From 5dd19f94ddcbcfed98d431a9c4faca4de31bd7f3 Mon Sep 17 00:00:00 2001 From: Awoyalejohn Date: Mon, 29 Aug 2022 22:12:38 +0100 Subject: [PATCH] Fix missing semi colon andt declaerd variabls --- checkout/static/checkout/js/download.js | 2 +- checkout/static/checkout/js/stripe_elements.js | 6 +++--- profiles/static/profiles/js/countryfield.js | 4 ++-- quotes/static/quotes/js/quote_request.js | 10 ++++++---- quotes/static/quotes/js/stripe_elements.js | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/checkout/static/checkout/js/download.js b/checkout/static/checkout/js/download.js index bc56c8d..17b8ea4 100644 --- a/checkout/static/checkout/js/download.js +++ b/checkout/static/checkout/js/download.js @@ -3,7 +3,7 @@ * https://stackoverflow.com/questions/44070437/how-to-get-a-file-or-blob-from-an-url-in-javascript */ const downloadItems = document.querySelectorAll('.download-item'); -for (let downloadItem of downloadItems ) { +for (const downloadItem of downloadItems ) { let url = downloadItem.getAttribute('href'); fetch(url) diff --git a/checkout/static/checkout/js/stripe_elements.js b/checkout/static/checkout/js/stripe_elements.js index 197509a..c5c8d52 100644 --- a/checkout/static/checkout/js/stripe_elements.js +++ b/checkout/static/checkout/js/stripe_elements.js @@ -54,7 +54,7 @@ form.addEventListener('submit', (event) => { document.querySelector('#submit-button').disabled = true; // Checks the checkbox if its checked - let saveInfo = document.querySelector('#id-save-info') + let saveInfo = document.querySelector('#id-save-info'); if (typeof (saveInfo) != 'undefined' && saveInfo != null) { saveInfo = saveInfo.checked; } else { @@ -68,7 +68,7 @@ form.addEventListener('submit', (event) => { const url = '/checkout/cache_checkout_data/'; //headers - headerInfo = { + const headerInfo = { 'Content-Type': 'application/json', 'X-CSRFToken': csrftoken, }; @@ -137,7 +137,7 @@ form.addEventListener('submit', (event) => { form.submit(); } } - }) + }); }) .catch(function (error) { // Reloads the page diff --git a/profiles/static/profiles/js/countryfield.js b/profiles/static/profiles/js/countryfield.js index 83ae26f..828de82 100644 --- a/profiles/static/profiles/js/countryfield.js +++ b/profiles/static/profiles/js/countryfield.js @@ -1,4 +1,4 @@ -const country = document.querySelector('#id_default_country') +const country = document.querySelector('#id_default_country'); let countrySelected = country.value; if (!countrySelected) { @@ -9,6 +9,6 @@ country.addEventListener('change', (event) => { if(!countrySelected) { event.target.style.color = '#aab7c4'; } else{ - event.target.style.color = '#000' + event.target.style.color = '#000'; } }); \ No newline at end of file diff --git a/quotes/static/quotes/js/quote_request.js b/quotes/static/quotes/js/quote_request.js index 7e93c12..7dc85c0 100644 --- a/quotes/static/quotes/js/quote_request.js +++ b/quotes/static/quotes/js/quote_request.js @@ -1,9 +1,9 @@ // Code to calculate quote request form checkout total when the type and size are selected in the select box let typeArray = [0]; let sizeArray = [0]; -let subtotal = 0 +let subtotal = 0; let subtotalElement = document.querySelector('#subtotal'); -let discountPercent = 10 +let discountPercent = 10; let discountElement = document.querySelector('#discount'); let totalElement = document.querySelector('#total'); @@ -13,6 +13,7 @@ const selectType = document.querySelector('#id_type'); selectType.addEventListener('change', (event) => { let selectedValue = event.target.value; let typeCost = null; + let discount = null; // selects the price based on the current value if (selectedValue == 'IC' || selectedValue == 'ST') { @@ -26,7 +27,7 @@ const selectType = document.querySelector('#id_type'); } typeArray[0] = typeCost; - subtotal = (typeArray[0] + sizeArray[0]).toFixed(2) + subtotal = (typeArray[0] + sizeArray[0]).toFixed(2); if (subtotal > 40) { discount = (subtotal * discountPercent / 100).toFixed(2); } else { @@ -47,6 +48,7 @@ const selectSize = document.querySelector('#id_size'); selectSize.addEventListener('change', (event) => { let selectedValue = event.target.value; let sizeCost = null; + let discount = null; // selects the price based on the current value if (selectedValue == 'S') { @@ -60,7 +62,7 @@ const selectSize = document.querySelector('#id_size'); } sizeArray[0] = sizeCost; - subtotal = (typeArray[0] + sizeArray[0]).toFixed(2) + subtotal = (typeArray[0] + sizeArray[0]).toFixed(2); if (subtotal > 40) { discount = (subtotal * discountPercent / 100).toFixed(2); } else { diff --git a/quotes/static/quotes/js/stripe_elements.js b/quotes/static/quotes/js/stripe_elements.js index 6a2b39d..65fb127 100644 --- a/quotes/static/quotes/js/stripe_elements.js +++ b/quotes/static/quotes/js/stripe_elements.js @@ -79,5 +79,5 @@ form.addEventListener('submit', (event) => { form.submit(); } } - }) + }); }); \ No newline at end of file