update: fixing non tps
parent
b95e93d3c2
commit
0390d630b3
|
|
@ -215,6 +215,31 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||||
const DETAIL_DATA_URL = "/driver/json/detail-penjemputan-non-tps.json";
|
const DETAIL_DATA_URL = "/driver/json/detail-penjemputan-non-tps.json";
|
||||||
const DEFAULT_TPS_NAME = "Lokasi Pengangkutan 1";
|
const DEFAULT_TPS_NAME = "Lokasi Pengangkutan 1";
|
||||||
|
|
||||||
|
function isBrowserFile(file) {
|
||||||
|
return file instanceof File;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveStoredPhoto(file) {
|
||||||
|
return isBrowserFile(file) ? file : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStoredPhotoUrl(file) {
|
||||||
|
if (isBrowserFile(file)) return URL.createObjectURL(file);
|
||||||
|
if (typeof file === 'string') return file;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStoredPhotoName(file, defaultName = 'Foto') {
|
||||||
|
if (isBrowserFile(file)) return file.name;
|
||||||
|
if (typeof file === 'string') return file.split('/').pop() || defaultName;
|
||||||
|
return defaultName;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStoredPhotoSize(file) {
|
||||||
|
if (isBrowserFile(file)) return file.size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
function initializeLocation() {
|
function initializeLocation() {
|
||||||
tpsData = [{
|
tpsData = [{
|
||||||
name: DEFAULT_TPS_NAME,
|
name: DEFAULT_TPS_NAME,
|
||||||
|
|
@ -540,7 +565,7 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||||
if (displayWaktu) displayWaktu.value = formatted;
|
if (displayWaktu) displayWaktu.value = formatted;
|
||||||
|
|
||||||
getLocationUpdate();
|
getLocationUpdate();
|
||||||
saveState();
|
scheduleAutoSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reverseGeocode(lat, lng) {
|
function reverseGeocode(lat, lng) {
|
||||||
|
|
@ -562,7 +587,7 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||||
if (latInput) latInput.value = lat;
|
if (latInput) latInput.value = lat;
|
||||||
if (lngInput) lngInput.value = lng;
|
if (lngInput) lngInput.value = lng;
|
||||||
}
|
}
|
||||||
saveState();
|
scheduleAutoSave();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
tps.latitude = lat;
|
tps.latitude = lat;
|
||||||
|
|
@ -576,7 +601,7 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||||
if (latInput) latInput.value = lat;
|
if (latInput) latInput.value = lat;
|
||||||
if (lngInput) lngInput.value = lng;
|
if (lngInput) lngInput.value = lng;
|
||||||
}
|
}
|
||||||
saveState();
|
scheduleAutoSave();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -943,7 +968,7 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||||
formatWeightDisplay(totalAnorganik);
|
formatWeightDisplay(totalAnorganik);
|
||||||
if (grandTotalResiduDisplay)
|
if (grandTotalResiduDisplay)
|
||||||
grandTotalResiduDisplay.textContent = formatWeightDisplay(totalResidu);
|
grandTotalResiduDisplay.textContent = formatWeightDisplay(totalResidu);
|
||||||
saveState();
|
scheduleAutoSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimbanganUploadStateMarkup(hasFile, isUploaded, hasValidWeight) {
|
function getTimbanganUploadStateMarkup(hasFile, isUploaded, hasValidWeight) {
|
||||||
|
|
@ -1250,7 +1275,7 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||||
if (itemIndex >= 0 && tps.timbangan[itemIndex]) {
|
if (itemIndex >= 0 && tps.timbangan[itemIndex]) {
|
||||||
tps.timbangan[itemIndex].uploaded = false;
|
tps.timbangan[itemIndex].uploaded = false;
|
||||||
refreshTimbanganUploadState(item);
|
refreshTimbanganUploadState(item);
|
||||||
saveState();
|
scheduleAutoSave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue