@extends('layouts.user-app') @section('content')

Payment

@foreach($filteredEstimations as $estimation) @php $hasFullPayment = false; $hasAdvancePayment = false; @endphp @if($estimation->emailUser->where('type', '==', 'userPayment')->count() > 0) {{-- Show The Amount --}} @foreach($estimation->emailUser->where('type', '==', 'userPayment') as $email) @php $emailContent = json_decode($email->content); @endphp @endforeach @foreach($estimation->emailUser->where('type', '==', 'userPayment') as $email) @php $emailContent = json_decode($email->content); @endphp @endforeach @foreach ($estimation->emailUser->where('type', 'userPayment') as $email) @php $emailContent = json_decode($email->content); $estimationId = $estimation->id; $filteredPayments = $estimation->userPayment->where('estimation_id', $estimationId) ->where('status', 'paid') ->pluck('payment_type') ->toArray(); @endphp @endforeach {{-- Show The Payment Status --}} @php $hasFullPayment = false; $hasAdvancePayment = false; $hasRemainingPayment = false; @endphp @foreach($estimation->userPayment as $payment) @if($payment->status == 'paid') @if($payment->payment_type == 'full_payment') @php $hasFullPayment = true; @endphp @elseif($payment->payment_type == 'advance_payment') @php $hasAdvancePayment = true; @endphp @elseif($payment->payment_type == 'remaining_payment') @php $hasRemainingPayment = true; @endphp @endif @endif @endforeach @else @endif @endforeach
Service Estimation Time Request Date Advance Fees Total Fees Remaining Amount Payment Status View
@if($estimation->services->count() > 1 || $estimation->others != null) Multiple @elseif($estimation->services->count() == 1) {{$estimation->services->first()->title ?? ''}} @endif {{$estimation->estimation_time ?? ''}} {{ $estimation->created_at->format('m/d/Y') ?? '' }}$ {{$emailContent->serviceAdvanceFees ?? ''}}$ {{$emailContent->serviceTotalFees ?? ''}} @if (in_array('advance_payment', $filteredPayments)) @if (in_array('remaining_payment', $filteredPayments)) $ 0 @elseif (in_array('full_payment', $filteredPayments)) $ 0 @else $ {{ $emailContent->serviceTotalFees - $emailContent->serviceAdvanceFees ?? '' }} @endif @elseif (in_array('full_payment', $filteredPayments)) $ 0 @else $ {{ $emailContent->serviceTotalFees ?? '' }} @endif @if($hasFullPayment) Paid @elseif($hasAdvancePayment && $hasRemainingPayment) Paid @elseif($hasAdvancePayment) Remaining Payment @else Pay @endif
No Payment Available
@endsection