This commit is contained in:
2021-01-26 00:42:52 +00:00
parent 531c86a943
commit 43a7fcc9e5
6 changed files with 117 additions and 22 deletions

View File

@@ -586,6 +586,9 @@ export default {
// Process and return server errors if any for form and field specified
// note that this is called in turn by every control on the form so it's only job
// is to return errors if they exist for *that* field
// Not to be confused with validation errors through the "rules" property
// that is separate and any errors returned here are *added* to the validation
// errors in the UI by Vuetify
//
serverErrors(vm, ref) {
let ret = [];

View File

@@ -15,6 +15,7 @@
:dataListSort="dataListSort"
:showSelect="rights.read"
:reload="reload"
:metaView="metaView"
v-on:selection-change="handleSelected"
data-cy="partInventoryTransactionsTable"
>
@@ -26,9 +27,35 @@
const FORM_KEY = "part-inventory-list";
export default {
created() {
this.rights = window.$gz.role.getRights(window.$gz.type.PartInventory);
let vm = this;
vm.rights = window.$gz.role.getRights(window.$gz.type.PartInventory);
window.$gz.eventBus.$on("menu-click", clickHandler);
generateMenu(this);
if (vm.$route.params.filter) {
let metaFilter = [];
//pre-filter by PartNumber or warehouse name or both
if (vm.$route.params.filter.PartPartNumber != null) {
metaFilter.push({
fld: "PartPartNumber",
filter: {
items: [{ op: "=", value: vm.$route.params.filter.PartPartNumber }]
}
});
}
if (vm.$route.params.filter.PartWarehouseName != null) {
metaFilter.push({
fld: "PartWarehouseName",
filter: {
items: [
{ op: "=", value: vm.$route.params.filter.PartWarehouseName }
]
}
});
}
vm.metaView = JSON.stringify(metaFilter);
}
generateMenu(vm);
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
@@ -42,6 +69,7 @@ export default {
rights: window.$gz.role.defaultRightsObject(),
ayType: window.$gz.type.PartInventory,
selectedItems: [],
metaView: undefined,
reload: false
};
},

View File

@@ -15,6 +15,7 @@
:dataListSort="dataListSort"
:showSelect="rights.read"
:reload="reload"
:metaView="metaView"
v-on:selection-change="handleSelected"
data-cy="partInventoryTable"
>
@@ -26,9 +27,35 @@
const FORM_KEY = "part-inventory-list";
export default {
created() {
this.rights = window.$gz.role.getRights(window.$gz.type.PartInventory);
let vm = this;
vm.rights = window.$gz.role.getRights(window.$gz.type.PartInventory);
window.$gz.eventBus.$on("menu-click", clickHandler);
generateMenu(this);
if (vm.$route.params.filter) {
let metaFilter = [];
//pre-filter by PartNumber or warehouse name or both
if (vm.$route.params.filter.PartPartNumber != null) {
metaFilter.push({
fld: "PartPartNumber",
filter: {
items: [{ op: "=", value: vm.$route.params.filter.PartPartNumber }]
}
});
}
if (vm.$route.params.filter.PartWarehouseName != null) {
metaFilter.push({
fld: "PartWarehouseName",
filter: {
items: [
{ op: "=", value: vm.$route.params.filter.PartWarehouseName }
]
}
});
}
vm.metaView = JSON.stringify(metaFilter);
}
generateMenu(vm);
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
@@ -42,6 +69,7 @@ export default {
rights: window.$gz.role.defaultRightsObject(),
ayType: window.$gz.type.PartInventory,
selectedItems: [],
metaView: undefined,
reload: false
};
},

View File

@@ -491,7 +491,18 @@ async function clickHandler(menuItem) {
});
}
break;
case "PartByWarehouseInventoryList":
m.vm.$router.push({
name: "inv-part-inventory",
params: { filter: { PartWarehouseName: m.vm.obj.name } }
});
break;
case "PartInventoryTransactionList":
m.vm.$router.push({
name: "inv-part-inventory-transactions",
params: { filter: { PartWarehouseName: m.vm.obj.name } }
});
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
@@ -585,6 +596,26 @@ function generateMenu(vm) {
menuOptions.menuItems.push({ divider: true, inset: false });
if (
vm.obj.id != null &&
vm.obj.id != 0 &&
window.$gz.store.state.globalSettings.useInventory
) {
menuOptions.menuItems.push({
title: "PartByWarehouseInventoryList",
icon: "$ayiPallet",
key: FORM_KEY + ":PartByWarehouseInventoryList",
vm: vm
});
menuOptions.menuItems.push({
title: "PartInventoryTransactionList",
icon: "$ayiDolly",
key: FORM_KEY + ":PartInventoryTransactionList",
vm: vm
});
}
menuOptions.menuItems.push({ divider: true, inset: false });
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
@@ -605,6 +636,8 @@ async function initForm(vm) {
async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([
"PartWarehouse",
"PartByWarehouseInventoryList",
"PartInventoryTransactionList",
"PartWarehouseName",
"PartWarehouseNotes",
"PartWarehouseCustom1",

View File

@@ -718,6 +718,18 @@ async function clickHandler(menuItem) {
params: { recordid: m.vm.obj.id }
});
break;
case "PartByWarehouseInventoryList":
m.vm.$router.push({
name: "inv-part-inventory",
params: { filter: { PartPartNumber: m.vm.obj.partNumber } }
});
break;
case "PartInventoryTransactionList":
m.vm.$router.push({
name: "inv-part-inventory-transactions",
params: { filter: { PartPartNumber: m.vm.obj.partNumber } }
});
break;
default:
window.$gz.eventBus.$emit(
@@ -807,8 +819,6 @@ function generateMenu(vm) {
menuOptions.menuItems.push({ divider: true, inset: false });
//---- SHOW ALL ---
//MIGRATE_OUTSTANDING part inventory link from part form
if (
vm.obj.id != null &&
vm.obj.id != 0 &&
@@ -817,17 +827,14 @@ function generateMenu(vm) {
menuOptions.menuItems.push({
title: "PartByWarehouseInventoryList",
icon: "$ayiPallet",
key: FORM_KEY + ":TODO-PartByWareHouseInventoryLinkForThisPart",
key: FORM_KEY + ":PartByWarehouseInventoryList",
vm: vm
});
//MIGRATE_OUTSTANDING part inventory transactions list for this part
menuOptions.menuItems.push({
title: "PartInventoryTransactionList",
icon: "$ayiDolly",
key:
FORM_KEY +
":TODO-PartByWareHouseInventoryTransactionListLinkForThisPart",
key: FORM_KEY + ":PartInventoryTransactionList",
vm: vm
});
@@ -871,6 +878,7 @@ async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([
"Part",
"PartByWarehouseInventoryList",
"PartInventoryTransactionList",
"PartSerialNumbersAvailable",
"PartStockingLevels",
"PartName",