Browse Source

Initial Commit

pull/81/head
SHEREEF PT 8 years ago
parent
commit
a6a2dab829
  1. 25
      pos_chatter/README.rst
  2. 23
      pos_chatter/__init__.py
  3. 39
      pos_chatter/__openerp__.py
  4. BIN
      pos_chatter/static/description/banner.jpg
  5. BIN
      pos_chatter/static/description/cybro_logo.png
  6. BIN
      pos_chatter/static/description/icon.png
  7. 48
      pos_chatter/static/description/index.html
  8. BIN
      pos_chatter/static/description/pos_chat_01.png
  9. BIN
      pos_chatter/static/description/pos_chat_02.png
  10. 82
      pos_chatter/static/src/css/message.css
  11. 185
      pos_chatter/static/src/js/pos_chat.js
  12. 122
      pos_chatter/static/src/less/message.less
  13. 58
      pos_chatter/static/src/xml/pos_msg.xml
  14. 21
      pos_chatter/views/pos_chat.xml

25
pos_chatter/README.rst

@ -0,0 +1,25 @@
==============
POS Chatter v9
==============
This module adds chat interface in Point of sale screen.
Installation
============
Just select it from available modules to install it, there is no need to extra installations.
Configuration
=============
Nothing to configure.
Usage
=====
* Chat Button on POS screen.
* On clicking chat button,display chat list on the screen.
* On clicking an item in chat list, chat window open in pos screen.
Credits
=======
Developer: Aswani pc @ cybrosys
Guidance: Nilmar Shereef @ cybrosys, shereef@cybrosys.in

