This commit is contained in:
@@ -55,6 +55,9 @@ todo: workorders - need to set billing and service address from customers on mig
|
|||||||
|
|
||||||
## CLIENT MISC ITEMS
|
## CLIENT MISC ITEMS
|
||||||
|
|
||||||
|
todo: need to track fetched keys vs used keys so can tell if fetched a key that I don't need or stopped using due to code change
|
||||||
|
todo: need to track fetched keys that don't exists, should bomb immediately so I can remove them, they will eat up traffic for no useful purpose!!
|
||||||
|
|
||||||
todo: custom required rules only apply to new records!!
|
todo: custom required rules only apply to new records!!
|
||||||
|
|
||||||
todo: notification subscription tags UI
|
todo: notification subscription tags UI
|
||||||
@@ -339,7 +342,7 @@ todo: many biz objects are not using new PUT methodology
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
CURRENTLY DOING: WorkOrderItemTravel
|
CURRENTLY DOING: WorkOrderItemTravel
|
||||||
|
|
||||||
ORDER: Travel, tasks, parts, loans, units, outside service
|
ORDER: Travel, tasks, parts, loans, units, outside service
|
||||||
|
|
||||||
|
|||||||
827
ayanova/src/components/work-order-item-travels.vue
Normal file
827
ayanova/src/components/work-order-item-travels.vue
Normal file
@@ -0,0 +1,827 @@
|
|||||||
|
<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">$ayiHammer</v-icon>
|
||||||
|
{{ $ay.t("WorkOrderItemTravelList") }}
|
||||||
|
<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="travelsTable"
|
||||||
|
dense
|
||||||
|
:item-class="itemRowClasses"
|
||||||
|
@click:row="handleRowClick"
|
||||||
|
:show-select="$vuetify.breakpoint.xs"
|
||||||
|
single-select
|
||||||
|
>
|
||||||
|
<template v-slot:[`item.taxOnTax`]="{ item }">
|
||||||
|
<v-simple-checkbox
|
||||||
|
v-model="item.taxOnTax"
|
||||||
|
disabled
|
||||||
|
></v-simple-checkbox>
|
||||||
|
</template>
|
||||||
|
</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, 'WorkOrderItemTravelStartDate')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-date-time-picker
|
||||||
|
:label="$ay.t('WorkOrderItemTravelStartDate')"
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex]
|
||||||
|
.travelStartDate
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStartDate`
|
||||||
|
"
|
||||||
|
data-cy="travelStartDate"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStartDate`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStartDate`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
></gz-date-time-picker>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemTravelStopDate')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-date-time-picker
|
||||||
|
:label="$ay.t('WorkOrderItemTravelStopDate')"
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex]
|
||||||
|
.travelStopDate
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStopDate`
|
||||||
|
"
|
||||||
|
data-cy="travelStopDate"
|
||||||
|
:rules="[
|
||||||
|
form().datePrecedence(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStartDate`,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStopDate`
|
||||||
|
)
|
||||||
|
]"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStopDate`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelStopDate`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
></gz-date-time-picker>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemTravelTravelRateQuantity')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-decimal
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex]
|
||||||
|
.travelRateQuantity
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemTravelTravelRateQuantity')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelRateQuantity`
|
||||||
|
"
|
||||||
|
data-cy="travelTravelRateQuantity"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelRateQuantity`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:rules="[
|
||||||
|
form().decimalValid(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelRateQuantity`
|
||||||
|
),
|
||||||
|
form().required(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelRateQuantity`
|
||||||
|
)
|
||||||
|
]"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].travels[
|
||||||
|
${activeItemIndex}
|
||||||
|
].travelRateQuantity`)
|
||||||
|
"
|
||||||
|
></gz-decimal>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemTravelTravelRateID')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-pick-list
|
||||||
|
:aya-type="$ay.ayt().TravelRate"
|
||||||
|
:variant="'contractid:' + value.contractId"
|
||||||
|
:show-edit-icon="true"
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex]
|
||||||
|
.travelRateId
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemTravelTravelRateID')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelRateId`
|
||||||
|
"
|
||||||
|
data-cy="travels.travelRateId"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelRateId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].travelRateId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:name="rateChange"
|
||||||
|
></gz-pick-list>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemTravelUserID')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-pick-list
|
||||||
|
:aya-type="$ay.ayt().User"
|
||||||
|
variant="tech"
|
||||||
|
:show-edit-icon="true"
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex].userId
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemTravelUserID')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].userId`
|
||||||
|
"
|
||||||
|
data-cy="travels.userid"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].userId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].userId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:name="userChange"
|
||||||
|
></gz-pick-list>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemTravelNoChargeQuantity')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-decimal
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex]
|
||||||
|
.noChargeQuantity
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemTravelNoChargeQuantity')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].noChargeQuantity`
|
||||||
|
"
|
||||||
|
data-cy="travelNoChargeQuantity"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].noChargeQuantity`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:rules="[
|
||||||
|
form().decimalValid(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].noChargeQuantity`
|
||||||
|
),
|
||||||
|
form().required(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].noChargeQuantity`
|
||||||
|
)
|
||||||
|
]"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].travels[
|
||||||
|
${activeItemIndex}
|
||||||
|
].noChargeQuantity`)
|
||||||
|
"
|
||||||
|
></gz-decimal>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemTravelTaxRateSaleID')"
|
||||||
|
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].travels[activeItemIndex]
|
||||||
|
.taxCodeSaleId
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemTravelTaxRateSaleID')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].taxCodeSaleId`
|
||||||
|
"
|
||||||
|
data-cy="travelTaxCodeSaleId"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].taxCodeSaleId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].taxCodeSaleId`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:name="taxCodeChange"
|
||||||
|
></gz-pick-list>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'TravelPriceOverride')"
|
||||||
|
cols="12"
|
||||||
|
sm="6"
|
||||||
|
lg="4"
|
||||||
|
xl="3"
|
||||||
|
>
|
||||||
|
<gz-currency
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex]
|
||||||
|
.priceOverride
|
||||||
|
"
|
||||||
|
can-clear
|
||||||
|
:readonly="formState.readOnly || isDeleted"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('PriceOverride')"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].priceOverride`
|
||||||
|
"
|
||||||
|
data-cy="travelpriceoverride"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].priceOverride`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:rules="[
|
||||||
|
form().decimalValid(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[${activeItemIndex}].priceOverride`
|
||||||
|
)
|
||||||
|
]"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].travels[
|
||||||
|
${activeItemIndex}
|
||||||
|
].priceOverride`)
|
||||||
|
"
|
||||||
|
></gz-currency>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
v-if="form().showMe(this, 'WorkOrderItemTravelDetails')"
|
||||||
|
cols="12"
|
||||||
|
>
|
||||||
|
<v-textarea
|
||||||
|
v-model="
|
||||||
|
value.items[activeWoItemIndex].travels[activeItemIndex]
|
||||||
|
.travelDetails
|
||||||
|
"
|
||||||
|
:readonly="formState.readOnly"
|
||||||
|
:disabled="isDeleted"
|
||||||
|
:label="$ay.t('WorkOrderItemTravelDetails')"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${activeWoItemIndex}].travels[
|
||||||
|
${activeItemIndex}
|
||||||
|
].travelDetails`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:ref="
|
||||||
|
`Items[${activeWoItemIndex}].travels[
|
||||||
|
${activeItemIndex}
|
||||||
|
].travelDetails`
|
||||||
|
"
|
||||||
|
data-cy="traveltravelDetails"
|
||||||
|
@input="
|
||||||
|
fieldValueChanged(`Items[${activeWoItemIndex}].travels[
|
||||||
|
${activeItemIndex}
|
||||||
|
].travelDetails`)
|
||||||
|
"
|
||||||
|
auto-grow
|
||||||
|
></v-textarea>
|
||||||
|
</v-col>
|
||||||
|
</template>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/* XXXeslint-disable */
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
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: {
|
||||||
|
userChange(newName) {
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].userViz = newName;
|
||||||
|
},
|
||||||
|
rateChange(newName) {
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelRateViz = newName;
|
||||||
|
},
|
||||||
|
taxCodeChange(newName) {
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].taxCodeSaleViz = newName;
|
||||||
|
},
|
||||||
|
newItem() {
|
||||||
|
let newIndex = this.value.items[this.activeWoItemIndex].travels.length;
|
||||||
|
|
||||||
|
this.value.items[this.activeWoItemIndex].travels.push({
|
||||||
|
id: 0,
|
||||||
|
concurrency: 0,
|
||||||
|
userId: null,
|
||||||
|
//userViz: null,
|
||||||
|
travelStartDate: window.$gz.locale.nowUTC8601String(),
|
||||||
|
travelStopDate: window.$gz.locale.nowUTC8601String(), //TODO:sb now plus one hour to match v7
|
||||||
|
travelRateId: null,
|
||||||
|
travelDetails: null,
|
||||||
|
travelRateQuantity: 1,
|
||||||
|
noChargeQuantity: 0,
|
||||||
|
serviceBankId: null,
|
||||||
|
taxCodeSaleId: null,
|
||||||
|
taxName: null,
|
||||||
|
price: 0,
|
||||||
|
priceOverride: null,
|
||||||
|
//costViz: 0,
|
||||||
|
// listPriceViz: 0,
|
||||||
|
//taxAViz: 0,
|
||||||
|
//taxBViz: 0,
|
||||||
|
//lineTotalViz: 0,
|
||||||
|
//unitOfMeasureViz:null,
|
||||||
|
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].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].deleted = false;
|
||||||
|
this.setDefaultView();
|
||||||
|
},
|
||||||
|
deleteItem() {
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
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].travels.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].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].isDirty = true;
|
||||||
|
window.$gz.form.fieldValueChanged(this.pvm, ref);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemRowClasses: function(item) {
|
||||||
|
let ret = "";
|
||||||
|
const isDeleted =
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[item.index].deleted ===
|
||||||
|
true;
|
||||||
|
|
||||||
|
const hasError = this.form().childRowHasError(
|
||||||
|
this,
|
||||||
|
`Items[${this.activeWoItemIndex}].Travels[${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].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
] == null
|
||||||
|
) {
|
||||||
|
this.setDefaultView();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[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, "WorkOrderItemTravelStartDate")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemTravelStartDate"),
|
||||||
|
align: "right",
|
||||||
|
value: "travelStartDate"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemTravelStopDate")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemTravelStopDate"),
|
||||||
|
align: "right",
|
||||||
|
value: "travelStopDate"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemTravelTravelRateQuantity")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemTravelTravelRateQuantity"),
|
||||||
|
align: "right",
|
||||||
|
value: "travelRateQuantity"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemTravelTravelRateID")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemTravelTravelRateID"),
|
||||||
|
align: "left",
|
||||||
|
value: "travelRateViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemTravelDetails")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemTravelDetails"),
|
||||||
|
align: "left",
|
||||||
|
value: "travelDetails"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemTravelUserID")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemTravelUserID"),
|
||||||
|
align: "left",
|
||||||
|
value: "userViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemTravelNoChargeQuantity")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("WorkOrderItemTravelNoChargeQuantity"),
|
||||||
|
align: "right",
|
||||||
|
value: "noChargeQuantity"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelUnitOfMeasureViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("UnitOfMeasure"),
|
||||||
|
align: "left",
|
||||||
|
value: "unitOfMeasureViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelCostViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("Cost"),
|
||||||
|
align: "right",
|
||||||
|
value: "costViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelListPriceViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("ListPrice"),
|
||||||
|
align: "right",
|
||||||
|
value: "listPriceViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelPriceViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("PriceOverride"),
|
||||||
|
align: "right",
|
||||||
|
value: "priceOverride"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelPriceViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("Price"),
|
||||||
|
align: "right",
|
||||||
|
value: "priceViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "WorkOrderItemTravelTaxRateSaleID")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("Tax"),
|
||||||
|
align: "left",
|
||||||
|
value: "taxCodeSaleViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelNetViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("NetPrice"),
|
||||||
|
align: "right",
|
||||||
|
value: "netViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelTaxAViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("TaxAAmt"),
|
||||||
|
align: "right",
|
||||||
|
value: "taxAViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelTaxBViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("TaxBAmt"),
|
||||||
|
align: "right",
|
||||||
|
value: "taxBViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.form().showMe(this, "TravelLineTotalViz")) {
|
||||||
|
headers.push({
|
||||||
|
text: this.$ay.t("LineTotal"),
|
||||||
|
align: "right",
|
||||||
|
value: "lineTotalViz"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return headers;
|
||||||
|
},
|
||||||
|
itemList: function() {
|
||||||
|
return this.value.items[this.activeWoItemIndex].travels.map((x, i) => {
|
||||||
|
return {
|
||||||
|
index: i,
|
||||||
|
id: x.id,
|
||||||
|
travelStartDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||||
|
x.travelStartDate,
|
||||||
|
this.pvm.timeZoneName,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.hour12
|
||||||
|
),
|
||||||
|
travelStopDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||||
|
x.travelStopDate,
|
||||||
|
this.pvm.timeZoneName,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.hour12
|
||||||
|
),
|
||||||
|
|
||||||
|
travelRateQuantity: window.$gz.locale.decimalLocalized(
|
||||||
|
x.travelRateQuantity,
|
||||||
|
this.pvm.languageName
|
||||||
|
),
|
||||||
|
travelRateViz: x.travelRateViz,
|
||||||
|
userViz: x.userViz,
|
||||||
|
noChargeQuantity: window.$gz.locale.decimalLocalized(
|
||||||
|
x.noChargeQuantity,
|
||||||
|
this.pvm.languageName
|
||||||
|
),
|
||||||
|
unitOfMeasureViz: x.unitOfMeasureViz,
|
||||||
|
costViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.costViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
listPriceViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.listPriceViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
priceViz: window.$gz.locale.currencyLocalized(
|
||||||
|
x.priceViz,
|
||||||
|
this.pvm.languageName,
|
||||||
|
this.pvm.currencyName
|
||||||
|
),
|
||||||
|
taxCodeSaleViz: x.taxCodeSaleViz,
|
||||||
|
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
|
||||||
|
),
|
||||||
|
travelDetails: window.$gz.util.truncateString(x.travelDetails, 50)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
formState: function() {
|
||||||
|
return this.pvm.formState;
|
||||||
|
},
|
||||||
|
formCustomTemplateKey: function() {
|
||||||
|
return this.pvm.formCustomTemplateKey;
|
||||||
|
},
|
||||||
|
showTable: function() {
|
||||||
|
return this.value.items[this.activeWoItemIndex].travels.length > 1;
|
||||||
|
},
|
||||||
|
canAdd: function() {
|
||||||
|
return this.pvm.rights.change && this.pvm.subRights.travels.create;
|
||||||
|
},
|
||||||
|
canDelete: function() {
|
||||||
|
return (
|
||||||
|
this.activeItemIndex != null &&
|
||||||
|
this.pvm.rights.change &&
|
||||||
|
this.pvm.subRights.travels.delete
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//----
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -381,6 +381,19 @@
|
|||||||
@change="$emit('change')"
|
@change="$emit('change')"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
<v-col cols="12">
|
||||||
|
<GzWoItemTravels
|
||||||
|
v-if="
|
||||||
|
pvm.subRights.travels.visible &&
|
||||||
|
form().showMe(this, 'WorkOrderItemTravelList')
|
||||||
|
"
|
||||||
|
v-model="value"
|
||||||
|
:pvm="pvm"
|
||||||
|
:active-wo-item-index="activeItemIndex"
|
||||||
|
data-cy="woItemTravels"
|
||||||
|
@change="$emit('change')"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<GzWoItemExpenses
|
<GzWoItemExpenses
|
||||||
v-if="
|
v-if="
|
||||||
@@ -404,13 +417,15 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
import GzWoItemScheduledUsers from "../components/work-order-item-scheduled-users.vue";
|
import GzWoItemScheduledUsers from "../components/work-order-item-scheduled-users.vue";
|
||||||
import GzWoItemLabors from "../components/work-order-item-labors.vue";
|
import GzWoItemLabors from "../components/work-order-item-labors.vue";
|
||||||
|
import GzWoItemTravels from "../components/work-order-item-travels.vue";
|
||||||
import GzWoItemExpenses from "../components/work-order-item-expenses.vue";
|
import GzWoItemExpenses from "../components/work-order-item-expenses.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
GzWoItemScheduledUsers,
|
GzWoItemScheduledUsers,
|
||||||
GzWoItemExpenses,
|
GzWoItemExpenses,
|
||||||
GzWoItemLabors
|
GzWoItemLabors,
|
||||||
|
GzWoItemTravels
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.setDefaultView();
|
this.setDefaultView();
|
||||||
|
|||||||
@@ -1378,10 +1378,18 @@ async function fetchTranslatedText(vm) {
|
|||||||
"WorkOrderItemLaborUserID",
|
"WorkOrderItemLaborUserID",
|
||||||
"WorkOrderItemLaborNoChargeQuantity",
|
"WorkOrderItemLaborNoChargeQuantity",
|
||||||
"WorkOrderItemLaborTaxRateSaleID",
|
"WorkOrderItemLaborTaxRateSaleID",
|
||||||
"WorkOrderItemLaborManualDiscountPct",
|
|
||||||
"WorkOrderItemLaborBasePrice",
|
|
||||||
"WorkOrderItemLaborPrice",
|
"WorkOrderItemLaborPrice",
|
||||||
"WorkOrderItemLaborServiceStartDate",
|
"WorkOrderItemTravelList",
|
||||||
|
"WorkOrderItemTravelStartDate",
|
||||||
|
"WorkOrderItemTravelStopDate",
|
||||||
|
"WorkOrderItemTravelRateQuantity",
|
||||||
|
"WorkOrderItemTravelRateID",
|
||||||
|
"WorkOrderItemTravelDetails",
|
||||||
|
"WorkOrderItemTravelUserID",
|
||||||
|
"WorkOrderItemTravelNoChargeQuantity",
|
||||||
|
"WorkOrderItemTravelTaxRateSaleID",
|
||||||
|
"WorkOrderItemTravelPrice",
|
||||||
|
|
||||||
"SaveRecordToProceed",
|
"SaveRecordToProceed",
|
||||||
"Cost",
|
"Cost",
|
||||||
"ListPrice",
|
"ListPrice",
|
||||||
|
|||||||
Reference in New Issue
Block a user