bug fix when the notifcation appear but can't accept it directly

This commit is contained in:
Hafifie PKB
2025-04-06 16:04:21 +08:00
parent 2c8a44eaab
commit 6509739737
2 changed files with 16 additions and 4 deletions
@@ -91,7 +91,12 @@ class AutoSerahanController extends Controller
$currentPage = $response['current_page'] ?? 1; // Current page
$items = array_map(function ($item) {
$time_created = Carbon::parse($item['created_at']);
$item['cawangan_name'] = $this->CawanganKod($item['kodcaw']);
$item['tarikh'] = $time_created->toDateString();
$item['masa'] = $time_created->format('h:i A');
return $item;
}, $items);
+11 -4
View File
@@ -74,6 +74,7 @@
tableBody.append('<tr><td colspan="8" class="text-center bg-white py-5 text-gray-500 text-sm font-semibold">Tiada data</td></tr>');
return;
}
console.log('this data:',data);
data.forEach((item, index) => {
let actionBadge = '';
@@ -84,20 +85,26 @@
actionBadge = '<span class="inline-flex items-center rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-800 ring-1 ring-red-600/20 ring-inset">Delete</span>';
}
let baseApproveUrl = "{{ route('autoserahan.approve') }}";
let baseRejectUrl = "{{ route('autoserahan.reject') }}";
let approveurl = `${baseApproveUrl}?id=${item.id}&kodcaw=${item.kodcaw}&teller=${item.pc_name}&amaun=${item.amount}`;
let rejecturl = `${baseRejectUrl}?id=${item.id}&kodcaw=${item.kodcaw}&teller=${item.pc_name}&amaun=${item.amount}`;
let row = `
<tr>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${item.id}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${item.cawangan_name}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${item.tarikh}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${item.masa}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${item.tarikh}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${item.masa}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${actionBadge}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${item.pc_name}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">${parseFloat(item.amount).toFixed(2)}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">
<a href="${item.approve_url}" onclick="return confirmApproval(event, this)" class="cursor-pointer bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">
<a href="${approveurl}" onclick="return confirmApproval(event, this)" class="cursor-pointer bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">
<i class="fas fa-thumbs-up mr-1 text-md"></i> Lulus
</a>
<a href="${item.reject_url}" onclick="return confirmApproval(event, this)" class="cursor-pointer bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded">
<a href="${rejecturl}" onclick="return confirmApproval(event, this)" class="cursor-pointer bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded">
<i class="fas fa-thumbs-down mr-1 text-md"></i> Tolak
</a>
</td>