<?xml version="1.0"?>
<form string="Events" class="o_event_form_view">
                <header>
                    <button name="256" type="action" class="btn btn-primary" invisible="not seats_taken" context="{'default_event_id': id}">
                        Registration Desk
                    </button>
                    <field name="stage_id" widget="statusbar" options="{'clickable': '1'}"/>
                </header>
                <sheet>
                    <div class="oe_button_box" name="button_box" groups="base.group_user">
                        <button name="253" type="action" class="oe_stat_button" icon="fa-line-chart">
                            <div class="o_stat_info">
                                <span class="o_stat_text">
                                    Registration
                                </span>
                            </div>
                        </button>
                        <button name="248" type="action" context="{'search_default_expected': True}" class="oe_stat_button" icon="fa-users" help="Total Registrations for this Event">
                            <field name="seats_taken" widget="statinfo" string="Attendees"/>
                        </button>
                        <button name="254" type="action" class="oe_stat_button" icon="fa-calendar" invisible="not is_multi_slots">
                            <field name="event_slot_count" widget="statinfo" string="Slots"/>
                        </button>
                    </div>
                    <field name="active" invisible="1"/>
                    <field name="company_id" invisible="1"/>
                    <field name="legend_blocked" invisible="1"/>
                    <field name="legend_normal" invisible="1"/>
                    <field name="legend_done" invisible="1"/>
                    <widget name="web_ribbon" text="Archived" bg_color="text-bg-danger" invisible="active"/>
                    <field name="kanban_state" widget="state_selection" class="ms-auto float-end"/>
                    <div class="oe_title">
                        <label for="name" string="Event Name"/>
                        <h1><field class="text-break" options="{'line_breaks': False}" widget="text" name="name" placeholder="e.g. Conference for Architects"/></h1>
                    </div>
                    <group>
                        <group>
                            <field name="active" invisible="1"/>
                            <field name="date_begin" string="Date" widget="daterange" options="{'end_date_field': 'date_end'}"/>
                            <field name="date_end" invisible="1"/>
                            <field name="date_tz"/>
                            <field name="is_multi_slots" string="Multiple Slots"/>
                            <field name="lang"/>
                            <field name="event_type_id" string="Template"/>
                            <field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_quick_create': True}"/>
                        </group>
                        <group name="right_event_details">
                            <field name="organizer_id"/>
                            <field name="user_id" widget="many2one_avatar_user" domain="[('share', '=', False)]"/>
                            <field name="company_id" groups="base.group_multi_company" placeholder="Visible to all"/>
                            <field name="address_id" context="{'show_address': 1}" placeholder="Online if not set"/>
                            <field name="event_url" invisible="address_id" widget="url" placeholder="e.g. &quot;https://www.odoo.com&quot;"/>
                            <label for="seats_limited" string="Limit Registrations"/>
                            <div>
                                <field name="seats_limited"/>
                                <span invisible="not seats_limited" required="not seats_limited">
                                    to <field name="seats_max" class="oe_inline o_input_9ch"/> Attendees
                                    <span invisible="not is_multi_slots"> per slot</span>
                                </span>
                            </div>
                        </group>
                    </group>
                    <notebook>
                        <page string="Tickets" name="tickets">
                            <field name="event_ticket_ids" context="{                                 'default_event_name': name,                                 'is_event_multi_slots': is_multi_slots,                                 'list_view_ref': 'event.event_event_ticket_view_tree_from_event',                                 'form_view_ref': 'event.event_event_ticket_view_form_from_event',                                 'kanban_view_ref': 'event.event_event_ticket_view_kanban_from_event'}" mode="list,kanban"/>
                        </page>
                        <page string="Communication" name="event_communication">
                            <field name="event_mail_ids">
                                <list string="Communication" editable="bottom" decoration-danger="mail_state == 'error'">
                                    <field name="sequence" widget="handle"/>
                                    <field name="template_ref" options="{'no_quick_create': True}" context="{'filter_template_on_event': True, 'default_model': 'event.registration'}" widget="EventMailTemplateReferenceField"/>
                                    <field name="interval_nbr" readonly="interval_unit == 'now'"/>
                                    <field name="interval_unit"/>
                                    <field name="interval_type"/>
                                    <field name="scheduled_date" groups="base.group_no_one"/>
                                    <field name="mail_count_done"/>
                                    <field name="mail_state" widget="event_icon_selection" string=" " nolabel="1" options="{'error': 'fa fa-exclamation-triangle', 'sent': 'fa fa-check', 'scheduled': 'fa fa-hourglass-half', 'running': 'fa fa-cogs'}"/>
                                </list>
                            </field>
                        </page>
                         <page string="Questions" name="questions">
                            <field name="question_ids" string="Question" nolabel="1">
                                <list>
                                    <field name="sequence" widget="handle"/>
                                    <field name="title"/>
                                    <field name="is_mandatory_answer" string="Mandatory"/>
                                    <field name="once_per_order" string="Once per Order"/>
                                    <field name="question_type" string="Type"/>
                                    <field name="answer_ids" widget="many2many_tags" invisible="question_type != 'simple_choice'"/>
                                    <button name="action_view_question_answers" type="object" class="p-0" icon="fa-bar-chart pe-1" string="Stats" title="Answer Breakdown" invisible="question_type not in ['simple_choice', 'text_box']"/>
                                </list>
                                <!-- Need to repeat the whole tree form here to be able to create answers properly
                                    Without this, the sub-fields of answer_ids are unknown to the web framework.
                                    We need this because we create questions and answers when the event type changes. -->
                                <form string="Question">
                                    <sheet>
                                        <h1 class="d-flex"><field name="title" placeholder="e.g. &quot;Do you have any diet restrictions?&quot;" class="flex-grow-1"/></h1>
                                        <group>
                                            <group>
                                                <field name="is_mandatory_answer"/>
                                                <field name="question_type" widget="radio"/>
                                            </group>
                                            <group>
                                                <field name="once_per_order"/>
                                            </group>
                                        </group>
                                        <notebook invisible="question_type != 'simple_choice'">
                                            <page string="Answers" name="answers">
                                                <field name="answer_ids">
                                                    <list editable="bottom">
                                                        <!-- 'display_name' is necessary for the many2many_tags to work on the event view -->
                                                        <field name="display_name" column_invisible="True"/>
                                                        <field name="sequence" widget="handle"/>
                                                        <field name="name"/>
                                                    </list>
                                                </field>
                                            </page>
                                        </notebook>
                                    </sheet>
                                </form>
                            </field>
                        </page>
                        <page string="Notes &amp; Documents" name="event_notes">
                            <group>
                                <group>
                                    <field name="badge_format"/>
                                    <field name="badge_image"/>
                                </group>
                                <group>
                                    <label for="ticket_instructions" string="Ticket Instructions"/>
                                    <br/>
                                    <field nolabel="1" colspan="2" name="ticket_instructions" placeholder="e.g. How to get to your event, door closing time, ..."/>
                                </group>
                                <group>
                                    <label for="note" string="Note"/>
                                    <br/>
                                    <field nolabel="1" colspan="2" name="note" placeholder="Add some internal notes (to do lists, contact info, ...)"/>
                                </group>
                            </group>
                        </page>
                    </notebook>
                </sheet>
                <chatter/>
            </form>
        