@extends('layout.app') @section('title', 'Target Savings Details') @section('pagetitle', 'Target Savings Details') @section('content')
@include('includes.errors') @include('includes.success')
customer photo

Name: {{ $customer['first_name'] }} {{ $customer['last_name'] }}

Account Number: {{ number_format($customer['account_balance'], 2) }}

Business Name: {{ $customer['business_name'] ?? 'Nil' }}

Occupation: {{ $customer['occupation'] }}

Gender: {{ $customer['gender'] }}

Account Officer: {{ $customer['account_officer'] }}

Phone: {{ $customer['phone'] }}

Email: {{ $customer['email'] }}

Address: {{ $customer['residential_address'] }}

State: {{ $customer['state'] }}

LGA: {{ $customer['state_lga'] }}

@if ($target->status !== 'rejected') @if ($target->status === 'pending') @if ($target->user_id !== auth()->id()) Approve Reject @endif @else @if ($target->status === 'approved') Terminate @endif @endif @endif

@php $status = strtolower($target->status ?? 'pending'); $colorClass = match ($status) { 'active' => 'color:#198754;', 'pending' => 'color:#f0ad4e;', 'terminate' => 'color:#dc3545;', 'reject' => 'color:#dc3545;', 'closed', 'close' => 'color:#0d6efd;', default => 'color:#6c757d;', }; @endphp
{{ ucfirst($target->status ?? '—') }} Code: {{ $target->code ?? '—' }} Account: {{ $target->account_number ?? '—' }} Created: {{ $target->created_at?->format('d M, Y h:ia') ?? '—' }} Last Update: {{ $target->updated_at?->format('d M, Y h:ia') ?? '—' }}
Target Code Start Date Frequency Target (₦) Auto Save Amount (₦) Interest (%) Total Accrued Interest (₦) Total Saved (₦) Status
{{ $target->code ?? '—' }} {{ $target->auto_save_start_date ? \Carbon\Carbon::parse($target->start_date)->format('d-m-Y') : '—' }} {{ ucfirst($target->frequency ?? '—') }} ₦{{ number_format((float) ($target->target_amount ?? 0), 2) }} ₦{{ number_format((float) ($target->auto_save_amount ?? 0), 2) }} {{ $product->interest_rate ?? '—' }}% ₦{{ number_format((float) ($target->total_accrued_interest ?? 0), 2) }} ₦{{ number_format((float) ($target->total_amount_saved ?? 0), 2) }} {{ ucfirst($target->status ?? '—') }}


@php $fmtDate = fn($d) => $d ? \Carbon\Carbon::parse($d)->format('d M, Y h:ia') : '—'; $fmtDateShort = fn($d) => $d ? \Carbon\Carbon::parse($d)->format('d M, Y') : '—'; $money = fn($n) => '₦' . number_format((float) ($n ?? 0), 2); $fields = [ ['Plan Name', $target->savings_plan_name ?? '—'], [ 'Product', ($product->name ?? '—') . ' (' . ($product->product_code ?? '—') . ')', ], ['Auto Save', $target->auto_save ?? false ? 'Yes' : 'No'], ['Auto Save Start', $fmtDateShort($target->auto_save_start_date ?? null)], [ 'Duration', ($target->duration ?? 0) . ' ' . (($target->duration_unit ?? 'month') . (($target->duration ?? 0) > 1 ? 's' : '')), ], ['Funding Source', $target->funding_source_type ?? '—'], ['Currency', $target->currency ?? 'NGN'], ['Target Code', $target->code ?? '—'], ['Customer ID', $target->customer_id ?? '—'], ['User ID', $target->user_id ?? '—'], ['Product ID', $target->target_savings_products_id ?? '—'], ['Account Number', $target->account_number ?? '—'], ['Target Amount', $money($target->target_amount ?? 0)], ['Frequency', ucfirst($target->frequency ?? '—')], ['Save Now Amount', $money($target->auto_save_amount ?? 0)], ['Status', ucfirst($target->status ?? '—')], ['Start Date', $fmtDateShort($target->start_date ?? null)], ['Maturity Date', $fmtDateShort($target->maturity_date ?? null)], ['Interest Method', ucfirst($target->interest_method ?? '—')], ['Amount Saved', $money($target->total_amount_saved ?? 0)], ['Amount Paid Out', $money($target->amount_paid_out ?? 0)], ['Accrued Interest', $money($target->total_accrued_interest ?? 0)], ['Created By', $target->created_by ?? '—'], ['Approved By', $target->approved_by ?? '—'], ['Declined By', $target->declined_by ?? '—'], // ['Terminated By', $target->use9 ['Updated By', $target->updated_by ?? '—'], ['Created Date', $fmtDate($target->created_date ?? null)], ['Updated Date', $fmtDate($target->updated_date ?? null)], ['Approved At', $fmtDate($target->approved_at ?? null)], ['Declined At', $fmtDate($target->declined_at ?? null)], ['Terminated At', $fmtDate($target->terminate_at ?? null)], ['Created At', $fmtDate($target->created_at ?? null)], ['Updated At', $fmtDate($target->updated_at ?? null)], [ 'Metadata', $target->metadata ? (is_array($target->metadata) ? json_encode($target->metadata) : (string) $target->metadata) : '—', ], ]; @endphp {{-- Render 3 columns per row --}} @foreach (collect($fields)->chunk(3) as $row) @foreach ($row as $i => [$label, $value]) @endforeach {{-- Fill remaining columns if less than 3 --}} @for ($i = count($row); $i < 3; $i++) @endfor @endforeach
{{ $label }}: {{ $value }}

Schedules

@forelse ($schedules as $item) @empty @endforelse
Schedule No Target Code Amount (₦) Due Date Status Disbursed By Disbursed At Paid At Updated At
{{ $item->schedule_no ?? '—' }} {{ $item->target_savings_code ?? '—' }} {{ number_format((float) $item->amount, 2) }} {{ $item->due_date ? \Carbon\Carbon::parse($item->due_date)->format('d M, Y') : '—' }} {{ ucfirst($item->status ?? '—') }} {{ $item->disbursed_by ?? '—' }} {{ $item->disbursed_at ? \Carbon\Carbon::parse($item->disbursed_at)->format('d M, Y H:i') : '—' }} {{ $item->paid_at ? \Carbon\Carbon::parse($item->paid_at)->format('d M, Y H:i') : '—' }} {{ $item->updated_at ? \Carbon\Carbon::parse($item->updated_at)->format('d M, Y H:i') : '—' }}
No schedules found.
@endsection