@php $leanAskMode = 'edit'; $askLocked = (bool) ($askLocked ?? false); $askAmountLocked = (bool) ($askAmountLocked ?? $askLocked); $askProductLocked = (bool) ($askProductLocked ?? $askAmountLocked); $mapped = $loanFormMappedFields ?? []; $mappedBookingSegments = $mappedBookingFieldDisplaySegments ?? []; $draftApplication = $draftApplication ?? $application; $lockPrefilledClient = true; $prefilledClient = $prefilledClient ?? $application->loanClient; $selectedClientId = $selectedClientId ?? $application->loan_client_id; $inFormModal = request()->header('Turbo-Frame') === 'loan-form-modal'; $editFeeMeta = (array) ($application->form_meta ?? []); $editFeesFulfilled = strtolower(trim((string) data_get($editFeeMeta, 'fee_fulfillment_status', ''))) === 'fulfilled'; $editFeeAttachedPayments = collect((array) data_get($editFeeMeta, 'fee_selected_payments', [])) ->filter(static fn ($row): bool => is_array($row) && (int) ($row['id'] ?? 0) > 0) ->map(static function (array $row): array { $id = (int) $row['id']; $amount = round((float) ($row['amount'] ?? 0), 2); $reference = (string) ($row['reference'] ?? ('PAY-#'.$id)); return [ 'id' => $id, 'amount' => $amount, 'reference' => $reference, 'label' => $reference.' | '.number_format($amount, 2).' (already attached)', 'payment_kind' => (string) ($row['payment_kind'] ?? 'attached'), 'status' => 'attached', 'channel' => '', 'transaction_at' => '', ]; }) ->values() ->all(); $editFeeWalletAmount = round((float) old( 'wallet_fee_amount', data_get($editFeeMeta, 'fee_wallet_funding_amount', 0) ), 2); @endphp @if (! $inFormModal) Application 360 Back @endif
$inFormModal, 'mx-auto max-w-7xl grid-cols-1 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,1.4fr)]' => ! $inFormModal, ]) x-data="loanProductPicker( @js($productMetaByName ?? []), @js((string) old('term_unit', $application->term_unit ?? '')), @js(old('suspense_payment_ids', (array) data_get( $application->form_meta, 'fee_selected_payment_ids', array_values(array_filter([data_get($application->form_meta, 'fee_selected_payment_id')])) ))), 0, @js($productFieldConfig ?? []), @js($clientLookupUrl ?? ''), true, @js((string) old('loan_client_id', $application->loan_client_id)), @js(route('loan.tools.discover_products')), @js((string) old('product_name', $application->product_name ?? '')) )" data-products-store-url="{{ route('loan.book.applications.products.store') }}" data-suspense-options-url="{{ route('loan.book.applications.suspense_options') }}" data-discover-products-url="{{ route('loan.tools.discover_products') }}" data-product-bootstrap-url="{{ route('loan.book.applications.product_bootstrap') }}" data-lean-ask="1" data-lean-ask-modal="{{ $inFormModal ? '1' : '0' }}" data-fees-fulfilled="{{ $editFeesFulfilled ? '1' : '0' }}" data-fee-wallet-amount="{{ $editFeeWalletAmount }}" data-fee-attached-payments='@json($editFeeAttachedPayments)' data-initial-requested-amount="{{ old('amount_requested', $draftApplication?->amount_requested ?? '') }}" > @if (! $inFormModal) @endif
! $inFormModal, ]) data-lean-ask-form > @csrf @method('patch') @if ($inFormModal) @endif
@if ($inFormModal)
@include('loan.book.applications.partials.lean-ask.header') @include('loan.book.applications.partials.lean-ask.lock-banner')
@endif @include('loan.partials.modal-validation-alert', [ 'title' => __('Application could not be updated. Fix the issues below and try again.'), 'sticky' => $inFormModal, 'id' => 'loan-application-edit-validation-summary', ]) @include('loan.book.applications.partials.lean-ask.loan-request') @include('loan.book.applications.partials.spouse-consent', [ 'application' => $application, ]) @include('loan.book.applications.partials.applicant-certification', [ 'application' => $application, ]) @include('loan.book.applications.partials.lean-ask.fees')
@error('notes')

{{ $message }}

@enderror
@include('loan.book.applications.partials.lean-ask.sticky-actions', [ 'inFormModal' => $inFormModal, ])