Merge pull request #28 from JuliusR/rails3
stock_article_selection ready for testing
This commit is contained in:
commit
00d2847f9d
21 changed files with 177 additions and 80 deletions
3
Gemfile
3
Gemfile
|
@ -53,4 +53,7 @@ group :development do
|
|||
# Re-enable rails benchmarker/profiler
|
||||
gem 'ruby-prof'
|
||||
gem 'test-unit'
|
||||
|
||||
# Get infos when not using proper eager loading
|
||||
gem 'bullet'
|
||||
end
|
||||
|
|
|
@ -57,6 +57,8 @@ GEM
|
|||
erubis (>= 2.7.0)
|
||||
binding_of_caller (0.6.8)
|
||||
builder (3.0.4)
|
||||
bullet (4.3.0)
|
||||
uniform_notifier
|
||||
chronic (0.9.0)
|
||||
client_side_validations (3.1.4)
|
||||
coderay (1.0.8)
|
||||
|
@ -205,6 +207,7 @@ GEM
|
|||
uglifier (1.3.0)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
uniform_notifier (1.1.1)
|
||||
vegas (0.1.11)
|
||||
rack (>= 1.0.0)
|
||||
whenever (0.8.1)
|
||||
|
@ -223,6 +226,7 @@ DEPENDENCIES
|
|||
acts_as_versioned!
|
||||
better_errors
|
||||
binding_of_caller
|
||||
bullet
|
||||
client_side_validations
|
||||
coffee-rails (~> 3.2.1)
|
||||
daemons
|
||||
|
|
|
@ -157,13 +157,13 @@ function updateBalance() {
|
|||
var bgcolor = '';
|
||||
if (balance < 0) {
|
||||
bgcolor = '#FF0000';
|
||||
$('#submit_button').disabled = true;
|
||||
$('#submit_button').attr('disabled', 'disabled')
|
||||
} else {
|
||||
$('#submit_button').disabled = false;
|
||||
$('#submit_button').removeAttr('disabled')
|
||||
}
|
||||
// update bgcolor
|
||||
for (i in itemTotal) {
|
||||
$('#ltd_price_' + i).css('background-color', bgcolor);
|
||||
$('#td_price_' + i).css('background-color', bgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
class StockitController < ApplicationController
|
||||
|
||||
def index
|
||||
@stock_articles = StockArticle.includes(:supplier, :article_category).
|
||||
order('suppliers.name, article_categories.name, articles.name')
|
||||
@stock_articles = StockArticle.elements_for_index
|
||||
@stock_article_selection = StockArticleSelection.new
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
class StockitSelectionsController < ApplicationController
|
||||
|
||||
def index
|
||||
@stock_article_selections = StockArticleSelection.all
|
||||
@stock_article_selections = StockArticleSelection.find(:all, :order => 'created_at DESC')
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -14,43 +14,48 @@ class StockitSelectionsController < ApplicationController
|
|||
@stock_article_selection.created_by = current_user
|
||||
|
||||
if @stock_article_selection.save
|
||||
redirect_to(@stock_article_selection, :notice => 'Löschvorschlag für gewählte Artikel wurde erstellt.')
|
||||
redirect_to(@stock_article_selection, :notice => 'Löschvorschlag für gewählte Artikel erstellt.')
|
||||
else
|
||||
@stock_articles = StockArticle.includes(:supplier, :article_category).
|
||||
order('suppliers.name, article_categories.name, articles.name')
|
||||
@stock_articles = StockArticle.elements_for_index
|
||||
render 'stockit/index'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy # destroy (open or finished) selection without deleting articles
|
||||
def destroy # destroy selection without deleting articles
|
||||
stock_article_selection = StockArticleSelection.find(params[:id])
|
||||
stock_article_selection.destroy
|
||||
|
||||
redirect_to stock_article_selections_path, :notice => 'Löschvorschlag wurde verworfen.'
|
||||
redirect_to stock_article_selections_path, :notice => 'Löschvorschlag verworfen.'
|
||||
end
|
||||
|
||||
def articles # destroy articles, finish selection
|
||||
def articles # destroy articles
|
||||
stock_article_selection = StockArticleSelection.find(params[:id])
|
||||
|
||||
destroyed_articles_count = 0
|
||||
failed_articles_count = 0
|
||||
stock_article_selection.stock_articles.each do |article|
|
||||
begin
|
||||
article.destroy # article.delete would save some effort, but validations are important
|
||||
article.destroy
|
||||
destroyed_articles_count += 1
|
||||
rescue => error # recover if article.destroy fails and continue with next article
|
||||
failed_articles_count += 1
|
||||
end
|
||||
end
|
||||
|
||||
if destroyed_articles_count>0 # note that 1 successful article.destroy is enough to destroy selection
|
||||
stock_article_selection.destroy
|
||||
flash[:notice] = "#{destroyed_articles_count} gewählte Artikel sind nun gelöscht."
|
||||
if destroyed_articles_count > 0
|
||||
flash[:notice] = "#{destroyed_articles_count} gewählte Artikel gelöscht."
|
||||
flash[:error] = "#{failed_articles_count} Artikel konnten nicht gelöscht werden." unless 0==failed_articles_count
|
||||
else
|
||||
flash[:error] = "Löschvorgang fehlgeschlagen. Es wurden keine Artikel gelöscht."
|
||||
flash[:error] = 'Löschvorgang fehlgeschlagen. Keine Artikel gelöscht.'
|
||||
end
|
||||
|
||||
redirect_to stock_articles_path
|
||||
end
|
||||
|
||||
def finished # delete all finished selections
|
||||
finished_selections = StockArticleSelection.all.select { |sel| sel.deletable_count + sel.nondeletable_count <= 0 }
|
||||
finished_selections.each { |sel| sel.destroy }
|
||||
|
||||
redirect_to stock_article_selections_path, :notice => 'Alle erledigten Löschvorschläge entfernt.'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -142,7 +142,8 @@ module ApplicationHelper
|
|||
# offers a link for writing message to user
|
||||
# checks for nil (useful for relations)
|
||||
def link_to_user_message_if_valid(user)
|
||||
user.nil? ? '??' : ( link_to user.nick, new_message_path(:message => {:mail_to => user.id}), :title => 'Nachricht schreiben' )
|
||||
user.nil? ? '??' : link_to(user.nick, new_message_path('message[mail_to]' => user.id),
|
||||
:title => 'Nachricht schreiben')
|
||||
end
|
||||
|
||||
def bootstrap_flash
|
||||
|
|
|
@ -1,2 +1,18 @@
|
|||
# encoding: utf-8
|
||||
module StockArticleSelectionsHelper
|
||||
def article_deletion_classes(article)
|
||||
className = "label label-success" # usual deletable case, maybe modified below
|
||||
className = "label label-important" if article.quantity_available > 0
|
||||
className = "label" if article.deleted?
|
||||
|
||||
className
|
||||
end
|
||||
|
||||
def article_deletion_title(article)
|
||||
myTitle = "Löschbar" # usual deletable case, maybe modified below
|
||||
myTitle = "Nicht löschbar, da im Lager vorhanden" if article.quantity_available > 0
|
||||
myTitle = "Bereits gelöscht" if article.deleted?
|
||||
|
||||
myTitle
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,20 +38,23 @@ class GroupOrder < ActiveRecord::Base
|
|||
|
||||
# load prices and other stuff....
|
||||
data[:order_articles] = {}
|
||||
order.order_articles.each do |order_article|
|
||||
data[:order_articles][order_article.id] = {
|
||||
:price => order_article.article.fc_price,
|
||||
:unit => order_article.article.unit_quantity,
|
||||
:quantity => (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:others_quantity => order_article.quantity - (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:used_quantity => (new_record? ? 0 : goas[order_article.id][:quantity_result]),
|
||||
:tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:others_tolerance => order_article.tolerance - (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:used_tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance_result]),
|
||||
:total_price => (new_record? ? 0 : goas[order_article.id][:total_price]),
|
||||
:missing_units => order_article.missing_units,
|
||||
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
|
||||
}
|
||||
#order.order_articles.each do |order_article|
|
||||
order.articles_grouped_by_category.each do |article_category, order_articles|
|
||||
order_articles.each do |order_article|
|
||||
data[:order_articles][order_article.id] = {
|
||||
:price => order_article.article.fc_price,
|
||||
:unit => order_article.article.unit_quantity,
|
||||
:quantity => (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:others_quantity => order_article.quantity - (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:used_quantity => (new_record? ? 0 : goas[order_article.id][:quantity_result]),
|
||||
:tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:others_tolerance => order_article.tolerance - (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:used_tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance_result]),
|
||||
:total_price => (new_record? ? 0 : goas[order_article.id][:total_price]),
|
||||
:missing_units => order_article.missing_units,
|
||||
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
data
|
||||
|
|
|
@ -82,9 +82,10 @@ class Order < ActiveRecord::Base
|
|||
# The array has the following form:
|
||||
# e.g: [["drugs",[teethpaste, toiletpaper]], ["fruits" => [apple, banana, lemon]]]
|
||||
def articles_grouped_by_category
|
||||
order_articles.includes([:article_price, :group_order_articles, :article => :article_category]).
|
||||
@articles_grouped_by_category ||= order_articles.
|
||||
includes([:article_price, :group_order_articles, :article => :article_category]).
|
||||
order('articles.name').
|
||||
group_by { |a| a.article.article_category.name }.
|
||||
group_by { |a| a.article.article_category.name }.
|
||||
sort { |a, b| a[0] <=> b[0] }
|
||||
end
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ class StockArticle < Article
|
|||
def self.stock_value
|
||||
available.collect { |a| a.quantity * a.gross_price }.sum
|
||||
end
|
||||
|
||||
def self.elements_for_index
|
||||
StockArticle.includes(:supplier, :article_category).
|
||||
order('suppliers.name, article_categories.name, articles.name')
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
|
|
@ -13,6 +13,18 @@ class StockArticleSelection < ActiveRecord::Base
|
|||
all_articles = stock_article_ids
|
||||
end
|
||||
|
||||
def deletable_count
|
||||
stock_articles.select { |a| a.quantity_available<=0 }.length
|
||||
end
|
||||
|
||||
def nondeletable_count
|
||||
stock_articles.select { |a| a.quantity_available>0 }.length
|
||||
end
|
||||
|
||||
def deleted_count
|
||||
stock_articles.only_deleted.count
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def include_stock_articles
|
||||
|
|
|
@ -12,31 +12,34 @@
|
|||
})
|
||||
});
|
||||
|
||||
.row-fluid
|
||||
.span6
|
||||
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
||||
= f.hidden_field :supplier_id
|
||||
#stock_changes
|
||||
= f.fields_for :stock_changes do |stock_change_form|
|
||||
%p
|
||||
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
|
||||
Menge
|
||||
= stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
|
||||
= stock_change_form.hidden_field :_destroy
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", class: 'destroy_stock_change'
|
||||
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
||||
= f.hidden_field :supplier_id
|
||||
#stock_changes
|
||||
= f.fields_for :stock_changes do |stock_change_form|
|
||||
%p
|
||||
= link_to "Lagerartikel der Lieferung hinzufügen", {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
|
||||
%hr/
|
||||
= f.input :delivered_on, as: :date_picker
|
||||
= f.input :note, input_html: {size: '35x4'}
|
||||
.form-actions
|
||||
= f.submit class: 'btn btn-primary'
|
||||
= link_to "oder abbrechen", supplier_deliveries_path(@supplier)
|
||||
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
|
||||
Menge
|
||||
= stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
|
||||
= stock_change_form.hidden_field :_destroy
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", class: 'destroy_stock_change'
|
||||
%p
|
||||
= link_to "Lagerartikel der Lieferung hinzufügen", {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
|
||||
%p
|
||||
%small
|
||||
Ist ein Artikel noch nicht in der Lagerverwaltung, muss er erst
|
||||
#{link_to("neu angelegt", new_stock_article_path)} werden.
|
||||
%hr/
|
||||
= f.input :delivered_on, as: :date_picker
|
||||
= f.input :note, input_html: {size: '35x4'}
|
||||
.form-actions
|
||||
= f.submit class: 'btn btn-primary'
|
||||
= link_to "oder abbrechen", supplier_deliveries_path(@supplier)
|
||||
|
||||
/
|
||||
TODO: Fix this!!
|
||||
.span6
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
%p
|
||||
//TODO: Fix this!!
|
||||
Suche nach Artikeln aus dem
|
||||
%i= @supplier.name
|
||||
Katalog:
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
%td Neuer Kontostand:
|
||||
%td.currency
|
||||
%strong
|
||||
%span#new_balance= @ordergroup.account_balance - @group_order.price
|
||||
%span#new_balance= @ordering_data[:available_funds] - @group_order.price
|
||||
€
|
||||
#order-button
|
||||
= submit_tag( "Bestellung speichern", id: 'submit_button', class: 'btn btn-primary' )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
- content_for :javascript do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('tr.unavailable,input.unavailable').hide();
|
||||
$('tr.unavailable,input.unavailable,div.unavailable').hide();
|
||||
})
|
||||
|
||||
.well.well-small
|
||||
|
@ -12,12 +12,12 @@
|
|||
Ansichtsoptionen
|
||||
%span.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable,input.unavailable', tabindex: -1
|
||||
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable,input.unavailable,div.unavailable', tabindex: -1
|
||||
|
||||
.btn-group
|
||||
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn btn-primary'
|
||||
= link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", new_order_path(supplier_id: 0),
|
||||
class: 'btn'
|
||||
class: 'btn', class: 'btn btn-primary'
|
||||
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, 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'
|
||||
|
@ -66,7 +66,8 @@
|
|||
= 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' }
|
||||
.form-actions.unavailable
|
||||
= submit_tag "Artikel zum Löschen vormerken", { :class => 'unavailable btn' }
|
||||
%p
|
||||
Aktueller Lagerwert:
|
||||
= number_to_currency StockArticle.stock_value
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
})
|
||||
|
||||
|
||||
%p
|
||||
/
|
||||
TODO: Fix this
|
||||
%p
|
||||
Suche nach Artikeln aus allen Katalogen:
|
||||
= text_field_tag 'article_search'
|
||||
#stock_article_form
|
||||
|
|
|
@ -2,15 +2,22 @@
|
|||
%table.table.table-hover
|
||||
%tr
|
||||
%th Artikel
|
||||
%th Zusammenfassung
|
||||
%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
|
||||
- for article in stock_article_selection.stock_articles.with_deleted
|
||||
%span{:class => article_deletion_classes(article), :title => article_deletion_title(article)}= article.name
|
||||
%td
|
||||
%span{:class => 'label label-success'}= "#{stock_article_selection.deletable_count} Löschbar"
|
||||
%span{:class => 'label'}= "#{stock_article_selection.deleted_count} Gelöscht"
|
||||
%span{:class => 'label label-important'}= "#{stock_article_selection.nondeletable_count} Nicht löschbar"
|
||||
%td= format_date(stock_article_selection.created_at)
|
||||
%td= 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,
|
||||
|
|
|
@ -1,7 +1,25 @@
|
|||
- 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
|
||||
|
||||
.well.well-small
|
||||
.btn-toolbar
|
||||
.btn-group
|
||||
= link_to "Lager anzeigen", stock_articles_path, class: 'btn'
|
||||
= link_to "Aufräumen", finished_stock_article_selections_path, :method => 'delete',
|
||||
:confirm => 'Wirklich alle erledigten Löschvorschläge entfernen?', class: 'btn'
|
||||
|
||||
.well
|
||||
%h2 Ausstehende Löschvorschläge
|
||||
- open_selections = @stock_article_selections.select { |sel| sel.deletable_count + sel.nondeletable_count > 0 }
|
||||
- if open_selections.length == 0
|
||||
%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 => open_selections}
|
||||
|
||||
%h2 Erledigte Löschvorschläge
|
||||
- finished_selections = @stock_article_selections.select { |sel| sel.deletable_count + sel.nondeletable_count <= 0 }
|
||||
- if finished_selections.length == 0
|
||||
%p Es gibt keine erledigten Löschvorschläge.
|
||||
- else
|
||||
= render :partial => 'overview', :locals => {:stock_article_selections => @stock_article_selections}
|
||||
= render :partial => 'overview', :locals => {:stock_article_selections => finished_selections}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
- title "Löschvorschlag für #{@stock_article_selection.stock_articles.count} Lagerartikel"
|
||||
|
||||
.well.well-small
|
||||
.btn-toolbar
|
||||
.btn-group
|
||||
= link_to "Lager anzeigen", stock_articles_path, class: 'btn'
|
||||
= link_to 'Alle Löschvorschläge anzeigen', stock_article_selections_path, class: 'btn'
|
||||
|
||||
%dl
|
||||
%dt Löschvorschlag vom:
|
||||
%dd=h @stock_article_selection.created_at
|
||||
%dd= format_time(@stock_article_selection.created_at)
|
||||
%dt Erstellt durch:
|
||||
%dd=h link_to_user_message_if_valid(@stock_article_selection.created_by)
|
||||
%dd= 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
|
||||
- for article in @stock_article_selection.stock_articles.with_deleted
|
||||
%dd
|
||||
%span{:class => article_deletion_classes(article), :title => article_deletion_title(article)}= article.name
|
||||
|
||||
|
||||
%p
|
||||
|
@ -15,4 +22,4 @@
|
|||
: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'
|
||||
= link_to 'Alle Löschvorschläge anzeigen', stock_article_selections_path, class: 'btn'
|
||||
|
|
6
config/initializers/bullet.rb
Normal file
6
config/initializers/bullet.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
if defined? Bullet
|
||||
Bullet.enable = true
|
||||
# Bullet.alert = true
|
||||
Bullet.bullet_logger = true
|
||||
Bullet.console = true
|
||||
end
|
|
@ -7,7 +7,7 @@ SimpleNavigation::Configuration.run do |navigation|
|
|||
|
||||
primary.item :dashboard_nav_item, 'Dashboard', root_path(anchor: '')
|
||||
|
||||
primary.item :foodcoop, 'Foodcoop', '#' do |subnav|
|
||||
primary.item :foodcoop, 'Foodcoop', '#', id: nil do |subnav|
|
||||
subnav.item :members, 'Mitglieder', foodcoop_users_path, id: nil
|
||||
subnav.item :workgroups, 'Arbeitsgruppen', foodcoop_workgroups_path, id: nil
|
||||
subnav.item :ordergroups, 'Bestellgruppen', foodcoop_ordergroups_path, id: nil
|
||||
|
@ -15,32 +15,32 @@ SimpleNavigation::Configuration.run do |navigation|
|
|||
subnav.item :tasks, 'Aufgaben', tasks_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :wiki, 'Wiki', '#' do |subnav|
|
||||
primary.item :wiki, 'Wiki', '#', id: nil do |subnav|
|
||||
subnav.item :wiki_home, 'Startseite', wiki_path, id: nil
|
||||
subnav.item :all_pages, 'Alle Seiten', all_pages_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :orders, 'Bestellungen', '#' do |subnav|
|
||||
primary.item :orders, 'Bestellungen', '#', id: nil do |subnav|
|
||||
subnav.item :ordering, 'Bestellen!', group_orders_path, id: nil
|
||||
subnav.item :ordering_archive, 'Meine Bestellungen', archive_group_orders_path, id: nil
|
||||
subnav.item :orders, 'Bestellverwaltung', orders_path, if: Proc.new { current_user.role_orders? }, id: nil
|
||||
end
|
||||
|
||||
primary.item :articles, 'Artikel', '#',
|
||||
primary.item :articles, 'Artikel', '#', id: nil,
|
||||
if: Proc.new { current_user.role_article_meta? or current_user.role_suppliers? } do |subnav|
|
||||
subnav.item :suppliers, 'Lieferanten/Artikel', suppliers_path, id: nil
|
||||
subnav.item :stockit, 'Lager', stock_articles_path, id: nil
|
||||
subnav.item :categories, 'Kategorien', article_categories_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :finance, 'Finanzen', '#', if: Proc.new { current_user.role_finance? } do |subnav|
|
||||
primary.item :finance, 'Finanzen', '#', id: nil, if: Proc.new { current_user.role_finance? } do |subnav|
|
||||
subnav.item :finance_home, 'Übersicht', finance_root_path
|
||||
subnav.item :accounts, 'Konten verwalten', finance_ordergroups_path, id: nil
|
||||
subnav.item :balancing, 'Bestellungen abrechnen', finance_order_index_path, id: nil
|
||||
subnav.item :invoices, 'Rechnungen', finance_invoices_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :admin, 'Administration', '#', if: Proc.new { current_user.role_admin? } do |subnav|
|
||||
primary.item :admin, 'Administration', '#', id: nil, if: Proc.new { current_user.role_admin? } do |subnav|
|
||||
subnav.item :admin_home, 'Übersicht', admin_root_path
|
||||
subnav.item :users, 'Benutzerinnen', admin_users_path, id: nil
|
||||
subnav.item :ordergroups, 'Bestellgruppen', admin_ordergroups_path, id: nil
|
||||
|
|
|
@ -95,6 +95,10 @@ Foodsoft::Application.routes.draw do
|
|||
member do
|
||||
delete 'articles'
|
||||
end
|
||||
|
||||
collection do
|
||||
delete 'finished'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue