This commit is contained in:
2021-05-27 00:01:46 +00:00
parent 9c2b25930b
commit 5dd024b0b2
2 changed files with 161 additions and 144 deletions

View File

@@ -346,6 +346,7 @@ CURRENTLY DOING: loaners
ORDER: loans, units, outside service, then post and test remotely all devices, then back to refinement todo's below and cases
todo: seeder stock data / translations: loanunit "Units" have extraneous "rate" in them, i.e. "Hourly rate", sb just "Hourly"
todo: LoanUnit edit form add "*Cost" fields to UI
todo: part request
link to open po, delete button in grid? both?

View File

@@ -6,7 +6,7 @@
<template v-slot:activator="{ on, attrs }">
<div class="text-h6">
<v-icon large color="primary" class="mr-2">$ayiBoxes</v-icon>
{{ $ay.t("WorkOrderItemPartList") }}
{{ $ay.t("WorkOrderItemLoanList") }}
<v-btn v-if="!parentDeleted" large icon v-bind="attrs" v-on="on">
<v-icon small color="primary">$ayiEllipsisV</v-icon>
</v-btn>
@@ -48,7 +48,7 @@
disable-filtering
disable-sort
hide-default-footer
data-cy="partsTable"
data-cy="loansTable"
dense
:item-class="itemRowClasses"
@click:row="handleRowClick"
@@ -69,7 +69,7 @@
>
<v-col
v-if="form().showMe(this, 'WorkOrderItemPartQuantity')"
v-if="form().showMe(this, 'WorkOrderItemLoanQuantity')"
cols="12"
sm="6"
lg="4"
@@ -77,33 +77,33 @@
>
<gz-decimal
v-model="
value.items[activeWoItemIndex].parts[activeItemIndex].quantity
value.items[activeWoItemIndex].loans[activeItemIndex].quantity
"
:readonly="formState.readOnly || isDeleted"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemPartQuantity')"
:label="$ay.t('WorkOrderItemLoanQuantity')"
:ref="
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].quantity`
"
data-cy="partQuantity"
data-cy="loanQuantity"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].quantity`
)
"
:rules="[
form().decimalValid(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].quantity`
),
form().required(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].quantity`
)
]"
@input="
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
fieldValueChanged(`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].quantity`)
"
@@ -111,70 +111,70 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderItemPartPartID')"
v-if="form().showMe(this, 'WorkOrderItemLoanLoanID')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
:aya-type="$ay.ayt().Part"
:aya-type="$ay.ayt().Loan"
:show-edit-icon="true"
v-model="
value.items[activeWoItemIndex].parts[activeItemIndex].partId
value.items[activeWoItemIndex].loans[activeItemIndex].loanId
"
:readonly="formState.readOnly || isDeleted"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemPartPartID')"
:label="$ay.t('WorkOrderItemLoanLoanID')"
:ref="
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanId`
"
data-cy="parts.partId"
data-cy="loans.loanId"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanId`
)
"
@input="
fieldValueChanged(
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanId`
)
"
@update:name="partChange"
@update:name="loanChange"
></gz-pick-list>
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderItemPartPartWarehouseID')"
v-if="form().showMe(this, 'WorkOrderItemLoanLoanWarehouseID')"
cols="12"
sm="6"
lg="4"
xl="3"
>
<gz-pick-list
:aya-type="$ay.ayt().PartWarehouse"
:aya-type="$ay.ayt().LoanWarehouse"
:show-edit-icon="true"
v-model="
value.items[activeWoItemIndex].parts[activeItemIndex]
.partWarehouseId
value.items[activeWoItemIndex].loans[activeItemIndex]
.loanWarehouseId
"
:readonly="formState.readOnly || isDeleted"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemPartPartWarehouseID')"
:label="$ay.t('WorkOrderItemLoanLoanWarehouseID')"
:ref="
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partWarehouseId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanWarehouseId`
"
data-cy="parts.partWarehouseId"
data-cy="loans.loanWarehouseId"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partWarehouseId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanWarehouseId`
)
"
@input="
fieldValueChanged(
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partWarehouseId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].loanWarehouseId`
)
"
@update:name="warehouseChange"
@@ -182,7 +182,7 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderItemPartDescription')"
v-if="form().showMe(this, 'WorkOrderItemLoanDescription')"
cols="12"
sm="6"
lg="4"
@@ -190,23 +190,23 @@
>
<v-text-field
v-model="
value.items[activeWoItemIndex].parts[activeItemIndex].description
value.items[activeWoItemIndex].loans[activeItemIndex].description
"
:readonly="formState.readOnly || isDeleted"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemPartDescription')"
:label="$ay.t('WorkOrderItemLoanDescription')"
:ref="
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].description`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].description`
"
data-cy="partQuantity"
data-cy="loanQuantity"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].description`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].description`
)
"
@input="
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
fieldValueChanged(`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].description`)
"
@@ -214,7 +214,7 @@
</v-col>
<v-col
v-if="form().showMe(this, 'WorkOrderItemPartTaxPartSaleID')"
v-if="form().showMe(this, 'WorkOrderItemLoanTaxLoanSaleID')"
cols="12"
sm="6"
lg="4"
@@ -224,25 +224,25 @@
:aya-type="$ay.ayt().TaxCode"
:show-edit-icon="true"
v-model="
value.items[activeWoItemIndex].parts[activeItemIndex]
.taxPartSaleId
value.items[activeWoItemIndex].loans[activeItemIndex]
.taxLoanSaleId
"
:readonly="formState.readOnly || isDeleted"
:disabled="isDeleted"
:label="$ay.t('WorkOrderItemPartTaxPartSaleID')"
:label="$ay.t('WorkOrderItemLoanTaxLoanSaleID')"
:ref="
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].taxPartSaleId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxLoanSaleId`
"
data-cy="partTaxCodeSaleId"
data-cy="loanTaxCodeSaleId"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].taxPartSaleId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxLoanSaleId`
)
"
@input="
fieldValueChanged(
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].taxPartSaleId`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].taxLoanSaleId`
)
"
@update:name="taxCodeChange"
@@ -250,7 +250,7 @@
</v-col>
<v-col
v-if="form().showMe(this, 'PartPriceOverride')"
v-if="form().showMe(this, 'LoanPriceOverride')"
cols="12"
sm="6"
lg="4"
@@ -258,7 +258,7 @@
>
<gz-currency
v-model="
value.items[activeWoItemIndex].parts[activeItemIndex]
value.items[activeWoItemIndex].loans[activeItemIndex]
.priceOverride
"
can-clear
@@ -266,33 +266,33 @@
:disabled="isDeleted"
:label="$ay.t('PriceOverride')"
:ref="
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].priceOverride`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].priceOverride`
"
data-cy="partpriceoverride"
data-cy="loanpriceoverride"
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].priceOverride`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].priceOverride`
)
"
:rules="[
form().decimalValid(
this,
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].priceOverride`
`Items[${activeWoItemIndex}].loans[${activeItemIndex}].priceOverride`
)
]"
@input="
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
fieldValueChanged(`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].priceOverride`)
"
></gz-currency>
</v-col>
<v-col v-if="form().showMe(this, 'WorkOrderItemPartSerials')" cols="12">
<v-col v-if="form().showMe(this, 'WorkOrderItemLoanSerials')" cols="12">
<v-textarea
v-model="
value.items[activeWoItemIndex].parts[activeItemIndex].serials
value.items[activeWoItemIndex].loans[activeItemIndex].serials
"
:readonly="formState.readOnly"
:disabled="isDeleted"
@@ -300,19 +300,19 @@
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].parts[
`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].serials`
)
"
:ref="
`Items[${activeWoItemIndex}].parts[
`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].serials`
"
data-cy="partSerials"
data-cy="loanSerials"
@input="
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
fieldValueChanged(`Items[${activeWoItemIndex}].loans[
${activeItemIndex}
].serials`)
"
@@ -348,7 +348,7 @@ l.Add(new FormField { TKey = "TaxAAmt", FieldKey = "LoanTaxAViz", TKeySection =
l.Add(new FormField { TKey = "TaxBAmt", FieldKey = "LoanTaxBViz", TKeySection = "WorkOrderItemLoans" });
l.Add(new FormField { TKey = "LineTotal", FieldKey = "LoanLineTotalViz", TKeySection = "WorkOrderItemLoans" });
{
"0": {
"0": {## Item, rate, quantity, loaned,due, returned,notes, $$$ FIELDS
"id": 31,
"concurrency": 8125060,
"notes": null,
@@ -408,33 +408,33 @@ export default {
},
methods: {
warehouseChange(newName) {
this.value.items[this.activeWoItemIndex].parts[
this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex
].partWarehouseViz = newName;
].loanWarehouseViz = newName;
},
partChange(newName) {
this.value.items[this.activeWoItemIndex].parts[
loanChange(newName) {
this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex
].partViz = newName;
].loanViz = newName;
},
taxCodeChange(newName) {
this.value.items[this.activeWoItemIndex].parts[
this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex
].taxPartSaleViz = newName;
].taxLoanSaleViz = newName;
},
newItem() {
let newIndex = this.value.items[this.activeWoItemIndex].parts.length;
let newIndex = this.value.items[this.activeWoItemIndex].loans.length;
this.value.items[this.activeWoItemIndex].parts.push({
this.value.items[this.activeWoItemIndex].loans.push({
id: 0,
concurrency: 0,
userId: null,
description: null,
serials: null,
partId: null,
partWarehouseId: null,
loanId: null,
loanWarehouseId: null,
quantity: 1,
taxPartSaleId: null,
taxLoanSaleId: null,
price: 0,
priceOverride: null,
cost: 0,
@@ -448,13 +448,13 @@ export default {
this.activeItemIndex = newIndex;
},
unDeleteItem() {
this.value.items[this.activeWoItemIndex].parts[
this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex
].deleted = false;
this.setDefaultView();
},
deleteItem() {
this.value.items[this.activeWoItemIndex].parts[
this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex
].deleted = true;
this.setDefaultView();
@@ -462,7 +462,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].parts.length == 1) {
if (this.value.items[this.activeWoItemIndex].loans.length == 1) {
this.selectedRow = [{ index: 0 }];
this.activeItemIndex = 0;
} else {
@@ -480,7 +480,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].parts[
this.value.items[this.activeWoItemIndex].loans[
this.activeItemIndex
].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
@@ -489,12 +489,12 @@ export default {
itemRowClasses: function(item) {
let ret = "";
const isDeleted =
this.value.items[this.activeWoItemIndex].parts[item.index].deleted ===
this.value.items[this.activeWoItemIndex].loans[item.index].deleted ===
true;
const hasError = this.form().childRowHasError(
this,
`Items[${this.activeWoItemIndex}].Parts[${item.index}].`
`Items[${this.activeWoItemIndex}].Loans[${item.index}].`
);
if (isDeleted) {
@@ -510,14 +510,14 @@ export default {
computed: {
isDeleted: function() {
if (
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex] ==
this.value.items[this.activeWoItemIndex].loans[this.activeItemIndex] ==
null
) {
this.setDefaultView();
return true;
}
return (
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex]
this.value.items[this.activeWoItemIndex].loans[this.activeItemIndex]
.deleted === true
);
},
@@ -532,63 +532,63 @@ export default {
*/
let headers = [];
if (this.form().showMe(this, "WorkOrderItemPartPartID")) {
if (this.form().showMe(this, "WorkOrderItemLoanUnit")) {
headers.push({
text: this.$ay.t("WorkOrderItemPartPartID"),
text: this.$ay.t("WorkOrderItemLoanUnit"),
align: "left",
value: "partViz"
value: "loanUnitViz"
});
}
if (this.form().showMe(this, "WorkOrderItemPartPartWarehouseID")) {
if (this.form().showMe(this, "WorkOrderItemLoanRate")) {
headers.push({
text: this.$ay.t("WorkOrderItemPartPartWarehouseID"),
align: "left",
value: "partWarehouseViz"
});
}
if (this.form().showMe(this, "WorkOrderItemPartQuantity")) {
headers.push({
text: this.$ay.t("WorkOrderItemPartQuantity"),
align: "right",
value: "quantity"
});
}
if (this.form().showMe(this, "PartUPC")) {
headers.push({
text: this.$ay.t("PartUPC"),
align: "left",
value: "upcViz"
});
}
if (this.form().showMe(this, "WorkOrderItemPartDescription")) {
headers.push({
text: this.$ay.t("WorkOrderItemPartDescription"),
align: "left",
value: "description"
});
}
if (this.form().showMe(this, "WorkOrderItemPartSerials")) {
headers.push({
text: this.$ay.t("PurchaseOrderItemSerialNumbers"),
align: "left",
value: "serials"
});
}
if (this.form().showMe(this, "PartUnitOfMeasureViz")) {
headers.push({
text: this.$ay.t("UnitOfMeasure"),
text: this.$ay.t("WorkOrderItemLoanRate"),
align: "left",
value: "unitOfMeasureViz"
});
}
if (this.form().showMe(this, "PartCost")) {
if (this.form().showMe(this, "WorkOrderItemLoanQuantity")) {
headers.push({
text: this.$ay.t("WorkOrderItemLoanQuantity"),
align: "right",
value: "quantity"
});
}
if (this.form().showMe(this, "WorkOrderItemLoanOutDate")) {
headers.push({
text: this.$ay.t("WorkOrderItemLoanOutDate"),
align: "right",
value: "outDate"
});
}
if (this.form().showMe(this, "WorkOrderItemLoanDueDate")) {
headers.push({
text: this.$ay.t("WorkOrderItemLoanDueDate"),
align: "right",
value: "dueDate"
});
}
if (this.form().showMe(this, "WorkOrderItemLoanReturnDate")) {
headers.push({
text: this.$ay.t("WorkOrderItemLoanReturnDate"),
align: "right",
value: "returnDate"
});
}
if (this.form().showMe(this, "WorkOrderItemLoanNotes")) {
headers.push({
text: this.$ay.t("WorkOrderItemLoanNotes"),
align: "left",
value: "notes"
});
}
if (this.form().showMe(this, "LoanCost")) {
headers.push({
text: this.$ay.t("Cost"),
align: "right",
@@ -596,7 +596,7 @@ export default {
});
}
if (this.form().showMe(this, "PartListPrice")) {
if (this.form().showMe(this, "LoanListPrice")) {
headers.push({
text: this.$ay.t("ListPrice"),
align: "right",
@@ -604,7 +604,7 @@ export default {
});
}
if (this.form().showMe(this, "PartPriceOverride")) {
if (this.form().showMe(this, "LoanPriceOverride")) {
headers.push({
text: this.$ay.t("PriceOverride"),
align: "right",
@@ -612,7 +612,7 @@ export default {
});
}
if (this.form().showMe(this, "PartPriceViz")) {
if (this.form().showMe(this, "LoanPriceViz")) {
headers.push({
text: this.$ay.t("Price"),
align: "right",
@@ -620,15 +620,15 @@ export default {
});
}
if (this.form().showMe(this, "WorkOrderItemPartTaxPartSaleID")) {
if (this.form().showMe(this, "WorkOrderItemLoanTaxCodeID")) {
headers.push({
text: this.$ay.t("Tax"),
align: "left",
value: "taxPartSaleViz"
value: "taxCodeViz"
});
}
if (this.form().showMe(this, "PartNetViz")) {
if (this.form().showMe(this, "LoanNetViz")) {
headers.push({
text: this.$ay.t("NetPrice"),
align: "right",
@@ -636,7 +636,7 @@ export default {
});
}
if (this.form().showMe(this, "PartTaxAViz")) {
if (this.form().showMe(this, "LoanTaxAViz")) {
headers.push({
text: this.$ay.t("TaxAAmt"),
align: "right",
@@ -644,7 +644,7 @@ export default {
});
}
if (this.form().showMe(this, "PartTaxBViz")) {
if (this.form().showMe(this, "LoanTaxBViz")) {
headers.push({
text: this.$ay.t("TaxBAmt"),
align: "right",
@@ -652,7 +652,7 @@ export default {
});
}
if (this.form().showMe(this, "PartLineTotalViz")) {
if (this.form().showMe(this, "LoanLineTotalViz")) {
headers.push({
text: this.$ay.t("LineTotal"),
align: "right",
@@ -662,20 +662,36 @@ export default {
return headers;
},
itemList: function() {
return this.value.items[this.activeWoItemIndex].parts.map((x, i) => {
return this.value.items[this.activeWoItemIndex].loans.map((x, i) => {
return {
index: i,
id: x.id,
partViz: x.partViz,
partWarehouseViz: x.partWarehouseViz,
loanUnitViz: x.loanUnitViz,
unitOfMeasureViz: x.unitOfMeasureViz,
quantity: window.$gz.locale.decimalLocalized(
x.quantity,
this.pvm.languageName
),
upcViz: x.upcViz,
description: x.description,
serials: window.$gz.util.truncateString(x.serials, 50),
unitOfMeasureViz: x.unitOfMeasureViz,
outDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
x.outDate,
this.pvm.timeZoneName,
this.pvm.languageName,
this.pvm.hour12
),
dueDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
x.dueDate,
this.pvm.timeZoneName,
this.pvm.languageName,
this.pvm.hour12
),
returnDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
x.returnDate,
this.pvm.timeZoneName,
this.pvm.languageName,
this.pvm.hour12
),
notes: window.$gz.util.truncateString(x.notes, 50),
cost: window.$gz.locale.currencyLocalized(
x.cost,
this.pvm.languageName,
@@ -691,7 +707,7 @@ export default {
this.pvm.languageName,
this.pvm.currencyName
),
taxPartSaleViz: x.taxPartSaleViz,
taxCodeViz: x.taxCodeViz,
priceOverride: window.$gz.locale.currencyLocalized(
x.priceOverride,
this.pvm.languageName,
@@ -727,16 +743,16 @@ export default {
return this.pvm.formCustomTemplateKey;
},
showTable: function() {
return this.value.items[this.activeWoItemIndex].parts.length > 1;
return this.value.items[this.activeWoItemIndex].loans.length > 1;
},
canAdd: function() {
return this.pvm.rights.change && this.pvm.subRights.parts.create;
return this.pvm.rights.change && this.pvm.subRights.loans.create;
},
canDelete: function() {
return (
this.activeItemIndex != null &&
this.pvm.rights.change &&
this.pvm.subRights.parts.delete
this.pvm.subRights.loans.delete
);
}
//----