@extends('layouts.base_pdf')
@section('inner_content')
    <br>
    <htmlpageheader name="page-header">
        <br><br>
        <div class="separator"><strong><i>{{ $po_order_transaction->bill_no }}</i></strong></div>
    </htmlpageheader>
    <br>
    <table>
        <tr>
            <td class="title">
                <strong>Purchase Order</strong>
            </td>
            <td class="document-detail">
                PO#: {{ $po_order_transaction->bill_no }} <br>
                Ref#: {{ $po_order_transaction->booking->marking }} <br>
                Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->booking->created_at }}
            </td>
        </tr>
    </table>

    <br>

    <table class="buyer-seller">
        <tr>
            <td width="50%" class="top">
                <span class="buyer-seller-title">
                    Buyer
                </span>
                <br>

                <div class="buyer-company">
                    Marking#: {{ $po_order_transaction->booking->marking }}
                </div>

                <span class="buyer-company">
                    {{ $supplier->name }}
                </span>
                <span class="reg">
                    {{-- {{ $supplier }} --}}
                </span>
                <br>
                <span class="address">
                    @php
                        $billingAddress = $supplier->addresses()->where('billing', '=', true)->first();
                    @endphp
                    {{ $billingAddress->street_one }}
                    {{ $billingAddress->street_two }}
                    {{ $billingAddress->state()->first()->name }}
                    {{ $billingAddress->district()->first()->name }}
                </span>
                <br>
                <span class="contact-no">
                    Phone: {{ $supplier->contacts()->first()->phone }}
                </span>
            </td>
            <td width="50%" class="top">
                <span class="buyer-seller-title">
                    Seller
                </span>
                <br>
                <span class="buyer-company">
                    CIEF Worldwide Sdn Bhd (1134596-M)
                </span>
                <div class="address">
                    No. 72-3, Jalan Jalil 1,<br>
                    The Earth Bukit Jalil,<br>
                    57000 Kuala Lumpur
                </div>
                <div class="contact-no">
                    Tel: 03-8082 1252
                </div>
            </td>
        </tr>
    </table>

    <br>

    @if($e_invoice_started_for_booking)
        @include('pages.pdfs.purchase_order_table_v2')
    @else
        @include('pages.pdfs.purchase_order_table')
    @endif

    <htmlpagefooter name="page-footer">
        <table width="100%">
            <tr>
                <td style="text-align: right; ">This is generated by computer. No signature required.</td>
                <td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
            </tr>
        </table>
    </htmlpagefooter>
@endsection
