root 2 years ago
parent
commit
e010bab531
7 changed files with 243 additions and 37 deletions
  1. +24
    -5
      controllers/kalachakra.py
  2. +64
    -2
      static/js/kalachakra.js
  3. +13
    -0
      static/src/css/tree.css
  4. +3
    -0
      views/account.xml
  5. +1
    -0
      views/asset.xml
  6. +3
    -0
      views/event.xml
  7. +135
    -30
      views/website_event_registration.xml

+ 24
- 5
controllers/kalachakra.py View File

@ -609,6 +609,24 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
request.session['status']=partner.member_status request.session['status']=partner.member_status
return http.request.render('kalachakra.registration_step1',data) return http.request.render('kalachakra.registration_step1',data)
@http.route(['/event/registration/contactform'], type='http', auth='user', website=True, sitemap=False,csrf=False)
#def event_registration_contactform(self,event_id,*args,**kw):
def event_registration_contactform(self,*args,**kw):
data={}
#contact lié à l'utilisateur
userid=request.env.context.get('uid')
data['lang']=request.env.context.get('lang')
user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
data['partner']=partner
#évenement
# event=request.env['event.event'].sudo().search([('id','=',int(event_id))])
# request.session['event_id']=int(event_id)
#data['event']=event
return http.request.render('kalachakra.registration_contactform',data)
@http.route(['/event/registration/step1b'], type='http', auth='user', website=True, sitemap=False,csrf=False) @http.route(['/event/registration/step1b'], type='http', auth='user', website=True, sitemap=False,csrf=False)
def event_registration_step1b(self,event_id,*args,**kw): def event_registration_step1b(self,event_id,*args,**kw):
data={} data={}
@ -646,7 +664,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
data['online']=False data['online']=False
data['headphone']=False data['headphone']=False
if (post.get('headphone2')=='yes') or (post.get('headphone3')=='yes'):data['headphone']=True
if post.get('headphone')=='true' :data['headphone']=True
if event.online_event: if event.online_event:
if post.get('online')=='yes':data['online']=True if post.get('online')=='yes':data['online']=True
@ -677,7 +695,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
vals={} vals={}
vals['event_id']=request.session['event_id'] vals['event_id']=request.session['event_id']
vals['partner_id']=request.session['partner_id'] vals['partner_id']=request.session['partner_id']
if (post.get('headphone2')=='yes') or (post.get('headphone3')=='yes'):vals['headphone']=True
if post.get('headphone')=='true':vals['headphone']=True
else:vals['headphone']=False else:vals['headphone']=False
if event.online_event: if event.online_event:
@ -695,9 +713,10 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
invoice_id=request.env['event.registration'].sudo().action_generate_participation_invoice(int(res.id),'CB',membership) invoice_id=request.env['event.registration'].sudo().action_generate_participation_invoice(int(res.id),'CB',membership)
else: else:
data['headphone']=True
if (post.get('headphone2')=='yes') or (post.get('headphone3')=='yes'):data['headphone']=True
res.headphone=True
data['headphone']=False
if (post.get('headphone')=='true') :
data['headphone']=True
res.headphone=True
request.session['res_id']=res.id request.session['res_id']=res.id


+ 64
- 2
static/js/kalachakra.js View File

