This commit is contained in:
2021-06-30 19:55:11 +00:00
parent d31750be19
commit a5d443eade
3 changed files with 122 additions and 48 deletions

View File

@@ -103,6 +103,9 @@ todo: grid position not preserved when open a record then track back
i.e. go to last record in a multipage list, open something, go back and will see it's back to the start of the list losing the user's scroll position
this is very important that it work correctly
todo: purchase order form should work more like workorder form, it's a but fucky YAGNI??
Joyce has a case, technically it works but see what Joyce wrote
todo: custom required rules only apply to new records!!
todo: inventory and other lists shows LT: because namefetcher postgres function returns it when it's not a named item
@@ -1298,6 +1301,7 @@ Build 111
- User / Custom contact on create / duplicate now allows entry of new user options before first User save rather than previous behaviour of having to save new record first then edit and save user options
- Customer user login now always shows in App notifications (Bell icon and list when clicked on) regardless of whether they can subscribe to any notifications (global settings) to allow for viewing direct notifications sent to them
(previously it was not shown if they had no available notification types allowed to subscribe)
- Prevent double booking a tech case 3720 customer request
global setting "Allow schedule conflicts" and if on will check if same tech is booked already within that time frame on update or new scheduled user record

View File

@@ -232,6 +232,7 @@
<v-data-table
:headers="headerList"
:items="itemList"
item-key="index"
class="elevation-1"
disable-pagination
disable-filtering
@@ -842,31 +843,90 @@ export default {
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
// //id 0 means create or duplicate to new
// if (vm.$route.params.recordid != 0) {
// //is there already an obj from a prior operation?
// if (this.$route.params.obj) {
// //yes, no need to fetch it
// this.obj = this.$route.params.obj;
// window.$gz.form.setFormState({
// vm: vm,
// loading: false
// });
// } else {
// await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
// }
// } else {
// window.$gz.form.setFormState({
// vm: vm,
// loading: false
// });
// }
// window.$gz.form.setFormState({
// vm: vm,
// dirty: false,
// valid: true
// });
//---------------------------------
let setDirty = false;
let setValid = true;
//id 0 means create or duplicate to new
if (vm.$route.params.recordid != 0) {
//is there already an obj from a prior operation?
if (this.$route.params.obj) {
//yes, no need to fetch it
this.obj = this.$route.params.obj;
window.$gz.form.setFormState({
vm: vm,
loading: false
});
} else {
await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading
}
} else {
window.$gz.form.setFormState({
vm: vm,
loading: false
});
//Might be a duplicate and contain another record
if (this.$route.params.obj) {
this.obj = this.$route.params.obj;
this.obj.concurrency = undefined;
this.obj.id = 0;
this.obj.serial = 0;
/*
CopyObject.Copy(dbObject, newObject, "Wiki,Serial");
newObject.Id = 0;
newObject.Concurrency = 0;
newObject.Status = PurchaseOrderStatus.OpenNotYetOrdered;
foreach (var item in newObject.Items)
{
item.Id = 0;
item.Concurrency = 0;
item.QuantityReceived = 0;
item.ReceivedCost = 0;
item.ReceivedDate = null;
item.PurchaseOrderId = 0;
item.WorkorderItemPartRequestId = null;
item.PartRequestedById = null;
}
*/
vm.obj.status = 1; // OpenNotYetOrdered = 1,
vm.obj.items.forEach(z => {
z.id = 0;
z.concurrency = undefined;
z.quantityReceived = 0;
z.receivedCost = 0;
z.receivedDate = null;
z.purchaseOrderId = 0;
z.workorderItemPartRequestId = null;
z.partRequestedById = null;
});
setDirty = true;
}
}
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true
loading: false,
dirty: setDirty,
valid: setValid
});
//----------------------------
generateMenu(vm);
} catch (error) {
window.$gz.errorHandler.handleFormError(error, vm);
@@ -1550,42 +1610,53 @@ export default {
window.$gz.errorHandler.handleFormError(error, vm);
}
},
async duplicate() {
let vm = this;
if (!vm.canDuplicate || vm.$route.params.recordid == 0) {
return;
}
window.$gz.form.setFormState({
vm: vm,
loading: true
});
let url = API_BASE_URL + "duplicate/" + vm.$route.params.recordid;
try {
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.upsert(url);
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
//Navigate to new record
this.$router.push({
name: "inv-purchase-order",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
}
});
duplicate() {
//Navigate to new record
this.$router.push({
name: "inv-purchase-order",
params: {
recordid: 0,
obj: this.obj
}
} catch (ex) {
window.$gz.errorHandler.handleFormError(ex, vm);
} finally {
window.$gz.form.setFormState({
vm: vm,
loading: false
});
}
});
}
// ,
// async duplicate() {
// let vm = this;
// if (!vm.canDuplicate || vm.$route.params.recordid == 0) {
// return;
// }
// window.$gz.form.setFormState({
// vm: vm,
// loading: true
// });
// let url = API_BASE_URL + "duplicate/" + vm.$route.params.recordid;
// try {
// window.$gz.form.deleteAllErrorBoxErrors(vm);
// let res = await window.$gz.api.upsert(url);
// if (res.error) {
// vm.formState.serverError = res.error;
// window.$gz.form.setErrorBoxErrors(vm);
// } else {
// //Navigate to new record
// this.$router.push({
// name: "inv-purchase-order",
// params: {
// recordid: res.data.id,
// obj: res.data // Pass data object to new form
// }
// });
// }
// } catch (ex) {
// window.$gz.errorHandler.handleFormError(ex, vm);
// } finally {
// window.$gz.form.setFormState({
// vm: vm,
// loading: false
// });
// }
// }
//end methods
}
};

View File

@@ -195,10 +195,9 @@ export default {
vm.rights = window.$gz.role.getRights(window.$gz.type.Project);
vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
//---------------------------------
let setDirty = false;
let setValid = true;
//id 0 means create or duplicate to new
if (vm.$route.params.recordid != 0) {
//is there already an obj from a prior operation?
@@ -220,13 +219,13 @@ export default {
setDirty = true;
}
}
window.$gz.form.setFormState({
vm: vm,
loading: false,
dirty: setDirty,
valid: setValid
});
//----------------------------
generateMenu(vm);
} catch (error) {
window.$gz.errorHandler.handleFormError(error, vm);