<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>{{ __("Invoice : [:Id]",['id' => $order['ref_id'] ?? "ID"]) }}</title>
    <style>
        body {
            font-family: 'almarai', sans-serif;
        }

        .invoice-box {
            max-width: 800px;
            margin: auto;
            padding: 30px;
            font-size: 16px;
            line-height: 24px;
            font-family: 'almarai', sans-serif;
            color: #555;
        }

        .invoice-box table {
            width: 100%;
            line-height: inherit;
            text-align: left;
        }

        .invoice-box table td {
            padding: 5px;
            vertical-align: top;
        }

        .invoice-box table tr td:nth-child(2),
        .invoice-box table tr td:nth-child(3) {
            text-align: right;
        }

        .invoice-box table tr.top table td {
            padding-bottom: 20px;
        }

        .invoice-box table tr.top table td.title {
            font-size: 45px;
            line-height: 45px;
            color: #333;
        }

        .invoice-box table tr.information table td {
            padding-bottom: 40px;
        }

        .invoice-box table tr.heading td {
            background: #eee;
            border-bottom: 1px solid #ddd;
            font-weight: bold;
        }

        .invoice-box table tr.details td {
            padding-bottom: 20px;
        }

        .invoice-box table tr.item td {
            border-bottom: 1px solid #eee;
        }

        .invoice-box table tr.item.last td {
            border-bottom: none;
        }

        .invoice-box table tr.total td:nth-child(2),
        .invoice-box table tr.total td:nth-child(3) {
            border-top: 2px solid #eee;
            font-weight: bold;
        }

        @media only screen and (max-width: 600px) {
            .invoice-box table tr.top table td {
                width: 100%;
                display: block;
                text-align: center;
            }

            .invoice-box table tr.information table td {
                width: 100%;
                display: block;
                text-align: center;
            }
        }

        /** RTL **/
        .invoice-box.rtl {
            direction: rtl;
            font-family: 'almarai', sans-serif;
        }

        .invoice-box.rtl table {
            text-align: right;
        }

        .invoice-box.rtl table tr td:nth-child(2),
        .invoice-box.rtl table tr td:nth-child(3) {
            text-align: left;
        }

        @page {
            header: page-header;
            footer: page-footer;
        }
    </style>
</head>
<body>
<div class="invoice-box">
    <table cellpadding="0" cellspacing="0">
        <tr class="top">
            <td colspan="3">
                <table>
                    <tr>
                        <td class="title">
                            <img src="{{ base_path('public/img/logo.png') }}" style="width: 100%; max-width: 100px" />
                        </td>
                        <td></td>
                        <td>
                            {{__("Invoice")}} :  <strong>#{{ $order['ref_id'] ?? "ID"}}</strong><br />
                            {{__("Created At")}} : {{ format_date($order['created_at'],__("d-m-Y à H:i:s")) }}<br />
                            {{__('Due At')}} : {{ format_date($order['updated_at'],__("d-m-Y à H:i:s")) }}
                        </td>
                    </tr>
                </table>
            </td>
        </tr>

        <tr class="information">
            <td colspan="3">
                <table>
                    <tr>
                        <td>
                            {{getSettingsOf("site_title")}}<br />
                            - <i><b>{{getSettingsOf("adress")}}</b></i> <br/>
                            - <i><b>{{getSettingsOf("adress2")}}</b></i>
                        </td>
                        <td></td>
                        <td>
                            {{ $user['full_name'] }}<br />
                            {{ $user['phone'] }}<br />
                            {{ $user['email'] }}
                        </td>
                    </tr>
                </table>
            </td>
        </tr>

        <tr class="heading">
            <td>{{__("Payments")}}</td>
            <td></td>
            <td>{{__("Check #")}}</td>
        </tr>

        <tr class="details">
            <td>{{ __('N/A') }}</td>
            <td></td>
            <td>{{format_amount($order['total'],$currency_symbol) }}</td>
        </tr>

        <tr class="heading">
            <td>{{__("Product")}}</td>
            <td>{{__("Price")}}</td>
            <td>{{__("Quantity")}}</td>
            <td>{{__("Amount")}}</td>
        </tr>

        @foreach($items as $item)
            <tr class="item">
                <td>{{ $item["product"]['name'] }}</td>
                <td>{{ format_amount($item['price']) }}</td>
                <td>{{ format_amount($item['quantity']) }}</td>
                <td>{{ format_amount($item['amount'],$currency_symbol) }}</td>
            </tr>
        @endforeach

        <tr class="total">
            <td></td>
            <td>{{__("Subtotal")}} :</td>
            <td>{{ format_amount($order['subtotal'],$currency_symbol)}}</td>
        </tr>
        <tr class="total">
            <td></td>
            <td>{{__("Discount")}} :</td>
            <td>{{ format_amount($order['discount'],$currency_symbol)  }}</td>
        </tr>
        <tr class="total">
            <td></td>
            <td>{{__("Tax")}} :</td>
            <td>{{  format_amount($order['tax'],$currency_symbol) }}</td>
        </tr>
        <tr class="total">
            <td></td>
            <td>{{__("Shipping")}} :</td>
            <td>{{ format_amount($order['shipping'],$currency_symbol)  }}</td>
        </tr>
        <tr class="total">
            <td></td>
            <td>{{__("Total")}} :</td>
            <td>{{ format_amount($order['total'],$currency_symbol)}}</td>
        </tr>
    </table>
</div>
</body>
</html>
