@extends('layouts.app') @section('title', 'Applicant Dashboard') @section('content')

Applicant Dashboard

Welcome, {{ auth()->user()->name }}

@csrf
@if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @php $hasProfile = isset($profile) && $profile !== null; $hasCompanyDetails = isset($companyDetails) && $companyDetails !== null; $hasOperationDetails = isset($operationDetails) && $operationDetails !== null; $hasVesselDetails = isset($vesselDetails) && $vesselDetails !== null; $noVesselDeclared = $hasOperationDetails && isset($operationDetails->has_vessel) && !$operationDetails->has_vessel; $step4Complete = $hasVesselDetails || $noVesselDeclared; $readyToSubmit = $hasCompanyDetails && $hasOperationDetails && $step4Complete; $hasPendingOrApproved = false; if (isset($applications) && $applications->count() > 0) { foreach ($applications as $app) { if (in_array($app->status, ['pending', 'approved'])) { $hasPendingOrApproved = true; break; } } } // Lock all 5 cards when a pending/approved application exists. // Detect "applying for another" by checking if operation/vessel were // created/updated AFTER the most recent pending/approved application was submitted. $isLocked = $hasPendingOrApproved; $applyingForAnother = false; if ($isLocked && $hasOperationDetails) { $lastSubmittedApp = isset($applications) ? $applications->whereIn('status', ['pending', 'approved'])->sortByDesc('created_at')->first() : null; if ($lastSubmittedApp && $operationDetails->updated_at > $lastSubmittedApp->created_at) { $applyingForAnother = true; } } $step1Locked = $isLocked; $step2Locked = $isLocked; $step3Locked = $isLocked && !$applyingForAnother; $step4Locked = $isLocked && !$applyingForAnother; $step5Locked = $isLocked && !$applyingForAnother; @endphp @if(!$hasProfile)

Step 1: Personal Details

Let's start by registering your personal information.

@include('applicant.profile.create')
@else

License Application Process

Personal Details

{{ $hasCompanyDetails ? '✓' : '2' }}

Company Details

{{ $hasOperationDetails ? '✓' : '3' }}

Operation Details

@if($step4Complete) {{ $noVesselDeclared && !$hasVesselDetails ? '–' : '✓' }} @else 4 @endif

Vessel Details

{{ $readyToSubmit ? '✓' : '5' }}

Submit Application

{{-- Step 1 — locked when pending/approved --}}

Personal Details

Name: {{ $profile->full_name }}

DOB: {{ $profile->date_of_birth ? $profile->date_of_birth->format('d M Y') : 'N/A' }}

Phone: {{ $profile->phone_number }}

Email: {{ $profile->email }}

Island: {{ $profile->home_island }}

Nationality: {{ $profile->nationality }}

@if($isLocked) @else Edit Details @endif
{{-- Step 2 — locked when pending/approved --}}

Company Details

@if($step2Locked) @elseif($hasCompanyDetails) @else Next @endif

{{ $hasCompanyDetails ? 'Information submitted' : 'Provide your company information' }}

@if($step2Locked) @elseif($hasCompanyDetails) Edit Details @else Add Company Details @endif
{{-- Step 3 — unlocked when applying for another --}}

Operation Details

@if($step3Locked) @elseif($hasOperationDetails) @else Next @endif

{{ $hasOperationDetails ? 'Information submitted' : 'Describe your operations' }}

@if($step3Locked) @elseif($hasOperationDetails) Edit Details @else Add Operation Details @endif
{{-- Step 4 — unlocked when applying for another --}}

Vessel Details

@if($step4Locked) @elseif($hasVesselDetails) @elseif($noVesselDeclared) Optional @else Next @endif

@if($step4Locked) Locked @elseif($hasVesselDetails) Information submitted @elseif($noVesselDeclared) Skipped — no vessel declared @else Register your vessels @endif

@if($step4Locked) @elseif($hasVesselDetails) Edit Details @elseif($noVesselDeclared) Add Vessel (Optional) @else Add Vessel Details @endif
{{-- Step 5 — unlocked when applying for another --}}

Submit Application

@if($step5Locked) @elseif($hasPendingOrApproved && !$applyingForAnother) @elseif($readyToSubmit) Ready @else @endif

@if($step5Locked) Locked @elseif($hasPendingOrApproved && !$applyingForAnother) Application submitted @else Submit for review @endif

@if($step5Locked) @elseif($readyToSubmit) @else @endif
@if($isLocked && !$applyingForAnother)

🔒 Steps 1 & 2 are locked.
You have an active application in progress. Personal and Company details cannot be edited. To apply for another license, click "Apply for Another License" below — this will unlock Operation Details, Vessel Details, and Submit.

@elseif($applyingForAnother)

📋 New License Application.
Steps 3, 4 and 5 are now active. Complete your operation and vessel details, then submit.

@elseif(!$hasCompanyDetails)

📋 Next Step:
Add your company details to proceed.

@elseif(!$hasOperationDetails)

⚙️ Next Step:
Provide your operation details to continue.

@elseif(!$step4Complete)

🚢 Next Step:
Register your vessel details, or go back to Operation Details and select "No vessel" to skip.

@elseif($readyToSubmit)

✅ Ready to Submit!
All requirements completed. Click "Review & Submit" to submit your license application.

