This commit is contained in:
2023-04-20 00:08:43 +00:00
parent 9011f19688
commit 9b506cefdb
4 changed files with 191 additions and 1 deletions

View File

@@ -38,7 +38,8 @@ export default {
Product: 97,
GZCase: 98,
VendorNotification: 99,
Subscription: 100
Subscription: 100,
SubscriptionItem: 101
};
/**
*

View File

@@ -437,6 +437,14 @@ export default new Router({
component: () =>
import(/* webpackChunkName: "biz" */ "./views/biz-subscription.vue")
},
{
path: "/biz-subscription-item-list",
name: "biz-subscription-item-list",
component: () =>
import(
/* webpackChunkName: "biz" */ "./views/biz-subscription-item-list.vue"
)
},
// //####################### SERVICE GROUP ##############################
// {
// path: "/svc-schedule",

View File

@@ -0,0 +1,168 @@
<template>
<div>
<gz-report-selector ref="reportSelector"></gz-report-selector>
<gz-extensions
ref="extensions"
:aya-type="sockType"
:selected-items="selectedItems"
>
</gz-extensions>
<gz-data-table
ref="gzdatatable"
form-key="subscription-item-list"
data-list-key="SubscriptionItemsDataList"
:show-select="rights.read"
:reload="reload"
data-cy="subscriptionItemsTable"
:client-criteria="clientCriteria"
:pre-filter-mode="preFilterMode"
@selection-change="handleSelected"
@clear-pre-filter="clearPreFilter"
>
</gz-data-table>
</div>
</template>
<script>
const FORM_KEY = "subscription-item-list";
export default {
data() {
return {
rights: window.$gz.role.defaultRightsObject(),
sockType: window.$gz.type.SubscriptionItem,
selectedItems: [],
reload: false,
clientCriteria: undefined,
preFilterMode: null,
objectId: null,
aForType: null,
name: null
};
},
created() {
this.rights = window.$gz.role.getRights(window.$gz.type.Subscription);
window.$gz.eventBus.$on("menu-click", clickHandler);
//------ pre-filter ----
//OPTIONAL "Show All subscriptions of head office" FILTER
this.objectId = window.$gz.util.stringToIntOrNull(
this.$route.params.objectId
);
this.aForType = window.$gz.util.stringToIntOrNull(this.$route.params.aType);
if (this.objectId && this.objectId != 0 && this.aForType) {
//OBJECTID,AYATYPE
this.clientCriteria = `${this.objectId},${this.aForType}`;
this.preFilterMode = {
icon: window.$gz.util.iconForType(this.aForType),
id: this.objectId,
socktype: this.aForType,
viz: this.$route.params.name,
clearable: true
};
}
//------ /pre-filter ----
generateMenu(this);
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
},
methods: {
handleSelected(selected) {
this.selectedItems = selected;
},
clearPreFilter() {
this.clientCriteria = null;
this.preFilterMode = null;
this.reload = !this.reload;
}
}
};
/////////////////////////////
//
//
async function clickHandler(menuItem) {
if (!menuItem) {
return;
}
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "extensions":
{
const res = await m.vm.$refs.extensions.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.Subscription
)
);
if (res && res.refresh == true) {
m.vm.reload = !m.vm.reload;
}
}
break;
case "report":
{
const res = await m.vm.$refs.reportSelector.open(
m.vm.$refs.gzdatatable.getDataListSelection(
window.$gz.type.Subscription
),
m.id
);
if (res == null) {
return;
}
window.$gz.form.setLastReportMenuItem(FORM_KEY, res, m.vm);
}
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
FORM_KEY + "::context click: [" + m.key + "]"
);
}
}
}
//////////////////////
//
//
function generateMenu(vm) {
const menuOptions = {
isMain: true,
icon: "$sockiFileContract",
title: "SubscriptionList",
menuItems: [],
formData: {
sockType: window.$gz.type.Subscription
}
};
menuOptions.menuItems.push({
title: "Report",
icon: "$sockiFileAlt",
key: FORM_KEY + ":report",
vm: vm
});
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,
notrans: true,
icon: "$sockiFileAlt",
key: FORM_KEY + ":report:" + lastReport.id,
vm: vm
});
}
menuOptions.menuItems.push({
title: "Extensions",
icon: "$sockiPuzzlePiece",
key: FORM_KEY + ":extensions",
vm: vm
});
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
</script>

View File

@@ -122,6 +122,11 @@ async function clickHandler(menuItem) {
window.$gz.form.setLastReportMenuItem(FORM_KEY, res, m.vm);
}
break;
case "SubscriptionItemList":
m.vm.$router.push({
name: "biz-subscription-item-list"
});
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
@@ -179,6 +184,14 @@ function generateMenu(vm) {
key: FORM_KEY + ":extensions",
vm: vm
});
menuOptions.menuItems.push({ divider: true, inset: false });
menuOptions.menuItems.push({
title: "SubscriptionItemList",
icon: "$sockiFileContract",
key: FORM_KEY + ":SubscriptionItemList",
vm: vm
});
menuOptions.menuItems.push({ divider: true, inset: false });
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
</script>