This commit is contained in:
2021-07-20 00:22:17 +00:00
parent 7eb509911a
commit 9fa8703571
2 changed files with 47 additions and 2 deletions

View File

@@ -32,6 +32,17 @@
$ay.t("WorkOrderConvertScheduledUserToLabor")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="hasSelection && !formState.readOnly && hasMultipleItems"
@click="convertAllToLabor"
>
<v-list-item-icon>
<v-icon>$ayiHammer</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderConvertAllScheduledUsersToLabor")
}}</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>
@@ -349,6 +360,33 @@ export default {
}
},
methods: {
convertAllToLabor() {
todo:code this efficiently in conjunction with below
const s = this.value.items[this.activeWoItemIndex].scheduledUsers[
this.activeItemIndex
];
this.value.items[this.activeWoItemIndex].labors.push({
id: 0,
concurrency: 0,
userId: s.userId,
serviceStartDate: s.startDate,
serviceStopDate: s.stopDate,
serviceRateId: s.serviceRateId,
serviceDetails: null,
serviceRateQuantity: s.estimatedQuantity,
noChargeQuantity: 0,
taxCodeSaleId: null,
price: 0,
priceOverride: null,
isDirty: true,
workOrderItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now(),
userViz: s.userViz,
serviceRateViz: s.serviceRateViz,
taxCodeViz: null
});
this.$emit("change");
},
convertToLabor() {
const s = this.value.items[this.activeWoItemIndex].scheduledUsers[
this.activeItemIndex
@@ -681,6 +719,9 @@ export default {
},
canDeleteAll: function() {
return this.pvm.rights.change && !this.value.userIsRestrictedType;
},
hasMultipleItems: function() {
return this.value.items[this.activeWoItemIndex].scheduledUsers.length > 1;
}
}
};