Fix: Updated removed redundant filtering, and getting for single-page architecture, which this is not on all pages
This commit is contained in:
@@ -70,18 +70,6 @@ export default class API {
|
||||
|
||||
// store
|
||||
// product categories
|
||||
static async getCategories() {
|
||||
return await API.request(hashGetStoreProductCategory);
|
||||
}
|
||||
static async getCategoriesByFilters(filtersJson) {
|
||||
/*
|
||||
let dataRequest = {};
|
||||
dataRequest[flagForm] = filtersJson;
|
||||
return await API.request(hashGetStoreProductCategory, 'POST', dataRequest);
|
||||
*/
|
||||
// return await API.request(hashPageStoreProductCategories, 'GET', filtersJson);
|
||||
API.goToHash(hashPageStoreProductCategories, filtersJson);
|
||||
}
|
||||
static async saveCategories(categories, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
@@ -91,12 +79,6 @@ export default class API {
|
||||
}
|
||||
|
||||
// products
|
||||
static async getProducts() {
|
||||
return await API.request(hashGetStoreProduct);
|
||||
}
|
||||
static async getProductsByFilters(filtersJson) {
|
||||
API.goToHash(hashPageStoreProducts, filtersJson);
|
||||
}
|
||||
static async saveProducts(products, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
@@ -106,12 +88,6 @@ export default class API {
|
||||
}
|
||||
|
||||
// product permutations
|
||||
static async getProductPermutations() {
|
||||
return await API.request(hashGetStoreProductPermutation);
|
||||
}
|
||||
static async getProductPermutationsByFilters(filtersJson) {
|
||||
API.goToHash(hashPageStoreProductPermutations, filtersJson);
|
||||
}
|
||||
static async saveProductPermutations(permutations, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
@@ -121,12 +97,6 @@ export default class API {
|
||||
}
|
||||
|
||||
// product variations
|
||||
static async getProductVariations() {
|
||||
return await API.request(hashGetStoreProductVariation);
|
||||
}
|
||||
static async getProductVariationsByFilters(filtersJson) {
|
||||
API.goToHash(hashPageStoreProductVariations, filtersJson);
|
||||
}
|
||||
static async saveProductVariations(variationTypes, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
@@ -136,12 +106,6 @@ export default class API {
|
||||
}
|
||||
|
||||
// stock items
|
||||
static async getStockItems() {
|
||||
return await API.request(hashGetStoreStockItem);
|
||||
}
|
||||
static async getStockItemsByFilters(filtersJson) {
|
||||
API.goToHash(hashPageStoreStockItems, filtersJson);
|
||||
}
|
||||
static async saveStockItems(stockItems, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
@@ -151,12 +115,6 @@ export default class API {
|
||||
}
|
||||
|
||||
// suppliers
|
||||
static async getSuppliers() {
|
||||
return await API.request(hashGetStoreSupplier);
|
||||
}
|
||||
static async getSuppliersByFilters(filtersJson) {
|
||||
API.goToHash(hashPageStoreSuppliers, filtersJson);
|
||||
}
|
||||
static async saveSuppliers(suppliers, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
@@ -166,12 +124,6 @@ export default class API {
|
||||
}
|
||||
|
||||
// supplier purchase orders
|
||||
static async getSupplierPurchaseOrders() {
|
||||
return await API.request(hashGetStoreSupplierPurchaseOrder);
|
||||
}
|
||||
static async getSupplierPurchaseOrdersByFilters(filtersJson) {
|
||||
API.goToHash(hashPageStoreSupplierPurchaseOrders, filtersJson);
|
||||
}
|
||||
static async saveSupplierPurchaseOrders(supplierPurchaseOrders, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
@@ -181,12 +133,6 @@ export default class API {
|
||||
}
|
||||
|
||||
// manufacturing purchase orders
|
||||
static async getManufacturingPurchaseOrders() {
|
||||
return await API.request(hashGetStoreManufacturingPurchaseOrder);
|
||||
}
|
||||
static async getManufacturingPurchaseOrdersByFilters(filtersJson) {
|
||||
API.goToHash(hashPageStoreManufacturingPurchaseOrders, filtersJson);
|
||||
}
|
||||
static async saveManufacturingPurchaseOrders(manufacturingPurchaseOrders, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
|
||||
@@ -14,27 +14,10 @@ import OverlayError from "../components/common/temporary/overlay_error.js";
|
||||
export default class TableBasePage extends BasePage {
|
||||
// static hash
|
||||
// static attrIdRowObject
|
||||
// callFilterTableContent
|
||||
// callSaveTableContent
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
/*
|
||||
if (!this.constructor.callFilterTableContent) {
|
||||
throw new Error(`Class ${this.constructor.name} must have a static callFilterTableContent method attribute that takes a single argument - the filters as json.`);
|
||||
}
|
||||
if (!this.constructor.callSaveTableContent) {
|
||||
throw new Error(`Class ${this.constructor.name} must have a static callSaveTableContent method attribute that takes 3 arguments - a list of records, the filters as json, and a comment for saving.`);
|
||||
}
|
||||
this.initialize();
|
||||
// this.hookupFilters();
|
||||
this.loadRowTable(null);
|
||||
this.getJsonRow(null);
|
||||
// this.hookupTableMain();
|
||||
this.getTableRecords();
|
||||
this.leave();
|
||||
*/
|
||||
// this.cursorXInitial = null;
|
||||
this.cursorYInitial = null;
|
||||
this.rowInitial = null;
|
||||
this.placeholder = null;
|
||||
@@ -67,7 +50,7 @@ export default class TableBasePage extends BasePage {
|
||||
let formFilters = this.getFormFilters();
|
||||
let filtersDefault = DOM.convertForm2JSON(formFilters);
|
||||
if (!Validation.areEqualDicts(filters, filtersDefault)) {
|
||||
this.callFilterTableContent(filters);
|
||||
this.callFilterTableContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,15 +88,18 @@ export default class TableBasePage extends BasePage {
|
||||
});
|
||||
}
|
||||
getAndLoadFilteredTableContent() {
|
||||
let formFilters = this.getFormFilters();
|
||||
let filtersJson = DOM.convertForm2JSON(formFilters);
|
||||
this.leave();
|
||||
this.callFilterTableContent(filtersJson)
|
||||
this.callFilterTableContent()
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
getFormFilters() {
|
||||
return document.querySelector(idFormFilters);
|
||||
}
|
||||
callFilterTableContent() {
|
||||
let formFilters = this.getFormFilters();
|
||||
let filtersJson = DOM.convertForm2JSON(formFilters);
|
||||
this.leave();
|
||||
API.goToHash(this.constructor.hash, filtersJson);
|
||||
}
|
||||
callbackLoadTableContent(response) {
|
||||
let table = TableBasePage.getTableMain();
|
||||
let bodyTable = table.querySelector('tbody');
|
||||
@@ -132,9 +118,7 @@ export default class TableBasePage extends BasePage {
|
||||
throw new Error("Subclass of TableBasePage must implement method loadRowTable().");
|
||||
}
|
||||
getAndLoadFilteredTableContentSinglePageApp() {
|
||||
let formFilters = this.getFormFilters();
|
||||
let filtersJson = DOM.convertForm2JSON(formFilters);
|
||||
this.callFilterTableContent(filtersJson)
|
||||
this.callFilterTableContent()
|
||||
.then(data => {
|
||||
if (_verbose) { console.log('Table data received:', data); }
|
||||
this.callbackLoadTableContent(data);
|
||||
@@ -979,7 +963,6 @@ import DOM from "../dom.js";
|
||||
export class PageStoreProductCategories extends TableBasePage {
|
||||
static hash = hashPageStoreProductCategories;
|
||||
static attrIdRowObject = attrIdProductCategory;
|
||||
callFilterTableContent = API.getCategoriesByFilters;
|
||||
callSaveTableContent = API.saveCategories;
|
||||
|
||||
constructor() {}
|
||||
|
||||
@@ -12,7 +12,6 @@ import StoreTableMixinPage from "./mixin_table.js";
|
||||
export default class PageStoreManufacturingPurchaseOrders extends TableBasePage {
|
||||
static hash = hashPageStoreManufacturingPurchaseOrders;
|
||||
static attrIdRowObject = attrIdManufacturingPurchaseOrder;
|
||||
callFilterTableContent = API.getManufacturingPurchaseOrdersByFilters;
|
||||
callSaveTableContent = API.saveManufacturingPurchaseOrders;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import StoreTableMixinPage from "./mixin_table.js";
|
||||
export default class PageStoreProductCategories extends TableBasePage {
|
||||
static hash = hashPageStoreProductCategories;
|
||||
static attrIdRowObject = attrIdProductCategory;
|
||||
callFilterTableContent = API.getCategoriesByFilters;
|
||||
callSaveTableContent = API.saveCategories;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import StoreTableMixinPage from "./mixin_table.js";
|
||||
export default class PageStoreProductPermutations extends TableBasePage {
|
||||
static hash = hashPageStoreProductPermutations;
|
||||
static attrIdRowObject = attrIdProductPermutation;
|
||||
callFilterTableContent = API.getProductPermutationsByFilters;
|
||||
callSaveTableContent = API.saveProductPermutations;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import StoreTableMixinPage from "./mixin_table.js";
|
||||
export default class PageStoreProductVariations extends TableBasePage {
|
||||
static hash = hashPageStoreProductVariations;
|
||||
static attrIdRowObject = attrIdProductVariationType;
|
||||
callFilterTableContent = API.getProductVariationsByFilters;
|
||||
callSaveTableContent = API.saveProductVariations;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import Utils from "../../lib/utils.js";
|
||||
export default class PageStoreProducts extends TableBasePage {
|
||||
static hash = hashPageStoreProducts;
|
||||
static attrIdRowObject = attrIdProduct;
|
||||
callFilterTableContent = API.getProductsByFilters;
|
||||
callSaveTableContent = API.saveProducts;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import StoreTableMixinPage from "./mixin_table.js";
|
||||
export default class PageStoreStockItems extends TableBasePage {
|
||||
static hash = hashPageStoreStockItems;
|
||||
static attrIdRowObject = attrIdStockItem;
|
||||
callFilterTableContent = API.getStockItemsByFilters;
|
||||
callSaveTableContent = API.saveStockItems;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import StoreTableMixinPage from "./mixin_table.js";
|
||||
export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
static hash = hashPageStoreSupplierPurchaseOrders;
|
||||
static attrIdRowObject = attrIdSupplierPurchaseOrder;
|
||||
callFilterTableContent = API.getSupplierPurchaseOrdersByFilters;
|
||||
callSaveTableContent = API.saveSupplierPurchaseOrders;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import StoreTableMixinPage from "./mixin_table.js";
|
||||
export default class PageStoreSuppliers extends TableBasePage {
|
||||
static hash = hashPageStoreSuppliers;
|
||||
static attrIdRowObject = attrIdSupplier;
|
||||
callFilterTableContent = API.getSuppliersByFilters;
|
||||
callSaveTableContent = API.saveSuppliers;
|
||||
|
||||
constructor(router) {
|
||||
|
||||
Reference in New Issue
Block a user