@extends('layouts.user') @section('title', __('accounts.title')) @section('content') @php $money = fn($v) => number_format((float)$v, 2); $typeLabel = function($type){ return match($type){ 'bank' => __('accounts.bank'), 'mfs' => __('accounts.mfs'), 'cash' => __('accounts.cash'), default => ucfirst($type), }; }; $typeBadge = function($type){ return match($type){ 'bank' => 'bg-blue-50 text-blue-700 border-blue-200', 'mfs' => 'bg-violet-50 text-violet-700 border-violet-200', 'cash' => 'bg-amber-50 text-amber-700 border-amber-200', default => 'bg-slate-50 text-slate-700 border-slate-200', }; }; $statusBadge = function($status){ return $status === 'active' ? 'bg-emerald-50 text-emerald-700 border-emerald-200' : 'bg-rose-50 text-rose-700 border-rose-200'; }; @endphp
{{-- Header --}}
{{ __('accounts.title') }}
{{ __('accounts.title') }}
@if(session('ok'))
{{ session('ok') }}
@endif @if(session('err'))
{{ session('err') }}
@endif {{-- Summary Cards --}}
{{ __('accounts.total_accounts') }}
{{ $summary['total_accounts'] }}
{{ __('accounts.active') }}: {{ $summary['active_accounts'] }} | {{ __('accounts.inactive') }}: {{ $summary['inactive_accounts'] }}
{{ __('accounts.bank_balance') }}
{{ $money($summary['bank_balance']) }}
{{ __('accounts.mfs_balance') }}
{{ $money($summary['mfs_balance']) }}
{{ __('accounts.total_balance') }}
{{ $money($summary['total_balance']) }}
{{ __('accounts.cash') }}: {{ $money($summary['cash_balance']) }}
{{-- Account Balance Cards --}} @if($allAccounts->count())
{{ __('accounts.account_balance_cards') }}
@foreach($allAccounts as $account) @php $cardClass = 'border-slate-200 bg-gradient-to-br from-slate-50 via-white to-slate-100/80'; $orb1 = 'bg-slate-200/50'; $orb2 = 'bg-slate-300/30'; $wave = 'from-slate-200/40 via-slate-100/30 to-transparent'; $line = 'border-slate-300/40'; $iconClass = 'bg-slate-500/10 text-slate-700'; if ($account->type === 'bank') { $cardClass = 'border-blue-200 bg-gradient-to-br from-blue-50 via-white to-sky-100/80'; $orb1 = 'bg-blue-200/50'; $orb2 = 'bg-sky-200/40'; $wave = 'from-blue-200/40 via-sky-100/30 to-transparent'; $line = 'border-blue-300/40'; $iconClass = 'bg-blue-500/10 text-blue-700'; } elseif ($account->type === 'mfs') { $cardClass = 'border-violet-200 bg-gradient-to-br from-violet-50 via-white to-purple-100/80'; $orb1 = 'bg-violet-200/50'; $orb2 = 'bg-purple-200/40'; $wave = 'from-violet-200/40 via-purple-100/30 to-transparent'; $line = 'border-violet-300/40'; $iconClass = 'bg-violet-500/10 text-violet-700'; } elseif ($account->type === 'cash') { $cardClass = 'border-amber-200 bg-gradient-to-br from-amber-50 via-white to-orange-100/80'; $orb1 = 'bg-amber-200/50'; $orb2 = 'bg-orange-200/40'; $wave = 'from-amber-200/40 via-orange-100/30 to-transparent'; $line = 'border-amber-300/40'; $iconClass = 'bg-amber-500/10 text-amber-700'; } if ($account->current_balance_calc < 0) { $cardClass = 'border-rose-200 bg-gradient-to-br from-rose-50 via-white to-pink-100/80'; $orb1 = 'bg-rose-200/50'; $orb2 = 'bg-pink-200/40'; $wave = 'from-rose-200/40 via-pink-100/30 to-transparent'; $line = 'border-rose-300/40'; $iconClass = 'bg-rose-500/10 text-rose-700'; } @endphp
{{ $account->name }}
{{ $typeLabel($account->type) }} @if($account->account_number) • {{ $account->account_number }} @endif
{{ $account->status === 'active' ? __('accounts.active_upper') : __('accounts.inactive_upper') }}
{{ __('accounts.current_balance') }}
{{ $money($account->current_balance_calc) }}
@if($account->type === 'bank') @elseif($account->type === 'mfs') @elseif($account->type === 'cash') @else @endif
{{ __('accounts.opening') }}
{{ $money($account->opening_balance) }}
{{ __('accounts.type') }}
{{ $typeLabel($account->type) }}
@endforeach
@endif {{-- Filter --}}
{{ __('accounts.reset') }}
{{-- Table --}}
@forelse($accounts as $account) @empty @endforelse
{{ __('accounts.name') }} {{ __('accounts.account_no') }} {{ __('accounts.type') }} {{ __('accounts.status') }} {{ __('accounts.opening') }} {{ __('accounts.current_balance') }} {{ __('accounts.action') }}
{{ $account->name }}
{{ __('accounts.created') }}: {{ optional($account->created_at)->format('d M Y') }}
{{ $account->account_number ?: '-' }} {{ $typeLabel($account->type) }} {{ $account->status === 'active' ? __('accounts.active_upper') : __('accounts.inactive_upper') }} {{ $money($account->opening_balance) }} {{ $money($account->current_balance_calc) }}
{{ __('accounts.ledger') }} {{ __('accounts.edit') }}
{{ __('accounts.no_accounts_found') }}
{{ $accounts->links() }}
@endsection