From 026f53baf4e9849cc9e95f68ccfb3fce161396ea Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 16 Jun 2021 23:47:58 +0000 Subject: [PATCH] --- ayanova/src/components/work-order-item-labors.vue | 10 ++++++++-- ayanova/src/components/work-order-item-loans.vue | 10 ++++++++-- .../components/work-order-item-outside-services.vue | 10 ++++++++-- ayanova/src/components/work-order-item-parts.vue | 10 ++++++++-- .../src/components/work-order-item-scheduled-users.vue | 10 ++++++++-- ayanova/src/components/work-order-item-tasks.vue | 10 ++++++++-- ayanova/src/components/work-order-item-travels.vue | 10 ++++++++-- ayanova/src/components/work-order-items.vue | 2 -- 8 files changed, 56 insertions(+), 16 deletions(-) diff --git a/ayanova/src/components/work-order-item-labors.vue b/ayanova/src/components/work-order-item-labors.vue index 3af5586d..7f0aeee2 100644 --- a/ayanova/src/components/work-order-item-labors.vue +++ b/ayanova/src/components/work-order-item-labors.vue @@ -454,8 +454,13 @@ export default { }, gotoIndex(val, oldVal) { if (val != oldVal) { - this.selectedRow = [{ index: val }]; - this.activeItemIndex = val; + let gotoIndex = val; + if (val < 0) { + //it's a create request + gotoIndex = this.newItem(); + } + this.selectedRow = [{ index: gotoIndex }]; + this.activeItemIndex = gotoIndex; this.$nextTick(() => { const el = this.$refs.labortopform; if (el) { @@ -504,6 +509,7 @@ export default { this.$emit("change"); this.selectedRow = [{ index: newIndex }]; this.activeItemIndex = newIndex; + return newIndex; //for create new on goto }, unDeleteItem() { this.value.items[this.activeWoItemIndex].labors[ diff --git a/ayanova/src/components/work-order-item-loans.vue b/ayanova/src/components/work-order-item-loans.vue index 384913f2..bc4cae51 100644 --- a/ayanova/src/components/work-order-item-loans.vue +++ b/ayanova/src/components/work-order-item-loans.vue @@ -473,8 +473,13 @@ export default { }, gotoIndex(val, oldVal) { if (val != oldVal) { - this.selectedRow = [{ index: val }]; - this.activeItemIndex = val; + let gotoIndex = val; + if (val < 0) { + //it's a create request + gotoIndex = this.newItem(); + } + this.selectedRow = [{ index: gotoIndex }]; + this.activeItemIndex = gotoIndex; this.$nextTick(() => { const el = this.$refs.loantopform; if (el) { @@ -534,6 +539,7 @@ export default { `Items[${this.activeWoItemIndex}].loans[${this.activeItemIndex}].loanUnitId` ); }); + return newIndex; //for create new on goto }, unDeleteItem() { this.value.items[this.activeWoItemIndex].loans[ diff --git a/ayanova/src/components/work-order-item-outside-services.vue b/ayanova/src/components/work-order-item-outside-services.vue index 1b46b983..9dfb560f 100644 --- a/ayanova/src/components/work-order-item-outside-services.vue +++ b/ayanova/src/components/work-order-item-outside-services.vue @@ -623,8 +623,13 @@ export default { }, gotoIndex(val, oldVal) { if (val != oldVal) { - this.selectedRow = [{ index: val }]; - this.activeItemIndex = val; + let gotoIndex = val; + if (val < 0) { + //it's a create request + gotoIndex = this.newItem(); + } + this.selectedRow = [{ index: gotoIndex }]; + this.activeItemIndex = gotoIndex; this.$nextTick(() => { const el = this.$refs.outsideservicetopform; if (el) { @@ -692,6 +697,7 @@ export default { `Items[${this.activeWoItemIndex}].outsideServices[${this.activeItemIndex}].unitId` ); }); + return newIndex; //for create new on goto }, unDeleteItem() { this.value.items[this.activeWoItemIndex].outsideServices[ diff --git a/ayanova/src/components/work-order-item-parts.vue b/ayanova/src/components/work-order-item-parts.vue index 41c3d4f3..c318b575 100644 --- a/ayanova/src/components/work-order-item-parts.vue +++ b/ayanova/src/components/work-order-item-parts.vue @@ -385,8 +385,13 @@ export default { }, gotoIndex(val, oldVal) { if (val != oldVal) { - this.selectedRow = [{ index: val }]; - this.activeItemIndex = val; + let gotoIndex = val; + if (val < 0) { + //it's a create request + gotoIndex = this.newItem(); + } + this.selectedRow = [{ index: gotoIndex }]; + this.activeItemIndex = gotoIndex; this.$nextTick(() => { const el = this.$refs.parttopform; if (el) { @@ -506,6 +511,7 @@ export default { `Items[${this.activeWoItemIndex}].parts[${this.activeItemIndex}].partId` ); }); + return newIndex; //for create new on goto }, unDeleteItem() { this.value.items[this.activeWoItemIndex].parts[ diff --git a/ayanova/src/components/work-order-item-scheduled-users.vue b/ayanova/src/components/work-order-item-scheduled-users.vue index 8695d3cb..4df8c626 100644 --- a/ayanova/src/components/work-order-item-scheduled-users.vue +++ b/ayanova/src/components/work-order-item-scheduled-users.vue @@ -307,8 +307,13 @@ export default { }, gotoIndex(val, oldVal) { if (val != oldVal) { - this.selectedRow = [{ index: val }]; - this.activeItemIndex = val; + let gotoIndex = val; + if (val < 0) { + //it's a create request + gotoIndex = this.newItem(); + } + this.selectedRow = [{ index: gotoIndex }]; + this.activeItemIndex = gotoIndex; this.$nextTick(() => { const el = this.$refs.scheduledusertopform; if (el) { @@ -348,6 +353,7 @@ export default { this.$emit("change"); this.selectedRow = [{ index: newIndex }]; this.activeItemIndex = newIndex; + return newIndex; //for create new on goto }, unDeleteItem() { this.value.items[this.activeWoItemIndex].scheduledUsers[ diff --git a/ayanova/src/components/work-order-item-tasks.vue b/ayanova/src/components/work-order-item-tasks.vue index 8bb289f5..b86ac174 100644 --- a/ayanova/src/components/work-order-item-tasks.vue +++ b/ayanova/src/components/work-order-item-tasks.vue @@ -344,8 +344,13 @@ export default { }, gotoIndex(val, oldVal) { if (val != oldVal) { - this.selectedRow = [{ index: val }]; - this.activeItemIndex = val; + let gotoIndex = val; + if (val < 0) { + //it's a create request + gotoIndex = this.newItem(); + } + this.selectedRow = [{ index: gotoIndex }]; + this.activeItemIndex = gotoIndex; this.$nextTick(() => { const el = this.$refs.tasktopform; if (el) { @@ -438,6 +443,7 @@ export default { `Items[${this.activeWoItemIndex}].tasks[${this.activeItemIndex}].task` ); }); + return newIndex; //for create new on goto }, unDeleteItem() { this.value.items[this.activeWoItemIndex].tasks[ diff --git a/ayanova/src/components/work-order-item-travels.vue b/ayanova/src/components/work-order-item-travels.vue index e02845d2..a6883f56 100644 --- a/ayanova/src/components/work-order-item-travels.vue +++ b/ayanova/src/components/work-order-item-travels.vue @@ -454,8 +454,13 @@ export default { }, gotoIndex(val, oldVal) { if (val != oldVal) { - this.selectedRow = [{ index: val }]; - this.activeItemIndex = val; + let gotoIndex = val; + if (val < 0) { + //it's a create request + gotoIndex = this.newItem(); + } + this.selectedRow = [{ index: gotoIndex }]; + this.activeItemIndex = gotoIndex; this.$nextTick(() => { const el = this.$refs.traveltopform; if (el) { @@ -504,6 +509,7 @@ export default { this.$emit("change"); this.selectedRow = [{ index: newIndex }]; this.activeItemIndex = newIndex; + return newIndex; //for create new on goto }, unDeleteItem() { this.value.items[this.activeWoItemIndex].travels[ diff --git a/ayanova/src/components/work-order-items.vue b/ayanova/src/components/work-order-items.vue index 3d57bedb..3548fc28 100644 --- a/ayanova/src/components/work-order-items.vue +++ b/ayanova/src/components/work-order-items.vue @@ -845,7 +845,6 @@ export default { }); }, newSubItem(atype) { - console.log("Newsubitem type: ", atype); //new Id value to use (by convention goto negative will trigger create and then goto instead of simple goto) let newId = -Math.abs(Date.now()); switch (atype) { @@ -874,7 +873,6 @@ export default { this.gotoTravelIndex = newId; break; case window.$gz.type.WorkOrderItemUnit: - console.log("new unit id", newId); this.gotoUnitIndex = newId; break; }