submit button de-id-d

This commit is contained in:
Pablo Martin 2025-03-31 16:50:11 +02:00
parent 14ee0b4127
commit 67c33aee3e
2 changed files with 13 additions and 16 deletions

View file

@ -12,9 +12,7 @@ const PopupNotification = require('../components/PopupNotification');
const offerService = require('../services/offerService');
class CreateOfferModal {
// Actual creation logic to be provided by a service
// Stop relying on IDs
class CreateOfferModal { // Stop relying on IDs
constructor({ parentElement, onCreationCallback, offerService }) {
this.element = null;
this.parentElement = parentElement;
@ -98,7 +96,17 @@ class CreateOfferModal {
});
const submitButtonArea = document.createElement('div');
submitButtonArea.id = 'submit-button-area';
submitButtonArea.classList.add('submit-button-area')
this.publishOfferButton = new PublishOfferButton({
parentElement: submitButtonArea,
id: 'button-submit-offer',
onClickCallback: async () => {
await this.createOffer();
await this.onCreationCallback();
await this.toggleOfferCreatedAlert();
},
});
this.publishOfferButton.render();
const closeButtonArea = document.createElement('div');
closeButtonArea.id = 'close-offer-controls-area';
@ -122,17 +130,6 @@ class CreateOfferModal {
return Math.floor(Math.random() * (95000 - 70000 + 1) + 70000);
};
this.publishOfferButton = new PublishOfferButton({
parentElement: document.getElementById('submit-button-area'),
id: 'button-submit-offer',
onClickCallback: async () => {
await this.createOffer();
await this.onCreationCallback();
await this.toggleOfferCreatedAlert();
},
});
this.publishOfferButton.render();
this.buyOrSellButtonGroup = new BuyOrSellButtonGroup({
parentElement: document.getElementById('buy-or-sell-area'),
id: 'button-group-buy-or-sell',