<?xml version="1.0" encoding="UTF-8" ?>
<!--

    Copyright 2017-2019 MuK IT GmbH
    Copyright 2024 Subteno - Timothée Vannier (https://www.subteno.com).
    License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

-->
<odoo>
    <record id="view_dms_tag_search" model="ir.ui.view">
        <field name="name">dms_tag.search</field>
        <field name="model">dms.tag</field>
        <field name="arch" type="xml">
            <search string="Categories">
                <field name="name" filter_domain="[('name', 'ilike', self)]" />
                <filter
                    string="All"
                    name="all"
                    domain="['|', ('active', '=', False), ('active', '=', True)]"
                />
                <group expand="0" name="group_by" string="Group By">
                    <filter
                        name="group_by_category"
                        string="Category"
                        domain="[]"
                        context="{'group_by': 'category_id'}"
                    />
                    <filter
                        name="group_by_color"
                        string="Color"
                        domain="[]"
                        context="{'group_by': 'color'}"
                    />
                </group>
            </search>
        </field>
    </record>
    <record id="view_dms_tag_kanban" model="ir.ui.view">
        <field name="name">dms_tag.kanban</field>
        <field name="model">dms.tag</field>
        <field name="arch" type="xml">
            <kanban class="o_kanban_small_column" group_create="false">
                <field name="name" />
                <field name="color" />
                <templates>
                    <t t-name="kanban-menu">
                        <div class="container">
                            <div class="row">
                                <div class="col o_kanban_card_manage_section">
                                    <h5
                                        role="menuitem"
                                        class="o_kanban_card_manage_title"
                                    >
                                        <span>Actions</span>
                                    </h5>
                                    <div role="menuitem">
                                        <a type="open">
                                            <i class="fa fa-external-link" />
                                            Open
                                        </a>
                                    </div>
                                    <div role="menuitem">
                                        <a type="edit">
                                            <i class="fa fa-pencil-square-o" />
                                            Edit
                                        </a>
                                    </div>
                                    <div role="menuitem">
                                        <a type="delete">
                                            <i class="fa fa-trash-o" />
                                            Delete
                                        </a>
                                    </div>
                                </div>
                            </div>
                            <div class="o_kanban_card_manage_settings row">
                                <div role="menuitem" aria-haspopup="true">
                                    <ul
                                        class="oe_kanban_colorpicker"
                                        data-field="color"
                                        role="popup"
                                    />
                                </div>
                            </div>
                        </div>
                    </t>
                    <t t-name="kanban-box">
                        <div
                            t-attf-class="#{kanban_color(record.color.raw_value)} oe_kanban_global_click oe_kanban_content oe_kanban_card"
                        >
                            <div class="o_kanban_details">
                                <div class="o_kanban_record_title">
                                    <h2><field name="name" /></h2>
                                </div>
                                <div class="o_kanban_record_body" />
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>
    <record id="view_dms_tag_tree" model="ir.ui.view">
        <field name="name">dms_tag.tree</field>
        <field name="model">dms.tag</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name" />
                <field name="category_id" />
                <field name="color" widget="color_picker" />
            </tree>
        </field>
    </record>
    <record id="view_dms_tag_form" model="ir.ui.view">
        <field name="name">dms_tag.form</field>
        <field name="model">dms.tag</field>
        <field name="arch" type="xml">
            <form string="Tag">
                <sheet>
                    <widget
                        name="web_ribbon"
                        title="Archived"
                        bg_color="bg-danger"
                        invisible="active"
                    />
                    <div class="oe_button_box" name="button_box" />
                    <div class="oe_title">
                        <label for="name" class="oe_edit_only" />
                        <h1>
                            <field name="name" placeholder="Customer" />
                            <field name="active" invisible="1" />
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="category_id" />
                            <field name="color" widget="color_picker" />
                        </group>
                        <group>
                            <field name="count_files" string="Files" />
                            <field name="count_directories" string="Directories" />
                        </group>
                    </group>
                    <notebook>
                        <page string="Directories">
                            <field name="directory_ids" widget="one2many" mode="tree" />
                        </page>
                        <page string="Files">
                            <field name="file_ids" widget="one2many" mode="tree" />
                        </page>
                    </notebook>
                </sheet>
            </form>
        </field>
    </record>
    <record id="action_dms_tag" model="ir.actions.act_window">
        <field name="name">Tags</field>
        <field name="res_model">dms.tag</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="context">{'search_default_group_by_category': 1}</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Click to create a new tag.
            </p>
            <p>
                Tags are used to categorize Documents.
            </p>
        </field>
    </record>
</odoo>
