summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderRow.js
blob: 959ea5a1477242f3a206dff18b075a2df31a6ced (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
42
odoo.define('point_of_sale.OrderRow', function (require) {
    'use strict';

    const PosComponent = require('point_of_sale.PosComponent');
    const Registries = require('point_of_sale.Registries');

    /**
     * @props {models.Order} order
     * @props columns
     * @emits click-order
     */
    class OrderRow extends PosComponent {
        get order() {
            return this.props.order;
        }
        get highlighted() {
            const highlightedOrder = this.props.highlightedOrder;
            return !highlightedOrder ? false : highlightedOrder.backendId === this.props.order.backendId;
        }

        // Column getters //

        get name() {
            return this.order.get_name();
        }
        get date() {
            return moment(this.order.validation_date).format('YYYY-MM-DD hh:mm A');
        }
        get customer() {
            const customer = this.order.get('client');
            return customer ? customer.name : null;
        }
        get total() {
            return this.env.pos.format_currency(this.order.get_total_with_tax());
        }
    }
    OrderRow.template = 'OrderRow';

    Registries.Component.add(OrderRow);

    return OrderRow;
});