From 89cdc1161de4d6705738e664455c3dcfca95e096 Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Fri, 17 Nov 2023 10:55:50 +0100 Subject: [PATCH] shopfloor_mobile: use stars to display picking priority --- .../static/wms/src/scenario/checkout.js | 15 ++++++++++++++- .../static/wms/src/components/priority-widget.js | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/shopfloor_mobile/static/wms/src/scenario/checkout.js b/shopfloor_mobile/static/wms/src/scenario/checkout.js index b1f7d7da506..f783a1cbf7b 100644 --- a/shopfloor_mobile/static/wms/src/scenario/checkout.js +++ b/shopfloor_mobile/static/wms/src/scenario/checkout.js @@ -293,7 +293,20 @@ const Checkout = { {path: "origin"}, {path: "carrier.name", label: "Carrier"}, {path: "move_line_count", label: "Lines"}, - {path: "priority", label: "Priority"}, + { + path: "priority", + render_component: "priority-widget", + render_options: function (record) { + const priority = parseInt(record.priority); + // We need to pass the label to the component as an option instead of using "display_no_value" + // because pickings with no priority will still have a string value of "0" + // and the label would always be displayed. + return { + priority, + label: priority ? "Priority: " : null + }; + }, + }, ], }, }; diff --git a/shopfloor_mobile_base/static/wms/src/components/priority-widget.js b/shopfloor_mobile_base/static/wms/src/components/priority-widget.js index 9e8427cc9e0..4f0da6d3fa0 100644 --- a/shopfloor_mobile_base/static/wms/src/components/priority-widget.js +++ b/shopfloor_mobile_base/static/wms/src/components/priority-widget.js @@ -18,6 +18,7 @@ export var PriorityWidget = Vue.component("priority-widget", { }, template: `
+ {{ opts.label }} mdi-star