<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-name="pos_event.QuestionInputs">
        <div t-foreach="questions" t-as="question" t-key="question.id" class="global_question input-group mt-3">
            <span class="input-group-text">
                <t t-esc="question.title"/>
                <span t-if="question.is_mandatory_answer" class="text-danger">*</span>
            </span>
            <select t-if="question.question_type === 'simple_choice'" t-model="stateObject[question.id]" class="form-select">
                <option value="">--- Select ---</option>
                <option t-foreach="question.answer_ids" t-as="choice" t-key="choice.id" t-att-value="choice.id">
                    <t t-esc="choice.name"/>
                </option>
            </select>
            <input t-else="" t-model="stateObject[question.id]" class="form-control flex-grow-1"/>
        </div>
    </t>
    <t t-name="pos_event.EventRegistrationPopup">
        <Dialog title.translate="Tickets">
            <div class="o_event_registration_popup">
                <div t-if="this.questionsOncePerOrder.length" class="mb-4">
                    <div>
                        <span class="fs-3">Global questions</span>
                        <hr class="hr mt-1" />
                    </div>
                    <t t-set="questions" t-value="this.questionsOncePerOrder"/>
                    <t t-set="stateObject" t-value="this.state.byOrder"/>
                    <t t-call="pos_event.QuestionInputs" />
                </div>
                <t t-if="this.questionsByRegistration.length">
                    <div t-foreach="this.dataInQty" t-as="data" t-key="data_index" class="ticket_question mb-4">
                        <div>
                            <span class="fs-3">
                                Ticket #<t t-esc="data_index + 1" /> for <t t-esc="this.state.byRegistration[data_index].ticket_id.name" />
                            </span>
                            <hr class="hr mt-1" />
                        </div>
                        <t t-set="questions" t-value="this.questionsByRegistration"/>
                        <t t-set="stateObject" t-value="this.state.byRegistration[data_index].questions"/>
                        <t t-call="pos_event.QuestionInputs" />
                    </div>
                </t>
            </div>
            <t t-set-slot="footer">
                <button class="btn btn-secondary" t-on-click="close">Discard</button>
                <button class="btn btn-primary" t-on-click="confirm">Confirm</button>
            </t>
        </Dialog>
    </t>
</templates>
