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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Document</title>
    {{-- <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> --}}
    {{-- <link href="https://fonts.googleapis.com/css2?family=Oswald&family=Roboto:wght@300;400&display=swap"
        rel="stylesheet"> --}}
</head>

<style>
    @font-face {
        font-family: Bitum;
        src: url('/assets/font/Bitum.ttf');
    }

    @page {
        margin: 0cm;
    }

    html {
        color: black;
    }

    body {
        font-family: Bitum;
        font-size: 8pt;
        /* transform: scaleY(1.5); */
    }

    .title {
        font-size: 11pt;
        font-weight: bold;
    }

    /* .literely-table td,
        th,
        tr {
            border-collapse: collapse;
            border: 0.1px solid rgb(85, 85, 85);
        } */

    .rotate90 {
        -webkit-transform: rotate(90deg);
        -moz-transform: rotate(90deg);
        -o-transform: rotate(90deg);
        -ms-transform: rotate(90deg);
        transform: rotate(90deg);
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p {
        margin: 0;
    }

    hr.style1 {
        border-top: 3px double #8c8b8b;
    }

    hr.style2 {
        border-top: 1px solid #8c8b8b;
    }

    .dashed-line {
        border: 1.5px dashed black;
    }
</style>

<body style="width: 58mm;">
    <!-- Button Print -->
    <div class="">
        <div class="col-6 mb">
            <button class="btn btn-info btn-block hidden-print" id="print-dapur">Print</button>
        </div>
    </div>
    <br>
    <h2 style="text-align: center">Sepiring Telur Keriting</h2>
    <p style="text-align: center">Jln. Jawa No. 28A, Jember</p>
    <hr class="style2">
    <span style="display: flex; justify-content: space-between">
        <span>
            <p>{{ tanggal_indonesia($pesanan->tanggal_pesanan) }}</p>
            <p>{{ date('H:i', strtotime($pesanan->tanggal_pesanan)) }}</p>
        </span>
        <span style="text-align: right">
            <p>{{ $pesanan->kode_pesanan }}</p>
            <p>Kasir: {{ $pesanan->user->name }}</p>
        </span>
    </span>
    <hr class="style2">
    <span style="display: flex; justify-content: space-between">
        <table width="100%">
            <tr>
                <td width=50%>
                    <h3>Meja: {{ $pesanan->nomor_meja }}</h3>
                </td>
                <td width=50% align="right">
                    <h3>Antrian: {{ $pesanan->nomor_antrian }}</h3>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <h3>Pemesan: {{ $pesanan->nama_pemesan }}</h3>
                </td>
            </tr>
        </table>
    </span>
    <p></p>
    <hr class="style2">
    <table class="literely-table" style="width: 100%;">
        <tbody>
            @foreach ($pesanan->detailPesanan as $item)
                <tr>
                    <td style="width: 100px;" colspan="5">{{ $item->nama_produk }}</td>
                </tr>
                <tr>
                    <td></td>
                    <td style="text-align: right">{{ $item->jumlah_produk }}</td>
                    <td style="text-align: right">{{ convert_to_rupiah($item->harga_produk) }}</td>
                    <td style="text-align: right;width: 30px">
                        {{ $item->diskon_persen != '' || $item->diskon_persen != 0 || $item->diskon_persen != null ? $item->diskon_persen . '%' : '' }}
                    </td>
                    <td style="text-align: right;width: 70px">{{ convert_to_rupiah($item->total_harga_produk) }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>
    <hr class="style2">
    <table style="width: 100%;">
        <thead>
            <tr>
                <th style="width: 20px;text-align: right">{{ $pesanan->total_pesanan }}</th>
                <th style="text-align: right">Total :</th>
                <th style="text-align: right">{{ convert_to_rupiah($pesanan->total_bayar) }}</th>
            </tr>
            <tr>
                <th></th>
                <th style="text-align: right">Diskon :</th>
                <th style="text-align: right">{{ $pesanan->diskon_persen ?? 0 }} %</th>
            </tr>
            <tr>
                <th></th>
                <th style="text-align: right">Grand Total :</th>
                <th style="text-align: right">{{ convert_to_rupiah($pesanan->grand_total) }}</th>
            </tr>
            <tr>
                <th></th>
                <th style="text-align: right">Bayar :</th>
                <th style="text-align: right">{{ convert_to_rupiah($pesanan->nominal_bayar) }}</th>
            </tr>
            <tr>
                <th></th>
                <th style="text-align: right">Kembali :</th>
                <th style="text-align: right">{{ convert_to_rupiah($pesanan->nominal_kembali) }}</th>
            </tr>
        </thead>
    </table>
    <hr class="style1">
    <p style="text-align: center">Terima Kasih, Selamat Datang Kembali</p>
    <p style="text-align: center;font-size: 7pt;">@sepiringtelurkeriting</p>
    <hr class="dashed-line" style="margin-top: 15px;">
    <p style="text-align: center;font-size: 7pt">untuk dapur</p>
    <hr class="dashed-line" style="margin-top: 10px;">
    <span style="display: flex; justify-content: space-between">
        <span>
            <p>{{ tanggal_indonesia($pesanan->tanggal_pesanan) }}</p>
            <p>{{ date('H:i', strtotime($pesanan->tanggal_pesanan)) }}</p>
        </span>
        <span style="text-align: right">
            <p>{{ $pesanan->kode_pesanan }}</p>
            <p>Kasir: {{ $pesanan->user->name }}</p>
        </span>
    </span>
    <hr class="style2">
    <span style="display: flex; justify-content: space-between">
        <table width="100%">
            <tr>
                <td width=50%>
                    <h3>Meja: {{ $pesanan->nomor_meja }}</h3>
                </td>
                <td width=50% align="right">
                    <h3>Antrian: {{ $pesanan->nomor_antrian }}</h3>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <h3>Pemesan: {{ $pesanan->nama_pemesan }}</h3>
                </td>
            </tr>
        </table>
    </span>
    <p></p>
    <hr class="style2">
    <h5 style="text-align: left; margin-top:3px;">Menu Order</h5>
    <table class="table" style="width: 100%;">
        <tbody>
            @foreach ($pesanan->detailPesanan as $item)
                <tr>
                    <td style="width: 80px;" colspan="3">
                        <h4>
                            ({{ $item->jumlah_produk }} X)
                            {{ $item->nama_produk }}
                        </h4>
                        @if ($item->keterangan_produk != '')
                            <p>
                                &nbsp;&nbsp;&nbsp;&nbsp; ket: {{ $item->keterangan_produk }}
                            </p>
                            <br>
                        @endif
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
    <p style="text-align: left; margin-top:5px;">Keterangan Pesanan Keseluruhan</p>
    <table class="table" style="width: 100%;">
        <tbody>
            <tr>
                <td style="width: 80px;" colspan="3">
                    <h4>{{ $pesanan->keterangan_pesanan != '' ? $pesanan->keterangan_pesanan : '-' }}</h4>
                </td>
            </tr>
        </tbody>
    </table>
    <hr class="style2">
</body>
<style>
    /* Untuk menyembunyikan tombol print */
    @media print {

        .hidden-print,
        .hidden-print * {
            display: none !important;
        }
    }

    .mb {
        margin-bottom: 8px;
    }

    .row {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        margin-right: -7.5px;
        margin-left: -7.5px;
    }

    .btn {
        display: inline-block;
        font-weight: 400;
        color: #212529;
        text-align: center;
        vertical-align: middle;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        background-color: transparent;
        border: 1px solid transparent;
        border-top-color: transparent;
        border-right-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
        padding: .375rem .75rem;
        font-size: 1rem;
        line-height: 1.5;
        border-radius: .25rem;
        transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    }

    .btn:not(:disabled):not(.disabled) {
        cursor: pointer;
    }

    .btn-info {
        color: #fff;
        background-color: #17a2b8;
        border-color: #17a2b8;
        box-shadow: none;
    }

    .btn-danger {
        color: #fff;
        background-color: #dc3545;
        border-color: #dc3545;
        box-shadow: none;
    }

    .btn-block {
        display: block;
        width: 100%;
    }
</style>
<script>
    // window.print();
    const $btnPrint = document.querySelector("#print-dapur");
    $btnPrint.addEventListener("click", () => {
        window.print();
    });

    $(document).ready(function() {
        $('#refresh').on('click', function() {
            location.reload()
        })
    })
</script>

</html>
