This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
</v-col>
|
||||
|
||||
<template v-if="showTable">
|
||||
<!-- ################################ SCHEDULED USERS TABLE ############################### -->
|
||||
<!-- ############################################################### -->
|
||||
<v-col cols="12" class="mb-10">
|
||||
<v-data-table
|
||||
:headers="headerList"
|
||||
@@ -48,7 +48,7 @@
|
||||
disable-filtering
|
||||
disable-sort
|
||||
hide-default-footer
|
||||
data-cy="scheduledUsersTable"
|
||||
data-cy="expensesTable"
|
||||
dense
|
||||
:item-class="itemRowClasses"
|
||||
@click:row="handleRowClick"
|
||||
@@ -69,123 +69,118 @@
|
||||
>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'WorkOrderItemScheduledUserStartDate')"
|
||||
v-if="form().showMe(this, 'WorkOrderItemExpenseTotalCost')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-date-time-picker
|
||||
:label="$ay.t('WorkOrderItemScheduledUserStartDate')"
|
||||
<gz-currency
|
||||
v-model="
|
||||
value.items[activeWoItemIndex].scheduledUsers[activeItemIndex]
|
||||
.startDate
|
||||
"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="isDeleted"
|
||||
:ref="
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].startDate`
|
||||
"
|
||||
data-cy="startDate"
|
||||
:error-messages="
|
||||
form().serverErrors(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].startDate`
|
||||
)
|
||||
"
|
||||
@input="
|
||||
fieldValueChanged(
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].startDate`
|
||||
)
|
||||
"
|
||||
></gz-date-time-picker>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'WorkOrderItemScheduledUserStopDate')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-date-time-picker
|
||||
:label="$ay.t('WorkOrderItemScheduledUserStopDate')"
|
||||
v-model="
|
||||
value.items[activeWoItemIndex].scheduledUsers[activeItemIndex]
|
||||
.stopDate
|
||||
"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="isDeleted"
|
||||
:ref="
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].stopDate`
|
||||
"
|
||||
data-cy="stopDate"
|
||||
:rules="[
|
||||
form().datePrecedence(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].startDate`,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].stopDate`
|
||||
)
|
||||
]"
|
||||
:error-messages="
|
||||
form().serverErrors(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].stopDate`
|
||||
)
|
||||
"
|
||||
@input="
|
||||
fieldValueChanged(
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].stopDate`
|
||||
)
|
||||
"
|
||||
></gz-date-time-picker>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="
|
||||
form().showMe(this, 'WorkOrderItemScheduledUserEstimatedQuantity')
|
||||
"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<gz-decimal
|
||||
v-model="
|
||||
value.items[activeWoItemIndex].scheduledUsers[activeItemIndex]
|
||||
.estimatedQuantity
|
||||
value.items[activeWoItemIndex].expenses[activeItemIndex].totalCost
|
||||
"
|
||||
:readonly="formState.readOnly || isDeleted"
|
||||
:disabled="isDeleted"
|
||||
:label="$ay.t('WorkOrderItemScheduledUserEstimatedQuantity')"
|
||||
:label="$ay.t('WorkOrderItemExpenseTotalCost')"
|
||||
:ref="
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].estimatedQuantity`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].totalCost`
|
||||
"
|
||||
data-cy="scheduledUsers.EstimatedQuantity"
|
||||
:error-messages="
|
||||
form().serverErrors(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].estimatedQuantity`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].totalCost`
|
||||
)
|
||||
"
|
||||
:rules="[
|
||||
form().decimalValid(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].estimatedQuantity`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].totalCost`
|
||||
),
|
||||
form().required(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].estimatedQuantity`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].totalCost`
|
||||
)
|
||||
]"
|
||||
@input="
|
||||
fieldValueChanged(`Items[${activeWoItemIndex}].scheduledUsers[
|
||||
fieldValueChanged(`Items[${activeWoItemIndex}].expenses[
|
||||
${activeItemIndex}
|
||||
].estimatedQuantity`)
|
||||
].totalCost`)
|
||||
"
|
||||
></gz-decimal>
|
||||
></gz-currency>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'WorkOrderItemExpenseName')"
|
||||
cols="12"
|
||||
sm="6"
|
||||
lg="4"
|
||||
xl="3"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="
|
||||
value.items[activeWoItemIndex].expenses[activeItemIndex].name
|
||||
"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="isDeleted"
|
||||
:label="$ay.t('WorkOrderItemExpenseName')"
|
||||
:ref="
|
||||
`Items[${activeWoItemIndex}].expenses[
|
||||
${activeItemIndex}
|
||||
].name`
|
||||
"
|
||||
:error-messages="
|
||||
form().serverErrors(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].expenses[
|
||||
${activeItemIndex}
|
||||
].name`
|
||||
)
|
||||
"
|
||||
@input="
|
||||
fieldValueChanged(`Items[${activeWoItemIndex}].expenses[
|
||||
${activeItemIndex}
|
||||
].name`)
|
||||
"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'WorkOrderItemExpenseDescription')"
|
||||
cols="12"
|
||||
>
|
||||
<v-textarea
|
||||
v-model="
|
||||
value.items[activeWoItemIndex].expenses[activeItemIndex]
|
||||
.description
|
||||
"
|
||||
:readonly="formState.readOnly"
|
||||
:disabled="isDeleted"
|
||||
:label="$ay.t('WorkOrderItemExpenseDescription')"
|
||||
:error-messages="
|
||||
form().serverErrors(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].expenses[
|
||||
${activeItemIndex}
|
||||
].description`
|
||||
)
|
||||
"
|
||||
:ref="
|
||||
`Items[${activeWoItemIndex}].expenses[
|
||||
${activeItemIndex}
|
||||
].description`
|
||||
"
|
||||
data-cy="expenseDescription"
|
||||
@input="
|
||||
fieldValueChanged(`Items[${activeWoItemIndex}].expenses[
|
||||
${activeItemIndex}
|
||||
].description`)
|
||||
"
|
||||
auto-grow
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
<v-col
|
||||
v-if="form().showMe(this, 'WorkOrderItemScheduledUserUserID')"
|
||||
cols="12"
|
||||
@@ -198,25 +193,24 @@
|
||||
variant="tech"
|
||||
:show-edit-icon="true"
|
||||
v-model="
|
||||
value.items[activeWoItemIndex].scheduledUsers[activeItemIndex]
|
||||
.userId
|
||||
value.items[activeWoItemIndex].expenses[activeItemIndex].userId
|
||||
"
|
||||
:readonly="formState.readOnly || isDeleted"
|
||||
:disabled="isDeleted"
|
||||
:label="$ay.t('WorkOrderItemScheduledUserUserID')"
|
||||
:ref="
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].userId`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].userId`
|
||||
"
|
||||
data-cy="scheduledUsers.userid"
|
||||
:error-messages="
|
||||
form().serverErrors(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].userId`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].userId`
|
||||
)
|
||||
"
|
||||
@input="
|
||||
fieldValueChanged(
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].userId`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].userId`
|
||||
)
|
||||
"
|
||||
@update:name="userChange"
|
||||
@@ -234,25 +228,25 @@
|
||||
:aya-type="$ay.ayt().ServiceRate"
|
||||
:show-edit-icon="true"
|
||||
v-model="
|
||||
value.items[activeWoItemIndex].scheduledUsers[activeItemIndex]
|
||||
value.items[activeWoItemIndex].expenses[activeItemIndex]
|
||||
.serviceRateId
|
||||
"
|
||||
:readonly="formState.readOnly || isDeleted"
|
||||
:disabled="isDeleted"
|
||||
:label="$ay.t('WorkOrderItemScheduledUserServiceRateID')"
|
||||
:ref="
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].serviceRateId`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].serviceRateId`
|
||||
"
|
||||
data-cy="scheduledUsers.serviceRateId"
|
||||
:error-messages="
|
||||
form().serverErrors(
|
||||
this,
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].serviceRateId`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].serviceRateId`
|
||||
)
|
||||
"
|
||||
@input="
|
||||
fieldValueChanged(
|
||||
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].serviceRateId`
|
||||
`Items[${activeWoItemIndex}].expenses[${activeItemIndex}].serviceRateId`
|
||||
)
|
||||
"
|
||||
@update:name="rateChange"
|
||||
@@ -267,8 +261,54 @@
|
||||
/* XXXeslint-disable */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseChargeAmount", FieldKey = "WorkOrderItemExpenseChargeAmount", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseChargeTaxCodeID", FieldKey = "WorkOrderItemExpenseChargeTaxCodeID", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseTaxPaid", FieldKey = "WorkOrderItemExpenseTaxPaid", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseChargeToCustomer", FieldKey = "WorkOrderItemExpenseChargeToCustomer", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseDescription", FieldKey = "WorkOrderItemExpenseDescription", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseName", FieldKey = "WorkOrderItemExpenseName", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseReimburseUser", FieldKey = "WorkOrderItemExpenseReimburseUser", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseTotalCost", FieldKey = "WorkOrderItemExpenseTotalCost", TKeySection = "WorkOrderItemExpense" });
|
||||
l.Add(new FormField { TKey = "WorkOrderItemExpenseUserID", FieldKey = "WorkOrderItemExpenseUserID", TKeySection = "WorkOrderItemExpense" });
|
||||
|
||||
*/
|
||||
|
||||
public string Description { get; set; }
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public decimal TotalCost { get; set; }
|
||||
[Required]
|
||||
public decimal ChargeAmount { get; set; }
|
||||
[Required]
|
||||
public decimal TaxPaid { get; set; }
|
||||
public long? ChargeTaxCodeId { get; set; }
|
||||
[NotMapped]
|
||||
public string ChargeTaxCodeViz { get; set; }
|
||||
public bool ReimburseUser { get; set; } = false;
|
||||
public long? UserId { get; set; }
|
||||
[NotMapped]
|
||||
public string UserViz { get; set; }
|
||||
public bool ChargeToCustomer { get; set; } = false;
|
||||
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE aworkorderitemexpense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), "
|
||||
+ "description TEXT, name TEXT, totalcost DECIMAL(38,18) NOT NULL default 0, chargeamount DECIMAL(38,18) NOT NULL default 0, taxpaid DECIMAL(38,18) NOT NULL default 0, "
|
||||
+ "chargetaxcodeid BIGINT REFERENCES ataxcode, reimburseuser BOOL NOT NULL, userid BIGINT REFERENCES auser, chargetocustomer BOOL NOT NULL"
|
||||
+ ")");
|
||||
|
||||
|
||||
"WorkOrderItemExpenseChargeAmount": "Charge Amount",
|
||||
"WorkOrderItemExpenseChargeTaxCodeID": "Charge Tax Code",
|
||||
"WorkOrderItemExpenseChargeToCustomer": "Charge to customer?",
|
||||
"WorkOrderItemExpenseDescription": "Description",
|
||||
"WorkOrderItemExpenseList": "Expenses",
|
||||
"WorkOrderItemExpenseName": "Misc Exp Summary",
|
||||
"WorkOrderItemExpenseReimburseUser": "Reimburse User?",
|
||||
"WorkOrderItemExpenseTaxPaid": "Tax Paid",
|
||||
"WorkOrderItemExpenseTotalCost": "Total Cost",
|
||||
"WorkOrderItemExpenseUser": "User",
|
||||
"WorkOrderItemExpenseUserID": "User",
|
||||
*/
|
||||
export default {
|
||||
created() {
|
||||
this.setDefaultView();
|
||||
@@ -302,12 +342,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
userChange(newName) {
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.value.items[this.activeWoItemIndex].expenses[
|
||||
this.activeItemIndex
|
||||
].userViz = newName;
|
||||
},
|
||||
rateChange(newName) {
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.value.items[this.activeWoItemIndex].expenses[
|
||||
this.activeItemIndex
|
||||
].serviceRateViz = newName;
|
||||
},
|
||||
@@ -332,13 +372,13 @@ export default {
|
||||
this.activeItemIndex = newIndex;
|
||||
},
|
||||
unDeleteItem() {
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.value.items[this.activeWoItemIndex].expenses[
|
||||
this.activeItemIndex
|
||||
].deleted = false;
|
||||
this.setDefaultView();
|
||||
},
|
||||
deleteItem() {
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.value.items[this.activeWoItemIndex].expenses[
|
||||
this.activeItemIndex
|
||||
].deleted = true;
|
||||
this.setDefaultView();
|
||||
@@ -364,7 +404,7 @@ export default {
|
||||
fieldValueChanged(ref) {
|
||||
if (!this.formState.loading && !this.formState.readonly) {
|
||||
//flag this record dirty so it gets picked up by save
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.value.items[this.activeWoItemIndex].expenses[
|
||||
this.activeItemIndex
|
||||
].isDirty = true;
|
||||
window.$gz.form.fieldValueChanged(this.pvm, ref);
|
||||
@@ -378,7 +418,7 @@ export default {
|
||||
itemRowClasses: function(item) {
|
||||
let ret = "";
|
||||
const isDeleted =
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[item.index]
|
||||
this.value.items[this.activeWoItemIndex].expenses[item.index]
|
||||
.deleted === true;
|
||||
|
||||
const hasError = this.form().childRowHasError(
|
||||
@@ -398,7 +438,7 @@ export default {
|
||||
computed: {
|
||||
isDeleted: function() {
|
||||
if (
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.value.items[this.activeWoItemIndex].expenses[
|
||||
this.activeItemIndex
|
||||
] == null
|
||||
) {
|
||||
@@ -406,9 +446,8 @@ export default {
|
||||
return true;
|
||||
}
|
||||
return (
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.activeItemIndex
|
||||
].deleted === true
|
||||
this.value.items[this.activeWoItemIndex].expenses[this.activeItemIndex]
|
||||
.deleted === true
|
||||
);
|
||||
},
|
||||
parentDeleted: function() {
|
||||
|
||||
@@ -361,16 +361,16 @@
|
||||
@change="$emit('change')"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<GzWoItemScheduledUsers
|
||||
<v-col cols="12">
|
||||
<GzWoItemExpenses
|
||||
v-if="
|
||||
pvm.subRights.scheduledUsers.visible &&
|
||||
form().showMe(this, 'WorkOrderItemScheduledUserList')
|
||||
pvm.subRights.expenses.visible &&
|
||||
form().showMe(this, 'WorkOrderItemExpenseList')
|
||||
"
|
||||
v-model="value"
|
||||
:pvm="pvm"
|
||||
:active-wo-item-index="activeItemIndex"
|
||||
data-cy="woItemScheduledUsers"
|
||||
data-cy="woItemExpenses"
|
||||
@change="$emit('change')"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
Reference in New Issue
Block a user