<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="<?php echo base_url('public/css/bootstrap/bootstrap.min.css'); ?>" rel="stylesheet">
    <script src="<?php echo base_url('public/js/jquery3.6.0.js'); ?>"></script>
    <style>
        @media print {
    .container,
    .container-fluid {
        width: 100% !important;
    }

    .row,
    .col,
    [class*="col-"] {
        float: none !important;
        width: 100% !important;
        display: block !important;
    }
}
</style>

</head>

<body>
    <?php
    $sessiondata = \Config\Services::session();
    ?>
    <div class="container-fluid">
        <div class="row">
            <div class="col-12 "><?php
                // Load the model within the view
                use Modules\Fleet\Models\VehicleModel;

                    // Initialize the model
                $vehicleModel = new VehicleModel();

                // Fetch the vehicle data
                $vhicalname = $vehicleModel->find($ticket->vehicle_id);
            ?>
              <h6 class="text-center"><b><?php echo  $sessiondata->get('logotext'); ?></b></h6>
            <h6 class="text-center">Company : <?php echo $company_name??""; ?></h6>
                <h6 class="text-center"> <?php echo $from; ?> (<small><?php echo $trip_start_time; ?></small>) - <?php echo $to; ?> <small><?php //echo $trip_end_time; ?></small> </h6>

                <div class="table-responsive">
                    <table class="table table-bordered" id="">

                        <tbody>

                            <tr>
                                <td>
                                    <b><?php echo lang("Localize.pick_up") ?> <?php echo lang("Localize.location") ?> : </b>
                                    <?php foreach ($pickdrop as $pickvalue) : ?>
                                        <?php if ($pickvalue->pickdropid == $ticket->pick_stand_id) : ?>
                                            <?php echo  $pickvalue->stand_name; ?> (<small><?php echo  $pickvalue->time; ?></small>)
                                        <?php endif ?>
                                    <?php endforeach ?>
                                </td>
                                <td>
                                    <b><?php echo lang("Localize.drop") ?> <?php echo lang("Localize.location") ?> : </b>
                                    <?php foreach ($pickdrop as $pickdropvalue) : ?>
                                        <?php if ($pickdropvalue->pickdropid == $ticket->drop_stand_id) : ?>
                                            <?php echo  $pickdropvalue->stand_name; ?> (<small><?php echo  $pickdropvalue->time; ?></small>)
                                        <?php endif ?>
                                    <?php endforeach ?>
                                </td>
                                <td>
                                    <b><?php echo lang("Localize.booking") ?> <?php echo lang("Localize.date") ?> :</b>
                                    <?php echo date("Y-F-d", strtotime($ticket->bookingdate)); ?>
                                </td>
                                <td>
                                    <b><?php echo lang("Localize.journey") ?> <?php echo lang("Localize.date") ?> :</b>
                                    <?php echo date("Y-F-d", strtotime($ticket->journeydata)); ?>
                                </td>

                            </tr>

                        </tbody>
                    </table>
                </div>

                <!-- <div class="row">
                    <div class="col text-start">
                        <h6><b><?php echo lang("Localize.passanger") ?> <?php echo lang("Localize.name") ?> : </b><?php echo $ticket->first_name; ?> <?php echo $ticket->last_name; ?></h6>
                        <h6><b><?php echo lang("Localize.mobile") ?> : </b> <?php echo $ticket->login_mobile; ?> </h6>
                        <h6><b><?php echo lang("Localize.email") ?> : </b> <?php echo $ticket->login_email; ?> </h6>
                        <h6><b><?php echo lang("Localize.facility") ?> : </b><?php echo $facility; ?></h6>

                    </div>
                    <div class="col text-end">
                        <h6><b><?php echo lang("Localize.booking") ?> <?php echo lang("Localize.id") ?> : </b><?php echo $ticket->booking_id; ?></h6>
                        <h6><b><?php echo lang("Localize.trip") ?> <?php echo lang("Localize.start") ?> : </b>
                            <?php echo $travelerPick; ?>
                        </h6>
                        <h6><b><?php echo lang("Localize.trip") ?> <?php echo lang("Localize.end") ?> : </b>
                            <?php echo $travelerDrop; ?>
                        </h6>
                        <h6><b><?php echo lang("Localize.payment") ?> <?php echo lang("Localize.status") ?> : </b> <?php echo $ticket->payment_status; ?> </h6>

                    </div>

                </div> -->
                <table style="width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;">
                  <tr>
                    <td style="width: 50%; vertical-align: top;">
                      <p><b><?= lang("Localize.passanger") ?> <?= lang("Localize.name") ?>:</b> <?= $ticket->first_name . ' ' . $ticket->last_name; ?></p>
                      <p><b><?= lang("Localize.mobile") ?>:</b> <?= $ticket->login_mobile; ?></p>
                      <p><b><?= lang("Localize.email") ?>:</b> <?= $ticket->login_email; ?></p>
                      <p><b><?= lang("Localize.facility") ?>:</b> <?= $facility; ?></p>
                    </td>
                    <td style="width: 50%; vertical-align: top; text-align: right;">
                      <p><b><?= lang("Localize.booking") ?> <?= lang("Localize.id") ?>:</b> <?= $ticket->booking_id; ?></p>
                      <p><b><?= lang("Localize.trip") ?> <?= lang("Localize.start") ?>:</b> <?= $travelerPick; ?></p>
                      <p><b><?= lang("Localize.trip") ?> <?= lang("Localize.end") ?>:</b> <?= $travelerDrop; ?></p>
                      <p><b><?= lang("Localize.payment") ?> <?= lang("Localize.status") ?>:</b> <?= $ticket->payment_status; ?></p>
                    </td>
                  </tr>
                </table>


                <div class="table-responsive">
                    <table class="table table-bordered" id="">
                        <thead>
                            <tr>
                                <th scope="col"><?php echo lang("Localize.seat") ?> </th>
                                <th scope="col"><?php echo lang("Localize.seat") ?> <?php echo lang("Localize.number") ?> </th>
                                <th scope="col"><?php echo lang("Localize.amount") ?> </th>
                            </tr>
                        </thead>
                        <tbody>

                            <tr>
                                <td>
                                    <?php echo implode(",", $seat_class); ?>
                                </td>
                                <td>
                                    <?php echo  $ticket->seatnumber; ?>
                                </td>
                                <td class="text-end">
                                    <?php echo  $sessiondata->get('currency_symbol'); ?> <?php echo  round($ticket->price, 2); ?>
                                </td>

                            </tr>

                            <tr>
                                <td colspan="2" class="text-end">
                                    <?php echo $invoice_discount_label ?? lang("Localize.discount") ?>
                                </td>
                                <td class="text-end">
                                    <?php echo  $sessiondata->get('currency_symbol'); ?> <?php echo  round($invoice_discount_amount ?? $ticket->discount, 2); ?>
                                </td>
                            </tr>

                            

                            <tr>
                                <td colspan="2" class="text-end">
                                    <?php echo lang("Localize.grand") ?> <?php echo lang("Localize.total") ?>
                                </td>
                                <td class="text-end">
                                    <?php echo  $sessiondata->get('currency_symbol'); ?> <?php echo  $ticket->paidamount; ?>
                                </td>
                            </tr>

                            <?php if ($ticket->payment_status != "paid") : ?>

                                <tr>
                                    <td colspan="2" class="text-end">
                                        <?php echo lang("Localize.total") ?> <?php echo lang("Localize.paid") ?>
                                    </td>
                                    <td class="text-end">
                                        <?php echo  $sessiondata->get('currency_symbol'); ?> <?php echo ((int)$ticket->paidamount - (int)$due); ?>
                                    </td>
                                </tr>

                                <tr>
                                    <td colspan="2" class="text-end">
                                        <?php echo lang("Localize.total") ?> <?php echo lang("Localize.due") ?>
                                    </td>
                                    <td class="text-end">
                                        <?php echo  $sessiondata->get('currency_symbol'); ?> <?php echo  $due; ?>
                                    </td>
                                </tr>

                            <?php endif ?>

                        </tbody>
                    </table>
                </div>

               <div class="row">
                <div class="col-12">
                    
                        <small><?php echo $invocount ?></small>
                        <small><?php echo $policy ?></small>
                    
                </div>

            </div>

            </div>

        </div>
    </div>

</body>

<script src="<?php echo base_url('public/js/bootstrap/js/bootstrap.bundle.min.js'); ?>"></script>
<script type="text/javascript">
    $(document).ready(function() {
        window.print();
        setTimeout(function() {
                $('#content').append('<p>second print.</p>');
                // Trigger the second print
                window.print();
            }, 1000); // Delay to ensure the first print dialog is completed
    });
</script>

</html>