odoo.define('kalachakra.main', function (require) { if ($('#lang').val()=='en_GB') { var message_phone= 'please filling your mobile or phone number' var message_name= 'please filling your name' var message_firstname= 'please filling your firstname' var message_zip= 'please filling your zip code' var message_city= 'please filling your city' } if ($('#lang').val()=='fr_FR') { var message_phone= 'merci de saisir votre numéro de mobile ou de téléphone' var message_name= 'merci de saisir votre nom' var message_firstname= 'merci de saisir votre prénom' var message_zip= 'merci de saisir votre code postal' var message_city= 'merci de saisir votre ville' } $(document).ready(function() { }); $( "#contact_form_continue_button" ).click(function() { const mobile=$('#contact_mobile').val(); const phone=$('#contact_phone').val(); console.log(message_phone) if (mobile.trim()=='' && phone.trim()=='') { $('#validation_message').text(message_phone) $('#validation_message').show() } else { if ($('#contact_name').val().trim()=='') { $('#validation_message').text(message_name) $('#validation_message').show() } else if ($('#contact_firstname').val().trim()=='') { $('#validation_message').text(message_firstname) $('#validation_message').show() } else if ($('#contact_city').val().trim()=='') { $('#validation_message').text(message_city) $('#validation_message').show() } else { $('#form1').submit() } } }); $( ".list-group-item" ).click(function() { var txtamount = $( this ).text(); l=txtamount.length amount=txtamount.substr(0,l-2) if (jQuery(this).attr("id")=="btn_autre") { $("#amount_id").focus(); } $("#amount_id").val(amount) }); $( "#pay_now_btn" ).click(function() { $('#form').attr('action', '/kalachakra/participation?type=participation'); $( "#form" ).submit(); }); $( "#pay_membership_btn" ).click(function() { $('#form').attr('action', '/kalachakra/participation?type=membership_and_participation'); $( "#form" ).submit(); }); $( "#make_donation_btn" ).click(function() { $('#form').attr('action', '/kalachakra/participation?type=donation'); $( "#form" ).submit(); }); $( "#pay_on_the_spot_btn" ).click(function() { $('#form').attr('action', '/kalachakra/onthespotpayment'); $( "#form" ).submit(); }); $( "#btn_payment_choice" ).click(function() { //validation de l'adresse mail if (ValidateEmail($("#email").val())) { //vérification montant if ($("#amount_id").val()==0) { alert('merci de saisir un montant') } else if ($("#name_id").val()=='') { alert('merci de saisir votre nom') } else if ($("#firstname_id").val()=='') { alert('merci de saisir votre prénom') } else if ($("#street1_id").val()=='') { alert('merci de saisir votre adresse') } else if ($("#city_id").val()=='') { alert('merci de saisir votre ville') } else if ($("#zip_id").val()=='') { alert('merci de saisir votre code postal') } else if ($("#title_id").val()=='') { alert('merci de saisir votre civilité') } else { $( "#form" ).submit(); } } else { alert("adresse e-mail invalide") } }); function ValidateEmail(mail) { if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) { return (true) } return (false) } }); odoo.define('kalachakra.widget_booking_event', function (require) { 'use strict'; var publicWidget = require('web.public.widget'); publicWidget.registry.visitor2 = publicWidget.Widget.extend({ selector: ".oe_country_booking_events, .country_booking_events", disabledInEditableMode: false, /** * @override */ start: function () { var defs = [this._super.apply(this, arguments)]; var self = this; var $eventBookingList = this.$('.country_booking_events_list'); this._originalContent = $eventBookingList[0].outerHTML; defs.push(this._rpc({route: '/event/get_country_booking_event_list'}).then(function (data) { if (data) { self._$loadedContent = $(data); self._$loadedContent.attr('contentEditable', false); self._$loadedContent.addClass('o_temp_auto_element'); self._$loadedContent.attr('data-temp-auto-element-original-content', self._originalContent); $eventBookingList.replaceWith(self._$loadedContent); } })); return Promise.all(defs); }, /** * @override */ destroy: function () { this._super.apply(this, arguments); if (this._$loadedContent) { this._$loadedContent.replaceWith(this._originalContent); } }, }); });