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["webpack://UKCISA/./wwwroot/app/src/js/booking-for-live-pricing.js"],"sourcesContent":["class BookingLivePricing {\r\n\r\n constructor(el) {\r\n this.el = el;\r\n // get other elements in the page\r\n this.desktopContinueBtn = document.querySelector('.desktop-continue-panel .btn.btn-primary');\r\n this.orderSummaryPanel = {\r\n itemCountContainer: document.querySelector('#order-summary--items-in-basket'),\r\n totalContainer: document.querySelector('#order-summary--total'),\r\n continueBtn: document.querySelector('#order-summary .btn.btn-primary'),\r\n }\r\n this.checkboxes = [];\r\n let findCheckboxes = el.querySelectorAll('input[data-price]');\r\n if(findCheckboxes != null) {\r\n findCheckboxes.forEach(c => {\r\n this.checkboxes.push({\r\n el: c,\r\n price: parseFloat(c.dataset.price)\r\n });\r\n c.addEventListener('change', () => {\r\n this.update();\r\n });\r\n });\r\n }\r\n // also run update on radio-collapse-control 'rccChange' event\r\n window.addEventListener('rccChange', () => {\r\n this.update();\r\n });\r\n }\r\n\r\n update() {\r\n let items = 0,\r\n total = 0,\r\n enableContinueBtns = false;\r\n this.checkboxes.forEach(c => {\r\n if(c.el.checked) {\r\n items++;\r\n total += c.price;\r\n }\r\n });\r\n let writeTotal = 0;\r\n if (items > 0) {\r\n enableContinueBtns = true;\r\n if(total > Math.floor(total)) {\r\n writeTotal = `£${total.toFixed(2)}`;\r\n } else {\r\n writeTotal = `£${total.toFixed(2) }`;\r\n }\r\n }\r\n this.orderSummaryPanel.itemCountContainer.innerHTML = items;\r\n this.orderSummaryPanel.totalContainer.innerHTML = writeTotal;\r\n if(enableContinueBtns) {\r\n if(this.desktopContinueBtn) this.desktopContinueBtn.removeAttribute('disabled');\r\n if(this.orderSummaryPanel.continueBtn) this.orderSummaryPanel.continueBtn.removeAttribute('disabled');\r\n } else {\r\n if(this.desktopContinueBtn) this.desktopContinueBtn.setAttribute('disabled', 'disabled');\r\n if(this.orderSummaryPanel.continueBtn) this.orderSummaryPanel.continueBtn.setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n}\r\n\r\nexport function createFrom(wrappers) {\r\n wrappers.forEach((node) => {\r\n // if node is an element\r\n if (node.nodeType === 1) {\r\n new BookingLivePricing(node);\r\n }\r\n });\r\n}"],"names":["BookingLivePricing","constructor","el","this","desktopContinueBtn","document","querySelector","orderSummaryPanel","itemCountContainer","totalContainer","continueBtn","checkboxes","findCheckboxes","querySelectorAll","forEach","c","push","price","parseFloat","dataset","addEventListener","update","window","items","total","enableContinueBtns","checked","writeTotal","Math","floor","toFixed","innerHTML","removeAttribute","setAttribute","createFrom","wrappers","node","nodeType"],"sourceRoot":""}