|
|
|
|
@@ -40,6 +40,18 @@
|
|
|
|
|
>
|
|
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
|
|
|
|
<v-row>
|
|
|
|
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
|
|
|
<v-select
|
|
|
|
|
v-model="selectedDataListSortFilter"
|
|
|
|
|
:items="pickLists.availableDataListSortFilters"
|
|
|
|
|
item-text="name"
|
|
|
|
|
item-value="id"
|
|
|
|
|
:label="lt('GridFilterName')"
|
|
|
|
|
@change="filterSelected(item)"
|
|
|
|
|
></v-select>
|
|
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
|
|
|
|
</v-form>
|
|
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
|
|
|
|
@@ -52,22 +64,11 @@
|
|
|
|
|
//
|
|
|
|
|
//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 = "sortfilter";
|
|
|
|
|
const FORM_KEY = "ay-sort-filter";
|
|
|
|
|
const API_BASE_URL = "DataListSortFilter/";
|
|
|
|
|
export default {
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
|
var ltKeysRequired = [
|
|
|
|
|
"DataListSortFilter",
|
|
|
|
|
"FormFieldVisible",
|
|
|
|
|
"UiFieldDataType",
|
|
|
|
|
"UiFieldDataTypesCurrency",
|
|
|
|
|
"UiFieldDataTypesDateOnly",
|
|
|
|
|
"UiFieldDataTypesDateTime",
|
|
|
|
|
"UiFieldDataTypesNumber",
|
|
|
|
|
"UiFieldDataTypesText",
|
|
|
|
|
"UiFieldDataTypesTimeOnly",
|
|
|
|
|
"UiFieldDataTypesTrueFalse"
|
|
|
|
|
];
|
|
|
|
|
var ltKeysRequired = ["DataListSortFilter", "GridFilterName"];
|
|
|
|
|
|
|
|
|
|
window.$gz.locale.fetch(ltKeysRequired).then(next);
|
|
|
|
|
},
|
|
|
|
|
@@ -79,6 +80,8 @@ export default {
|
|
|
|
|
vv.then(() => {
|
|
|
|
|
vm.formState.ready = true;
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
debugger;
|
|
|
|
|
|
|
|
|
|
vm.formState.ready = true;
|
|
|
|
|
window.$gz.errorHandler.handleFormError(err);
|
|
|
|
|
});
|
|
|
|
|
@@ -115,17 +118,9 @@ export default {
|
|
|
|
|
dataListKey: this.$route.params.dataListKey,
|
|
|
|
|
concurrencyToken: undefined,
|
|
|
|
|
formCustomTemplateKey: this.$route.params.formCustomTemplateKey,
|
|
|
|
|
selectedDataListSortFilter: {},
|
|
|
|
|
pickLists: {
|
|
|
|
|
uiFieldDataTypes: [
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesDateTime"), id: "1" },
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesDateOnly"), id: "2" },
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesTimeOnly"), id: "3" },
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesText"), id: "4" },
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesTrueFalse"), id: "6" },
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesInteger"), id: "5" },
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesDecimal"), id: "7" },
|
|
|
|
|
{ name: this.lt("UiFieldDataTypesCurrency"), id: "8" }
|
|
|
|
|
]
|
|
|
|
|
availableDataListSortFilters: []
|
|
|
|
|
},
|
|
|
|
|
formState: {
|
|
|
|
|
ready: false,
|
|
|
|
|
@@ -137,7 +132,7 @@ export default {
|
|
|
|
|
appError: null,
|
|
|
|
|
serverError: {}
|
|
|
|
|
},
|
|
|
|
|
rights: window.$gz.role.getRights(window.$gz.type.FormCustom)
|
|
|
|
|
rights: window.$gz.role.getRights(window.$gz.type.DataListSortFilter)
|
|
|
|
|
//,tempTemplate: window.$gz.store.state.formCustomTemplate["widget"]
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
@@ -162,10 +157,11 @@ export default {
|
|
|
|
|
this.formState.dirty = true;
|
|
|
|
|
enableSaveButton();
|
|
|
|
|
},
|
|
|
|
|
dataTypeChanged: function(item) {
|
|
|
|
|
//nothing to scan here just set form dirty
|
|
|
|
|
this.formState.dirty = true;
|
|
|
|
|
enableSaveButton();
|
|
|
|
|
filterSelected: function(item) {
|
|
|
|
|
alert("STUB:FILTER SELECTED");
|
|
|
|
|
// //nothing to scan here just set form dirty
|
|
|
|
|
// this.formState.dirty = true;
|
|
|
|
|
// enableSaveButton();
|
|
|
|
|
},
|
|
|
|
|
submit() {
|
|
|
|
|
var vm = this;
|
|
|
|
|
@@ -307,19 +303,35 @@ function generateMenu(vm) {
|
|
|
|
|
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
function initForm(vm) {
|
|
|
|
|
return ensureTemplateIsInStore(vm).then(() => {
|
|
|
|
|
return populatePickLists(vm).then(() => {
|
|
|
|
|
//Must use return here
|
|
|
|
|
return initDataObject(vm);
|
|
|
|
|
});
|
|
|
|
|
// .catch(function handlePopulatePickListError(error) {
|
|
|
|
|
// debugger;
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
|
//
|
|
|
|
|
function ensureTemplateIsInStore(vm) {
|
|
|
|
|
return window.$gz.formCustomTemplate.get(
|
|
|
|
|
vm.$route.params.formCustomTemplateKey
|
|
|
|
|
);
|
|
|
|
|
function populatePickLists(vm) {
|
|
|
|
|
//http://localhost:7575/api/v8/DataListSortFilter/PickList?ListKey=TestWidgetDataList
|
|
|
|
|
return window.$gz.api
|
|
|
|
|
.get("DataListSortFilter/PickList?ListKey=" + vm.dataListKey)
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.error != undefined) {
|
|
|
|
|
window.$gz.errorHandler.handleFormError(res.error, vm);
|
|
|
|
|
} else {
|
|
|
|
|
vm.pickLists.availableDataListSortFilters = res.data;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// return window.$gz.formCustomTemplate.get(
|
|
|
|
|
// vm.$route.params.formCustomTemplateKey
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
|
@@ -327,53 +339,52 @@ function ensureTemplateIsInStore(vm) {
|
|
|
|
|
function initDataObject(vm) {
|
|
|
|
|
//http://localhost:7575/api/v8/ObjectFields/ObjectFields/widget
|
|
|
|
|
|
|
|
|
|
var url =
|
|
|
|
|
"ObjectFields/ObjectFields/" + vm.$route.params.formCustomTemplateKey;
|
|
|
|
|
var url = "FormFieldsDefinitions/" + vm.$route.params.formCustomTemplateKey;
|
|
|
|
|
return window.$gz.api.get(url).then(res => {
|
|
|
|
|
if (res.error) {
|
|
|
|
|
throw res.error;
|
|
|
|
|
}
|
|
|
|
|
if (res.error != undefined) {
|
|
|
|
|
window.$gz.errorHandler.handleFormError(res.error, vm);
|
|
|
|
|
} else {
|
|
|
|
|
//set vm.obj to the combined synthesized snapshot array of template and availble fields for working data for this form
|
|
|
|
|
// - {key, ltdisplay, hideable, custom, required, hide, type}
|
|
|
|
|
//Iterate ObjectFields
|
|
|
|
|
//create a new object based on the f.a.f. item and any existing template values for that item
|
|
|
|
|
|
|
|
|
|
//set vm.obj to the combined synthesized snapshot array of template and availble fields for working data for this form
|
|
|
|
|
// - {key, ltdisplay, hideable, custom, required, hide, type}
|
|
|
|
|
//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++) {
|
|
|
|
|
//get the formAvailableField record into an object to save typing
|
|
|
|
|
var faf = res.data[i];
|
|
|
|
|
//get the customTemplate record for this field if it exists
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
|
|
|
//get the formAvailableField record into an object to save typing
|
|
|
|
|
var faf = res.data[i];
|
|
|
|
|
//get the customTemplate record for this field if it exists
|
|
|
|
|
var templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
|
|
|
|
|
vm.formCustomTemplateKey,
|
|
|
|
|
faf.fieldKey
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
var templateItem = (templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
|
|
|
|
|
vm.formCustomTemplateKey,
|
|
|
|
|
faf.key
|
|
|
|
|
));
|
|
|
|
|
//handle non-existent template item (expected)
|
|
|
|
|
if (templateItem === undefined || templateItem === null) {
|
|
|
|
|
templateItem = {
|
|
|
|
|
required: false,
|
|
|
|
|
hide: faf.isCustomField ? true : false, //hide if custom because it's not set to display if it's not present, all others are stock fields
|
|
|
|
|
type: "text"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//handle non-existent template item (expected)
|
|
|
|
|
if (templateItem === undefined || templateItem === null) {
|
|
|
|
|
templateItem = {
|
|
|
|
|
required: false,
|
|
|
|
|
hide: faf.custom ? true : false, //hide if custom because it's not set to display if it's not present, all others are stock fields
|
|
|
|
|
type: "text"
|
|
|
|
|
// var canHide=faf.hideable && templateItem.required!==true;
|
|
|
|
|
|
|
|
|
|
var objItem = {
|
|
|
|
|
key: faf.fieldKey,
|
|
|
|
|
title: window.$gz.locale.get(faf.ltKey),
|
|
|
|
|
stockRequired: !faf.hideable,
|
|
|
|
|
custom: faf.isCustomField,
|
|
|
|
|
required: faf.hideable === false || templateItem.required === true,
|
|
|
|
|
visible: templateItem.hide !== true,
|
|
|
|
|
type: templateItem.type
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vm.obj.push(objItem);
|
|
|
|
|
vm.concurrencyToken = window.$gz.formCustomTemplate.getTemplateConcurrencyToken(
|
|
|
|
|
vm.formCustomTemplateKey
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// var canHide=faf.hideable && templateItem.required!==true;
|
|
|
|
|
|
|
|
|
|
var objItem = {
|
|
|
|
|
key: faf.key,
|
|
|
|
|
title: window.$gz.locale.get(faf.key),
|
|
|
|
|
stockRequired: !faf.hideable,
|
|
|
|
|
custom: faf.custom,
|
|
|
|
|
required: faf.hideable === false || templateItem.required === true,
|
|
|
|
|
visible: templateItem.hide !== true,
|
|
|
|
|
type: templateItem.type
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vm.obj.push(objItem);
|
|
|
|
|
vm.concurrencyToken = window.$gz.formCustomTemplate.getTemplateConcurrencyToken(
|
|
|
|
|
vm.formCustomTemplateKey
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|