Add stock_article_selection (deleting multiple stock articles at once)

This commit is contained in:
Julius 2013-01-12 16:14:06 +01:00
parent ecb7ce7cd3
commit 099e2b9b06
13 changed files with 217 additions and 34 deletions

View file

@ -2,7 +2,7 @@
- content_for :javascript do
:javascript
$(function() {
$('tr.unavailable').hide();
$('tr.unavailable,input.unavailable').hide();
})
.well.well-small
@ -12,7 +12,7 @@
Ansichtsoptionen
%span.caret
%ul.dropdown-menu
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable', tabindex: -1
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable,input.unavailable', tabindex: -1
.btn-group
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn btn-primary'
@ -20,6 +20,7 @@
class: 'btn'
= link_to "Inventur anlegen", new_stock_taking_path, class: 'btn'
= link_to "Inventurübersicht", stock_takings_path, class: 'btn'
= link_to 'Löschvorschläge', stock_article_selections_path, class: 'btn'
.btn-group
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
@ -29,36 +30,43 @@
- Supplier.all.each do |supplier|
%li= link_to supplier.name, new_supplier_delivery_path(supplier), tabindex: -1
%table.table.table-hover#articles
%thead
%tr
%th Artikel
%th im Lager
%th davon bestellt
%th verfügbar
%th Einheit
%th Preis
%th MwSt
%th Lieferantin
%th Kategorie
%th
%tbody
- for article in @stock_articles
%tr{:class => stock_article_classes(article)}
%td=h article.name
%td= article.quantity
%td= article.quantity - article.quantity_available
%th= article.quantity_available
%td= article.unit
%td= article.price
%td= number_to_percentage article.tax
%td= link_to article.supplier.name, article.supplier
%td= article.article_category.name
%td
= link_to "Bearbeiten", edit_stock_article_path(article), class: 'btn btn-mini'
= link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?",
class: 'btn btn-mini btn-danger'
= form_for @stock_article_selection do |form|
- if @stock_article_selection.errors.has_key?(:stock_articles)
.alert.alert-error
= @stock_article_selection.errors.get(:stock_articles).join(" ")
%table.table.table-hover#articles
%thead
%tr
%th= check_box_tag 'checkall', '1', false,
{ 'data-check-all' => 'table#articles tr.unavailable', :title => 'Alle löschbaren Artikel', :class => 'unavailable' }
%th Artikel
%th im Lager
%th davon bestellt
%th verfügbar
%th Einheit
%th Preis
%th MwSt
%th Lieferantin
%th Kategorie
%th
%tbody
- for article in @stock_articles
%tr{:class => stock_article_classes(article)}
%td= stock_article_delete_checkbox(article)
%td=h article.name
%td= article.quantity
%td= article.quantity - article.quantity_available
%th= article.quantity_available
%td= article.unit
%td= article.price
%td= number_to_percentage article.tax
%td= link_to article.supplier.name, article.supplier
%td= article.article_category.name
%td
= link_to "Bearbeiten", edit_stock_article_path(article), class: 'btn btn-mini'
= link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?",
class: 'btn btn-mini btn-danger'
%p= submit_tag "Artikel zum Löschen vormerken", { :class => 'unavailable btn' }
%p
Aktueller Lagerwert:
= number_to_currency StockArticle.stock_value

View file

@ -0,0 +1,19 @@
%table.table.table-hover
%tr
%th Artikel
%th Erstellt am
%th Erstellt von
%th Optionen
- stock_article_selections.each do |stock_article_selection|
%tr
%td=h truncate stock_article_selection.stock_articles.map{ |article| article.name}.join(', ')
%td=h stock_article_selection.created_at
%td=h link_to_user_message_if_valid stock_article_selection.created_by
%td
= link_to 'Anzeigen', stock_article_selection, class: 'btn btn-small'
= link_to "Artikel löschen", articles_stock_article_selection_path(stock_article_selection), :method => :delete,
:confirm => 'Diesen Löschvorschlag wirklich ausführen und markierte Artikel löschen?', class: 'btn btn-small btn-danger'
= link_to "Verwerfen", stock_article_selection, :method => :delete,
:confirm => 'Diesen Löschvorschlag wirklich verwerfen?', class: 'btn btn-small'

View file

@ -0,0 +1,7 @@
- title "Löschvorschläge für Lagerartikel"
- if @stock_article_selections.empty?
%p Es gibt keine ausstehenden Löschvorschläge.
%ul
%li= link_to "Löschvorschlag erstellen", stock_articles_path
- else
= render :partial => 'overview', :locals => {:stock_article_selections => @stock_article_selections}

View file

@ -0,0 +1,18 @@
- title "Löschvorschlag für #{@stock_article_selection.stock_articles.count} Lagerartikel"
%dl
%dt Löschvorschlag vom:
%dd=h @stock_article_selection.created_at
%dt Erstellt durch:
%dd=h link_to_user_message_if_valid(@stock_article_selection.created_by)
%dt Zu löschende Artikel
- for article in @stock_article_selection.stock_articles
%dd=h article.name
%p
= link_to 'Artikel löschen', articles_stock_article_selection_path(@stock_article_selection), :method => :delete,
:confirm => 'Diesen Löschvorschlag wirklich ausführen und markierte Artikel löschen?', class: 'btn btn-danger'
= link_to 'Verwerfen', @stock_article_selection, :method => :delete,
:confirm => 'Diesen Löschvorschlag wirklich verwerfen?', class: 'btn'
= link_to 'Alle Löschvorschläge zeigen', stock_article_selections_path, class: 'btn'