{{-- Two readers again: the person lending the company's cash, and the person borrowing from it. --}} @php $allTabs = ['mine' => __('My loans')]; if ($canSeeStaff) $allTabs['staff'] = __('Staff loans'); if ($canSeeOutbound) $allTabs['outbound'] = __('Company-lent'); $statusTone = fn ($s) => match ($s) { 'active' => 'sky', 'settled' => 'emerald', 'approved' => 'sky', 'rejected', 'cancelled' => 'rose', default => 'amber', }; @endphp
count($allTabs) < 2, ])> @foreach ($allTabs as $key => $label) @endforeach
{{-- Toolbar --}}
@if ($tab === 'mine' && $hasSalary) {{ __('You can borrow up to your salary, repayable within 3 months.') }} @endif
@if ($tab === 'mine' && $canApply) {{ __('Apply for a loan') }} @endif @if ($tab === 'staff' && $canRecordAdvance) {{ __('Record salary advance') }} @endif @if ($tab === 'outbound' && $canManage) {{ __('Lend cash out') }} @endif
@if ($loans->isEmpty()) @else
@foreach ($loans as $loan) @endforeach
{{ $tab === 'outbound' ? __('Borrower') : __('Employee') }} {{ __('Principal') }} {{ __('Outstanding') }} {{ __('Term') }} {{ __('Issued') }} {{ __('Status') }}
{{ $loan->borrower_label }} @if ($loan->kind === 'employee') {{ $loan->kindLabel() }} @endif {{ $loan->currency_code }} {{ number_format((float) $loan->principal, 2) }} {{ $loan->currency_code }} {{ number_format($loan->outstanding(), 2) }} {{ $loan->term_months }} {{ __('mo') }}@if ($loan->kind === 'employee' && $loan->repay_via_payroll)· {{ __('payroll') }}@endif {{ $loan->issued_on->format('d M Y') }} @if ($loan->paid_out_on){{ __('paid out before recording') }}@endif {{ ucfirst($loan->status) }} @if ($loan->status === 'rejected' && $loan->blocked_reason){{ $loan->blocked_reason }}@endif @if ($loan->status === 'pending' && $canApprove) {{ __('Approve') }} @endif @if ($loan->status === 'active' && $canManage) @endif
{{ $loans->links() }}
@endif
{{-- Apply modal --}} {{ __('Apply for a staff loan') }}
@if ($hasSalary)

{{ __('Maximum: one month of your salary. Repaid from payroll over up to 3 months.') }}

@endif
{{ __('Cancel') }} {{ __('Submit request') }}
{{-- Salary advance, recorded by a director for an employee --}} {{ __('Record a salary advance') }}

{{ __('Money given to an employee ahead of their pay, repaid from payroll. Up to one month of their salary, over 1 to :n months; deductions never take their net pay below zero.', ['n' => $maxTerm]) }}

@if ($adv_already_paid)
@endif
! $adv_already_paid])>
{{ __('Cancel') }} {{ __('Record advance') }} {{ __('Saving…') }}
{{-- Approve, with the approver's repayment split --}} {{ __('Approve :kind', ['kind' => strtolower($approveLoan?->kindLabel() ?? __('Staff loan'))]) }} @if ($approveLoan)

{{ $approveLoan->borrower_label }} · {{ $approveLoan->currency_code }} {{ number_format((float) $approveLoan->principal, 2) }}

{{ __('Asked for :n month(s). The schedule is rebuilt from your choice.', ['n' => $approveLoan->term_months]) }}

@endif
{{ __('Cancel') }} {{ __('Approve') }}
{{-- Reject modal --}} {{ __('Reject loan request') }} {{ __('Cancel') }} {{ __('Reject') }} {{-- Outbound modal --}} {{ __('Lend company cash out') }}
{{ __('Cancel') }} {{ __('Issue loan') }}
{{-- Repay modal --}} {{ __('Record a repayment') }}
{{ __('Cancel') }} {{ __('Record') }}
{{-- Schedule viewer --}} {{ __('Repayment schedule') }} @if ($viewLoan)
{{ $viewLoan->borrower_label }} {{ $viewLoan->currency_code }} {{ number_format((float) $viewLoan->principal, 2) }} · {{ __('outstanding') }} {{ number_format($viewLoan->outstanding(), 2) }}
@foreach ($viewLoan->installments as $inst) @endforeach
#{{ __('Due') }}{{ __('Amount') }}{{ __('Paid') }}{{ __('Status') }}
{{ $inst->sequence }} {{ $inst->due_date->format('d M Y') }} {{ number_format((float) $inst->amount, 2) }} {{ number_format((float) $inst->paid_amount, 2) }} {{ ucfirst($inst->status) }}
@if ($viewLoan->repayments->isNotEmpty())

{{ __('Repayments') }}

    @foreach ($viewLoan->repayments->sortByDesc('occurred_on') as $rep)
  • {{ $rep->occurred_on->format('d M Y') }} ({{ $rep->source }}) {{ $rep->currency_code }} {{ number_format((float) $rep->amount, 2) }}
  • @endforeach
@endif @endif
{{ __('Close') }}