Skip to content
Permalink
Browse files

[IMP] point_of_sale: Show message on proxy icon

Add the possibility to show a message on the proxy status icon in the
PoS. The message will be the same color than the status icon.
  • Loading branch information...
aprieels committed Sep 10, 2019
1 parent fe2e1ba commit 1d9ec39ba7b319fd5d8a49332292be844f9d2fee
@@ -506,7 +506,7 @@ td {
.pos .oe_icon.oe_red {
color: rgb(197, 52, 0);
}
.pos .oe_statu .oe_green,
.pos .oe_status .oe_green,
.pos .oe_icon.oe_green {
color: rgb(94, 185, 55);
}
@@ -367,7 +367,8 @@ var ProxyStatusWidget = StatusWidget.extend({
}
if( this.pos.config.iface_print_via_proxy ||
this.pos.config.iface_cashdrawer ){
if(!this.is_printer_connected(status.drivers.printer)){
var printer = status.drivers.printer ? status.drivers.printer.status : false;
if (printer != 'connected' && printer != 'connecting') {
warning = true;
msg = msg ? msg + ' & ' : msg;
msg += _t('Printer');
@@ -385,12 +386,9 @@ var ProxyStatusWidget = StatusWidget.extend({
msg = msg ? msg + ' ' + _t('Offline') : msg;
this.set_status(warning ? 'warning' : 'connected', msg);
}else{
this.set_status(status.status,'');
this.set_status(status.status, status.msg || '');
}
},
is_printer_connected: function (printer) {
return printer && printer.status === 'connected';
},
start: function(){
var self = this;

@@ -144,12 +144,13 @@ var ProxyDevice = core.Class.extend(mixins.PropertiesMixin,{

window.hw_proxy = this;
},
set_connection_status: function(status,drivers){
set_connection_status: function(status, drivers, msg=''){
var oldstatus = this.get('status');
var newstatus = {};
newstatus.status = status;
newstatus.drivers = status === 'disconnected' ? {} : oldstatus.drivers;
newstatus.drivers = drivers ? drivers : newstatus.drivers;
newstatus.msg = msg;
this.set('status',newstatus);
},
disconnect: function(){
@@ -74,17 +74,20 @@

<t t-name="ProxyStatusWidget">
<div class="oe_status js_proxy">
<span class='js_msg oe_orange oe_hidden'></span>
<div class="js_connected oe_icon oe_green">
<div class="js_connected oe_green">
<span class='js_msg oe_hidden'></span>
<i class='fa fa-fw fa-sitemap' role="img" aria-label="Proxy Connected" title="Proxy Connected"></i>
</div>
<div class="js_connecting oe_icon oe_hidden">
<div class="js_connecting oe_hidden">
<span class='js_msg oe_hidden'></span>
<i class='fa fa-fw fa-spin fa-spinner' role="img" aria-label="Connecting to Proxy" title="Connecting to Proxy"></i>
</div>
<div class="js_warning oe_icon oe_orange oe_hidden">
<div class="js_warning oe_orange oe_hidden">
<span class='js_msg oe_hidden'></span>
<i class='fa fa-fw fa-sitemap' role="img" aria-label="Proxy Warning" title="Proxy Warning"></i>
</div>
<div class="js_disconnected oe_icon oe_red oe_hidden">
<div class="js_disconnected oe_red oe_hidden">
<span class='js_msg oe_hidden'></span>
<i class='fa fa-fw fa-sitemap' role="img" aria-label="Proxy Disconnected" title="Proxy Disconnected"></i>
</div>
</div>

0 comments on commit 1d9ec39

Please sign in to comment.
You can’t perform that action at this time.