@extends('layouts.master') @section('title', 'Loans') @section('content')
Payroll

Employee loans

Instalments are deducted in payroll from the start month until the loan is fully repaid.
@can('Employee Loans add')@endcan
Disbursed{{ money($loans->sum('total_amount')) }}
Repaid{{ money($loans->sum('paid_amount')) }}
Outstanding{{ money($loans->where('status', 'active')->sum('balance')) }}
@foreach ($loans as $l) @php $p = $l->total_amount > 0 ? round($l->paid_amount / $l->total_amount * 100) : 0; @endphp @endforeach
EmployeeStartLoanRepaidBalanceInstalmentProgressStatus
@include('partials.person', ['e' => $l->employee]) {{ fmt_date($l->start_date) }} {{ money($l->total_amount, false) }}{{ money($l->paid_amount, false) }} {{ money($l->balance, false) }}{{ money($l->monthly_deduction, false) }}
{{ $p }}% · {{ $l->monthly_deduction > 0 ? ceil($l->balance / $l->monthly_deduction) . ' months left' : '—' }}
{!! status_badge($l->status) !!} @include('partials.row-actions', ['modal' => '#editModal', 'edit' => 'Employee Loans edit', 'delete' => 'Employee Loans delete', 'update' => route('loans.update', $l), 'destroy' => route('loans.destroy', $l), 'title' => 'Edit loan · ' . optional($l->employee)->full_name, 'record' => rec($l, ['total_amount', 'paid_amount', 'monthly_deduction', 'start_date', 'end_date', 'status', 'notes'])])
@include('partials.modal-open', ['title' => 'New loan'])
@include('partials.employee-select', ['employees' => $employees])
@include('partials.modal-close') @include('partials.modal-open', ['id' => 'editModal', 'title' => 'Edit loan'])
@include('partials.modal-close') @endsection