diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 8aac0ab1..990cb61c 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -380,11 +380,13 @@ TODO: V7 features on wo I haven't coded yet bugbug: empty collection, save, add new item but don't save then click on delete and save and it all goes weird on save, it seems to be trying to save the newly added but deleted record when it should just remove it and get on with it + bugbug: deleting task error at server, steps were to add a task but not fill it out, then add a task group, then click on delete the empty task then save todo: Outside services list section header only one with word "List" in it instead of plural form outside services todo: workorderitemlabor new record stop date sb +1 hour - +todo: errors may or may not be showing correctly, there was a task related error but it highlighted woitems row and nothing in tasks + however this was not supposed to be an error in the first place as it's a bug to do with attempting to delete a new task record todo: stop hiding one line tables in wo form, need them for the extra ui stuff they bring show as a line where the table would be?? But..then why not just show one line table instead?? diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index d0592f66..382abaa9 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -873,17 +873,21 @@ async function deleteUnits(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove(`${API_BASE_URL}items/units/${d.id}`); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "units", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].units.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/units/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "units", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].units.splice(i, 1); } //---- @@ -963,19 +967,21 @@ async function deleteScheduledUsers(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove( - `${API_BASE_URL}items/scheduled-users/${d.id}` - ); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "scheduledUsers", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].scheduledUsers.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/scheduled-users/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "scheduledUsers", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].scheduledUsers.splice(i, 1); } //---- @@ -1020,17 +1026,22 @@ async function deleteTasks(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove(`${API_BASE_URL}items/tasks/${d.id}`); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "tasks", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].tasks.splice(i, 1); + + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/tasks/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "tasks", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].tasks.splice(i, 1); } //---- @@ -1047,17 +1058,21 @@ async function deleteParts(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove(`${API_BASE_URL}items/parts/${d.id}`); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "parts", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].parts.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/parts/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "parts", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].parts.splice(i, 1); } //---- @@ -1102,19 +1117,21 @@ async function deletePartRequests(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove( - `${API_BASE_URL}items/part-requests/${d.id}` - ); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "partRequests", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].partRequests.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/part-requests/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "partRequests", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].partRequests.splice(i, 1); } //---- @@ -1189,19 +1206,21 @@ async function deleteLabors(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove( - `${API_BASE_URL}items/labors/${d.id}` - ); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "labors", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].labors.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/labors/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "labors", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].labors.splice(i, 1); } //---- @@ -1248,19 +1267,22 @@ async function deleteTravels(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove( - `${API_BASE_URL}items/travels/${d.id}` - ); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "travels", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].travels.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/travels/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "travels", + childUid: d.uid + }); + return; + } } + + vm.obj.items[woItemIndex].travels.splice(i, 1); } //---- @@ -1277,19 +1299,21 @@ async function deleteExpenses(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove( - `${API_BASE_URL}items/expenses/${d.id}` - ); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "expenses", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].expenses.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/expenses/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "expenses", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].expenses.splice(i, 1); } //---- @@ -1334,17 +1358,22 @@ async function deleteLoans(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove(`${API_BASE_URL}items/loans/${d.id}`); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "loans", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].loans.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/loans/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "loans", + childUid: d.uid + }); + return; + } } + + vm.obj.items[woItemIndex].loans.splice(i, 1); } //---- @@ -1393,19 +1422,21 @@ async function deleteOutsideServices(vm, woItemIndex) { if (!d.deleted) { continue; } - let res = await window.$gz.api.remove( - `${API_BASE_URL}items/outside-services/${d.id}` - ); - if (res.error) { - handleSaveError(vm, { - error: res.error, - itemUid: vm.obj.items[woItemIndex].uid, - childKey: "outsideServices", - childUid: d.uid - }); - } else { - vm.obj.items[woItemIndex].outsideServices.splice(i, 1); + if (d.id != 0) { + let res = await window.$gz.api.remove( + `${API_BASE_URL}items/outside-services/${d.id}` + ); + if (res.error) { + handleSaveError(vm, { + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "outsideServices", + childUid: d.uid + }); + return; + } } + vm.obj.items[woItemIndex].outsideServices.splice(i, 1); } //----