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

    <!-- Correction Request List View -->
    <record id="view_fusion_clock_correction_list" model="ir.ui.view">
        <field name="name">fusion.clock.correction.list</field>
        <field name="model">fusion.clock.correction</field>
        <field name="arch" type="xml">
            <list>
                <field name="create_date"/>
                <field name="employee_id"/>
                <field name="original_check_in"/>
                <field name="original_check_out"/>
                <field name="requested_check_in"/>
                <field name="requested_check_out"/>
                <field name="reason"/>
                <field name="state" decoration-success="state == 'approved'"
                       decoration-danger="state == 'rejected'"
                       decoration-warning="state == 'pending'" widget="badge"/>
            </list>
        </field>
    </record>

    <!-- Correction Request Form View -->
    <record id="view_fusion_clock_correction_form" model="ir.ui.view">
        <field name="name">fusion.clock.correction.form</field>
        <field name="model">fusion.clock.correction</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <button name="action_approve" string="Approve" type="object"
                            class="btn-primary" invisible="state != 'pending'"
                            groups="fusion_clock.group_fusion_clock_manager"/>
                    <button name="action_reject" string="Reject" type="object"
                            class="btn-danger" invisible="state != 'pending'"
                            groups="fusion_clock.group_fusion_clock_manager"/>
                    <field name="state" widget="statusbar"/>
                </header>
                <sheet>
                    <group>
                        <group string="Employee">
                            <field name="employee_id"/>
                            <field name="attendance_id"/>
                        </group>
                        <group string="Review">
                            <field name="reviewed_by" readonly="1"/>
                            <field name="reviewed_date" readonly="1"/>
                        </group>
                    </group>
                    <group>
                        <group string="Original Times">
                            <field name="original_check_in"/>
                            <field name="original_check_out"/>
                        </group>
                        <group string="Requested Correction">
                            <field name="requested_check_in"/>
                            <field name="requested_check_out"/>
                        </group>
                    </group>
                    <group>
                        <field name="reason"/>
                    </group>
                </sheet>
                <chatter/>
            </form>
        </field>
    </record>

    <!-- Correction Request Action -->
    <record id="action_fusion_clock_correction" model="ir.actions.act_window">
        <field name="name">Correction Requests</field>
        <field name="res_model">fusion.clock.correction</field>
        <field name="view_mode">list,form</field>
    </record>

</odoo>
