Fixed admin, orders, wiki views. Converted all erb to haml.
This commit is contained in:
parent
699fb9b233
commit
552c553b77
169 changed files with 1158 additions and 1307 deletions
|
|
@ -1,32 +1,36 @@
|
|||
%table
|
||||
%tr
|
||||
%th Name
|
||||
%th Gebinde
|
||||
%th Netto-/Bruttopreis
|
||||
%th Bestellte Einheiten
|
||||
- unless order.stockit?
|
||||
%th Volle Gebinde
|
||||
- total_net, total_gross, counter = 0, 0, 0
|
||||
- order.articles_grouped_by_category.each do |category_name, order_articles|
|
||||
%tr{:style => "background-color:#EFEFEF"}
|
||||
%td{:style => "text-align:left; color: grey;"}=h category_name
|
||||
%td{:colspan => "9"}
|
||||
- order_articles.each do |order_article|
|
||||
- net_price = order_article.price.price
|
||||
- gross_price = order_article.price.gross_price
|
||||
- units = order_article.units_to_order
|
||||
- unit_quantity = order_article.price.unit_quantity
|
||||
- total_net += units * unit_quantity * net_price
|
||||
- total_gross += units * unit_quantity * gross_price
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color: #{units > 0 ? 'green' : 'red'}"}
|
||||
%td=h order_article.article.name
|
||||
%td= "#{unit_quantity} x #{order_article.article.unit}"
|
||||
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
|
||||
- if order.stockit?
|
||||
%td= units
|
||||
- else
|
||||
%td= "#{order_article.quantity} + #{order_article.tolerance}" if unit_quantity > 1
|
||||
%td= units
|
||||
%table.table.table-hover
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Gebinde
|
||||
%th Netto-/Bruttopreis
|
||||
%th Bestellte Einheiten
|
||||
- unless order.stockit?
|
||||
%th Volle Gebinde
|
||||
- total_net, total_gross, counter = 0, 0, 0
|
||||
%tbody
|
||||
- order.articles_grouped_by_category.each do |category_name, order_articles|
|
||||
%tr.article-category
|
||||
%td
|
||||
= category_name
|
||||
%i.icon-tag
|
||||
%td{:colspan => "9"}
|
||||
- order_articles.each do |order_article|
|
||||
- net_price = order_article.price.price
|
||||
- gross_price = order_article.price.gross_price
|
||||
- units = order_article.units_to_order
|
||||
- unit_quantity = order_article.price.unit_quantity
|
||||
- total_net += units * unit_quantity * net_price
|
||||
- total_gross += units * unit_quantity * gross_price
|
||||
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color: #{units > 0 ? 'green' : 'red'}"}
|
||||
%td=h order_article.article.name
|
||||
%td= "#{unit_quantity} x #{order_article.article.unit}"
|
||||
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
|
||||
- if order.stockit?
|
||||
%td= units
|
||||
- else
|
||||
%td= "#{order_article.quantity} + #{order_article.tolerance}" if unit_quantity > 1
|
||||
%td= units
|
||||
%p
|
||||
Summe (Netto/Brutto-Preise):
|
||||
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
= pagination_links_remote @orders, :params => {:sort => params[:sort]}
|
||||
%table.list{:style => "width: 100%"}
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th[sort_td_class_helper("supplier")]
|
||||
|
|
@ -11,9 +11,9 @@
|
|||
%th{:colspan => "2"}
|
||||
%tbody
|
||||
- @orders.each do |order|
|
||||
%tr{:class => cycle('even', 'odd', :name => 'orders')}
|
||||
%td=h order.name
|
||||
%td=h format_time(order.starts)
|
||||
%td=h format_time(order.ends)
|
||||
%td= order.state
|
||||
%td= link_to "Anzeigen", order
|
||||
%tr
|
||||
%td= order.name
|
||||
%td= format_time(order.starts)
|
||||
%td= format_time(order.ends)
|
||||
%td= t(order.state, scope: 'orders.state')
|
||||
%td= link_to "Anzeigen", order, class: 'btn btn-small'
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
// Preset selected order articles per template order:
|
||||
var template = new Array();
|
||||
<% current_article_ids = @order.supplier.articles.available.map(&:id) -%>
|
||||
<% i = -1; for order in @template_orders -%>
|
||||
template[<%= i += 1 %>] = new Array(<%= current_article_ids.collect { |id| order.article_ids.include?(id) }.join(', ') %>);
|
||||
<% end -%>
|
||||
// Call with index into template-array to select order articles from template.
|
||||
function useTemplate(id) {
|
||||
if (id >= 0 && id < template.length) {
|
||||
<% i = -1; for article_id in current_article_ids -%>
|
||||
var status = template[id][<%= i += 1 %>]
|
||||
$('checkbox_<%= article_id %>').checked = status;
|
||||
highlightRow('<%= article_id %>',status);
|
||||
<% end -%>
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
17
app/views/orders/_template_orders_script.html.haml
Normal file
17
app/views/orders/_template_orders_script.html.haml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
:javascript
|
||||
//
|
||||
// Preset selected order articles per template order:
|
||||
var template = new Array();
|
||||
<haml:silent> current_article_ids = @order.supplier.articles.available.map(&:id)
|
||||
</haml:silent><haml:silent> i = -1; for order in @template_orders
|
||||
</haml:silent><haml:block> template[#{i += 1}] = new Array(#{current_article_ids.collect { |id| order.article_ids.include?(id) }.join(', ')});
|
||||
</haml:block> // Call with index into template-array to select order articles from template.
|
||||
function useTemplate(id) {
|
||||
if (id >= 0 && id < template.length) {
|
||||
<haml:silent> i = -1; for article_id in current_article_ids
|
||||
</haml:silent><haml:block> var status = template[id][#{i += 1}]
|
||||
$('checkbox_#{article_id}').checked = status;
|
||||
highlightRow('#{article_id}',status);
|
||||
</haml:block> }
|
||||
}
|
||||
//
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
- title "Bestellungen verwalten"
|
||||
|
||||
%p
|
||||
- form_tag do
|
||||
Neue Bestellung anlegen für
|
||||
= select_tag :switch_supplier,
|
||||
options_for_suppliers_to_select,
|
||||
:style => "font-size: 0.9em;margin-left:1em;",
|
||||
'data-redirect-to' => true
|
||||
%br/
|
||||
.left_column{:style => "width:55em"}
|
||||
.box_title
|
||||
%h2 Laufende Bestellungen
|
||||
.column_content
|
||||
- unless @open_orders.empty?
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th Lieferantin
|
||||
%th Ende
|
||||
%th Notiz
|
||||
%th{:colspan => "2"}
|
||||
%tbody
|
||||
- for order in @open_orders
|
||||
- tr_class = cycle('even', 'odd', :name => 'open_orders')
|
||||
- tr_class += " active" if order.expired?
|
||||
%tr{:class => tr_class}
|
||||
%td=h order.name
|
||||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
%td=h truncate(order.note)
|
||||
%td= link_to "Beenden", finish_order_path(order), :confirm => "Willst Du wirklich die Bestellung \"#{order.name}\" beenden?\nEs gibt kein zurück.", :method => :post
|
||||
%td
|
||||
= link_to "Anzeigen", order
|
||||
= link_to icon(:edit), edit_order_path(order)
|
||||
= link_to icon(:delete), order, :confirm => "Bist Du sicher die Bestellung zu beenden?", :method => :delete
|
||||
- else
|
||||
Derzeit gibt es keine laufende Bestellungen.
|
||||
|
||||
.left_column{:style => "width:75em"}
|
||||
.box_title
|
||||
%h2 Beendete Bestellungen
|
||||
.column_content#orders_table
|
||||
= render :partial => 'orders'
|
||||
41
app/views/orders/index.html.haml
Normal file
41
app/views/orders/index.html.haml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
- title "Bestellungen verwalten"
|
||||
|
||||
%p
|
||||
- form_tag do
|
||||
Neue Bestellung anlegen für
|
||||
= select_tag :switch_supplier,
|
||||
options_for_suppliers_to_select,
|
||||
style: "font-size: 0.9em;margin-left:1em;",
|
||||
'data-redirect-to' => true
|
||||
.well
|
||||
%h2 Laufende Bestellungen
|
||||
- unless @open_orders.empty?
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th Lieferantin
|
||||
%th Ende
|
||||
%th Notiz
|
||||
%th{colspan: "2"}
|
||||
%tbody
|
||||
- for order in @open_orders
|
||||
- tr_class = " active" if order.expired?
|
||||
%tr{class: tr_class}
|
||||
%td= order.name
|
||||
%td= format_time(order.ends) unless order.ends.nil?
|
||||
%td= truncate(order.note)
|
||||
%td= link_to "Beenden", finish_order_path(order),
|
||||
confirm: "Willst Du wirklich die Bestellung \"#{order.name}\" beenden?\nEs gibt kein zurück.",
|
||||
method: :post, class: 'btn btn-small btn-success'
|
||||
|
||||
%td
|
||||
= link_to "Anzeigen", order, class: 'btn btn-small'
|
||||
= link_to "Bearbeiten", edit_order_path(order), class: 'btn btn-small'
|
||||
= link_to "Löschen", order, confirm: "Willst Du wirklich die Bestellung löschen?", method: :delete,
|
||||
class: 'btn btn-small btn-danger'
|
||||
- else
|
||||
Derzeit gibt es keine laufende Bestellungen.
|
||||
|
||||
%h2 Beendete Bestellungen
|
||||
#orders_table
|
||||
= render partial: 'orders'
|
||||
1
app/views/orders/index.js.haml
Normal file
1
app/views/orders/index.js.haml
Normal file
|
|
@ -0,0 +1 @@
|
|||
$('#orders_table').html('#{escape_javascript(render('orders'))}');
|
||||
|
|
@ -1,80 +1,61 @@
|
|||
- title "Bestellung: #{@order.name}"
|
||||
|
||||
- if @order.finished? and !@order.closed?
|
||||
.alert.alert-warning Achtung, Bestellung wurde noch nicht abgerechnet.
|
||||
|
||||
// Order summary
|
||||
.left_column{:style => "width:65em"}
|
||||
.box_title
|
||||
%h2 Zusammenfassung
|
||||
.column_content
|
||||
- if @order.finished? and !@order.closed?
|
||||
%p
|
||||
%b{:style => "color:red"} Bestellung wurde noch nicht abgerechnet.
|
||||
%p
|
||||
Lieferantin:
|
||||
%b=h @order.name
|
||||
- unless @order.note.empty?
|
||||
%p
|
||||
Notiz:
|
||||
=h @order.note
|
||||
%p
|
||||
Beginn:
|
||||
%b=h format_time(@order.starts)
|
||||
|
|
||||
Ende:
|
||||
%b=h format_time(@order.ends)
|
||||
%p
|
||||
Gruppenbestellungen:
|
||||
%b= @order.group_orders.count
|
||||
.well
|
||||
%dl.dl-horizontal
|
||||
%dt Lieferantin
|
||||
%dd= @order.name
|
||||
%dt Notiz
|
||||
%dd= @order.note
|
||||
%dt Beginn
|
||||
%dd= format_time(@order.starts)
|
||||
%dt Ende
|
||||
%dd= format_time(@order.ends)
|
||||
%dt Gruppenbestellungen:
|
||||
%dd
|
||||
= @order.group_orders.count
|
||||
= "[#{@order.group_orders.includes(:ordergroup).all.collect{|g| g.ordergroup.name}.join(', ')}]"
|
||||
|
||||
%p
|
||||
Netto/Bruttosumme aller Artikel:
|
||||
%b= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
|
||||
%p
|
||||
Bestellte Artikel:
|
||||
%b= @order.order_articles.ordered.count
|
||||
%dt Netto/Bruttosumme aller Artikel:
|
||||
%dd= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
|
||||
%dt Bestellte Artikel:
|
||||
%dd= @order.order_articles.ordered.count
|
||||
|
||||
|
||||
%p
|
||||
Aktionen:
|
||||
.form-actions
|
||||
- if @order.open?
|
||||
= link_to "Bearbeiten", edit_order_path(@order)
|
||||
|
|
||||
= link_to 'Beenden!', finish_order_path(@order), :method => :post, :confirm => "Willst Du wirklich die Bestellung beenden?\nEs gibt kein zurück.."
|
||||
|
|
||||
= link_to "Bearbeiten", edit_order_path(@order), class: 'btn'
|
||||
= link_to 'Beenden!', finish_order_path(@order), method: :post,
|
||||
confirm: "Willst Du wirklich die Bestellung beenden?\nEs gibt kein zurück..", class: 'btn'
|
||||
- unless @order.closed?
|
||||
= link_to "Löschen", @order, :confirm => "Willst du wirklich die Bestellung löschen?", :method => :delete
|
||||
|
||||
|
||||
- unless @order.open?
|
||||
%p
|
||||
= update_articles_link(@order, "Artikelübersicht", :normal)
|
||||
|
|
||||
= update_articles_link(@order, "Sortiert nach Gruppen", :groups)
|
||||
= order_pdf(@order, :groups)
|
||||
|
|
||||
= update_articles_link(@order, "Sortiert nach Artikeln", :articles)
|
||||
= order_pdf(@order, :articles)
|
||||
|
|
||||
Matrix:
|
||||
= order_pdf(@order, :matrix)
|
||||
|
|
||||
Faxvorlage:
|
||||
= order_pdf(@order, :fax)
|
||||
= link_to image_tag("text_file.png", :size => "16x16", :border => "0", :alt => "Textdatei erstellen"), { :action => 'text_fax_template', :id => @order }, { :title => "Download file" }
|
||||
|
|
||||
= link_to 'Kommentare', '#comments'
|
||||
|
||||
.single_column{:style => "clear:both; width:70em;"}
|
||||
.box_title
|
||||
%h2 Artikel
|
||||
.column_content#articles
|
||||
= render :partial => 'articles', :locals => { :order => @order }
|
||||
= link_to "Löschen", @order, confirm: "Willst du wirklich die Bestellung löschen?", method: :delete,
|
||||
class: 'btn btn-danger'
|
||||
|
||||
.single_column{:style => "width:70em;"}
|
||||
.box_title
|
||||
%h2 Kommentare
|
||||
.column_content
|
||||
#comments
|
||||
= render :partial => 'shared/comments', :locals => { :comments => @order.comments }
|
||||
#new_comment= render :partial => 'order_comments/form', :locals => { :order_comment => @order.comments.build(:user => current_user)}
|
||||
= link_to_top
|
||||
- unless @order.open?
|
||||
%ul.nav.nav-pills
|
||||
%li.active= update_articles_link(@order, "Artikelübersicht", :default)
|
||||
%li= update_articles_link(@order, "Sortiert nach Gruppen", :groups)
|
||||
%li= update_articles_link(@order, "Sortiert nach Artikeln", :articles)
|
||||
%li= link_to 'Kommentare', '#comments'
|
||||
%li.dropdown
|
||||
= link_to '#', class: 'dropdown-toggle', data: {toggle: 'dropdown'} do
|
||||
Download
|
||||
%b.caret
|
||||
%ul.dropdown-menu
|
||||
%li= order_pdf(@order, :groups, "Gruppenpdf")
|
||||
%li= order_pdf(@order, :articles, "Artikelpdf")
|
||||
%li= order_pdf(@order, :matrix, "Matrix")
|
||||
%li= order_pdf(@order, :fax, "Fax PDF")
|
||||
%li= link_to "Fax Text", {action: 'text_fax_template', id: @order }, {title: "Download file"}
|
||||
|
||||
%section#articles_table
|
||||
= render 'articles', order: @order
|
||||
|
||||
%h2 Kommentare
|
||||
#comments
|
||||
= render partial: 'shared/comments', locals: { comments: @order.comments }
|
||||
#new_comment= render partial: 'order_comments/form', locals: { order_comment: @order.comments.build(user: current_user)}
|
||||
= link_to_top
|
||||
|
|
@ -1 +0,0 @@
|
|||
$('#articles').html('<%= escape_javascript(render(:partial => @partial, :locals => {:order => @order})) %>');
|
||||
2
app/views/orders/show.js.haml
Normal file
2
app/views/orders/show.js.haml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$('#articles_table').html('#{escape_javascript(render(@partial, order: @order))}');
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue