This commit is contained in:
@@ -105,10 +105,10 @@ export default {
|
||||
/////////////////////////////////////
|
||||
// Display LT message with wait for ok
|
||||
//
|
||||
displayLTErrorMessage(ltKeyText, ltKeyTitle = undefined) {
|
||||
displayLTErrorMessage(tKeyText, tKeyTitle = undefined) {
|
||||
return VM_LOCAL.$root.$gzconfirm({
|
||||
message: ltKeyText ? window.$gz.translation.get(ltKeyText) : "",
|
||||
title: ltKeyTitle ? window.$gz.translation.get(ltKeyTitle) : "",
|
||||
message: tKeyText ? window.$gz.translation.get(tKeyText) : "",
|
||||
title: tKeyTitle ? window.$gz.translation.get(tKeyTitle) : "",
|
||||
yesButtonText: window.$gz.translation.get("OK")
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
window.$gz.store.commit("addTranslationText", item);
|
||||
}
|
||||
);
|
||||
|
||||
console.log("3");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -158,8 +158,8 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
t: function(ltkey) {
|
||||
return window.$gz.translation.get(ltkey);
|
||||
t: function(tKey) {
|
||||
return window.$gz.translation.get(tKey);
|
||||
},
|
||||
form() {
|
||||
//nothing
|
||||
|
||||
@@ -107,8 +107,8 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
t: function(ltkey) {
|
||||
return window.$gz.translation.get(ltkey);
|
||||
t: function(tKey) {
|
||||
return window.$gz.translation.get(tKey);
|
||||
},
|
||||
hasError: function() {
|
||||
return this.errors.length > 0;
|
||||
|
||||
@@ -95,8 +95,8 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
t: function(ltkey) {
|
||||
return window.$gz.translation.get(ltkey);
|
||||
t: function(tKey) {
|
||||
return window.$gz.translation.get(tKey);
|
||||
},
|
||||
addTag() {
|
||||
var theTag = this.tagSearchEntry;
|
||||
|
||||
@@ -27,11 +27,17 @@
|
||||
>
|
||||
</v-select>
|
||||
</v-col>
|
||||
template:
|
||||
{{ obj }}
|
||||
<div>WORKING ARRAY: {{ workingArray }}</div>
|
||||
|
||||
available fields:
|
||||
{{ availableFields }}
|
||||
<!-- <div>
|
||||
TEMPLATE:
|
||||
{{ obj }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
available fields:
|
||||
{{ availableFields }}
|
||||
</div> -->
|
||||
<!-- <template v-for="item in obj">
|
||||
<v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2>
|
||||
<v-card>
|
||||
@@ -136,6 +142,7 @@ export default {
|
||||
},
|
||||
availableFields: [],
|
||||
workingArray: [],
|
||||
fieldKeys: [],
|
||||
templateId: 0,
|
||||
formState: {
|
||||
ready: false,
|
||||
@@ -151,8 +158,8 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
t: function(ltkey) {
|
||||
return window.$gz.translation.get(ltkey);
|
||||
t: function(tKey) {
|
||||
return window.$gz.translation.get(tKey);
|
||||
},
|
||||
templateSelected: function() {
|
||||
if (this.formState.dirty) {
|
||||
@@ -173,7 +180,7 @@ export default {
|
||||
}
|
||||
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
|
||||
console.log("1");
|
||||
//get available fields
|
||||
window.$gz.api
|
||||
.get(API_BASE_URL + "ListFields/" + vm.templateId)
|
||||
@@ -183,8 +190,37 @@ export default {
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.availableFields = res.data;
|
||||
vm.fieldKeys = [];
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
vm.fieldKeys.push(res.data[i].tKey);
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(
|
||||
window.$gz.translation.fetch(vm.fieldKeys)
|
||||
//TODO: this is fucked and I don't know why, maybe because it's calling a new thing, not processing the existing thing?
|
||||
//way easier to just return the template with the ltkeys already processed at the server instead of this fuckery,
|
||||
//but it would be good to know what the fuck is happening,maybe it needs await and stuff like in ay-data-list-view initform example since they are all new calls
|
||||
//rather than in then which is I think there to chain the first call basically
|
||||
|
||||
//THIS MIGHT BE RELEVANT, LOOK INTO IT: https://stackoverflow.com/questions/40981040/using-a-fetch-inside-another-fetch-in-javascript
|
||||
|
||||
//get translations for field names
|
||||
|
||||
// console.log("fetchTranslatedFieldNames");
|
||||
// if (!fields) {
|
||||
// return;
|
||||
// }
|
||||
// var fieldKeys = [];
|
||||
// for (var i = 0; i < fields.length; i++) {
|
||||
// fieldKeys.push(fields[i].tKey);
|
||||
// }
|
||||
// //Now fetch all the keys and await the response before returning
|
||||
// await window.$gz.translation.fetch(fieldKeys).then(() => {
|
||||
// console.log("fetchTranslatedFieldNames:done");
|
||||
// return;
|
||||
// });
|
||||
)
|
||||
.then(
|
||||
//get current edited template
|
||||
window.$gz.api.get(API_BASE_URL + vm.templateId).then(res => {
|
||||
@@ -192,11 +228,9 @@ export default {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
console.log("4");
|
||||
vm.obj = res.data;
|
||||
|
||||
//TODO: Here need to set workingArray to a synthesis of the active template, and available fields so it reflects the current state and provides the extra fields
|
||||
//then modify form so it uses workingArray to display like custom etc. note if has rowId is required and must be included=true
|
||||
|
||||
synthesizeWorkingArray(vm);
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
@@ -373,9 +407,9 @@ function initForm(vm) {
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
function fetchTranslatedText(vm) {
|
||||
var ltKeysRequired = ["Include"];
|
||||
var tKeysRequired = ["Include"];
|
||||
|
||||
return window.$gz.translation.fetch(ltKeysRequired);
|
||||
return window.$gz.translation.fetch(tKeysRequired);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@@ -391,4 +425,75 @@ function populateSelectionLists(vm) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////
|
||||
//
|
||||
function synthesizeWorkingArray(vm) {
|
||||
vm.workingArray = [];
|
||||
if (vm.obj.template == null) {
|
||||
return;
|
||||
}
|
||||
var template = JSON.parse(vm.obj.template);
|
||||
|
||||
//first, insert the templated fields into the working array so they are in current selected order
|
||||
for (var i = 0; i < template.length; i++) {
|
||||
var templateItem = template[i];
|
||||
var afItem = window.$gz._.find(vm.availableFields, [
|
||||
"fieldKey",
|
||||
templateItem.fld
|
||||
]);
|
||||
|
||||
if (afItem != null) {
|
||||
//Push into working array
|
||||
vm.workingArray.push({
|
||||
key: afItem.fieldKey,
|
||||
required: afItem.isRowId == true,
|
||||
include: true,
|
||||
title: vm.t(afItem.tKey)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//Now iterate all the available fields and insert the ones that were not in the current template
|
||||
|
||||
for (var i = 0; i < vm.availableFields.length; i++) {
|
||||
var afItem = vm.availableFields[i];
|
||||
//skip the active column
|
||||
if (afItem.isActive == true) {
|
||||
continue;
|
||||
}
|
||||
//is this field already in the template and was added above?
|
||||
if (window.$gz._.find(template, ["fld", afItem.fieldKey]) != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Push into working array
|
||||
vm.workingArray.push({
|
||||
key: afItem.fieldKey,
|
||||
required: afItem.isRowId == true,
|
||||
include: false,
|
||||
title: vm.t(afItem.tKey)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// //////////////////////////////////////////////////////////
|
||||
// //
|
||||
// // Ensures field names are present in translation table
|
||||
// //
|
||||
// async function fetchTranslatedFieldNames(fields) {
|
||||
// console.log("fetchTranslatedFieldNames:top");
|
||||
// if (!fields) {
|
||||
// return;
|
||||
// }
|
||||
// var fieldKeys = [];
|
||||
// for (var i = 0; i < fields.length; i++) {
|
||||
// fieldKeys.push(fields[i].tKey);
|
||||
// }
|
||||
// //Now fetch all the keys and await the response before returning
|
||||
// await window.$gz.translation.fetch(fieldKeys).then(() => {
|
||||
// console.log("fetchTranslatedFieldNames:done");
|
||||
// return;
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
|
||||
@@ -263,7 +263,7 @@ function initForm(vm) {
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
function fetchTranslatedText(vm) {
|
||||
var ltKeysRequired = [
|
||||
var tKeysRequired = [
|
||||
"HelpAboutAyaNova",
|
||||
"ClientApp",
|
||||
"Server",
|
||||
@@ -287,7 +287,7 @@ function fetchTranslatedText(vm) {
|
||||
"CurrencyCode"
|
||||
];
|
||||
|
||||
return window.$gz.translation.fetch(ltKeysRequired);
|
||||
return window.$gz.translation.fetch(tKeysRequired);
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
@@ -133,8 +133,8 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
t: function(ltkey) {
|
||||
return window.$gz.translation.get(ltkey);
|
||||
t: function(tKey) {
|
||||
return window.$gz.translation.get(tKey);
|
||||
},
|
||||
visibleChanged: function(item) {
|
||||
//Note: stock items can't be changed so no need to take that into account
|
||||
@@ -330,7 +330,7 @@ function initForm(vm) {
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
function fetchTranslatedText(vm) {
|
||||
var ltKeysRequired = [
|
||||
var tKeysRequired = [
|
||||
"FormFieldEntryRequired",
|
||||
"FormFieldVisible",
|
||||
"UiFieldDataType",
|
||||
@@ -344,7 +344,7 @@ function fetchTranslatedText(vm) {
|
||||
"UiFieldDataTypesTrueFalse"
|
||||
];
|
||||
|
||||
return window.$gz.translation.fetch(ltKeysRequired);
|
||||
return window.$gz.translation.fetch(tKeysRequired);
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
|
||||
@@ -555,8 +555,8 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
t: function(ltkey) {
|
||||
return window.$gz.translation.get(ltkey);
|
||||
t: function(tKey) {
|
||||
return window.$gz.translation.get(tKey);
|
||||
},
|
||||
enumSelectionList: function(enumKey) {
|
||||
return window.$gz.enums.getSelectionList(enumKey);
|
||||
@@ -993,7 +993,7 @@ function initForm(vm) {
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
function fetchTranslatedText(vm) {
|
||||
var ltKeysRequired = [
|
||||
var tKeysRequired = [
|
||||
"DataListView",
|
||||
"GridFilterName",
|
||||
"Include",
|
||||
@@ -1040,7 +1040,7 @@ function fetchTranslatedText(vm) {
|
||||
"Name"
|
||||
];
|
||||
|
||||
return window.$gz.translation.fetch(ltKeysRequired);
|
||||
return window.$gz.translation.fetch(tKeysRequired);
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
|
||||
@@ -52,8 +52,8 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
t: function(ltkey) {
|
||||
return window.$gz.translation.get(ltkey);
|
||||
t: function(tKey) {
|
||||
return window.$gz.translation.get(tKey);
|
||||
},
|
||||
ayaType: function() {
|
||||
return window.$gz.type;
|
||||
|
||||
Reference in New Issue
Block a user