"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[144],{243:(e,t,o)=>{o.d(t,{v:()=>c});var n=o(595),a=o(143),i=o(402);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function l(e,t){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null==t&&(t=document.querySelector("form."+flagFilter+" button."+flagSave)),null==o&&(o=document.querySelector("form."+flagFilter+" button."+flagCancel)),e?(o.classList.remove(flagCollapsed),t.classList.remove(flagCollapsed)):(o.classList.add(flagCollapsed),t.classList.add(flagCollapsed))}}],r=[{key:"isDirtyFilter",value:function(e){var t=a.A.isElementDirty(e);return t&&document.querySelectorAll(idTableMain+" tbody tr").remove(),t}}],o&&l(t.prototype,o),r&&l(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,o,r}()},144:(e,t,o)=>{o.r(t),o.d(t,{PageStoreProductCategories:()=>L});var n=o(243),a=o(143);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function r(e,t){for(var o=0;o0&&void 0!==arguments[0]&&arguments[0];if(this.constructor===t)throw new Error("Must implement initialize() method.");if(o){var n=this.getLocalStoragePage()[flagFormFilters],i=this.getFormFilters(),r=a.A.convertForm2JSON(i);areEqualDicts(n,r)}else this.sharedInitialize(),this.hookupFilters(),this.hookupButtonsAddSaveCancel(),this.hookupTableMain(),hookupOverlayConfirm((function(){e.leave(),e.saveRecordsTableDirty()}))}},{key:"hookupFilters",value:function(){if(this.constructor===t)throw new Error("Subclass of TableBasePage must implement method hookupFilters().");this.hookupButtonApplyFilters()}},{key:"hookupFilterActive",value:function(){initialiseEventHandler(idFormFilters+"."+flagActive,flagInitialised,(function(e){e.addEventListener("change",(function(o){t.isDirtyFilter(e)}))}))}},{key:"hookupButtonApplyFilters",value:function(){var e=this;initialiseEventHandler(idButtonApplyFilters,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation(),e.getAndLoadFilteredTableContent()}))}))}},{key:"getAndLoadFilteredTableContent",value:function(){var e=this.getFormFilters(),t=a.A.convertForm2JSON(e);this.callFilterTableContent(t).catch((function(e){return console.error("Error:",e)}))}},{key:"getFormFilters",value:function(){return document.querySelector(idFormFilters)}},{key:"callbackLoadTableContent",value:function(e){this.getTableMain().querySelector("tbody").querySelectorAll("tr").forEach((function(e){e.remove()}));var t=e.data[flagRows];!isEmpty(t)&&t.every((function(e){return e.hasOwnProperty("display_order")}))&&(t=t.sort((function(e,t){return e.display_order-t.display_order}))),t.forEach(this.loadRowTable.bind(this)),this.hookupTableMain()}},{key:"getTableMain",value:function(){return document.querySelector(idTableMain)}},{key:"loadRowTable",value:function(e){throw new Error("Subclass of TableBasePage must implement method loadRowTable().")}},{key:"hookupButtonsAddSaveCancel",value:function(){this.hookupButtonSave(),this.hookupButtonCancel(),this.hookupButtonAddRowTable()}},{key:"saveRecordsTableDirty",value:function(){var e=this,t=this.getTableRecords(!0);if(0!=t.length){var o=this.getFormFilters(),n=a.A.getElementValueCurrent(document.querySelector(idTextareaConfirm));this.callSaveTableContent(t,o,n).then((function(t){t[flagStatus]==flagSuccess?(console.log("Data received:",t),e.callbackLoadTableContent(t),console.log("Records saved!")):showOverlayError(t[flagMessage])})).catch((function(e){return console.error("Error:",e)}))}else showOverlayError("No records to save")}},{key:"getTableRecords",value:function(){var e,t=this,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.getTableMain(),a=[];return n.querySelectorAll("tbody tr").forEach((function(n){o&&!n.classList.contains(flagDirty)||(e=t.getJsonRow(n),a.push(e))})),a}},{key:"getJsonRow",value:function(e){throw new Error("Subclass of TableBasePage must implement method getJsonRow().")}},{key:"hookupButtonCancel",value:function(){initialiseEventHandler(idFormFilters+" button."+flagCancel,flagInitialised,(function(e){e.addEventListener("click",(function(e){e.stopPropagation(),getAndLoadFilteredTableContent()})),e.classList.add(flagCollapsed)}))}},{key:"hookupButtonAddRowTable",value:function(){var e=this;initialiseEventHandler(idFormFilters+" button."+flagAdd,flagInitialised,(function(t){t.addEventListener("click",(function(t){t.stopPropagation();var o=document.querySelector(idTableMain+" tbody"),n=_rowBlank.cloneNode(!0);n.classList.remove(flagInitialised),n.querySelectorAll("."+flagInitialised).forEach((function(e){e.classList.remove(flagInitialised)}));var a=parseInt(o.querySelector("tr:last-child").querySelector("td."+flagDisplayOrder+" ."+flagSlider).getAttribute(attrValueCurrent))+1;o.appendChild(n);var i=o.querySelector("tr:last-child").querySelector("td."+flagDisplayOrder+" ."+flagSlider);i&&(i.setAttribute(attrValueCurrent,a),i.setAttribute(attrValuePrevious,a)),e.hookupTableMain()}))}))}},{key:"hookupTableMain",value:function(){if(this.constructor===t)throw new Error("Must implement hookupTableMain() method.");null==_rowBlank&&this.cacheRowBlank()}},{key:"cacheRowBlank",value:function(){var e=idTableMain+" tbody tr."+flagRowNew,t=document.querySelector(e);console.log("row blank temp: ",t),_rowBlank=t.cloneNode(!0),document.querySelectorAll(e).forEach((function(e){e.remove()}))}},{key:"hookupSlidersDisplayOrderTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagDisplayOrder+" input."+flagSlider+"."+flagDisplayOrder;initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(o){console.log("slider change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupTextareasCodeTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagCode+" textarea";initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(o){console.log("textarea change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"handleChangeElementCellTable",value:function(e){var t=a.A.getRowFromElement(e),o=a.A.getCellFromElement(e);console.log("td: ",o);var n=this.isDirtyRow(t),i=e.classList.contains(flagDirty),r=a.A.isElementDirty(e);if(console.log("isDirtyElement: ",r),console.log("wasDirtyElement: ",i),r!=i){a.A.handleDirtyElement(o,r);var l=this.isDirtyRow(t);if(console.log("isNowDirtyRow: ",l),console.log("wasDirtyRow: ",n),l!=n){a.A.handleDirtyElement(t,l);var s=this.getTableRecords(!0),c=s.length>0;console.log("dirty records:",s),console.log("existsDirtyRecord:",c),this.toggleShowButtonsSaveCancel(c)}}}},{key:"isDirtyRow",value:function(e){throw new Error("Subclass of TableBasePage must implement method isDirtyRow().")}},{key:"toggleShowButtonsSaveCancel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null==t&&(t=document.querySelector(idFormFilters+" button."+flagSave)),null==o&&(o=document.querySelector(idFormFilters+" button."+flagCancel)),e?(o.classList.remove(flagCollapsed),t.classList.remove(flagCollapsed)):(o.classList.add(flagCollapsed),t.classList.add(flagCollapsed))}},{key:"handleChangeSelectCellTable",value:function(e){var t=a.A.getRowFromElement(e),o=a.A.getCellFromElement(e);console.log("td: ",o);var n=this.isDirtyRow(t),i=e.classList.contains(flagDirty),r=a.A.isElementDirty(e);if(console.log("isDirtyElement: ",r),console.log("wasDirtyElement: ",i),r!=i){a.A.handleDirtyElement(o,r);var l=e.options[e.selectedIndex];o.setAttribute(attrIdAccessLevel,l.value),o.setAttribute(flagAccessLevelRequired,l.textcontent);var s=this.isDirtyRow(t);if(console.log("isNowDirtyRow: ",s),console.log("wasDirtyRow: ",n),s!=n){a.A.handleDirtyElement(t,s);var c=this.getTableRecords(!0),u=c.length>0;console.log("dirty records:",c),console.log("existsDirtyRecord:",u),this.toggleShowButtonsSaveCancel(u)}}}},{key:"hookupTextareasNameTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagName+" textarea";initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(o){console.log("textarea change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupTextareasDescriptionTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagDescription+" textarea";initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(o){console.log("textarea change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupInputsActiveTable",value:function(){var e=this,t=idTableMain+" tbody tr td."+flagActive+' input[type="checkbox"]';initialiseEventHandler(t,flagInitialised,(function(t){t.addEventListener("change",(function(o){console.log("input change event"),e.handleChangeElementCellTable(t)}))}))}},{key:"hookupTdsAccessLevel",value:function(){var e=this;initialiseEventHandler(idTableMain+" tbody td."+flagAccessLevel,flagInitialised,(function(t){t.addEventListener("click",(function(t){e.handleClickTdAccessLevel(t)}))}))}},{key:"handleClickTdAccessLevel",value:function(e){console.log("tdAccessLevel clicked"),e.stopPropagation();var t=a.A.getCellFromElement(e.target);console.log("tdAccessLevel: ",t);var o=a.A.getRowFromElement(t),n=t.querySelector("div."+flagAccessLevel).getAttribute(attrIdAccessLevel),i=document.createElement("select");i.classList.add(flagAccessLevel),i.setAttribute(attrValueCurrent,n),i.setAttribute(attrValuePrevious,n),optionsAccessLevel.forEach((function(e){var t=document.createElement("option");t.value=e.value,t.textContent=e.text,e.value==n&&(t.selected=!0),i.appendChild(t)}));var r=t.cloneNode(!0);r.innerHTML="",r.appendChild(i),o.replaceChild(r,t),this.hookupDdlsAccessLevelTable()}},{key:"hookupDdlsAccessLevelTable",value:function(){var e=this;initialiseEventHandler(idTableMain+" tbody select."+flagAccessLevel,flagInitialised,(function(t){t.addEventListener("change",(function(o){o.stopPropagation(),e.handleChangeDdlAccessLevelTable(t)}))}))}},{key:"handleChangeDdlAccessLevelTable",value:function(e){var t=a.A.getRowFromElement(e),o=a.A.getCellFromElement(e);console.log("td: ",o);var n=this.isDirtyRow(t),i=e.classList.contains(flagDirty),r=a.A.isElementDirty(e);if(console.log("isDirtyElement: ",r),console.log("wasDirtyElement: ",i),r!=i){a.A.handleDirtyElement(o,r);var l=e.options[e.selectedIndex];o.setAttribute(attrIdAccessLevel,l.value),o.setAttribute(flagAccessLevelRequired,l.textcontent);var s=this.isDirtyRow(t);if(console.log("isNowDirtyRow: ",s),console.log("wasDirtyRow: ",n),s!=n){a.A.handleDirtyElement(t,s);var c=this.getTableRecords(!0),u=c.length>0;console.log("dirty records:",c),console.log("existsDirtyRecord:",u),this.toggleShowButtonsSaveCancel(u)}}}},{key:"leave",value:function(){if(this.constructor===t)throw new Error("Must implement leave() method.");var e,o,n;(e=t,o=this,"function"==typeof(n=u(f(1&3?e.prototype:e),"leave",o))?function(e){return n.apply(o,e)}:n)([]);var i=this.getFormFilters(),r={};r[flagFormFilters]=a.A.convertForm2JSON(i),this.setLocalStoragePage(r),_rowBlank=null}}],i=[{key:"isDirtyFilter",value:function(e){var t=a.A.isElementDirty(e);if(t){var o=document.querySelector(idTableMain+" tbody");o.querySelectorAll("tr").remove(),o.appendChild(document.createElement('
Press "Apply Filters" to refresh the table.
'))}return t}}],n&&r(o.prototype,n),i&&r(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o;var o,n,i}(n.v),g=o(595);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function y(e,t){for(var o=0;o