<?php $total_beds = 0;  ?>
<?php $total_extra = 0; $booking_ar="" ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Booking</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
    <style>
        @font-face {
            font-family: "AGENCY";
            src: url("/fonts/AGENCY.TTF");
        }
        @font-face {
            font-family: "ROCC";
            src: url("/fonts/ROCCB___.TTF");
        }
        @font-face {
            font-family: "dl";
            src: url("/fonts/DeepLake-Regular.TTF");
        }

        body {
            background: rgb(204,204,204); 
            font-size: 18px;
        }

        .page{
            background-image: url('/img/ticket.png');
            background-size: 100% 100%;
            width: 21cm;
            height: 29.7cm; 
            margin: 0 auto;  
            padding: 110px 10px 0 10px;
        }
        .page p{
            font: 14px "Tahoma";
            line-height: 1.6;
        }

        .t1{
            text-align: center;
            margin-bottom: 10px;
            width: 100%;
        }
        table td{
            padding-top: 8px;
        }

        .dl {
         font-family: "dl";
        }

        .fnt {
            font-family: "AGENCY";
        }

        .rc {
         font-family: "ROCC";
        }

        .text-cb{
            color: #1b74a7;
        }
        .bg{
            background-color: #a7aeb0;
            
        }

        .header-1 {
            font-size: 20px;
            color: #020a11;
        }

    </style>
</head>
<body>
    <div class="page fnt">
        <table class="t1">
            <tr class="header-1">
                <td style="text-align: left;padding-left: 20px;">Booking Reference: <span class="dl">{{ $booking->number }}</span></td>
                <td style="width: 30%;"></td>
                <td>DATE OF ISSUE: {{$booking->created_at->format('j F Y')}}</td>
            </tr>
        </table>
        <table style="text-align: justify;">
            <tr>
                <td colspan="3">
                    <img style="width:100%" src="/img/ticket1.gif" alt="">
                </td>
            </tr>
            <tr>
                <td style="width:33%;padding-left: 20px;">
                    <p>Name: {{ $booking->office->admin?$booking->office->admin->name:'--' }} </p>
                    <p>Mobile: {{ $booking->office?$booking->office->phone:'--' }}</p>
                </td>
                <td style="width:45%;">
                    <table style="width:100%;">
                        @foreach ($booking->passengers() as $p) 
                        <?php $passenger = $p[0] ?>
                        <tr>
                            <td>{{$passenger->called.', '.$passenger->fullName}}  <span style="margin-left: 20px">{{$passenger->passport}} </span></td>
                        </tr>
                        @endforeach
                    </table>
                </td>
                <td>
                    <table style="width:100%;">
                        @foreach ($booking->passengers() as $passenger) 
                        <tr>
                            <td>
                              @foreach ($passenger as $ticket) 
                                @if(!$loop->first) / @endif
                               {{$ticket->ticket_number}}
                              @endforeach
                            </td>
                        </tr>
                        @endforeach
                    </table>
                </td>

            </tr>
        </table>
        @foreach ($booking->segments as $segment)
            @include('booking.print_one',['item'=>$segment])
        @endforeach
        <table style="width:100%" >
            <tr>
                <td class="text-cb bg" style="text-align: left; padding-left: 10px;border-radius: 3px;" colspan="7">
                   <span class="rc">ADDITIONALS ITEMS</span>: <span  style="padding-left: 30px;font-weight: 700;"> 
                   @foreach($booking->services as $item)
                   [ {{ $item->subject->name }} x {{ $item->quantity }} ({{ formatPrice($item->price) }})  ] 
                   @endforeach
                   </span>
                </td>
            </tr>
            <tr>
                <td  style="text-align: left; padding-left: 10px;border-radius: 3px;" colspan="7">
                    @foreach($booking->services as $item)
                        @if(!$loop->first) / @endif
                        {{$item->ticket_number}} 
                    @endforeach
                </td>
            </tr>
        </table>
        <table style="margin-top: 20px;align-items: center;" class="text-cb rc">
            <tr>
                <td colspan="2"> <img style="width:100%" src="/img/ticket6.gif" alt=""> </td>
            </tr>
            <tr>
                <td style="width:52%" >
                    <table style="width: 100%">
                        <tr>
                            <td></td>
                            <td>
                                PRICE:  <span class="fnt" style="font-weight: 700;"> {{  formatPrice($booking->total - $booking->total_service) }}</span>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: right;width:28%;font-size: 11px;">
                                ADDITIONALS
                            </td>
                            <td style="text-align: left;">
                                PRICE: <span class="fnt" style="font-weight: 700;">{{  formatPrice($booking->total_service) }}</span>
                            </td>
                        </tr>
                    </table>
                </td>
                <td>
                @if($booking->status=="E")
                    (Reissued)
                    @endif 
                </td>
            </tr>
            <tr>
                <td>        

                </td>
                <td>
                    Payment Amount: <span class="fnt" style="font-weight: 700;">{{  formatPrice($booking->total) }}</span>
                </td>
            </tr>
        </table>
    </div>
</body>
</html>