23
pos_chatter/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Nilmar Shereef(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

39
pos_chatter/__openerp__.py

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2008-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Nilmar Shereef(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': "POS Chat",
'summary': """Chat in POS""",
'description': "This module adds chat interface in Point of sale screen.",
'author': "Cybrosys Techno Solutions",
'company': "Cybrosys Techno Solutions",
'website': "http://www.cybrosys.com",
'category': 'Point Of Sale',
'version': '0.3',
'depends': ['base', 'point_of_sale'],
'data': ['views/pos_chat.xml'],
'qweb': ['static/src/xml/pos_msg.xml'],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
}

BIN
pos_chatter/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
pos_chatter/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
pos_chatter/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

48
pos_chatter/static/description/index.html

@ -0,0 +1,48 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">POS Chat</h2>
<h3 class="oe_slogan">Easily communicate each other without going outside of POS Screen. </h3>
<h4 class="oe_slogan">Cybrosys Technologies , www.cybrosys.com</h4>
<div>
<h4><p>Features:</p></h4>
<ul>
<li>We can easily communicate each other in POS.</li>
<li>Nothing to configure.</li>
</ul>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Chat Button on POS screen</h3>
<div class="oe_demo oe_picture oe_screenshot">
<img src="pos_chat_01.png">
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">On clicking an item in chatlist, chat window open in pos screen</h3>
<div class="oe_demo oe_picture oe_screenshot">
<img src="pos_chat_02.png">
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;" href="http://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;"
href="http://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;"
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</section>

BIN
pos_chatter/static/description/pos_chat_01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

BIN
pos_chatter/static/description/pos_chat_02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

82
pos_chatter/static/src/css/message.css

@ -0,0 +1,82 @@
.pos .message-box{
position: absolute;
right: -350px;
top: 50px;
width: 100%;
height:100%;
background-color: rgba(0,0,0,0);
z-index:1000;
}
.pos .message-box .message{
position:relative;
top:0;left: 0; right: 0; bottom:0;
margin: auto;
width:350px;
font-size:22px;
background-color: #F0EEEE;
box-shadow: 0px 10px 20px rgba(0,0,0,0.4);
z-index:1200;
font-family: 'Lato';
font-family: Lato;
}
.pos .message .title {
background: #FFFFFF;
margin: 0;
padding: 4px;
border-bottom: solid 1px rgba(60,60,60,0.1);
}
.pos .pos-new_message{
margin-left :90px;
color: #337ab7
}
.pos .message a {
text-decoration: none;
font-size: 11px;
cursor: pointer;
padding: 4px 10px;
}
.pos .message a:hover {
color: #337ab7;
}
.pos .pos-selected {
font-weight: bold;
color : #337ab7;
}
.pos .fa-close {
margin-right: 10px;
cursor: pointer;
}
.ui-widget{
font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif;
background:#FFFFFF;
font-size: 13px;
width:200px;
z-index: 10000;
}
.ui-menu{
padding: 2px 0;
margin-top: 4px;
}
.ui-menu-item{
display: block;
background:#FFFFFF;
color: #000000; :
}
.ui-menu-item:hover{
display: block;
background:#7f82ac;
color:#FFFFFF;
}
.ui-menu .ui-menu-item a{
height:10px;
padding: 1px 16px;
}

185
pos_chatter/static/src/js/pos_chat.js

@ -0,0 +1,185 @@
odoo.define('point_of_sale.pos_chatter', function (require) {
"use strict";
var chrome = require('point_of_sale.chrome');
var core = require('web.core');
var chat_manager = require('mail.chat_manager');
var window_manager = require('mail.window_manager');
var ajax = require('web.ajax');
var gui = require('point_of_sale.gui');
var popup = require('point_of_sale.popups');
var PosBaseWidget = require('point_of_sale.BaseWidget');
var QWeb = core.qweb;
var _t = core._t;
chrome.Chrome.include({
events: {
"click .pos-message": "on_click_pos_message",
},
renderElement: function(){
var self = this;
this.filter = false;
chat_manager.bus.on("update_channel_unread_counter", this, this.update_counter);
chat_manager.is_ready.then(this.update_counter.bind(this));
return this._super();
},
is_open: function () {
return this.$el.hasClass('open');
},
update_counter: function () {
var counter = chat_manager.get_unread_conversation_counter();
this.$('.o_notification_counter').text(counter);
this.$el.toggleClass('o_no_notification', !counter);
this.$el.toggleClass('o_unread_chat', !!chat_manager.get_chat_unread_counter());
if (this.is_open()) {
this.update_channels_preview();
}
},
update_channels_preview: function () {
var self = this;
this.$('.o_mail_navbar_dropdown_channels').html(QWeb.render('mail.chat.Spinner'));
chat_manager.is_ready.then(function () {
var channels = _.filter(chat_manager.get_channels(), function (channel) {
if (self.filter === 'chat') {
return channel.is_chat;
} else if (self.filter === 'channels') {
return !channel.is_chat && channel.type !== 'static';
} else {
return channel.type !== 'static';
}
});
chat_manager.get_channels_preview(channels).then(self._render_channels_preview.bind(self));
});
},
_render_channels_preview: function (channels_preview) {
channels_preview.sort(function (c1, c2) {
return Math.min(1, c2.unread_counter) - Math.min(1, c1.unread_counter) ||
c2.is_chat - c1.is_chat ||
c2.last_message.date.diff(c1.last_message.date);
});
_.each(channels_preview, function (channel) {
channel.last_message_preview = chat_manager.get_message_body_preview(channel.last_message.body);
if (channel.last_message.date.isSame(new Date(), 'd')) { // today
channel.last_message_date = channel.last_message.date.format('LT');
} else {
channel.last_message_date = channel.last_message.date.format('lll');
}
});
this.gui.show_popup('message',{list:channels_preview});
},
on_click_pos_message: function () {
var self = this;
if (this.gui.current_popup) {
this.gui.close_popup();
}
else{
this.update_channels_preview();
}
},
on_click_new_message: function () {
chat_manager.bus.trigger('open_chat');
},
});
var MessageWidget = PosBaseWidget.extend({
template:'MessageWidget',
events: {
"click .o_mail_channel_preview": "on_click_message_item",
"click .pos-new_message": "on_click_new_message",
"click .pos-filter": "on_click_filter",
},
renderElement: function(){
var self = this;
return this._super();
},
show: function(options){
options = options || {};
var self = this;
this._super(options);
this.list = options.list || [];
this.renderElement();
},
on_click_new_message: function () {
this.gui.close_popup();
chat_manager.bus.trigger('open_chat');
},
on_click_filter: function (event) {
event.stopPropagation();
this.$(".pos-filter").removeClass('pos-selected');
var $target = $(event.currentTarget);
$target.addClass('pos-selected');
this.filter = $target.data('filter');
this.update_channels_preview();
},
update_channels_preview: function () {
var self = this;
this.$('.o_mail_navbar_dropdown_channels').html(QWeb.render('mail.chat.Spinner'));
chat_manager.is_ready.then(function () {
var channels = _.filter(chat_manager.get_channels(), function (channel) {
if (self.filter === 'chat') {
return channel.is_chat;
} else if (self.filter === 'channels') {
return !channel.is_chat && channel.type !== 'static';
} else {
return channel.type !== 'static';
}
});
chat_manager.get_channels_preview(channels).then(self._render_channels_preview.bind(self));
});
},
_render_channels_preview: function (channels_preview) {
channels_preview.sort(function (c1, c2) {
return Math.min(1, c2.unread_counter) - Math.min(1, c1.unread_counter) ||
c2.is_chat - c1.is_chat ||
c2.last_message.date.diff(c1.last_message.date);
});
_.each(channels_preview, function (channel) {
channel.last_message_preview = chat_manager.get_message_body_preview(channel.last_message.body);
if (channel.last_message.date.isSame(new Date(), 'd')) { // today
channel.last_message_date = channel.last_message.date.format('LT');
} else {
channel.last_message_date = channel.last_message.date.format('lll');
}
});
this.$('.o_mail_navbar_dropdown_channels').html(QWeb.render('mail.chat.ChannelsPreview', {
channels: channels_preview,
}));
},
close: function(){
if (this.$el) {
this.$el.addClass('oe_hidden');
}
},
on_click_message_item: function(event){
event.stopPropagation();
var $target = $(event.currentTarget);
var channel_id = $target.data('channel_id');
var channel = chat_manager.get_channel(channel_id);
if (channel) {
this.gui.close_popup();
chat_manager.open_channel(channel);
}
},
});
gui.define_popup({name:'message', widget: MessageWidget});
});

122
pos_chatter/static/src/less/message.less

@ -0,0 +1,122 @@
@gray: #52575C;
@gray-light: lighten(#000, 46.7%); // #777
@gray-lighter: lighten(#000, 93.5%); // #eee
@screen-xs-max: 767px;
@screen-sm: 768px;
@screen-sm-min: @screen-sm;
@text-color: #C8C8C8;
@navbar-default-link-color: @text-color;
@navbar-default-link-hover-color: #fff;
@navbar-default-link-hover-bg: transparent;
@navbar-default-link-active-color: #fff;
@navbar-default-link-active-bg: transparent;
@navbar-default-link-disabled-color: @gray-light;
@navbar-default-link-disabled-bg: transparent;
@border-radius-base: 4px;
@navbar-height: 44px;
.text-muted {
color: @gray-light;
}
.box-sizing(@boxmodel) {
-webkit-box-sizing: @boxmodel;
-moz-box-sizing: @boxmodel;
box-sizing: @boxmodel;
}
.o_chat_window {
&,* {
.box-sizing(border-box);
}
.o_chat_header {
height: 28px;
.fa-close {
text-decoration: none;
font-weight: bold;
}
> span {
margin: auto 0;
}
}
}
.btn-link {
color: @navbar-default-link-color;
&:hover,
&:focus {
color: @navbar-default-link-hover-color;
}
&[disabled],
fieldset[disabled] & {
&:hover,
&:focus {
color: @navbar-default-link-disabled-color;
}
}
}
.o_mail_navbar_dropdown_channels {
.o-flex(0, 1, auto);
background: #FFFFFF;
max-height: 400px;
min-height: 50px;
overflow-y: auto;
@media (max-width: @screen-xs-max) {
max-height: none;
}
.o_mail_channel_preview {
.o-flex-display();
height: 40px;
align-items: center;
padding: 5px;
cursor: pointer;
font-size: 12px;
overflow: hidden;
&~.o_mail_channel_preview {
border-top: 1px solid lightgray;
}
&.o_channel_unread {
background-color: lighten(lightgray, 10%);
}
&:hover {
background-color: lighten(lightgray, 5%);
}
.o_channel_image {
.o-flex(0, 0, 36px);
max-height: 36px;
}
.o_channel_info {
.o-flex(1, 1, 100%);
margin-left: 5px;
overflow: hidden;
.o_channel_title {
.o-flex-display();
.o_channel_name {
.o-flex(1, 1, auto);
.o-text-overflow();
}
.o_last_message_date {
.o-flex(0, 0, auto);
padding-top: 3px;
font-size: xx-small;
color: @odoo-main-color-muted;
}
}
.o_last_message_preview {
width: 100%;
color: @odoo-main-color-muted;
.o-text-overflow();
}
}
}
}

58
pos_chatter/static/src/xml/pos_msg.xml

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<template id="template" xml:space="preserve">
<t t-extend="Chrome">
<t t-jquery="div.pos-rightheader" t-operation="append">
<div class="oe_status">
<a title="Conversations" href="#">
<i class="fa fa-comments pos-message"/>
<span class="o_notification_counter"/>
</a>
</div>
</t>
</t>
<t t-name="MessageWidget">
<div class="message-box">
<div class="message">
<p class="title">
<a class="pos-selected pos-filter">All</a>
<a class="pos-filter" data-filter='chat'>Chat</a>
<a class="pos-filter" data-filter='channels'>Channels</a>
<a class="pos-new_message">New message</a>
</p>
<div class='o_mail_navbar_dropdown_channels selection scrollable-y touch-scrollable'>
<t t-foreach="widget.list || []" t-as="channel">
<div t-attf-class="o_mail_channel_preview #{channel.unread_counter ? 'o_channel_unread' : ''}"
t-att-data-channel_id="channel.id">
<img class="o_channel_image" t-att-src="channel.image_src"/>
<div class="o_channel_info">
<div class="o_channel_title">
<span class="o_channel_name">
<t t-if="channel.status" t-call="mail.chat.UserStatus">
<t t-set="status" t-value="channel.status"/>
</t>
<t t-esc="channel.name"/>
<t t-if="channel.unread_counter">(<t t-esc="channel.unread_counter"/>)</t>
</span>
<span class="o_last_message_date"> <t t-esc="channel.last_message_date"/> </span>
</div>
<div class="o_last_message_preview">
<t t-esc="channel.last_message.displayed_author"/>:
<t t-raw="channel.last_message_preview"/>
</div>
</div>
</div>
</t>
</div>
</div>
</div>
</t>
</template>

21
pos_chatter/views/pos_chat.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<template id="pos_chatter" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/pos_chatter/static/src/css/message.css" />
<script type="text/javascript" src="/pos_chatter/static/src/js/pos_chat.js"/>
<link rel="stylesheet" href="/pos_chatter/static/src/less/message.less" type="text/less"/>
<link rel="stylesheet" href="/web/static/src/less/variables.less"/>
<link rel="stylesheet" href="/web/static/src/less/utils.less"/>
<link rel="stylesheet" href="/web/static/src/less/mimetypes.less"/>
<link rel="stylesheet" href="/mail/static/src/less/chat_window.less" type="text/less"/>
<link rel="stylesheet" href="/mail/static/src/less/thread.less" type="text/less"/>
<link rel="stylesheet" href="/mail/static/src/less/client_action.less" type="text/less"/>
<link rel="stylesheet" href="/mail/static/src/less/composer.less" type="text/less"/>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save