feat(JavaScript): Updated architecture for TableBasePage object with static row ID attribute attached for adding ID against each row added to DOM
This commit is contained in:
82
static/js/pages/store/supplier_purchase_orders.js
Normal file
82
static/js/pages/store/supplier_purchase_orders.js
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
import API from "../../api.js";
|
||||
import BusinessObjects from "../../lib/business_objects.js";
|
||||
import DOM from "../../dom.js";
|
||||
import Events from "../../lib/events.js";
|
||||
import TableBasePage from "../base_table.js";
|
||||
import Utils from "../../lib/utils.js";
|
||||
import Validation from "../../lib/validation.js";
|
||||
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) {
|
||||
super(router);
|
||||
this.storeMixin = new StoreTableMixinPage(this);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
}
|
||||
|
||||
hookupFilters() {
|
||||
this.sharedHookupFilters();
|
||||
this.hookupFilterActive();
|
||||
}
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
}
|
||||
getJsonRow(row) {
|
||||
if (row == null) return;
|
||||
let tdSupplier = row.querySelector('td.' + flagSupplier);
|
||||
let tdCurrency = row.querySelector('td.' + flagCurrency);
|
||||
let inputCostTotalLocalVatExcl = row.querySelector('td.' + flagCostTotalLocalVatExcl + ' input');
|
||||
let inputCostTotalLocalVatIncl = row.querySelector('td.' + flagCostTotalLocalVatIncl + ' input');
|
||||
let tdItems = row.querySelector('td.' + flagItems);
|
||||
let checkboxActive = row.querySelector('td.' + flagActive + ' textarea');
|
||||
|
||||
let jsonRow = {};
|
||||
jsonRow[attrIdSupplierPurchaseOrder] = row.getAttribute(attrIdSupplierPurchaseOrder);
|
||||
jsonRow[attrIdSupplier] = DOM.getElementAttributeValueCurrent(tdSupplier);
|
||||
jsonRow[attrIdCurrency] = DOM.getElementAttributeValueCurrent(tdCurrency);
|
||||
jsonRow[flagCostTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatExcl);
|
||||
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
|
||||
jsonRow[flagItems] = DOM.getElementAttributeValueCurrent(tdItems);
|
||||
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
|
||||
return jsonRow;
|
||||
}
|
||||
initialiseRowNew(row) {
|
||||
super.initialiseRowNew(row);
|
||||
}
|
||||
|
||||
hookupTableMain() {
|
||||
super.hookupTableMain();
|
||||
this.hookupSupplierFields();
|
||||
this.hookupCurrencyFields();
|
||||
this.hookupCostInputs();
|
||||
this.hookupOrderItemsFields();
|
||||
this.hookupActiveCheckboxes();
|
||||
}
|
||||
hookupSupplierFields() {
|
||||
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagSupplier, Utils.getListFromDict(suppliers));
|
||||
}
|
||||
hookupCostInputs() {
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatExcl + ' input');
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatIncl + ' input');
|
||||
}
|
||||
hookupOrderItemsFields() {
|
||||
|
||||
}
|
||||
hookupActiveCheckboxes(){
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input');
|
||||
}
|
||||
|
||||
leave() {
|
||||
super.leave();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user