Files
admin-erahn/resources/views/wtd/simulasi/pengesahan.blade.php
T
2025-09-25 11:59:19 +08:00

90 lines
4.1 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container mx-auto mt-10">
<h1 class="text-2xl font-bold text-center my-4">Pengesahan Simulasi WTD</h1>
{{-- Display success or error messages --}}
@if (session('success'))
<div class="bg-green-500 text-white px-4 py-2 rounded mb-4">
{{ session('success') }}
</div>
@elseif (session('error'))
<div class="bg-red-500 text-white px-4 py-2 rounded mb-4">
{{ session('error') }}
</div>
@endif
<div class="overflow-x-auto">
<div>
<h5 class="text-lg font-semibold">Maklumat Simulasi yang Dipilih</h5>
</div>
<div class="py-2">
<a href="{{ url()->previous() }}"
class="inline-block bg-gray-500 hover:bg-gray-600 text-white px-4 py-2 rounded">
Kembali
</a>
</div>
@if (!empty($insertedRecords) && count($insertedRecords) > 0)
@php
// Calculate total baki
$totalBakiLelong = array_reduce(
$insertedRecords,
function ($sum, $record) {
return $sum + $record['baki'];
},
0,
);
@endphp
<table class="table-auto w-full border-collapse border border-gray-300">
<thead>
<tr class="bg-yellow-600 text-white">
<th class="border border-gray-200 px-4 py-2">Bulan</th>
<th class="border border-gray-200 px-4 py-2">Jumlah No Rujukan</th>
<th class="border border-gray-200 px-4 py-2">Pembiayaan</th>
<th class="border border-gray-200 px-4 py-2">Baki</th>
</tr>
</thead>
<tbody>
@foreach ($insertedRecords as $index => $record)
<tr class="{{ $index % 2 == 0 ? 'bg-gray-100' : 'bg-white' }}">
<td class="border border-gray-300 px-4 py-2 text-center">{{ $record['bulan'] }}</td>
<td class="border border-gray-300 px-4 py-2 text-center">{{ $record['jumlah_sag'] }}</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ number_format($record['pembiayaan'], 2) }}
</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ number_format($record['baki'], 2) }}
</td>
</tr>
@endforeach
<!-- Add the total row -->
<tr class="bg-gray-200 font-bold">
<td class="border border-gray-300 px-4 py-2 text-center" colspan="3">Jumlah Baki Lelong</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ number_format($totalBakiLelong, 2) }}
</td>
</tr>
</tbody>
</table>
@else
<p class="text-center text-gray-600 mt-4">Tiada data yang dipilih untuk pengesahan.</p>
@endif
</div>
<div class="flex justify-center mt-6">
<form action="{{ route('wtd.simulasi.proses-pengesahan') }}" method="POST">
@csrf
<input type="hidden" name="records" value="{{ json_encode($insertedRecords) }}">
<input type="hidden" name="kodcaw" value="{{ json_encode($kodcaw) }}">
<button type="submit" class="bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700">
Sahkan
</button>
</form>
</div>
</div>
@include('layouts.footer')
@endsection