Debian Codegraph @

addons/website_sale_loyalty/views/website_sale_templates.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="utf-8"?>
2 <odoo>
3 <template id="sale_coupon_result" inherit_id="website_sale.coupon_form">
4 <xpath expr="//form[@name='coupon_code']//input[@name='promo']" position="attributes">
5 <attribute name="placeholder">Gift card or discount code...</attribute>
6 </xpath>
7 <xpath expr="//t[@name='code_not_available']" position="replace"/>
8 </template>
9
10 <template id="modify_code_form" inherit_id="website_sale.total" name="Loyalty, coupon, gift card">
11 <xpath expr="//div[contains(@t-attf-class, 'o_cart_total')]//table/tr[last()]" position="after">
12 <tr t-if="not hide_promotions" class="oe_website_sale_gift_card">
13 <td colspan="3" class="text-center text-xl-end border-0 p-0">
14 <span class=''>
15 <t t-if="request.params.get('code_not_available')">
16 <div class="alert alert-danger text-start small" role="alert">
17 Invalid or expired promo code.
18 </div>
19 </t>
20 <t t-if="website_sale_order.get_promo_code_error(delete=False)">
21 <div class="alert alert-danger text-start small" role="alert">
22 <t t-out="website_sale_order.get_promo_code_error()"/>
23 </div>
24 </t>
25 <t t-if="website_sale_order">
26 <t t-if="website_sale_order.get_promo_code_success_message(delete=False)">
27 <div class="alert alert-success text-start small" role="alert">
28 You have successfully applied the following code: <strong t-out="website_sale_order.get_promo_code_success_message()"/>
29 </div>
30 </t>
31 <t t-foreach="website_sale_order._get_claimable_and_showable_rewards().items()" t-as="coupon_reward">
32 <t t-set="coupon" t-value="coupon_reward[0]"/>
33 <t t-set="rewards" t-value="coupon_reward[1]"/>
34 <t t-set="is_loyalty" t-value="rewards[0].program_id.program_type == 'loyalty'"/>
35
36 <div
37 t-if="is_loyalty"
38 class="alert alert-primary d-flex justify-content-between align-items-center mb-0 p-2 rounded-bottom-0"
39 role="alert"
40 >
41 <strong class="text-start small" t-out="coupon_reward[0].point_name"/>
42 <strong
43 class="small"
44 name="o_loyalty_points"
45 t-out="website_sale_order._get_real_points_for_coupon(coupon)"
46 />
47 </div>
48
49 <t t-foreach="rewards" t-as="reward">
50 <form t-att-action="'/shop/claimreward%s' % (redirect and '?r=' + redirect or '')"
51 method="post" name="claim_reward">
52 <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
53 <input type="hidden" name="reward_id" t-att-value="reward.id"/>
54 <input type="hidden" name="code" t-att-value="coupon.code"/>
55 <div t-attf-class="{{'border border-primary-subtle border-top-0 p-2 text-start' if is_loyalty else 'alert alert-primary p-2 text-start'}} {{'rounded-bottom mb-3' if is_loyalty and reward_last else ''}}">
56 <div class="d-flex gap-2 align-items-center">
57 <div class="flex-grow-1 text-break">
58 <t t-set="program" t-value="reward.program_id"/>
59 <t t-set="points" t-value="coupon._format_points(website_sale_order._get_real_points_for_coupon(coupon))"/>
60 <t t-if="program.program_type not in ['ewallet', 'promo_code', 'loyalty'] and (program.trigger == 'with_code' or (program.trigger == 'auto' and program.applies_on == 'future'))">
61 <t t-if="program.program_type == 'gift_card'">
62 <strong class="small">
63 <t t-out="reward.description"/>
64 -
65 <t t-out="points"/>
66 </strong>
67 </t>
68 <t t-elif="program.program_type == 'coupons'">
69 <strong class="small">
70 Coupons -
71 <t t-out="reward.description"/>
72 </strong>
73 </t>
74 <t t-elif="program.trigger == 'auto' and program.applies_on == 'future'">
75 <strong class="small" t-out="reward.description"/>
76 </t>
77 <div class="d-md-block small">
78 <span t-if="coupon and not coupon.program_id.is_nominative">
79 Code:
80 <t t-out="coupon.code[-4:].rjust(14, '&#8902;')"/>
81 </span>
82 <t t-if="coupon.expiration_date">
83 <br/>
84 <span>
85 Expired Date:
86 <t t-out="coupon.expiration_date"/>
87 </span>
88 </t>
89 </div>
90 </t>
91 <t t-elif="program.program_type == 'promo_code'">
92 <strong class="small" t-out="reward.description"/>
93 </t>
94 <t t-else="">
95 <div
96 t-if="program.program_type == 'ewallet'"
97 class="d-flex justify-content-between align-items-center h-100 me-2"
98 >
99 <strong class="small" t-out="reward.description"/>
100 <strong class="small" t-out="points"/>
101 </div>
102 <strong
103 t-else=""
104 class="small"
105 t-out="reward.description"
106 />
107 <div t-if="program.portal_visible">
108 <t t-if="not program.is_nominative">
109 <span t-out="points"/>
110 </t>
111 <small
112 t-elif="program.program_type != 'ewallet'"
113 t-out="coupon._format_points(reward.required_points)"
114 />
115 </div>
116 </t>
117 <select
118 t-if="reward.multi_product"
119 class="o_select w-100 form-select form-select-sm css_attribute_select"
120 name="product_id"
121 >
122 <option
123 t-foreach="reward.reward_product_ids"
124 t-as="product"
125 t-att-value="product.id"
126 >
127 <t t-out="product.display_name"/>
128 </option>
129 </select>
130 </div>
131 <div class="d-flex align-items-center">
132 <button
133 type="submit"
134 class="btn btn-sm btn-primary"
135 name="o_loyalty_claim"
136 >
137 <t t-if="(reward.program_id.trigger == 'with_code' and reward.program_id.program_type != 'promo_code') or (reward.program_id.trigger == 'auto' and reward.program_id.applies_on == 'future')">
138 Use
139 </t>
140 <t t-else="">Claim</t>
141 </button>
142 </div>
143 </div>
144 </div>
145 </form>
146 </t>
147 </t>
148 </t>
149 </span>
150 </td>
151 </tr>
152 </xpath>
153 </template>
154
155 <template id="layout" inherit_id="website.layout">
156 <xpath expr="//*[@id='wrapwrap']" position="inside">
157 <t t-set="coupon_error" t-value="request.params.get('coupon_error')"/>
158 <t t-set="pending_coupon_code" t-value="request.session.get('pending_coupon_code')"/>
159 <t t-if="coupon_error and pending_coupon_code">
160 <div t-attf-class="d-none coupon-message coupon-{{ request.params.get('coupon_error_type', 'error') }}-message">
161 <span class="coupon-message-title">Could not apply the promo code: <t t-out="pending_coupon_code"/></span>
162 <span class="coupon-message-content" t-out="coupon_error"/>
163 </div>
164 </t>
165 <t t-set="notify_coupon" t-value="request.params.get('notify_coupon')"/>
166 <div t-if="notify_coupon" class="d-none coupon-message coupon-info-message">
167 <span class="coupon-message-content">The following promo code was applied on your order: <t t-out="notify_coupon"/></span>
168 </div>
169 </xpath>
170 </template>
171
172 <template id="cart_discount" name="Show Discount in Subtotal" active="False" inherit_id="website_sale.total">
173 <xpath expr="//tr[@name='o_order_total_untaxed']" position="before">
174 <tr t-if="website_sale_order and website_sale_order.reward_amount">
175 <td class="text-end border-0 text-muted" title="Discounted amount">Discount:</td>
176 <td class="text-xl-end border-0 text-muted">
177 <span t-field="website_sale_order.reward_amount" style="white-space: nowrap;"
178 class="monetary_field"
179 t-options='{
180 "widget": "monetary",
181 "display_currency": website_sale_order.currency_id,
182 }'/>
183 </td>
184 </tr>
185 </xpath>
186 </template>
187
188 <template id="reduction_coupon_code" inherit_id="website_sale.reduction_code">
189 <xpath expr="//t[@t-set='force_coupon']" position="after">
190 <t t-set="_placeholder">Discount code or gift card</t>
191 </xpath>
192 </template>
193
194 <template id="cart_summary" name="Payment" inherit_id="website_sale.cart_product_price">
195 <xpath expr="//span" position="attributes">
196 <attribute name="t-att-data-reward-type">line.reward_id.reward_type</attribute>
197 </xpath>
198 </template>
199
200 <template
201 id="website_sale_loyalty.cart_lines_quantity"
202 inherit_id="website_sale.cart_lines_quantity"
203 name="Shopping Cart Lines"
204 >
205 <xpath expr="//t[@t-set='should_show_quantity_selector']" position="after">
206 <!-- Keep customers from changing the quantity for free product .-->
207 <t
208 t-set="should_show_quantity_selector"
209 t-value="should_show_quantity_selector and not line.reward_id.reward_type == 'product'"
210 />
211 </xpath>
212 </template>
213
214
215 <template id="cart_line_product_no_link" inherit_id="website_sale.cart_lines">
216 <xpath expr="//div[@name='o_wsale_cart_line_button_container']" position="before">
217 <t t-if="line.is_reward_line" t-call="sale_loyalty.used_gift_card"/>
218 </xpath>
219 </template>
220
221 <template id="cart_summary_inherit_website_gift_card_sale" inherit_id="website_sale.cart_summary_content">
222 <xpath expr="//td[@name='website_sale_cart_summary_product_name']/span" position="after">
223 <t t-call="sale_loyalty.used_gift_card"/>
224 </xpath>
225 </template>
226
227 <template id="website_sale_purchased_gift_card" inherit_id="website_sale.confirmation" >
228 <xpath expr="//div[@id='oe_structure_website_sale_confirmation_2']" position="after">
229 <t t-call="sale_loyalty.sale_purchased_gift_card"/>
230 </xpath>
231 </template>
232 </odoo>