This commit is contained in:
2019-12-06 20:48:51 +00:00
parent 674d839cd7
commit 0859846fbf
2 changed files with 73 additions and 79 deletions

View File

@@ -45,16 +45,12 @@ CURRENT ROADMAP
CURRENT TODOs
=-=-=-=-=-=-=
TODO: Form customization
- Init of form: synthesize a single working collection array of objects in the vue data() for the session to play with not live data
- customize form should work with a *copy* of all data and only access the store to update after successful save and on init to make copy
- Format: Must be all fields in formavailable fields and also their current template value on form init
- {key, hideable, custom, required, hide, type}
{"data":{"id":100,"concurrencyToken":3793054,"name":"Rustic Wooden Table 122","serial":100,"dollarAmount":461.84000,"active":true,"roles":1024,"startDate":"2019-12-05T15:12:27.989787Z","endDate":"2019-12-05T19:42:09.458793Z","notes":"Et quasi sint repellat. Perferendis qui asperiores provident odio quia cupiditate aut velit ipsum. Vero eum est illum voluptas vel debitis sapiente cupiditate. Repellendus ut provident libero necessitatibus voluptatibus aut quia. Vitae veniam vero reprehenderit autem et nihil asperiores alias. Omnis nam nihil et harum provident qui vel aut officiis.\n\nOmnis voluptatum ut incidunt. Praesentium eos unde modi omnis iste id sunt provident repellat. Vero saepe dolorum illum officiis architecto maxime voluptatibus beatae voluptatibus. Eos nemo ipsum repellat qui alias rerum minus eum consequuntur. Consequatur dolore magni blanditiis libero tempora aut. Eum aspernatur provident.\n\nBeatae aliquam doloribus quia deleniti qui veniam voluptatem recusandae iste. Et ab omnis odit animi sed quibusdam et. Exercitationem necessitatibus autem nobis quam ea occaecati officiis reiciendis. Et id porro numquam. Adipisci perferendis error aliquam expedita voluptas velit quasi est voluptate.","count":0,"customFields":"{\"c1\":\"2019-12-05T18:44:27.6070689Z\",\"c2\":\"Sint est distinctio consectetur debitis. Ut architecto quia velit ipsum. Facere sed cupiditate fugiat harum voluptates officia rerum ut. Accusantium rerum illum nobis minima quia temporibus nulla accusamus deleniti. Et est asperiores iste qui voluptatem quo.\",\"c3\":65949398,\"c4\":true,\"c5\":0.447373016480064}","tags":["brown","black","yellow"]}}
- When go to save then synthesize the record to send back
- When go to save then synthesize the record to send back
- Update the Store on success
- Do not add any custom fields not set to be displayed, their mere presence in teh template means they are to be displayed
TODO: HELP LINKS
- Make sure each form has a unique help link and also make a stub page in the documentation for that help link to be filled in later or now if applicable
TODO: FORM CUSTOMIZATION FORM
- Customize option on every form if user is logged in with BizAdminFull rights

View File

@@ -48,27 +48,30 @@
<v-card-subtitle>
{{ item.key }}
</v-card-subtitle>
<v-checkbox
v-model="item.visible"
:label="lt('FormFieldVisible')"
:ref="item.key"
:disabled="item.stockRequired"
@change="visibleChanged(item)"
></v-checkbox>
<v-checkbox
v-model="item.required"
:label="lt('FormFieldEntryRequired')"
:disabled="item.stockRequired"
@change="requiredChanged(item)"
></v-checkbox>
<v-select
v-if="item.custom"
v-model="item.type"
:items="pickLists.formFieldDataTypes"
item-text="name"
item-value="id"
:label="lt('FormfieldDataType')"
></v-select>
<v-card-text>
<v-checkbox
v-model="item.visible"
:label="lt('FormFieldVisible')"
:ref="item.key"
:disabled="item.stockRequired"
@change="visibleChanged(item)"
></v-checkbox>
<v-checkbox
v-model="item.required"
:label="lt('FormFieldEntryRequired')"
:disabled="item.stockRequired"
@change="requiredChanged(item)"
></v-checkbox>
<v-select
v-if="item.custom"
v-model="item.type"
:items="pickLists.formFieldDataTypes"
item-text="name"
item-value="id"
:label="lt('FormfieldDataType')"
@change="dataTypeChanged(item)"
></v-select>
</v-card-text>
</v-card>
</v-col>
</template>
@@ -82,6 +85,9 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//NOTE: This is a simple form with no need for business rules or validation so stripped out any extraneous code related to all that
//
const FORM_KEY = "customize";
const API_BASE_URL = "FormCustom/";
export default {
@@ -117,6 +123,8 @@ export default {
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
//modify the menu as necessary
generateMenu(this, false); //default is never read only and passing in this vm
//init disable save button so it can be enabled only on edit to show dirty form
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
},
data() {
return {
@@ -135,61 +143,41 @@ export default {
},
formState: {
ready: false,
dirty: false,
valid: true,
readOnly: false,
loading: true,
errorBoxMessage: null,
appError: null,
serverError: {}
errorBoxMessage: null
},
rights: window.$gz.role.defaultRightsObject(),
tempTemplate: window.$gz.store.state.formCustomTemplate["widget"]
rights: window.$gz.role.getRights(window.$gz.type.FormCustom)
//,tempTemplate: window.$gz.store.state.formCustomTemplate["widget"]
};
},
//WATCHERS
watch: {
formState: {
handler: function(val) {
//,oldval is available here too if necessary
if (this.formState.loading) {
return;
}
// //WATCHERS
// watch: {
// formState: {
// handler: function(val) {
// //,oldval is available here too if necessary
// if (this.formState.loading) {
// return;
// }
//enable / disable save button
var canSave = val.dirty && val.valid && !val.readOnly;
if (canSave) {
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
} else {
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
}
//enable / disable duplicate button
var canDuplicate = !val.dirty && val.valid && !val.readOnly;
if (canDuplicate) {
window.$gz.eventBus.$emit(
"menu-enable-item",
FORM_KEY + ":duplicate"
);
} else {
window.$gz.eventBus.$emit(
"menu-disable-item",
FORM_KEY + ":duplicate"
);
}
},
deep: true
}
},
computed: {
canSave: function() {
return this.formState.valid && this.formState.dirty;
},
canDuplicate: function() {
return this.formState.valid && !this.formState.dirty;
}
},
components: {},
// //enable / disable save button
// var canSave = val.dirty && val.valid && !val.readOnly;
// if (canSave) {
// window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
// } else {
// window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
// }
// },
// deep: true
// }
// },
// computed: {
// canSave: function() {
// return this.formState.valid && this.formState.dirty;
// },
// canDuplicate: function() {
// return this.formState.valid && !this.formState.dirty;
// }
// },
// components: {},
methods: {
lt: function(ltkey) {
return window.$gz.locale.get(ltkey);
@@ -199,16 +187,26 @@ export default {
if (item.required && item.visible == false) {
item.required = false;
}
enableSaveButton();
},
requiredChanged: function(item) {
//Note: stock items can't be changed so no need to take that into account
if (item.required && item.visible == false) {
item.visible = true;
}
enableSaveButton();
},
dataTypeChanged: function(item) {
//nothing to scan here just set form dirty
enableSaveButton();
}
}
};
function enableSaveButton() {
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
}
//////////////////////
//
//