diff --git a/resources/views/pages/customer_support.blade.php b/resources/views/pages/customer_support.blade.php index ec9a902b..42aa096c 100644 --- a/resources/views/pages/customer_support.blade.php +++ b/resources/views/pages/customer_support.blade.php @@ -51,53 +51,111 @@ @endif @if($booking) + @php + $payments = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->get(); + $purchaseOrder = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->first(); + @endphp
-
-

Booking

-

Booking Details:

-

Booking Status:

-
-
-

Payment

-

Payment Details:

-

Payment Status:

-

Bank Transaction Mapping:

-
-
-

Transfer Proof

-

Transfer Details:

-

Transfer Status:

-
-
-

Purchase Order

-

Order Details:

-

Order Status:

-
-
-

Invoice

-

Invoice Details:

-

Invoice Status:

-
-
-

Bank Slip

-

Bank Slip Details:

-

Bank Slip Status:

-
-
-

Bank Account

-

Bank Account Details:

-

Bank Account Status:

-
-
-

Refund

-

Refund Details:

-

Refund Status:

-
-
-

Supplier

-

Supplier Details:

-

Supplier Status:

+

Booking Reference: {{$booking->marking}}

+

Amount: {{$booking->fix_amount.' '.$booking->fixedCurrency->short_code}}

+

Status: {{$booking->status === 3 ? 'Complete' : 'In Progress'}}

+

Purchase Order Status: {{$purchaseOrder ? ($purchaseOrder->status === 3 ? 'Approved' : ($purchaseOrder->status === 1 ? 'Pending Approval' : 'Incomplete Submission')) : 'Pending Submission'}}

+ @foreach($payments as $payment) + @php + $bill = $payment->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::BILL)->first(); + $transferProof = null; + + $status = 'Pending Submission'; + + if($payment->status === 1) { + $status = 'Pending Approval'; + } + + if($payment->status === 2) { + $status = 'Pending Confirmation'; + } + + if(in_array($payment->status, [4, 5])) { + $status = 'Rejected/Failed Payment'; + $transferProof = $bill->documents()->first(); + } + + if($bill->status === 1) { + $status = 'Pending Transfer Proof'; + } + + if(in_array($bill->status, [2, 3])) { + $status = 'Transfer Complete'; + $transferProof = $bill->documents()->first(); + } + + @endphp +

Amount: {{$payment->original_amount.' '.$payment->originalCurrency->short_code}}

+

Status: {{$status}}

+

Payment Date: {{$payment->created_at->format('d-m-Y')}}

+ @if($bill) +

Supplier: {{$bill->issuer->name}}

+

Supplier Order Date: {{$bill->created_at->format('d-m-Y')}}

+ @if($transferProof)

Transfer Proof Upload Date: {{$transferProof->created_at->format('d-m-Y')}}

@endif + @endif + @endforeach +
+ @endif + @if(!$booking) + @php + $bookings = $company->bookings->whereIn('status', [2, 3])->get(); + @endphp +
+ @foreach($bookings as $booking) + @php + $payments = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->get(); + $purchaseOrder = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->first(); + @endphp +
+

Booking Reference: {{$booking->marking}}

+

Amount: {{$booking->fix_amount.' '.$booking->fixedCurrency->short_code}}

+

Status: {{$booking->status === 3 ? 'Complete' : 'In Progress'}}

+

Purchase Order Status: {{$purchaseOrder ? ($purchaseOrder->status === 3 ? 'Approved' : ($purchaseOrder->status === 1 ? 'Pending Approval' : 'Incomplete Submission')) : 'Pending Submission'}}

+ @foreach($payments as $payment) + @php + $bill = $payment->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::BILL)->first(); + $transferProof = null; + $status = 'Pending Submission'; + + if($payment->status === 1) { + $status = 'Pending Approval'; + } + + if($payment->status === 2) { + $status = 'Pending Confirmation'; + } + + if(in_array($payment->status, [4, 5])) { + $status = 'Rejected/Failed Payment'; + $transferProof = $bill->documents()->first(); + } + + if($bill->status === 1) { + $status = 'Pending Transfer Proof'; + } + + if(in_array($bill->status, [2, 3])) { + $status = 'Transfer Complete'; + $transferProof = $bill->documents()->first(); + } + + @endphp +

Amount: {{$payment->original_amount.' '.$payment->originalCurrency->short_code}}

+

Status: {{$status}}

+

Payment Date: {{$payment->created_at->format('d-m-Y')}}

+ @if($bill) +

Supplier: {{$bill->issuer->name}}

+

Supplier Order Date: {{$bill->created_at->format('d-m-Y')}}

+ @if($transferProof)

Transfer Proof Upload Date: {{$transferProof->created_at->format('d-m-Y')}}

@endif + @endif + @endforeach
+ @endforeach
@endif