checkboxes now work properly

This commit is contained in:
counterweight 2025-03-05 00:26:30 +01:00
parent aea850c642
commit 5e09802d5e
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 25 additions and 1 deletions

View file

@ -119,6 +119,22 @@ function validateBitcoinMethodCheckboxes(clickedCheckbox) {
}
}
function applyTrustCheckboxConstraints(pressedCheckbox) {
if (pressedCheckbox === myTrustedTrustedCheckbox) {
console.log('first case!');
if (!myTrustedTrustedCheckbox.checked && allMembersCheckbox.checked) {
allMembersCheckbox.checked = false;
}
}
if (pressedCheckbox === allMembersCheckbox) {
console.log('second case!');
if (!myTrustedTrustedCheckbox.checked && allMembersCheckbox.checked) {
myTrustedTrustedCheckbox.checked = true;
}
}
}
async function publishOffer() {
let wants;
if (buyButton.classList.contains('selected')) {
@ -617,6 +633,14 @@ for (const btcMethodCheckbox of btcMethodCheckboxes) {
});
}
myTrustedTrustedCheckbox.addEventListener('click', () => {
applyTrustCheckboxConstraints(myTrustedTrustedCheckbox);
});
allMembersCheckbox.addEventListener('click', () => {
applyTrustCheckboxConstraints(allMembersCheckbox);
});
publishOfferButton.addEventListener('click', async () => {
await publishOffer();
await myOffers.getOffersFromApi();

View file

@ -21,7 +21,7 @@
</div>
<div class="over-background" id="view-my-offers-root">
<h2>Mis ofertas</h2>
<button id="button-start-create-offer" class="button-primary button-medium">Crear nueva oferta</button>
<button id="button-start-create-offer" class="button-primary button-medium font-medium">Crear nueva oferta</button>
<div id="own-offers-container">
<p>Vaya, no hay nada por aquí...</p>
Quieres comprar BTC a un premium de 3% (precio: 93.000€/BTC). Quieres