This commit is contained in:
2020-04-02 20:16:28 +00:00
parent 7780c41117
commit e44362d6ff
7 changed files with 120 additions and 101 deletions

View File

@@ -75,7 +75,7 @@ const FORM_KEY = "customize";
const API_BASE_URL = "FormCustom/";
export default {
beforeRouteLeave(to, from, next) {
//var vm = this;
//let vm = this;
if (this.formState.dirty) {
window.$gz.dialog.confirmLeaveUnsaved().then(dialogResult => {
if (dialogResult == true) {
@@ -92,7 +92,7 @@ export default {
window.$gz.eventBus.$off("menu-click", clickHandler);
},
created() {
var vm = this;
let vm = this;
initForm(vm)
.then(() => {
@@ -158,24 +158,24 @@ export default {
enableSaveButton();
},
submit() {
var vm = this;
var url = API_BASE_URL + vm.formCustomTemplateKey;
let vm = this;
let url = API_BASE_URL + vm.formCustomTemplateKey;
//clear any errors vm might be around from previous submit
window.$gz.form.deleteAllErrorBoxErrors(vm);
//Create template data object here....
//Note that server expects to see a string array of json template, not actual json
var newObj = {
let newObj = {
formKey: vm.formCustomTemplateKey,
concurrencyToken: vm.concurrencyToken,
template: "[]"
};
//temporary array to hold template for later stringification
var temp = [];
let temp = [];
//Rules:
for (var i = 0; i < vm.obj.length; i++) {
var fldItem = vm.obj[i];
for (let i = 0; i < vm.obj.length; i++) {
let fldItem = vm.obj[i];
if (fldItem.custom == false) {
//Process regular stock field
//If it's *not* set to stockRequired (i.e. built in field with biz rules that can't be hidden or changed)
@@ -252,7 +252,7 @@ function clickHandler(menuItem) {
if (!menuItem) {
return;
}
var m = window.$gz.menu.parseMenuItem(menuItem);
let m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "save":
@@ -272,7 +272,7 @@ function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
var menuOptions = {
let menuOptions = {
isMain: false,
icon: "fa-sliders-h",
title: window.$gz.translation.get("Customize"),
@@ -330,7 +330,7 @@ function initForm(vm) {
// Ensures UI translated text is available
//
function fetchTranslatedText(vm) {
var tKeysRequired = [
let tKeysRequired = [
"FormFieldEntryRequired",
"FormFieldVisible",
"UiFieldDataType",
@@ -380,7 +380,7 @@ function ensureTemplateIsInStore(vm) {
function initDataObject(vm) {
//Get all the fields *available* to this form (all the fields for the object defined in AyaFormFieldDefinitions.cs as SERVER)
//Note: this is not the actual customization data, just the list of fields that could be customized (or not if required mandatory)
var url = "FormFieldsDefinitions/" + vm.$route.params.formCustomTemplateKey;
let url = "FormFieldsDefinitions/" + vm.$route.params.formCustomTemplateKey;
return window.$gz.api.get(url).then(res => {
if (res.error) {
throw res.error;
@@ -391,12 +391,12 @@ function initDataObject(vm) {
//Iterate ObjectFields
//create a new object based on the f.a.f. item and any existing template values for that item
for (var i = 0; i < res.data.length; i++) {
for (let i = 0; i < res.data.length; i++) {
//get the formAvailableField record into an object to save typing
var faf = res.data[i];
let faf = res.data[i];
//get the customTemplate record for this field if it exists
var templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
let templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
vm.formCustomTemplateKey,
faf.fieldKey
);
@@ -410,7 +410,7 @@ function initDataObject(vm) {
};
}
var objItem = {
let objItem = {
key: faf.fieldKey,
title: window.$gz.translation.get(faf.tKey),
stockRequired: !faf.hideable,