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

Completed Jobs

@foreach($completedJobs as $estimation) @foreach($estimation->emailUser->where('type', 'crewVisit') as $email) @php $crewName = json_decode($email->content) @endphp @endforeach @foreach($estimation->emailUser->where('type', 'userPayment') as $email) @php $serviceTotalFees = 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 @endforeach
Service Crew Name Service Total Payment Service Remaining Payment Status View
@if($estimation->services->count() > 1 || $estimation->others != null) Multiple @elseif($estimation->services->count() == 1) img{{$estimation->services->first()->title ?? ''}} @endif {{$crewName->crewName ?? ''}}${{$serviceTotalFees->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 {{$estimation->status ?? ''}}
@endsection