set shipper_branch to load & map loads in warehouse view

This commit is contained in:
Alexandro Uc Santos
2025-03-01 18:58:48 -06:00
parent 1a857f989d
commit 87c3e8a678
4 changed files with 71 additions and 32 deletions

View File

@@ -75,16 +75,11 @@
onMounted(() => {
window.addEventListener('resize', handleResize);
// mapRef.value = this.$refs.myMap;
if(window.innerWidth <= 1024) {
zoom.value = 4;
heightMap.value = 420;
}
// if(companyStore.locationsLoads.length <= 0) {
// getLocations();
// }
formLoad.owner = auth.user?.first_name + ' ' + auth.user?.last_name;
//origin_formatted_address
if(loadStore.currentLoad){
const dateStart = getDateTime(loadStore.currentLoad.est_loading_date, 0);
const dateEnd = getDateTime(loadStore.currentLoad.est_unloading_date, 0);
@@ -100,10 +95,7 @@
formLoad.weight = loadStore.currentLoad.weight;
formLoad.dateLoad = dateStart.substring(0, 10);
formLoad.dateDownload = dateEnd.substring(0, 10);
// formLoad.dateLoad = loadStore.currentLoad.est_loading_date?.substring(0, 10);
// formLoad.dateDownload = loadStore.currentLoad.est_unloading_date?.substring(0, 10);
formLoad.truckType = loadStore.currentLoad.truck_type ? {meta_value: loadStore.currentLoad.truck_type} : null;
origin.locationName = loadStore.currentLoad.origin.company_name;
origin.address = loadStore.currentLoad.origin.street_address1;
origin.state = loadStore.currentLoad.origin?.state ? { state_name: loadStore.currentLoad.origin.state } : null;
@@ -119,6 +111,7 @@
destination.country = loadStore.currentLoad.destination.country;
destination.postalCode = loadStore.currentLoad.destination.zipcode;
destinationRef.value = loadStore.currentLoad.destination.landmark;
locationLoadSelected.value = loadStore.currentLoad?.shipper_warehouse || null; /// Selected warehouse
getCoordsMap();
}
@@ -197,6 +190,7 @@
});
const origin = reactive({
id: null,
locationName: '',
address: '',
state: '',
@@ -254,10 +248,10 @@
},
company: auth.user.company,
posted_by: auth.user._id,
posted_by_name: formLoad.owner
posted_by_name: formLoad.owner,
shipper_warehouse: locationLoadSelected.value?._id || null,
};
return loadData;
}
@@ -269,7 +263,8 @@
const dataLocal = {
company: auth.user.company,
categories: formLoad.segment || null,
product: formLoad.terms?.length <= 0 ? null : formLoad.terms
product: formLoad.terms?.length <= 0 ? null : formLoad.terms,
shipper_warehouse: locationLoadSelected.value,
};
if(resp) {
const index = loadStore.loads.findIndex((load) => load._id === resp._id);
@@ -289,7 +284,8 @@
const load = {
...resp,
...loadData,
categories: [loadData.categories]
categories: [loadData.categories],
shipper_warehouse: locationLoadSelected.value,
}
loadStore.loads.unshift(load);