| 1 |
import { ClosePosPopup } from "@point_of_sale/app/components/popups/closing_popup/closing_popup"; |
| 2 |
import { patch } from "@web/core/utils/patch"; |
| 3 |
|
| 4 |
patch(ClosePosPopup.prototype, { |
| 5 |
sessionIsOutdated() { |
| 6 |
let isOutdated = false; |
| 7 |
if (this.pos.is_french_country() && this.pos.session.start_at) { |
| 8 |
const now = Date.now(); |
| 9 |
const limitDate = new Date(this.pos.session.start_at); |
| 10 |
limitDate.setDate(limitDate.getDate() + 1); |
| 11 |
isOutdated = limitDate < now; |
| 12 |
} |
| 13 |
return isOutdated; |
| 14 |
}, |
| 15 |
canCancel() { |
| 16 |
return super.canCancel(...arguments) && !this.sessionIsOutdated(); |
| 17 |
}, |
| 18 |
}); |