@extends('layouts.app') @section('title', 'Customer deposits') @section('content')

Customer deposits

{{ $accounts->total() }} deposit account(s). Money held is a liability until it is refunded.

@include('components.kpi', ['label' => 'Held now', 'value' => money($totals['held']), 'variant' => 'warn']) @include('components.kpi', ['label' => 'Ever deposited', 'value' => money($totals['deposited']), 'variant' => 'info']) @include('components.kpi', ['label' => 'Ever refunded', 'value' => money($totals['refunded']), 'variant' => 'good']) @include('components.kpi', ['label' => 'Accounts', 'value' => (string) $totals['accounts']])

Open a deposit account

@csrf
If the customer already has an account it is opened instead of duplicated. @error('customer_id'){{ $message }}@enderror

Rules

Refunds are capped
You cannot refund more than the balance held. Handing back more than was taken is a write-off, not a refund.
One account per customer
Opening for an existing customer brings up their current account.
Closing
An account with a balance cannot be closed — refund it first.

Accounts

@if ($accounts->isEmpty()) @include('components.empty-state', [ 'icon' => '💳', 'title' => 'No deposit accounts', 'message' => 'Open one above to hold a security deposit against CPE or damage.', ]) @else @foreach ($accounts as $account) @endforeach
CustomerBalanceDeposited RefundedMovementsLast movement
{{ $account->customer?->display_name ?: '—' }}
{{ $account->customer?->customer_number }}
{{ money($account->balance) }} {{ money($account->total_deposited) }} {{ money($account->total_refunded) }} {{ $account->transactions->count() }} {{ $account->transactions->max('created_at')?->diffForHumans() ?: '—' }} Open
@endif
@if ($accounts->hasPages())
{{ $accounts->links('partials.pagination') }}
@endif
@endsection