<?php
include_once('inc.function.php');

$MESSAGE_FAILURE =   '<blockquote>
                      <h1>
                          <div class="alert alert-danger" role="alert"><span class="glyphicon glyphicon-remove-sign"></span> It seems that your session is expired, please reselect appropriate date and pax.</div>
                      </h1>
                      <br>
                      <br>
                    </blockquote>';

if(empty($_SESSION['ITEM_SELECTED'])) { header('Location: booking.php'); }
if(empty($_SESSION['START_DATE']) || empty($_SESSION['END_DATE']) || empty($_SESSION['PAX'])) { $_SESSION['MESSAGE'] = $MESSAGE_FAILURE; header('Location: index.php'); die(); }
include_once('confdb.php');
include_once('header.php');
?>

   <!-- Begin page content -->
    <div class="container">
      <div class="page-header">
        <h1><img src='img/logo.jpg'/>&nbsp ONLINE BOOKING</h1>
      </div>
      <!-- CONTENT STARTS HERE -->
      <div class="stepwizard">
          <div class="stepwizard-row setup-panel">
              <div class="stepwizard-step">
                  <a href="index.php" type="button" class="btn btn-success btn-circle">1</a>
                  <p>Venue Search</p>
              </div>
              <div class="stepwizard-step">
                  <a href="booking.php" type="button" class="btn btn-success btn-circle">2</a>
                  <p>Venue Booking</p>
              </div>
              <div class="stepwizard-step">
                  <a href="booking_event.php" type="button" class="btn btn-success btn-circle">3</a>
                  <p>Event Detail</p>
              </div>
              <div class="stepwizard-step">
                  <a href="booking_contact.php" type="button" class="btn btn-success btn-circle">4</a>
                  <p>Contact Info</p>
              </div>
              <div class="stepwizard-step">
                  <a href="booking_address.php" type="button" class="btn btn-success btn-circle">5</a>
                  <p>Mailing Address</p>
              </div>
              <div class="stepwizard-step">
                  <a href="#step-6" type="button" class="btn btn-warning btn-circle">6</a>
                  <p>Booking Submission</p>
              </div>
          </div>
      </div>

      <div class="progress">
        <div class="progress-bar progress-bar-striped progress-bar-success active" role="progressbar"
        aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%">
          100%
        </div>
      </div>

        <div class="row setup-content" id="step-6">
            <div class="col-xs-12">
                <div class="col-md-12">
                    <h3> Step 6: Event Summary</h3>
                    <br>
                    <?php if(!empty($_SESSION['MESSAGE'])) { echo $_SESSION['MESSAGE'].'<br>';  unset($_SESSION['MESSAGE']); } ?>

                    <form role="form" method="POST" action="booking_submission_process.php"> 
                        <input type='hidden' name="STATUS" id="STATUS" value="CONFIRM">
                        <button type="submit" class="btn btn-primary btn-lg pull-right">Submit Booking</button>
                    </form>
                    <br><br><br>
                    

                    <div class="alert alert-success" role="alert">Contact Information:</div>

                      <table class="table table-striped table-bordered table-hover">
                        <tbody>
                            <tr><td width='30%'>Name:</td><td><?php echo $_SESSION['CLIENT_NAME']; ?></td></tr>
                            <tr><td>Telephone:</td><td><?php echo $_SESSION['CUST_COUNTRY_CALLING_CODE'].' - '.$_SESSION['CLIENT_TELEPHONE']; ?></td></tr>
                            <tr><td>Handphone:</td><td><?php echo $_SESSION['CUST_COUNTRY_CALLING_CODE'].' - '.$_SESSION['CLIENT_TELEPHONE2']; ?></td></tr>
                            <tr><td>Fax:</td><td><?php echo $_SESSION['CUST_COUNTRY_CALLING_CODE'].' - '.$_SESSION['CLIENT_FAX']; ?></td></tr>
                            <tr><td>Email:</td><td><?php echo $_SESSION['CLIENT_EMAIL']; ?></td></tr>
                        </tbody>
                      </table>

                      <br>
                      <div class="alert alert-warning" role="alert">Mailing Address:</div>

                      <table class="table table-striped table-bordered table-hover">
                        <tbody>
                            <tr><td width='30%'>Address 1:</td><td><?php echo $_SESSION['ADDRESS_1']; ?></td></tr>
                            <tr><td>Address 2:</td><td><?php echo $_SESSION['ADDRESS_2']; ?></td></tr>
                            <tr><td>Country:</td><td><?php echo $_SESSION['CUST_COUNTRY_NAME']; ?></td></tr>
                            <tr><td>State:</td><td><?php echo $_SESSION['CUST_STATES_NAME']; ?></td></tr>
                            <tr><td>City:</td><td><?php echo $_SESSION['CUST_CITY']; ?></td></tr>
                            <tr><td>Postcode:</td><td><?php echo $_SESSION['CUST_POSTCODE']; ?></td></tr>
                            <?php 
                                  if(!empty($_SESSION['COMPANY_NAME'])){ 
                                      echo '<tr><td>Company Name:</td><td>'.$_SESSION['COMPANY_NAME'].'</td></tr>';
                                  }
                            ?>     
                        </tbody>
                      </table>

                      <br>
                      <div class="alert alert-danger" role="alert">Event Details:</div>

                      <table class="table table-striped table-bordered table-hover">
                        <tbody>
                            <tr><td width='30%'>Pax:</td><td><?php echo $_SESSION['PAX']; ?></td></tr>
                            <tr><td>Start Date:</td><td><?php echo date('d-m-Y', strtotime($_SESSION['START_DATE'])).' ('.date('l', strtotime($_SESSION['START_DATE'])).')'; ?></td></tr>
                            <tr><td>End Date:</td><td><?php echo date('d-m-Y', strtotime($_SESSION['END_DATE'])).' ('.date('l', strtotime($_SESSION['END_DATE'])).')'; ?></td></tr>
                            <tr><td>Event Name:</td><td><?php echo $_SESSION['EVENT_NAME']; ?></td></tr>
                            <tr><td>Event Type:</td><td><?php echo $_SESSION['EVENT_TYPE_DISPLAY']; ?></td></tr>
                            <!--<tr><td>Event Segment:</td><td><?php echo $_SESSION['EVENT_SEGMENT_DISPLAY']; ?></td></tr>-->
                            <tr><td>Event Industry:</td><td><?php echo $_SESSION['EVENT_INDUSTRY_DISPLAY']; ?></td></tr>
                        </tbody>
                      </table>

                      <br>
                      <div class="alert alert-success" role="alert">Hall Venue:</div>

                    <table class="table table-striped table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th class="center">Item Selected</th>
                                    <th class="center">Layout</th>
                                    <th class="center">Capacity</th>
                                    <th class="center">Action</th>
                               </tr>
                            </thead>
                            <tbody>
                              <?php
                                  foreach ( $_SESSION['ITEM_SELECTED'] AS $row_session ) 
                                  {  
                                    $CART_ID = $row_session['SETUP_ID'];
                                    $FAC_MODAL[] = $row_session['SETUP_ID'];
                                ?>
                                      <tr>
                                        <td class="center"><?php echo $row_session['ITEM_DESCRIPTION']; ?></td>
                                        <td class="center"><?php echo $row_session['SETUP_LAYOUT']; ?></td>
                                        <td class="center"><?php echo $row_session['SETUP_CAPACITY']; ?></td>
                                        <td class="center"><a href="#RemoveCart<?php echo $CART_ID; ?>" class="hidden-sm" data-toggle="modal"><button type="button" class="btn btn-danger btn-sm"><i class="fa fa-trash-o"></i>Remove</button></a></p></td>
                                      </tr>
                                      <?php 
                                  }
                                ?>
                            </tbody>
                        </table>
 
                </div>
            </div>
        </div>


       <?php
            foreach ($FAC_MODAL as $key => $val) {
       ?>

       <form method="POST" action="delete_cart.php">
          <input type="hidden" name="PAGE_ID" id="PAGE_ID" value="2">
          <input type="hidden" name="SETUP_ID" id="SETUP_ID" value="<?php echo $val; ?>">
            <!-- Modal Add Layout -->
            <div id="RemoveCart<?php echo $val; ?>" class="modal fade">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                           <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title">Cart Removal </h4>
                            </div>
                                 <div class="modal-body">

                                  <p>Are you sure you want to remove this cart?</p>

                                 </div>
                        <div class="modal-footer">
                                <button type="button" class="btn btn-default btn-lg" data-dismiss="modal">Cancel</button>
                                <input type="submit" class="btn btn-danger btn-lg" value="Remove" />
                       </div>
                    </div>
                </div>
            </div>
        </form>
                        
        <?php
             }
        ?>

      <!-- CONTENT ENDS HERE -->
    </div>

<?php include_once('footer.php'); ?>