This commit is contained in:
745
ayanova/src/components/work-order-item-loans.vue
Normal file
745
ayanova/src/components/work-order-item-loans.vue
Normal file
@@ -0,0 +1,745 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="value != null" class="mt-8">
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-menu offset-y>
|
||||||
|
<template v-slot:activator="{ on, attrs }">
|
||||||
|
<div class="text-h6">
|
||||||
|
<v-icon large color="primary" class="mr-2">$ayiBoxes</v-icon>
|
||||||
|
{{ $ay.t("WorkOrderItemPartList") }}
|
||||||
|
<v-btn v-if="!parentDeleted" large icon v-bind="attrs" v-on="on">
|
||||||
|
<v-icon small color="primary">$ayiEllipsisV</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<v-list>
|
||||||
|
<v-list-item v-if="canAdd" @click="newItem">
|
||||||
|
<v-list-item-icon>
|
||||||
|
<v-icon>$ayiPlus</v-icon>
|
||||||
|
</v-list-item-icon>
|
||||||
|
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
<v-list-item v-if="canDelete && !isDeleted" @click="deleteItem">
|
||||||
|
<v-list-item-icon>
|
||||||
|
<v-icon>$ayiTrashAlt</v-icon>
|
||||||
|
</v-list-item-icon>
|
||||||
|
<v-list-item-title>{{ $ay.t("SoftDelete") }}</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
|
||||||
|
<v-list-item-icon>
|
||||||
|
<v-icon>$ayiTrashRestoreAlt</v-icon>
|
||||||
|
</v-list-item-icon>
|
||||||
|
<v-list-item-title>{{ $ay.t("Undelete") }}</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-menu>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<template v-if="showTable">
|
||||||
|
<!-- ############################################################### -->
|
||||||
|
<v-col cols="12" class="mb-10">
|
||||||
|
<v-data-table
|
||||||
|
:headers="headerList"
|
||||||
|
:items="itemList"
|
||||||
|
item-key="index"
|
||||||
|
v-model="selectedRow"
|
||||||
|
class="elevation-1"
|
||||||
|
disable-pagination
|
||||||
|
disable-filtering
|
||||||
|
disable-sort
|
||||||
|
hide-default-footer
|
||||||
|
data-cy="partsTable"
|
||||||
|
dense
|
||||||
|
:item-class="itemRowClasses"
|
||||||
|
@click:row="handleRowClick"
|
||||||
|
:show-select="$vuetify.breakpoint.xs"
|
||||||
|
single-select
|
||||||
|
>
|
||||||
|
</v-data-table>
|
||||||
|
</v-col>
|
||||||
|
</template>
|
||||||
|
<template v-if="activeItemIndex != null">
|
||||||
|
<v-btn
|
||||||
|
v-if="canDelete && isDeleted"
|
||||||
|
large
|
||||||
|
@click="unDeleteItem"
|
||||||
|
color="primary"
|
||||||
|
>{{ $ay.t("Undelete")
|
||||||
|
}}<v-icon right large>$ayiTrashRestoreAlt</v-icon></v-btn
|
||||||
|
>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemPartQuantity')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-decimal
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex].quantity
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemPartQuantity')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
|
||||||
|
"
|
||||||
|
data-cy="partQuantity"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:rules="[
|
||||||
|
form().decimalValid(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
|
||||||
|
),
|
||||||
|
form().required(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].quantity`
|
||||||
|
)
|
||||||
|
]"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
|
||||||
|
${activeItemIndex}
|
||||||
|
].quantity`)
|
||||||
|
"
|
||||||
|
></gz-decimal>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemPartPartID')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-pick-list
|
||||||
|
:aya-type="$ay.ayt().Part"
|
||||||
|
:show-edit-icon="true"
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex].partId
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemPartPartID')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId`
|
||||||
|
"
|
||||||
|
data-cy="parts.partId"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:name="partChange"
|
||||||
|
></gz-pick-list>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemPartPartWarehouseID')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-pick-list
|
||||||
|
:aya-type="$ay.ayt().PartWarehouse"
|
||||||
|
:show-edit-icon="true"
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex]
|
||||||
|
.partWarehouseId
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemPartPartWarehouseID')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partWarehouseId`
|
||||||
|
"
|
||||||
|
data-cy="parts.partWarehouseId"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partWarehouseId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].partWarehouseId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:name="warehouseChange"
|
||||||
|
></gz-pick-list>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemPartDescription')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<v-text-field
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex].description
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemPartDescription')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].description`
|
||||||
|
"
|
||||||
|
data-cy="partQuantity"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].description`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
|
||||||
|
${activeItemIndex}
|
||||||
|
].description`)
|
||||||
|
"
|
||||||
|
></v-text-field>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemPartTaxPartSaleID')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-pick-list
|
||||||
|
:aya-type="$ay.ayt().TaxCode"
|
||||||
|
:show-edit-icon="true"
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex]
|
||||||
|
.taxPartSaleId
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemPartTaxPartSaleID')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].taxPartSaleId`
|
||||||
|
"
|
||||||
|
data-cy="partTaxCodeSaleId"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].taxPartSaleId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].taxPartSaleId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:name="taxCodeChange"
|
||||||
|
></gz-pick-list>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'PartPriceOverride')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-currency
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex]
|
||||||
|
.priceOverride
|
||||||
|
"
|
||||||
|
can-clear
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('PriceOverride')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].priceOverride`
|
||||||
|
"
|
||||||
|
data-cy="partpriceoverride"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].priceOverride`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:rules="[
|
||||||
|
form().decimalValid(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[${activeItemIndex}].priceOverride`
|
||||||
|
)
|
||||||
|
]"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
|
||||||
|
${activeItemIndex}
|
||||||
|
].priceOverride`)
|
||||||
|
"
|
||||||
|
></gz-currency>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col v-if="form().showMe(this, 'WorkOrderItemPartSerials')" cols="12">
|
||||||
|
<v-textarea
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].parts[activeItemIndex].serials
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('PurchaseOrderItemSerialNumbers')"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].parts[
|
||||||
|
${activeItemIndex}
|
||||||
|
].serials`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].parts[
|
||||||
|
${activeItemIndex}
|
||||||
|
].serials`
|
||||||
|
"
|
||||||
|
data-cy="partSerials"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].parts[
|
||||||
|
${activeItemIndex}
|
||||||
|
].serials`)
|
||||||
|
"
|
||||||
|
auto-grow
|
||||||
|
></v-textarea>
|
||||||
|
</v-col>
|
||||||
|
</template>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/* XXXeslint-disable */
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/*
|
||||||
|
//WORKORDER ITEM LOAN
|
||||||
|
l.Add(new FormField { TKey = "WorkOrderItemLoanNotes", FieldKey = "WorkOrderItemLoanNotes", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "WorkOrderItemLoanOutDate", FieldKey = "WorkOrderItemLoanOutDate", 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 = "WorkOrderItemLoanTaxCodeID", FieldKey = "WorkOrderItemLoanTaxCodeID", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "WorkOrderItemLoanTaxLoanSaleID", FieldKey = "WorkOrderItemLoanTaxLoanSaleID", 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 = "WorkOrderItemLoanRate", FieldKey = "WorkOrderItemLoanRate", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "Cost", FieldKey = "LoanCost", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "ListPrice", FieldKey = "LoanListPrice", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "Price", FieldKey = "LoanPriceViz", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "PriceOverride", FieldKey = "LoanPriceOverride", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "UnitOfMeasure", FieldKey = "LoanUnitOfMeasureViz", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "NetPrice", FieldKey = "LoanNetViz", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "TaxAAmt", FieldKey = "LoanTaxAViz", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "TaxBAmt", FieldKey = "LoanTaxBViz", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
l.Add(new FormField { TKey = "LineTotal", FieldKey = "LoanLineTotalViz", TKeySection = "WorkOrderItemLoans" });
|
||||||
|
{
|
||||||
|
"0": {
|
||||||
|
"id": 31,
|
||||||
|
"concurrency": 8125060,
|
||||||
|
"notes": null,
|
||||||
|
"outDate": "2020-11-08T01:00:00Z",
|
||||||
|
"dueDate": "2020-11-08T02:00:00Z",
|
||||||
|
"returnDate": null,
|
||||||
|
"taxCodeId": null,
|
||||||
|
"taxCodeViz": null,
|
||||||
|
"loanUnitId": 4,
|
||||||
|
"loanUnitViz": null,
|
||||||
|
"quantity": 1,
|
||||||
|
"rate": 1,
|
||||||
|
"cost": 0,
|
||||||
|
"listPrice": 20.689718162496447,
|
||||||
|
"priceOverride": null,
|
||||||
|
"unitOfMeasureViz": "Hour rate",
|
||||||
|
"priceViz": 20.689718162496447,
|
||||||
|
"netViz": 20.689718162496447,
|
||||||
|
"taxAViz": 0,
|
||||||
|
"taxBViz": 0,
|
||||||
|
"lineTotalViz": 20.689718162496447,
|
||||||
|
"isDirty": false,
|
||||||
|
"workOrderItemId": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
created() {
|
||||||
|
this.setDefaultView();
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
activeItemIndex: null,
|
||||||
|
selectedRow: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
default: null,
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
pvm: {
|
||||||
|
default: null,
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
activeWoItemIndex: {
|
||||||
|
default: null,
|
||||||
|
type: Number
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
activeWoItemIndex(val, oldVal) {
|
||||||
|
if (val != oldVal) {
|
||||||
|
this.setDefaultView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
warehouseChange(newName) {
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[
|
||||||
|
this.activeItemIndex
|
||||||
|
].partWarehouseViz = newName;
|
||||||
|
},
|
||||||
|
partChange(newName) {
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[
|
||||||
|
this.activeItemIndex
|
||||||
|
].partViz = newName;
|
||||||
|
},
|
||||||
|
taxCodeChange(newName) {
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[
|
||||||
|
this.activeItemIndex
|
||||||
|
].taxPartSaleViz = newName;
|
||||||
|
},
|
||||||
|
newItem() {
|
||||||
|
let newIndex = this.value.items[this.activeWoItemIndex].parts.length;
|
||||||
|
|
||||||
|
this.value.items[this.activeWoItemIndex].parts.push({
|
||||||
|
id: 0,
|
||||||
|
concurrency: 0,
|
||||||
|
userId: null,
|
||||||
|
description: null,
|
||||||
|
serials: null,
|
||||||
|
partId: null,
|
||||||
|
partWarehouseId: null,
|
||||||
|
quantity: 1,
|
||||||
|
taxPartSaleId: null,
|
||||||
|
price: 0,
|
||||||
|
priceOverride: null,
|
||||||
|
cost: 0,
|
||||||
|
listPrice: 0,
|
||||||
|
isDirty: true,
|
||||||
|
workOrderItemId: this.value.items[this.activeWoItemIndex].id,
|
||||||
|
uid: Date.now() //used for error tracking / display
|
||||||
|
});
|
||||||
|
this.$emit("change");
|
||||||
|
this.selectedRow = [{ index: newIndex }];
|
||||||
|
this.activeItemIndex = newIndex;
|
||||||
|
},
|
||||||
|
unDeleteItem() {
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[
|
||||||
|
this.activeItemIndex
|
||||||
|
].deleted = false;
|
||||||
|
this.setDefaultView();
|
||||||
|
},
|
||||||
|
deleteItem() {
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[
|
||||||
|
this.activeItemIndex
|
||||||
|
].deleted = true;
|
||||||
|
this.setDefaultView();
|
||||||
|
this.$emit("change");
|
||||||
|
},
|
||||||
|
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) {
|
||||||
|
this.selectedRow = [{ index: 0 }];
|
||||||
|
this.activeItemIndex = 0;
|
||||||
|
} else {
|
||||||
|
this.selectedRow = [];
|
||||||
|
this.activeItemIndex = null; //select nothing in essence resetting a child selects and this one too clearing form
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRowClick: function(item) {
|
||||||
|
this.activeItemIndex = item.index;
|
||||||
|
this.selectedRow = [{ index: item.index }];
|
||||||
|
},
|
||||||
|
form() {
|
||||||
|
return window.$gz.form;
|
||||||
|
},
|
||||||
|
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.activeItemIndex
|
||||||
|
].isDirty = true;
|
||||||
|
window.$gz.form.fieldValueChanged(this.pvm, ref);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemRowClasses: function(item) {
|
||||||
|
let ret = "";
|
||||||
|
const isDeleted =
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[item.index].deleted ===
|
||||||
|
true;
|
||||||
|
|
||||||
|
const hasError = this.form().childRowHasError(
|
||||||
|
this,
|
||||||
|
`Items[${this.activeWoItemIndex}].Parts[${item.index}].`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isDeleted) {
|
||||||
|
ret += this.form().tableRowDeletedClass();
|
||||||
|
}
|
||||||
|
if (hasError) {
|
||||||
|
ret += this.form().tableRowErrorClass();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isDeleted: function() {
|
||||||
|
if (
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex] ==
|
||||||
|
null
|
||||||
|
) {
|
||||||
|
this.setDefaultView();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex]
|
||||||
|
.deleted === true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
parentDeleted: function() {
|
||||||
|
return this.value.items[this.activeWoItemIndex].deleted === true;
|
||||||
|
},
|
||||||
|
|
||||||
|
headerList: function() {
|
||||||
|
/*
|
||||||
|
If the column is a text, left-align it
|
||||||
|
If the column is a number or number + unit, (or date) right-align it (like excel)
|
||||||
|
*/
|
||||||
|
let headers = [];
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemPartPartID")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemPartPartID"),
|
||||||
|
align: "left",
|
||||||
|
value: "partViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemPartPartWarehouseID")) {
|
||||||
|
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"),
|
||||||
|
align: "left",
|
||||||
|
value: "unitOfMeasureViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartCost")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("Cost"),
|
||||||
|
align: "right",
|
||||||
|
value: "cost"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartListPrice")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("ListPrice"),
|
||||||
|
align: "right",
|
||||||
|
value: "listPrice"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartPriceOverride")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("PriceOverride"),
|
||||||
|
align: "right",
|
||||||
|
value: "priceOverride"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartPriceViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("Price"),
|
||||||
|
align: "right",
|
||||||
|
value: "priceViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemPartTaxPartSaleID")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("Tax"),
|
||||||
|
align: "left",
|
||||||
|
value: "taxPartSaleViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartNetViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("NetPrice"),
|
||||||
|
align: "right",
|
||||||
|
value: "netViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartTaxAViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("TaxAAmt"),
|
||||||
|
align: "right",
|
||||||
|
value: "taxAViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartTaxBViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("TaxBAmt"),
|
||||||
|
align: "right",
|
||||||
|
value: "taxBViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "PartLineTotalViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("LineTotal"),
|
||||||
|
align: "right",
|
||||||
|
value: "lineTotalViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return headers;
|
||||||
|
},
|
||||||
|
itemList: function() {
|
||||||
|
return this.value.items[this.activeWoItemIndex].parts.map((x, i) => {
|
||||||
|
return {
|
||||||
|
index: i,
|
||||||
|
id: x.id,
|
||||||
|
partViz: x.partViz,
|
||||||
|
partWarehouseViz: x.partWarehouseViz,
|
||||||
|
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,
|
||||||
|
cost: window.$gz.locale.currencyLocalized(
|
||||||
|
x.cost,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
listPrice: window.$gz.locale.currencyLocalized(
|
||||||
|
x.listPrice,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
priceViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.priceViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
taxPartSaleViz: x.taxPartSaleViz,
|
||||||
|
priceOverride: window.$gz.locale.currencyLocalized(
|
||||||
|
x.priceOverride,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
netViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.netViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
taxAViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.taxAViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
taxBViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.taxBViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
lineTotalViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.lineTotalViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
formState: function() {
|
||||||
|
return this.pvm.formState;
|
||||||
|
},
|
||||||
|
formCustomTemplateKey: function() {
|
||||||
|
return this.pvm.formCustomTemplateKey;
|
||||||
|
},
|
||||||
|
showTable: function() {
|
||||||
|
return this.value.items[this.activeWoItemIndex].parts.length > 1;
|
||||||
|
},
|
||||||
|
canAdd: function() {
|
||||||
|
return this.pvm.rights.change && this.pvm.subRights.parts.create;
|
||||||
|
},
|
||||||
|
canDelete: function() {
|
||||||
|
return (
|
||||||
|
this.activeItemIndex != null &&
|
||||||
|
this.pvm.rights.change &&
|
||||||
|
this.pvm.subRights.parts.delete
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//----
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user