<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="hr_employee_view_search" model="ir.ui.view">
        <field name="name">hr.employee.view.search</field>
        <field name="model">hr.employee</field>
        <field name="inherit_id" ref="hr.view_employee_filter"/>
        <field name="arch" type="xml">
            <filter name="group_manager" position="after">
                <filter name="group_hr_presence_state" string="Presence" domain="[]" context="{'group_by':'hr_presence_state_display'}" groups="hr.group_hr_manager"/>
            </filter>
        </field>
    </record>

    <record id="hr_employee_view_presence_search" model="ir.ui.view">
        <field name="name">hr.employee.view.search.presence</field>
        <field name="model">hr.employee</field>
        <field name="arch" type="xml">
            <search string="Employees">
                <filter name="group_hr_presence_state" string="Presence" domain="[]" context="{'group_by':'hr_presence_state_display'}"/>
                <searchpanel>
                    <field name="company_id" groups="base.group_multi_company" icon="fa-building"/>
                    <field name="hr_presence_state_display" string="Absence/Presence" />
                    <field name="department_id" icon="fa-users"/>
                </searchpanel>
            </search>
        </field>
    </record>

    <record id="hr_employee_view_kanban" model="ir.ui.view">
        <field name="name">hr.employee.view.kanban</field>
        <field name="model">hr.employee</field>
        <field name="inherit_id" ref="hr.hr_kanban_view_employees"/>
        <field name="groups_id" eval="[(4, ref('hr.group_hr_manager'))]"/>
        <field name="mode">primary</field>
        <field name="arch" type="xml">
            <xpath expr="//kanban" position="attributes">
                <attribute name="create">0</attribute>
            </xpath>
            <xpath expr="//div[hasclass('oe_kanban_details')]" position="inside">
                <div class="oe_kanban_content d-flex flex-column gap-1">
                    <div class="oe_kanban_row d-flex gap-1">
                        <field name="hr_presence_state" invisible="1"/>
                        <button name="action_set_present" type="object" class="btn btn-success btn-sm fa fa-check" title="Set as present" invisible="hr_presence_state == 'present'"> </button>
                        <button name="action_set_absent" type="object" class="btn btn-warning btn-sm fa fa-times" title="Set as absent" invisible="hr_presence_state != 'present'"> </button>
                        <button name="action_open_leave_request" type="object" class="btn btn-secondary btn-sm">Time Off</button>
                    </div>
                    <div class="oe_kanban_row d-flex gap-1">
                        <button name="action_send_sms" type="object" class="btn btn-secondary btn-sm">SMS</button>
                        <button name="action_send_mail" type="object" class="btn btn-secondary btn-sm">Log</button>
                    </div>
                </div>
            </xpath>
        </field>
    </record>

</odoo>
