From 53f24cd885169d4bb0adf2253257fdaabc3dd054 Mon Sep 17 00:00:00 2001 From: Julius Date: Wed, 25 Sep 2013 21:22:34 +0200 Subject: [PATCH 1/7] Fix migrate problem caused by output formating(?) --- db/migrate/20130702113610_update_group_order_totals.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20130702113610_update_group_order_totals.rb b/db/migrate/20130702113610_update_group_order_totals.rb index ca9aab67..f0052ee5 100644 --- a/db/migrate/20130702113610_update_group_order_totals.rb +++ b/db/migrate/20130702113610_update_group_order_totals.rb @@ -7,7 +7,7 @@ class UpdateGroupOrderTotals < ActiveRecord::Migration say "If you do want to update the ordergroup totals, open the rails console " + "(by running `rails c`), and enter:" - say "GroupOrder.all.each { |go| go.order.closed? and go.update_price! }", subitem: true + say "GroupOrder.all.each { |go| go.order.closed? and go.update_price! }" say "You may want to check first that no undesired accounting issues are introduced. " + "It may be wise to discuss this with those responsible for the ordering finances." From 3f822dc396ef6a2157d791058591116451c7608c Mon Sep 17 00:00:00 2001 From: Julius Date: Thu, 3 Oct 2013 22:03:14 +0200 Subject: [PATCH 2/7] Revert "Fix migrate problem caused by output formating(?)" This reverts commit 53f24cd885169d4bb0adf2253257fdaabc3dd054. --- db/migrate/20130702113610_update_group_order_totals.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20130702113610_update_group_order_totals.rb b/db/migrate/20130702113610_update_group_order_totals.rb index f0052ee5..ca9aab67 100644 --- a/db/migrate/20130702113610_update_group_order_totals.rb +++ b/db/migrate/20130702113610_update_group_order_totals.rb @@ -7,7 +7,7 @@ class UpdateGroupOrderTotals < ActiveRecord::Migration say "If you do want to update the ordergroup totals, open the rails console " + "(by running `rails c`), and enter:" - say "GroupOrder.all.each { |go| go.order.closed? and go.update_price! }" + say "GroupOrder.all.each { |go| go.order.closed? and go.update_price! }", subitem: true say "You may want to check first that no undesired accounting issues are introduced. " + "It may be wise to discuss this with those responsible for the ordering finances." From a3e82f5304739f109d40883d442c087405180e90 Mon Sep 17 00:00:00 2001 From: Julius Date: Thu, 3 Oct 2013 22:14:41 +0200 Subject: [PATCH 3/7] Add article price tooltip to StockTaking form --- app/views/stock_takings/_stock_change.html.haml | 5 +++-- app/views/stock_takings/new.html.haml | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/views/stock_takings/_stock_change.html.haml b/app/views/stock_takings/_stock_change.html.haml index 616be369..3d27c1fa 100644 --- a/app/views/stock_takings/_stock_change.html.haml +++ b/app/views/stock_takings/_stock_change.html.haml @@ -3,5 +3,6 @@ = form.hidden_field :stock_article_id = "Menge (#{stock_change.stock_article.quantity_available})" = form.text_field :quantity, :size => 5, :autocomplete => 'off' - %b= stock_change.stock_article.name - = "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})" + %span{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => stock_change.stock_article})}} + %b= stock_change.stock_article.name + = "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})" diff --git a/app/views/stock_takings/new.html.haml b/app/views/stock_takings/new.html.haml index 51239ba4..c46406f3 100644 --- a/app/views/stock_takings/new.html.haml +++ b/app/views/stock_takings/new.html.haml @@ -1,5 +1,19 @@ - title t('.title') +- content_for :javascript do + :javascript + $(function() { + enablePriceTooltips(); + }); + + function enablePriceTooltips(context) { + $('[data-toggle~="tooltip"]', context).tooltip({ + animation: false, + html: true, + placement: 'left' + }); + } + - content_for :sidebar do %p %i= t('.text_deviations', inv_link: link_to(t('.temp_inventory'), stock_articles_path)).html_safe From fef8c6d99f7f457c77363cd44b54d160677beb78 Mon Sep 17 00:00:00 2001 From: Julius Date: Thu, 3 Oct 2013 22:24:21 +0200 Subject: [PATCH 4/7] Move StockArticle#history to StockArticle#show --- app/controllers/stockit_controller.rb | 10 +++++----- app/views/stockit/index.html.haml | 3 +-- .../stockit/{history.haml => show.html.haml} | 0 config/locales/de.yml | 19 +++++++++---------- config/locales/en.yml | 19 +++++++++---------- config/locales/fr.yml | 19 +++++++++---------- config/locales/nl.yml | 19 +++++++++---------- config/routes.rb | 2 -- 8 files changed, 42 insertions(+), 49 deletions(-) rename app/views/stockit/{history.haml => show.html.haml} (100%) diff --git a/app/controllers/stockit_controller.rb b/app/controllers/stockit_controller.rb index 3e3b43b2..475ac3a3 100644 --- a/app/controllers/stockit_controller.rb +++ b/app/controllers/stockit_controller.rb @@ -31,6 +31,11 @@ class StockitController < ApplicationController end end + def show + @stock_article = StockArticle.find(params[:id]) + @stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC') + end + def destroy @article = StockArticle.find(params[:id]) @article.mark_as_deleted @@ -55,9 +60,4 @@ class StockitController < ApplicationController render :partial => 'form', :locals => {:stock_article => stock_article} end - - def history - @stock_article = StockArticle.undeleted.find(params[:stock_article_id]) - @stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!} - end end diff --git a/app/views/stockit/index.html.haml b/app/views/stockit/index.html.haml index 477e5816..c2899d9e 100644 --- a/app/views/stockit/index.html.haml +++ b/app/views/stockit/index.html.haml @@ -45,7 +45,7 @@ %tbody - for article in @stock_articles %tr{:class => stock_article_classes(article), :id => "stockArticle-#{article.id}"} - %td=h article.name + %td= link_to article.name, article %td= article.quantity %td= article.quantity - article.quantity_available %th= article.quantity_available @@ -56,7 +56,6 @@ %td= article.article_category.name %td = link_to t('ui.edit'), edit_stock_article_path(article), class: 'btn btn-mini' - = link_to t('ui.history'), stock_article_history_path(article), class: 'btn btn-mini' = link_to t('ui.delete'), article, :method => :delete, :confirm => t('.confirm_delete'), class: 'btn btn-mini btn-danger', :remote => true %p diff --git a/app/views/stockit/history.haml b/app/views/stockit/show.html.haml similarity index 100% rename from app/views/stockit/history.haml rename to app/views/stockit/show.html.haml diff --git a/config/locales/de.yml b/config/locales/de.yml index a0a0e3a7..8971e53d 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1731,15 +1731,6 @@ de: title: Lagerartikel bearbeiten form: price_hint: Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten Lagerartikeln nicht mehr verändert werden. - history: - change_quantity: Veränderung - datetime: Zeitpunkt - delivery: Lieferung - new_quantity: Neuer Bestand - order: Bestellung - reason: Ereignis - stock_changes: Verlauf anzeigen für »%{article_name}« - stock_taking: Inventur index: article: article: Artikel @@ -1765,6 +1756,15 @@ de: new: search_text: ! 'Suche nache Artikeln aus allen Katalogen:' title: Neuen Lagerartikel anlegen + show: + change_quantity: Veränderung + datetime: Zeitpunkt + delivery: Lieferung + new_quantity: Neuer Bestand + order: Bestellung + reason: Ereignis + stock_changes: Verlauf anzeigen für »%{article_name}« + stock_taking: Inventur stock_create: notice: Lagerartikel wurde gespeichert. stock_update: @@ -1889,7 +1889,6 @@ de: close: Schließen delete: Löschen edit: Bearbeiten - history: Verlauf anzeigen marks: close: ! '×' success: diff --git a/config/locales/en.yml b/config/locales/en.yml index b13f4707..50121ec5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1735,15 +1735,6 @@ en: title: Edit stock articles form: price_hint: To avoid choas, it is not possible to edit the prices of already added stock articles until further notice. - history: - change_quantity: Change - datetime: Time - delivery: Delivery - new_quantity: New quantity - order: Order - reason: Reason - stock_changes: Stock quantity changes of ‘%{article_name}’ - stock_taking: Inventory index: article: article: Article @@ -1769,6 +1760,15 @@ en: new: search_text: ! 'Search for articles in all catalogues:' title: Add new stock article + show: + change_quantity: Change + datetime: Time + delivery: Delivery + new_quantity: New quantity + order: Order + reason: Reason + stock_changes: Stock quantity changes of ‘%{article_name}’ + stock_taking: Inventory stock_create: notice: Stock article was created. stock_update: @@ -1893,7 +1893,6 @@ en: close: Close delete: Delete edit: Edit - history: Show history marks: close: ! '×' success: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 18e2cfea..30f446c2 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1737,15 +1737,6 @@ fr: title: Modifier l'article form: price_hint: Pour éviter que ça soit le bazar, les prix des articles en stock ne peuvent plus être modifiés. - history: - change_quantity: Modification - datetime: Temps - delivery: Réapprovisionnement - new_quantity: Nouveau stock - order: Commande - reason: Raison - stock_changes: Afficher l'historique pour "%{article_name}" - stock_taking: Inventaire index: article: article: Article @@ -1771,6 +1762,15 @@ fr: new: search_text: ! 'Rechercher des articles dans tous les catalogues:' title: Ajouter un article au stock + show: + change_quantity: Modification + datetime: Temps + delivery: Réapprovisionnement + new_quantity: Nouveau stock + order: Commande + reason: Raison + stock_changes: Afficher l'historique pour "%{article_name}" + stock_taking: Inventaire stock_create: notice: L'article a été sauvegardé. stock_update: @@ -1903,7 +1903,6 @@ fr: close: Fermer delete: Supprimer edit: Modifier - history: Afficher l'historique marks: close: ! '×' success: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 221d9373..50fdf702 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1663,15 +1663,6 @@ nl: title: form: price_hint: - history: - change_quantity: - datetime: - delivery: - new_quantity: - order: - reason: - stock_changes: - stock_taking: index: article: article: @@ -1697,6 +1688,15 @@ nl: new: search_text: title: + show: + change_quantity: + datetime: + delivery: + new_quantity: + order: + reason: + stock_changes: + stock_taking: stock_create: notice: Voorraadsartikel is opgeslagen. stock_update: @@ -1821,7 +1821,6 @@ nl: close: Sluiten delete: Verwijder edit: Bewerk - history: marks: close: ! '×' success: diff --git a/config/routes.rb b/config/routes.rb index 0f96d7fa..533d2d97 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -97,8 +97,6 @@ Foodsoft::Application.routes.draw do get :articles_search get :fill_new_stock_article_form end - - get :history end resources :suppliers do From 9a9a782bc40266d881129c37d8b01a6b971a2247 Mon Sep 17 00:00:00 2001 From: Julius Date: Thu, 3 Oct 2013 23:21:53 +0200 Subject: [PATCH 5/7] Complete StockArticle#show view --- app/views/stockit/show.html.haml | 62 +++++++++++++++++++++++--------- config/locales/de.yml | 2 +- config/locales/en.yml | 2 +- config/locales/fr.yml | 2 +- 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/app/views/stockit/show.html.haml b/app/views/stockit/show.html.haml index f4fe2b07..5f416bf9 100644 --- a/app/views/stockit/show.html.haml +++ b/app/views/stockit/show.html.haml @@ -1,17 +1,47 @@ -- title t('.stock_changes', :article_name => @stock_article.name) +- title @stock_article.name -%table.table.table-hover#stock_changes - %thead - %tr - %th= t '.datetime' - %th= t '.reason' - %th= t '.change_quantity' - %th= t '.new_quantity' - %tbody - - reversed_history = @stock_article.quantity_history.reverse - - @stock_changes.each_with_index do |stock_change, index| - %tr - %td= l stock_change.created_at - %td= link_to_stock_change_reason(stock_change) - %td= stock_change.quantity - %td= reversed_history[index] +.row-fluid + .span6 + %dl.dl-horizontal + %dt= StockArticle.human_attribute_name 'supplier' + %dd= link_to @stock_article.supplier.name, @stock_article.supplier + %dt= StockArticle.human_attribute_name 'name' + %dd= @stock_article.name + %dt= StockArticle.human_attribute_name 'unit' + %dd= @stock_article.unit + %dt= StockArticle.human_attribute_name 'price' + %dd= number_to_currency @stock_article.price + %dt= StockArticle.human_attribute_name 'tax' + %dd= number_to_percentage @stock_article.tax + %dt= StockArticle.human_attribute_name 'deposit' + %dd= number_to_currency @stock_article.deposit + %dt= StockArticle.human_attribute_name 'fc_price' + %dd= number_to_currency @stock_article.fc_price + %dt= StockArticle.human_attribute_name 'article_category' + %dd= @stock_article.article_category.name + %dt= StockArticle.human_attribute_name 'note' + %dd= @stock_article.note + %dt= StockArticle.human_attribute_name 'quantity' + %dd= @stock_article.quantity + %dt= StockArticle.human_attribute_name 'quantity_available' + %dd= @stock_article.quantity_available + .form-actions + = link_to t('ui.edit'), edit_stock_article_path(@stock_article), class: 'btn' + + .span6 + %h2= t('.stock_changes') + %table.table.table-hover#stock_changes + %thead + %tr + %th= t '.datetime' + %th= t '.reason' + %th= t '.change_quantity' + %th= t '.new_quantity' + %tbody + - reversed_history = @stock_article.quantity_history.reverse + - @stock_changes.each_with_index do |stock_change, index| + %tr + %td= l stock_change.created_at + %td= link_to_stock_change_reason(stock_change) + %td= stock_change.quantity + %td= reversed_history[index] diff --git a/config/locales/de.yml b/config/locales/de.yml index 8971e53d..ba339ee8 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1763,7 +1763,7 @@ de: new_quantity: Neuer Bestand order: Bestellung reason: Ereignis - stock_changes: Verlauf anzeigen für »%{article_name}« + stock_changes: Verlauf des Lagerbestands stock_taking: Inventur stock_create: notice: Lagerartikel wurde gespeichert. diff --git a/config/locales/en.yml b/config/locales/en.yml index 50121ec5..6c3fbea8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1767,7 +1767,7 @@ en: new_quantity: New quantity order: Order reason: Reason - stock_changes: Stock quantity changes of ‘%{article_name}’ + stock_changes: Stock quantity changes stock_taking: Inventory stock_create: notice: Stock article was created. diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 30f446c2..8d16c076 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1769,7 +1769,7 @@ fr: new_quantity: Nouveau stock order: Commande reason: Raison - stock_changes: Afficher l'historique pour "%{article_name}" + stock_changes: Afficher l'historique stock_taking: Inventaire stock_create: notice: L'article a été sauvegardé. From 10d1615cd878f33ea4175bfab76e7cca83bd1785 Mon Sep 17 00:00:00 2001 From: Julius Date: Sat, 5 Oct 2013 22:28:04 +0200 Subject: [PATCH 6/7] Prepare tooltip for next bootstrap version (as in 1fed9834b35dbee8b329305b2a62ac1ddf8e0eb7) --- app/views/stock_takings/new.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/stock_takings/new.html.haml b/app/views/stock_takings/new.html.haml index c46406f3..6e4526f9 100644 --- a/app/views/stock_takings/new.html.haml +++ b/app/views/stock_takings/new.html.haml @@ -10,7 +10,8 @@ $('[data-toggle~="tooltip"]', context).tooltip({ animation: false, html: true, - placement: 'left' + placement: 'left', + container: 'body' }); } From 9041a350d5b15279974241b58515ec3c663ed00f Mon Sep 17 00:00:00 2001 From: Julius Date: Sat, 5 Oct 2013 22:37:17 +0200 Subject: [PATCH 7/7] Add some locales for article attributes --- config/locales/de.yml | 5 +++++ config/locales/en.yml | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index bed1f8b9..ea3d9bf8 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -42,7 +42,10 @@ de: fc_price: Endpreis fc_share: FC-Aufschlag gross_price: Bruttopreis + name: Name + note: Notiz price: Nettopreis + supplier: Lieferantin tax: MwSt unit: Einheit unit_quantity: Gebindegröße @@ -51,6 +54,8 @@ de: note: Notiz stock_article: price: Nettopreis + quantity: Lagerbestand + quantity_available: Verfügbarer Bestand user: first_name: Vorname password: Passwort diff --git a/config/locales/en.yml b/config/locales/en.yml index cebb1c8e..d54afc8a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -42,7 +42,10 @@ en: fc_price: FC price fc_share: FC share gross_price: gross price + name: name + note: note price: price + supplier: supplier tax: VAT unit: unit unit_quantity: unit quantity @@ -50,7 +53,9 @@ en: amount: amount note: note stock_article: - price: Price + price: price + quantity: quantity + quantity_available: available quantity user: first_name: First name password: Password