This commit is contained in:
@@ -234,8 +234,11 @@ OVERALL
|
|||||||
TODO: move to a "soft delete" get rid of the deleted items separate array
|
TODO: move to a "soft delete" get rid of the deleted items separate array
|
||||||
- on delete flag an item as "deleted=true"
|
- on delete flag an item as "deleted=true"
|
||||||
- modify the Items method that provides the array to the table so hide "deleted=true" items
|
- modify the Items method that provides the array to the table so hide "deleted=true" items
|
||||||
|
or....maybe show them as read only grayed out??
|
||||||
|
if this, then delete would be wrong term, should be "mark for delete"
|
||||||
- on save iterate the graph looking for deleted=true and attempt delete
|
- on save iterate the graph looking for deleted=true and attempt delete
|
||||||
- on fail of delete set deleted=true to false so it will show but make sure to do it *IN* the delete method so it's ready for later to show the error
|
- on fail of delete set deleted=true to false so it will show but make sure to do it *IN* the delete method so it's ready for later to show the error
|
||||||
|
|
||||||
|
|
||||||
- test partial save (### and delete ###) with fail at each level (make up a fail if have to at server)
|
- test partial save (### and delete ###) with fail at each level (make up a fail if have to at server)
|
||||||
- Error messages should display correctly both in alert box and in each item's controls
|
- Error messages should display correctly both in alert box and in each item's controls
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
"
|
"
|
||||||
></gz-decimal>
|
></gz-decimal>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
<!-- {{ value.items[activeWoItemIndex].scheduledUsers[activeItemIndex] }} -->
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -111,6 +112,13 @@ export default {
|
|||||||
type: Number
|
type: Number
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
activeWoItemIndex(val, oldVal) {
|
||||||
|
if (val != oldVal) {
|
||||||
|
this.setDefaultView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
newItem() {
|
newItem() {
|
||||||
let newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
|
let newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers
|
||||||
@@ -132,28 +140,54 @@ export default {
|
|||||||
this.activeItemIndex = newIndex;
|
this.activeItemIndex = newIndex;
|
||||||
},
|
},
|
||||||
async deleteItem() {
|
async deleteItem() {
|
||||||
if ((await window.$gz.dialog.confirmDelete()) != true) {
|
// if ((await window.$gz.dialog.confirmDelete()) != true) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
let o = this.value.items[this.activeWoItemIndex].scheduledUsers[
|
// 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
|
this.activeItemIndex
|
||||||
];
|
].deleted = true;
|
||||||
|
// if (o.id != 0) {
|
||||||
if (o.id != 0) {
|
// //it's a previously saved item so it needs to be removed at the server too
|
||||||
//it's a previously saved item so it needs to be removed at the server too
|
// this.$emit("graph-item-deleted", {
|
||||||
this.$emit("graph-item-deleted", {
|
// atype: window.$gz.type.WorkOrderItemScheduledUser,
|
||||||
atype: window.$gz.type.WorkOrderItemScheduledUser,
|
// id: o.id,
|
||||||
id: o.id,
|
// objectIndex: this.activeItemIndex,
|
||||||
objectIndex: this.activeItemIndex,
|
// woItemIndex: this.activeWoItemIndex
|
||||||
woItemIndex: this.activeWoItemIndex
|
// });
|
||||||
});
|
// }
|
||||||
}
|
// this.value.items[this.activeWoItemIndex].scheduledUsers.splice(
|
||||||
this.value.items[this.activeWoItemIndex].scheduledUsers.splice(
|
// this.activeItemIndex,
|
||||||
this.activeItemIndex,
|
// 1
|
||||||
1
|
// );
|
||||||
);
|
// this.setDefaultView();
|
||||||
this.setDefaultView();
|
|
||||||
},
|
},
|
||||||
setDefaultView: function() {
|
setDefaultView: function() {
|
||||||
//if only one record left then display it otherwise just let the datatable show what the user can click on
|
//if only one record left then display it otherwise just let the datatable show what the user can click on
|
||||||
@@ -182,11 +216,31 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemRowClasses: function(item) {
|
itemRowClasses: function(item) {
|
||||||
//"Items[3].scheduledUsers[1].
|
if (this.activeItemIndex == null) {
|
||||||
const path = `Items[${this.activeWoItemIndex}].ScheduledUsers[${item.index}].`;
|
return;
|
||||||
if (this.form().childRowHasError(this, path)) {
|
|
||||||
return "font-weight-black font-italic error--text";
|
|
||||||
}
|
}
|
||||||
|
let ret = "";
|
||||||
|
console.log("scheduseritemrowclass:", {
|
||||||
|
activewoitemindex: this.activeWoItemIndex,
|
||||||
|
activeItem: this.activeItemIndex
|
||||||
|
});
|
||||||
|
const isDeleted =
|
||||||
|
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||||
|
this.activeItemIndex
|
||||||
|
].deleted === true;
|
||||||
|
|
||||||
|
const hasError = this.form().childRowHasError(
|
||||||
|
this,
|
||||||
|
`Items[${this.activeWoItemIndex}].ScheduledUsers[${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: {
|
||||||
|
|||||||
Reference in New Issue
Block a user