diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.js b/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.js index f2069964f7e..d311f07c1b4 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.js +++ b/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.js @@ -24,4 +24,7 @@ export class ActionpadWidget extends Component { get highlightPay() { return this.pos.get_order()?.orderlines?.length; } + getMainButtonClasses() { + return "button btn d-flex flex-column flex-fill align-items-center justify-content-center fw-bolder btn-lg py-5 rounded-0"; + } } diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.xml b/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.xml index 65f15ddc97a..4c372a80332 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.xml +++ b/addons/point_of_sale/static/src/app/screens/product_screen/action_pad/action_pad.xml @@ -2,7 +2,7 @@ -
+
@@ -20,10 +20,11 @@
- -
- -
diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.scss b/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.scss index 7ef974eda69..c7bdf187f49 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.scss +++ b/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.scss @@ -1,6 +1,5 @@ .numpad { grid-template-columns: repeat(4, 1fr); - min-width: 216px; gap: 1px; } diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.xml b/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.xml index cb11c443594..f20aabbb44d 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.xml +++ b/addons/point_of_sale/static/src/app/screens/product_screen/numpad/numpad.xml @@ -2,35 +2,35 @@ -
- - - +
+ + + - - - + + + - - - + + + - - - + + - diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/product/product.xml b/addons/point_of_sale/static/src/app/screens/product_screen/product/product.xml index 8949b5b6acd..1f774439563 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/product/product.xml +++ b/addons/point_of_sale/static/src/app/screens/product_screen/product/product.xml @@ -2,14 +2,14 @@ -
-
+
-
+
diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.js b/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.js index 43fb1650357..fd44c8027be 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.js +++ b/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.js @@ -2,14 +2,12 @@ import { debounce } from "@web/core/utils/timing"; import { usePos } from "@point_of_sale/app/store/pos_hook"; - -import { CategoryButton } from "@point_of_sale/app/screens/product_screen/category_button/category_button"; - import { Component, onMounted, onWillUnmount, useRef, useState } from "@odoo/owl"; import { useService } from "@web/core/utils/hooks"; +import { CategorySelector } from "@point_of_sale/app/generic_components/category_selector/category_selector"; export class ProductsWidgetControlPanel extends Component { - static components = { CategoryButton }; + static components = { CategorySelector }; static template = "point_of_sale.ProductsWidgetControlPanel"; setup() { @@ -30,6 +28,43 @@ export class ProductsWidgetControlPanel extends Component { window.removeEventListener("resize", toggleIsMobile); }); } + + getCategoryImageUrl(category) { + return `/web/image?model=pos.category&field=image_128&id=${category.id}&unique=${category.write_date}`; + } + /** + * @param {Object} category - the object from `this.pos.db.category_by_id` + * @returns {import("@point_of_sale/app/generic_components/category_selector/category_selector").Category} + */ + formatCategoryObject(category) { + const isRootCategory = category.id === this.pos.db.root_category_id; + const hasSeparator = + !isRootCategory && + [ + ...this.pos.db.get_category_ancestors_ids(this.pos.selectedCategoryId), + this.pos.selectedCategoryId, + ].includes(category.id); + return { + id: category.id, + name: !isRootCategory ? category.name : "", + icon: isRootCategory ? "fa-home fa-2x" : "", + separator: hasSeparator ? "fa-caret-right" : "", + imageUrl: category?.has_image && this.getCategoryImageUrl(category), + }; + } + /** + * @returns {import("@point_of_sale/app/generic_components/category_selector/category_selector").Category[]} + */ + getCategories() { + return [ + ...this.pos.db.get_category_ancestors_ids(this.pos.selectedCategoryId), + this.pos.selectedCategoryId, + ...this.pos.db.get_category_childs_ids(this.pos.selectedCategoryId), + ] + .map((id) => this.pos.db.category_by_id[id]) + .map((category) => this.formatCategoryObject(category)); + } + toggleIsMobile() { // In addition to the UI service we need to check the width of the window // because the search bar glitches on a specific width between when the diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.scss b/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.scss index 048267a66a6..e226885741a 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.scss +++ b/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.scss @@ -1,8 +1,4 @@ -.category-list-scroller{ - max-height:40vh; -} - .category-button { .category-img { width: 120px; @@ -33,11 +29,3 @@ display: block; margin : 3px auto 0 auto; } - -@media screen and (max-width: 768px) { - .pos .search-bar-container.sb-product { - max-width: none; - width: auto; - background-color: #FFFFFF; - } -} diff --git a/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.xml b/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.xml index 23c1a3d0f9e..c1c67e47132 100644 --- a/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.xml +++ b/addons/point_of_sale/static/src/app/screens/product_screen/product_list/control_panel/control_panel.xml @@ -2,66 +2,27 @@ -
-
- -
- -