feat: synchronize mobile pane state with product screen tabs and add product image URL helper

This commit is contained in:
Suherdy Yacob 2026-06-03 12:11:26 +07:00
parent 593884ab7b
commit 0f231e9d20
2 changed files with 20 additions and 0 deletions

View File

@ -11,14 +11,29 @@ patch(ProductScreen.prototype, {
super.setup(); super.setup();
this.portraitMode = useService("portrait_mode"); this.portraitMode = useService("portrait_mode");
this.portraitState = useState({ tab: "products" }); this.portraitState = useState({ tab: "products" });
if (this.portraitMode.isPortrait) {
this.portraitState.tab = this.pos.mobile_pane === "right" ? "products" : "cart";
}
}, },
get portraitTab() { get portraitTab() {
if (this.portraitMode.isPortrait) {
if (this.pos.mobile_pane === "right" && this.portraitState.tab !== "products") {
this.portraitState.tab = "products";
} else if (this.pos.mobile_pane === "left" && this.portraitState.tab === "products") {
this.portraitState.tab = "cart";
}
}
return this.portraitState.tab; return this.portraitState.tab;
}, },
switchPortraitTab(tab) { switchPortraitTab(tab) {
this.portraitState.tab = tab; this.portraitState.tab = tab;
if (tab === "products") {
this.pos.mobile_pane = "right";
} else {
this.pos.mobile_pane = "left";
}
}, },
onDeleteLine() { onDeleteLine() {

View File

@ -50,5 +50,10 @@ patch(ProductScreen.prototype, {
} }
} }
return limitedList; return limitedList;
},
getProductImage(product) {
const hasImage = product.image_128 || product.product_tmpl_id?.image_128;
return hasImage ? product.getImageUrl() : false;
} }
}); });