<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Invoice Client</title>
    <link href="{{ base_path() . '/public/assets/vendor/bootstrap-5.0.2-dist/css/bootstrap.css' }}" rel="stylesheet">
    <style>
        @page {
            margin: 0;
        }

        * {
            /* margin: 0; */
            line-height: 1.2;
            color: #000;
        }

        /* html { margin: 0} */

        body {
            font-weight: 400;
            /* margin: 1.5cm 1cm 1cm 1cm; */
            margin: 0.5cm;
        }

        .word-break {
            word-wrap: break-word;
            overflow-wrap: break-word;
        }

        .page-break {
            page-break-after: always;
        }

        strong {
            font-weight: 1000;
        }

        table tr td,
        table tr th {
            font-size: 10pt;
        }

        .borderless td,
        .borderless th {
            border: none;
        }

        .p-2_5 {
            padding: 0.75rem;
        }

    </style>
</head>

<body>

    <hr class="my-1" style="border-bottom: 1px solid rgba(0, 0, 0, .1)">

    <h5>Invoice #{{ $order->ord_code }}</h5>

    <table class="table table-bordered border border-dark mb-3">
        <thead>
            <tr class="border border-dark">
                <th class="text-start p-2_5" colspan="2">Rincian Transaksi</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="text-start p-2_5 border border-dark" style="width:50%;">
                    <p class="mb-1">Bingkis Korporat</p>
                    <p>{{ env('BINGCORP_ADDR') }}</p>

                    <p class="mb-0">Telephone: {{ env('BINGCORP_PHONE') }}</p>
                    <p class="mb-0">Email: {{ env('BINGCORP_MAIL') }}</p>
                    <p class="mb-0">Website: {{ url('') }}</p>
                </td>
                <td class="text-start p-2_5 border border-dark" style="width:50%;">
                    <p class="mb-1">Tanggal Keluar:
                        {{-- {{ $_COOKIE['now_at'] == null || $_COOKIE['now_at'] == '' ? date('d M Y', time()) : $_COOKIE['now_at'] }} --}}
                        {{ date('d M Y', $order->crt) }}
                    </p>
                    <p class="mb-1">No Invoice: {{ $order->ord_code }}</p>
                    <p class="mb-1">Metode Pembayaran: Transfer via Rekening</p>
                    <p class="mb-1">Metode Pengiriman: Expedisi</p>
                </td>
            </tr>
        </tbody>
    </table>

    <table class="table table-bordered border border-dark mb-3">
        <thead>
            <tr>
                <th class="text-start p-2_5 border border-dark">Alamat Pembayaran</th>
                <th class="text-start p-2_5 border border-dark">Alamat Pengiriman</th>
                <th class="text-start p-2_5 border border-dark">Tanggal Pengiriman</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="text-start p-2_5 border border-dark">
                    <p class="mb-1">{{ $order->c_pt_name }}</p>
                    <p>{{ $order->c_pt_addr }}</p>
                </td>
                <td class="text-start p-2_5 border border-dark">
                    <p class="mb-1">{{ $order->drop_name }}</p>
                    <p>{{ $order->drop_addr }}</p>
                </td>
                <td class="text-start p-2_5 border border-dark">
                    {{-- {{ $_COOKIE['now_at'] == null || $_COOKIE['now_at'] == '' ? date('d M Y', time()) : $_COOKIE['now_at'] }} --}}
                    {{ date('d M Y', $order->going_at) }}
                </td>
            </tr>
        </tbody>
    </table>

    <table class="table table-bordered border border-dark" style="margin-top:10px;min-height:3cm">
        <thead>
            <tr>
                <th class="p-2 border border-dark text-end">No</th>
                <th class="p-2 border border-dark text-center">Code</th>
                <th class="p-2 border border-dark text-center">Desc</th>
                <th class="p-2 border border-dark text-end">Weight (kg)</th>
                <th class="p-2 border border-dark text-end">Volume (M&sup3;)</th>
            </tr>
        </thead>
        <tbody>
            @php
                $total_harga_jual = 0;
                $total_komisi = 0;
            @endphp

            @foreach ($items as $k => $v)
                <tr>
                    <td class="p-1 border border-dark text-end">{{ $k + 1 }}</td>
                    <td class="p-1 border border-dark text-center">{{ $v->item_code }}
                    </td>
                    <td class="p-1 border border-dark text-start">{{ $v->desc }}</td>
                    <td class="p-1 border border-dark text-end">{{ $v->weight }}</td>
                    @php
                    $vol = $v->volume;
                    $vol_cm3 = ($v->length * $v->wide * $v->height) / 1000000;
                    if ($vol_cm3 > $v->volume) {
                        $vol = $vol_cm3;
                    }
                    @endphp
                    <td class="p-1 border border-dark text-end">{{ $vol }}</td>
                </tr>
            @endforeach
            <tr>
                <th class="p-2 border border-dark text-end" colspan="4">Lead Time</th>
                <th class="p-2 border border-dark text-end">{{ $order->lead_time }} Day</th>
            </tr>
            <tr>
                <th class="p-2 border border-dark text-end" colspan="4">Total Tunggakan</th>
                <th class="p-2 border border-dark text-end">Rp{{ number_format($order->price, 0, ',', '.') }}</th>
            </tr>
        </tbody>
    </table>

    <table class="table table-bordered" style="margin-top:10px;min-height:3cm">
        <thead>
            <tr>
                <th class="text-start p-2_5 border border-dark">NOREK BCA</th>
                <th class="text-start p-2_5 border border-dark">NOREK BRI</th>
                <th class="text-start p-2_5 border border-dark">NOREK BNI</th>
                <th class="text-start p-2_5 border border-dark">NOREK MANDIRI</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="text-start p-2_5 border border-dark">...</td>
                <td class="text-start p-2_5 border border-dark">...</td>
                <td class="text-start p-2_5 border border-dark">...</td>
                <td class="text-start p-2_5 border border-dark">...</td>
            </tr>
        </tbody>
    </table>

</body>

</html>
