This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<div class="text-subtitle-1">
|
<div class="text-subtitle-1">
|
||||||
<v-icon color="primary">$ayiUserClock</v-icon>
|
<v-icon color="primary">$ayiUserClock</v-icon>
|
||||||
{{ $ay.t("WorkOrderItemScheduledUserList") }}
|
{{ $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-icon small color="primary">$ayiEllipsisV</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
@@ -154,37 +154,6 @@ export default {
|
|||||||
this.setDefaultView();
|
this.setDefaultView();
|
||||||
},
|
},
|
||||||
deleteItem() {
|
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.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||||
this.activeItemIndex
|
this.activeItemIndex
|
||||||
].deleted = true;
|
].deleted = true;
|
||||||
@@ -218,10 +187,6 @@ export default {
|
|||||||
},
|
},
|
||||||
itemRowClasses: function(item) {
|
itemRowClasses: function(item) {
|
||||||
let ret = "";
|
let ret = "";
|
||||||
// console.log("scheduseritemrowclass:", {
|
|
||||||
// activewoitemindex: this.activeWoItemIndex,
|
|
||||||
// activeItem: this.activeItemIndex
|
|
||||||
// });
|
|
||||||
const isDeleted =
|
const isDeleted =
|
||||||
this.value.items[this.activeWoItemIndex].scheduledUsers[item.index]
|
this.value.items[this.activeWoItemIndex].scheduledUsers[item.index]
|
||||||
.deleted === true;
|
.deleted === true;
|
||||||
@@ -248,6 +213,9 @@ export default {
|
|||||||
].deleted === true
|
].deleted === true
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
parentDeleted: function() {
|
||||||
|
return this.value.items[this.activeWoItemIndex].deleted === true;
|
||||||
|
},
|
||||||
|
|
||||||
headerList: function() {
|
headerList: function() {
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -19,11 +19,17 @@
|
|||||||
</v-list-item-icon>
|
</v-list-item-icon>
|
||||||
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
|
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
|
||||||
</v-list-item>
|
</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-list-item-icon>
|
||||||
<v-icon>$ayiTrashAlt</v-icon>
|
<v-icon>$ayiTrashAlt</v-icon>
|
||||||
</v-list-item-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-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
@@ -53,10 +59,12 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="activeItemIndex != null">
|
<template v-if="activeItemIndex != null">
|
||||||
|
<h1 v-if="isDeleted">MARKED FOR DELETE</h1>
|
||||||
<v-col v-if="form().showMe(this, 'WorkOrderItemSummary')" cols="12">
|
<v-col v-if="form().showMe(this, 'WorkOrderItemSummary')" cols="12">
|
||||||
<v-textarea
|
<v-textarea
|
||||||
v-model="value.items[activeItemIndex].notes"
|
v-model="value.items[activeItemIndex].notes"
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
|
:disabled="isDeleted"
|
||||||
:label="$ay.t('WorkOrderItemSummary')"
|
:label="$ay.t('WorkOrderItemSummary')"
|
||||||
:error-messages="
|
:error-messages="
|
||||||
form().serverErrors(this, `items[${activeItemIndex}].notes`)
|
form().serverErrors(this, `items[${activeItemIndex}].notes`)
|
||||||
@@ -78,6 +86,7 @@
|
|||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="value.items[activeItemIndex].sequence"
|
v-model="value.items[activeItemIndex].sequence"
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
|
:disabled="isDeleted"
|
||||||
:label="$ay.t('Sequence')"
|
:label="$ay.t('Sequence')"
|
||||||
ref="sequence"
|
ref="sequence"
|
||||||
:rules="[form().integerValid(this, 'sequence')]"
|
:rules="[form().integerValid(this, 'sequence')]"
|
||||||
@@ -91,6 +100,7 @@
|
|||||||
<v-textarea
|
<v-textarea
|
||||||
v-model="value.items[activeItemIndex].techNotes"
|
v-model="value.items[activeItemIndex].techNotes"
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
|
:disabled="isDeleted"
|
||||||
:label="$ay.t('WorkOrderItemTechNotes')"
|
:label="$ay.t('WorkOrderItemTechNotes')"
|
||||||
:error-messages="form().serverErrors(this, 'techNotes')"
|
:error-messages="form().serverErrors(this, 'techNotes')"
|
||||||
ref="techNotes"
|
ref="techNotes"
|
||||||
@@ -106,7 +116,6 @@
|
|||||||
:pvm="pvm"
|
:pvm="pvm"
|
||||||
:active-wo-item-index="activeItemIndex"
|
:active-wo-item-index="activeItemIndex"
|
||||||
data-cy="woItemScheduledUsers"
|
data-cy="woItemScheduledUsers"
|
||||||
@graph-item-deleted="$emit('graph-item-deleted', $event)"
|
|
||||||
@change="$emit('change')"
|
@change="$emit('change')"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -174,21 +183,22 @@ export default {
|
|||||||
this.selectedRow = [{ index: newIndex }];
|
this.selectedRow = [{ index: newIndex }];
|
||||||
this.activeItemIndex = newIndex;
|
this.activeItemIndex = newIndex;
|
||||||
},
|
},
|
||||||
async deleteItem() {
|
unDeleteItem() {
|
||||||
if ((await window.$gz.dialog.confirmDelete()) != true) {
|
this.value.items[this.activeItemIndex].deleted = false;
|
||||||
return;
|
//CHILDREN
|
||||||
}
|
this.value.items[this.activeItemIndex].scheduledUsers.forEach(
|
||||||
|
z => (z.deleted = false)
|
||||||
let o = this.value.items[this.activeItemIndex];
|
);
|
||||||
if (o.id != 0) {
|
//todo: other grandchildren
|
||||||
//it's a previously saved item so it needs to be removed at the server too
|
this.setDefaultView();
|
||||||
this.$emit("graph-item-deleted", {
|
},
|
||||||
atype: window.$gz.type.WorkOrderItem,
|
deleteItem() {
|
||||||
id: o.id,
|
this.value.items[this.activeItemIndex].deleted = true;
|
||||||
objectIndex: this.activeItemIndex
|
//CHILDREN
|
||||||
});
|
this.value.items[this.activeItemIndex].scheduledUsers.forEach(
|
||||||
}
|
z => (z.deleted = true)
|
||||||
this.value.items.splice(this.activeItemIndex, 1);
|
);
|
||||||
|
//todo: other grandchildren
|
||||||
this.setDefaultView();
|
this.setDefaultView();
|
||||||
},
|
},
|
||||||
setDefaultView: function() {
|
setDefaultView: function() {
|
||||||
@@ -216,13 +226,26 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemRowClasses: function(item) {
|
itemRowClasses: function(item) {
|
||||||
const path = `Items[${item.index}].`;
|
let ret = "";
|
||||||
if (this.form().childRowHasError(this, path)) {
|
const isDeleted = this.value.items[item.index].deleted === true;
|
||||||
return "font-weight-black font-italic error--text";
|
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: {
|
computed: {
|
||||||
|
isDeleted: function() {
|
||||||
|
return this.value.items[this.activeItemIndex].deleted === true;
|
||||||
|
},
|
||||||
headerList: function() {
|
headerList: function() {
|
||||||
/*
|
/*
|
||||||
public uint Concurrency { get; set; }
|
public uint Concurrency { get; set; }
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
:pvm="this"
|
:pvm="this"
|
||||||
data-cy="woItems"
|
data-cy="woItems"
|
||||||
@change="setDirty()"
|
@change="setDirty()"
|
||||||
@graph-item-deleted="flagGraphItemForDelete($event)"
|
|
||||||
/>
|
/>
|
||||||
</v-form>
|
</v-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -167,7 +166,6 @@ export default {
|
|||||||
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
|
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
|
||||||
languageName: window.$gz.locale.getResolvedLanguage(),
|
languageName: window.$gz.locale.getResolvedLanguage(),
|
||||||
hour12: window.$gz.locale.getHour12(),
|
hour12: window.$gz.locale.getHour12(),
|
||||||
deletedGraphItems: { items: [], scheduledUsers: [] }, //todo: other grandchildren
|
|
||||||
selectLists: {
|
selectLists: {
|
||||||
wostatus: [],
|
wostatus: [],
|
||||||
allowedwostatus: []
|
allowedwostatus: []
|
||||||
@@ -309,19 +307,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
setDirty: function() {
|
||||||
this.formState.dirty = true;
|
this.formState.dirty = true;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user