diff --git a/wwwroot/driver/js/detail-penjemputan-non-tps.js b/wwwroot/driver/js/detail-penjemputan-non-tps.js index d01b80b..c002728 100644 --- a/wwwroot/driver/js/detail-penjemputan-non-tps.js +++ b/wwwroot/driver/js/detail-penjemputan-non-tps.js @@ -1040,6 +1040,13 @@ document.addEventListener('DOMContentLoaded', function() { alert('Berat belum valid. Isi manual dulu sebelum upload foto timbangan.'); return; } + + const _ext = (tps.timbangan[itemIndex].file.name.split('.').pop() || 'jpg').toLowerCase(); + const _jenis = (tps.timbangan[itemIndex].jenisSampah[0] || 'residu').toLowerCase(); + const _beratStr = parseFloat(weight.toFixed(2)).toString().replace('.', '_'); + const _newName = `timbangan${itemIndex + 1}-${_jenis}-${_beratStr}.${_ext}`; + tps.timbangan[itemIndex].file = new File([tps.timbangan[itemIndex].file], _newName, { type: tps.timbangan[itemIndex].file.type, lastModified: tps.timbangan[itemIndex].file.lastModified }); + alert(`Upload foto timbangan #${itemIndex + 1}\nBerat: ${formatWeightDisplay(weight)} kg\n(Implementasi upload ke server)`); tps.timbangan[itemIndex].uploaded = true; diff --git a/wwwroot/driver/js/detail-penjemputan-tps.js b/wwwroot/driver/js/detail-penjemputan-tps.js index a530adf..e5e7761 100644 --- a/wwwroot/driver/js/detail-penjemputan-tps.js +++ b/wwwroot/driver/js/detail-penjemputan-tps.js @@ -1197,7 +1197,13 @@ async function applyWatermark(file, photoNumber) { alert('Berat belum valid. Isi manual dulu sebelum upload foto timbangan.'); return; } - + + const _ext = (timbanganItem.file.name.split('.').pop() || 'jpg').toLowerCase(); + const _jenis = timbanganItem.jenisSampah.toLowerCase(); + const _beratStr = parseFloat(timbanganItem.weight.toFixed(2)).toString().replace('.', '_'); + const _newName = `timbangan${itemIndex + 1}-${_jenis}-${_beratStr}.${_ext}`; + timbanganItem.file = new File([timbanganItem.file], _newName, { type: timbanganItem.file.type, lastModified: timbanganItem.file.lastModified }); + alert(`Upload foto timbangan #${itemIndex + 1} untuk ${tps.name}\nJenis: ${timbanganItem.jenisSampah}\nBerat: ${timbanganItem.weight} kg\n(Implementasi upload ke server)`); timbanganItem.uploaded = true;