Debian Codegraph @

addons/website_event_booth_sale/static/src/interactions/booth_registration.js

raw symbols SCIP
1 import { BoothRegistration } from "@website_event_booth/interactions/booth_registration";
2 import { patch } from "@web/core/utils/patch";
3
4 /**
5 * This class changes the displayed price after selecting the requested booths.
6 */
7 patch(BoothRegistration.prototype, {
8 start() {
9 super.start();
10 this.categoryPrice = this.selectedBoothCategory ? this.selectedBoothCategory.dataset.price : undefined;
11 },
12 onBoothTypeChange(ev, currentTargetEl) {
13 super.onBoothTypeChange(ev, currentTargetEl);
14 this.categoryPrice = parseFloat(currentTargetEl.dataset.price);
15 },
16 onBoothChange(ev, currentTargetEl) {
17 super.onBoothChange(ev, currentTargetEl);
18 const boothCount = this.countSelectedBooths();
19 const boothTotalPriceEl = this.el.querySelector(".o_wbooth_booth_total_price");
20 boothTotalPriceEl?.classList.toggle("d-none", !boothCount || !this.categoryPrice);
21 this.updatePrice(boothCount);
22 },
23 updatePrice(boothCount) {
24 const boothCurrencyEl = this.el.querySelector(".o_wbooth_booth_total_price .oe_currency_value");
25 if (boothCurrencyEl) {
26 boothCurrencyEl.textContent = `${boothCount * this.categoryPrice}`;
27 }
28 },
29 });