<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="buyer_view_list" model="ir.ui.view">
        <field name="name">buyer.list</field>
        <field name="model">buyer</field>
        <field name="arch" type="xml">
            <list>
                <field name="name"/>
                <field name="team_name"/>
                <field name="tax_id" optional="show"/>
                <field name="country_id" optional="show"/>
                <field name="logto_org_id" optional="show"/>
                <field name="state" widget="badge" decoration-warning="state == 'pending'" decoration-success="state == 'active'" decoration-danger="state == 'suspended'"/>
                <field name="joined_date"/>
                <field name="is_active" optional="hide"/>
            </list>
        </field>
    </record>

    <record id="buyer_view_kanban" model="ir.ui.view">
        <field name="name">buyer.kanban</field>
        <field name="model">buyer</field>
        <field name="arch" type="xml">
            <kanban class="o_kanban_mobile">
                <field name="name"/>
                <field name="team_name"/>
                <field name="state"/>
                <field name="logto_org_id"/>
                <templates>
                    <t t-name="card">
                        <div class="oe_kanban_content">
                            <div class="o_kanban_record_top mb-2">
                                <div class="o_kanban_record_headings">
                                    <strong class="o_kanban_record_title">
                                        <field name="name"/>
                                    </strong>
                                </div>
                                <field name="state" widget="label_selection" options="{'classes': {'pending': 'warning', 'active': 'success', 'suspended': 'danger'}}"/>
                            </div>
                            <div class="o_kanban_record_body">
                                <div><field name="team_name"/></div>
                                <div t-if="record.logto_org_id.raw_value" class="text-muted">
                                    <i class="fa fa-check text-success"/> Logto connected
                                </div>
                                <div t-else="" class="text-muted">
                                    <i class="fa fa-clock-o text-warning"/> Pending Logto
                                </div>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>

    <record id="action_buyer" model="ir.actions.act_window">
        <field name="name">Buyers</field>
        <field name="res_model">buyer</field>
        <field name="view_mode">list,kanban,form</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                No buyers yet
            </p>
            <p>
                Buyers are created when KYC applications are approved.
            </p>
        </field>
    </record>
</odoo>
