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

    <!-- ============================================================ -->
    <!--                  Exam Assignment Views                       -->
    <!-- ============================================================ -->

    <record id="view_exam_assignment_form" model="ir.ui.view">
        <field name="name">encoach.exam.assignment.form</field>
        <field name="model">encoach.exam.assignment</field>
        <field name="arch" type="xml">
            <form string="Exam Assignment">
                <header>
                    <field name="status" widget="statusbar" statusbar_visible="assigned,started,completed,expired"/>
                </header>
                <sheet>
                    <group>
                        <group>
                            <field name="exam_id"/>
                            <field name="student_id"/>
                            <field name="batch_id"/>
                        </group>
                        <group>
                            <field name="access_start"/>
                            <field name="access_end"/>
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="view_exam_assignment_list" model="ir.ui.view">
        <field name="name">encoach.exam.assignment.list</field>
        <field name="model">encoach.exam.assignment</field>
        <field name="arch" type="xml">
            <list string="Exam Assignments" decoration-info="status == 'assigned'" decoration-warning="status == 'started'" decoration-success="status == 'completed'" decoration-muted="status == 'expired'">
                <field name="exam_id"/>
                <field name="student_id"/>
                <field name="batch_id"/>
                <field name="access_start"/>
                <field name="access_end"/>
                <field name="status"/>
            </list>
        </field>
    </record>

    <record id="view_exam_assignment_search" model="ir.ui.view">
        <field name="name">encoach.exam.assignment.search</field>
        <field name="model">encoach.exam.assignment</field>
        <field name="arch" type="xml">
            <search string="Search Exam Assignments">
                <field name="exam_id"/>
                <field name="student_id"/>
                <field name="batch_id"/>
                <separator/>
                <filter string="Assigned" name="filter_assigned" domain="[('status', '=', 'assigned')]"/>
                <filter string="Started" name="filter_started" domain="[('status', '=', 'started')]"/>
                <filter string="Completed" name="filter_completed" domain="[('status', '=', 'completed')]"/>
                <filter string="Expired" name="filter_expired" domain="[('status', '=', 'expired')]"/>
                <filter string="Status" name="group_status" context="{'group_by': 'status'}"/>
                <filter string="Exam" name="group_exam" context="{'group_by': 'exam_id'}"/>
                <filter string="Batch" name="group_batch" context="{'group_by': 'batch_id'}"/>
            </search>
        </field>
    </record>

    <record id="action_exam_assignment" model="ir.actions.act_window">
        <field name="name">Exam Assignments</field>
        <field name="res_model">encoach.exam.assignment</field>
        <field name="view_mode">list,form</field>
        <field name="search_view_id" ref="view_exam_assignment_search"/>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Assign your first exam to students
            </p>
        </field>
    </record>

</odoo>
