This commit is contained in:
2021-05-27 00:30:39 +00:00
parent 5dd024b0b2
commit 8eb8b026fa
4 changed files with 166 additions and 64 deletions

View File

@@ -369,7 +369,7 @@ todo: strip all *viz fields from object before sending over the wire from client
todo: mark for deletion with ONE record and no table?? how does that work? todo: mark for deletion with ONE record and no table?? how does that work?
TODO: test new from scratch wo regularly TODO: test new from scratch wo regularly
todo: subrights test
todo: Need a preset default for the workorder customization, right now it's just barfing up all fields todo: Need a preset default for the workorder customization, right now it's just barfing up all fields

View File

@@ -5,7 +5,7 @@
<v-menu offset-y> <v-menu offset-y>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<div class="text-h6"> <div class="text-h6">
<v-icon large color="primary" class="mr-2">$ayiBoxes</v-icon> <v-icon large color="primary" class="mr-2">$ayiPlug</v-icon>
{{ $ay.t("WorkOrderItemLoanList") }} {{ $ay.t("WorkOrderItemLoanList") }}
<v-btn v-if="!parentDeleted" large icon v-bind="attrs" v-on="on"> <v-btn v-if="!parentDeleted" large icon v-bind="attrs" v-on="on">
<v-icon small color="primary">$ayiEllipsisV</v-icon> <v-icon small color="primary">$ayiEllipsisV</v-icon>
@@ -68,6 +68,92 @@
}}<v-icon right large>$ayiTrashRestoreAlt</v-icon></v-btn }}<v-icon right large>$ayiTrashRestoreAlt</v-icon></v-btn
> >
<v-col
v-if="form().showMe(this, 'WorkOrderItemLoanUnit')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
:aya-type="$ay.ayt().LoanUnit"
:show-edit-icon="true"
v-model="
value.items[activeWoItemIndex].loans[activeItemIndex].loanUnitId
"
:readonly="formState.readOnly || isDeleted"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemLoanUnit')"
:ref="
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanUnitId`
"
data-cy="loans.loanUnitId"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanUnitId`
)
"
@input="
fieldValueChanged(
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanUnitId`
)
"
@update:name="loanUnitChange"
></gz-pick-list>
</v-col>
<v-col
v-if="
form().showMe(
this,
'WorkOrderItemTaskWorkOrderItemTaskCompletionType'
)
"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-select
v-model="value.items[activeWoItemIndex].loans[activeItemIndex].rate"
:items="pvm.selectLists.loanUnitRateUnits"
item-text="name"
item-value="id"
:readonly="formState.readOnly || isDeleted"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemTaskWorkOrderItemTaskCompletionType')"
:ref="
`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].rate`
"
data-cy="loanUnitRateUnit"
:rules="[
form().integerValid(
this,
`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].rate`
)
]"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].rate`
)
"
@input="
fieldValueChanged(`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].rate`)
"
@change="loanUnitRateUnitChange"
></v-select>
</v-col>
<v-col <v-col
v-if="form().showMe(this, 'WorkOrderItemLoanQuantity')" v-if="form().showMe(this, 'WorkOrderItemLoanQuantity')"
cols="12" cols="12"
@@ -111,110 +197,103 @@
</v-col> </v-col>
<v-col <v-col
v-if="form().showMe(this, 'WorkOrderItemLoanLoanID')" v-if="form().showMe(this, 'WorkOrderItemLoanOutDate')"
cols="12" cols="12"
sm="6" sm="6"
lg="4" lg="4"
xl="3" xl="3"
> >
<gz-pick-list <gz-date-time-picker
:aya-type="$ay.ayt().Loan" :label="$ay.t('WorkOrderItemLoanOutDate')"
:show-edit-icon="true"
v-model=" v-model="
value.items[activeWoItemIndex].loans[activeItemIndex].loanId value.items[activeWoItemIndex].loans[activeItemIndex].outDate
" "
:readonly="formState.readOnly || isDeleted" :readonly="formState.readOnly"
:disabled="isDeleted" :disabled="isDeleted"
:label="$ay.t('WorkOrderItemLoanLoanID')"
:ref=" :ref="
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].outDate`
" "
data-cy="loans.loanId" data-cy="loanUnitOutDate"
:error-messages=" :error-messages="
form().serverErrors( form().serverErrors(
this, this,
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].outDate`
) )
" "
@input=" @input="
fieldValueChanged( fieldValueChanged(
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].outDate`
) )
" "
@update:name="loanChange" ></gz-date-time-picker>
></gz-pick-list>
</v-col> </v-col>
<v-col <v-col
v-if="form().showMe(this, 'WorkOrderItemLoanLoanWarehouseID')" v-if="form().showMe(this, 'WorkOrderItemLoanDueDate')"
cols="12" cols="12"
sm="6" sm="6"
lg="4" lg="4"
xl="3" xl="3"
> >
<gz-pick-list <gz-date-time-picker
:aya-type="$ay.ayt().LoanWarehouse" :label="$ay.t('WorkOrderItemLoanDueDate')"
:show-edit-icon="true"
v-model=" v-model="
value.items[activeWoItemIndex].loans[activeItemIndex] value.items[activeWoItemIndex].loans[activeItemIndex].dueDate
.loanWarehouseId
" "
:readonly="formState.readOnly || isDeleted" :readonly="formState.readOnly"
:disabled="isDeleted" :disabled="isDeleted"
:label="$ay.t('WorkOrderItemLoanLoanWarehouseID')"
:ref=" :ref="
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanWarehouseId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].dueDate`
" "
data-cy="loans.loanWarehouseId" data-cy="loanUnitDueDate"
:error-messages=" :error-messages="
form().serverErrors( form().serverErrors(
this, this,
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanWarehouseId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].dueDate`
) )
" "
@input=" @input="
fieldValueChanged( fieldValueChanged(
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanWarehouseId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].dueDate`
) )
" "
@update:name="warehouseChange" ></gz-date-time-picker>
></gz-pick-list>
</v-col> </v-col>
<v-col <v-col
v-if="form().showMe(this, 'WorkOrderItemLoanDescription')" v-if="form().showMe(this, 'WorkOrderItemLoanReturnDate')"
cols="12" cols="12"
sm="6" sm="6"
lg="4" lg="4"
xl="3" xl="3"
> >
<v-text-field <gz-date-time-picker
:label="$ay.t('WorkOrderItemLoanReturnDate')"
v-model=" v-model="
value.items[activeWoItemIndex].loans[activeItemIndex].description value.items[activeWoItemIndex].loans[activeItemIndex].returnDate
" "
:readonly="formState.readOnly || isDeleted" :readonly="formState.readOnly"
:disabled="isDeleted" :disabled="isDeleted"
:label="$ay.t('WorkOrderItemLoanDescription')"
:ref=" :ref="
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].description` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].returnDate`
" "
data-cy="loanQuantity" data-cy="loanUnitReturnDate"
:error-messages=" :error-messages="
form().serverErrors( form().serverErrors(
this, this,
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].description` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].returnDate`
) )
" "
@input=" @input="
fieldValueChanged(`Items[${activeWoItemIndex}].loans[ fieldValueChanged(
${activeItemIndex} `Items[${activeWoItemIndex}].loans[${activeItemIndex}].returnDate`
].description`) )
" "
></v-text-field> ></gz-date-time-picker>
</v-col> </v-col>
<v-col <v-col
v-if="form().showMe(this, 'WorkOrderItemLoanTaxLoanSaleID')" v-if="form().showMe(this, 'WorkOrderItemLoanTaxCodeID')"
cols="12" cols="12"
sm="6" sm="6"
lg="4" lg="4"
@@ -224,25 +303,24 @@
:aya-type="$ay.ayt().TaxCode" :aya-type="$ay.ayt().TaxCode"
:show-edit-icon="true" :show-edit-icon="true"
v-model=" v-model="
value.items[activeWoItemIndex].loans[activeItemIndex] value.items[activeWoItemIndex].loans[activeItemIndex].taxCodeId
.taxLoanSaleId
" "
:readonly="formState.readOnly || isDeleted" :readonly="formState.readOnly || isDeleted"
:disabled="isDeleted" :disabled="isDeleted"
:label="$ay.t('WorkOrderItemLoanTaxLoanSaleID')" :label="$ay.t('WorkOrderItemLoanTaxCodeID')"
:ref=" :ref="
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxLoanSaleId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxCodeId`
" "
data-cy="loanTaxCodeSaleId" data-cy="loanTaxCodeSaleId"
:error-messages=" :error-messages="
form().serverErrors( form().serverErrors(
this, this,
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxLoanSaleId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxCodeId`
) )
" "
@input=" @input="
fieldValueChanged( fieldValueChanged(
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxLoanSaleId` `Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxCodeId`
) )
" "
@update:name="taxCodeChange" @update:name="taxCodeChange"
@@ -289,32 +367,32 @@
></gz-currency> ></gz-currency>
</v-col> </v-col>
<v-col v-if="form().showMe(this, 'WorkOrderItemLoanSerials')" cols="12"> <v-col v-if="form().showMe(this, 'WorkOrderItemLoanNotes')" cols="12">
<v-textarea <v-textarea
v-model=" v-model="
value.items[activeWoItemIndex].loans[activeItemIndex].serials value.items[activeWoItemIndex].loans[activeItemIndex].notes
" "
:readonly="formState.readOnly" :readonly="formState.readOnly"
:disabled="isDeleted" :disabled="isDeleted"
:label="$ay.t('PurchaseOrderItemSerialNumbers')" :label="$ay.t('WorkOrderItemLoanNotes')"
:error-messages=" :error-messages="
form().serverErrors( form().serverErrors(
this, this,
`Items[${activeWoItemIndex}].loans[ `Items[${activeWoItemIndex}].loans[
${activeItemIndex} ${activeItemIndex}
].serials` ].notes`
) )
" "
:ref=" :ref="
`Items[${activeWoItemIndex}].loans[ `Items[${activeWoItemIndex}].loans[
${activeItemIndex} ${activeItemIndex}
].serials` ].notes`
" "
data-cy="loanSerials" data-cy="loanUnitNotes"
@input=" @input="
fieldValueChanged(`Items[${activeWoItemIndex}].loans[ fieldValueChanged(`Items[${activeWoItemIndex}].loans[
${activeItemIndex} ${activeItemIndex}
].serials`) ].notes`)
" "
auto-grow auto-grow
></v-textarea> ></v-textarea>
@@ -334,7 +412,7 @@ l.Add(new FormField { TKey = "WorkOrderItemLoanOutDate", FieldKey = "WorkOrderIt
l.Add(new FormField { TKey = "WorkOrderItemLoanDueDate", FieldKey = "WorkOrderItemLoanDueDate", TKeySection = "WorkOrderItemLoans" }); l.Add(new FormField { TKey = "WorkOrderItemLoanDueDate", FieldKey = "WorkOrderItemLoanDueDate", TKeySection = "WorkOrderItemLoans" });
l.Add(new FormField { TKey = "WorkOrderItemLoanReturnDate", FieldKey = "WorkOrderItemLoanReturnDate", TKeySection = "WorkOrderItemLoans" }); l.Add(new FormField { TKey = "WorkOrderItemLoanReturnDate", FieldKey = "WorkOrderItemLoanReturnDate", TKeySection = "WorkOrderItemLoans" });
l.Add(new FormField { TKey = "WorkOrderItemLoanTaxCodeID", FieldKey = "WorkOrderItemLoanTaxCodeID", TKeySection = "WorkOrderItemLoans" }); l.Add(new FormField { TKey = "WorkOrderItemLoanTaxCodeID", FieldKey = "WorkOrderItemLoanTaxCodeID", TKeySection = "WorkOrderItemLoans" });
l.Add(new FormField { TKey = "WorkOrderItemLoanTaxLoanSaleID", FieldKey = "WorkOrderItemLoanTaxLoanSaleID", TKeySection = "WorkOrderItemLoans" }); l.Add(new FormField { TKey = "WorkOrderItemLoanTaxCodeID", FieldKey = "WorkOrderItemLoanTaxCodeID", TKeySection = "WorkOrderItemLoans" });
l.Add(new FormField { TKey = "WorkOrderItemLoanUnit", FieldKey = "WorkOrderItemLoanUnit", TKeySection = "WorkOrderItemLoans" }); l.Add(new FormField { TKey = "WorkOrderItemLoanUnit", FieldKey = "WorkOrderItemLoanUnit", TKeySection = "WorkOrderItemLoans" });
l.Add(new FormField { TKey = "WorkOrderItemLoanQuantity", FieldKey = "WorkOrderItemLoanQuantity", TKeySection = "WorkOrderItemLoans" }); l.Add(new FormField { TKey = "WorkOrderItemLoanQuantity", FieldKey = "WorkOrderItemLoanQuantity", TKeySection = "WorkOrderItemLoans" });
l.Add(new FormField { TKey = "WorkOrderItemLoanRate", FieldKey = "WorkOrderItemLoanRate", TKeySection = "WorkOrderItemLoans" }); l.Add(new FormField { TKey = "WorkOrderItemLoanRate", FieldKey = "WorkOrderItemLoanRate", TKeySection = "WorkOrderItemLoans" });
@@ -407,15 +485,17 @@ export default {
} }
}, },
methods: { methods: {
warehouseChange(newName) { loanUnitRateUnitChange(newId) {
this.value.items[this.activeWoItemIndex].loans[ this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex this.activeItemIndex
].loanWarehouseViz = newName; ].unitOfMeasureViz = this.pvm.selectLists.loanUnitRateUnits.find(
s => s.id == newId
).name;
}, },
loanChange(newName) { loanUnitChange(newName) {
this.value.items[this.activeWoItemIndex].loans[ this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex this.activeItemIndex
].loanViz = newName; ].loanUnitViz = newName;
}, },
taxCodeChange(newName) { taxCodeChange(newName) {
this.value.items[this.activeWoItemIndex].loans[ this.value.items[this.activeWoItemIndex].loans[
@@ -434,7 +514,7 @@ export default {
loanId: null, loanId: null,
loanWarehouseId: null, loanWarehouseId: null,
quantity: 1, quantity: 1,
taxLoanSaleId: null, taxCodeId: null,
price: 0, price: 0,
priceOverride: null, priceOverride: null,
cost: 0, cost: 0,

View File

@@ -472,7 +472,22 @@
/> />
</v-col> </v-col>
<!-- //todo WorkOrderItemLoanList here <v-col
cols="12"
v-if="
pvm.subRights.expenses.visible &&
form().showMe(this, 'WorkOrderItemLoanList')
"
>
<GzWoItemLoans
v-model="value"
:pvm="pvm"
:active-wo-item-index="activeItemIndex"
data-cy="woItemLoans"
@change="$emit('change')"
/>
</v-col>
<!--
//todo WorkOrderItemOutsideServiceList here --> //todo WorkOrderItemOutsideServiceList here -->
</template> </template>
</v-row> </v-row>
@@ -489,6 +504,7 @@ import GzWoItemExpenses from "../components/work-order-item-expenses.vue";
import GzWoItemTasks from "../components/work-order-item-tasks.vue"; import GzWoItemTasks from "../components/work-order-item-tasks.vue";
import GzWoItemParts from "../components/work-order-item-parts.vue"; import GzWoItemParts from "../components/work-order-item-parts.vue";
import GzWoItemPartRequests from "../components/work-order-item-part-requests.vue"; import GzWoItemPartRequests from "../components/work-order-item-part-requests.vue";
import GzWoItemLoans from "../components/work-order-item-loans.vue";
export default { export default {
components: { components: {
@@ -498,7 +514,8 @@ export default {
GzWoItemTravels, GzWoItemTravels,
GzWoItemTasks, GzWoItemTasks,
GzWoItemParts, GzWoItemParts,
GzWoItemPartRequests GzWoItemPartRequests,
GzWoItemLoans
}, },
created() { created() {
this.setDefaultView(); this.setDefaultView();

View File

@@ -183,7 +183,8 @@ export default {
allowedwostatus: [], allowedwostatus: [],
woItemPriorities: [], woItemPriorities: [],
woItemStatus: [], woItemStatus: [],
woItemTaskCompletionTypes: [] woItemTaskCompletionTypes: [],
loanUnitRateUnits: []
}, },
subRights: { subRights: {
items: { items: {
@@ -1908,6 +1909,10 @@ async function populateSelectionLists(vm) {
"WorkorderItemTaskCompletionType" "WorkorderItemTaskCompletionType"
); );
await window.$gz.enums.fetchEnumList("LoanUnitRateUnit"); //prefetch
vm.selectLists.loanUnitRateUnits = window.$gz.enums.getSelectionList(
"LoanUnitRateUnit"
);
//--------- //---------
} }
</script> </script>