Merged in bugfix/nisha-wtd (pull request #139)

update-wtd
This commit is contained in:
nurulnisha muhammad
2025-12-21 03:11:06 +00:00
4 changed files with 217 additions and 21 deletions
+23 -2
View File
@@ -14,14 +14,35 @@
<div class="flex flex-row font-normal text-gray-700 dark:text-gray-400">
<div class="w-1/3">Jumlah WTD</div>
<div>:</div>
<div class="ml-2 w-1/3"><b>RM {{ formattext(sb.baki) }} </b></div>
<!-- <div class="flex items-center ml-2 w-1/3"><b>RM {{ formattext(sb.baki) }} </b></div> -->
<div class="flex items-baseline ml-2 w-1/3">
<span class="text-sm mr-1">RM</span><span class="text-lg font-bold">{{ formattext(sb.baki) }}</span>
</div>
</div>
<div class="flex flex-row font-normal text-gray-700 dark:text-gray-400">
<div class="w-1/3">Tarikh Proses WTD
<div class="w-1/3">Tahun Lelong
</div>
<div>:</div>
<div class="ml-2 w-1/3"><b> {{ (sb.tahun) ? sb.tahun : 'Tiada' }} </b></div>
</div>
<div class="flex flex-row font-normal text-gray-700 dark:text-gray-400">
<div class="w-1/3">Bulan Lelong
</div>
<div>:</div>
<div class="ml-2 w-1/3"><b> {{ (sb.bulan) ? sb.bulan : 'Tiada' }} </b></div>
</div>
<div class="flex flex-row font-normal text-gray-700 dark:text-gray-400">
<div class="w-1/3">Tarikh Proses
</div>
<div>:</div>
<div class="ml-2 w-1/3"><b> {{ (sb.t_jual) ? sb.t_jual : 'Tiada' }} </b></div>
</div>
<div class="flex flex-row font-normal text-gray-700 dark:text-gray-400">
<div class="w-1/3">Tarikh Hantar
</div>
<div>:</div>
<div class="ml-2 w-1/3"><b> {{ (sb.t_htr_ag) ? sb.t_htr_ag : 'Tiada' }} </b></div>
</div>
<div class="flex flex-row font-normal text-gray-700 dark:text-gray-400">
<div class="w-1/3">Status
</div>
+62 -18
View File
@@ -19,7 +19,7 @@
</div>
<div class="p-4">
<button @click.prevent="promptdeletewtd" :disabled="aktif == 1" :class="{'hover:bg-red-600 bg-red-600 border-red-600': aktif == 0}" class="border border-red-300 text-white bg-red-300 font-montserrat py-2 px-8 font-medium rounded-xl transition-all duration-300"><i class="fas fa-trash-alt"></i></button>
<button @click.prevent="promptwtd" :disabled="aktif == 1" :class="{'hover:bg-yellow-600 bg-yellow-600 border-yellow-600': aktif == 0}" class="border border-yellow-300 text-white bg-yellow-300 font-montserrat py-2 px-8 font-medium rounded-xl transition-all duration-300">Proses WTD</button>
<button @click.prevent="promptwtd" :disabled="aktif == 1" :class="{'hover:bg-yellow-600 bg-yellow-600 border-yellow-600': aktif == 0}" class="border border-yellow-300 text-white bg-yellow-300 font-montserrat py-2 px-8 font-medium rounded-xl transition-all duration-300">Serahan WTD</button>
<span v-if="batchno != 0" class="text-lg font-bold ml-3">Batchno: {{ this.batchno }}</span>
</div>
</div>
@@ -38,9 +38,9 @@
<th scope="col" class="px-6 py-3">
Tarikh Lelong
</th>
<th scope="col" class="px-6 py-3">
<!-- <th scope="col" class="px-6 py-3">
Pembiayaan
</th>
</th> -->
<th scope="col" class="px-6 py-3">
Baki
</th>
@@ -60,9 +60,9 @@
<td class="px-6 py-4">
{{ bl.t_jual }}
</td>
<td class="px-6 py-4">
<!-- <td class="px-6 py-4">
{{ formattext(bl.pinjaman) }}
</td>
</td> -->
<td class="px-6 py-4">
{{ formattext(bl.baki) }}
</td>
@@ -103,7 +103,7 @@ export default {
kodcaw: this.$kodcaw,
}
}).then(response => {
console.log(response);
//console.log(response);
this.arraybakilelong = response.data;
})
},
@@ -153,7 +153,7 @@ export default {
if (boolkatalaluan == 1) {
await this.$swal({
title: 'Proses WTD?',
title: 'Serahan WTD?',
text: "anda tidak boleh ulang kembali setelah di proses!",
icon: 'warning',
showCancelButton: true,
@@ -165,16 +165,59 @@ export default {
if (result.isConfirmed) {
//new added
this.$swal({
title: "Masukkan No Cek:",
// text: "Write something interesting:",
input: 'text',
showCancelButton: true
}).then((result) => {
if (result.value) {
this.proseswtd(result.value);
}
});
title: 'Sila Isi Butiran Berikut',
html: `
<div class="swal-form">
<div class="swal-row">
<label>No Cek</label>
<input id="noCek" class="swal2-input" placeholder="Masukkan No Cek">
</div>
<div class="swal-row">
<label>Tarikh Hantar ke AG</label>
<input
id="tarikhAG"
type="date"
class="swal2-input"
max="${new Date().toISOString().split('T')[0]}"
>
</div>
</div>
`,
focusConfirm: false,
showCancelButton: true,
confirmButtonText: 'Simpan',
cancelButtonText: 'Batal',
customClass: {
popup: 'swal-popup',
confirmButton: 'swal-confirm',
cancelButton: 'swal-cancel'
},
preConfirm: () => {
const noCek = document.getElementById('noCek').value.trim();
const tarikhAG = document.getElementById('tarikhAG').value;
if (!noCek || !tarikhAG) {
this.$swal.showValidationMessage(
'Sila masukkan No Cek dan Tarikh Hantar ke AG'
);
return false;
}
return { noCek, tarikhAG };
}
}).then((result) => {
if (result.isConfirmed) {
this.proseswtd(result.value.noCek, result.value.tarikhAG);
}
});
//end new added
}
});
} else {
@@ -197,11 +240,12 @@ export default {
}
});
},
proseswtd: function (nocek) {
proseswtd: function (nocek,tarikhAG) {
this.axios.post(this.$hostname + '/admin/wtd/process', {
kodcaw: this.$kodcaw,
batch: this.batchno,
nocek: nocek
nocek: nocek,
tarikhAG: tarikhAG
}).then(response => {
if (response.data == 'success') {
+1 -1
View File
@@ -8,7 +8,7 @@
<div class="pt-6 px-4">
<breadcrumb :items="[{ 'title' : 'Wang Tak Dituntut', 'icon' : 'fas fa-gavel' }]"></breadcrumb>
<wtdindex-component></wtd-component>
<wtdindex-component></wtdindex-component>
</div>
</main>
+131
View File
@@ -0,0 +1,131 @@
@extends('layouts.app')
@section('content')
<div class="container mx-auto mt-10">
@if (session('success'))
<div class="bg-green-100 text-green-800 px-4 py-3 rounded mb-4">
{{ session('success') }}
</div>
@endif
<h2 class="text-2xl font-bold mb-6">Senarai Batch Simulasi Untuk Tahun: {{ $year }}</h2>
<div class="flex justify-end items-center mb-4">
<h3 class="text-lg font-semibold">Jumlah Baki Lelong:
<span id="total-baki" class="text-yellow-600">RM 0.00</span>
</h3>
</div>
<form id="proses-wtd-form" method="POST" action="{{ route('wtd.simulasi.pengesahan') }}">
@csrf
<div class="overflow-x-auto">
<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">#</th>
<th class="border border-gray-200 px-4 py-2">Bulan</th>
<th class="border border-gray-200 px-4 py-2">Jumlah SAG</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>
<th class="border border-gray-200 px-4 py-2 text-center">
<input id="select-all" type="checkbox" class="cursor-pointer">
</th>
</tr>
</thead>
<tbody>
{{-- @dd($senaraiSimulasi); --}}
@foreach ($senaraiSimulasi as $index => $item)
<input type="hidden" name="tahun" value="{{ $year }}"/>
<tr class="{{ $index % 2 == 0 ? 'bg-gray-100' : 'bg-white' }}">
<td class="border border-gray-300 px-4 py-2 text-center">{{ $index + 1 }}</td>
<td class="border border-gray-300 px-4 py-2">
<a href="{{ route('wtd.simulasi.rekod', [
'month' => $item['bulan'],
'year' => $year,
'kodcaw' => $item['kodcaw'],
]) }}"
class="text-yellow-600 hover:underline">
{{ $item['bulan'] }}
</a>
<input type="hidden" name="data[{{ $index }}][kodcaw]"
value="{{ $item['kodcaw'] }}">
<input type="hidden" name="data[{{ $index }}][bulan]"
value="{{ $item['bulan'] }}">
</td>
<td class="border border-gray-300 px-4 py-2 text-center">
{{ $item['jumlah_norujukan'] ?? 0 }}
<input type="hidden" name="data[{{ $index }}][jumlah_norujukan]"
value="{{ $item['jumlah_norujukan'] }}">
</td>
<td class="border border-gray-300 px-4 py-2">
{{ number_format($item['pembiayaan'], 2) }}
<input type="hidden" name="data[{{ $index }}][pembiayaan]"
value="{{ $item['pembiayaan'] }}">
</td>
<td class="border border-gray-300 px-4 py-2" data-baki="{{ $item['baki'] }}">
{{ number_format($item['baki'], 2) }}
<input type="hidden" name="data[{{ $index }}][baki]"
value="{{ $item['baki'] }}">
</td>
<td class="border border-gray-300 px-4 py-2 text-center">
<input type="checkbox" class="row-checkbox" data-baki="{{ $item['baki'] }}"
name="data[{{ $index }}][selected]">
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="flex justify-end mt-4">
<button type="submit" id="proses-wtd-btn"
class="bg-yellow-600 text-white px-6 py-2 rounded cursor-pointer hover:bg-yellow-700">
Jana Simulasi
</button>
</div>
</form>
</div>
@include('layouts.footer')
@endsection
<script>
document.addEventListener('DOMContentLoaded', function() {
const selectAllCheckbox = document.getElementById('select-all');
const rowCheckboxes = document.querySelectorAll('.row-checkbox');
const totalBakiElement = document.getElementById('total-baki');
function formatCurrency(amount) {
return `RM ${amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')}`;
}
function calculateTotalBaki() {
let total = 0;
rowCheckboxes.forEach(checkbox => {
if (checkbox.checked) {
total += parseFloat(checkbox.dataset.baki);
}
});
totalBakiElement.textContent = formatCurrency(total);
}
selectAllCheckbox.addEventListener('change', function() {
rowCheckboxes.forEach(checkbox => {
checkbox.checked = this.checked;
});
calculateTotalBaki();
});
rowCheckboxes.forEach(checkbox => {
checkbox.addEventListener('change', function() {
if (!this.checked) {
selectAllCheckbox.checked = false;
}
if (Array.from(rowCheckboxes).every(cb => cb.checked)) {
selectAllCheckbox.checked = true;
}
calculateTotalBaki();
});
});
});
</script>