@endif
{{-- Cost Breakdown (only shown when there are applications with invoices) --}} @if(isset($applications) && $applications->count() > 0) @php $invoicedApplications = $applications->filter(fn($app) => $app->invoice !== null); @endphp @if($invoicedApplications->count() > 0)

License Fee Breakdown

Amounts in AUD
@foreach($invoicedApplications as $app) @php $inv = $app->invoice; @endphp
{{-- Invoice header bar --}}
Invoice #{{ $inv->invoice_number }} · {{ $app->license_type }} License
@php $dueDate = $inv->due_date ? \Carbon\Carbon::parse($inv->due_date) : \Carbon\Carbon::parse($inv->created_at)->addWeek(); @endphp Due: {{ $dueDate->format('d M Y') }} {{ ucfirst($inv->status ?? 'pending') }}
{{-- Fee rows --}}
@php $feeRows = [ ['label' => 'Upfront License Fee', 'category' => 'Fixed Fee', 'amount' => $inv->upfront_fee], ['label' => 'Environmental Impact (EIA)', 'category' => 'Fixed Fee', 'amount' => $inv->eia_fee], ['label' => 'Registration Fee', 'category' => 'Fixed Fee', 'amount' => $inv->registration_fee], ['label' => 'Cost Recovery Fee', 'category' => 'Fixed Fee', 'amount' => $inv->recovery_fee], ['label' => 'Vessel Size Fee', 'category' => 'Vessel', 'amount' => $inv->vessel_fee], ['label' => 'Harvesting Methods Fee', 'category' => 'Harvesting Method', 'amount' => $inv->harvesting_fee], ['label' => 'Fish Families Fee', 'category' => 'Target Species', 'amount' => $inv->fish_family_fee], ]; $activeRows = array_filter($feeRows, fn($r) => $r['amount'] > 0); @endphp {{-- Column headers (desktop) --}} @foreach($activeRows as $row)
{{ $row['label'] }}
${{ number_format($row['amount'], 2) }}
@endforeach {{-- Fish family line-items --}} @if($inv->fishFamilies && $inv->fishFamilies->count() > 0) @foreach($inv->fishFamilies as $ff) @php $ffFee = $ff->pivot->fee ?? $ff->fee ?? null; @endphp @if($ffFee)
{{ $ff->name }}
${{ number_format($ffFee, 2) }}
@endif @endforeach @endif {{-- Total row --}}
Total Amount Due
${{ number_format($inv->total_amount, 2) }}
{{-- Invoice footer --}}
@if($inv->notes)

Note: {{ $inv->notes }}

@endif
@endforeach
@if($applications->whereNull('invoice')->where('status', 'approved')->count() > 0)

Invoice pending: Your approved application will receive an invoice within 5 working days via email.

@endif
@endif @endif

My License Applications

@if($hasProfile && $hasCompanyDetails) Apply for Another License @endif
@forelse($applications as $application)

{{ $application->license_type }} License

@if(in_array($application->status, ['payment_uploaded'])) waiting for final approval @else {{ ucfirst($application->status) }} @endif App #{{ $application->id }}

Business

{{ $application->business_name }}

Applicant

{{ $application->ap_full_name ?? '—' }}

Submitted

{{ $application->created_at->format('d M Y') }}

Vessel

{{ $application->vd_vessel_name ?? ($application->od_has_vessel ? '—' : 'None') }}

@if($application->status === 'pending')

Awaiting Reviewer

Your application is pending for reviewer

@elseif($application->status === 'reviewed')

Under Review

Your application is currently being reviewed by a reviewer and you will receive an invoice within 5 working days.

@elseif($application->status === 'rejected')

❌ Application Rejected

@if($application->rejection_reason)

Reason: {{ $application->rejection_reason }}

@endif

You may delete this and submit a new application with corrected information.

@elseif($application->status === 'revoked' && $application->license)

⚠️ License Revoked

Reason: {{ $application->license->revoked_reason }}

Revoked on: {{ $application->license->revoked_at->format('M d, Y') }}

@endif @if($application->status === 'approved') @if($application->reviewer)

Reviewed by {{ $application->reviewer->name }}{{ $application->reviewed_at ? ' on '.$application->reviewed_at->format('d M Y H:i') : '' }}

@endif

✓ You will receive your license within 5 working days upon application approval via email.

@elseif($application->status === 'rejected') @if($application->reviewer)

Reviewed by {{ $application->reviewer->name }}{{ $application->reviewed_at ? ' on '.$application->reviewed_at->format('d M Y H:i') : '' }}

@endif

✗ Your application was not approved. Please delete this application and resubmit with corrected information.

@elseif($application->status === 'revoked')

⚠ Your license has been revoked by the Ministry of Fisheries. Please contact them directly for further assistance.

@elseif($application->status === 'pending') {{-- No reviewer message shown while still pending --}} @endif
@if($application->status === 'rejected')
@csrf @method('DELETE')
@endif
{{-- Full Details Modal --}} @empty

No applications submitted yet

Complete all steps above to submit your first license application

@endforelse
@endif
@verbatim @endverbatim {{-- ════════════════════════════════════════ REVIEW & SUBMIT MODAL ════════════════════════════════════════ --}} @endsection