From 6526fd127111698fe5d2d19406dc12f6df73def3 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 16 Jun 2021 23:41:22 +0000 Subject: [PATCH] --- .../components/work-order-item-expenses.vue | 11 +- ayanova/src/components/work-order-items.vue | 302 ++++++++++++++---- 2 files changed, 248 insertions(+), 65 deletions(-) diff --git a/ayanova/src/components/work-order-item-expenses.vue b/ayanova/src/components/work-order-item-expenses.vue index ba2b2a43..6ee12eea 100644 --- a/ayanova/src/components/work-order-item-expenses.vue +++ b/ayanova/src/components/work-order-item-expenses.vue @@ -455,8 +455,14 @@ 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.expensetopform; if (el) { @@ -501,6 +507,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].expenses[ diff --git a/ayanova/src/components/work-order-items.vue b/ayanova/src/components/work-order-items.vue index 0b9ee401..3d57bedb 100644 --- a/ayanova/src/components/work-order-items.vue +++ b/ayanova/src/components/work-order-items.vue @@ -39,15 +39,112 @@ @@ -397,13 +494,7 @@ @change="$emit('change')" /> - + - + - + - + - + - + - + - + 0 ); }, + canAddScheduledUser: function() { + return ( + this.pvm.subRights.scheduledUsers.create && + this.form().showMe(this, "WorkOrderItemScheduledUserList") + ); + }, showScheduledUsers: function() { return ( this.pvm.subRights.scheduledUsers.visible && this.form().showMe(this, "WorkOrderItemScheduledUserList") && this.value.items[this.activeItemIndex].scheduledUsers.length > 0 ); + }, + canAddTask: function() { + return ( + this.pvm.subRights.tasks.create && + this.form().showMe(this, "WorkOrderItemTaskList") + ); + }, + showTasks: function() { + return ( + this.pvm.subRights.tasks.visible && + this.form().showMe(this, "WorkOrderItemTaskList") && + this.value.items[this.activeItemIndex].tasks.length > 0 + ); + }, + canAddPart: function() { + return ( + this.pvm.subRights.parts.create && + this.form().showMe(this, "WorkOrderItemUnitList") + ); + }, + showParts: function() { + return ( + this.pvm.subRights.parts.visible && + this.form().showMe(this, "WorkOrderItemUnitList") && + this.value.items[this.activeItemIndex].parts.length > 0 + ); + }, + showPartRequests: function() { + return ( + this.pvm.useInventory && + this.value.items[this.activeItemIndex].partRequests.length > 0 && + this.pvm.subRights.partRequests.visible && + this.form().showMe(this, "WorkOrderItemPartRequestList") + ); + }, + + canAddLabor: function() { + return ( + this.pvm.subRights.labors.create && + this.form().showMe(this, "WorkOrderItemUnitList") + ); + }, + showLabors: function() { + return ( + this.pvm.subRights.labors.visible && + this.form().showMe(this, "WorkOrderItemUnitList") && + this.value.items[this.activeItemIndex].labors.length > 0 + ); + }, + canAddTravel: function() { + return ( + this.pvm.subRights.travels.create && + this.form().showMe(this, "WorkOrderItemUnitList") + ); + }, + showTravels: function() { + return ( + this.pvm.subRights.travels.visible && + this.form().showMe(this, "WorkOrderItemUnitList") && + this.value.items[this.activeItemIndex].travels.length > 0 + ); + }, + canAddExpense: function() { + return ( + this.pvm.subRights.expenses.create && + this.form().showMe(this, "WorkOrderItemUnitList") + ); + }, + showExpenses: function() { + return ( + this.pvm.subRights.expenses.visible && + this.form().showMe(this, "WorkOrderItemUnitList") && + this.value.items[this.activeItemIndex].expenses.length > 0 + ); + }, + canAddLoan: function() { + return ( + this.pvm.subRights.loans.create && + this.form().showMe(this, "WorkOrderItemUnitList") + ); + }, + showLoans: function() { + return ( + this.pvm.subRights.loans.visible && + this.form().showMe(this, "WorkOrderItemUnitList") && + this.value.items[this.activeItemIndex].loans.length > 0 + ); + }, + canAddOutsideService: function() { + return ( + this.pvm.subRights.outsideServices.create && + this.form().showMe(this, "WorkOrderItemUnitList") + ); + }, + showOutsideServices: function() { + return ( + this.pvm.subRights.outsideServices.visible && + this.form().showMe(this, "WorkOrderItemUnitList") && + this.value.items[this.activeItemIndex].outsideServices.length > 0 + ); } } }; -//TODO: Function status name from woitemstatusid -//and priority same -//this.pvm.pickLists.woItemStatus.find(x=>x.id==x.workorderItemStatusId) ////////////////////// //