This commit is contained in:
2021-04-16 17:29:34 +00:00
parent 3b4486a272
commit 1f2a911455
3 changed files with 48 additions and 72 deletions

View File

@@ -6,7 +6,7 @@
<div class="text-subtitle-1">
<v-icon color="primary">$ayiUserClock</v-icon>
{{ $ay.t("WorkOrderItemScheduledUserList") }}
<v-btn large icon v-bind="attrs" v-on="on">
<v-btn v-if="!parentDeleted" large icon v-bind="attrs" v-on="on">
<v-icon small color="primary">$ayiEllipsisV</v-icon>
</v-btn>
</div>
@@ -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() {
/*

View File

@@ -19,11 +19,17 @@
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canDelete" @click="deleteItem">
<v-list-item v-if="canDelete && !isDeleted" @click="deleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("Delete") }}</v-list-item-title>
<v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
<v-list-item-icon>
<v-icon>$ayiTrashRestoreAlt</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
@@ -53,10 +59,12 @@
</v-col>
</template>
<template v-if="activeItemIndex != null">
<h1 v-if="isDeleted">MARKED FOR DELETE</h1>
<v-col v-if="form().showMe(this, 'WorkOrderItemSummary')" cols="12">
<v-textarea
v-model="value.items[activeItemIndex].notes"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemSummary')"
:error-messages="
form().serverErrors(this, `items[${activeItemIndex}].notes`)
@@ -78,6 +86,7 @@
<v-text-field
v-model="value.items[activeItemIndex].sequence"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('Sequence')"
ref="sequence"
:rules="[form().integerValid(this, 'sequence')]"
@@ -91,6 +100,7 @@
<v-textarea
v-model="value.items[activeItemIndex].techNotes"
:readonly="formState.readOnly"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemTechNotes')"
:error-messages="form().serverErrors(this, 'techNotes')"
ref="techNotes"
@@ -106,7 +116,6 @@
:pvm="pvm"
:active-wo-item-index="activeItemIndex"
data-cy="woItemScheduledUsers"
@graph-item-deleted="$emit('graph-item-deleted', $event)"
@change="$emit('change')"
/>
</template>
@@ -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; }

View File

@@ -19,7 +19,6 @@
:pvm="this"
data-cy="woItems"
@change="setDirty()"
@graph-item-deleted="flagGraphItemForDelete($event)"
/>
</v-form>
</div>
@@ -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;
},