99 lines
5.6 KiB
XML
99 lines
5.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<flectra>
|
|
|
|
<template id="assets_editor" inherit_id="website.assets_frontend" name="Event Sale">
|
|
<xpath expr="." position="inside">
|
|
<script type="text/javascript" src="/website_event_sale/static/src/js/website.tour.event_sale.js"></script>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="index" inherit_id="website_event.index" name="Event's Ticket">
|
|
<xpath expr="//li[@t-foreach='event_ids']/div/h4" position="before">
|
|
<t t-if="event.state in ['draft', 'confirm'] and event.event_ticket_ids">
|
|
<span t-if="event.seats_availability == 'limited' and not event.seats_available" class="label label-danger pull-right">Sold Out</span>
|
|
<span t-if="event.seats_availability == 'limited' and event.seats_available and event.seats_available <= ((event.seats_max or 0) / 4)" class="label pull-right label-info">
|
|
Only <t t-esc="event.seats_available"/> Remaining
|
|
</span>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="registration_template" inherit_id="website_event.registration_template">
|
|
<xpath expr="//t[@t-id='tickets']" position="replace">
|
|
<t t-set="saleable_tickets" t-value="event.event_ticket_ids.filtered(lambda t: not t.is_expired)"/>
|
|
<t t-id="tickets" t-foreach="saleable_tickets" t-as="ticket">
|
|
<t t-call="website_event.ticket">
|
|
<t t-set="name">
|
|
<span itemprop="name" t-field="ticket.name"/>
|
|
</t>
|
|
<t t-set="description">
|
|
<span itemprop="description" t-field="ticket.product_id.description_sale"/>
|
|
</t>
|
|
<t t-set="registration_end">
|
|
<t t-if="ticket.deadline">
|
|
<span itemprop="priceValidUntil" t-field="ticket.deadline"/>
|
|
</t>
|
|
<t t-if="not ticket.deadline">
|
|
<span>Unlimited</span>
|
|
</t>
|
|
</t>
|
|
<t t-set="price">
|
|
<t t-if="ticket.price or editable">
|
|
<t t-if="(ticket.price-website.get_current_pricelist().currency_id.compute(ticket.price_reduce, event.company_id.sudo().currency_id)) > 1
|
|
and website.get_current_pricelist().discount_policy == 'without_discount'">
|
|
<del class="text-danger mr4" t-field="ticket.price" t-options='{
|
|
"widget": "monetary",
|
|
"from_currency": event.company_id.sudo().currency_id,
|
|
"display_currency": website.get_current_pricelist().currency_id
|
|
}'/>
|
|
</t>
|
|
<span t-field="ticket.price_reduce" t-options='{
|
|
"widget": "monetary",
|
|
"display_currency": website.pricelist_id.currency_id
|
|
}' groups="sale.group_show_price_subtotal"/>
|
|
<span t-field="ticket.price_reduce_taxinc" t-options='{
|
|
"widget": "monetary",
|
|
"display_currency": website.pricelist_id.currency_id
|
|
}' groups="sale.group_show_price_total"/>
|
|
<span itemprop="price" style="display:none;" t-esc="ticket.price"/>
|
|
<span itemprop="priceCurrency" style="display:none;" t-esc="website.pricelist_id.currency_id.name"/>
|
|
</t>
|
|
<t t-if="not ticket.price and not editable">
|
|
<span>Free</span>
|
|
</t>
|
|
<span t-if="ticket.seats_max and ((ticket.seats_reserved or 0)*100 / ticket.seats_max)>75" class="badge" itemprop="availability" content="http://schema.org/LimitedAvailability">
|
|
<t t-esc="ticket.seats_max - ticket.seats_reserved"/>
|
|
<span>left</span>
|
|
</span>
|
|
</t>
|
|
<t t-set="quantity">
|
|
<select t-attf-name="nb_register-#{ticket.id}" class="form-control">
|
|
<t t-set="seats_max_ticket" t-value="(ticket.seats_availability == 'unlimited' or ticket.seats_available > 9) and 10 or ticket.seats_available + 1"/>
|
|
<t t-set="seats_max_event" t-value="(event.seats_availability == 'unlimited' or event.seats_available > 9) and 10 or event.seats_available + 1"/>
|
|
<t t-set="seats_max" t-value="min(seats_max_ticket, seats_max_event)"/>
|
|
<t t-foreach="range(0, seats_max)" t-as="nb">
|
|
<option t-esc="nb" t-att-selected="len(saleable_tickets) == 1 and nb == 1 and 'selected'"/>
|
|
</t>
|
|
</select>
|
|
</t>
|
|
</t>
|
|
</t>
|
|
</xpath>
|
|
<xpath expr="//form[@id='registration_form']" position="attributes">
|
|
<attribute name="t-if">event.event_ticket_ids and not all([ticket.is_expired for ticket in event.event_ticket_ids])</attribute>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="cart" inherit_id="website_sale.cart_lines" name="Hide product reduction for event tickets">
|
|
<xpath expr="//td[hasclass('td-product_name')]/div/a" position="attributes">
|
|
<attribute name="t-attf-href"/>
|
|
<attribute name="t-att-href">
|
|
line.event_id and ('/event/%s/register' % slug(line.event_id)) or ('/shop/product/%s' % slug(line.product_id.product_tmpl_id))
|
|
</attribute>
|
|
</xpath>
|
|
<xpath expr="//del" position="attributes">
|
|
<attribute name="t-attf-class" separator=" " add="#{line.event_id and 'hidden' or ''}"/>
|
|
</xpath>
|
|
</template>
|
|
</flectra>
|