@extends('layouts.pdf')

<style>
    * {
        font-size: 0.9rem;
    }
</style>

<div class="container-fluid pt-4 font-serif" style="">
    <div class="fw-bold">
        TOP NOTCH EMBROIDERY & DIGITIZING LTD.
    </div>
    <div>
        108-618 EAST KENT AVE. SOUTH <br>
        VANCOUVER BC <br>
        (604) 871-9991 <br>
        info@sewtopnotch.com <br>
        GST# 846025062RT0001 <br>
    </div>

    <div class="fs-3 fw-bold text-primary mt-2">
        INVOICE
    </div>

    <div class="d-flex flex-row">
        <div class="me-auto">
            <div class="fw-bold">
                BILL TO
            </div>
            <div>
                {{$invoice->customer->company_name}} <br>
                {{$invoice->customer->billing_address_line_1}} <br>
                {{$invoice->customer->billing_address_line_2}} <br>
            </div>
        </div>

        <div class="text-end pe-2">
            <div class="fw-bold">
                INVOICE#
            </div>
            <div class="fw-bold">
                DATE
            </div>
            <div class="fw-bold">
                DUE DATE
            </div>
        </div>

        <div>
            <div>
                {{$invoice->internal_id}}
            </div>
            <div>
                {{$invoice->date}}
            </div>
            <div>
                {{$invoice->due_date}}
            </div>
        </div>
    </div>

    <hr>

    <table class="table table-sm table-striped">
        <tr>
            <th>WO#</th>
            <th>PO#</th>
            <th>PRODUCT SERVICES</th>
            <th>QTY</th>
            <th>RATE</th>
            <th>AMOUNT</th>
        </tr>

        @foreach($invoice->productServices as $service)
            <tr>
                <td class="text-nowrap">
                    <span style="font-size: 0.8rem">
                    {{$service->order->internal_po}}
                    </span>
                </td>
                <td>
                    {{$service->order->customer_po}}
                </td>
                <td>
                    <span class="fw-bold">
                    {{$service->order->order_type->name}} <br>
                    </span>
                    {{$service->service_details}}
                </td>
                <td class="text-end">
                    {{$service->amount}}
                </td>
                <td class="text-end">
                    {{number_format($service->amount_price, 2)}}
                </td>
                <td class="text-end">
                    ${{number_Format($service->price, 2)}}
                </td>
            </tr>
        @endforeach
    </table>

    <div class="d-flex flex-row-reverse">

        <div class="text-end ps-5">
            <div>${{number_format($invoice->subtotal, 2)}}</div>
            <div>${{number_format($invoice->gst_amount, 2)}}</div>
            <div>${{number_format($invoice->pst_amount, 2)}}</div>
            <div>${{number_format($invoice->total, 2)}}</div>
            <br>
            <div class="fw-bold">${{number_format($invoice->total, 2)}}</div>
        </div>

        <div class="fw-bold text-end">
            <div>Subtotal</div>
            <div>GST @ {{$invoice->gst_rate}}%</div>
            <div>PST (BC) @ {{$invoice->pst_rate}}%</div>
            <div>TOTAL</div>
            <br>
            <div>BALANCE DUE</div>
        </div>
    </div>

</div>