HUGE REFACTOR / CLEANUP
if there is a issue it's probably something in here that was changed
This commit is contained in:
@@ -16,12 +16,11 @@
|
||||
</v-data-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const FORM_KEY = "notify-subscriptions";
|
||||
export default {
|
||||
async created() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
try {
|
||||
await initForm(vm);
|
||||
vm.formState.readOnly = false;
|
||||
@@ -60,12 +59,11 @@ export default {
|
||||
});
|
||||
},
|
||||
async getDataFromApi() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
vm.formState.loading = true;
|
||||
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
try {
|
||||
let res = await window.$gz.api.get("notify-subscription/list");
|
||||
const res = await window.$gz.api.get("notify-subscription/list");
|
||||
|
||||
if (res.error) {
|
||||
if (res.error.code == "2010") {
|
||||
@@ -75,21 +73,18 @@ export default {
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
if (res.data) {
|
||||
let ret = [];
|
||||
//const timeZoneName = window.$gz.locale.getResolvedTimeZoneName();
|
||||
const ret = [];
|
||||
const languageName = window.$gz.locale.getResolvedLanguage();
|
||||
//const hour12 = window.$gz.store.state.userOptions.hour12;
|
||||
const currencyName = window.$gz.locale.getCurrencyName();
|
||||
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
let o = res.data[i];
|
||||
const o = res.data[i];
|
||||
let info = "";
|
||||
if (o.status != "") {
|
||||
info += o.status;
|
||||
}
|
||||
if (o.decValue && o.decValue != 0) {
|
||||
//currently is only currency for "The Andy" so format as currency
|
||||
let t = window.$gz.locale.currencyLocalized(
|
||||
const t = window.$gz.locale.currencyLocalized(
|
||||
o.decValue,
|
||||
languageName,
|
||||
currencyName
|
||||
@@ -99,12 +94,11 @@ export default {
|
||||
}
|
||||
}
|
||||
if (o.ageValue) {
|
||||
let t = window.$gz.locale.durationLocalized(o.ageValue);
|
||||
const t = window.$gz.locale.durationLocalized(o.ageValue);
|
||||
if (info != "" && t != "") {
|
||||
info += ` - ${t}`;
|
||||
}
|
||||
}
|
||||
|
||||
let eventDisplay = window.$gz.enums.get(
|
||||
"NotifyEventType",
|
||||
o.eventType
|
||||
@@ -112,7 +106,6 @@ export default {
|
||||
if (info && info != "") {
|
||||
eventDisplay += ` - ${info}`;
|
||||
}
|
||||
|
||||
ret.push({
|
||||
id: o.id,
|
||||
eventType: eventDisplay,
|
||||
@@ -125,12 +118,10 @@ export default {
|
||||
tags: window.$gz.util.formatTags(o.tags)
|
||||
});
|
||||
}
|
||||
|
||||
vm.obj = ret;
|
||||
} else {
|
||||
vm.obj = [];
|
||||
}
|
||||
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
@@ -157,7 +148,7 @@ async function clickHandler(menuItem) {
|
||||
if (!menuItem) {
|
||||
return;
|
||||
}
|
||||
let m = window.$gz.menu.parseMenuItem(menuItem);
|
||||
const m = window.$gz.menu.parseMenuItem(menuItem);
|
||||
if (m.owner == FORM_KEY && !m.disabled) {
|
||||
switch (m.key) {
|
||||
case "new":
|
||||
@@ -180,7 +171,7 @@ async function clickHandler(menuItem) {
|
||||
//
|
||||
//
|
||||
function generateMenu(vm) {
|
||||
let menuOptions = {
|
||||
const menuOptions = {
|
||||
isMain: true,
|
||||
icon: "$ayiBullhorn",
|
||||
title: "NotifySubscriptionList",
|
||||
@@ -209,7 +200,7 @@ function generateMenu(vm) {
|
||||
//
|
||||
async function initForm(vm) {
|
||||
await fetchTranslatedText(vm);
|
||||
await cacheEnums(vm);
|
||||
await cacheEnums();
|
||||
await createTableHeaders(vm);
|
||||
}
|
||||
|
||||
@@ -231,8 +222,7 @@ async function fetchTranslatedText(vm) {
|
||||
//////////////////////
|
||||
//
|
||||
//
|
||||
async function cacheEnums(vm) {
|
||||
//ensure the enum values required are pre-fetched
|
||||
async function cacheEnums() {
|
||||
await window.$gz.enums.fetchEnumList("NotifyEventType");
|
||||
await window.$gz.enums.fetchEnumList("NotifyDeliveryMethod");
|
||||
await window.$gz.enums.fetchEnumList("coreview");
|
||||
@@ -245,7 +235,6 @@ async function createTableHeaders(vm) {
|
||||
vm.headers = [
|
||||
{ text: vm.$ay.t("ID"), value: "id" },
|
||||
{ text: vm.$ay.t("NotifyEventType"), value: "eventType" },
|
||||
// { value: "info" },
|
||||
{ text: vm.$ay.t("AyaType"), value: "ayaType" },
|
||||
{ text: vm.$ay.t("NotifyDeliveryMethod"), value: "deliveryMethod" },
|
||||
{ text: vm.$ay.t("NotifyDeliveryAddress"), value: "deliveryAddress" },
|
||||
|
||||
Reference in New Issue
Block a user