4b9fc67794dcc2a052cea070b1f35e575e328f36
[odoo/odoo.git] / addons / im_livechat / views / im_livechat_view.xml
1 <?xml version="1.0"?>
2 <openerp>
3     <data>
4         <!--
5             Views for im_chat.session
6         -->
7         <!-- History : form, list and search views -->
8         <record id="action_session_history" model="ir.actions.act_window">
9             <field name="name">History</field>
10             <field name="res_model">im_chat.session</field>
11             <field name="view_type">form</field>
12             <field name="view_mode">list,form</field>
13             <field name="domain">[('channel_id', '!=', None)]</field>
14             <field name="context">{'group_by': ['channel_id', 'create_date:month']}</field>
15         </record>
16
17         <record id="im_chat_session_search" model="ir.ui.view">
18             <field name="name">im_chat.session.search</field>
19             <field name="model">im_chat.session</field>
20             <field name="arch" type="xml">
21                 <search string="Search history">
22                     <filter name="id" string="My sessions" domain="[('user_ids','in', uid)]"/>
23                     <group expand="0" string="Group By...">
24                         <filter name="group_by_channel" string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
25                         <separator orientation="vertical" />
26                         <filter name="group_by_day" string="Creation date (day)" domain="[]" context="{'group_by':'create_date:day'}"/>
27                         <filter name="group_by_week" string="Creation date (week)" domain="[]" context="{'group_by':'create_date:week'}"/>
28                         <filter name="group_by_month" string="Creation date (month)" domain="[]" context="{'group_by':'create_date:month'}" />
29                         <filter name="group_by_year" string="Creation date (year)" domain="[]" context="{'group_by':'create_date:year'}"/>
30                     </group>
31                 </search>
32             </field>
33         </record>
34
35         <record id="im_chat_session_list_view" model="ir.ui.view">
36             <field name="name">im_chat.session.tree</field>
37             <field name="model">im_chat.session</field>
38             <field name="arch" type="xml">
39                 <tree string="History" create="false">
40                     <field name="id"/>
41                     <field name="fullname"/>
42                     <field name="create_date"/>
43                     <field name="feedback_rating"/>
44                 </tree>
45             </field>
46         </record>
47
48         <record id="im_chat_session_form_view" model="ir.ui.view">
49             <field name="name">im_chat.session.form</field>
50             <field name="model">im_chat.session</field>
51             <field name="arch" type="xml">
52                 <form string="Session Form" create="false" edit="false">
53                     <sheet>
54                        <group string="General">
55                             <field name="id"/>
56                             <field name="fullname" />
57                             <field name="create_date" readonly="1"/>
58                         </group>
59                         <group string="Feedback">
60                             <field name="feedback_rating"/>
61                             <field name="feedback_reason"/>
62                         </group>
63                         <field name="message_ids" type="tree">
64                             <tree string="History">
65                                 <field name="create_date" />
66                                 <field name="from_id" />
67                                 <field name="message" />
68                             </tree>
69                         </field>
70                     </sheet>
71                 </form>
72             </field>
73         </record>
74
75
76         <!-- Session of a channel : list view -->
77         <record id="action_session_channel" model="ir.actions.act_window">
78             <field name="name">Sessions</field>
79             <field name="res_model">im_chat.session</field>
80             <field name="view_mode">list,form</field>
81             <field name="domain">[('channel_id','in',[active_id])]</field>
82             <field name="context">{
83                 'search_default_channel_id': [active_id],
84                 'default_channel_id': active_id,
85             }</field>
86             <field name="search_view_id" ref="im_chat_session_search"/>
87         </record>
88
89
90         <!--
91             Views for im_livechat.channel
92         -->
93         <record id="action_support_channels" model="ir.actions.act_window">
94             <field name="name">Live Chat Channels</field>
95             <field name="res_model">im_livechat.channel</field>
96             <field name="view_mode">kanban,form</field>
97             <field name="help" type="html">
98               <p class="oe_view_nocontent_create">
99                 Click to define a new live chat channel.
100               </p><p>
101                 You can create channels for each website on which you want
102                 to integrate the live chat widget, allowing you website
103                 visitors to talk in real time with your operators.
104               </p><p>
105                 Each channel has it's own URL that you can send by email to
106                 your customers in order to start chatting with you.
107               </p>
108             </field>
109         </record>
110
111         <record id="support_channel_kanban" model="ir.ui.view">
112             <field name="name">support_channel.kanban</field>
113             <field name="model">im_livechat.channel</field>
114             <field name="arch" type="xml">
115                 <kanban>
116                     <field name="name"/>
117                     <field name="web_page" widget="url"/>
118                     <field name="are_you_inside"/>
119                     <field name="user_ids"/>
120                     <field name="nbr_session"/>
121                     <templates>
122                         <t t-name="kanban-box">
123                             <div class="oe_kanban_card oe_kanban_global_click">
124                                 <div class="oe_module_vignette row">
125                                     <div class="col-md-4">
126                                         <div class="oe_module_icon">
127                                             <img t-att-src="kanban_image('im_livechat.channel', 'image_medium', record.id.value)" class="img-responsive"/>
128                                         </div>
129                                     </div>
130                                     <div class="col-md-7">
131                                         <h3><field name="name"/></h3>
132                                         <div>
133                                             <p>
134                                                 <i class="fa fa-user">
135                                                     <t t-esc="(record.user_ids.raw_value || []).length"/> Operators
136                                                 </i>
137                                                 <br/>
138                                                 <i class="fa fa-comments">
139                                                     <t t-esc="record.nbr_session.raw_value"/> Sessions
140                                                 </i>
141                                             </p>
142                                             <div style="margin-top:5px;">
143                                                 <button t-if="record.are_you_inside.raw_value" name="quit" type="object" class="btn btn-default btn-xs">Quit</button>
144                                                 <button t-if="! record.are_you_inside.raw_value" name="join" type="object" class="btn btn-info btn-xs">Join</button>
145                                             </div>
146                                         </div>
147                                     </div>
148                                 </div>
149                             </div>
150                         </t>
151                     </templates>
152                 </kanban>
153             </field>
154         </record>
155
156         <record id="support_channel_form" model="ir.ui.view">
157             <field name="name">support_channel.form</field>
158             <field name="model">im_livechat.channel</field>
159             <field name="arch" type="xml">
160                 <form string="Support Channels" version="7.0">
161                 <sheet>
162                     <field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_medium"}'/>
163                     <div class="oe_title">
164                         <label for="name" class="oe_edit_only"/>
165                         <h1>
166                             <field name="name" placeholder="e.g. YourWebsite.com"/>
167                         </h1>
168                         <div>
169                             <button type="object" name="join" class="oe_highlight" string="Join Channel" attrs='{"invisible": [["are_you_inside", "=", True]]}'/>
170                             <button type="object" name="quit" string="Leave Channel" attrs='{"invisible": [["are_you_inside", "=", False]]}'/>
171                             <button type="object" name="test_channel" string="Test" attrs='{"invisible": [["web_page", "=", False]]}'/>
172                             <field name="are_you_inside" invisible="1"/>
173                         </div>
174                     </div>
175                     <div class="oe_right oe_button_box" name="buttons">
176                         <button class="oe_inline oe_stat_button" type="action" attrs="{'invisible':[('nbr_session','=', 0)]}" name="%(action_session_channel)d" icon="fa-comments">
177                             <field string="Sessions" name="nbr_session" widget="statinfo"/>
178                         </button>
179                     </div>
180                     <group>
181                         <group string="Operators">
182                             <field name="user_ids" widget="many2many_kanban" nolabel="1" colspan="2">
183                                 <kanban>
184                                     <field name="name"/>
185                                     <templates>
186                                         <t t-name="kanban-box">
187                                             <div>
188                                                 <a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
189                                                 <div class="oe_group_details" style="min-height: 40px">
190                                                     <img t-att-src="kanban_image('res.users', 'image', record.id.value)"
191                                                         class="oe_avatar oe_kanban_avatar_smallbox" style="float:left; margin-right: 10px;"/>
192                                                     <h4><field name="name"/></h4>
193                                                 </div>
194                                             </div>
195                                         </t>
196                                     </templates>
197                                 </kanban>
198                             </field>
199                         </group>
200                         <group string="Options">
201                             <field name="button_text"/>
202                             <field name="input_placeholder"/>
203                             <field name="default_message" placeholder="e.g. Hello, how may I help you?"/>
204                         </group>
205                     </group>
206
207                     <div attrs='{"invisible": [["web_page", "=", False]]}'>
208                         <separator string="How to use the Live Chat widget?"/>
209                         <p>
210                             Copy and paste this code into your website, within the &amp;lt;head&amp;gt; tag:
211                         </p>
212                         <field name="script_external" readonly="1" class="oe_tag"/>
213                         <p>
214                             or copy this url and send it by email to your customers or suppliers:
215                         </p>
216                         <field name="web_page" readonly="1" class="oe_tag" widget="url"/>
217                         <p>For website built with Odoo CMS, please install the website_livechat module. Then go to Settings > Website Settings and select the Live Chat Channel you want to add on your website.</p>
218                     </div>
219
220                     <group string="Channel Rules">
221                         <field name="rule_ids" nolabel="1"/>
222                     </group>
223                 </sheet>
224                 </form>
225             </field>
226         </record>
227
228
229
230         <!--
231             Views for im_livechat_channel_rule
232         -->
233         <record id="im_livechat_channel_rule_tree_view" model="ir.ui.view">
234             <field name="name">im.livechat.channel.rule.tree</field>
235             <field name="model">im_livechat.channel.rule</field>
236             <field name="arch" type="xml">
237                 <tree string="Rules">
238                     <field name="regex_url"/>
239                     <field name="action"/>
240                     <field name="country_ids"/>
241                 </tree>
242             </field>
243         </record>
244
245         <record id="im_livechat_channel_rule_form_view" model="ir.ui.view">
246             <field name="name">im_livechat.channel.rule.form</field>
247             <field name="model">im_livechat.channel.rule</field>
248             <field name="type">form</field>
249             <field name="arch" type="xml">
250                 <form string="Channel Rule">
251                     <sheet>
252                         <group>
253                             <field name="action"/>
254                             <field name="regex_url" />
255                             <field name="auto_popup_timer" />
256                         </group>
257                         <notebook>
258                             <page string="Blocked Countries">
259                                 <field name="country_ids" />
260                             </page>
261                         </notebook>
262                     </sheet>
263                 </form>
264             </field>
265         </record>
266
267
268         <!-- Menu items -->
269         <menuitem name="Live Chat" parent="mail.mail_feeds_main" id="im_livechat" groups="group_im_livechat"/>
270
271         <menuitem name="History" parent="im_livechat" id="session_history" action="action_session_history" groups="group_im_livechat"/>
272
273         <menuitem name="Channels" parent="im_livechat" id="support_channels" action="action_support_channels" groups="group_im_livechat"/>
274
275
276     </data>
277 </openerp>