@foreach($application->applicants as $applicantIndex => $applicant)
@forelse($applicant->applicationServices as $serviceIndex => $appService)
@php
// IMPORTANT: Create truly unique ID for this service
$uniqueId = 'acc_' . $applicant->id . '_' . $appService->id . '_' . $serviceIndex;
// Determine if first accordion item should be open
$isFirstService = ($applicantIndex === 0 && $serviceIndex === 0);
// Get form data
$formData = is_array($appService->form_data) ? $appService->form_data : json_decode($appService->form_data ?? '{}', true);
// Determine form fields file
$serviceSlug = $appService->service->slug ?? '';
$serviceTitle = strtolower($appService->service->title ?? '');
$serviceName = strtolower($appService->service->menu_title ?? '');
$formFieldsFile = 'admin.checkouts.forms.generic_fields';
if (str_contains($serviceSlug, 'oci') || str_contains($serviceName, 'oci')) {
$formFieldsFile = 'admin.checkouts.forms.oci_fields';
} elseif ((str_contains($serviceSlug, 'passport') || str_contains($serviceName, 'passport')) && !str_contains($serviceName, 'surrender') && !str_contains($serviceName, 'renewal')) {
$formFieldsFile = 'admin.checkouts.forms.passport_fields';
} elseif ((str_contains($serviceSlug, 'passport') || str_contains($serviceName, 'passport')) && !str_contains($serviceName, 'surrender')) {
$formFieldsFile = 'admin.checkouts.forms.renewal_passport_fields';
} elseif (str_contains($serviceSlug, 'indian-visa') || str_contains($serviceName, 'e-visa')) {
$formFieldsFile = 'admin.checkouts.forms.indian_visa_fields';
} elseif (str_contains($serviceSlug, 'x1-visa') || str_contains($serviceName, 'x visa')) {
$formFieldsFile = 'admin.checkouts.forms.x_visa_fields';
} elseif (str_contains($serviceSlug, 'visa') || str_contains($serviceName, 'visa')) {
$formFieldsFile = 'admin.checkouts.forms.visa_fields';
} elseif (str_contains($serviceSlug, 'pcc') || str_contains($serviceSlug, 'police') || str_contains($serviceName, 'police')) {
$formFieldsFile = 'admin.checkouts.forms.pcc_fields';
} elseif (str_contains($serviceSlug, 'pan') || str_contains($serviceName, 'pan')) {
$formFieldsFile = 'admin.checkouts.forms.pan_fields';
} elseif (str_contains($serviceSlug, 'apostille') || str_contains($serviceName, 'apostille')) {
$formFieldsFile = 'admin.checkouts.forms.apostille_fields';
} elseif (str_contains($serviceSlug, 'surrender') || str_contains($serviceSlug, 'renunciation') || str_contains($serviceName, 'surrender')) {
$formFieldsFile = 'admin.checkouts.forms.surrender_fields';
} elseif (str_contains($serviceName, 'certificate')) {
$formFieldsFile = 'admin.checkouts.forms.certificate_fields';
} elseif (str_contains($serviceName, 'income tax') || str_contains($serviceName, 'repatriation')) {
$formFieldsFile = 'admin.checkouts.forms.tax_fields';
}
@endphp
{{ $serviceIndex + 1 }}
{{ $appService->service->menu_title ?? $appService->service->title ?? 'Service' }}
Payment Receipt
@if($application->payment_status == 'paid')
Paid
@else
Unpaid
@endif
-
Service Name:
{{ $appService->service->menu_title ?? $appService->service->title ?? 'N/A' }}
-
Date:
{{ $application->created_at->format('d M Y') }}
-
Service Fee:
${{ number_format($appService->price_usd ?? 0, 2) }}
-
Government Fee:
${{ number_format($appService->government_fee_usd ?? 0, 2) }}
-
Transaction ID:
{{ $application->transaction_id ?? 'N/A' }}
-
Payment Method:
{{ $application->payment_method ?? 'N/A' }}
Amount Paid: ${{ number_format(($appService->price_usd ?? 0) + ($appService->government_fee_usd ?? 0), 2) }}
{{--
Uploaded Documents
@forelse ($appService->documents as $key => $document)
@if ($document->document_id == 0 && $document->documant_name == 'Notary Document')
@continue
@endif
@php
$filePath = 'https://visament.com/storage/' . $document->file_path;
$fileType = $document->file_type ?? '';
$isPdf = str_contains($fileType, 'pdf') || str_ends_with(strtolower($document->file_path ?? ''), '.pdf');
$isImage = str_contains($fileType, 'image') || preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $document->file_path ?? '');
@endphp
{{ $document->document_name }}
Status:
{{ ucfirst($document->status) }}
@if (isset($document->rejection_reason) && $document->rejection_reason)
Remark:
{{ $document->rejection_reason }}
@endif
@empty
No documents uploaded for this service.
@endforelse
--}}
Uploaded Documents
@php
// Filter out Notary Document with id 0 and group by document_id
$filteredDocuments = $appService->documents->filter(function($document) {
return !($document->document_id == 0 && $document->documant_name == 'Notary Document');
});
$uploadedDocuments = $filteredDocuments->groupBy('document_id')->toArray();
// Get unique document types (excluding document_id = 0 for additional docs)
$documentTypes = $filteredDocuments->where('document_id', '!=', 0)
->unique('document_id')
->pluck('document_name', 'document_id')
->toArray();
@endphp
@if(count($documentTypes) > 0)
@foreach($documentTypes as $docTypeId => $docTypeName)
@php
$frontDocs = $uploadedDocuments[$docTypeId] ?? [];
$docStatus = $frontDocs[0]['status'] ?? null;
@endphp
Photo Status:
@if(!empty($frontDocs))
@switch($docStatus)
@case('pending') Pending @break
@case('rejected') Rejected @break
@case('approved') Approved @break
@default Pending
@endswitch
@else
Not Uploaded Yet
@endif
@if(isset($frontDocs[0]['rejection_reason']) && $frontDocs[0]['rejection_reason'])
Remark:
{{ $frontDocs[0]['rejection_reason'] }}
@endif
@if(!empty($frontDocs))
@foreach($frontDocs as $docimg)
@php
$file_nm = $docimg['file_path'];
$file_ext = pathinfo($file_nm, PATHINFO_EXTENSION);
$isPdf = strtolower($file_ext) == "pdf";
$img_nm = $isPdf ? "uploads/checkout_docs/document/pdf_icon.png" : $docimg['file_path'];
// $filePath = 'https://visament.com/storage/' . $docimg['file_path'];
$filePath = 'http://172.105.63.118/visament_working_dir/storage/app/public/' . $docimg['file_path'];
if($docimg['status'] == "approved"){
$img_class = "border border-success";
} elseif($docimg['status'] == "rejected") {
$img_class = "border border-danger";
} else {
$img_class = "border border-warning";
}
@endphp
@if(empty($docimg['file_path']))
@continue
@endif
-
@if($isPdf)
@else
@endif
@endforeach
@endif
@endforeach
@endif
{{-- Additional Documents Section (document_id = 0) --}}
@php
$frontDocs = $uploadedDocuments[0] ?? [];
$docStatus = $frontDocs[0]['status'] ?? null;
@endphp
Photo Status:
@if(!empty($frontDocs))
@switch($docStatus)
@case('pending') Pending @break
@case('rejected') Rejected @break
@case('approved') Approved @break
@default Pending
@endswitch
@else
Not Uploaded Yet
@endif
@if(!empty($frontDocs))
@foreach($frontDocs as $docimg)
@php
$file_nm = $docimg['file_path'];
$file_ext = pathinfo($file_nm, PATHINFO_EXTENSION);
$isPdf = strtolower($file_ext) == "pdf";
$filePath = 'http://172.105.63.118/visament_working_dir/storage/app/public/' . $docimg['file_path'];
// $filePath = 'https://visament.com/storage/' . $docimg['file_path'];
if($docimg['status'] == "approved"){
$img_class = "border border-success";
} elseif($docimg['status'] == "rejected") {
$img_class = "border border-danger";
} else {
$img_class = "border border-warning";
}
@endphp
-
@if($isPdf)
@else
@endif
@endforeach
@endif
{{-- Approve All Docs Button --}}
Account Activation Details
@if(!$loop->last)
@endif
@empty
No services found for this applicant.
@endforelse
@endforeach
@if(isset($attachments) && count($attachments) > 0)
Recevied Attchment
@if(isset($attachments[0]))
@foreach($attachments[0] as $attachment)
{{ $attachment['attachment_name'] }}
@endforeach
@endif
Sent Attchment
@if(isset($attachments[1]))
@foreach($attachments[1] as $attachment)
{{ $attachment['attachment_name'] }}
@endforeach
@endif
@endif