From e03af82f5e02281178001c8a238c8a7a30dc5df1 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 30 Jun 2021 22:56:17 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 6 ++-- .../components/work-order-item-expenses.vue | 30 +++++++++++----- .../src/components/work-order-item-labors.vue | 30 +++++++++++----- .../src/components/work-order-item-loans.vue | 34 ++++++++++++++----- .../work-order-item-outside-services.vue | 29 ++++++++++++---- .../work-order-item-part-requests.vue | 31 ++++++++++++----- .../work-order-item-scheduled-users.vue | 30 +++++++++++----- ayanova/src/components/work-order-items.vue | 26 +++++--------- 8 files changed, 147 insertions(+), 69 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 04ca74f1..9f80d901 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -436,10 +436,8 @@ CURRENTLY DOING: template replacement additions Close case 3897 after this is done -bugbug: can't delete workorder if there is any of the following items on any of it's woitems - woitempart - woitemexpenese - + + bugbug: missing code to delete all items in woitem where it's children get deleted? see work-order-items.vue delete item and delete all item and undelete item diff --git a/ayanova/src/components/work-order-item-expenses.vue b/ayanova/src/components/work-order-item-expenses.vue index 29108255..7c6afbba 100644 --- a/ayanova/src/components/work-order-item-expenses.vue +++ b/ayanova/src/components/work-order-item-expenses.vue @@ -21,17 +21,25 @@ {{ $ay.t("New") }} + + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} + $ayiTrashAlt {{ $ay.t("SoftDelete") }} - + - $ayiTrashRestoreAlt + $ayiTrashAlt - {{ $ay.t("Undelete") }} + {{ + $ay.t("SoftDeleteAll") + }} @@ -522,6 +530,13 @@ export default { this.setDefaultView(); this.$emit("change"); }, + deleteAllItem() { + this.value.items[this.activeWoItemIndex].expenses.forEach( + z => (z.deleted = true) + ); + this.setDefaultView(); + this.$emit("change"); + }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on if ( @@ -751,11 +766,10 @@ export default { return this.pvm.rights.change && this.pvm.subRights.expenses.create; }, canDelete: function() { - return ( - this.activeItemIndex != null && - this.pvm.rights.change && - this.pvm.subRights.expenses.delete - ); + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { + return this.pvm.rights.change && this.pvm.subRights.expenses.delete; } } }; diff --git a/ayanova/src/components/work-order-item-labors.vue b/ayanova/src/components/work-order-item-labors.vue index 71b6b43f..80347dbd 100644 --- a/ayanova/src/components/work-order-item-labors.vue +++ b/ayanova/src/components/work-order-item-labors.vue @@ -21,17 +21,25 @@ {{ $ay.t("New") }} + + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} + $ayiTrashAlt {{ $ay.t("SoftDelete") }} - + - $ayiTrashRestoreAlt + $ayiTrashAlt - {{ $ay.t("Undelete") }} + {{ + $ay.t("SoftDeleteAll") + }} @@ -527,6 +535,13 @@ export default { this.setDefaultView(); this.$emit("change"); }, + deleteAllItem() { + this.value.items[this.activeWoItemIndex].labors.forEach( + z => (z.deleted = true) + ); + this.setDefaultView(); + this.$emit("change"); + }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on if (this.value.items[this.activeWoItemIndex].labors.length == 1) { @@ -908,11 +923,10 @@ export default { return this.pvm.rights.change && this.pvm.subRights.labors.create; }, canDelete: function() { - return ( - this.activeItemIndex != null && - this.pvm.rights.change && - this.pvm.subRights.labors.delete - ); + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { + return this.pvm.rights.change && this.pvm.subRights.labors.delete; } //---- } diff --git a/ayanova/src/components/work-order-item-loans.vue b/ayanova/src/components/work-order-item-loans.vue index 5e75bfff..1b5ff8ab 100644 --- a/ayanova/src/components/work-order-item-loans.vue +++ b/ayanova/src/components/work-order-item-loans.vue @@ -19,7 +19,14 @@ $ayiPlus - {{ $ay.t("New") }} + {{ + $ay.t("New") + }} + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} @@ -27,11 +34,13 @@ {{ $ay.t("SoftDelete") }} - + - $ayiTrashRestoreAlt + $ayiTrashAlt - {{ $ay.t("Undelete") }} + {{ + $ay.t("SoftDeleteAll") + }} @@ -510,6 +519,13 @@ export default { this.setDefaultView(); this.$emit("change"); }, + deleteAllItem() { + this.value.items[this.activeWoItemIndex].loans.forEach( + z => (z.deleted = true) + ); + this.setDefaultView(); + this.$emit("change"); + }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on if (this.value.items[this.activeWoItemIndex].loans.length == 1) { @@ -805,12 +821,12 @@ export default { return this.pvm.rights.change && this.pvm.subRights.loans.create; }, canDelete: function() { - return ( - this.activeItemIndex != null && - this.pvm.rights.change && - this.pvm.subRights.loans.delete - ); + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { + return this.pvm.rights.change && this.pvm.subRights.loans.delete; } + //---- } }; diff --git a/ayanova/src/components/work-order-item-outside-services.vue b/ayanova/src/components/work-order-item-outside-services.vue index d7487528..50a0e96a 100644 --- a/ayanova/src/components/work-order-item-outside-services.vue +++ b/ayanova/src/components/work-order-item-outside-services.vue @@ -21,17 +21,25 @@ {{ $ay.t("New") }} + + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} + $ayiTrashAlt {{ $ay.t("SoftDelete") }} - + - $ayiTrashRestoreAlt + $ayiTrashAlt - {{ $ay.t("Undelete") }} + {{ + $ay.t("SoftDeleteAll") + }} @@ -716,6 +724,13 @@ export default { this.setDefaultView(); this.$emit("change"); }, + deleteAllItem() { + this.value.items[this.activeWoItemIndex].outsideServices.forEach( + z => (z.deleted = true) + ); + this.setDefaultView(); + this.$emit("change"); + }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on if ( @@ -1069,12 +1084,14 @@ export default { ); }, canDelete: function() { + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { return ( - this.activeItemIndex != null && - this.pvm.rights.change && - this.pvm.subRights.outsideServices.delete + this.pvm.rights.change && this.pvm.subRights.outsideServices.delete ); } + //---- } }; diff --git a/ayanova/src/components/work-order-item-part-requests.vue b/ayanova/src/components/work-order-item-part-requests.vue index 7d24b999..04b6f304 100644 --- a/ayanova/src/components/work-order-item-part-requests.vue +++ b/ayanova/src/components/work-order-item-part-requests.vue @@ -16,17 +16,25 @@ + + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} + $ayiTrashAlt {{ $ay.t("SoftDelete") }} - + - $ayiTrashRestoreAlt + $ayiTrashAlt - {{ $ay.t("Undelete") }} + {{ + $ay.t("SoftDeleteAll") + }} @@ -158,6 +166,13 @@ export default { this.setDefaultView(); this.$emit("change"); }, + deleteAllItem() { + this.value.items[this.activeWoItemIndex].partRequests.forEach( + z => (z.deleted = true) + ); + this.setDefaultView(); + this.$emit("change"); + }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on if (this.value.items[this.activeWoItemIndex].partRequests.length == 1) { @@ -361,12 +376,12 @@ export default { // return this.pvm.rights.change && this.pvm.subRights.partRequests.create; // }, canDelete: function() { - return ( - this.activeItemIndex != null && - this.pvm.rights.change && - this.pvm.subRights.partRequests.delete - ); + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { + return this.pvm.rights.change && this.pvm.subRights.partRequests.delete; } + //---- } }; diff --git a/ayanova/src/components/work-order-item-scheduled-users.vue b/ayanova/src/components/work-order-item-scheduled-users.vue index b94b3050..b1c38575 100644 --- a/ayanova/src/components/work-order-item-scheduled-users.vue +++ b/ayanova/src/components/work-order-item-scheduled-users.vue @@ -21,17 +21,25 @@ {{ $ay.t("New") }} + + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} + $ayiTrashAlt {{ $ay.t("SoftDelete") }} - + - $ayiTrashRestoreAlt + $ayiTrashAlt - {{ $ay.t("Undelete") }} + {{ + $ay.t("SoftDeleteAll") + }} @@ -370,6 +378,13 @@ export default { this.setDefaultView(); this.$emit("change"); }, + deleteAllItem() { + this.value.items[this.activeWoItemIndex].scheduledUsers.forEach( + z => (z.deleted = true) + ); + this.setDefaultView(); + this.$emit("change"); + }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on if (this.value.items[this.activeWoItemIndex].scheduledUsers.length == 1) { @@ -611,11 +626,10 @@ export default { return this.pvm.rights.change && this.pvm.subRights.scheduledUsers.create; }, canDelete: function() { - return ( - this.activeItemIndex != null && - this.pvm.rights.change && - this.pvm.subRights.scheduledUsers.delete - ); + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { + return this.pvm.rights.change && this.pvm.subRights.scheduledUsers.delete; } } }; diff --git a/ayanova/src/components/work-order-items.vue b/ayanova/src/components/work-order-items.vue index 2ded131f..b428b3bf 100644 --- a/ayanova/src/components/work-order-items.vue +++ b/ayanova/src/components/work-order-items.vue @@ -29,7 +29,7 @@ {{ $ay.t("SoftDelete") }} - + $ayiTrashAlt @@ -889,30 +889,17 @@ export default { }, unDeleteItem() { this.value.items[this.activeItemIndex].deleted = false; - //CHILDREN - this.value.items[this.activeItemIndex].scheduledUsers.forEach( - z => (z.deleted = false) - ); - //todo: other grandchildren + this.setDefaultView(); }, deleteItem() { this.value.items[this.activeItemIndex].deleted = true; - //CHILDREN - this.value.items[this.activeItemIndex].scheduledUsers.forEach( - z => (z.deleted = true) - ); - //todo: other grandchildren + this.setDefaultView(); this.$emit("change"); }, deleteAllItem() { this.value.items.forEach(z => (z.deleted = true)); - // //CHILDREN - // this.value.items[this.activeItemIndex].scheduledUsers.forEach( - // z => (z.deleted = true) - // ); - //todo: other grandchildren this.setDefaultView(); this.$emit("change"); }, @@ -1122,11 +1109,14 @@ and it's probably not a big list to fill anyway ); }, canDelete: function() { + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { return ( - this.activeItemIndex != null && !this.pvm.formState.readOnly && this.pvm.rights.change && - this.pvm.subRights.items.delete + this.pvm.subRights.items.delete && + this.hasData ); }, canAddUnit: function() {