<div id="pendingBookingBox" class="modal modal-message modal-danger fade" style="display: none;" aria-hidden="true">
    <div class="modal-dialog" style="left: 0%!important;  width: 50%!important;">
        <div class="modal-content">
            <div class="modal-header">
                <div class="modal-title">
                    <div class="col-lg-11 col-md-11 col-sm-11">New Booking </div>
                    <div class="col-lg-1 col-md-1 col-sm-1 close" data-dismiss="modal" aria-label="Close" style="cursor: default"><i class="fa fa-close" aria-hidden="true"></i></div>
                </div>
            </div>
            <div class="modal-body" style="height: 50%;">
                <table class="table table-bordered table-responsive">
                    <tr>
                        <td style="width: 40%" class="text-right">Name</td>
                        <td class="text-left text-capitalize"><?php echo $booking[0]->first_name . ' ' . $booking[0]->last_name ?></td>
                    </tr>
                    <tr>
                        <td style="width: 40%"class="text-right">Email</td>
                        <td class="text-left"><?php echo $booking[0]->res_email ?></td>
                    </tr>
                    <tr>
                        <td class="text-right">Phone</td>
                        <td class="text-left"><?php echo $booking[0]->res_phone ?></td>
                    </tr>
                    <tr>
                        <td class="text-right">Date</td>
                        <td class="text-left"><?php echo date($this->config->item('dateformat'), strtotime($booking[0]->res_date))  ?></td>
                    </tr>
                    <tr>
                        <td class="text-right">Time</td>
                        <td class="text-left"><?php echo $booking[0]->time_from ?></td>
                    </tr>
                    <tr>
                        <td class="text-right">Guest</td>
                        <td class="text-left"><?php echo $booking[0]->guest_number ?></td>
                    </tr>
                    <tr>
                        <td class="text-right">Customer Message</td>
                        <td class="text-left"><?php echo $booking[0]->res_message ?></td>
                    </tr>
                </table>
                <div class="button-group text-center" style="margin: 20px;">
                    <button class="btn btn-success round" style="width: 120px" onclick="updateBookingStatus('<?php echo $booking[0]->id ?>', '1')">Confirm</button>
                    <button class="btn btn-danger round" style="width: 120px" onclick="updateBookingStatus('<?php echo $booking[0]->id ?>', '2')">Reject</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function updateBookingStatus(id, status) {
        $.ajax({
            url: '<?php echo site_url("gkpos/booking/reaction") ?>',
            data: {
                id: id,
                status: status
            },
            type: "POST",
            dataType: "json",
            success: function (output) {
                if (output.success) {
                    $('#pendingBookingBox').modal('hide');
                    $('#latestPendingOrder').html('');
                    ALERT_TITLE = "<?php echo $this->lang->line('gkpos_alert_title_success') ?>";
                    alert('updated successfully');
                } else {
                    ALERT_TITLE = "<?php echo $this->lang->line('gkpos_alert_title_error') ?>";
                   alert('update failed');
                }
            }
        });
    }
</script>