diff --git a/fusion_plating/fusion_plating_shopfloor/static/src/js/shopfloor_tablet.js b/fusion_plating/fusion_plating_shopfloor/static/src/js/shopfloor_tablet.js index bcf51157..5104566d 100644 --- a/fusion_plating/fusion_plating_shopfloor/static/src/js/shopfloor_tablet.js +++ b/fusion_plating/fusion_plating_shopfloor/static/src/js/shopfloor_tablet.js @@ -20,6 +20,9 @@ import { registry } from "@web/core/registry"; import { rpc } from "@web/core/network/rpc"; import { useService } from "@web/core/utils/hooks"; import { QrScanner } from "./qr_scanner"; +import { FpMovePartsDialog } from "./move_parts_dialog"; +import { FpStopTimerDialog } from "./stop_timer_dialog"; +import { FpRackPartsDialog } from "./rack_parts_dialog"; export class ShopfloorTablet extends Component { static template = "fusion_plating_shopfloor.ShopfloorTablet"; @@ -29,8 +32,21 @@ export class ShopfloorTablet extends Component { setup() { this.notification = useService("notification"); this.action = useService("action"); + this.dialog = useService("dialog"); this.scanInput = useRef("scanInput"); + // Sub 12b — listen for the rack-resolution custom event fired + // from inside FpMovePartsDialog when the operator hits the + // 'Resolve' button on a rack-required blocker. + this._onResolveRack = (ev) => { + this.dialog.add(FpRackPartsDialog, { + fromStepId: ev.detail.fromStepId, + qty: ev.detail.qty || 0, + onRacked: () => this.refresh(), + }); + }; + window.addEventListener("fp-resolve-rack", this._onResolveRack); + this.state = useState({ overview: null, stationId: null, @@ -56,6 +72,23 @@ export class ShopfloorTablet extends Component { onWillUnmount(() => { if (this._interval) clearInterval(this._interval); if (this._tickInterval) clearInterval(this._tickInterval); + window.removeEventListener("fp-resolve-rack", this._onResolveRack); + }); + } + + // ===================================================== Sub 12b dialogs + + openMovePartsDialog(fromStepId, toStepId) { + this.dialog.add(FpMovePartsDialog, { + fromStepId, toStepId, + onCommit: () => this.refresh(), + }); + } + + openStopTimerDialog(timerId) { + this.dialog.add(FpStopTimerDialog, { + timerId, + onReconciled: () => this.refresh(), }); }