 <?php  
require 'admin/config/function.php';

 if(isset($_POST['check_in'])) {
   
   $check_out = $_POST['check_out'];
    $check_in = $_POST['check_in'];
      $heading = $_POST['heading'];
      $check_out = $_POST['check_out'];
       $stay = $_POST['stay'];
        $n_price = $_POST['n_price'];
       $w_price = $_POST['w_price'];
        $g_price = $_POST['g_price'];

 }
?>
<!doctype html>
<html lang="en">

<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>GetQuotes--Blue Corel</title>
  <!-- Bootstrap CSS -->
 <?php include 'inc/link.php';?>
</head>

<body>

  <!-- navbar start here -->
 <?php include 'inc/header.php';?>
  <!-- navbar end here -->

 <main>
    <section>
        <div class="container mt-3">
            <h2>
                <?=$heading?> : Booking Quote
            </h2>
            <div class="responsive-table mt-5" style="font-size: 20px;">
                <table class="table">
                    <thead>
                        <tr>
                            <th>Check In</th>
                            <th>Check Out</th>
                            <th>Min Stay</th>
                            <th>Total Nights</th>
                            <th>Nightly</th>
                            <th>Weekly</th>
                            <th>Gross Amount</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td><?= date("d M Y", strtotime($check_in)) ?></td>
                            <td><?= date("d M Y", strtotime($check_out)) ?></td>
                            <td>Nights</td>
                            <td>
                              <?php
$check_in_date = strtotime($check_in);
$check_out_date = strtotime($check_out);

// Calculate the difference in seconds
$diff_seconds = $check_out_date - $check_in_date;

// Convert the difference to days and subtract 1
$diff_days = floor($diff_seconds / (60 * 60 * 24)) - 1; // Subtracting 1 day for the night before check-out

// Display the number of nights
echo $diff_days;
?>
                            </td>
                            <td>₹ <?=$n_price?>.00</td>
                            <td>₹ <?=$w_price?>.00</td>
                            <td>₹ <?=$g_price?>.00</td>
                        </tr>
                        <tr>
                            <td colspan="6">Net Payable Amount</td>
                            <td>₹ <?=$n_price + $w_price + $g_price?>.00</td>
                        </tr>
                    </tbody>
                </table>
            </div>
<hr>
            <form action="">
                <div class="card  p-4 border-0 shadow justify-content-center mt-5">
                    <div class="row">
                        <div class="col-md-2">
                            <label for="" class="form-label"> <strong>Name</strong></label>
                        </div>
                        <div class="col-md-9">
                            <input type="text" class="form-control form-control-lg mb-3" placeholder="Your Name" required>
                        </div>
                        <div class="col-md-2">
                            <label for="" class="form-label"> <strong>Email</strong></label>

                        </div>
                        <div class="col-md-9">
                            <input type="email" class="form-control form-control-lg mb-3" placeholder="Your Email" required>
                        </div>
                        <div class="col-md-2">
                            <label for="" class="form-label"> <strong>Phone</strong></label>
                        </div>
                        <div class="col-md-9">
                            <input type="email" class="form-control form-control-lg mb-3" placeholder="Your Number" required>

                        </div>
                        <div class="col-md-2">
                            <label for="" class="form-label"> <strong>Guests</strong></label>

                        </div>
                        <div class="col-md-9">
                            <input type="email" class="form-control form-control-lg mb-3">

                        </div>
                        <div class="col-md-2">
                            <label for="" class="form-label"> <strong>Address</strong></label>
                        </div>
                        <div class="col-md-9">
                            <input type="email" class="form-control form-control-lg mb-3" placeholder="Your Address" required>

                        </div>
                        <div class="col-md-2">
                            <label for="" class="form-label"> <strong>Additional Address</strong></label>

                        </div>
                        <div class="col-md-9">
                            <textarea class="form-control" id="" cols="30" rows="3" placeholder="Write message..."></textarea>
                        </div>
                    </div>
                    <div class="d-flex justify-content-center mt-3">
                        <button class="btn me-2" type="submit" style="background-color: black; color: white; padding: 15px 40px;">SUBMIT ENQUIRY</button>
                        <input type="text" class="form-control form me-2" placeholder="Enter code" style="width: 6vw; display: none;" id="EnterCodeInput">
                        <button class="btn" type="button" style="background-color: blue; color: white; padding: 15px 40px;" onclick="EnterCode()" id="Code">SEQUIRY CODE</button>
    
                    </div> 
                </div>
                 
            </form>
           
        </div>
    </section>
 </main>


<?php include 'inc/footer.php';?>
  <script>
      // show enter code input
      var EnterCodeInput= document.querySelector("#EnterCodeInput");
      var Code= document.querySelector("#Code");

     function EnterCode(){
        if (EnterCodeInput.style.display === "none") {
          EnterCodeInput.style.display = "block";
          Code.innerHTML = "CHECK CODE";
          } else {
            EnterCodeInput.style.display = "none";
            Code.innerHTML = "SEQUIRY CODE";
          }
      }
  </script>
</body>

</html>