Membuat Sub Menu Data Penawaran dari Menu Tender part 4

This commit is contained in:
2024-10-03 17:48:21 +07:00
parent 5cc18fa0e1
commit 07c0276c34
9 changed files with 614 additions and 513 deletions

View File

@@ -90,38 +90,6 @@
1];
}
</script>
<script type="text/javascript">
function deleteData(data) {
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
});
$.ajax(`tender/penawaran/${data}`, {
type: 'DELETE'
}).then((response) => {
swal.fire('Deleted!', 'User has been deleted.', 'success').then(() => {
window.location.reload();
});
}).catch((error) => {
console.error('Error:', error);
Swal.fire('Error!', 'An error occurred while deleting the file.', 'error');
});
}
})
}
</script>
<script type="module">
const element = document.querySelector('#penawaran-table');
const searchInput = document.getElementById('search');
@@ -146,10 +114,26 @@
},
nama_kjpp_sebelumnya: {
title: 'Nama KJPP Sebelumnya',
render: (item, data) => {
let nama = data.nama_kjpp_sebelumnya;
if (typeof nama === 'string') {
nama = JSON.parse(nama);
}
if (nama.length === 0) {
return `<span class="badge badge-danger badge-xs">Tidak Ada</span>`;
}
return nama.map(n => `<span class="badge badge-primary badge-xs">${n}</span>`).join(' ');
}
},
tanggal_penilaian_sebelumnya: {
title: 'Tanggal Penilaian Sebelumnya',
render: (item, data) => formatDate(new Date(data.tanggal_penilaian_sebelumnya))
render: (item, data) => {
const tanggal = data.tanggal_penilaian_sebelumnya;
if (!tanggal) {
return 'Tidak ada';
}
return formatDate(new Date(tanggal));
}
},
actions: {
title: 'Action',