<!-- PAGE-INDEX-STARTS -->

<div class="breadcrumbs">
    <div class="breadcrumbs-inner">
        <?php
        if($this->session->flashdata('message')) {
        $message = $this->session->flashdata('message');
        ?>
            <div class="alert alert-<?php echo $message['class']; ?>">
                <button class="close" data-dismiss="alert" type="button">×</button>
                <?php echo $message['message']; ?>
            </div>
        <?php } ?>
        <div class="row m-0">
            <div class="col-sm-4">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><?= $pTitle ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-8">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li><a href="<?= base_url() ?>">Dashboard</a></li>
                            <li><a ><?= $menu ?></a></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- PAGE-INDEX-ENDS -->

<!-- PAGE-CONTENT-STARTS -->

<div class="content">
    <div class="animated fadeIn">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header">
                        <strong class="card-title"><?= $pDescription ?></strong>
                    </div>
                    <div class="card-body">
                        <table id="" class="table table-striped table-bordered dataTable-custom" data-ajax="Pos_booking/get_all_Pos_booking">
                            <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Booking ID</th>                                    
                                    <th>Customer Name</th>
                                    <th>Customer PhoneNo</th>
                                    <th>Cost</th>
                                    <th>Delivery Date</th>
                                    <th>Status</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- PAGE-CONTENT-ENDS -->
        
    <script type="text/javascript">        
        function doconfirm(){
            action = confirm("Are you sure to delete permanently?");
            if(action != true) return false;
        }

        function getBookDetails(bookingId){
          if(bookingId == '' || bookingId==undefined || bookingId == 'undefined' || bookingId == null || bookingId=='null'){
            return true;
          }
          modalTrigger('Booking Details','');
          addModalLoader();
          jQuery.ajax({
            url : base_url+"Pos_booking/getbookDetails",
            type : 'POST',
            data : {'bookId':bookingId,'view_all':'1'},
            success : function(resp){
              if(resp == '' || resp == undefined || resp == 'undefined' || resp == null || resp == 'null'){
                remModalLoader();
                jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
                return false;
              }

              var resp_data = jQuery.parseJSON(resp);
              if(resp_data['status'] == '0'){
                remModalLoader();
                jQuery('[id="modal_content"]').html('Something went wrong, Please try again later...!');
                return false;
              }

              var issueHtml = '';
              issueHtml +=  '<form id="customQuote" role="form" method="post">'+
                               '<div class="col-md-12" style="padding-top:10px">'+
                                '<div class="row"><label><b>Product Details</b></label></div>'+
                                '<div class="row">'+
                                    '<div class="col-md-6">'+
                                        '<div class="row">'+
                                            '<div class="col-md-6">Request Code</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].posReq_id+'</label></div>'+
                                        '</div> '+
                                    '</div>'+
                                    '<div class="col-md-6">'+
                                        '<div class="row">'+
                                            '<div class="col-md-6">Product Name</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].unique_name+'</label></div>'+
                                        '</div> '+
                                    '</div>'+
                                    '</div>'+
                                '</div>'+
                                '<div class="col-md-12" style="padding-top:20px;">'+
                                    '<div class="row"><label><b>Customer Details</b></label></div>'+
                                    '<div class="row">'+
                                    '<div class="col-md-6">'+
                                        '<div class="row">'+
                                            '<div class="col-md-6">Customer Name</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].customer_name+'</label></div>'+
                                        '</div> '+
                                        '<div class="row"> '+
                                            '<div class="col-md-6">Customer Ph No</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].phone_no+'</label></div> '+
                                        '</div> '+
                                    '</div>'+
                                    '<div class="col-md-6">'+
                                        '<div class="row"> '+
                                            '<div class="col-md-6">Customer Location</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].area+'</label></div> '+
                                        '</div> '+
                                    '</div>'+
                                    '<div class="col-md-12">'+
                                        '<div class="row"> '+
                                            '<div class="col-md-3">Customer Address</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-8"><label>'+resp_data['data'].name+', '+resp_data['data'].house_no+', '+resp_data['data'].area+', '+resp_data['data'].city+', '+resp_data['data'].country+'</label></div> '+
                                        '</div> '+
                                    '</div>'+
                                    '</div>'+
                                '</div> '+
                                '<div class="col-md-12" style="padding-top:20px;">'+
                                    '<div class="row"><label><b>Vehicle Details</b></label></div>'+
                                    '<div class="row">'+
                                    '<div class="col-md-6">'+
                                        '<div class="row">'+
                                            '<div class="col-md-6">Vehicle Make</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].make+'</label></div>'+
                                        '</div> '+
                                        '<div class="row">'+
                                            '<div class="col-md-6">Vehicle Year</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].year+'</label></div>'+
                                        '</div> '+
                                    '</div>'+
                                     '<div class="col-md-6">'+
                                         '<div class="row">'+
                                            '<div class="col-md-6">Vehicle Model</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].model+'</label></div>'+
                                        '</div> '+
                                         '<div class="row">'+
                                            '<div class="col-md-6">Vehicle mileage</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4"><label>'+resp_data['data'].mileage+'</label></div>'+
                                        '</div> '+
                                    '</div>'+
                                    '</div>'+
                                '</div> '+
                                '<div class="col-md-12">'+
                                 '<div class="row"><label><b>Amount Details</b></label></div>'+
                                 '<div class="row">'+
                                   '<div class="col-md-6">'+
                                       '<div class="row">'+
                                            '<div class="col-md-6"> Amount</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4">'+
                                              '<label>'+resp_data['data'].cost+'</label>'+
                                            '</div>'+
                                        '</div>'+
                                        '<div class="row">'+
                                            '<div class="col-md-6"> Margin</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4">'+
                                              '<label>'+resp_data['data'].margin+'</label>'+
                                            '</div>'+
                                        '</div>'+
                                    '</div>'+
                                    '<div class="col-md-6">'+
                                       '<div class="row">'+
                                            '<div class="col-md-6">VAT</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4">'+
                                              '<label>'+resp_data['data'].VAT+'</label>'+
                                            '</div>'+
                                        '</div>'+
                                        '<div class="row">'+
                                            '<div class="col-md-6">Total</div>'+
                                            '<div class="col-md-1">:</div>'+
                                            '<div class="col-md-4">'+
                                              '<label>'+resp_data['data'].total+'</label>'+
                                            '</div>'+
                                        '</div>'+
                                    '</div>'+
                                  '</div>'+
                                '</div>'+
                            '</form>';
              remModalLoader();
              jQuery('[id="modal_content"]').html(issueHtml);
            },
            fail: function(xhr, textStatus, errorThrown){
                remModalLoader();
                jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
            },
            error: function (ajaxContext) {
                remModalLoader();
                jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
            }
          })
        }

    </script>