This commit is contained in:
2021-04-09 19:09:39 +00:00
parent 46e09644eb
commit 063c9bd205
2 changed files with 44 additions and 83 deletions

View File

@@ -97,6 +97,10 @@ import GzWoItemScheduledUsers from "../components/work-order-item-scheduled-user
/*
todo: stop using parent vm directly to control state in graph and instead pass down values via props to children and pass up values to parent via events
https://www.smashingmagazine.com/2020/01/data-components-vue-js/
todo: on init:
//If there is a single woitem then select it otherwise keep it clean and empty by not selecting thus not showing
//edit form as per design
todo: can I turn control labels into hyperlinks for getting to feeder records? If not then need to find a way to accomplish it
e.g. can workorder status title be changed to a hyper link to status list

View File

@@ -90,16 +90,6 @@ export default {
dirty: false,
valid: true
});
//If there is a single woitem then select it otherwise keep it clean and empty by not selecting thus not showing
//edit form as per design
if (vm.obj.items.length > 0) {
if (vm.obj.items.length == 1) {
vm.selectedItemIndex = 0;
}
} else {
vm.selectedItemIndex = null;
}
} catch (error) {
window.$gz.errorHandler.handleFormError(error, vm);
} finally {
@@ -123,64 +113,46 @@ export default {
data() {
return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
obj:
//IMPORTANT NOTE: Fields that are NON NULLABLE in the schema for the table but *are* hideable **MUST** have a default value set here or else there will be no way to save the record
//I.E. Serial, usertype fields, ACTIVE
//Also, if it's a non-nullable Enum backed field then it should have a valid selection i.e. not zero if there is no zero
// {
// id: 0,
// concurrency: 0,
// name: null,
// active: true,
// notes: null,
// wiki: null,
// customFields: "{}",
// tags: [],
// dateStarted: window.$gz.locale.nowUTC8601String(),
// dateCompleted: null,
// workorderOverseerId: null,
// accountNumber: null
// }
{
data: {
id: 0,
concurrency: 0,
serial: null,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
customerId: null,
projectId: null,
internalReferenceNumber: null,
customerReferenceNumber: null,
customerContactName: null,
fromQuoteId: null,
fromPMId: null,
fromCSRId: null,
serviceDate: null,
completeByDate: null,
invoiceNumber: null,
customerSignature: null,
customerSignatureName: null,
customerSignatureCaptured: 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: false,
isLockedAtServer: false
}
},
obj: {
data: {
id: 0,
concurrency: 0,
serial: null,
notes: null,
wiki: null,
customFields: "{}",
tags: [],
customerId: null,
projectId: null,
internalReferenceNumber: null,
customerReferenceNumber: null,
customerContactName: null,
fromQuoteId: null,
fromPMId: null,
fromCSRId: null,
serviceDate: null,
completeByDate: null,
invoiceNumber: null,
customerSignature: null,
customerSignatureName: null,
customerSignatureCaptured: 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: false,
isLockedAtServer: false
}
},
formState: {
ready: false,
dirty: false,
@@ -314,21 +286,6 @@ export default {
}
},
computed: {
hasSelectedScheduledUserItem: function() {
if (
this.hasSelectedWoItem &&
this.selectedScheduledUserItemIndex != null
) {
return true;
}
return false;
},
scheduledUserItemCount: function() {
if (!this.obj.items || !this.hasSelectedWoItem) {
return 0;
}
return this.obj.items[this.selectedItemIndex].scheduledUsers.length;
},
currentState() {
//return actual status object from top level shell based on current state
//if state is unknown then it should return a placeholder dummy state showing an error condition or empty I guess