HUGE REFACTOR / CLEANUP
if there is a issue it's probably something in here that was changed
This commit is contained in:
@@ -60,7 +60,6 @@
|
||||
</gz-data-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const FORM_KEY = "pm-list";
|
||||
export default {
|
||||
@@ -68,7 +67,6 @@ export default {
|
||||
this.rights = window.$gz.role.getRights(window.$gz.type.PM);
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
await fetchTranslatedText();
|
||||
|
||||
//------ Show all ----
|
||||
//OPTIONAL "Show All" FILTER
|
||||
this.objectId = window.$gz.util.stringToIntOrNull(
|
||||
@@ -119,13 +117,12 @@ export default {
|
||||
this.preFilterMode = null;
|
||||
this.reload = !this.reload;
|
||||
},
|
||||
|
||||
async openPM() {
|
||||
if (!this.openPMNumber) {
|
||||
return;
|
||||
}
|
||||
//get id from number then push open
|
||||
let res = await window.$gz.api.get(
|
||||
const res = await window.$gz.api.get(
|
||||
"pm/id-from-number/" + this.openPMNumber
|
||||
);
|
||||
if (res.error) {
|
||||
@@ -134,7 +131,6 @@ export default {
|
||||
window.$gz.errorHandler.errorToString(res, this)
|
||||
);
|
||||
return;
|
||||
// throw new Error(window.$gz.errorHandler.errorToString(res, this));
|
||||
}
|
||||
|
||||
this.$router.push({
|
||||
@@ -152,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":
|
||||
@@ -162,7 +158,7 @@ async function clickHandler(menuItem) {
|
||||
});
|
||||
break;
|
||||
case "extensions":
|
||||
let res = await m.vm.$refs.extensions.open(
|
||||
const res = await m.vm.$refs.extensions.open(
|
||||
m.vm.$refs.gzdatatable.getDataListSelection(window.$gz.type.PM)
|
||||
);
|
||||
if (res && res.refresh == true) {
|
||||
@@ -171,7 +167,7 @@ async function clickHandler(menuItem) {
|
||||
break;
|
||||
case "report":
|
||||
{
|
||||
let res = await m.vm.$refs.reportSelector.open(
|
||||
const res = await m.vm.$refs.reportSelector.open(
|
||||
m.vm.$refs.gzdatatable.getDataListSelection(window.$gz.type.PM),
|
||||
m.id
|
||||
);
|
||||
@@ -179,7 +175,7 @@ async function clickHandler(menuItem) {
|
||||
return;
|
||||
}
|
||||
window.$gz.form.setLastReport(FORM_KEY, res);
|
||||
generateMenu(m.vm); //refresh the menu with the new report
|
||||
generateMenu(m.vm);
|
||||
}
|
||||
break;
|
||||
case "WorkOrderItemList":
|
||||
@@ -203,7 +199,7 @@ async function clickHandler(menuItem) {
|
||||
//
|
||||
//
|
||||
function generateMenu(vm) {
|
||||
let menuOptions = {
|
||||
const menuOptions = {
|
||||
isMain: true,
|
||||
icon: "$ayiBusinessTime",
|
||||
title: "PMList",
|
||||
@@ -224,8 +220,6 @@ function generateMenu(vm) {
|
||||
});
|
||||
}
|
||||
|
||||
//REPORTS
|
||||
//Report not Print, print is a further option
|
||||
menuOptions.menuItems.push({
|
||||
title: "Report",
|
||||
icon: "$ayiFileAlt",
|
||||
@@ -233,8 +227,7 @@ function generateMenu(vm) {
|
||||
vm: vm
|
||||
});
|
||||
|
||||
//get last report selected
|
||||
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
||||
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
||||
if (lastReport != null) {
|
||||
menuOptions.menuItems.push({
|
||||
title: lastReport.name,
|
||||
|
||||
Reference in New Issue
Block a user