diff --git a/pos_chatter/README.rst b/pos_chatter/README.rst new file mode 100644 index 000000000..2b530564f --- /dev/null +++ b/pos_chatter/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +============= +POS Chat Box +============= +Using the POS screen, this module facilitates user communication. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: yadhukrishnan @ cybrosys, odoo@cybrosys.com + +License +------- +Affero General Public License, Version 3 (AGPL v3). +(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) + + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://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 `__ + +Further information +=================== +HTML Description: ``__ diff --git a/pos_chatter/__init__.py b/pos_chatter/__init__.py new file mode 100644 index 000000000..e20701c73 --- /dev/null +++ b/pos_chatter/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Yadhukrishnan K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import controllers diff --git a/pos_chatter/__manifest__.py b/pos_chatter/__manifest__.py new file mode 100644 index 000000000..70352a129 --- /dev/null +++ b/pos_chatter/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Yadhukrishnan K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +{ + 'name': 'POS Chat Box', + 'category': 'Point Of Sale', + 'version': '16.0.1.0.0', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'summary': """POS Chat Box For Odoo16 Community and Enterprise Edition""", + 'description': """Using the POS screen, this module facilitates user ' + 'communication.""", + 'images': ['static/description/banner.png'], + 'depends': [ + 'base', + 'point_of_sale', + ], + 'assets': { + 'point_of_sale.assets': [ + '/pos_chatter/static/src/xml/pos_systray_icon.xml', + '/pos_chatter/static/src/js/pos_systray_icon.js', + '/pos_chatter/static/src/js//pos_msg_view.js', + '/pos_chatter/static/src/js/pos_chat_view.js', + ], + }, + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/pos_chatter/controllers/__init__.py b/pos_chatter/controllers/__init__.py new file mode 100644 index 000000000..bd8c608a1 --- /dev/null +++ b/pos_chatter/controllers/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Yadhukrishnan K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from . import systray diff --git a/pos_chatter/controllers/systray.py b/pos_chatter/controllers/systray.py new file mode 100644 index 000000000..01ab81ec6 --- /dev/null +++ b/pos_chatter/controllers/systray.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Yadhukrishnan K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +################################################################################ +from odoo import http +from odoo.http import request + + +class SystrayController(http.Controller): + """ + The PosSystray Getting values to the pos chatter list, pos message and write + the record to "mail.message". + Methods: + get_data_pos_systray(self): + Getting data to the Message chatter list + get_data_chat_box(self, **kw): + kw contain the id of the channel and getting the message of the + corresponding channel id. + action_create_message_mail(self, **kw): + creating new record in "mail.message" + """ + + @http.route('/pos_systray/message_data', auth='public', type='json') + def get_data_pos_systray(self): + """ + Summary: + Getting data to the Message chatter list. + Return: + it contains details about chatter list. + """ + return [{'id': mail_channel_id.id, + 'type': mail_channel_id.channel_type, + 'name': mail_channel_id.name, + 'message_body': request.env['mail.message'].search( + [('model', '=', 'mail.channel'), + ('res_id', '=', mail_channel_id.id)], limit=1).body + } for mail_channel_id in request.env['mail.channel'].search([]) + for partner_id in mail_channel_id.channel_partner_ids + if partner_id.id == request.env.user.partner_id.id] + + @http.route('/pos_systray/chat_message', auth='public', type='json') + def get_data_chat_box(self, **kw): + """ + Summary: + getting the message of the corresponding channel id. + Args: + all_message_list = [] + mail_channel_ids = request.env['mail.channel'].search([]) + for mail_channel_id in mail_channel_ids: + for partner_id in mail_channel_id.channel_partner_ids: + if partner_id.id == request.env.user.partner_id.id: + message_id = request.env['mail.message'].search( + [('model', '=', 'mail.channel'), + ('res_id', '=', mail_channel_id.id)], limit=1) + all_message_list.append({ + 'id': mail_channel_id.id, + 'type': mail_channel_id.channel_type, + 'name': mail_channel_id.name, + 'message_body': message_id.body + })dict): + it contains channel id of the clicked channel. + """ + return { + 'name': request.env['mail.channel'].browse(int(kw['data'])).name, + 'messages': [{ + 'body': message_id.body, + 'author': message_id.author_id.name, + 'flag': 1 if message_id.author_id.id == request.env.user. + partner_id.id else 0 + } for message_id in request.env['mail.message'].search( + [('model', '=', 'mail.channel'), + ('res_id', '=', int(kw['data']))]).sorted('create_date') + ], + 'channel_id': int(kw['data']) + } + + @http.route('/pos_chatter/send_message', auth='public', type='json') + def action_create_message_mail(self, **kw): + """ + Summary: + creating new record in "mail.message" + Args: + kw(dict): + it contains channel id of the clicked channel. + """ + data = kw['data'] + request.env['mail.message'].sudo().create({ + 'body': "

