case 4237

This commit is contained in:
2022-11-09 23:22:54 +00:00
parent 6a997ffc48
commit 5e3a5f952b
3 changed files with 107 additions and 3 deletions

View File

@@ -1353,6 +1353,19 @@ async function clickHandler(menuItem) {
}
});
break;
case "newwo":
m.vm.$router.push({
name: "workorder-edit",
params: {
recordid: 0,
customerId: m.vm.obj.id,
add: {
type: 0
}
}
});
break;
//v.next
// case "Schedule":
// m.vm.$router.push({
@@ -1449,6 +1462,18 @@ function generateMenu(vm) {
menuOptions.menuItems.push({ divider: true, inset: false });
if (
vm.$route.params.recordid != 0 &&
window.$gz.role.canChange(window.$gz.type.WorkOrder)
) {
menuOptions.menuItems.push({
title: "NewWorkOrder",
icon: "$ayiTools",
key: FORM_KEY + ":newwo",
vm: vm
});
}
menuOptions.menuItems.push({
title: "CustomerNoteList",
icon: "$ayiClipboard",
@@ -1571,7 +1596,8 @@ async function fetchTranslatedText() {
"LastLogin",
"CustomerNoteList",
"CustomerNoteNotes",
"CustomerNoteNoteDate"
"CustomerNoteNoteDate",
"NewWorkOrder"
]);
}

View File

@@ -1207,6 +1207,19 @@ async function clickHandler(menuItem) {
}
});
break;
case "newwo":
m.vm.$router.push({
name: "workorder-edit",
params: {
recordid: 0,
customerId: m.vm.obj.customerId,
add: {
type: m.vm.$ay.ayt().WorkOrderItemUnit,
unitId: m.vm.obj.id
}
}
});
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
@@ -1293,6 +1306,18 @@ function generateMenu(vm) {
menuOptions.menuItems.push({ divider: true, inset: false });
if (
vm.$route.params.recordid != 0 &&
vm.obj.customerId != 0 &&
window.$gz.role.canChange(window.$gz.type.WorkOrder)
) {
menuOptions.menuItems.push({
title: "NewWorkOrder",
icon: "$ayiTools",
key: FORM_KEY + ":newwo",
vm: vm
});
}
menuOptions.menuItems.push({
title: "UnitModels",
icon: "$ayiDiceD20",

View File

@@ -290,8 +290,19 @@ export default {
//sometimes we're here with some data to fill in (e.g. schedule creates new wo itemscheduled user, if so there will be a add property on the params)
if (this.$route.params.add) {
//case 4237
if (this.$route.params.customerId) {
//new work order with provided customer id
this.obj.customerId = Number.parseInt(
this.$route.params.customerId
);
setDirty = true;
}
const n = this.$route.params.add;
switch (n.type) {
case this.$ay.ayt().NoType:
//this is for cases where we want to specify a Customer for example but nothing further
break;
case this.$ay.ayt().WorkOrderItemScheduledUser:
this.obj.items.push({
id: 0,
@@ -339,6 +350,46 @@ export default {
uid: Date.now() //used for error tracking / display
});
this.obj.serviceDate = n.start;
break;
case this.$ay.ayt().WorkOrderItemUnit:
this.obj.items.push({
id: 0,
concurrency: 0,
notes: "-", //todo: default here at some point or just leave this TTM
wiki: null,
customFields: "{}",
tags: [],
workOrderId: null,
techNotes: null,
workOrderItemStatusId: null,
workOrderItemPriorityId: null,
requestDate: null,
warrantyService: false,
sequence: 1, //indexes are zero based but sequences are visible to user so 1 based
isDirty: true,
expenses: [],
labors: [],
loans: [],
parts: [],
partRequests: [],
units: [
{
id: 0,
concurrency: 0,
unitId: n.unitId,
isDirty: true,
workOrderItemId: 0,
uid: Date.now()
}
],
tasks: [],
travels: [],
scheduledUsers: [],
outsideServices: [],
uid: Date.now() //used for error tracking / display
});
this.obj.serviceDate = n.start;
break;
default:
@@ -358,8 +409,10 @@ export default {
this.formState.ready = true;
//trigger rule breaking / validation
this.$nextTick(() => {
this.obj.customerId = null;
this.fieldValueChanged(`customerId`);
if (!this.$route.params.customerId) {
this.obj.customerId = null;
this.fieldValueChanged(`customerId`);
}
});
}
}