<?xml version="1.0"?>
<t name="Registration Attendee Details" t-name="website_event.registration_attendee_details">
    <div id="modal_attendees_registration" class="modal fade" tabindex="-1" role="dialog">
        <div class="modal-dialog modal-lg" role="document">
            <form id="attendee_registration" t-attf-action="/event/#{slug(event)}/registration/confirm" method="post" class="js_website_submit_form">
                <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
                <div class="modal-content">
                    <div class="modal-header align-items-center">
                        <h4 class="modal-title">Attendees</h4>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"/>
                    </div>
                    <t t-set="counter" t-value="0"/>
                    <t t-set="input_type_by_question_type" t-value="{'name': 'text', 'email': 'email', 'phone': 'tel', 'company_name': 'text'}"/>
                    <t t-if="availability_check" t-foreach="tickets" t-as="ticket">
                        <t t-foreach="range(1, ticket['quantity'] + 1)" t-as="att_counter" name="attendee_loop">
                            <t t-set="counter" t-value="counter + 1"/>
                            <input t-if="event_slot_id" type="hidden" t-attf-name="#{counter}-event_slot_id" t-att-value="event_slot_id"/>
                            <input class="d-none" type="text" t-attf-name="#{counter}-event_ticket_id" t-attf-value="#{ticket['id']}"/>
                            <div t-if="event.specific_question_ids" class="modal-body">
                                <h5 t-attf-class="mt-1 pb-2 #{'border-bottom' if event.question_ids else ''}">Ticket #<span t-out="counter"/> <small class="text-muted">- <span t-out="ticket['name']"/></small></h5>
                                <div class="row">
                                    <t t-foreach="event.specific_question_ids" t-as="question">
                                        <div class="col-lg-6 mt-2">
                                            <t t-call="website_event.registration_event_question">
                                                <t t-set="registration_index" t-value="counter"/>
                                            </t>
                                        </div>
                                    </t>
                                </div>
                            </div>
                        </t>
                    </t>
                    <div t-if="availability_check and event.general_question_ids" class="modal-body border-top o_wevent_registration_question_global">
                        <div class="row">
                            <t t-foreach="event.general_question_ids" t-as="question">
                                <div class="mt-2" t-att-class="question.question_type=='text_box' and 'col-lg-12' or 'col-lg-6'">
                                    <t t-call="website_event.registration_event_question">
                                        <t t-set="registration_index" t-value="0"/>
                                    </t>
                                </div>
                            </t>
                        </div>
                    </div>
                    <t t-elif="not availability_check">
                        <div class="modal-body border-bottom">
                            <strong> You ordered more tickets than available seats</strong>
                        </div>
                    </t>
                    <div class="modal-footer border-top">
                        <button type="button" class="btn btn-secondary js_goto_event" data-bs-dismiss="modal">Cancel</button>
                        <button type="submit" class="btn btn-primary" t-if="availability_check">Confirm Registration</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</t>

