From f6ebe0ef5170fdeb5c96377cb81fe191a1fc1169 Mon Sep 17 00:00:00 2001 From: aban4 Date: Tue, 11 Apr 2023 18:04:50 -0400 Subject: [PATCH 1/7] error message when creating an ordergroup with a memeber in another ordergroup --- app/models/ordergroup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/ordergroup.rb b/app/models/ordergroup.rb index c29ec762f..ccdb7cfea 100644 --- a/app/models/ordergroup.rb +++ b/app/models/ordergroup.rb @@ -176,7 +176,7 @@ def self.sort_by_param(param) # Make sure, that a user can only be in one ordergroup def uniqueness_of_members users.each do |user| - errors.add :user_tokens, I18n.t('ordergroups.model.error_single_group', :user => user.display) if user.groups.where(:type => 'Ordergroup').size > 1 + errors.add :user_tokens, I18n.t('ordergroups.model.error_single_group', :user => user.display) if user.groups.where(:type => 'Ordergroup').size >= 1 end end From 3584d58d4c1b90aece6a3170cf684af1db7ca2fb Mon Sep 17 00:00:00 2001 From: aban4 Date: Wed, 12 Apr 2023 10:59:44 -0400 Subject: [PATCH 2/7] added hovering tool tip for notes in order page --- app/views/group_orders/_form.html.haml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index 3ffd583ee..fa0d5bdb0 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -95,7 +95,14 @@ %td{colspan: "9"} - order_articles.each do |order_article| %tr{class: "#{cycle('even', 'odd', name: 'articles')} order-article #{get_missing_units_css_class(@ordering_data[:order_articles][order_article.id][:missing_units])}", valign: "top"} - %td.name= order_article.article.name + - oa = order_article + %td{style: "width:40%"} + = oa.article.name + - unless oa.article.note.blank? + = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) + + + - if @order.stockit? %td= truncate order_article.article.supplier.name, length: 15 %td= h order_article.article.origin @@ -130,6 +137,8 @@ %a.btn.btn-ordering{'data-decrease_tolerance' => order_article.id} %i.icon-minus + + %td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"} %span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price]) .article-info @@ -151,6 +160,11 @@ %br/ #{heading_helper Article, :note}: #{order_article.article.note} %br/ + + - unless oa.article.note.blank? + %tr{id: "note_#{oa.id}", class: "note even", style: "display:none"} + %td{colspan: "6"}=h oa.article.note + #order-footer #info-box #total-sum From 6aad993645c09a4767bba5a46b480e90e4b6f156 Mon Sep 17 00:00:00 2001 From: aban4 Date: Wed, 12 Apr 2023 12:43:19 -0400 Subject: [PATCH 3/7] ingredients added to article schema and displayed in order summary --- app/controllers/articles_controller.rb | 2 ++ app/controllers/order_articles_controller.rb | 1 + app/views/articles/_form.html.haml | 1 + app/views/group_orders/_form.html.haml | 4 ++-- db/schema.rb | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 4161e66a8..d12b5073a 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -37,6 +37,7 @@ def index end def new + puts 'in new article controller' @article = @supplier.articles.build(:tax => FoodsoftConfig[:tax_default]) render :layout => false end @@ -47,6 +48,7 @@ def copy end def create + puts 'in create article controller' @article = Article.new(params[:article]) if @article.valid? && @article.save render :layout => false diff --git a/app/controllers/order_articles_controller.rb b/app/controllers/order_articles_controller.rb index 0552269d0..bd3ec1ecb 100644 --- a/app/controllers/order_articles_controller.rb +++ b/app/controllers/order_articles_controller.rb @@ -10,6 +10,7 @@ def new end def create + puts 'in create oa controller' # The article may be ordered with zero units - in that case do not complain. # If order_article is ordered and a new order_article is created, an error message will be # given mentioning that the article already exists, which is desired. diff --git a/app/views/articles/_form.html.haml b/app/views/articles/_form.html.haml index 7cbd64cd8..481388dc9 100644 --- a/app/views/articles/_form.html.haml +++ b/app/views/articles/_form.html.haml @@ -11,6 +11,7 @@ = render partial: 'shared/article_fields_units', locals: {f: f} = f.input :note + = f.input :ingredients = f.association :article_category / TODO labels diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index fa0d5bdb0..4f42800f6 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -161,9 +161,9 @@ #{heading_helper Article, :note}: #{order_article.article.note} %br/ - - unless oa.article.note.blank? + - unless oa.article.ingredients.blank? %tr{id: "note_#{oa.id}", class: "note even", style: "display:none"} - %td{colspan: "6"}=h oa.article.note + %td{colspan: "6"}=h oa.article.ingredients #order-footer #info-box diff --git a/db/schema.rb b/db/schema.rb index ce812b3ff..b3a5ffbf9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -55,6 +55,7 @@ t.integer "article_category_id", default: 0, null: false t.string "unit", default: "", null: false t.string "note" + t.string "ingredients" t.boolean "availability", default: true, null: false t.string "manufacturer" t.string "origin" From c789bbacd9a1c23a39dc9825d78526433c6f28c3 Mon Sep 17 00:00:00 2001 From: aban4 Date: Wed, 12 Apr 2023 15:57:42 -0400 Subject: [PATCH 4/7] new branch --- .DS_Store | Bin 0 -> 6148 bytes app/views/group_orders/_form.html.haml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c2ec8d5dbd6913cf1dda8ebe0065cb455fe1c91e GIT binary patch literal 6148 zcmeHK%}T>S5Z-NTO(;SS3VK`cTClZRDqcdYFJMFuDm5{+24lAL#~ex_cYPsW#OHBl zcXJ2^youNu*!^bbXE*af_J=XX-9^}8tjQR&pdoTpN(9ZNu8IjpQjUo@DCH{rO_%`qLX6T}l}T zx$Xy7(I_1@x6foU_oHMqRS8izf{@$mC<$fi%0&{+RIaBTmTlX^=H7DIZTCAZ(eE9v zT4H%}*lvlVZf~`+t)2aY(~IGA{F2Bw%_IlXm24Tz;T@DhQLo-KiDfbdd!CcW5)uQ% z05L!etQ`a9D6kr9S2-0-3=ji9F@XDnfQIN8%rvU413J7uqrZlT0y@4W5QRaQru?7+j}=U6?q>V5U*0Gp<&KdCbcBxKC-Kv+AmOt ZILBb75obZWN(ZEifFguCV&E4T_yT}=OhW(w literal 0 HcmV?d00001 diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index 4f42800f6..5cf29548c 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -99,7 +99,7 @@ %td{style: "width:40%"} = oa.article.name - unless oa.article.note.blank? - = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) + = image_tag("role-article_meta.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) From cbbf384f47e7f98935bfae541110dd9b1c208d94 Mon Sep 17 00:00:00 2001 From: aban4 Date: Wed, 12 Apr 2023 16:38:24 -0400 Subject: [PATCH 5/7] added ingredients hover to order summary --- app/views/group_orders/_form.html.haml | 2 +- app/views/group_orders/show.html.haml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index 5cf29548c..38b82e39d 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -98,7 +98,7 @@ - oa = order_article %td{style: "width:40%"} = oa.article.name - - unless oa.article.note.blank? + - unless oa.article.ingredients.blank? = image_tag("role-article_meta.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) diff --git a/app/views/group_orders/show.html.haml b/app/views/group_orders/show.html.haml index 8c9678d7c..7f8bcd48b 100644 --- a/app/views/group_orders/show.html.haml +++ b/app/views/group_orders/show.html.haml @@ -75,6 +75,8 @@ = oa.article.name - unless oa.article.note.blank? = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) + - unless oa.article.note.blank? + = image_tag("role-article_meta.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#ingredients_#{oa.id}').show();", onmouseout: "$('#ingredients_#{oa.id}').hide();"}) %td= "#{oa.price.unit_quantity} x #{oa.article.unit}" %td= number_to_currency(oa.price.fc_price) %td @@ -85,6 +87,9 @@ - unless oa.article.note.blank? %tr{id: "note_#{oa.id}", class: "note even", style: "display:none"} %td{colspan: "6"}=h oa.article.note + - unless oa.article.ingredients.blank? + %tr{id: "ingredients_#{oa.id}", class: "note even", style: "display:none"} + %td{colspan: "6"}=h oa.article.ingredients %tr{class: cycle('even', 'odd', name: 'articles')} %th{colspan: "5"}= heading_helper GroupOrder, :price %th= number_to_currency(@group_order.price) From d05a6f712c847d81edc47028a0bcb64b580cb3ff Mon Sep 17 00:00:00 2001 From: aban4 Date: Wed, 12 Apr 2023 16:55:15 -0400 Subject: [PATCH 6/7] clean up --- app/controllers/articles_controller.rb | 2 -- app/controllers/order_articles_controller.rb | 1 - 2 files changed, 3 deletions(-) diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index d12b5073a..4161e66a8 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -37,7 +37,6 @@ def index end def new - puts 'in new article controller' @article = @supplier.articles.build(:tax => FoodsoftConfig[:tax_default]) render :layout => false end @@ -48,7 +47,6 @@ def copy end def create - puts 'in create article controller' @article = Article.new(params[:article]) if @article.valid? && @article.save render :layout => false diff --git a/app/controllers/order_articles_controller.rb b/app/controllers/order_articles_controller.rb index bd3ec1ecb..0552269d0 100644 --- a/app/controllers/order_articles_controller.rb +++ b/app/controllers/order_articles_controller.rb @@ -10,7 +10,6 @@ def new end def create - puts 'in create oa controller' # The article may be ordered with zero units - in that case do not complain. # If order_article is ordered and a new order_article is created, an error message will be # given mentioning that the article already exists, which is desired. From 00a2d3ae35f1fc3b687d478dbb2cf6045afd0cfc Mon Sep 17 00:00:00 2001 From: aban4 Date: Wed, 12 Apr 2023 17:01:01 -0400 Subject: [PATCH 7/7] irrelevant change removed --- app/models/ordergroup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/ordergroup.rb b/app/models/ordergroup.rb index ccdb7cfea..c29ec762f 100644 --- a/app/models/ordergroup.rb +++ b/app/models/ordergroup.rb @@ -176,7 +176,7 @@ def self.sort_by_param(param) # Make sure, that a user can only be in one ordergroup def uniqueness_of_members users.each do |user| - errors.add :user_tokens, I18n.t('ordergroups.model.error_single_group', :user => user.display) if user.groups.where(:type => 'Ordergroup').size >= 1 + errors.add :user_tokens, I18n.t('ordergroups.model.error_single_group', :user => user.display) if user.groups.where(:type => 'Ordergroup').size > 1 end end