1/* stimulusFetch: 'lazy' */ 2import {Controller} from '@hotwired/stimulus'; 3 4export default class extends Controller { 5 static targets = ["boatRentalForm", "activityForm", "boatRentalButton", "activityButton", "boatRentalTitle", "activityTitle"]; 6 7 static values = { 8 activeForm: { type: String, default: "boatRental" } 9 }; 10 11 connect() { 12 this.showForm(this.activeFormValue); 13 } 14 15 /** 16 * @param {Event} event 17 */ 18 showBoatRental(event) { 19 event.preventDefault(); 20 this.showForm("boatRental"); 21 } 22 23 /** 24 * @param {Event} event 25 */ 26 showActivity(event) { 27 event.preventDefault(); 28 this.showForm("activity"); 29 } 30 31 /** 32 * @param {string} formType - "boatRental" ou "activity" 33 */ 34 showForm(formType) { 35 this.activeFormValue = formType; 36 37 if (formType === "boatRental") { 38 // Afficher le formulaire de location de bateaux 39 this.boatRentalFormTarget.classList.remove("hidden"); 40 this.activityFormTarget.classList.add("hidden"); 41 42 // Ajouter la classe active sur le bouton location 43 this.boatRentalButtonTarget.classList.add("active"); 44 45 // Retirer la classe active sur le bouton activités 46 this.activityButtonTarget.classList.remove("active"); 47 } else { 48 // Afficher le formulaire d'activités 49 this.boatRentalFormTarget.classList.add("hidden"); 50 this.activityFormTarget.classList.remove("hidden"); 51 52 // Retirer la classe active sur le bouton location 53 this.boatRentalButtonTarget.classList.remove("active"); 54 55 // Ajouter la classe active sur le bouton activités 56 this.activityButtonTarget.classList.add("active"); 57 } 58 } 59}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.