<?xml version="1.0" encoding="utf-8"?>

<templates xml:space="preserve">

    <t t-name="event.EventRegistrationSummaryDialog" >
       <Dialog size="'md'" title="'Registration Summary'">
            <div class="row">
                <div class="col-lg-8 offset-lg-2">
                    <div class="text-center mb-3" t-if="registration.partner_id">
                        <img t-attf-src="/web/image/res.partner/{{registration.partner_id}}/avatar_128" alt="Registration" class="o_image_64_cover"/>
                    </div>
                    <div t-if="registration.status === 'confirmed_registration'" class="alert alert-success text-center" role="alert">
                        <t t-out="registration.name"/> is successfully registered
                    </div>
                    <div t-else="" class="alert alert-warning text-center" role="alert">
                        <t t-if="registration.status === 'need_manual_confirmation'">
                            <span>This ticket is for another event<br/>
                            Confirm attendance for <t t-out="registration.name"/>?</span>
                        </t>
                        <t t-elif="registration.status === 'not_ongoing_event'">
                            <span>This ticket is not for an ongoing event</span>
                        </t>
                        <t t-elif="registration.status === 'canceled_registration'">
                            <span>Canceled registration</span>
                        </t>
                        <t t-elif="registration.status == 'already_registered'">
                            <t t-out="registration.name"/><span> is already registered</span>
                        </t>
                    </div>
                    <div t-if="registration.has_to_pay" class="alert alert-danger text-center" role="alert">
                        The registration must be paid
                    </div>
                </div>
            </div>
            <div id="registration_information" class="row">
                <div class="col-lg-12">
                    <table class="table table-striped">
                        <tr><td>Event</td><td><t t-out="registration.event_display_name"/></td></tr>
                        <tr t-if="!registration.event_id and registration.company_name"><td>Company</td><td><t t-out="registration.company_name"/></td></tr>
                        <tr><td>Name</td><td><t t-out="registration.name"/></td></tr>
                        <tr t-if="registration.ticket_name"><td>Ticket</td><td><t t-out="registration.ticket_name"/></td></tr>
                        <tr t-if="registration.sale_status_value"><td>Payment</td><td><t t-out="registration.sale_status_value"/></td></tr>
                        <tr t-if="registration.registration_answers">
                            <td>Answers</td>
                            <td>
                                <span t-foreach="registration.registration_answers" t-as="registration_answer" t-key="registration_answer_index"
                                    t-attf-class="o_tag o_tag_badge_text o_tag_color_#{registration_answer_index % 10} badge rounded-pill p-1 me-1 mb-1"
                                    t-out="registration_answer"/>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>

            <t t-set-slot="footer">
                <button t-if="needManualConfirmation" class="btn btn-primary" t-on-click="() => this.onRegistrationConfirm()">Confirm</button>
                <button class="btn" t-att-class="needManualConfirmation ? 'btn-secondary' : 'btn-primary'" t-on-click="() => this.props.close()">Close</button>
                <button class="btn btn-secondary" t-on-click="() => this.onRegistrationPrintPdf()">Print</button>
                <button class="btn btn-secondary" t-on-click="() => this.onRegistrationView()">View</button>
            </t>
        </Dialog>
    </t>

</templates>
