Fix: Product, Product Category, Product Permutation, Supplier, Supplier Purchase Order, and Manufacturing Purchase Order architecture update for getting and saving data.
This commit is contained in:
@@ -22,8 +22,6 @@ export default class API {
|
||||
options.body = JSON.stringify(data);
|
||||
}
|
||||
|
||||
console.log('API request:', method, url, data);
|
||||
|
||||
try {
|
||||
const response = await fetch(url, options);
|
||||
if (!response.ok) {
|
||||
@@ -38,10 +36,7 @@ export default class API {
|
||||
|
||||
static getUrlFromHash(hash, params = null) {
|
||||
if (hash == null) hash = hashPageHome;
|
||||
console.log("getUrlFromHash:");
|
||||
console.log("base url: " + _pathHost + "\nhash: " + hash + '\nparams: ' + params);
|
||||
let url = API.parameteriseUrl(_pathHost + hash, params);
|
||||
console.log("url: " + url);
|
||||
return url;
|
||||
}
|
||||
static parameteriseUrl(url, params) {
|
||||
|
||||
@@ -48,7 +48,6 @@ class App {
|
||||
|
||||
handleGlobalClick(event) {
|
||||
// Handle global click events
|
||||
console.log('Global click:', event.target);
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
function handleSelectCollapse(elementSelect) {
|
||||
let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected');
|
||||
optionSelected.text(optionSelected.getAttribute(attrTextCollapsed));
|
||||
console.log('collapsed: ', optionSelected.text());
|
||||
optionSelected.classList.remove(flagExpanded);
|
||||
optionSelected.classList.add(flagCollapsed);
|
||||
}
|
||||
function handleSelectExpand(elementSelect) {
|
||||
let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected');
|
||||
optionSelected.text(optionSelected.getAttribute(attrTextExpanded));
|
||||
console.log('expanded: ', optionSelected.text());
|
||||
optionSelected.classList.remove(flagCollapsed);
|
||||
optionSelected.classList.add(flagExpanded);
|
||||
}
|
||||
@@ -54,11 +54,9 @@ export default class DOM {
|
||||
static convertForm2JSON(elementForm) {
|
||||
let dataForm = {};
|
||||
if (Validation.isEmpty(elementForm)) {
|
||||
console.log("empty form element");
|
||||
return dataForm;
|
||||
}
|
||||
let containersFilter = elementForm.querySelectorAll('.' + flagContainerInput + '.' + flagFilter);
|
||||
console.log("containersFilter: " + containersFilter);
|
||||
let containerFilter, labelFilter, keyFilter, filter;
|
||||
for (let indexFilter = 0; indexFilter < containersFilter.length; indexFilter++) {
|
||||
containerFilter = containersFilter[indexFilter];
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class BusinessObjects {
|
||||
static getOptionJsonFromObjectJson(objectJson, valueSelected = null) {
|
||||
let keyText = objectJson[flagNameAttrOptionText];
|
||||
let keyValue = objectJson[flagNameAttrOptionValue];
|
||||
console.log({objectJson, keyText, keyValue});
|
||||
if (_verbose) { console.log({objectJson, keyText, keyValue}); };
|
||||
return BusinessObjects.getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected);
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -3,4 +3,3 @@ const _dataLoadingFlag = 'data-loading'
|
||||
var _domParser = null;
|
||||
// var hashPageCurrent; // moved to layout
|
||||
const keyPublicStripe = 'pk_test_51OGrxlL7BuLKjoMpfpfw7bSmZZK1MhqMoQ5VhW2jUj7YtoEejO4vqnxKPiqTHHuh9U4qqkywbPCSI9TpFKtr4SYH007KHMWs68';
|
||||
var _verbose = true;
|
||||
|
||||
@@ -14,7 +14,7 @@ export default class BasePage {
|
||||
throw new Error("Router is required");
|
||||
}
|
||||
else {
|
||||
console.log("initialising with router: ", router);
|
||||
if (_verbose) { console.log("initialising with router: ", router); }
|
||||
}
|
||||
this.router = router;
|
||||
this.title = titlePageCurrent;
|
||||
@@ -38,7 +38,7 @@ export default class BasePage {
|
||||
}
|
||||
|
||||
logInitialisation() {
|
||||
console.log('Initializing ' + this.title + ' page');
|
||||
if (_verbose) { console.log('Initializing ' + this.title + ' page'); }
|
||||
}
|
||||
|
||||
hookupCommonElements() {
|
||||
@@ -189,7 +189,7 @@ export default class BasePage {
|
||||
Events.initialiseEventHandler('form.' + flagFilter + ' button.' + flagSave, flagInitialised, (button) => {
|
||||
button.addEventListener("click", (event) => {
|
||||
event.stopPropagation();
|
||||
console.log('saving page: ', this.title);
|
||||
if (_verbose) { console.log('saving page: ', this.title); }
|
||||
OverlayConfirm.show();
|
||||
});
|
||||
// button.classList.add(flagCollapsed);
|
||||
@@ -204,7 +204,7 @@ export default class BasePage {
|
||||
}
|
||||
|
||||
leave() {
|
||||
console.log('Leaving ' + this.title + ' page');
|
||||
if (_verbose) { console.log('Leaving ' + this.title + ' page'); }
|
||||
if (this.constructor === BasePage) {
|
||||
throw new Error("Must implement leave() method.");
|
||||
}
|
||||
@@ -222,11 +222,11 @@ export default class BasePage {
|
||||
if (show) {
|
||||
buttonCancel.classList.remove(flagCollapsed);
|
||||
buttonSave.classList.remove(flagCollapsed);
|
||||
console.log('showing buttons');
|
||||
if (_verbose) { console.log('showing buttons'); }
|
||||
} else {
|
||||
buttonCancel.classList.add(flagCollapsed);
|
||||
buttonSave.classList.add(flagCollapsed);
|
||||
console.log('hiding buttons');
|
||||
if (_verbose) { console.log('hiding buttons'); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ export default class TableBasePage extends BasePage {
|
||||
let filtersJson = DOM.convertForm2JSON(formFilters);
|
||||
this.callFilterTableContent(filtersJson)
|
||||
.then(data => {
|
||||
console.log('Table data received:', data);
|
||||
if (_verbose) { console.log('Table data received:', data); }
|
||||
this.callbackLoadTableContent(data);
|
||||
})
|
||||
.catch(error => console.error('Error:', error));
|
||||
@@ -156,12 +156,14 @@ export default class TableBasePage extends BasePage {
|
||||
this.callSaveTableContent(records, formElement, comment)
|
||||
.then(data => {
|
||||
if (data[flagStatus] == flagSuccess) {
|
||||
console.log('Records saved!');
|
||||
console.log('Data received:', data);
|
||||
if (_verbose) {
|
||||
console.log('Records saved!');
|
||||
console.log('Data received:', data);
|
||||
}
|
||||
this.getAndLoadFilteredTableContent();
|
||||
}
|
||||
else {
|
||||
console.log("error: ", data[flagMessage]);
|
||||
if (_verbose) { console.log("error: ", data[flagMessage]); }
|
||||
OverlayError.show(data[flagMessage]);
|
||||
}
|
||||
})
|
||||
@@ -192,12 +194,14 @@ export default class TableBasePage extends BasePage {
|
||||
this.callSaveTableContent(records, formElement, comment)
|
||||
.then(data => {
|
||||
if (data[flagStatus] == flagSuccess) {
|
||||
console.log('Records saved!');
|
||||
console.log('Data received:', data);
|
||||
if (_verbose) {
|
||||
console.log('Records saved!');
|
||||
console.log('Data received:', data);
|
||||
}
|
||||
this.callbackLoadTableContent(data);
|
||||
}
|
||||
else {
|
||||
console.log("error: ", data[flagMessage]);
|
||||
if (_verbose) { console.log("error: ", data[flagMessage]); }
|
||||
OverlayError.show(data[flagMessage]);
|
||||
}
|
||||
})
|
||||
@@ -207,7 +211,7 @@ export default class TableBasePage extends BasePage {
|
||||
Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, function(button) {
|
||||
button.addEventListener("click", function(event) {
|
||||
event.stopPropagation();
|
||||
getAndLoadFilteredTableContent();
|
||||
this.getAndLoadFilteredTableContent();
|
||||
});
|
||||
button.classList.add(flagCollapsed);
|
||||
});
|
||||
@@ -255,7 +259,7 @@ export default class TableBasePage extends BasePage {
|
||||
cacheRowBlank() {
|
||||
let selectorRowNew = idTableMain + ' tbody tr.' + flagRowNew;
|
||||
let rowBlankTemp = document.querySelector(selectorRowNew);
|
||||
console.log("row blank temp: ", rowBlankTemp);
|
||||
if (_verbose) { console.log("row blank temp: ", rowBlankTemp); }
|
||||
_rowBlank = rowBlankTemp.cloneNode(true);
|
||||
document.querySelectorAll(selectorRowNew).forEach(function(row) {
|
||||
row.remove();
|
||||
@@ -368,10 +372,10 @@ export default class TableBasePage extends BasePage {
|
||||
let wasDirtyParentRows = this.getAllIsDirtyRowsInParentTree(element);
|
||||
let wasDirtyElement = element.classList.contains(flagDirty);
|
||||
let isDirtyElement = DOM.updateAndCheckIsElementDirty(element);
|
||||
console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows});
|
||||
if (_verbose) { console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows}); }
|
||||
if (isDirtyElement != wasDirtyElement) {
|
||||
let td = DOM.getCellFromElement(element);
|
||||
DOM.setElementAttributeValueCurrent(td, DOM.getElementValueCurrent(element));
|
||||
DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element));
|
||||
this.toggleShowButtonsSaveCancel(isDirtyElement);
|
||||
this.cascadeChangedIsDirtyNestedElementCellTable(element, isDirtyElement, wasDirtyParentRows);
|
||||
}
|
||||
@@ -397,7 +401,7 @@ export default class TableBasePage extends BasePage {
|
||||
let tr = DOM.getRowFromElement(td);
|
||||
let isDirtyRow = isDirtyTd || DOM.hasDirtyChildrenNotDeletedContainer(tr);
|
||||
let wasDirtyRow = wasDirtyParentRows.pop();
|
||||
console.log({isDirtyRow, wasDirtyRow});
|
||||
if (_verbose) { console.log({isDirtyRow, wasDirtyRow}); }
|
||||
if (isDirtyRow != wasDirtyRow) {
|
||||
DOM.handleDirtyElement(tr, isDirtyRow);
|
||||
this.toggleShowButtonsSaveCancel(isDirtyRow);
|
||||
@@ -517,10 +521,9 @@ export default class TableBasePage extends BasePage {
|
||||
cellSelector
|
||||
, optionList
|
||||
, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }
|
||||
, changeHandler = (event, element) => { this.handleChangeTableCellDdl(event, element); }
|
||||
, changeHandler = (event, element) => { this.handleChangeNestedElementCellTable(event, element); }
|
||||
) {
|
||||
this.hookupEventHandler("click", cellSelector, (event, td) => {
|
||||
// if (td.querySelector('select')) return;
|
||||
this.handleClickTableCellDdlPreview(
|
||||
event
|
||||
, td
|
||||
@@ -532,14 +535,14 @@ export default class TableBasePage extends BasePage {
|
||||
); }
|
||||
);
|
||||
});
|
||||
ddlHookup(cellSelector + ' select');
|
||||
}
|
||||
hookupTableCellDdls(ddlSelector, changeHandler = (event, element) => { this.handleChangeTableCellDdl(event, element); }) {
|
||||
hookupTableCellDdls(ddlSelector, changeHandler = (event, element) => { this.handleChangeNestedElementCellTable(event, element); }) {
|
||||
this.hookupEventHandler("change", ddlSelector, (event, element) => { changeHandler(event, element); });
|
||||
}
|
||||
handleClickTableCellDdlPreview(event, td, optionObjectList, cellSelector, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }) {
|
||||
if (td.querySelector('select')) return;
|
||||
// td.removeEventListener("click", ddlHookup);
|
||||
console.log("click table cell ddl preview");
|
||||
let tdNew = td.cloneNode(true);
|
||||
td.parentNode.replaceChild(tdNew, td);
|
||||
let idSelected = DOM.getElementAttributeValueCurrent(tdNew);
|
||||
@@ -547,7 +550,10 @@ export default class TableBasePage extends BasePage {
|
||||
let ddl = document.createElement('select');
|
||||
DOM.setElementValuesCurrentAndPrevious(ddl, idSelected);
|
||||
let optionJson, option;
|
||||
console.log({optionObjectList, cellSelector});
|
||||
if (_verbose) {
|
||||
console.log("click table cell ddl preview");
|
||||
console.log({optionObjectList, cellSelector});
|
||||
}
|
||||
option = DOM.createOption(null);
|
||||
ddl.appendChild(option);
|
||||
optionObjectList.forEach((optionObjectJson) => {
|
||||
@@ -557,8 +563,10 @@ export default class TableBasePage extends BasePage {
|
||||
});
|
||||
tdNew.appendChild(ddl);
|
||||
let ddlSelector = cellSelector + ' select';
|
||||
debugger;
|
||||
ddlHookup(ddlSelector);
|
||||
}
|
||||
/*
|
||||
handleChangeTableCellDdl(event, ddl) {
|
||||
let row = DOM.getRowFromElement(ddl);
|
||||
let td = DOM.getCellFromElement(ddl);
|
||||
@@ -585,6 +593,7 @@ export default class TableBasePage extends BasePage {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
hookupTableCellDDlPreviewsWhenNotCollapsed(cellSelector, optionList, ddlHookup = (event, element) => { this.hookupTableCellDdls(event, element); }) {
|
||||
this.hookupEventHandler("click", cellSelector, (event, td) => {
|
||||
let div = td.querySelector('div');
|
||||
@@ -596,7 +605,7 @@ export default class TableBasePage extends BasePage {
|
||||
this.hookupChangeHandlerTableCells(ddlSelector, (event, element) => { this.handleChangeProductCategoryDdl(event, element); });
|
||||
}
|
||||
handleChangeProductCategoryDdl(event, ddlCategory) {
|
||||
this.handleChangeTableCellDdl(event, ddlCategory);
|
||||
this.handleChangeNestedElementCellTable(event, ddlCategory);
|
||||
let idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory);
|
||||
let row = DOM.getRowFromElement(ddlCategory);
|
||||
let tdProduct = row.querySelector('td.' + flagProduct);
|
||||
@@ -611,7 +620,7 @@ export default class TableBasePage extends BasePage {
|
||||
option = DOM.createOption(optionJson);
|
||||
ddlProduct.appendChild(option);
|
||||
});
|
||||
this.handleChangeTableCellDdl(event, ddlProduct);
|
||||
this.handleChangeNestedElementCellTable(event, ddlProduct);
|
||||
}
|
||||
hookupFieldsProductPermutationVariation() {
|
||||
this.hookupPreviewsProductPermutationVariation();
|
||||
@@ -625,7 +634,6 @@ export default class TableBasePage extends BasePage {
|
||||
handleClickProductPermutationVariationsPreview(event, element) {
|
||||
let tblVariations = element.querySelector('table.' + flagProductVariations);
|
||||
if (!Validation.isEmpty(tblVariations)) return;
|
||||
console.log("click product permutation variations preview");
|
||||
this.toggleColumnCollapsed(flagProductVariations, false);
|
||||
let permutationVariations = this.getElementProductVariations(element);
|
||||
tblVariations = document.createElement("table");
|
||||
@@ -650,18 +658,21 @@ export default class TableBasePage extends BasePage {
|
||||
thead.appendChild(tr);
|
||||
tblVariations.appendChild(thead);
|
||||
let tbody = document.createElement("tbody");
|
||||
console.log('variations:', permutationVariations);
|
||||
if (!Validation.isEmpty(permutationVariations)) {
|
||||
permutationVariations.forEach((permutationVariation, index) => {
|
||||
this.addProductPermutationVariationRow(tbody, permutationVariation);
|
||||
});
|
||||
}
|
||||
tblVariations.appendChild(tbody);
|
||||
if (_verbose) {
|
||||
console.log("click product permutation variations preview");
|
||||
console.log('variations:', permutationVariations);
|
||||
console.log("tblVariations: ", tblVariations);
|
||||
}
|
||||
|
||||
let cellParent = element.closest(idTableMain + ' tbody tr td.' + flagProductVariations);
|
||||
cellParent.innerHTML = '';
|
||||
cellParent.appendChild(tblVariations);
|
||||
console.log("tblVariations: ", tblVariations);
|
||||
|
||||
this.hookupFieldsProductPermutationVariation();
|
||||
}
|
||||
@@ -680,7 +691,7 @@ export default class TableBasePage extends BasePage {
|
||||
permutationVariations.forEach((variation) => {
|
||||
parts = variation.split(':');
|
||||
if (parts.length == 2) {
|
||||
console.log("parts: ", parts);
|
||||
if (_verbose) { console.log("parts: ", parts); }
|
||||
new_variation_type = productVariationTypes[parts[0].trim()];
|
||||
new_variation = productVariations[parts[1].trim()];
|
||||
objVariations.push({
|
||||
@@ -689,7 +700,7 @@ export default class TableBasePage extends BasePage {
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log("error: invalid variation: ", variation);
|
||||
if (_verbose) { console.log("error: invalid variation: ", variation); }
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -712,6 +723,7 @@ export default class TableBasePage extends BasePage {
|
||||
};
|
||||
}
|
||||
addProductPermutationVariationRow(tbody, permutationVariation) {
|
||||
if (_verbose) { console.log("permutationVariation: ", permutationVariation); }
|
||||
let productVariationType, optionProductVariationTypeJson, optionProductVariationType, productVariation, optionProductVariationJson, optionProductVariation;
|
||||
/*
|
||||
if (Validation.isEmpty(variations)) {
|
||||
@@ -734,7 +746,7 @@ export default class TableBasePage extends BasePage {
|
||||
if (doFilterProductVariationKeys) {
|
||||
productVariationKeys = productVariationKeys.filter(variationKey => !productVariationTypeKeysSelected.has(productVariations[variationKey][attrIdProductVariationType]));
|
||||
}
|
||||
console.log("permutationVariation: ", permutationVariation);
|
||||
|
||||
let permutationVariationJson = permutationVariation[flagProductVariation];
|
||||
let permutationVariationTypeJson = permutationVariation[flagProductVariationType];
|
||||
|
||||
@@ -747,7 +759,7 @@ export default class TableBasePage extends BasePage {
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariationType, permutationVariationTypeJson[attrIdProductVariationType]);
|
||||
|
||||
optionProductVariationType = DOM.createOption(null);
|
||||
console.log("optionProductVariationType: ", optionProductVariationType);
|
||||
if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); }
|
||||
ddlVariationType.appendChild(optionProductVariationType);
|
||||
|
||||
productVariationTypeKeys.forEach((productVariationTypeKey) => {
|
||||
@@ -759,7 +771,7 @@ export default class TableBasePage extends BasePage {
|
||||
productVariationType = productVariationTypes[productVariationTypeKey];
|
||||
optionProductVariationTypeJson = BusinessObjects.getOptionJsonFromObjectJson(productVariationType, permutationVariationTypeJson[attrIdProductVariationType]);
|
||||
optionProductVariationType = DOM.createOption(optionProductVariationTypeJson);
|
||||
console.log("optionProductVariationType: ", optionProductVariationType);
|
||||
if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); }
|
||||
ddlVariationType.appendChild(optionProductVariationType);
|
||||
});
|
||||
|
||||
@@ -772,14 +784,14 @@ export default class TableBasePage extends BasePage {
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariation, permutationVariationJson[attrIdProductVariation]);
|
||||
|
||||
optionProductVariation = DOM.createOption(null);
|
||||
console.log("optionProductVariation: ", optionProductVariation);
|
||||
if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); }
|
||||
ddlVariation.appendChild(optionProductVariation);
|
||||
|
||||
productVariationKeys.forEach((productVariationKey) => {
|
||||
productVariation = productVariations[productVariationKey];
|
||||
optionProductVariationJson = BusinessObjects.getOptionJsonFromObjectJson(productVariation, permutationVariationJson[attrIdProductVariation]);
|
||||
optionProductVariation = DOM.createOption(optionProductVariationJson);
|
||||
console.log("optionProductVariation: ", optionProductVariation);
|
||||
if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); }
|
||||
ddlVariation.appendChild(optionProductVariation);
|
||||
});
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ export default class PageStoreBasket extends BasePage {
|
||||
hookupStoreCardsInfo() {
|
||||
|
||||
document.querySelectorAll(idContainerInfoDelivery).addEventListener("click", function(event) {
|
||||
console.log("delivery modal display method");
|
||||
if (_verbose) { console.log("delivery modal display method"); }
|
||||
document.querySelectorAll(idOverlayInfoDelivery).css('display', 'block');
|
||||
});
|
||||
|
||||
document.querySelectorAll(idContainerInfoBilling).addEventListener("click", function(event) {
|
||||
console.log("billing modal display method");
|
||||
if (_verbose) { console.log("billing modal display method"); }
|
||||
document.querySelectorAll(idOverlayInfoBilling).css('display', 'block');
|
||||
});
|
||||
}
|
||||
@@ -44,7 +44,7 @@ export default class PageStoreBasket extends BasePage {
|
||||
elForm.submit(function(event) {
|
||||
elForm = document.querySelectorAll(elForm);
|
||||
event.preventDefault();
|
||||
console.log("delivery submit method");
|
||||
if (_verbose) { console.log("delivery submit method"); }
|
||||
|
||||
ajaxData = {};
|
||||
ajaxData[keyInfoType] = keyInfoDelivery;
|
||||
@@ -63,7 +63,7 @@ export default class PageStoreBasket extends BasePage {
|
||||
Events.initialiseEventHandler(elForm, flagInitialised, function() {
|
||||
elForm.submit(function(event) {
|
||||
event.preventDefault();
|
||||
console.log("billing submit method");
|
||||
if (_verbose) { console.log("billing submit method"); }
|
||||
|
||||
ajaxData = {};
|
||||
ajaxData[keyInfoType] = keyInfoBilling;
|
||||
@@ -81,7 +81,7 @@ export default class PageStoreBasket extends BasePage {
|
||||
|
||||
loadInfoAddress(response) {
|
||||
|
||||
console.log('ajax:'); console.log(response.data);
|
||||
if (_verbose) { console.log('response:'); console.log(response.data); }
|
||||
let infoType = response.data[keyInfoType];
|
||||
let infoAddress = response.data[infoType];
|
||||
LocalStorage.setLocalStorage(infoType, infoAddress);
|
||||
@@ -119,11 +119,13 @@ export default class PageStoreBasket extends BasePage {
|
||||
elOverlay = document.querySelectorAll(idOverlayInfoDelivery);
|
||||
elForm = elOverlay.querySelector('form');
|
||||
|
||||
console.log('converting billing form to json\nform ID: ' + elForm.id);
|
||||
ajaxData[flagForm] = convertForm2JSON(elForm); // formData; // form.serialize();
|
||||
let keys = [keyNameFull, keyPhoneNumber, keyPostcode, keyAddress1, keyAddress2, keyCity, keyCounty];
|
||||
console.log('ajaxData:');
|
||||
console.log(ajaxData);
|
||||
if (_verbose) {
|
||||
console.log('converting billing form to json\nform ID: ' + elForm.id);
|
||||
console.log('ajaxData:');
|
||||
console.log(ajaxData);
|
||||
}
|
||||
ajaxData[flagForm][keyInfoIdentical] = getElementValueCurrent(elForm.querySelector('#' + keyInfoIdentical));
|
||||
for (var k in keys) {
|
||||
if (idOverlayInfo == idOverlayInfoBilling && ajaxData[flagForm][keyInfoIdentical]) {
|
||||
@@ -132,8 +134,10 @@ export default class PageStoreBasket extends BasePage {
|
||||
ajaxData[flagForm][keys[k]] = getElementValueCurrent(elForm.querySelector('#' + keys[k]));
|
||||
}
|
||||
}
|
||||
console.log('ajaxData:');
|
||||
console.log(ajaxData);
|
||||
if (_verbose) {
|
||||
console.log('ajaxData:');
|
||||
console.log(ajaxData);
|
||||
}
|
||||
return ajaxData;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
let inputCostTotalLocalVatIncl = row.querySelector('td.' + flagCostTotalLocalVatIncl + ' input');
|
||||
let inputPriceTotalLocalVatExcl = row.querySelector('td.' + flagPriceTotalLocalVatExcl + ' input');
|
||||
let inputPriceTotalLocalVatIncl = row.querySelector('td.' + flagPriceTotalLocalVatIncl + ' input');
|
||||
let tdItems = row.querySelector('td.' + flagOrderItems);
|
||||
let trsPurchaseOrderItem = row.querySelectorAll('tr.' + flagOrderItems);
|
||||
let checkboxActive = row.querySelector('td.' + flagActive + ' textarea');
|
||||
|
||||
let jsonRow = {};
|
||||
@@ -47,11 +47,12 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
|
||||
jsonRow[flagPriceTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatExcl);
|
||||
jsonRow[flagPriceTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatIncl);
|
||||
// jsonRow[flagOrderItems] = DOM.getElementAttributeValueCurrent(tdItems);
|
||||
let orderItems = [];
|
||||
trsPurchaseOrderItem.forEach((tr) => {
|
||||
orderItems.push(this.getJsonRowOrderItem(tr));
|
||||
});
|
||||
if (trsPurchaseOrderItem != null) {
|
||||
trsPurchaseOrderItem.forEach((tr) => {
|
||||
orderItems.push(this.getJsonRowOrderItem(tr));
|
||||
});
|
||||
}
|
||||
jsonRow[flagOrderItems] = orderItems;
|
||||
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
|
||||
return jsonRow;
|
||||
@@ -77,8 +78,6 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
jsonRow[attrIdUnitMeasurementQuantity] = DOM.getElementAttributeValueCurrent(tdUnitQuantity);
|
||||
jsonRow[flagQuantityUsed] = DOM.getElementAttributeValueCurrent(inputQuantityUsed);
|
||||
jsonRow[flagQuantityProduced] = DOM.getElementAttributeValueCurrent(inputQuantityProduced);
|
||||
jsonRow[flagCostTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatExcl);
|
||||
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
|
||||
jsonRow[flagLatencyManufacture] = DOM.getElementAttributeValueCurrent(inputLatencyManufacture);
|
||||
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
|
||||
|
||||
@@ -91,11 +90,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
hookupTableMain() {
|
||||
super.hookupTableMain();
|
||||
this.hookupCurrencyFields();
|
||||
this.hookupCostInputs();
|
||||
this.hookupCostAndPriceInputs();
|
||||
this.hookupOrderItemsFields();
|
||||
this.hookupInputsActiveTable();
|
||||
}
|
||||
hookupCostInputs() {
|
||||
hookupCostAndPriceInputs() {
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatExcl + ' input');
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatIncl + ' input');
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPriceTotalLocalVatExcl + ' input');
|
||||
@@ -110,8 +109,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
this.hookupFieldsOrderItemUnitQuantity();
|
||||
this.hookupFieldsOrderItemQuantityUsed();
|
||||
this.hookupFieldsOrderItemQuantityProduced();
|
||||
this.hookupFieldsOrderItemCostTotalLocalVatExcl();
|
||||
this.hookupFieldsOrderItemCostTotalLocalVatIncl();
|
||||
this.hookupFieldsOrderItemUnitMeasurementLatencyManufacture();
|
||||
this.hookupFieldsOrderItemLatencyManufacture();
|
||||
this.hookupFieldsOrderItemActive();
|
||||
this.hookupFieldsOrderItemAddDelete();
|
||||
@@ -124,7 +122,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
});
|
||||
}
|
||||
handleClickOrderItemsPreview(event, element) {
|
||||
console.log("click order items preview");
|
||||
if (_verbose) { console.log("click order items preview"); }
|
||||
this.toggleColumnHeaderCollapsed(flagOrderItems, false);
|
||||
element.classList.remove(flagCollapsed);
|
||||
|
||||
@@ -154,10 +152,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
thUnitQuantity.textContent = 'Unit Quantity';
|
||||
let thQuantityUsed = document.createElement("th");
|
||||
thQuantityUsed.classList.add(flagQuantityUsed);
|
||||
thQuantityUsed.textContent = 'Quantity Ordered';
|
||||
thQuantityUsed.textContent = 'Quantity Used';
|
||||
let thQuantityProduced = document.createElement("th");
|
||||
thQuantityProduced.classList.add(flagQuantityProduced);
|
||||
thQuantityProduced.textContent = 'Quantity Received';
|
||||
thQuantityProduced.textContent = 'Quantity Produced';
|
||||
/*
|
||||
let thCostTotalLocalVatExcl = document.createElement("th");
|
||||
thCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl);
|
||||
thCostTotalLocalVatExcl.textContent = 'Cost Total Local VAT Excl';
|
||||
@@ -170,9 +169,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
let thCostUnitLocalVatIncl = document.createElement("th");
|
||||
thCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
|
||||
thCostUnitLocalVatIncl.textContent = 'Cost Unit Local VAT Incl';
|
||||
*/
|
||||
let thUnitMeasurementLatencyManufacture = document.createElement("th");
|
||||
thUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
|
||||
thUnitMeasurementLatencyManufacture.textContent = 'Unit Measurement Latency Manufacture';
|
||||
let thLatencyManufacture = document.createElement("th");
|
||||
thLatencyManufacture.classList.add(flagLatencyManufacture);
|
||||
thLatencyManufacture.textContent = 'Latency Delivery (Days)';
|
||||
thLatencyManufacture.textContent = 'Latency Manufacture';
|
||||
let thActive = document.createElement("th");
|
||||
thActive.classList.add(flagActive);
|
||||
thActive.textContent = 'Active';
|
||||
@@ -190,10 +193,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
tr.appendChild(thUnitQuantity);
|
||||
tr.appendChild(thQuantityUsed);
|
||||
tr.appendChild(thQuantityProduced);
|
||||
/*
|
||||
tr.appendChild(thCostTotalLocalVatExcl);
|
||||
tr.appendChild(thCostTotalLocalVatIncl);
|
||||
tr.appendChild(thCostUnitLocalVatExcl);
|
||||
tr.appendChild(thCostUnitLocalVatIncl);
|
||||
*/
|
||||
tr.appendChild(thUnitMeasurementLatencyManufacture);
|
||||
tr.appendChild(thLatencyManufacture);
|
||||
tr.appendChild(thActive);
|
||||
tr.appendChild(thAddDelete);
|
||||
@@ -210,11 +216,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
let cellNew = cell.cloneNode(false);
|
||||
cellNew.appendChild(tblOrderItems);
|
||||
row.replaceChild(cellNew, cell);
|
||||
console.log("tblOrderItems: ", tblOrderItems);
|
||||
if (_verbose) { console.log("tblOrderItems: ", tblOrderItems); }
|
||||
this.hookupOrderItemsFields();
|
||||
}
|
||||
addRowManufacturingPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions,
|
||||
console.log("addRowManufacturingPurchaseOrderItem: ", orderItem);
|
||||
if (_verbose) { console.log("addRowManufacturingPurchaseOrderItem: ", orderItem); }
|
||||
|
||||
let tdDisplayOrder = document.createElement("td");
|
||||
tdDisplayOrder.classList.add(flagDisplayOrder);
|
||||
@@ -245,6 +251,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
|
||||
let tdVariations = document.createElement("td");
|
||||
tdVariations.classList.add(flagProductVariations);
|
||||
tdVariations.classList.add(flagCollapsed);
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductCategory]);
|
||||
let divVariations = document.createElement("div");
|
||||
divVariations.classList.add(flagProductVariations);
|
||||
@@ -276,6 +283,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(inputQuantityProduced, orderItem[flagQuantityProduced]);
|
||||
tdQuantityProduced.appendChild(inputQuantityProduced);
|
||||
|
||||
/*
|
||||
let tdCostTotalLocalVatExcl = document.createElement("td");
|
||||
tdCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl);
|
||||
let inputCostTotalLocalVatExcl = document.createElement("input");
|
||||
@@ -307,7 +315,16 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl]);
|
||||
tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl);
|
||||
*/
|
||||
|
||||
let tdUnitMeasurementLatencyManufacture = document.createElement("td");
|
||||
tdUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(tdUnitMeasurementLatencyManufacture, orderItem[attrIdUnitMeasurementLatencyManufacture]);
|
||||
let divUnitMeasurementLatencyManufacture = document.createElement("div");
|
||||
divUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
|
||||
// DOM.setElementValuesCurrentAndPrevious(divUnitMeasurementLatencyManufacture, orderItem[flagUnitMeasurementLatencyManufacture]);
|
||||
tdUnitMeasurementLatencyManufacture.appendChild(divUnitMeasurementLatencyManufacture);
|
||||
|
||||
let tdLatencyManufacture = document.createElement("td");
|
||||
tdLatencyManufacture.classList.add(flagLatencyManufacture);
|
||||
let inputLatencyManufacture = document.createElement("input");
|
||||
@@ -343,10 +360,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
tr.appendChild(tdUnitQuantity);
|
||||
tr.appendChild(tdQuantityUsed);
|
||||
tr.appendChild(tdQuantityProduced);
|
||||
/*
|
||||
tr.appendChild(tdCostTotalLocalVatExcl);
|
||||
tr.appendChild(tdCostTotalLocalVatIncl);
|
||||
tr.appendChild(tdCostUnitLocalVatExcl);
|
||||
tr.appendChild(tdCostUnitLocalVatIncl);
|
||||
*/
|
||||
tr.appendChild(tdUnitMeasurementLatencyManufacture);
|
||||
tr.appendChild(tdLatencyManufacture);
|
||||
tr.appendChild(tdActive);
|
||||
tr.appendChild(tdDelete);
|
||||
@@ -368,9 +388,6 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
hookupFieldsOrderItemProductVariations() {
|
||||
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element));
|
||||
}
|
||||
handleChangeElementProductVariationsSubtableCell(event, element) {
|
||||
this.handleChangeNestedElementCellTable(event, element); // , flagProductVariations);
|
||||
}
|
||||
hookupFieldsOrderItemUnitQuantity() {
|
||||
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements));
|
||||
}
|
||||
@@ -380,6 +397,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
hookupFieldsOrderItemQuantityProduced() {
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagQuantityProduced + ' input');
|
||||
}
|
||||
/*
|
||||
hookupFieldsOrderItemPriceTotalLocalVatExcl() {
|
||||
this.hookupChangeHandlerTableCells(
|
||||
idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceTotalLocalVatExcl + ' input'
|
||||
@@ -438,6 +456,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
hookupFieldsOrderItemPriceUnitLocalVatIncl() {
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceUnitLocalVatIncl + ' input');
|
||||
}
|
||||
*/
|
||||
hookupFieldsOrderItemUnitMeasurementLatencyManufacture() {
|
||||
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementLatencyManufacture, Utils.getListFromDict(unitMeasurementsTime));
|
||||
}
|
||||
@@ -459,11 +478,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => {
|
||||
let row = element.closest(idTableMain + ' > tbody > tr');
|
||||
let idManufacturingPurchaseOrder = row.getAttribute(attrIdManufacturingPurchaseOrder);
|
||||
let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
|
||||
let countManufacturingOrderItemes = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagManufacturingPurchaseOrder).length;
|
||||
// let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
|
||||
let countManufacturingOrderItems = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagManufacturingPurchaseOrder).length;
|
||||
let manufacturingPurchaseOrderItem = {
|
||||
[attrIdManufacturingPurchaseOrder]: idManufacturingPurchaseOrder,
|
||||
[attrIdManufacturingPurchaseOrderProductLink]: -1 - countManufacturingOrderItemes,
|
||||
[attrIdManufacturingPurchaseOrderProductLink]: -1 - countManufacturingOrderItems,
|
||||
[attrIdProductCategory]: 0,
|
||||
[attrIdProduct]: 0,
|
||||
[flagProductVariations]: '',
|
||||
@@ -473,10 +492,10 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
|
||||
[attrIdUnitMeasurementLatencyManufacture]: 0,
|
||||
[flagLatencyManufacture]: '',
|
||||
[flagDisplayOrder]: countManufacturingOrderItems + 1,
|
||||
[flagActive]: !hasActiveOrderItem,
|
||||
[flagActive]: true, // !hasActiveOrderItem,
|
||||
};
|
||||
let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody');
|
||||
this.addRowManufacturingOrderItem(tbody, manufacturingPurchaseOrderItem);
|
||||
this.addRowManufacturingPurchaseOrderItem(tbody, manufacturingPurchaseOrderItem);
|
||||
/*
|
||||
if (!hasActiveOrderItem) {
|
||||
let tdOrderItem = row.querySelector('td.' + flagOrderItems);
|
||||
|
||||
@@ -65,7 +65,7 @@ export default class StoreMixinPage {
|
||||
});
|
||||
dropdownCurrency.addEventListener("change", function() {
|
||||
let selectedCurrency = dropdownCurrency.val();
|
||||
console.log("selected currency: ", selectedCurrency);
|
||||
if (_verbose) { console.log("selected currency: ", selectedCurrency); }
|
||||
let basket = LocalStorage.getLocalStorage(keyBasket);
|
||||
basket[keyIdCurrency] = selectedCurrency;
|
||||
// LocalStorage.setLocalStorage(keyIdCurrency, selectedCurrency);
|
||||
@@ -109,17 +109,17 @@ export default class StoreMixinPage {
|
||||
Events.initialiseEventHandler(dropdownRegion, flagInitialised, function() {
|
||||
dropdownRegion = document.querySelectorAll(dropdownRegion);
|
||||
dropdownRegion.addEventListener("focus", function() {
|
||||
console.log("dropdown region focused");
|
||||
if (_verbose) { console.log("dropdown region focused"); }
|
||||
handleSelectExpand(dropdownRegion);
|
||||
});
|
||||
dropdownRegion.addEventListener("blur", function() {
|
||||
console.log("dropdown region blurred");
|
||||
if (_verbose) { console.log("dropdown region blurred"); }
|
||||
handleSelectCollapse(dropdownRegion);
|
||||
});
|
||||
dropdownRegion.addEventListener("change", function() {
|
||||
handleSelectCollapse(dropdownRegion);
|
||||
let selectedRegion = dropdownRegion.val();
|
||||
console.log("selected region: ", selectedRegion);
|
||||
if (_verbose) { console.log("selected region: ", selectedRegion); }
|
||||
let basket = LocalStorage.getLocalStorage(keyBasket);
|
||||
basket[keyIdRegionDelivery] = selectedRegion;
|
||||
// LocalStorage.setLocalStorage(keyIdRegionDelivery, selectedRegion);
|
||||
@@ -138,10 +138,13 @@ export default class StoreMixinPage {
|
||||
elSelector.addEventListener("change", function(event) {
|
||||
ajaxData = {};
|
||||
ajaxData[flagForm] = convertForm2JSON(elForm);
|
||||
console.log('sending data to include VAT controller: '); console.log(ajaxData);
|
||||
if (_verbose) {
|
||||
console.log('sending data to include VAT controller: ');
|
||||
console.log(ajaxData);
|
||||
}
|
||||
ajaxJSONData('set include VAT', mapHashToController(hashStoreSetIsIncludedVAT), ajaxData, function() { window.location.reload() }, false);
|
||||
});
|
||||
console.log("form is included VAT initialised")
|
||||
if (_verbose) { console.log("form is included VAT initialised"); }
|
||||
});
|
||||
}
|
||||
hookupLocalStorage() {
|
||||
@@ -153,7 +156,7 @@ export default class StoreMixinPage {
|
||||
// console.log('d:'); console.log(d);
|
||||
let basketLocalStorage = LocalStorage.getLocalStorage(keyBasket);
|
||||
if (!StoreMixinPage.validateBasket(basketLocalStorage)) {
|
||||
console.log('locally-stored basket not valid');
|
||||
if (_verbose) { console.log('locally-stored basket not valid'); }
|
||||
basketLocalStorage = StoreMixinPage.makeNewBasket();
|
||||
}
|
||||
let basketServer = StoreMixinPage.validateBasket(userBasket) ? userBasket : basketLocalStorage;
|
||||
@@ -216,7 +219,7 @@ export default class StoreMixinPage {
|
||||
this.hookupDeleteBasketItemButtons();
|
||||
}
|
||||
toggleShowButtonCheckout() {
|
||||
console.log("toggling checkout button");
|
||||
if (_verbose) { console.log("toggling checkout button"); }
|
||||
const buttonCheckout = document.querySelectorAll(idButtonCheckout);
|
||||
const labelBasketEmpty = document.querySelectorAll(idLabelBasketEmpty);
|
||||
if (userBasket['items'].length == 0) {
|
||||
@@ -228,7 +231,7 @@ export default class StoreMixinPage {
|
||||
}
|
||||
}
|
||||
hookupButtonCheckout() {
|
||||
console.log("hooking up checkout button");
|
||||
if (_verbose) { console.log("hooking up checkout button"); }
|
||||
const buttonCheckout = document.querySelectorAll(idButtonCheckout);
|
||||
// let lsPage = getPageLocalStorage(hashPageCurrent);
|
||||
Events.initialiseEventHandler(buttonCheckout, flagInitialised, function() {
|
||||
@@ -383,7 +386,7 @@ export default class StoreMixinPage {
|
||||
getCurrencySelected() {
|
||||
let elementSelectorCurrency = document.querySelectorAll(idSelectorCurrency);
|
||||
let selectedCurrency = elementSelectorCurrency.val();
|
||||
console.log("selected currency: ", selectedCurrency);
|
||||
if (_verbose) { console.log("selected currency: ", selectedCurrency); }
|
||||
return selectedCurrency;
|
||||
}
|
||||
|
||||
@@ -392,13 +395,15 @@ export default class StoreMixinPage {
|
||||
let d; // , lsShared;
|
||||
let selectorCardProduct = '.card.subcard';
|
||||
Events.initialiseEventHandler(selectorCardProduct, flagInitialised, function(cardProduct) {
|
||||
console.log("initialising product card: ", cardProduct);
|
||||
if (_verbose) { console.log("initialising product card: ", cardProduct); }
|
||||
cardProduct.addEventListener("click", function(event) {
|
||||
// d = { keyIdProduct: product.getAttribute(attrIdProduct) }
|
||||
var elemClicked = event.target;
|
||||
if (elemClicked.id != 'submit') { // disable for submit buttons
|
||||
console.log("product click: " + cardProduct.getAttribute(attrIdProduct));
|
||||
console.log("permutation click: " + cardProduct.getAttribute(attrIdPermutation));
|
||||
if (_verbose) {
|
||||
console.log("product click: " + cardProduct.getAttribute(attrIdProduct));
|
||||
console.log("permutation click: " + cardProduct.getAttribute(attrIdPermutation));
|
||||
}
|
||||
var d = {}
|
||||
d[keyIdProduct] = cardProduct.getAttribute(attrIdProduct)
|
||||
d[keyIdPermutation] = cardProduct.getAttribute(attrIdPermutation)
|
||||
@@ -406,7 +411,7 @@ export default class StoreMixinPage {
|
||||
goToPage(hashPageStoreProduct, d);
|
||||
}
|
||||
});
|
||||
console.log("click method added for product ID: " + cardProduct.getAttribute(attrIdProduct) + ', permutation ID: ', cardProduct.getAttribute(attrIdPermutation));
|
||||
if (_verbose) { console.log("click method added for product ID: " + cardProduct.getAttribute(attrIdProduct) + ', permutation ID: ', cardProduct.getAttribute(attrIdPermutation)); }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ export default class PageStoreProductCategories extends TableBasePage {
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
if (rowJson == null) return;
|
||||
if (_verbose) { console.log("applying data row: ", rowJson); }
|
||||
let row = _rowBlank.cloneNode(true);
|
||||
row.classList.remove(flagRowNew);
|
||||
row.classList.remove(flagInitialised);
|
||||
row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
|
||||
element.classList.remove(flagInitialised);
|
||||
});
|
||||
console.log("applying data row: ", rowJson);
|
||||
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
|
||||
let textareaCode = row.querySelector('td.' + flagCode + ' textarea');
|
||||
let textareaName = row.querySelector('td.' + flagName + ' textarea');
|
||||
@@ -75,13 +75,13 @@ export default class PageStoreProductCategories extends TableBasePage {
|
||||
|
||||
let jsonCategory = {};
|
||||
jsonCategory[attrIdProductCategory] = row.getAttribute(attrIdProductCategory);
|
||||
jsonCategory[flagCode] = DOM.getElementValueCurrent(textareaCode);
|
||||
jsonCategory[flagName] = DOM.getElementValueCurrent(textareaName);
|
||||
jsonCategory[flagDescription] = DOM.getElementValueCurrent(textareaDescription);
|
||||
jsonCategory[flagCode] = DOM.getElementAttributeValueCurrent(textareaCode);
|
||||
jsonCategory[flagName] = DOM.getElementAttributeValueCurrent(textareaName);
|
||||
jsonCategory[flagDescription] = DOM.getElementAttributeValueCurrent(textareaDescription);
|
||||
// jsonCategory[flagAccessLevelRequired] = tdAccessLevel.getAttribute(flagAccessLevelRequired);
|
||||
jsonCategory[attrIdAccessLevel] = DOM.getElementValueCurrent(tdAccessLevel);
|
||||
jsonCategory[flagActive] = DOM.getElementValueCurrent(inputActive);
|
||||
jsonCategory[flagDisplayOrder] = sliderDisplayOrder.getAttribute(attrValueCurrent);
|
||||
jsonCategory[attrIdAccessLevel] = DOM.getElementAttributeValueCurrent(tdAccessLevel);
|
||||
jsonCategory[flagActive] = DOM.getElementAttributeValueCurrent(inputActive);
|
||||
jsonCategory[flagDisplayOrder] = DOM.getElementAttributeValueCurrent(sliderDisplayOrder);
|
||||
return jsonCategory;
|
||||
}
|
||||
initialiseRowNew(row) {
|
||||
|
||||
@@ -67,12 +67,12 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
}
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
/*
|
||||
if (rowJson == null) return;
|
||||
if (_verbose) { console.log("applying data row: ", rowJson); }
|
||||
/*
|
||||
let tableMain = TableBasePage.getTableMain();
|
||||
let row = _rowBlank.cloneNode(true);
|
||||
row.classList.remove(flagRowNew);
|
||||
console.log("applying data row: ", rowJson);
|
||||
let dllCategory = row.querySelector('td.' + flagProductCategory + ' select');
|
||||
dllCategory.value = rowJson[attrIdProductCategory];
|
||||
let ddlProduct = row.querySelector('td.' + flagProduct + ' select');
|
||||
@@ -130,7 +130,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
let tdProduct = row.querySelector('td.' + flagProduct);
|
||||
let tdProductVariations = row.querySelector('td.' + flagProductVariations);
|
||||
let inputDescription = row.querySelector('td.' + flagDescription + ' textarea');
|
||||
let inputCostLocal = row.querySelector('td.' + flagCostLocal + ' input');
|
||||
let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input');
|
||||
let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input');
|
||||
let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost);
|
||||
let inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input');
|
||||
let inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input');
|
||||
@@ -155,7 +156,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent);
|
||||
jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != '';
|
||||
jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent);
|
||||
jsonRow[flagCostLocal] = inputCostLocal.getAttribute(attrValueCurrent);
|
||||
jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent);
|
||||
jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent);
|
||||
jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent);
|
||||
jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent);
|
||||
jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent);
|
||||
@@ -181,8 +183,10 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct);
|
||||
let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter);
|
||||
let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0');
|
||||
console.log("initialiseRowNew: ", row);
|
||||
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
|
||||
if (_verbose) {
|
||||
console.log("initialiseRowNew: ", row);
|
||||
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
|
||||
}
|
||||
if (!hasCategoryFilter && !hasProductFilter) return;
|
||||
if (hasCategoryFilter) {
|
||||
let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select');
|
||||
@@ -231,7 +235,10 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrencyCost, Utils.getListFromDict(currencies));
|
||||
}
|
||||
hookupCostInputs(){
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostLocal + ' input');
|
||||
/*
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatExcl + ' input');
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatIncl + ' input');
|
||||
*/
|
||||
}
|
||||
hookupProfitFields(){
|
||||
// this.hookupCurrencyProfitFields();
|
||||
@@ -268,7 +275,6 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCountUnitMeasurementPerQuantityStep + ' input');
|
||||
}
|
||||
hookupUnitMeasurementQuantityFields() {
|
||||
console.log("hooking up unit measurement quantity fields");
|
||||
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements));
|
||||
}
|
||||
hookupSubscriptionFields() {
|
||||
|
||||
@@ -40,7 +40,6 @@ export default class PageStoreProducts extends TableBasePage {
|
||||
row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
|
||||
element.classList.remove(flagInitialised);
|
||||
});
|
||||
console.log("applying data row: ", rowJson);
|
||||
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
|
||||
let tdProductCategory = row.querySelector('td.' + flagProductCategory);
|
||||
let divProductCategory = tdProductCategory.querySelector('div.' + flagProductCategory);
|
||||
|
||||
@@ -115,8 +115,10 @@ export default class PageStoreStockItems extends TableBasePage {
|
||||
let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct);
|
||||
let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter);
|
||||
let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0');
|
||||
console.log("initialiseRowNew: ", row);
|
||||
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
|
||||
if (_verbose) {
|
||||
console.log("initialiseRowNew: ", row);
|
||||
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
|
||||
}
|
||||
if (!hasCategoryFilter && !hasProductFilter) return;
|
||||
if (hasCategoryFilter) {
|
||||
let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select');
|
||||
@@ -222,7 +224,7 @@ export default class PageStoreStockItems extends TableBasePage {
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(ddlPlant, plantJson[attrIdPlant]);
|
||||
|
||||
optionPlant = DOM.createOption(null);
|
||||
console.log("optionPlant: ", optionPlant);
|
||||
if (_verbose) { console.log("optionPlant: ", optionPlant); }
|
||||
ddlPlant.appendChild(optionPlant);
|
||||
|
||||
plantKeys.forEach((plantKey) => {
|
||||
@@ -232,7 +234,7 @@ export default class PageStoreStockItems extends TableBasePage {
|
||||
valueSelected = plantJson[attrIdPlant]
|
||||
);
|
||||
optionPlant = DOM.createOption(optionPlantJson);
|
||||
console.log("optionPlant: ", optionPlant);
|
||||
if (_verbose) { console.log("optionPlant: ", optionPlant); }
|
||||
ddlPlant.appendChild(optionPlant);
|
||||
});
|
||||
|
||||
@@ -245,7 +247,7 @@ export default class PageStoreStockItems extends TableBasePage {
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(ddlStorageLocation, storageLocationJson[attrIdStorageLocation]);
|
||||
|
||||
optionStorageLocation = DOM.createOption(null);
|
||||
console.log("optionStorageLocation: ", optionStorageLocation);
|
||||
if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); }
|
||||
ddlStorageLocation.appendChild(optionStorageLocation);
|
||||
|
||||
StorageLocationKeys.forEach((StorageLocationKey) => {
|
||||
@@ -255,7 +257,7 @@ export default class PageStoreStockItems extends TableBasePage {
|
||||
valueSelected = storageLocationJson[attrIdStorageLocation]
|
||||
);
|
||||
optionStorageLocation = DOM.createOption(optionStorageLocationJson);
|
||||
console.log("optionStorageLocation: ", optionStorageLocation);
|
||||
if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); }
|
||||
ddlStorageLocation.appendChild(optionStorageLocation);
|
||||
});
|
||||
|
||||
@@ -270,12 +272,12 @@ export default class PageStoreStockItems extends TableBasePage {
|
||||
let parent = element.parentElement;
|
||||
parent.innerHTML = '';
|
||||
parent.appendChild(tblStorageLocation);
|
||||
console.log("tblStorageLocation: ", tblStorageLocation);
|
||||
if (_verbose) { console.log("tblStorageLocation: ", tblStorageLocation); }
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPlant + ' select', (event, element) => { this.handleChangeStoragePlantDdl(event, element); });
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagStorageLocation + ' select', (event, element) => { this.handleChangeStorageLocationDdl(event, element); });
|
||||
}
|
||||
handleChangeStoragePlantDdl(event, ddlPlant) {
|
||||
this.handleChangeTableCellDdl(event, ddlPlant);
|
||||
this.handleChangeNestedElementCellTable(event, ddlPlant);
|
||||
let row = DOM.getRowFromElement(ddlPlant);
|
||||
let ddlStorageLocation = row.querySelector('td.' + flagStorageLocation + ' select');
|
||||
ddlStorageLocation.innerHTML = '';
|
||||
@@ -288,10 +290,10 @@ export default class PageStoreStockItems extends TableBasePage {
|
||||
option = DOM.createOption(optionJson);
|
||||
ddlStorageLocation.appendChild(option);
|
||||
});
|
||||
this.handleChangeTableCellDdl(event, ddlStorageLocation);
|
||||
this.handleChangeNestedElementCellTable(event, ddlStorageLocation);
|
||||
}
|
||||
handleChangeStorageLocationDdl(event, ddlStorageLocation) {
|
||||
this.handleChangeTableCellDdl(event, ddlStorageLocation);
|
||||
this.handleChangeNestedElementCellTable(event, ddlStorageLocation);
|
||||
}
|
||||
|
||||
hookupSealingInputs() {
|
||||
|
||||
@@ -129,7 +129,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
});
|
||||
}
|
||||
handleClickOrderItemsPreview(event, element) {
|
||||
console.log("click order items preview");
|
||||
if (_verbose) { console.log("click order items preview"); }
|
||||
this.toggleColumnHeaderCollapsed(flagOrderItems, false);
|
||||
element.classList.remove(flagCollapsed);
|
||||
|
||||
@@ -216,11 +216,11 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
let cellNew = cell.cloneNode(false);
|
||||
cellNew.appendChild(tblOrderItems);
|
||||
row.replaceChild(cellNew, cell);
|
||||
console.log("tblOrderItems: ", tblOrderItems);
|
||||
if (_verbose) { console.log("tblOrderItems: ", tblOrderItems); }
|
||||
this.hookupOrderItemsFields();
|
||||
}
|
||||
addRowSupplierPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions,
|
||||
console.log("addRowSupplierPurchaseOrderItem: ", orderItem);
|
||||
if (_verbose) { console.log("addRowSupplierPurchaseOrderItem: ", orderItem); }
|
||||
|
||||
let tdDisplayOrder = document.createElement("td");
|
||||
tdDisplayOrder.classList.add(flagDisplayOrder);
|
||||
@@ -255,6 +255,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
|
||||
let tdVariations = document.createElement("td");
|
||||
tdVariations.classList.add(flagProductVariations);
|
||||
tdVariations.classList.add(flagCollapsed);
|
||||
DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductVariation]);
|
||||
let divVariations = document.createElement("div");
|
||||
divVariations.classList.add(flagProductVariations);
|
||||
@@ -312,14 +313,14 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
tdCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl);
|
||||
let divCostUnitLocalVatExcl = document.createElement("div");
|
||||
divCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl);
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, orderItem[flagCostUnitLocalVatExcl]);
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, orderItem[flagCostUnitLocalVatExcl].toFixed(3));
|
||||
tdCostUnitLocalVatExcl.appendChild(divCostUnitLocalVatExcl);
|
||||
|
||||
let tdCostUnitLocalVatIncl = document.createElement("td");
|
||||
tdCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
|
||||
let divCostUnitLocalVatIncl = document.createElement("div");
|
||||
divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl]);
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl].toFixed(3));
|
||||
tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl);
|
||||
|
||||
let tdLatencyDeliveryDays = document.createElement("td");
|
||||
@@ -384,20 +385,11 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element));
|
||||
}
|
||||
*/
|
||||
handleChangeElementProductVariationsSubtableCell(event, element) {
|
||||
this.handleChangeNestedElementCellTable(event, element); // flagProductVariations);
|
||||
}
|
||||
hookupDdlsProductPermutationVariation() {
|
||||
this.hookupTableCellDdls(
|
||||
idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation
|
||||
, (event, element) => { this.handleChangeElementProductVariationsSubtableCell(event, element); }
|
||||
);
|
||||
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation);
|
||||
}
|
||||
hookupDdlsProductPermutationVariationType() {
|
||||
this.hookupTableCellDdls(
|
||||
idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType
|
||||
, (event, element) => { this.handleChangeElementProductVariationsSubtableCell(event, element); }
|
||||
);
|
||||
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType);
|
||||
}
|
||||
hookupFieldsOrderItemUnitQuantity() {
|
||||
this.hookupTableCellDdlPreviews(
|
||||
@@ -442,7 +434,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
|
||||
let divCostUnitLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' div');
|
||||
let costUnitLocalVatExcl = quantityOrdered == 0 ? 0 : costTotalLocalVatExcl / quantityOrdered;
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, costUnitLocalVatExcl);
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, costUnitLocalVatExcl.toFixed(3));
|
||||
|
||||
let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr');
|
||||
let divCostGrandTotalLocalVatExcl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatExcl + ' div');
|
||||
@@ -459,7 +451,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
|
||||
let divCostUnitLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' div');
|
||||
let costUnitLocalVatIncl = quantityOrdered == 0 ? 0 : costTotalLocalVatIncl / quantityOrdered;
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, costUnitLocalVatIncl);
|
||||
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, costUnitLocalVatIncl.toFixed(3));
|
||||
|
||||
let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr');
|
||||
let divCostGrandTotalLocalVatIncl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatIncl + ' div');
|
||||
@@ -485,7 +477,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => {
|
||||
let row = element.closest(idTableMain + ' > tbody > tr');
|
||||
let idSupplierPurchaseOrder = row.getAttribute(attrIdSupplierPurchaseOrder);
|
||||
let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
|
||||
// let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
|
||||
let countSupplierOrderItems = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagSupplierPurchaseOrder).length;
|
||||
let supplierOrderItem = {
|
||||
[attrIdSupplierPurchaseOrder]: idSupplierPurchaseOrder,
|
||||
@@ -502,7 +494,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
|
||||
[flagCostUnitLocalVatIncl]: '',
|
||||
[flagLatencyDeliveryDays]: '',
|
||||
[flagDisplayOrder]: countSupplierOrderItems + 1,
|
||||
[flagActive]: !hasActiveOrderItem,
|
||||
[flagActive]: true, // !hasActiveOrderItem,
|
||||
};
|
||||
let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody');
|
||||
this.addRowSupplierPurchaseOrderItem(tbody, supplierOrderItem);
|
||||
|
||||
@@ -132,7 +132,7 @@ export default class PageStoreSuppliers extends TableBasePage {
|
||||
});
|
||||
}
|
||||
handleClickAddressPreview(event, element) {
|
||||
console.log("click address preview");
|
||||
if (_verbose) { console.log("click address preview"); }
|
||||
this.toggleColumnHeaderCollapsed(flagAddress, false);
|
||||
element.classList.remove(flagCollapsed);
|
||||
let row = DOM.getRowFromElement(element);
|
||||
@@ -192,11 +192,11 @@ export default class PageStoreSuppliers extends TableBasePage {
|
||||
let cellNew = cell.cloneNode(false);
|
||||
cellNew.appendChild(tblAddresses);
|
||||
row.replaceChild(cellNew, cell);
|
||||
console.log("tblAddresses: ", tblAddresses);
|
||||
if (_verbose) { console.log("tblAddresses: ", tblAddresses); }
|
||||
this.hookupAddressFields();
|
||||
}
|
||||
addRowSupplierAddress(tbody, supplierAddress, regionOptions) {
|
||||
console.log("addRowSupplierAddress: ", supplierAddress);
|
||||
if (_verbose) { console.log("addRowSupplierAddress: ", supplierAddress); }
|
||||
let tdPostcode = document.createElement("td");
|
||||
tdPostcode.classList.add(flagPostcode);
|
||||
let textareaPostcode = document.createElement("textarea");
|
||||
@@ -279,28 +279,25 @@ export default class PageStoreSuppliers extends TableBasePage {
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
hookupAddressPostcodeInputs() {
|
||||
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagPostcode);
|
||||
}
|
||||
handleChangeElementAddressSubtableCells(event, element) {
|
||||
this.handleChangeNestedElementCellTable(event, element); // flagAddress);
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagPostcode);
|
||||
}
|
||||
hookupAddressLine1Inputs() {
|
||||
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine1);
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine1);
|
||||
}
|
||||
hookupAddressLine2Inputs() {
|
||||
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine2);
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine2);
|
||||
}
|
||||
hookupAddressCityInputs() {
|
||||
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCity);
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCity);
|
||||
}
|
||||
hookupAddressCountyInputs() {
|
||||
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCounty);
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCounty);
|
||||
}
|
||||
hookupAddressRegionDdls() {
|
||||
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' select.' + flagRegion);
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' select.' + flagRegion);
|
||||
}
|
||||
hookupAddressActiveCheckboxes() {
|
||||
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' input.' + flagActive, (event, element) => {
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' input.' + flagActive, (event, element) => {
|
||||
let rowSupplierAddress = element.closest('tr');
|
||||
let idAddress = rowSupplierAddress.getAttribute(attrIdSupplierAddress);
|
||||
DOM.setElementAttributeValueCurrent(rowSupplierAddress, idAddress);
|
||||
|
||||
@@ -143,7 +143,7 @@ export default class Router {
|
||||
return module; // [pageJson.name];
|
||||
}
|
||||
catch (error) {
|
||||
console.log("this.pages: ", this.pages);
|
||||
if (_verbose) { console.log("this.pages: ", this.pages); };
|
||||
console.error('Page not found:', hashPage);
|
||||
throw error;
|
||||
}
|
||||
@@ -169,7 +169,6 @@ export default class Router {
|
||||
// this.beforeLeave();
|
||||
/*
|
||||
if (this.routes[hash]) {
|
||||
console.log("navigating to hash: " + hash);
|
||||
this.routes[hash](isPopState);
|
||||
} else {
|
||||
console.error(`Hash ${hash} not found`);
|
||||
@@ -323,7 +322,6 @@ export default class Router {
|
||||
*/
|
||||
|
||||
static loadPageBodyFromResponse(response) {
|
||||
console.log(response.data);
|
||||
DOM.loadPageBody(response.data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user