This commit is contained in:
2021-09-13 18:01:05 +00:00
parent a255299382
commit 6e24b140a8
4 changed files with 49 additions and 2 deletions

View File

@@ -375,6 +375,21 @@ export default {
`task-group/${this.selectedTaskGroup}`
);
if (res.data && res.data.items) {
//If there is one empty task line only then they likely just want to append the group and ditch the default empty item so remove it here
if (
this.value.items[this.activeWoItemIndex].tasks.length == 1 &&
this.value.items[this.activeWoItemIndex].tasks[0].task == null &&
this.value.items[this.activeWoItemIndex].tasks[0].id == 0
) {
//but first need to unbreak rule from initial add empty in case it's the only broken validation rule preventing saving
this.value.items[this.activeWoItemIndex].tasks[0].task = "..";
this.fieldValueChanged(
`Items[${this.activeWoItemIndex}].tasks[${this.activeItemIndex}].task`
);
//Now we can remove it
this.value.items[this.activeWoItemIndex].tasks.splice(0, 1);
}
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
let incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
s => s.id == 1 //incomplete

View File

@@ -375,6 +375,20 @@ export default {
`task-group/${this.selectedTaskGroup}`
);
if (res.data && res.data.items) {
//If there is one empty task line only then they likely just want to append the group and ditch the default empty item so remove it here
if (
this.value.items[this.activeWoItemIndex].tasks.length == 1 &&
this.value.items[this.activeWoItemIndex].tasks[0].task == null &&
this.value.items[this.activeWoItemIndex].tasks[0].id == 0
) {
//but first need to unbreak rule from initial add empty in case it's the only broken validation rule preventing saving
this.value.items[this.activeWoItemIndex].tasks[0].task = "..";
this.fieldValueChanged(
`Items[${this.activeWoItemIndex}].tasks[${this.activeItemIndex}].task`
);
//Now we can remove it
this.value.items[this.activeWoItemIndex].tasks.splice(0, 1);
}
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
let incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
s => s.id == 1 //incomplete

View File

@@ -375,6 +375,21 @@ export default {
`task-group/${this.selectedTaskGroup}`
);
if (res.data && res.data.items) {
//If there is one empty task line only then they likely just want to append the group and ditch the default empty item so remove it here
if (
this.value.items[this.activeWoItemIndex].tasks.length == 1 &&
this.value.items[this.activeWoItemIndex].tasks[0].task == null &&
this.value.items[this.activeWoItemIndex].tasks[0].id == 0
) {
//but first need to unbreak rule from initial add empty in case it's the only broken validation rule preventing saving
this.value.items[this.activeWoItemIndex].tasks[0].task = "..";
this.fieldValueChanged(
`Items[${this.activeWoItemIndex}].tasks[${this.activeItemIndex}].task`
);
//Now we can remove it
this.value.items[this.activeWoItemIndex].tasks.splice(0, 1);
}
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
let incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
s => s.id == 1 //incomplete