added autoserahan

This commit is contained in:
Hafifie PKB
2025-03-17 11:39:56 +08:00
parent a2331b0bed
commit 5ee3d492fc
3 changed files with 164 additions and 19 deletions
+96 -17
View File
@@ -24,28 +24,44 @@
<table class="min-w-full leading-normal">
<thead class="text-center">
<tr>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Bil</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Cawangan</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Pemohon</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Amaun</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Tindakan</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-xs font-semibold text-gray-600 uppercase tracking-wider text-center">Bil</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-xs font-semibold text-gray-600 uppercase tracking-wider text-center">Cawangan</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-xs font-semibold text-gray-600 uppercase tracking-wider text-center">Tindakan</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-xs font-semibold text-gray-600 uppercase tracking-wider text-center">Pemohon</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-xs font-semibold text-gray-600 uppercase tracking-wider text-center">Amaun</th>
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-xs font-semibold text-gray-600 uppercase tracking-wider text-center">Tindakan</th>
</tr>
</thead>
@if ($list->count() > 0)
@foreach($list as $item)
<tbody>
<tr>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">{{ $item['id'] }}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">{{ $item['kodcaw'] }}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">{{ $item['pc_name'] }}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">{{ number_format($item['amount'], 2) }}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<a href="{{ route('autoserahan.approve', ['id' => $item['id'], 'kodcaw' => $item['kodcaw'], 'teller' => $item['pc_name'], 'amaun' => $item['amount']]) }}" 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="{{ route('autoserahan.reject', ['id' => $item['id'], 'kodcaw' => $item['kodcaw'], 'teller' => $item['pc_name'], 'amaun' => $item['amount']]) }}" 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 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">
@if($item['action'] === 'create')
<span class="inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-800 ring-1 ring-green-600/20 ring-inset">
Create
</span>
@elseif($item['action'] === 'delete')
<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>
@endif
</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">{{ number_format($item['amount'], 2) }}</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm text-center">
<a href="{{ route('autoserahan.approve', ['id' => $item['id'], 'kodcaw' => $item['kodcaw'], 'teller' => $item['pc_name'], 'amaun' => $item['amount']]) }}"
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="{{ route('autoserahan.reject', ['id' => $item['id'], 'kodcaw' => $item['kodcaw'], 'teller' => $item['pc_name'], 'amaun' => $item['amount']]) }}"
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>
</tr>
</tbody>
@@ -53,7 +69,7 @@
@else
<tbody>
<tr>
<td colspan="5" class="text-center py-5 text-gray-500 text-sm font-semibold">Tiada data</td>
<td colspan="5" class="text-center bg-white py-5 text-gray-500 text-sm font-semibold">Tiada data</td>
</tr>
</tbody>
@endif
@@ -65,4 +81,67 @@
</div>
</div>
</main>
@include('layouts.footer')
</div>
@push('additional_scripts')
<script>
async function requestPasswordAndSend(element) {
const {
value: katalaluan
} = await Swal.fire({
title: 'Masukkan Katalaluan Semula',
input: 'password',
inputPlaceholder: 'Katalaluan',
confirmButtonText: 'Hantar',
showCancelButton: true,
cancelButtonText: 'Batal',
allowOutsideClick: false
});
boolkatalaluan = 0;
if (katalaluan) {
$.ajax({
url: '/mintasemulakelulusan',
type: 'GET',
data: { passsemula: katalaluan },
success: function(response) {
boolkatalaluan = response;
if (boolkatalaluan == 1) {
Swal.fire({
title: 'Success',
text: 'Katalaluan Sah',
icon: 'success',
confirmButtonText: 'OK',
allowOutsideClick: false,
allowEscapeKey: false,
}).then((result) => {
if (result.isConfirmed) {
window.location.href = element.href;
}
});
} else {
Swal.fire('Error', 'Katalaluan Tidak Sah', 'error');
}
},
error: function(xhr, status, error) {
console.error('Error:', error);
Swal.fire('Error', 'Something went wrong!', 'error');
}
});
}else{
return false;
}
}
function confirmApproval(event, element) {
event.preventDefault();
requestPasswordAndSend(element);
}
</script>
@endpush
@endsection
+1 -1
View File
@@ -32,7 +32,7 @@
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.sidebar {
height: 100%;