" + data['msg_body'] + "

", + 'model': 'mail.channel', + 'res_id': int(data['res_id']), + 'message_type': 'comment', + 'author_id': request.env.user.partner_id.id + }) + return True diff --git a/pos_chatter/doc/RELEASE_NOTES.md b/pos_chatter/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..3aa1d9ac7 --- /dev/null +++ b/pos_chatter/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 20.03.2023 +#### Version 16.0.1.0.0 +##### ADD +- Initial Commit for POS Chat Box diff --git a/pos_chatter/static/description/assets/icons/check.png b/pos_chatter/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/pos_chatter/static/description/assets/icons/check.png differ diff --git a/pos_chatter/static/description/assets/icons/chevron.png b/pos_chatter/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/pos_chatter/static/description/assets/icons/chevron.png differ diff --git a/pos_chatter/static/description/assets/icons/cogs.png b/pos_chatter/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/pos_chatter/static/description/assets/icons/cogs.png differ diff --git a/pos_chatter/static/description/assets/icons/consultation.png b/pos_chatter/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/pos_chatter/static/description/assets/icons/consultation.png differ diff --git a/pos_chatter/static/description/assets/icons/ecom-black.png b/pos_chatter/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/pos_chatter/static/description/assets/icons/ecom-black.png differ diff --git a/pos_chatter/static/description/assets/icons/education-black.png b/pos_chatter/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/pos_chatter/static/description/assets/icons/education-black.png differ diff --git a/pos_chatter/static/description/assets/icons/hotel-black.png b/pos_chatter/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/pos_chatter/static/description/assets/icons/hotel-black.png differ diff --git a/pos_chatter/static/description/assets/icons/license.png b/pos_chatter/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/pos_chatter/static/description/assets/icons/license.png differ diff --git a/pos_chatter/static/description/assets/icons/lifebuoy.png b/pos_chatter/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/pos_chatter/static/description/assets/icons/lifebuoy.png differ diff --git a/pos_chatter/static/description/assets/icons/manufacturing-black.png b/pos_chatter/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/pos_chatter/static/description/assets/icons/manufacturing-black.png differ diff --git a/pos_chatter/static/description/assets/icons/pos-black.png b/pos_chatter/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/pos_chatter/static/description/assets/icons/pos-black.png differ diff --git a/pos_chatter/static/description/assets/icons/puzzle.png b/pos_chatter/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/pos_chatter/static/description/assets/icons/puzzle.png differ diff --git a/pos_chatter/static/description/assets/icons/restaurant-black.png b/pos_chatter/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/pos_chatter/static/description/assets/icons/restaurant-black.png differ diff --git a/pos_chatter/static/description/assets/icons/service-black.png b/pos_chatter/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/pos_chatter/static/description/assets/icons/service-black.png differ diff --git a/pos_chatter/static/description/assets/icons/trading-black.png b/pos_chatter/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/pos_chatter/static/description/assets/icons/trading-black.png differ diff --git a/pos_chatter/static/description/assets/icons/training.png b/pos_chatter/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/pos_chatter/static/description/assets/icons/training.png differ diff --git a/pos_chatter/static/description/assets/icons/update.png b/pos_chatter/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/pos_chatter/static/description/assets/icons/update.png differ diff --git a/pos_chatter/static/description/assets/icons/user.png b/pos_chatter/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/pos_chatter/static/description/assets/icons/user.png differ diff --git a/pos_chatter/static/description/assets/icons/wrench.png b/pos_chatter/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/pos_chatter/static/description/assets/icons/wrench.png differ diff --git a/pos_chatter/static/description/assets/misc/categories.png b/pos_chatter/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/categories.png differ diff --git a/pos_chatter/static/description/assets/misc/check-box.png b/pos_chatter/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/check-box.png differ diff --git a/pos_chatter/static/description/assets/misc/compass.png b/pos_chatter/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/pos_chatter/static/description/assets/misc/compass.png differ diff --git a/pos_chatter/static/description/assets/misc/corporate.png b/pos_chatter/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/pos_chatter/static/description/assets/misc/corporate.png differ diff --git a/pos_chatter/static/description/assets/misc/customer-support.png b/pos_chatter/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/pos_chatter/static/description/assets/misc/customer-support.png differ diff --git a/pos_chatter/static/description/assets/misc/cybrosys-logo.png b/pos_chatter/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/pos_chatter/static/description/assets/misc/cybrosys-logo.png differ diff --git a/pos_chatter/static/description/assets/misc/features.png b/pos_chatter/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/features.png differ diff --git a/pos_chatter/static/description/assets/misc/logo.png b/pos_chatter/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pos_chatter/static/description/assets/misc/logo.png differ diff --git a/pos_chatter/static/description/assets/misc/pictures.png b/pos_chatter/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/pictures.png differ diff --git a/pos_chatter/static/description/assets/misc/pie-chart.png b/pos_chatter/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/pie-chart.png differ diff --git a/pos_chatter/static/description/assets/misc/right-arrow.png b/pos_chatter/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/right-arrow.png differ diff --git a/pos_chatter/static/description/assets/misc/star.png b/pos_chatter/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/pos_chatter/static/description/assets/misc/star.png differ diff --git a/pos_chatter/static/description/assets/misc/support.png b/pos_chatter/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/support.png differ diff --git a/pos_chatter/static/description/assets/misc/whatsapp.png b/pos_chatter/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/pos_chatter/static/description/assets/misc/whatsapp.png differ diff --git a/pos_chatter/static/description/assets/modules/l1.png b/pos_chatter/static/description/assets/modules/l1.png new file mode 100644 index 000000000..ed175b076 Binary files /dev/null and b/pos_chatter/static/description/assets/modules/l1.png differ diff --git a/pos_chatter/static/description/assets/modules/l2.png b/pos_chatter/static/description/assets/modules/l2.png new file mode 100644 index 000000000..a3194264c Binary files /dev/null and b/pos_chatter/static/description/assets/modules/l2.png differ diff --git a/pos_chatter/static/description/assets/modules/l3.png b/pos_chatter/static/description/assets/modules/l3.png new file mode 100644 index 000000000..e894393ef Binary files /dev/null and b/pos_chatter/static/description/assets/modules/l3.png differ diff --git a/pos_chatter/static/description/assets/modules/l4.png b/pos_chatter/static/description/assets/modules/l4.png new file mode 100644 index 000000000..f3c986fc1 Binary files /dev/null and b/pos_chatter/static/description/assets/modules/l4.png differ diff --git a/pos_chatter/static/description/assets/modules/l5.png b/pos_chatter/static/description/assets/modules/l5.png new file mode 100644 index 000000000..b21837312 Binary files /dev/null and b/pos_chatter/static/description/assets/modules/l5.png differ diff --git a/pos_chatter/static/description/assets/modules/l6.png b/pos_chatter/static/description/assets/modules/l6.png new file mode 100644 index 000000000..e64a5b55c Binary files /dev/null and b/pos_chatter/static/description/assets/modules/l6.png differ diff --git a/pos_chatter/static/description/assets/screenshots/Screenshot.png b/pos_chatter/static/description/assets/screenshots/Screenshot.png new file mode 100644 index 000000000..dacd331eb Binary files /dev/null and b/pos_chatter/static/description/assets/screenshots/Screenshot.png differ diff --git a/pos_chatter/static/description/assets/screenshots/Screenshot2.png b/pos_chatter/static/description/assets/screenshots/Screenshot2.png new file mode 100644 index 000000000..fb18d3683 Binary files /dev/null and b/pos_chatter/static/description/assets/screenshots/Screenshot2.png differ diff --git a/pos_chatter/static/description/assets/screenshots/Screenshot3.png b/pos_chatter/static/description/assets/screenshots/Screenshot3.png new file mode 100644 index 000000000..2bfbda585 Binary files /dev/null and b/pos_chatter/static/description/assets/screenshots/Screenshot3.png differ diff --git a/pos_chatter/static/description/assets/screenshots/hero.gif b/pos_chatter/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..61424854f Binary files /dev/null and b/pos_chatter/static/description/assets/screenshots/hero.gif differ diff --git a/pos_chatter/static/description/banner.png b/pos_chatter/static/description/banner.png new file mode 100644 index 000000000..93c573093 Binary files /dev/null and b/pos_chatter/static/description/banner.png differ diff --git a/pos_chatter/static/description/icon.png b/pos_chatter/static/description/icon.png new file mode 100644 index 000000000..1b24a1508 Binary files /dev/null and b/pos_chatter/static/description/icon.png differ diff --git a/pos_chatter/static/description/index.html b/pos_chatter/static/description/index.html new file mode 100644 index 000000000..ff3466cda --- /dev/null +++ b/pos_chatter/static/description/index.html @@ -0,0 +1,612 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ + + +

