@ -0,0 +1,49 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Whatsapp Chat Layout in Odoo Discuss |
|||
==================================== |
|||
* Whatsapp Chat Layout in Odoo Discuss module for Odoo 18. |
|||
|
|||
Installation |
|||
============ |
|||
- www.odoo.com/documentation/17.0/setup/install.html |
|||
- Install our custom addon |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
* Developer:(V16) Afra M P, |
|||
(V17) Gayathri v, |
|||
(V18) Bhagyadev KP |
|||
Contact : odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
|||
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Sreerag PM (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import models |
|||
from . import controllers |
|||
@ -0,0 +1,56 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Sreerag PM (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Whatsapp Chat Layout in Odoo Discuss', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Discuss', |
|||
'summary': 'Redesigned the discuss module into whatsapp chat layout', |
|||
'description': 'Odoo discuss with whatsapp view', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['base', 'mail', 'base_setup', 'web'], |
|||
'data': [ |
|||
'views/res_config_settings.xml' |
|||
], |
|||
'assets': { |
|||
'web.assets_backend': [ |
|||
'whatsapp_chat_layout/static/src/js/discuss_container.js', |
|||
'whatsapp_chat_layout/static/src/js/Thread.js', |
|||
'whatsapp_chat_layout/static/src/css/discuss.css', |
|||
'whatsapp_chat_layout/static/src/css/thread.css', |
|||
'whatsapp_chat_layout/static/src/css/color.css', |
|||
'whatsapp_chat_layout/static/src/js/discuss_sidebar.js', |
|||
'whatsapp_chat_layout/static/src/xml/discuss_sidebar.xml', |
|||
'whatsapp_chat_layout/static/src/xml/discuss_sidebar_category.xml', |
|||
'whatsapp_chat_layout/static/src/xml/discuss_sidebar_categories_advanced.xml' |
|||
], |
|||
}, |
|||
'images': [ |
|||
'static/description/banner.jpg' |
|||
], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Sreerag PM (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import whatsapp_chat_layout |
|||
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Sreerag PM (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import http |
|||
from odoo.http import request |
|||
|
|||
|
|||
class Color(http.Controller): |
|||
"""The ProjectFilter class provides the filter option to the js. |
|||
When applying the filter returns the corresponding data.""" |
|||
|
|||
@http.route('/select_color', auth='public', type='json') |
|||
def get_color(self): |
|||
"""Function to return values into js""" |
|||
colors = {'background_color': request.env[ |
|||
'ir.config_parameter'].sudo().get_param( |
|||
'whatsapp_chat_layout.background_color'), 'layout_color': request.env[ |
|||
'ir.config_parameter'].sudo().get_param( |
|||
'whatsapp_chat_layout.layout_color'), |
|||
'background_image': request.env.user.company_id.background_image} |
|||
return colors |
|||
|
|||
@http.route('/select_user_image', auth='public', type='json') |
|||
def get_user_image(self): |
|||
"""Function to get current user image and return in js""" |
|||
return request.env.user.partner_id.image_1920 |
|||
@ -0,0 +1,7 @@ |
|||
## Module <whatsapp_chat_layout> |
|||
|
|||
#### 22.10.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Whatsapp Chat Layout in Odoo Discuss |
|||
- |
|||
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Sreerag PM (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import res_company |
|||
from . import res_config_settings |
|||
@ -0,0 +1,30 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Sreerag PM (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResCompany(models.Model): |
|||
"""Inherit the model res_company to store the image""" |
|||
_inherit = 'res.company' |
|||
|
|||
background_image = fields.Binary(string="Background Image", attachment=True, |
|||
help='Provide background image') |
|||
@ -0,0 +1,40 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Sreerag PM (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
"""Inherit the model res_config_settings to add fields""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
background_color = fields.Char(string='Background Color', |
|||
config_parameter='whatsapp_chat_layout.background_color', |
|||
default='#FFFFFF', |
|||
help='Select discuss background color') |
|||
layout_color = fields.Char(string='Layout Color', |
|||
config_parameter='whatsapp_chat_layout.layout_color', |
|||
default='#3a8180', |
|||
help='select discuss layout color') |
|||
chat_background = fields.Binary(string="Background Image", |
|||
related='company_id.background_image', |
|||
readonly=False, |
|||
help='Add background image for discuss') |
|||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 209 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 495 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 624 B |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 214 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 929 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 542 B |
|
After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 738 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 600 B |
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 878 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 800 B |
|
After Width: | Height: | Size: 905 B |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 839 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 627 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 988 B |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 875 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 710 KiB |
|
After Width: | Height: | Size: 776 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 738 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 610 KiB |
|
After Width: | Height: | Size: 780 KiB |
|
After Width: | Height: | Size: 39 KiB |
@ -0,0 +1,23 @@ |
|||
:root{ |
|||
--background-color: #ffffff; |
|||
--layout-color: #3a8180; |
|||
} |
|||
|
|||
.o-mail-DiscussSidebarCategory{ |
|||
height: 74px; |
|||
background-color: white !important; |
|||
} |
|||
.o-mail-DiscussSidebarCategory span{ |
|||
color: black!important; |
|||
} |
|||
|
|||
.o-mail-DiscussSidebarCategory-icon{ |
|||
color: black!important; |
|||
} |
|||
.o-mail-DiscussSidebarCategory-add{ |
|||
color: black!important; |
|||
} |
|||
|
|||
i.o_DiscussSidebarCategory_command{ |
|||
color: black!important; |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
.o_DiscussSidebar{ |
|||
width: 400px; |
|||
} |
|||
.o_DiscussSidebar_startAMeetingButton { |
|||
font-size: 24px; |
|||
width: 55px; |
|||
height: 65px; |
|||
background-color: #eeedee!important; |
|||
color: #979797; |
|||
border-color: #eeedee; |
|||
margin-left: 10px; |
|||
padding-top: 18px; |
|||
} |
|||
|
|||
.header { |
|||
margin-left: 200px; |
|||
} |
|||
|
|||
.text-700 { |
|||
color: gray!important; |
|||
} |
|||
|
|||
.o-mail-DiscussSidebarCategory{ |
|||
height: 74px; |
|||
background-color: var(--layout-color) !important; |
|||
} |
|||
.o-mail-DiscussSidebarCategory span{ |
|||
color: white!important; |
|||
} |
|||
|
|||
.o-mail-DiscussSidebarCategory-icon{ |
|||
color: white!important; |
|||
} |
|||
.o-mail-DiscussSidebarCategory-add{ |
|||
color: white!important; |
|||
} |
|||
|
|||
i.o_DiscussSidebarCategory_command{ |
|||
color: white!important; |
|||
} |
|||
|
|||
.o_DiscussSidebar{ |
|||
background-color: #FFFFFF!important; |
|||
} |
|||
.o-mail-ThreadIcon { |
|||
border-radius: 50%; |
|||
font-size: 34px; |
|||
padding-right: 15px; |
|||
color: var(--layout-color) !important; |
|||
} |
|||
.o-mail-DiscussSidebar-item { |
|||
color: black; |
|||
font-size: 17px; |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
.o_ThreadViewTopbar { |
|||
height: 66px; |
|||
background-color: #eeedee!important; |
|||
} |
|||
|
|||
.o-mail-Thread.o_ThreadView_messageList { |
|||
background-color: var(--background-color) !important; |
|||
background-image: var(--background-image) !important; |
|||
background-repeat:no-repeat; |
|||
background-size:cover; |
|||
} |
|||
.o-mail-Thread.o_ThreadView_messageList{ |
|||
background-color: var(--background-color) !important; |
|||
background-image: var(--background-image) !important; |
|||
background-repeat:no-repeat; |
|||
background-size:cover; |
|||
} |
|||
.o_Composer{ |
|||
background-color: #eeedee!important; |
|||
height: 85px; |
|||
padding-top: 15px!important; |
|||
} |
|||
|
|||
button.o_Composer_toolButton{ |
|||
font-size: 25px; |
|||
background-color: #eeedee; |
|||
} |
|||
.o_Composer_toolButtons { |
|||
height: 50px; |
|||
background-color: #eeedee!important; |
|||
} |
|||
|
|||
button.o-mail-Composer-send.o-mail-Composer-send { |
|||
background-color: var(--layout-color) !important; |
|||
color: white; |
|||
} |
|||
.o_Message.o_MessageList_item.o_MessageList_message { |
|||
display: flex; |
|||
flex-direction: row-reverse; |
|||
justify-content: end; |
|||
} |
|||
.o_Message.o_MessageList_item.o_MessageList_message { |
|||
display: flex; |
|||
flex-direction: row-reverse; |
|||
justify-content: end; |
|||
} |
|||
.text-break { |
|||
word-break: inherit!important; |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
import { Thread } from "@mail/core/common/thread_model"; |
|||
import { patch } from "@web/core/utils/patch"; |
|||
|
|||
//Patching Thread Component
|
|||
patch(Thread.prototype, { |
|||
setup() { |
|||
super.setup(...arguments); |
|||
}, |
|||
async leave() { |
|||
super.leave(...arguments); |
|||
await location.reload(); |
|||
}, |
|||
}); |
|||
@ -0,0 +1,30 @@ |
|||
import { Discuss } from "@mail/core/public_web/discuss"; |
|||
import { patch} from "@web/core/utils/patch"; |
|||
import { rpc } from "@web/core/network/rpc"; |
|||
const { useRef } = owl; |
|||
import { onMounted } from "@odoo/owl"; |
|||
|
|||
patch(Discuss.prototype, { |
|||
setup() { |
|||
super.setup(...arguments); |
|||
this.core = useRef("core"); |
|||
onMounted(async () => { |
|||
var self = this; |
|||
await rpc('/select_color', {}).then(function(result) { |
|||
if (result.background_color !== false){ |
|||
self.core.el.style.setProperty("background-color",result.background_color |
|||
); |
|||
} |
|||
if (result.layout_color !== false){ |
|||
document.documentElement.style.setProperty("layout-color",result.layout_color); |
|||
} |
|||
if (result.background_image !== false){ |
|||
self.core.el.style.setProperty("background-image",'url(data:image/png;base64,'+result.background_image+')',"important"); |
|||
self.core.el.style.setProperty("background-size", "cover", "important"); |
|||
self.core.el.style.setProperty("background-position", "center", "important"); |
|||
self.core.el.style.setProperty("background-repeat", "no-repeat", "important"); |
|||
} |
|||
}); |
|||
}); |
|||
}, |
|||
}); |
|||
@ -0,0 +1,79 @@ |
|||
/** @odoo-module **/ |
|||
import { patch } from "@web/core/utils/patch"; |
|||
import { MessagingMenu } from "@mail/core/public_web/messaging_menu"; |
|||
import { DiscussSidebar } from "@mail/core/public_web/discuss_sidebar"; |
|||
import { DiscussSidebarMailboxes } from "@mail/core/web/discuss_sidebar_mailboxes"; |
|||
import { ChannelSelector } from "@mail/discuss/core/web/channel_selector"; |
|||
import { VoiceRecorder } from "@mail/discuss/voice_message/common/voice_recorder"; |
|||
import { onMounted, onWillStart, useRef } from "@odoo/owl"; |
|||
import { useState } from "@odoo/owl"; |
|||
import { rpc } from "@web/core/network/rpc"; |
|||
import { DiscussSidebarChannel } from "@mail/discuss/core/public_web/discuss_sidebar_categories"; |
|||
import { DiscussSidebarCategory } from "@mail/discuss/core/public_web/discuss_sidebar_categories"; |
|||
import { cleanTerm } from "@mail/utils/common/format"; |
|||
import { useService } from "@web/core/utils/hooks"; |
|||
|
|||
patch(DiscussSidebar.prototype, { |
|||
setup() { |
|||
super.setup(); |
|||
this.root = useRef("root") |
|||
this.state = useState({ |
|||
sidebar: 'channels', |
|||
chat: 'chats', |
|||
quickSearchVal: "", |
|||
floatingQuickSearchOpen: false |
|||
}); |
|||
this.store = useState(useService("mail.store")); |
|||
// Use the same filteredThreads logic as DiscussSidebarCategories
|
|||
this.filteredThreads = (threads) => { |
|||
return threads.filter( |
|||
(thread) => |
|||
thread.displayInSidebar && |
|||
(thread.parent_channel_id || |
|||
!this.state.quickSearchVal || |
|||
cleanTerm(thread.displayName).includes(cleanTerm(this.state.quickSearchVal))) |
|||
); |
|||
}; |
|||
|
|||
onWillStart(async () => { |
|||
await rpc('/select_color', {}).then(function(result) { |
|||
const root = document.documentElement; |
|||
if (result.background_color !== false){ |
|||
root.style.setProperty("--background-color",result.background_color); |
|||
} |
|||
}) |
|||
}); |
|||
onMounted(this.sidebar) |
|||
}, |
|||
|
|||
sidebar(){ |
|||
var self = this |
|||
rpc('/select_user_image', {}).then(function(result) { |
|||
let image = document.createElement('div') |
|||
image.innerHTML = '<img class="o_Composer_currentPartner rounded-circle o_object_fit_cover"style="margin-top: 21px;margin-left: 10px;width: 45px;height: 45px;"src="data:image/png;base64,' + result + '">' |
|||
self.root.el.querySelector('#img').appendChild(image); |
|||
}); |
|||
}, |
|||
_onClickMail(ev) {// Click function of mail button
|
|||
this.root.el.querySelector('.mail').classList.remove("d-none"); |
|||
this.root.el.querySelector('.channel').classList.add("d-none"); |
|||
this.root.el.querySelector('.chat').classList.add("d-none"); |
|||
}, |
|||
_onClickChat(ev) {// Click function of chat button
|
|||
this.root.el.querySelector('.chat').classList.remove("d-none"); |
|||
this.root.el.querySelector('.mail').classList.add("d-none"); |
|||
this.root.el.querySelector('.channel').classList.add("d-none"); |
|||
this.state.sidebarChannel = 'chat' |
|||
}, |
|||
_onClickChannel(ev) {// Click function of channel button
|
|||
this.root.el.querySelector('.channel').classList.remove("d-none"); |
|||
this.root.el.querySelector('.mail').classList.add("d-none"); |
|||
this.root.el.querySelector('.chat').classList.add("d-none"); |
|||
this.state.sidebarChat = 'channel' |
|||
}, |
|||
}); |
|||
|
|||
DiscussSidebar.components = { |
|||
...DiscussSidebar.components, |
|||
DiscussSidebarMailboxes, ChannelSelector, MessagingMenu, DiscussSidebarCategory, VoiceRecorder, DiscussSidebarChannel |
|||
}; |
|||