summaryrefslogtreecommitdiff
path: root/addons/im_livechat/views/mail_channel_views.xml
blob: a9e03b819b3f2c84d596e0ae409fab90335c5d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0"?>
<odoo>
    <data>

        <record id="mail_channel_view_search" model="ir.ui.view">
            <field name="name">mail.channel.search</field>
            <field name="model">mail.channel</field>
            <field name="arch" type="xml">
                <search string="Search history">
                    <field name="name"/>
                    <group expand="0" string="Group By...">
                        <filter name="group_by_channel" string="Channel" domain="[]" context="{'group_by':'livechat_channel_id'}"/>
                        <separator orientation="vertical"/>
                        <filter name="group_by_month" string="Creation Date" domain="[]" context="{'group_by':'create_date:month'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="mail_channel_view_tree" model="ir.ui.view">
            <field name="name">mail.channel.tree</field>
            <field name="model">mail.channel</field>
            <field name="arch" type="xml">
                <tree string="History" create="false" default_order="create_date desc">
                    <field name="create_date" string="Session Date"/>
                    <field name="name" string="Attendees"/>
                    <field name="channel_message_ids" string="# Messages"/>
                    <field name="rating_last_image" string="Rating" widget="image" options='{"size": [20, 20]}'/>
                </tree>
            </field>
        </record>

        <record id="mail_channel_view_form" model="ir.ui.view">
            <field name="name">mail.channel.form</field>
            <field name="model">mail.channel</field>
            <field name="arch" type="xml">
                <form string="Session Form" create="false" edit="false">
                    <sheet>
                        <div style="width:50%" class="float-right">
                            <field name="rating_last_image" widget="image" class="float-right" readonly="1" nolabel="1"/>
                            <field name="rating_last_feedback" nolabel="1"/>
                        </div>
                        <div style="width:50%" class="float-left">
                            <group>
                                <field name="name" string="Attendees"/>
                                <field name="create_date" readonly="1" string="Session Date"/>
                            </group>
                        </div>

                        <group string="History" class="o_history_container">
                            <div class="o_history_kanban_container">
                                <div class="o_history_kanban_sub_container">
                                    <field name="message_ids" mode="kanban">
                                        <kanban default_order="create_date DESC">
                                            <field name="author_id"/>
                                            <field name="body"/>
                                            <field name="create_date" groups="base.group_no_one"/>
                                            <field name="id"/>
                                            <field name="author_avatar"/>
                                            <templates>
                                                <t t-name="kanban-box">
                                                    <div class="oe_module_vignette">
                                                        <div class="o_kanban_image">
                                                            <div>
                                                                 <t t-if="record.author_avatar.raw_value">
                                                                    <img t-att-src="kanban_image('mail.message', 'author_avatar', record.id.raw_value)" alt="Avatar" class="o_image_64_cover rounded-circle"/>
                                                                 </t>
                                                                 <t t-else=""><img alt="Anonymous" src="/mail/static/src/img/smiley/avatar.jpg" class="o_image_64_cover rounded-circle"/></t>
                                                            </div>
                                                        </div>
                                                        <div class="oe_module_desc">
                                                            <div class="float-right"><p><field name="date"/></p></div>
                                                            <div>
                                                                <p><strong>
                                                                    <t t-if="record.author_id.raw_value"><field name="author_id"/></t>
                                                                    <t t-else="">Anonymous</t>
                                                                </strong></p>
                                                                <p>
                                                                    <t t-if="record.body.raw_value"><field name="body" widget="html"/><br/></t>
                                                                </p>
                                                            </div>
                                                        </div>

                                                    </div>
                                                </t>
                                            </templates>
                                         </kanban>
                                    </field>
                                </div>
                            </div>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>


        <record id="mail_channel_action" model="ir.actions.act_window">
            <field name="name">History</field>
            <field name="res_model">mail.channel</field>
            <field name="view_mode">tree,form</field>
            <field name="search_view_id" ref="im_livechat.mail_channel_view_search"/>
            <field name="domain">[('livechat_channel_id', '!=', None)]</field>
            <field name="context">{'search_default_session_not_empty': 1}</field>
            <field name="help" type="html">
                <p class="o_view_nocontent_empty_folder">
                    Your chatter history is empty
                </p><p>
                    Create a channel and start chatting to fill up your history.
                </p>
            </field>
        </record>
        <record id="mail_channel_action_tree" model="ir.actions.act_window.view">
            <field name="sequence">1</field>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="im_livechat.mail_channel_view_tree"/>
            <field name="act_window_id" ref="im_livechat.mail_channel_action"/>
        </record>

        <record id="mail_channel_action_form" model="ir.actions.act_window.view">
            <field name="sequence">2</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="im_livechat.mail_channel_view_form"/>
            <field name="act_window_id" ref="im_livechat.mail_channel_action"/>
        </record>


        <record id="mail_channel_action_from_livechat_channel" model="ir.actions.act_window">
            <field name="name">Sessions</field>
            <field name="res_model">mail.channel</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('livechat_channel_id', 'in', [active_id]), ('channel_message_ids', '!=', False)]</field>
            <field name="context">{
                'search_default_livechat_channel_id': [active_id],
                'default_livechat_channel_id': active_id,
            }</field>
            <field name="search_view_id" ref="mail_channel_view_search"/>
        </record>
        <record id="mail_channel_action_livechat_tree" model="ir.actions.act_window.view">
            <field name="sequence">1</field>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="im_livechat.mail_channel_view_tree"/>
            <field name="act_window_id" ref="im_livechat.mail_channel_action_from_livechat_channel"/>
        </record>

        <record id="mail_channel_action_livechat_form" model="ir.actions.act_window.view">
            <field name="sequence">2</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="im_livechat.mail_channel_view_form"/>
            <field name="act_window_id" ref="im_livechat.mail_channel_action_from_livechat_channel"/>
        </record>


    </data>
</odoo>