feat(sub12b): wire Move Parts + Stop Timer dialogs into tablet (Task 15)

ShopfloorTablet component:
- Imports the 3 new OWL dialogs.
- useService('dialog') for spawning.
- Listens for 'fp-resolve-rack' window CustomEvent fired from inside
  FpMovePartsDialog → spawns FpRackPartsDialog inline.
- New methods: openMovePartsDialog(from, to) + openStopTimerDialog(id).
  Refresh tablet after commit/reconcile so the UI reflects new state.

Listener cleanup on unmount.

Note: the actual buttons that call these methods are added to the
existing tablet XML in a follow-up step — for now they are wired but
not surfaced. Operators get them after Task 16 + smoke test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-27 21:16:15 -04:00
parent 11bc0ca742
commit 902f3e8398

View File

@@ -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(),
});
}