From 1f2a911455f75d87a8d97309f525769751db990f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 16 Apr 2021 17:29:34 +0000 Subject: [PATCH] --- .../work-order-item-scheduled-users.vue | 40 ++---------- ayanova/src/components/work-order-items.vue | 65 +++++++++++++------ ayanova/src/views/svc-workorder.vue | 15 ----- 3 files changed, 48 insertions(+), 72 deletions(-) diff --git a/ayanova/src/components/work-order-item-scheduled-users.vue b/ayanova/src/components/work-order-item-scheduled-users.vue index 7e7c5c82..97dda5e3 100644 --- a/ayanova/src/components/work-order-item-scheduled-users.vue +++ b/ayanova/src/components/work-order-item-scheduled-users.vue @@ -6,7 +6,7 @@
$ayiUserClock {{ $ay.t("WorkOrderItemScheduledUserList") }} - + $ayiEllipsisV
@@ -154,37 +154,6 @@ export default { this.setDefaultView(); }, deleteItem() { - // if ((await window.$gz.dialog.confirmDelete()) != true) { - // return; - // } - - // let o = this.value.items[this.activeWoItemIndex].scheduledUsers[ - // this.activeItemIndex - // ]; - - // if (o.id != 0) { - // //it's a previously saved item so it needs to be removed at the server too - // this.$emit("graph-item-deleted", { - // atype: window.$gz.type.WorkOrderItemScheduledUser, - // id: o.id, - // objectIndex: this.activeItemIndex, - // woItemIndex: this.activeWoItemIndex - // }); - // } - // this.value.items[this.activeWoItemIndex].scheduledUsers.splice( - // this.activeItemIndex, - // 1 - // ); - // this.setDefaultView(); - - //SOFT DELETE TEST - //NO need to confirm, it's apparent? - //or maybe it's a big enough deal it should be confirmed - //or maybe on save it should prompt that some items will be deleted is this ok etc?? - // if ((await window.$gz.dialog.confirmDelete()) != true) { - // return; - // } - this.value.items[this.activeWoItemIndex].scheduledUsers[ this.activeItemIndex ].deleted = true; @@ -218,10 +187,6 @@ export default { }, itemRowClasses: function(item) { let ret = ""; - // console.log("scheduseritemrowclass:", { - // activewoitemindex: this.activeWoItemIndex, - // activeItem: this.activeItemIndex - // }); const isDeleted = this.value.items[this.activeWoItemIndex].scheduledUsers[item.index] .deleted === true; @@ -248,6 +213,9 @@ export default { ].deleted === true ); }, + parentDeleted: function() { + return this.value.items[this.activeWoItemIndex].deleted === true; + }, headerList: function() { /* diff --git a/ayanova/src/components/work-order-items.vue b/ayanova/src/components/work-order-items.vue index 64101c1f..5ee50924 100644 --- a/ayanova/src/components/work-order-items.vue +++ b/ayanova/src/components/work-order-items.vue @@ -19,11 +19,17 @@ {{ $ay.t("New") }} - + $ayiTrashAlt - {{ $ay.t("Delete") }} + {{ $ay.t("SoftDelete") }} + + + + $ayiTrashRestoreAlt + + {{ $ay.t("Undelete") }} @@ -53,10 +59,12 @@ @@ -174,21 +183,22 @@ export default { this.selectedRow = [{ index: newIndex }]; this.activeItemIndex = newIndex; }, - async deleteItem() { - if ((await window.$gz.dialog.confirmDelete()) != true) { - return; - } - - let o = this.value.items[this.activeItemIndex]; - if (o.id != 0) { - //it's a previously saved item so it needs to be removed at the server too - this.$emit("graph-item-deleted", { - atype: window.$gz.type.WorkOrderItem, - id: o.id, - objectIndex: this.activeItemIndex - }); - } - this.value.items.splice(this.activeItemIndex, 1); + 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(); }, setDefaultView: function() { @@ -216,13 +226,26 @@ export default { } }, itemRowClasses: function(item) { - const path = `Items[${item.index}].`; - if (this.form().childRowHasError(this, path)) { - return "font-weight-black font-italic error--text"; + let ret = ""; + const isDeleted = this.value.items[item.index].deleted === true; + const hasError = this.form().childRowHasError( + this, + `Items[${item.index}].` + ); + + if (hasError) { + ret = "font-weight-black font-italic error--text "; } + if (isDeleted) { + ret += "text-decoration-line-through text--disabled"; + } + return ret; } }, computed: { + isDeleted: function() { + return this.value.items[this.activeItemIndex].deleted === true; + }, headerList: function() { /* public uint Concurrency { get; set; } diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index cba4eeac..6d227161 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -19,7 +19,6 @@ :pvm="this" data-cy="woItems" @change="setDirty()" - @graph-item-deleted="flagGraphItemForDelete($event)" /> @@ -167,7 +166,6 @@ export default { timeZoneName: window.$gz.locale.getResolvedTimeZoneName(), languageName: window.$gz.locale.getResolvedLanguage(), hour12: window.$gz.locale.getHour12(), - deletedGraphItems: { items: [], scheduledUsers: [] }, //todo: other grandchildren selectLists: { wostatus: [], allowedwostatus: [] @@ -309,19 +307,6 @@ export default { } }, methods: { - flagGraphItemForDelete: function(item) { - switch (item.atype) { - case window.$gz.type.WorkOrderItem: - this.deletedGraphItems.items.push(item); - break; - case window.$gz.type.WorkOrderItemScheduledUser: - this.deletedGraphItems.scheduledUsers.push(item); - break; - - //todo: other grandchildren - } - this.setDirty(); - }, setDirty: function() { this.formState.dirty = true; },