add: search vehicles view & fixes: bugs state

This commit is contained in:
Alexandro Uc Santos
2024-08-17 18:56:22 -06:00
parent 3cd6715c4b
commit 84c0595f5b
24 changed files with 392 additions and 75 deletions

View File

@@ -86,11 +86,8 @@
formLoad.owner = auth.user?.first_name + ' ' + auth.user?.last_name;
//origin_formatted_address
if(loadStore.currentLoad){
// console.log(loadStore.currentLoad)
const dateStart = getDateTime(loadStore.currentLoad.est_loading_date, 0);
const dateEnd = getDateTime(loadStore.currentLoad.est_unloading_date, 0);
console.log(dateStart)
console.log(dateEnd)
formLoad.price = loadStore.currentLoad.actual_cost;
formLoad.segment = loadStore.currentLoad.categories?.length <= 0 ? [] : loadStore.currentLoad.categories.map(m =>{
return m;
@@ -275,13 +272,18 @@
if(loadStore.currentLoad){
const resp = await loadStore.updateLoad(loadStore.currentLoad._id, loadData);
isLoading.value = false;
const dataLocal = {
company: auth.user.company,
categories: formLoad.segment || null,
product: formLoad.terms?.length <= 0 ? null : formLoad.terms
};
if(resp) {
const index = loadStore.loads.findIndex((load) => load._id === resp._id);
loadStore.loads[index] = {
...loadStore.loads[index],
...resp
...resp,
...dataLocal,
};
return 'success';
} else {
return 'error';
@@ -295,6 +297,7 @@
...loadData,
categories: [loadData.categories]
}
loadStore.loads.unshift(load);
return 'success';
} else {