<!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>DELIVERY ORDER</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;
        }

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

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

        strong {
            font-weight: 1000;
        }

    </style>
</head>

<body>

    <table class="table mb-1">
        <tbody>
            <tr>
                <td>
                    <p style="margin:0 0 1rem 0.25rem;font-size:24px;"><strong>DELIVERY ORDER</strong></p>
                </td>
                <td class="text-end"><img src="{{ base_path() . '/public/images/bonceng-red.png' }}"
                        alt="PT. BONCENG INDONESIA" style="margin:0 1.5rem 0 0;"></td>
            </tr>
        </tbody>
    </table>

    <table class="table mb-0">
        <tbody>
            <tr>
                <td style="width:45%;">
                    <table class="table mb-0">
                        <tbody>
                            <tr>
                                <td style="width:28%;">No. Proyek</td>
                                <td style="width:5%;">:</td>
                                <td style="font-size:15px;background:#EBF1DE;"><strong>{{ $order->ord_code }}</strong>
                                </td>
                            </tr>
                            <tr>
                                <td>No. DO</td>
                                <td>:</td>
                                <td>
                                    <table class="table mb-0">
                                        <tr>
                                            <td style="width:20%;">DO-</td>
                                            <td style="width:40%;">{{ $order->ord_code }}</td>
                                            <td style="background:#EBF1DE;">
                                                @if ($order->drop_chk_at != 0)
                                                    Rev.03
                                                @elseif ($order->pck_chk_at != 0)
                                                    Rev.02
                                                @elseif ($order->pck_chk_at == 0)
                                                    Rev.01
                                                @endif
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>Tanggal DO</td>
                                <td>:</td>
                                {{-- <td>{{ $_COOKIE['now_at'] == null || $_COOKIE['now_at'] == '' ? date('d M Y', time()) : $_COOKIE['now_at'] }} --}}
                                <td>{{ date('d M Y', time()) }}
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">&nbsp;</td>
                            </tr>
                            <tr>
                                <td>Nama Proyek</td>
                                <td>:</td>
                                <td>Pengiriman Logistik</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td style="width:55%;padding-left:1rem;">
                    <table class="table table-bordered border border-dark mb-0">
                        <tbody>
                            <tr>
                                <td colspan="3">
                                    <p style="margin:0 0 0 0;font-size:15px;"><strong>BARANG DIKIRIM KE :</strong></p>
                                </td>
                            </tr>
                            <tr class="border-bottom border-dark">
                                <td style="width:10%;">Alamat</td>
                                <td style="width:10%;">:</td>
                                <td style="background:#EBF1DE;">{{ $order->drop_name }} <br>
                                    {{ $order->drop_addr }}</td>
                            </tr>
                            <tr>
                                <td>CP</td>
                                <td>:</td>
                                <td style="background:#EBF1DE;">{{ $order->drop_pic_name }}</td>
                            </tr>
                            <tr>
                                <td>No.HP</td>
                                <td>:</td>
                                <td style="background:#EBF1DE;">0{{ $order->drop_pic_phone_val }}</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>

    <table class="table mb-2">
        <tbody>
            <tr>
                <td style="width:45%;">
                    <table class="table mb-0">
                        <tbody>
                            <tr>
                                <td colspan="3">
                                    <p style="margin:0 0 0 0;font-size:15px;"><strong>CLIENT :</strong></p>
                                </td>
                            </tr>
                            <tr>
                                <td style="width:28%;">Nama Client</td>
                                <td style="width:5%;">:</td>
                                <td>{{ $order->c_pt_name }}</td>
                            </tr>
                            {{-- <tr>
                                <td>No PO</td>
                                <td>:</td>
                                <td>{{ $order->c_name }}</td>
                            </tr> --}}
                            <tr>
                                <td>Telp. Kantor</td>
                                <td>:</td>
                                <td>0{{ $order->c_pt_phone_val }}</td>
                            </tr>
                            <tr>
                                <td>Contact Person</td>
                                <td>:</td>
                                <td>{{ $order->c_name }}</td>
                            </tr>
                            <tr>
                                <td>HP CP</td>
                                <td>:</td>
                                <td>0{{ $order->c_phone_val }}</td>
                            </tr>
                            <tr>
                                <td>Email CP</td>
                                <td>:</td>
                                <td>{{ $order->c_mail }}</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td style="width:55%;padding-left:1rem;">
                    <table class="table mb-0">
                        <tbody>
                            <tr>
                                <td colspan="3">
                                    <p style="margin:0 0 0 0;font-size:15px;"><strong>EXPEDISI/ PENGAMBIL BARANG
                                            :</strong></p>
                                </td>
                            </tr>
                            {{-- <tr>
                                <td colspan="3">&nbsp;</td>
                            </tr> --}}
                            <tr>
                                <td style="width:20%;">Nama Exp.</td>
                                <td style="width:5%;">:</td>
                                <td style="background:#EBF1DE;">Bingkis Corporate</td>
                            </tr>
                            <tr>
                                <td>Telp Exp.</td>
                                <td>:</td>
                                <td style="background:#EBF1DE;">081285091879</td>
                            </tr>
                            <tr>
                                <td>Fax Exp.</td>
                                <td>:</td>
                                <td style="background:#EBF1DE;">-</td>
                            </tr>
                            <tr>
                                <td>CP Exp.</td>
                                <td>:</td>
                                <td style="background:#EBF1DE;">Emirsyaf Munir</td>
                            </tr>
                            <tr>
                                <td>HP Exp.</td>
                                <td>:</td>
                                <td style="background:#EBF1DE;">081285091879</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>

    <table class="table mb-2">
        <thead>
            <th class="p-2 border border-dark" style="background:#C0C0C0">No</th>
            <th class="p-2 border border-dark" style="background:#C0C0C0">Code</th>
            <th class="p-2 border border-dark" style="background:#C0C0C0">Desc</th>
            {{-- <th class="p-2 border border-dark" style="background:#C0C0C0">QTY</th> --}}
            <th class="p-2 border border-dark" style="background:#C0C0C0">Weight (Kg)</th>
            <th class="p-2 border border-dark" style="background:#C0C0C0">Volume (M&sup3;)</th>
        </thead>
        <tbody>
            @foreach ($items as $k => $v)
                <tr>
                    <td class="p-2 border border-dark text-center">{{ $k + 1 }}</td>
                    <td class="p-2 border border-dark text-center" style="background:#EBF1DE;">{{ $v->item_code }}
                    </td>
                    <td class="p-2 border border-dark text-start">{{ $v->desc }}</td>
                    {{-- <td class="p-2 border border-dark text-center" style="background:#EBF1DE;">{{ $v->qty }}</td> --}}
                    <td class="p-2 border border-dark text-center">{{ $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-2 border border-dark text-center" style="background:#EBF1DE;">{{ $vol }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>

    <p class="mb-1">Pengambilan barang dilakukan di :</p>
    <p class="mb-1">{{ $order->pck_name }}: {{ $order->pck_addr }}</p>
    {{-- Admin --}}
    <p class="mb-1">Konfirmasi waktu dan lokasi pengambilan dilakukan sehari sebelumnya ke
        <strong>{{ $order->pck_pic_name }}
            (0{{ implode(' ', str_split($order->pck_pic_phone_val, 4)) }})</strong></p>
    <p class="mb-2"><u>Delivery Order ini harus dibawa ketika pengambilan dan hanya berlaku untuk 1 (satu)
            kali pengambilan</u></p>

    <table class="table mb-0">
        <tbody>
            <tr>
                {{-- Admin --}}
                <td style="width:45%;">
                    <table class="table table-bordered border border-dark mb-0">
                        <tbody>
                            <tr>
                                <td class="text-center" style="padding-bottom:4rem;"><strong>APPROVAL</strong></td>
                            </tr>
                            <tr>
                                <td class="text-center"><strong>{{ $order->pck_pic_name }}</strong></td>
                            </tr>
                            <tr>
                                <td class="text-center"><strong>PIC Lokasi Pengambilan</strong></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                {{-- Driver --}}
                <td style="width:55%;">
                    <table class="table table-bordered border border-dark mb-0">
                        <tbody>
                            <tr>
                                <td class="text-center" style="padding-bottom:4rem;"><strong>PT. BONCENG
                                        INDONESIA</strong></td>
                            </tr>
                            <tr>
                                <td class="text-center" style="background:#EBF1DE;">
                                    <strong>({{ $order->drv_name }})</strong></td>
                            </tr>
                            <tr>
                                <td class="text-center" style="background:#EBF1DE;"><strong>Driver</strong></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>

</body>

</html>
