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

    <!-- Leave Request List View -->
    <record id="view_fusion_clock_leave_request_list" model="ir.ui.view">
        <field name="name">fusion.clock.leave.request.list</field>
        <field name="model">fusion.clock.leave.request</field>
        <field name="arch" type="xml">
            <list>
                <field name="leave_date"/>
                <field name="employee_id"/>
                <field name="reason"/>
                <field name="state" decoration-success="state == 'reviewed'"
                       decoration-info="state == 'auto_approved'" widget="badge"/>
                <field name="created_from"/>
            </list>
        </field>
    </record>

    <!-- Leave Request Form View -->
    <record id="view_fusion_clock_leave_request_form" model="ir.ui.view">
        <field name="name">fusion.clock.leave.request.form</field>
        <field name="model">fusion.clock.leave.request</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <button name="action_mark_reviewed" string="Mark Reviewed" type="object"
                            class="btn-primary" invisible="state == 'reviewed'"
                            groups="fusion_clock.group_fusion_clock_manager"/>
                    <field name="state" widget="statusbar"/>
                </header>
                <sheet>
                    <group>
                        <group>
                            <field name="employee_id"/>
                            <field name="leave_date"/>
                            <field name="created_from"/>
                        </group>
                        <group>
                            <field name="reason"/>
                        </group>
                    </group>
                </sheet>
                <chatter/>
            </form>
        </field>
    </record>

    <!-- Leave Request Action -->
    <record id="action_fusion_clock_leave_request" model="ir.actions.act_window">
        <field name="name">Leave Requests</field>
        <field name="res_model">fusion.clock.leave.request</field>
        <field name="view_mode">list,form</field>
    </record>

</odoo>
