Debian Codegraph @

addons/l10n_fr_pos_cert/static/src/js/Chrome.js

raw
1 import { Chrome } from "@point_of_sale/app/pos_app";
2 import { patch } from "@web/core/utils/patch";
3 import { ClosePosPopup } from "@point_of_sale/app/components/popups/closing_popup/closing_popup";
4 import { onMounted } from "@odoo/owl";
5 import { useService } from "@web/core/utils/hooks";
6
7 patch(Chrome.prototype, {
8 setup() {
9 super.setup(...arguments);
10 this.dialog = useService("dialog");
11 onMounted(async () => {
12 if (this.pos.is_french_country() && this.pos.session.start_at) {
13 const now = Date.now();
14 const limitDate = new Date(this.pos.session.start_at);
15 limitDate.setDate(limitDate.getDate() + 1);
16 if (limitDate.getTime() < now) {
17 const info = await this.pos.getClosePosInfo();
18 this.dialog.add(ClosePosPopup, info);
19 }
20 }
21 });
22 },
23 });