<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>{{ gs()->siteName($pageTitle ?? '') }}</title>
    <!-- favicon -->
    <link rel="shortcut icon" type="image/png" href="{{ siteFavicon() }}">

    <link rel="stylesheet" href="{{ asset('assets/global/css/pdf.css') }}">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap');

        @font-face {
            font-family: "mono";
            src: url({{ asset('asset/pdf_font/RobotoMono-Light.ttf') }}) format("opentype");
            font-weight: normal;
            font-style: normal;
        }

        .table>thead {
            vertical-align: bottom;
            background: none;
            color: rgb(56, 56, 56);
            border-top: 1px dashed #838383 !important;
            border-bottom: 1px dashed #838383 !important;
            border-left: none;
            border-right: none;
        }

        table td {
            background: none !important;
        }

        table {
            border: none !important;
            font-family: "mono", monospace;
        }

        table td {
            padding: 8px 10px;
        }

        table tbody {
            border: none !important;
        }

        table tr td.border-top {
            border-top: 1px dashed #858585 !important;
        }

        .devide-two {
            padding-bottom: 5px;
        }

        .devide-two span,
        .devide-two b {
            display: inline-block;
        }

        .devide-two b:first-child {
            min-width: 105px !important;
        }

        .bank-location .bank-address {
            display: inline-block;
            padding-bottom: 10px;
        }

        .account-info .devide-two span:last-child {
            font-family: "mono", monospace;
        }

        .account-address {
            font-family: "mono", monospace;
            display: block !important;
            max-width: 300px;
            word-wrap: break-word;
            line-height: 1.4;
        }

        .statement_box {
            padding: 8px 0;
            margin-top: 20px;
        }

        .left_side {
            float: left;
            width: 50%;
        }

        .right_side {
            float: right;
            width: 45%;
        }

        .logo_box {
            padding-bottom: 15px;
        }

        .logo_box img {
            max-width: 210px;
        }

        b {
            font-weight: 500;
        }

        .transaction-detail {
            max-width: 220px;
            word-wrap: break-word;
        }

        .clearfix::after {
            content: "";
            clear: both;
            display: table;
        }

        .customer-name {
            font-size: 14px;
            font-weight: 600;
            padding-bottom: 8px;
            display: inline-block;
        }
    </style>

    @stack('style')
</head>

<body>
    <main>
        <div class="list--row clearfix">
            <div class="left_side">
                <div class="logo_box">
                    <img src="{{ siteLogo('dark') }}" class="logo" alt="Logo">
                </div>
                <div class="bank-location">
                    <span class="bank-address">
                        {{ __(gs()->site_name) }}
                    </span>
                    <div class="devide-two">
                        <b>@lang('Email')</b>
                        <span>: {{ __(gs()->email_from) }}</span>
                    </div>
                    <div class="devide-two">
                        <b>@lang('Phone')</b>
                        <span>: +1 345 743 1465</span>
                    </div>
                    <div class="devide-two">
                        <b>@lang('Website')</b>
                        <span>: Caymanbranconational.com</span>
                    </div>
                </div>
            </div>
            <div class="right_side">
                <div class="bank-location account-info">
                    <span class="customer-name">
                        {{ $user->firstname }} {{ $user->lastname }}
                    </span>
                    @php
                        $addressParts = [];
                        if ($user->address) $addressParts[] = trim($user->address, '"\'');
                        if ($user->city) $addressParts[] = $user->city;
                        if ($user->state) $addressParts[] = $user->state;
                        if ($user->zip) $addressParts[] = $user->zip;
                        if ($user->country_name) $addressParts[] = $user->country_name;
                        $fullAddress = implode(', ', $addressParts);
                    @endphp
                    <span class="bank-address account-address">
                        {{ $fullAddress }}
                    </span>
                    <div class="devide-two">
                        <b>@lang('Account No')</b>
                        <span>: {{ $user->account_number }}</span>
                    </div>
                    <div class="devide-two">
                        <b>@lang('Email')</b>
                        <span>: {{ $user->email }}</span>
                    </div>
                    <div class="devide-two">
                        <b>@lang('Mobile')</b>
                        <span>: +{{ $user->dial_code }} {{ $user->mobile }}</span>
                    </div>
                    <div class="devide-two">
                        <b>@lang('Issue Date')</b>
                        <span>: {{ showDateTime(now(), 'F d, Y') }}</span>
                    </div>
                </div>
            </div>
        </div>

        <div class="statement_box">
            <b>@lang('STATEMENT OF ACCOUNT FOR THE PERIOD :') {{ strtoupper(request()->date) }}</b>
        </div>

        <div class="body">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>@lang('DATE')</th>
                        <th>@lang('DETAILS')</th>
                        <th>@lang('DEBIT')</th>
                        <th>@lang('CREDIT')</th>
                        <th>@lang('BALANCE')</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($transactions as $transaction)
                        <tr>
                            <td>
                                {{ showDateTime($transaction->created_at, 'd-M-Y') }}
                            </td>
                            <td class="transaction-detail">
                                {{ $transaction->details }}
                            </td>
                            <td>
                                {{ $transaction->trx_type == '-' ? showAmount($transaction->amount) : '-' }}
                            </td>
                            <td>
                                {{ $transaction->trx_type == '+' ? showAmount($transaction->amount) : '-' }}
                            </td>
                            <td>
                                {{ showAmount($transaction->post_balance) }}
                            </td>
                        </tr>
                    @endforeach
                    <tr>
                        <td></td>
                        <td></td>
                        <td class="border-top">
                            <b>{{ showAmount($minusSumAmount) }}</b>
                        </td>
                        <td class="border-top">
                            <b>{{ showAmount($plusSumAmount) }}</b>
                        </td>
                        <td class="border-top">
                            <b>{{ showAmount($transactions->last()->post_balance ?? 0) }}</b>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </main>

    <footer>
        <div class="d-block text-center">
            @lang('Powered by') {{ __(gs()->site_name) }}
        </div>
    </footer>
</body>

</html>