+ POS Chat Box

+

A Module for Chat in POS.

+ + + +
+ + +
+
+ +
+

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ Using the POS screen, this module facilitates user communication. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Users can use chatter in the pos session. +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Chat Button on POS screen

+

+ +
+
+

Chatlist

+ +
+ + +
+

On clicking an + item in chat list, chat window open in pos screen

+

+ +
+
+
+ + + +
+
+ +
+

+ Related + Products +

+
+
+
+ +
+
+ + + + +
+
+ +
+

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + + +
+
+ +
+

+ Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+
+
+ + + + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/pos_chatter/static/src/js/pos_chat_view.js b/pos_chatter/static/src/js/pos_chat_view.js new file mode 100644 index 000000000..77058a0f6 --- /dev/null +++ b/pos_chatter/static/src/js/pos_chat_view.js @@ -0,0 +1,130 @@ +/** @odoo-module **/ +import ajax from 'web.ajax'; +const { xml,onMounted,useState,useExternalListener, useRef } = owl; +export class ChatMsgView extends owl.Component { + setup() { + super.setup(...arguments); + this.flag_scroll = 1 + this.flag = 0 + this.root = useRef("root") + onMounted(this.render_messages) + useExternalListener(window, "click", this.ext_close_window, true); + this.state = owl.useState({ + 'name': {}, + 'data': {}, + 'id': {} + }) + } + /** function for the enter key to send messages*/ + keyEnter(event) { + var self = this + if (event.key === "Enter") { + self._onClickMessageSend() + } + } + /** for running the function passing flag values*/ + /** getting old message*/ + render_messages() { + var self = this + ajax.jsonRpc('/pos_systray/chat_message', 'call', { + 'data': self.props.channel_id + }).then(function(result) { + if (self.flag_scroll == 1) { + var element = this.root.el.querySelector("#msg_content"); + element.scrollTop = element.scrollHeight; + } + var message_list = [] + var messages = result.messages + $(messages).each(function(message) { + const htmlString = messages[message].body; + const parser = new DOMParser(); + const parsedHtml = parser.parseFromString(htmlString, 'text/html'); + const plainText = parsedHtml.documentElement.textContent; + message_list.push({ + 'body': plainText, + 'author': messages[message].author, + 'flag': messages[message].flag + }) + }); + self.state.data = message_list; + self.state.name = result.name; + self.state.id = result.channel_id; + }) + if (self.flag == 0) { + setTimeout(this.render_messages.bind(this), 1000); + self.flag_scroll = 0 + } + } + /** for closing the chat window*/ + close_window() { + this.__owl__.remove() + this.flag = 1 + this.flag_scroll = 0 + } + /** for closing the opened chat window */ + ext_close_window(ev) { + console.log(this.root.el) + if(this.root.el){ + if (!this.root.el.contains(ev.target)) { + this.__owl__.remove() + this.flag = 1 + this.flag_scroll = 0 + } + } + } + /** for sending the message*/ + _onClickMessageSend() { + var self = this + var input_value = this.root.el.querySelector("#message_to_send") + var res_id = this.root.el.querySelector("#button_send").getAttribute("value") + var element = this.root.el.querySelector("#msg_content"); + element.scrollTop = element.scrollHeight; + if (input_value.value) { + var data = { + 'res_id': res_id, + 'msg_body': input_value.value + } + ajax.jsonRpc('/pos_chatter/send_message', 'call', { + 'data': data + }).then(function() { + input_value.value = "" + var res_id = self.root.el.querySelector("#button_send").getAttribute("value") + self.render_messages(); + var element = self.root.el.querySelector("#msg_content"); + element.scrollTop = element.scrollHeight; + }) + } + } +} +ChatMsgView.template = xml` + //template for pos chat view +
+
+
+ + + +
+
+ + +

+
+ +

+
+ +

You +
+ +

+
+
+
+
+
+ + +
+
+
` diff --git a/pos_chatter/static/src/js/pos_msg_view.js b/pos_chatter/static/src/js/pos_msg_view.js new file mode 100644 index 000000000..de4ec1a99 --- /dev/null +++ b/pos_chatter/static/src/js/pos_msg_view.js @@ -0,0 +1,150 @@ +/** @odoo-module **/ +import ajax from 'web.ajax'; +const { mount,xml, onMounted, useState, useRef} = owl; +import { ChatMsgView } from "./pos_chat_view" +export class PosMsgView extends owl.Component { + setup(){ + super.setup() + this.root = useRef("root") + onMounted(this.render_msg_view) + this.MsgWindow = new ChatMsgView(); + this.state = useState({ + 'data': {} + }); + } + /** for getting all chat list */ + render_msg_view(data){ + var self = this + ajax.jsonRpc('/pos_systray/message_data', 'call').then(function(data){ + var message_list = [] + var messages = data + $(messages).each(function(message){ + const htmlString = messages[message].message_body; + const parser = new DOMParser(); + const parsedHtml = parser.parseFromString(htmlString, 'text/html'); + const plainText = parsedHtml.documentElement.textContent; + message_list.push({ + 'id': messages[message].id, + 'type': messages[message].type, + 'name': messages[message].name, + 'message_body': plainText + }) + }); + self.state.data = message_list + }) + } + + /** for click function for navbar*/ + _onClickAllMessage(){ + this.root.el.querySelector('#all_message').style.display = "block" + this.root.el.querySelector('#all_chat').style.display = "none" + this.root.el.querySelector('#all_channels').style.display = "none" + this.root.el.querySelector('#all_message_button').style.color = "#000" + this.root.el.querySelector('#all_chat_button').style.color = "#9c9a97" + this.root.el.querySelector('#all_channels_button').style.color = "#9c9a97" + } + /** for click function for navbar*/ + _onClickAllChannels(){ + this.root.el.querySelector('#all_message').style.display = "none" + this.root.el.querySelector('#all_chat').style.display = "none" + this.root.el.querySelector('#all_channels').style.display = "block" + this.root.el.querySelector('#all_message_button').style.color = "#9c9a97" + this.root.el.querySelector('#all_chat_button').style.color = "#9c9a97" + this.root.el.querySelector('#all_channels_button').style.color = "#000" + } + /** for click function for navbar*/ + _onClickAllChat(){ + this.root.el.querySelector('#all_message').style.display = "none" + this.root.el.querySelector('#all_chat').style.display = "block" + this.root.el.querySelector('#all_channels').style.display = "none" + this.root.el.querySelector('#all_message_button').style.color = "#9c9a97" + this.root.el.querySelector('#all_chat_button').style.color = "#000" + this.root.el.querySelector('#all_channels_button').style.color = "#9c9a97" + } + /** On clicking the chat or channel open the corresponding chat view */ + _onClickToMessage(ev){ + var self = this + var channel_id = ev.currentTarget.getAttribute("value") + this.__owl__.remove() + if($("#pos_chat_view").length == 0){ + this.schedule_dropdown = mount(ChatMsgView, document.body, {props: { + channel_id + }}) + }else if($("#pos_chat_view").length > 0){ + this.schedule_dropdown = mount(ChatMsgView, document.body, {props: { + channel_id + }}) + } + } +} +PosMsgView.template = xml` + //template for pos messages list view +
+
+

All

+

Chat

+

Channels

+
+
+
+ +
+
+ + + + + + +
+
+ +
+ +
+
+
+
+ + +
` diff --git a/pos_chatter/static/src/js/pos_systray_icon.js b/pos_chatter/static/src/js/pos_systray_icon.js new file mode 100644 index 000000000..f0502e338 --- /dev/null +++ b/pos_chatter/static/src/js/pos_systray_icon.js @@ -0,0 +1,23 @@ +/** @odoo-module **/ +import PosComponent from 'point_of_sale.PosComponent'; +import { mount } from "@odoo/owl"; +import Registries from 'point_of_sale.Registries'; +import { PosMsgView } from "./pos_msg_view" +class PosSystray extends PosComponent { + setup(){ + super.setup(...arguments); + } + /** for opening the chat list window while click on the systray button*/ + onClick(ev) { + if($(".pos_systray_template").length == 0){ + this.schedule_dropdown = mount(PosMsgView, document.body) + }else if($(".pos_systray_template").length > 0){ + this.schedule_dropdown.then(function(res){ + res.__owl__.remove() + }) + } + } +} +PosSystray.template = 'PosSystray'; +Registries.Component.add(PosSystray); +return PosSystray; diff --git a/pos_chatter/static/src/xml/pos_systray_icon.xml b/pos_chatter/static/src/xml/pos_systray_icon.xml new file mode 100644 index 000000000..8e637909b --- /dev/null +++ b/pos_chatter/static/src/xml/pos_systray_icon.xml @@ -0,0 +1,15 @@ + + + + +
+ +
+
+ + + + + + +