This commit is contained in:
@@ -387,10 +387,7 @@ export default {
|
|||||||
FORM_KEY + ":duplicate"
|
FORM_KEY + ":duplicate"
|
||||||
);
|
);
|
||||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new");
|
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new");
|
||||||
window.$gz.eventBus.$emit(
|
|
||||||
"menu-enable-item",
|
|
||||||
FORM_KEY + ":acceptnew"
|
|
||||||
);
|
|
||||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":reject");
|
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":reject");
|
||||||
} else {
|
} else {
|
||||||
window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
@@ -398,11 +395,19 @@ export default {
|
|||||||
FORM_KEY + ":duplicate"
|
FORM_KEY + ":duplicate"
|
||||||
);
|
);
|
||||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new");
|
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new");
|
||||||
|
|
||||||
|
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":reject");
|
||||||
|
}
|
||||||
|
if (!val.dirty && val.valid) {
|
||||||
|
window.$gz.eventBus.$emit(
|
||||||
|
"menu-enable-item",
|
||||||
|
FORM_KEY + ":acceptnew"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
"menu-disable-item",
|
"menu-disable-item",
|
||||||
FORM_KEY + ":acceptnew"
|
FORM_KEY + ":acceptnew"
|
||||||
);
|
);
|
||||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":reject");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
@@ -595,28 +600,13 @@ export default {
|
|||||||
if (vm.obj.status != 0 || vm.$route.params.recordid == 0) {
|
if (vm.obj.status != 0 || vm.$route.params.recordid == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.$gz.form.setFormState({
|
//change status to rejected and save
|
||||||
vm: vm,
|
vm.obj.status = 2; //declined=2, accepted=1
|
||||||
loading: true
|
|
||||||
});
|
|
||||||
let url = API_BASE_URL + "reject/" + vm.$route.params.recordid;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
await this.submit();
|
||||||
let res = await window.$gz.api.upsert(url);
|
// navigate backwards
|
||||||
if (res.error) {
|
vm.$router.go(-1);
|
||||||
vm.formState.serverError = res.error;
|
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
|
||||||
} else {
|
|
||||||
//Navigate to record
|
|
||||||
this.$router.push({
|
|
||||||
name: "csr-edit",
|
|
||||||
params: {
|
|
||||||
recordid: res.data.id,
|
|
||||||
obj: res.data // Pass data object to new form
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -630,42 +620,113 @@ export default {
|
|||||||
//generate work order from this csr
|
//generate work order from this csr
|
||||||
//flag this csr as accepted
|
//flag this csr as accepted
|
||||||
let vm = this;
|
let vm = this;
|
||||||
if (vm.obj.status != 0 || vm.$route.params.recordid == 0) {
|
if (vm.$route.params.recordid == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: true
|
|
||||||
});
|
|
||||||
|
|
||||||
//get workorder if to existing
|
//create new workorder for this csr
|
||||||
|
//navigate to the new workorder so it can be edited and or saved
|
||||||
|
//workorder is responsible for flagging as fromcsr so that server can update the csr when it sees the wo is new and the fromcsrid is set
|
||||||
|
|
||||||
let url = `${API_BASE_URL}accept/${vm.$route.params.recordid}/${toExistingId}`;
|
let w = {
|
||||||
|
id: 0,
|
||||||
|
concurrency: 0,
|
||||||
|
serial: 0,
|
||||||
|
notes: this.obj.name,
|
||||||
|
wiki: null,
|
||||||
|
customFields: "{}",
|
||||||
|
tags: [],
|
||||||
|
customerId: this.obj.customerId,
|
||||||
|
projectId: null,
|
||||||
|
contractId: null,
|
||||||
|
internalReferenceNumber: null,
|
||||||
|
customerReferenceNumber: this.obj.customerReferenceNumber,
|
||||||
|
customerContactName: this.obj.requestedByUserViz,
|
||||||
|
fromQuoteId: null,
|
||||||
|
fromPMId: null,
|
||||||
|
fromCSRId: this.obj.id,
|
||||||
|
serviceDate: null,
|
||||||
|
completeByDate: null,
|
||||||
|
durationToCompleted: "00:00:00",
|
||||||
|
invoiceNumber: null,
|
||||||
|
onsite: true,
|
||||||
|
customerSignature: null,
|
||||||
|
customerSignatureName: null,
|
||||||
|
customerSignatureCaptured: null,
|
||||||
|
techSignature: null,
|
||||||
|
techSignatureName: null,
|
||||||
|
techSignatureCaptured: null,
|
||||||
|
postAddress: null,
|
||||||
|
postCity: null,
|
||||||
|
postRegion: null,
|
||||||
|
postCountry: null,
|
||||||
|
postCode: null,
|
||||||
|
address: null,
|
||||||
|
city: null,
|
||||||
|
region: null,
|
||||||
|
country: null,
|
||||||
|
latitude: null,
|
||||||
|
longitude: null,
|
||||||
|
items: [],
|
||||||
|
states: [],
|
||||||
|
isDirty: true,
|
||||||
|
isLockedAtServer: false,
|
||||||
|
alertViz: null
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
let wi = {
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
id: 0,
|
||||||
let res = await window.$gz.api.upsert(url);
|
concurrency: 0,
|
||||||
if (res.error) {
|
notes: this.obj.name,
|
||||||
vm.formState.serverError = res.error;
|
wiki: null,
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
customFields: "{}",
|
||||||
} else {
|
tags: [],
|
||||||
//Navigate to record
|
workOrderId: 0,
|
||||||
this.$router.push({
|
techNotes: this.obj.notes,
|
||||||
name: "csr-edit",
|
workOrderItemStatusId: null,
|
||||||
params: {
|
workOrderItemPriorityId: null,
|
||||||
recordid: res.data.id,
|
requestDate: this.obj.dateRequested,
|
||||||
obj: res.data // Pass data object to new form
|
warrantyService: false,
|
||||||
}
|
sequence: 1,
|
||||||
});
|
isDirty: true,
|
||||||
}
|
expenses: [],
|
||||||
} catch (ex) {
|
labors: [],
|
||||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
loans: [],
|
||||||
} finally {
|
parts: [],
|
||||||
window.$gz.form.setFormState({
|
partRequests: [],
|
||||||
vm: vm,
|
scheduledUsers: [],
|
||||||
loading: false
|
tasks: [],
|
||||||
|
travels: [],
|
||||||
|
units: [],
|
||||||
|
outsideServices: []
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.obj.unitId != null) {
|
||||||
|
wi.units.push({
|
||||||
|
id: 0,
|
||||||
|
concurrency: 0,
|
||||||
|
wiki: null,
|
||||||
|
customFields: "{}",
|
||||||
|
tags: [],
|
||||||
|
notes: null,
|
||||||
|
unitId: this.obj.unitId,
|
||||||
|
isDirty: true,
|
||||||
|
workOrderItemId: 0,
|
||||||
|
unitViz: null,
|
||||||
|
warrantyViz: null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w.items.push(wi);
|
||||||
|
|
||||||
|
//Navigate to new record
|
||||||
|
this.$router.push({
|
||||||
|
name: "workorder-edit",
|
||||||
|
params: {
|
||||||
|
recordid: 0,
|
||||||
|
obj: w
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//end methods
|
//end methods
|
||||||
}
|
}
|
||||||
@@ -805,24 +866,27 @@ function generateMenu(vm) {
|
|||||||
|
|
||||||
menuOptions.menuItems.push({ divider: true, inset: false });
|
menuOptions.menuItems.push({ divider: true, inset: false });
|
||||||
|
|
||||||
if (vm.obj.status == 0) {
|
if (vm.rights.change) {
|
||||||
menuOptions.menuItems.push({
|
if (vm.obj.status != 1) {
|
||||||
title: "CustomerServiceRequestAcceptToNew",
|
//if not already accepted, this allows to accept even if rejected earlier
|
||||||
icon: null,
|
menuOptions.menuItems.push({
|
||||||
key: FORM_KEY + ":acceptnew",
|
title: "CustomerServiceRequestAcceptToNew",
|
||||||
vm: vm
|
icon: null,
|
||||||
});
|
key: FORM_KEY + ":acceptnew",
|
||||||
|
vm: vm
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (vm.obj.status == 0) {
|
||||||
|
menuOptions.menuItems.push({
|
||||||
|
title: "CustomerServiceRequestReject",
|
||||||
|
icon: null,
|
||||||
|
key: FORM_KEY + ":reject",
|
||||||
|
vm: vm
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
menuOptions.menuItems.push({
|
menuOptions.menuItems.push({ divider: true, inset: false });
|
||||||
title: "CustomerServiceRequestReject",
|
|
||||||
icon: null,
|
|
||||||
key: FORM_KEY + ":reject",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
menuOptions.menuItems.push({ divider: true, inset: false });
|
|
||||||
|
|
||||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user