This commit is contained in:
2020-07-20 21:31:24 +00:00
parent 89b9107682
commit 8b8bdc4880
2 changed files with 109 additions and 47 deletions

View File

@@ -2,6 +2,7 @@
<div>
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
{{ obj }}
<v-list three-line>
<v-list-item> </v-list-item>
</v-list>
@@ -30,6 +31,10 @@ export default {
},
data() {
return {
selectLists: {
eventTypes: {},
ayaTypes: {}
},
obj: [],
formState: {
ready: false,
@@ -66,7 +71,41 @@ export default {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
vm.obj = res.data;
//pre-make the display list object
//source object:
//[ { "id": 1, "concurrency": 18835104, "userId": 1, "created": "2020-07-20T19:35:49.665888Z", "ayaType": 2,
// "objectId": 101, "eventType": 2, "notifySubscriptionId": 1, "message": null, "fetched": true } ]
//display object:
//{event:"",objectname:"",objecttype:null,icon:null,eventdate:null,openurl:null,suburl:null,eventid}
let temp = res.data;
let timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
let languageName = window.$gz.locale.getBrowserLanguages();
let hour12 = window.$gz.store.state.locale.hour12;
for (let i = 0; i < temp.length; i++) {
temp[
i
].uicreated = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
temp[i].created,
timeZoneName,
languageName,
hour12
);
temp[i]["uievent"] = vm.selectLists.eventTypes.find(
z => z.id == temp[i].eventType
).name;
temp[i]["uiayatype"] = vm.selectLists.ayaTypes.find(
z => z.id == temp[i].ayaType
).name;
temp[i].icon = window.$gz.util.iconForType(temp[i].ayaType);
}
vm.obj = [...temp];
//modify the menu as necessary
generateMenu(vm);
//Update the form status
@@ -168,51 +207,74 @@ function generateMenu(vm) {
//
//
async function initForm(vm) {
//await fetchTranslatedText(vm);
//await populateSelectionLists(vm);
await fetchTranslatedText(vm);
// await populateAyaTypeList(vm);
await populateSelectionLists(vm);
}
// //////////////////////////////////////////////////////////
// //
// // Ensures UI translated text is available
// //
// async function fetchTranslatedText(vm) {
// await window.$gz.translation.cacheTranslations([
// "Widget",
// "WidgetName",
// "WidgetSerial",
// "WidgetDollarAmount",
// "WidgetCount",
// "User",
// "UserType",
// "WidgetStartDate",
// "WidgetEndDate",
// "WidgetNotes",
// "WidgetCustom1",
// "WidgetCustom2",
// "WidgetCustom3",
// "WidgetCustom4",
// "WidgetCustom5",
// "WidgetCustom6",
// "WidgetCustom7",
// "WidgetCustom8",
// "WidgetCustom9",
// "WidgetCustom10",
// "WidgetCustom11",
// "WidgetCustom12",
// "WidgetCustom13",
// "WidgetCustom14",
// "WidgetCustom15",
// "WidgetCustom16"
// ]);
// }
//////////////////////////////////////////////////////////
//
// Ensures UI translated text is available
//
async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([
// "NotifyDeliveryMethod",
// "NotifyEventType",
// "NotifyDeliveryAddress",
// "InTags",
// "NotifyEventObjectDeleted",
// "NotifyEventObjectCreated",
// "NotifyEventObjectModified",
// "NotifyEventWorkorderStatusChange",
// "NotifyEventContractExpiring",
// "NotifyEventCSRAccepted",
// "NotifyEventCSRRejected",
// "NotifyEventWorkorderClosed",
// "NotifyEventQuoteStatusChange",
// "NotifyEventQuoteStatusAge",
// "NotifyEventServiceBankDepleted",
// "NotifyEventReminderImminent",
// "NotifyEventScheduledOnWorkorder",
// "NotifyEventScheduledOnWorkorderImminent",
// "NotifyEventWorkorderCloseByPassed",
// "NotifyEventOutsideServiceOverdue",
// "NotifyEventOutsideServiceReceived",
// "NotifyEventPartRequestReceived",
// "NotifyEventNotifyHealthCheck",
// "NotifyEventBackupStatus",
// "NotifyEventCustomerServiceImminent",
// "NotifyEventPartRequested",
// "NotifyEventWorkorderTotalExceedsThreshold",
// "NotifyEventWorkorderStatusAge",
// "NotifyEventUnitWarrantyExpiry",
// "NotifyEventUnitMeterReadingMultipleExceeded",
// "NotifyEventDefaultNotification",
// "NotifyDeliveryMethodApp",
// "NotifyDeliveryMethodSMTP",
// "NotifyEventObjectAge",
// "NotifyEventServerOperationsProblem",
// "Duration"
]);
}
// //////////////////////
// //
// //
// async function populateSelectionLists(vm) {
// //ensure the pick lists required are pre-fetched
// await window.$gz.enums.fetchEnumList("usertype");
// vm.selectLists.usertypes = window.$gz.enums.getSelectionList("usertype");
// }
//////////////////////
//
//
async function populateSelectionLists(vm) {
//ensure the pick lists required are pre-fetched
await window.$gz.enums.fetchEnumList("NotifyEventType");
var v = window.$gz.enums.getSelectionList("NotifyEventType");
console.log(v);
vm.selectLists.eventTypes = window.$gz.enums.getSelectionList(
"NotifyEventType"
);
// await window.$gz.enums.fetchEnumList("NotifyDeliveryMethod");
// vm.selectLists.deliveryMethods = window.$gz.enums.getSelectionList(
// "NotifyDeliveryMethod"
// );
await window.$gz.enums.fetchEnumList("ayatype");
vm.selectLists.ayaTypes = window.$gz.enums.getSelectionList("ayatype");
}
</script>