From 6c77080e1d5641ca7ea09f3c04f797041285c5bc Mon Sep 17 00:00:00 2001 From: Florian Lentsch Date: Fri, 26 Apr 2024 21:14:31 +0200 Subject: [PATCH] Fixes #62 --- app/assets/javascripts/group-order-form.js | 2 +- app/views/group_orders/_form.html.haml | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/group-order-form.js b/app/assets/javascripts/group-order-form.js index aed79799..bb6257fe 100644 --- a/app/assets/javascripts/group-order-form.js +++ b/app/assets/javascripts/group-order-form.js @@ -169,7 +169,7 @@ class GroupOrderForm { usedTolerance$.text(round(usedTolerance)); unusedTolerance$.text(round(unusedTolerance)); - totalPacks$.text(round(totalPacks)); + totalPacks$.text(packSizeDeterminedBySupplierOrderUnit ? round(totalPacks) : round(totalQuantity)); totalPacks$.css('color', this.packCompletedFromTolerance(packSize, totalQuantity, totalTolerance) ? 'grey' : 'auto'); diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index e2f5bed6..ce5c8022 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -147,7 +147,7 @@ .article-name= order_article.article_version.name .pull-right = t('.units_full') + ':' - %span{id: "units_#{order_article.id}"}= order_article.units_to_order + %span{id: "units_#{order_article.id}"}= order_article.article_version.convert_quantity(order_article.units_to_order, order_article.article_version.supplier_order_unit, order_article.article_version.group_order_unit) %br/ = t('.units_total') + ':' %span{id: "q_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] + @ordering_data[:order_articles][order_article.id][:others_quantity] @@ -158,7 +158,14 @@ .pull-left #{heading_helper Article, :manufacturer}: #{order_article.article_version.manufacturer} %br/ - #{heading_helper Article, :units}: #{@order.stockit? ? order_article.article_version.article.quantity_available : format_supplier_order_unit_with_ratios(order_article.article_version)} + #{heading_helper Article, :units}: + - if @order.stockit? + #{order_article.article_version.article.quantity_available} + - elsif order_article.article_version.uses_tolerance? + #{format_supplier_order_unit_with_ratios(order_article.article_version)} + - else + #{format_group_order_unit_with_ratios(order_article.article_version)} + %br/ #{heading_helper Article, :note}: #{order_article.article_version.note} %br/