Skip to content

Commit

Permalink
Merge pull request #37 from moevm/bogdanov_zero_price_check
Browse files Browse the repository at this point in the history
Zero price check
  • Loading branch information
Bnd1238 authored Dec 23, 2024
2 parents 8dc0993 + 5ff0e1f commit fba48b7
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions main/_front/src/js/add-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ const addAdminPanel = () => {
}

name.addEventListener("change", () => {
console.log(isChanged)
isChanged = true;
console.log(isChanged)
})

price.addEventListener("change", () => {
console.log(isChanged)
price.addEventListener("change", (e) => {
isChanged = true;
console.log(isChanged)
if (e.target.value[0] === "0"){
price.value = 1;
}
})


Expand Down Expand Up @@ -93,9 +92,7 @@ choiceLists.forEach((choiceList) => {
if (isType){
switchTypeOf(choiceList.dataset.value)
}
console.log(isChanged)
isChanged = true;
console.log(isChanged)
});
});
if (isType){
Expand Down Expand Up @@ -154,9 +151,7 @@ steppers.forEach(stepper => {
count--;
value.textContent = count;
plus_btn.disabled = false;
console.log(isChanged)
isChanged = true;
console.log(isChanged)
writeDataValue(stepper, value.textContent);
if (checkMinDisabled(value)){
minus_btn.disabled = true;
Expand All @@ -173,9 +168,7 @@ steppers.forEach(stepper => {
value.textContent = count;
minus_btn.disabled = false;
writeDataValue(stepper, value.textContent);
console.log(isChanged)
isChanged = true;
console.log(isChanged)
if (checkMaxDisabled(value, max)){
plus_btn.disabled = true;
value.textContent = max;
Expand Down Expand Up @@ -212,15 +205,11 @@ const input_property_name = document.querySelector("#property_name>input");
const input_property_value = document.querySelector("#property_value>input");

input_property_name.addEventListener("change", () => {
console.log(isChanged)
isChanged = true;
console.log(isChanged)
})

input_property_value.addEventListener("change", () => {
console.log(isChanged)
isChanged = true;
console.log(isChanged)
})

const properties_list = document.querySelector("#properties_list")
Expand Down Expand Up @@ -251,7 +240,7 @@ const addProperty = (element, name, value) => {
<img src="../img/trash.svg" alt="">
</button>
</div>
</div>
`)
element.querySelectorAll(".property .property__btn-delete").forEach(button => {
Expand Down Expand Up @@ -422,3 +411,4 @@ window.addEventListener('beforeunload', (event) => {
event.preventDefault();
}
});

0 comments on commit fba48b7

Please sign in to comment.