| 1 | <?xml version="1.0" ?> |
| 2 | <odoo> |
| 3 | |
| 4 | <template id="used_gift_card"> |
| 5 | <div class="d-md-block mb-2 small text-muted" |
| 6 | t-if="line.coupon_id and line.order_id != line.coupon_id.order_id and not line.coupon_id.program_id.is_nominative"> |
| 7 | <span> |
| 8 | Code: |
| 9 | <t t-esc="line.coupon_id.code[-4:].rjust(14, '⋆')"/> |
| 10 | </span> |
| 11 | <t t-if="line.coupon_id.expiration_date"> |
| 12 | <br/> |
| 13 | <span> |
| 14 | Expired Date: |
| 15 | <t t-esc="line.coupon_id.expiration_date"/> |
| 16 | </span> |
| 17 | </t> |
| 18 | </div> |
| 19 | </template> |
| 20 | |
| 21 | <template id="sale_purchased_gift_card"> |
| 22 | <t t-set="gift_cards" t-value="order.coupon_point_ids.filtered(lambda pe: pe.coupon_id.program_id.program_type == 'gift_card').coupon_id"/> |
| 23 | <div class="card mt-3 " t-if="gift_cards and order.state in ('sale', 'done')"> |
| 24 | <div class="card-body"> |
| 25 | <span t-if="not hide_intro">You will find below your gift cards code. An email has been sent with it. You can use it starting right now.</span> |
| 26 | <table class="table text-center table-borderless"> |
| 27 | <thead> |
| 28 | <tr> |
| 29 | <th class="fw-normal">Gift Card Code</th> |
| 30 | </tr> |
| 31 | </thead> |
| 32 | <tbody> |
| 33 | <t t-foreach="range(len(gift_cards))" t-as="gift_card_idx"> |
| 34 | <t t-set="gift_card" t-value="gift_cards[gift_card_idx]"/> |
| 35 | <td class="o_purchased_gift_card"> |
| 36 | Gift #<t t-esc="gift_card_idx + 1"/> |
| 37 | (<span t-esc="gift_card._format_points(order._get_real_points_for_coupon(gift_card, post_confirm=True))"/>) |
| 38 | <strong t-esc="gift_card.code"/> |
| 39 | <button class="btn btn-sm btn-secondary copy-to-clipboard" t-att-data-clipboard-text="gift_card.code"> |
| 40 | <span class="fa fa-clipboard"/> Copy |
| 41 | </button> |
| 42 | </td> |
| 43 | </t> |
| 44 | </tbody> |
| 45 | </table> |
| 46 | </div> |
| 47 | </div> |
| 48 | </template> |
| 49 | |
| 50 | <template id="sale_order_portal_loyalty_content"> |
| 51 | <t t-set="loyalty_data" t-value="sale_order.loyalty_data"/> |
| 52 | <div class="col-xs-5 col-md-6 col-lg-5" t-if="loyalty_data"> |
| 53 | <table class="table table-sm"> |
| 54 | <tr> |
| 55 | <td><strong>Loyalty Card</strong></td> |
| 56 | </tr> |
| 57 | <tr t-if="loyalty_data['issued']"> |
| 58 | <td>Issued</td> |
| 59 | <td class="text-end"> |
| 60 | +<span t-out="loyalty_data['issued']"/> |
| 61 | <span class="d-none d-md-inline" t-out="loyalty_data['point_name']"/> |
| 62 | </td> |
| 63 | </tr> |
| 64 | <tr t-if="loyalty_data['cost']"> |
| 65 | <td>Used</td> |
| 66 | <td class="text-end"> |
| 67 | -<span t-out="loyalty_data['cost']"/> |
| 68 | <span class="d-none d-md-inline" t-out="loyalty_data['point_name']"/> |
| 69 | </td> |
| 70 | </tr> |
| 71 | </table> |
| 72 | </div> |
| 73 | </template> |
| 74 | |
| 75 | <template id="sale_order_portal_content_inherit" |
| 76 | name="Gift Card Products Portal" |
| 77 | inherit_id="sale.sale_order_portal_content"> |
| 78 | <xpath expr="//section[@id='details']//td[@name='td_product_name']/*[last()]" position="after"> |
| 79 | <t t-if="line.coupon_id and line.coupon_id.program_id.program_type == 'gift_card'" |
| 80 | t-call="sale_loyalty.used_gift_card"/> |
| 81 | </xpath> |
| 82 | <xpath expr="//div[@id='total']" position="after"> |
| 83 | <t t-call="sale_loyalty.sale_purchased_gift_card"> |
| 84 | <t t-set="order" t-value="sale_order"/> |
| 85 | <t t-set="hide_intro" t-value="1"/> |
| 86 | </t> |
| 87 | </xpath> |
| 88 | <xpath expr="//div[@id='total']/*" position="after"> |
| 89 | <t t-call="sale_loyalty.sale_order_portal_loyalty_content" /> |
| 90 | </xpath> |
| 91 | </template> |
| 92 | |
| 93 | </odoo> |