Aucun résultat

La page demandée est introuvable. Essayez d'affiner votre recherche ou utilisez le panneau de navigation ci-dessus pour localiser l'article.

tag. Mews.Distributor( // Set Configuration ID of your booking engine. { configurationIds: ['c6c0470b-b6ec-47e6-878b-af86008df0f3'], }, // Add callback which will enable Submit button and open the Booking Engine Widget upon button click. function (api) { // Listen on submit and when user submits, open booking engine with given dates. const listenOnSubmit = () => { // Find the form in DOM and listen on submit. const form = document.getElementById('date-form'); form.addEventListener('submit', event => { // Don't use the default submit button behavior. We want to handle it ourselves. event.preventDefault(); // Get the dates from the date form. const { start, end, adultcount, childcount, vouchercode } = event.target.elements; const [startYears, startMonths, startDays] = start.value.split('-'); const [endYears, endMonths, endDays] = end.value.split('-'); const adult = parseInt(adultcount.value); const child = parseInt(childcount.value); const code = vouchercode.value; const startDate = new Date(startYears, startMonths - 1, startDays); const endDate = new Date(endYears, endMonths - 1, endDays); // Use the Booking Engine Widget Javascript API to set the dates in the widget and open it. api.setStartDate(startDate); api.setEndDate(endDate); api.setAdultCount(adult); api.setChildCount(child); api.setVoucherCode(code); api.open(); }); }; listenOnSubmit(); // Enable the submit button, because the Booking Engine Widget is ready to be used. const enableSubmit = () => { const submitButton = document.getElementById('dates-submit'); submitButton.value = 'Submit'; submitButton.disabled = false; }; enableSubmit(); } // 4. Note - this guide is written for the Production environment. );