This commit is contained in:
@@ -63,6 +63,9 @@ todo: Seeding UI keep track of timing and later down the road when firmed up, pr
|
|||||||
|
|
||||||
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 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: 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: strip all *viz fields from object before sending over the wire from client to server
|
||||||
|
Setting their value to undefined stops them being sent so do that, but remember they then need to be updated on the return record
|
||||||
|
PO I'm thinking is the main one??
|
||||||
|
|
||||||
todo: custom required rules only apply to new records!!
|
todo: custom required rules only apply to new records!!
|
||||||
|
|
||||||
@@ -359,11 +362,6 @@ CURRENTLY DOING: workorder round two electric boogaloo
|
|||||||
|
|
||||||
Do these things, check each one against the list of cases here too as there is some overlap of items
|
Do these things, check each one against the list of cases here too as there is some overlap of items
|
||||||
|
|
||||||
todo: strip all *viz fields from object before sending over the wire from client to server
|
|
||||||
Setting their value to undefined stops them being sent so do that, but remember they then need to be updated on the return record
|
|
||||||
See the header save for working example, others will be easier since they set *all* fields on return unlike header which is a bastardized one
|
|
||||||
todo: why does server send isdirty to client, isn't that just a client thing?
|
|
||||||
Client can set it on initial fetch
|
|
||||||
|
|
||||||
todo: LoanUnit edit form add "*Cost" fields to UI
|
todo: LoanUnit edit form add "*Cost" fields to UI
|
||||||
todo: part request
|
todo: part request
|
||||||
|
|||||||
@@ -378,19 +378,51 @@ export default {
|
|||||||
vm.lastGetContractId = vm.obj.contractId; //preserve for triggering full update if something changes it later
|
vm.lastGetContractId = vm.obj.contractId; //preserve for triggering full update if something changes it later
|
||||||
vm.lastGetCustomerId = vm.obj.customerId; //preserve for triggering full update if something changes it later
|
vm.lastGetCustomerId = vm.obj.customerId; //preserve for triggering full update if something changes it later
|
||||||
|
|
||||||
//assign opening UID's
|
//assign opening values
|
||||||
|
vm.obj.isDirty = false;
|
||||||
vm.obj.items.forEach((z, index) => {
|
vm.obj.items.forEach((z, index) => {
|
||||||
z.uid = index;
|
z.uid = index;
|
||||||
z.expenses.forEach((x, index) => (x.uid = index));
|
z.isDirty = false;
|
||||||
z.labors.forEach((x, index) => (x.uid = index));
|
z.expenses.forEach((x, index) => {
|
||||||
z.loans.forEach((x, index) => (x.uid = index));
|
x.uid = index;
|
||||||
z.parts.forEach((x, index) => (x.uid = index));
|
x.isDirty = false;
|
||||||
z.partRequests.forEach((x, index) => (x.uid = index));
|
});
|
||||||
z.scheduledUsers.forEach((x, index) => (x.uid = index));
|
z.labors.forEach((x, index) => {
|
||||||
z.tasks.forEach((x, index) => (x.uid = index));
|
x.uid = index;
|
||||||
z.travels.forEach((x, index) => (x.uid = index));
|
x.isDirty = false;
|
||||||
z.units.forEach((x, index) => (x.uid = index));
|
});
|
||||||
z.outsideServices.forEach((x, index) => (x.uid = index));
|
z.loans.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
|
z.parts.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
|
z.partRequests.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
|
z.scheduledUsers.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
|
z.tasks.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
|
z.travels.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
|
z.units.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
|
z.outsideServices.forEach((x, index) => {
|
||||||
|
x.uid = index;
|
||||||
|
x.isDirty = false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//modify the menu as necessary
|
//modify the menu as necessary
|
||||||
@@ -415,24 +447,6 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// async submitNewContract() {
|
|
||||||
// //save new contract route, this only ever gets called from a clean wo with no dirty edits so just save the contract and reset the wo from the result
|
|
||||||
// let res = await window.$gz.api.post(
|
|
||||||
// `${API_BASE_URL}set-contract/${this.obj.id}`,
|
|
||||||
// { newContractId: this.obj.contractId }
|
|
||||||
// );
|
|
||||||
// if (res.error) {
|
|
||||||
// this.formState.serverError = res.error;
|
|
||||||
// window.$gz.form.setErrorBoxErrors(this);
|
|
||||||
// } else {
|
|
||||||
// this.obj = res.data;
|
|
||||||
// window.$gz.form.setFormState({
|
|
||||||
// vm: this,
|
|
||||||
// dirty: false,
|
|
||||||
// valid: true
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
async submit() {
|
async submit() {
|
||||||
const vm = this;
|
const vm = this;
|
||||||
if (vm.canSave == false) {
|
if (vm.canSave == false) {
|
||||||
@@ -782,8 +796,8 @@ async function saveItems(vm) {
|
|||||||
if (isPost) {
|
if (isPost) {
|
||||||
vm.obj.items[i].id = res.data.id;
|
vm.obj.items[i].id = res.data.id;
|
||||||
vm.obj.items[i].workorderId = res.data.workorderId;
|
vm.obj.items[i].workorderId = res.data.workorderId;
|
||||||
//walk all unsaved children and set the workorder id so they can save
|
|
||||||
|
|
||||||
|
//walk all unsaved children and set the workorder item id so they can save
|
||||||
vm.obj.items[i].units.forEach(
|
vm.obj.items[i].units.forEach(
|
||||||
z => (z.workorderItemId = vm.obj.items[i].id)
|
z => (z.workorderItemId = vm.obj.items[i].id)
|
||||||
);
|
);
|
||||||
@@ -919,6 +933,7 @@ async function saveUnits(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].units.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].units.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -958,6 +973,7 @@ async function saveScheduledUsers(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].scheduledUsers.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].scheduledUsers.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1027,6 +1043,7 @@ async function saveTasks(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].tasks.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].tasks.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1132,6 +1149,7 @@ async function saveParts(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].parts.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].parts.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1205,6 +1223,7 @@ async function savePartRequests(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].partRequests.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].partRequests.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1251,6 +1270,7 @@ async function saveLabors(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].labors.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].labors.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1328,6 +1348,7 @@ async function saveTravels(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].travels.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].travels.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1428,6 +1449,7 @@ async function saveExpenses(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].expenses.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].expenses.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1500,6 +1522,7 @@ async function saveLoans(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].loans.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].loans.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1580,6 +1603,7 @@ async function saveOutsideServices(vm, woItemIndex) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
|
||||||
|
res.data.isDirty = false; //prime isDirty to detect future edits
|
||||||
vm.obj.items[woItemIndex].outsideServices.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
vm.obj.items[woItemIndex].outsideServices.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user