From 8f2e5d840da65d138be1bbc49408b67a6f423b33 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 1 Jul 2021 15:27:59 +0000 Subject: [PATCH] --- .../src/components/work-order-item-units.vue | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ayanova/src/components/work-order-item-units.vue b/ayanova/src/components/work-order-item-units.vue index 313fa736..e3e598e2 100644 --- a/ayanova/src/components/work-order-item-units.vue +++ b/ayanova/src/components/work-order-item-units.vue @@ -21,17 +21,25 @@ {{ $ay.t("New") }} + + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} + $ayiTrashAlt {{ $ay.t("SoftDelete") }} - + - $ayiTrashRestoreAlt + $ayiTrashAlt - {{ $ay.t("Undelete") }} + {{ + $ay.t("SoftDeleteAll") + }} @@ -327,6 +335,13 @@ export default { this.setDefaultView(); this.$emit("change"); }, + deleteAllItem() { + this.value.items[this.activeWoItemIndex].units.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].units.length == 1) { @@ -450,11 +465,10 @@ export default { return this.pvm.rights.change && this.pvm.subRights.units.create; }, canDelete: function() { - return ( - this.activeItemIndex != null && - this.pvm.rights.change && - this.pvm.subRights.units.delete - ); + return this.activeItemIndex != null && this.canDeleteAll; + }, + canDeleteAll: function() { + return this.pvm.rights.change && this.pvm.subRights.units.delete; } } };