diff --git a/ayanova/src/components/work-order-item-expenses.vue b/ayanova/src/components/work-order-item-expenses.vue index c5a07ac2..51cf26e8 100644 --- a/ayanova/src/components/work-order-item-expenses.vue +++ b/ayanova/src/components/work-order-item-expenses.vue @@ -68,48 +68,6 @@ }}$ayiTrashRestoreAlt - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + ----------------------------------------------------------------------------- - - - - - - - @@ -346,16 +498,15 @@ export default { this.activeItemIndex ].userViz = newName; }, - rateChange(newName) { + taxCodeChange(newName) { this.value.items[this.activeWoItemIndex].expenses[ this.activeItemIndex - ].serviceRateViz = newName; + ].chargeTaxCodeViz = newName; }, newItem() { - let newIndex = this.value.items[this.activeWoItemIndex].scheduledUsers - .length; + let newIndex = this.value.items[this.activeWoItemIndex].expenses.length; - this.value.items[this.activeWoItemIndex].scheduledUsers.push({ + this.value.items[this.activeWoItemIndex].expenses.push({ id: 0, concurrency: 0, userId: null, @@ -386,7 +537,7 @@ export default { }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on - if (this.value.items[this.activeWoItemIndex].scheduledUsers.length == 1) { + if (this.value.items[this.activeWoItemIndex].expenses.length == 1) { this.selectedRow = [{ index: 0 }]; this.activeItemIndex = 0; } else { @@ -423,7 +574,7 @@ export default { const hasError = this.form().childRowHasError( this, - `Items[${this.activeWoItemIndex}].ScheduledUsers[${item.index}].` + `Items[${this.activeWoItemIndex}].Expenses[${item.index}].` ); if (isDeleted) { @@ -461,77 +612,99 @@ export default { */ let headers = []; - if (this.form().showMe(this, "WorkOrderItemScheduledUserStartDate")) { + if (this.form().showMe(this, "WorkOrderItemExpenseName")) { headers.push({ - text: this.$ay.t("WorkOrderItemScheduledUserStartDate"), - align: "right", - value: "startDate" + text: this.$ay.t("WorkOrderItemExpenseName"), + align: "left", + value: "name" }); } - if (this.form().showMe(this, "WorkOrderItemScheduledUserStopDate")) { + if (this.form().showMe(this, "WorkOrderItemExpenseTotalCost")) { headers.push({ - text: this.$ay.t("WorkOrderItemScheduledUserStopDate"), + text: this.$ay.t("WorkOrderItemExpenseTotalCost"), align: "right", - value: "stopDate" + value: "totalCost" }); } - if ( - this.form().showMe(this, "WorkOrderItemScheduledUserEstimatedQuantity") - ) { + if (this.form().showMe(this, "WorkOrderItemExpenseChargeAmount")) { headers.push({ - text: this.$ay.t("WorkOrderItemScheduledUserEstimatedQuantity"), + text: this.$ay.t("WorkOrderItemExpenseChargeAmount"), align: "right", - value: "estimatedQuantity" + value: "chargeAmount" }); } - if (this.form().showMe(this, "WorkOrderItemScheduledUserUserID")) { + if (this.form().showMe(this, "WorkOrderItemExpenseChargeToCustomer")) { headers.push({ - text: this.$ay.t("WorkOrderItemScheduledUserUserID"), + text: this.$ay.t("WorkOrderItemExpenseChargeToCustomer"), + align: "center", + value: "chargeToCustomer" + }); + } + + if (this.form().showMe(this, "WorkOrderItemExpenseTaxPaid")) { + headers.push({ + text: this.$ay.t("WorkOrderItemExpenseTaxPaid"), + align: "right", + value: "taxPaid" + }); + } + + if (this.form().showMe(this, "WorkOrderItemExpenseChargeTaxCodeID")) { + headers.push({ + text: this.$ay.t("WorkOrderItemExpenseChargeTaxCodeID"), + align: "left", + value: "chargeTaxCodeViz" + }); + } + + if (this.form().showMe(this, "WorkOrderItemExpenseReimburseUser")) { + headers.push({ + text: this.$ay.t("WorkOrderItemExpenseReimburseUser"), + align: "center", + value: "reimburseUser" + }); + } + + if (this.form().showMe(this, "WorkOrderItemExpenseUserID")) { + headers.push({ + text: this.$ay.t("WorkOrderItemExpenseUserID"), align: "left", value: "userViz" }); } - if (this.form().showMe(this, "WorkOrderItemScheduledUserServiceRateID")) { - headers.push({ - text: this.$ay.t("WorkOrderItemScheduledUserServiceRateID"), - align: "left", - value: "serviceRateViz" - }); - } - return headers; }, itemList: function() { - return this.value.items[this.activeWoItemIndex].scheduledUsers.map( - (x, i) => { - return { - index: i, - id: x.id, - startDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized( - x.startDate, - this.pvm.timeZoneName, - this.pvm.languageName, - this.pvm.hour12 - ), - stopDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized( - x.stopDate, - this.pvm.timeZoneName, - this.pvm.languageName, - this.pvm.hour12 - ), - estimatedQuantity: window.$gz.locale.decimalLocalized( - x.estimatedQuantity, - this.pvm.languageName - ), - userViz: x.userViz, - serviceRateViz: x.serviceRateViz - }; - } - ); + return this.value.items[this.activeWoItemIndex].expenses.map((x, i) => { + return { + index: i, + id: x.id, + name: x.name, + totalCost: window.$gz.locale.currencyLocalized( + x.totalCost, + this.pvm.languageName, + this.pvm.currencyName + ), + chargeAmount: window.$gz.locale.currencyLocalized( + x.chargeAmount, + this.pvm.languageName, + this.pvm.currencyName + ), + chargeToCustomer: x.chargeToCustomer, + taxPaid: window.$gz.locale.currencyLocalized( + x.taxPaid, + this.pvm.languageName, + this.pvm.currencyName + ), + chargeTaxCodeViz: x.chargeTaxCodeViz, + reimburseUser: x.reimburseUser, + userViz: x.userViz + }; + }); }, formState: function() { return this.pvm.formState; @@ -540,16 +713,16 @@ export default { return this.pvm.formCustomTemplateKey; }, showTable: function() { - return this.value.items[this.activeWoItemIndex].scheduledUsers.length > 1; + return this.value.items[this.activeWoItemIndex].expenses.length > 1; }, canAdd: function() { - return this.pvm.rights.change && this.pvm.subRights.scheduledUsers.create; + return this.pvm.rights.change && this.pvm.subRights.expenses.create; }, canDelete: function() { return ( this.activeItemIndex != null && this.pvm.rights.change && - this.pvm.subRights.scheduledUsers.delete + this.pvm.subRights.expenses.delete ); } }