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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user