<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <t t-name="loyalty.LoyaltyListRenderer" t-inherit="web.ListRenderer" t-inherit-mode="primary">
        <ActionHelper position="replace">
            <t t-if="showNoContentHelper">
                <LoyaltyActionHelper noContentHelp="props.noContentHelp"/>
            </t>
        </ActionHelper>
    </t>

    <t t-name="loyalty.LoyaltyActionHelper">
        <div class="o_view_nocontent flex-wrap pt-5">
            <div class="container">
                <div class="o_nocontent_help">
                    <t t-out="props.noContentHelp"/>
                </div>
                <div class="row justify-content-center loyalty-templates-container">
                    <t t-foreach="Object.entries(loyaltyTemplateData)" t-as="data" t-key="data[0]">
                        <t t-set="loyalty_el_icon" t-value="data[1].icon"/>
                        <t t-set="loyalty_el_title" t-value="data[1].title"/>
                        <div class="col-6 col-md-4 col-lg-3 py-4">
                            <div class="card rounded p-3 d-flex align-items-stretch h-100 loyalty-template" t-on-click.stop.prevent="() => this.onTemplateClick(data[0])">
                                <div class="row m-0 w-100 h-100">
                                    <div class="col-lg-4 p-0">
                                        <div class="d-flex w-100 h-100 align-items-start justify-content-center display-3 p-3 text-muted">
                                            <img t-attf-src="/loyalty/static/img/{{loyalty_el_icon}}.svg" t-attf-alt="{{loyalty_el_title}}"/>
                                        </div>
                                    </div>
                                    <div class="col-lg-8 p-0">
                                        <div class="card-body d-flex flex-column align-items-start justify-content-start h-100">
                                            <h3 class="card-title" t-out="loyalty_el_title"/>
                                            <p class="card-text" t-out="data[1].description"/>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </t>
                </div>
            </div>
        </div>
    </t>

    <t t-name="loyalty.LoyaltyX2ManyField" t-inherit-mode="primary" t-inherit="web.X2ManyField">
        <t t-if="displayControlPanelButtons" position="replace">
            <h4 t-esc="field.string or ''"/>
            <t t-if="displayControlPanelButtons">
                <div class="o_cp_buttons me-0 ms-auto" role="toolbar" aria-label="Control panel buttons" t-ref="buttons">
                    <div>
                        <button type="button" class="btn btn-secondary o-kanban-button-new" title="Create record" accesskey="c" t-on-click="() => this.onAdd()">
                            Add
                        </button>
                    </div>
                </div>
            </t>
        </t>
    </t>

    <t t-name="loyalty.LoyaltyCardListView.buttons" t-inherit-mode="primary" t-inherit="web.ListView.Buttons">
        <xpath expr="." position="inside">
            <t t-set="supportedProgramTypes" t-value="['coupons', 'gift_card', 'ewallet']"/>
            <button t-if="supportedProgramTypes.includes(props.context.program_type)" type="button" class="btn btn-primary o_loyalty_card_list_button_generate" t-attf-data-tooltip="Generate {{props.context.program_item_name}}"
                t-on-click.stop.prevent="() => this.actionService.doAction('loyalty.loyalty_generate_wizard_action', { additionalContext: this.props.context, onClose: () => {this.model.load()} })">
                Generate <t t-esc="props.context.program_item_name"/>
            </button>
        </xpath>
    </t>
</odoo>