@ -1,12 +1,74 @@
odoo.define('kalachakra.main', function (require) { 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() { $(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() { $( ".list-group-item" ).click(function() {
var txtamount = $( this ).text(); var txtamount = $( this ).text();
l=txtamount.length l=txtamount.length


+ 13
- 0
static/src/css/tree.css View File

@ -0,0 +1,13 @@
.account_tree_class .o_list_table thead > tr>th:nth-child(4) {
width: 200px !important;
max-width: 200px !important;
}
.event_tree_class .o_list_table thead > tr>th:nth-child(2){
width: 300px !important;
max-width: 300px !important;
}

+ 3
- 0
views/account.xml View File

@ -13,6 +13,9 @@
<field string="Amount paid" name="transaction_amount"/> <field string="Amount paid" name="transaction_amount"/>
</xpath>
<xpath expr="//tree" position="attributes">
<attribute name="class">account_tree_class</attribute>
</xpath> </xpath>
</field> </field>
</record> </record>


+ 1
- 0
views/asset.xml View File

@ -2,6 +2,7 @@
<template id="assets_backend" name="kala backoffice assets" inherit_id="web.assets_backend"> <template id="assets_backend" name="kala backoffice assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<link rel="stylesheet" href="/kalachakra/static/src/css/kalachakra_backoffice.css"/> <link rel="stylesheet" href="/kalachakra/static/src/css/kalachakra_backoffice.css"/>
<link rel="stylesheet" href="/kalachakra/static/src/css/tree.css"/>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>

+ 3
- 0
views/event.xml View File

@ -41,6 +41,9 @@
<field name="model">event.event</field> <field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_tree" /> <field name="inherit_id" ref="event.view_event_tree" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//tree" position="attributes">
<attribute name="class">event_tree_class</attribute>
</xpath>
<xpath expr="//tree" position="attributes"> <xpath expr="//tree" position="attributes">
<attribute name="decoration-danger"/> <attribute name="decoration-danger"/>
</xpath> </xpath>


+ 135
- 30
views/website_event_registration.xml View File

@ -17,38 +17,28 @@
</br> </br>
<form t-att-action="'step2?event_id='+str(event.id)" method="post" class="form js_website_submit_form"> <form t-att-action="'step2?event_id='+str(event.id)" method="post" class="form js_website_submit_form">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class=" col-sm-auto s_website_form_label " for="headphone1">
<span class="s_website_form_label_content">je suis francophone, je souhaite une traduction en français</span>
</label>
<div class="col-sm">
<input type="checkbox" value="yes" class="s_website_form_input" name="headphone1" id="headphone1"/>
</div>
</div>
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class=" col-sm-auto s_website_form_label " for="headphone2">
<span class="s_website_form_label_content">I need a tibetan to english translation</span>
</label>
<div class="col-sm">
<input type="checkbox" value="yes" class="s_website_form_input" name="headphone2" id="headphone2"/>
</div>
</div>
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class=" col-sm-auto s_website_form_label " for="headphone3">
<span class="s_website_form_label_content">E vorrei una traduzione in italiano</span>
</label>
<div class="col-sm">
<input type="checkbox" value="yes" class="s_website_form_input" name="headphone3" id="headphone3"/>
</div>
</div>
<div class="row s_col_no_resize s_col_no_bgcolor s_website_form_multiple" data-name="" data-display="vertical">
<div class="radio col-12 ">
<div class="form-check">
<input type="radio" class="s_website_form_input form-check-input" id="agxtgyifb8q0" name="headphone" value="false"/>
<label class="form-check-label s_website_form_check_label" for="agxtgyifb8q0">
Je suis francophone, je souhaite une traduction en français
</label>
</div>
</div>
<div class="radio col-12 ">
<div class="form-check">
<input type="radio" class="s_website_form_input form-check-input" id="agxtgyifb8q1" name="" value="true"/>
<label class="form-check-label s_website_form_check_label" for="agxtgyifb8q1">
I need a tibetan to english translation
</label>
</div>
</div>
</div>
<br></br> <br></br>
<button id="back_button1" type="button" class="btn btn-warning" >back</button> <button id="back_button1" type="button" class="btn btn-warning" >back</button>
<button type="submit" class="btn btn-primary" >Continue</button> <button type="submit" class="btn btn-primary" >Continue</button>
@ -317,4 +307,119 @@
</template> </template>
<template id="kalachakra.registration_contactform" name="Form">
<t t-call="website.layout">
<div class="container-fluid">
<form id="form1" action="questionnaire" method="post" class="form js_website_submit_form">
<input type="hidden" id="lang" t-att-value="lang"/>
<section class="s_website_form pt16 pb16 o_colored_level">
<h6>To contact you if needed, please filling your personnals informations :</h6>
<div class="form-group s_website_form_field s_website_form_custom s_website_form_required" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">Name</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-3">
<input type="text" class="form-control s_website_form_input" name="name" t-att-value="partner.name" required="1" id="contact_name" style="cursor: auto;"/>
</div>
</div>
</div>
<div class="form-group s_website_form_field s_website_form_custom s_website_form_required" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">First name</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-3">
<input type="text" class="form-control s_website_form_input" name="contact_firstname" t-att-value="partner.firstname" required="1" id="contact_firstname" style="cursor: auto;"/>
</div>
</div>
</div>
<div class="form-group s_website_form_field s_website_form_custom" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">Street</span>
</label>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-3">
<input type="text" id='contact_street' class="form-control s_website_form_input" name="street" t-att-value="partner.street" style="cursor: auto;"/>
</div>
</div>
</div>
<div class="form-group s_website_form_field s_website_form_custom" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">Street 2</span>
</label>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-3">
<input type="text" id='contact_street2' class="form-control s_website_form_input" name="street2" t-att-value="partner.street2" style="cursor: auto;"/>
</div>
</div>
</div>
<div class="form-group s_website_form_field s_website_form_custom s_website_form_require" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">Zip</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-12 col-sm-12 col-md-4 col-lg-2 col-xl-2">
<input type="text" id='contact_zip' class="form-control s_website_form_input" name="zip" t-att-value="partner.zip" style="cursor: auto;"/>
</div>
</div>
</div>
<div class="form-group s_website_form_field s_website_form_custom s_website_form_required" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">City</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-12 col-sm-12 col-md-4 col-lg-2 col-xl-2">
<input type="text" id='contact_city' class="form-control s_website_form_input" name="city" t-att-value="partner.city" style="cursor: auto;"/>
</div>
</div>
</div>
<div class="form-group s_website_form_field s_website_form_custom " data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">Phone</span>
<span class="s_website_form_mark"></span>
</label>
<div class="col-12 col-sm-12 col-md-4 col-lg-2 col-xl-2">
<input type="text" id='contact_phone' class="form-control s_website_form_input" name="phone" t-att-value="partner.phone" style="cursor: auto;"/>
</div>
</div>
</div>
<div class="form-group s_website_form_field s_website_form_custom" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">
<span class="s_website_form_label_content">Mobile</span>
<span class="s_website_form_mark"></span>
</label>
<div class="col-12 col-sm-12 col-md-4 col-lg-2 col-xl-2">
<input type="text" class="form-control s_website_form_input" id="contact_mobile" name="mobile" t-att-value="partner.mobile" style="cursor: auto;"/>
</div>
</div>
</div>
<h6 id='validation_message' style='display:none;color:red'></h6>
<button id="contact_form_back_button" type="button" class="btn btn-warning" >back</button>
<button id="contact_form_continue_button" type="button" class="btn btn-primary" >Continue</button>
<br/>
</section>
</form>
</div>
</t>
</template>
</odoo> </odoo>

Loading…
Cancel
Save