@extends('layouts.base_pdf')

@section('inner_content')

    <br>
    <htmlpageheader name="page-header">
        <br><br>
        <div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
    </htmlpageheader>

    <table>
        <!-- Header Section -->
        <tr>
            <td class="header-logo">
                <img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
            </td>
            <td class="header-cief-address">
                <span class="company-name"><strong>CIEF WORLDWIDE SDN BHD</strong></span>
                <span class="company-reg">(1134596-M)</span><br>
                No. 72-3, Jalan Jalil 1,<br>
                The Earth Bukit Jalil,<br>
                57000 Kuala Lumpur<br>
                Tel: 03-8082 1252
            </td>
            <td class="header-details">
                <div class="title"><strong>Invoice</strong></div>
                <div class="number">EI#: {{ $transaction->bill_no }}</div>
                <div class="ref">Ref# {{ $po_order_transaction->booking->marking }}</div>
                <div class="date">Date: {{ $document_date }}</div>
                <div>&nbsp;</div>
            </td>
        </tr>
        <tr>
            <td colspan="3" class="bill-to">
                <span class="sub-title">Bill To</span>
            </td>
        </tr>
        <tr>
            <td colspan="3" class="address">
                <div class="label">{{ $supplier->name }}</div>
                @php
                    $billingAddress = $supplier->addresses()->where('billing', '=', true)->first();
                @endphp
                <div class="address">
                    {{ $billingAddress->street_one }}
                    {{ $billingAddress->street_two }},
                    {{ $billingAddress->district()->first()->name }},
                    {{ $billingAddress->postcode }}
                    {{ $billingAddress->state()->first()->name }},
                    {{ $billingAddress->country()->first()->name }}
                </div>
                <div>Phone: {{ $supplier->contacts()->first()->phone }}</div>
            </td>
        </tr>
    </table>

    <br>
    <br>

    <!-- Invoice Table -->
    @include('pages.pdfs.purchase_order_table')

    <br>
    <div class="note">
        <strong>Note:</strong> All items purchased are subject to our Terms & Conditions. Please refer to our official website for more information.
    </div>
    <br><br>
    <div class="bank-info">
        Please transfer the payment to:<br>
        Bank: Maybank Berhad<br>
        Account Name: CIEF Worldwide Sdn Bhd<br>
        Account No: 568603010762<br>
    </div>
    <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
