diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 982ab6bb..cb1f8e94 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -18,9 +18,9 @@ todo: BAckend inapp notification form 3 LINE style Listed in order from newest at top to oldest at bottom AVATAR to left side which is icon of ayatype - TITLE which is the event type translation AND object name + TITLE which is the event type translation AND object name and date SUBTITLE which is the message if applicable - ACTION buttons open object, delete notification + ACTION buttons open object, delete notification, open subscription POSSIBLE: Items approaching 90 days old should show differently to indicate they are about to be deleted, like faded or something? diff --git a/ayanova/src/views/home-notifications.vue b/ayanova/src/views/home-notifications.vue index 80f6c9e1..0f8c3bc0 100644 --- a/ayanova/src/views/home-notifications.vue +++ b/ayanova/src/views/home-notifications.vue @@ -2,6 +2,7 @@
{{ obj }} + @@ -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"); +}