@extends('layouts.base_portal') @section('inner_content')
@csrf
@if($company) @php $employees = $company->employees; $primaryEmployee = $employees->first(); $identification = $company->documents->whereIn('document_type', \App\Classes\ValueObjects\Constants\DocumentType::IDENTIFICATION_DOCUMENTS)->first() @endphp

Customer Account

Company Id: {{$company->id}}

Marking: {{$company->reference}}

Account Type: {{$company->type === 1 ? 'Business' : 'Personal'}}

@if($company->type === 1)

Company's Name: {{$company->name}}

@endif

Customer's Name: {{$employees->pluck('name')->implode(', ')}}

Email: {{$employees->pluck('email')->implode(', ')}}

Phone: {{$company->contacts->pluck('phone')->implode(', ')}}

Registration Date: {{$company->created_at->format('d-m-Y')}}

Customer Verification

Email Verification Status: {{ $primaryEmployee->status === 2 ? 'Verified' : 'Pending Verification'}}

Identification Verification Status: {{$identification ? ($identification->status === 2 ? 'Verified' : 'Pending Verification') : 'Not Submitted'}}

@if(!$booking)

Customer Bookings

@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'}}

@if($payments)

Payment History:

@endif @php $i = 1; @endphp @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'; } if($bill) { if($bill->status === 1) { $status = 'Pending Transfer Proof'; } if(in_array($bill->status, [2, 3])) { $status = 'Transfer Complete'; $transferProof = $bill->documents()->first(); } } @endphp

{{$i++}}.

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

Status: {{$status}}

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

@if($bill)

Supplier: {{$bill->issuerCompany->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 @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 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'}}

@if($payments)

Payment History:

@endif @php $i = 1; @endphp @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'; } if($bill) { if($bill->status === 1) { $status = 'Pending Transfer Proof'; } if(in_array($bill->status, [2, 3])) { $status = 'Transfer Complete'; $transferProof = $bill->documents()->first(); } } @endphp

{{$i++}}.

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

Status: {{$status}}

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

@if($bill)

Supplier: {{$bill->issuerCompany->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
@endsection