feat: synchronize mobile pane state with product screen tabs and add product image URL helper
This commit is contained in:
parent
593884ab7b
commit
0f231e9d20
@ -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() {
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user