blob: d142bbdeac017733867f695d07c535a3a5891e9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
odoo.define('point_of_sale.TicketButton', function (require) {
'use strict';
const PosComponent = require('point_of_sale.PosComponent');
const Registries = require('point_of_sale.Registries');
const { posbus } = require('point_of_sale.utils');
class TicketButton extends PosComponent {
onClick() {
if (this.props.isTicketScreenShown) {
posbus.trigger('ticket-button-clicked');
} else {
this.showScreen('TicketScreen');
}
}
willPatch() {
posbus.off('order-deleted', this);
}
patched() {
posbus.on('order-deleted', this, this.render);
}
mounted() {
posbus.on('order-deleted', this, this.render);
}
willUnmount() {
posbus.off('order-deleted', this);
}
get count() {
if (this.env.pos) {
return this.env.pos.get_order_list().length;
} else {
return 0;
}
}
}
TicketButton.template = 'TicketButton';
Registries.Component.add(TicketButton);
return TicketButton;
});
|