@extends('emails.layout.base')

@section('content')
    <h4 style="font-size: 1em;">Hello, {{ $user->name }}</h4>
    <p style="font-size: 0.9em">We wanted to send you an update on the recent shipment for you order no. <a href="{{ route('order.show', $packingList->owner->reference) }}">{{ $packingList->owner->reference }}</a> you have placed with us. We've just learned that there has been a shipping delay from the shipping liner, and as a result your packages will arrive a few days later the estimated date we gave you when we shipped your order. The new estimated date for arrival will be {{ $packingList->containers()->first()->transports()->first()->schedules()->where('status', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)->first()->eta->format('d-m-Y') }}.</p>
    <p style="margin-top: 30px; font-size: 0.8em">We're very sorry that you are experiencing this delay. and we wanted to let you know as soon as we learned about it. We are working directly with the shipping liner to minimize the impact, but we don't want you to worry your order is still on its way!</p>
    <p style="margin-top: 20px; font-size: 0.8em">Recently shipping liner facing very frequent delay, it's better to estimate longer ETA while purchase to avoid any inconvenience causes.</p>
    @if($packingList->transactions()->whereHas('transactions', function ($query){
        return $query->where('type', \App\Classes\ValueObjects\Constants\TransactionType::SHIPPING_INVOICE)->where('status', '=', 2);
    })->get())
    <p style="margin-top: 20px; font-size: 0.8em">Meanwhile, we would appreciate if you could make the payment as soon as possible so we can deliver your packages as soon as the shipment arrives. please <a href="{{ route('order.show', $packingList->owner->reference) }}">click here</a> to pay your invoice.</p>
    @endif
    <div style="margin-top: 20px;"><small style="font-size: 0.7em">If you wish to ask any additional questions, kindly contact us at our live chat from your account's <a href="{{ route('dashboard') }}">dashboard</a>.</small></div>
@endsection
