2012-10-15 21:19:17 +02:00
|
|
|
- content_for :javascript do
|
2017-10-10 18:20:54 +02:00
|
|
|
- group_balance = FoodsoftConfig[:charge_members_manually] ? @ordering_data[:account_balance] : @ordering_data[:available_funds]
|
2011-06-19 19:56:04 +02:00
|
|
|
:javascript
|
|
|
|
$(function() {
|
|
|
|
#{data_to_js(@ordering_data)}
|
2017-10-10 18:20:54 +02:00
|
|
|
setGroupBalance(#{group_balance});
|
2013-07-10 22:02:36 +02:00
|
|
|
setMinimumBalance(#{FoodsoftConfig[:minimum_balance] or 0});
|
2012-08-24 19:52:38 +02:00
|
|
|
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
|
2011-06-19 19:56:04 +02:00
|
|
|
setStockit(#{@order.stockit?});
|
2013-09-18 23:15:21 +02:00
|
|
|
// create List for search-feature (using list.js, http://listjs.com)
|
2013-10-04 18:28:45 +02:00
|
|
|
var listjsResetPlugin = ['reset', {highlightClass: 'btn-primary'}];
|
|
|
|
var listjsDelayPlugin = ['delay', {delayedSearchTime: 500}];
|
2013-11-05 10:54:35 +01:00
|
|
|
new List(document.body, {
|
|
|
|
valueNames: ['name'],
|
|
|
|
engine: 'unlist',
|
|
|
|
plugins: [listjsResetPlugin, listjsDelayPlugin],
|
|
|
|
// make large pages work too (as we don't have paging - articles may disappear!)
|
|
|
|
page: 10000,
|
|
|
|
indexAsync: true
|
|
|
|
});
|
2011-06-19 19:56:04 +02:00
|
|
|
});
|
2011-06-19 15:30:33 +02:00
|
|
|
|
2013-02-09 02:01:31 +01:00
|
|
|
- title t('.title'), false
|
2011-06-19 15:30:33 +02:00
|
|
|
|
2012-12-22 14:42:19 +01:00
|
|
|
.row-fluid
|
|
|
|
.well.pull-left
|
2015-04-10 18:58:51 +02:00
|
|
|
= close_button :alert
|
2012-12-22 14:42:19 +01:00
|
|
|
%h2= @order.name
|
|
|
|
%dl.dl-horizontal
|
|
|
|
- unless @order.note.blank?
|
2013-11-23 17:28:21 +01:00
|
|
|
%dt= heading_helper Order, :note
|
2012-12-22 14:42:19 +01:00
|
|
|
%dd= @order.note
|
2013-11-23 17:28:21 +01:00
|
|
|
%dt= heading_helper Order, :created_by
|
2013-09-20 22:40:13 +02:00
|
|
|
%dd= show_user_link(@order.created_by)
|
2013-11-23 17:28:21 +01:00
|
|
|
%dt= heading_helper Order, :ends
|
2012-12-22 14:42:19 +01:00
|
|
|
%dd= format_time(@order.ends)
|
2016-04-29 15:28:05 +02:00
|
|
|
%dt= heading_helper Order, :pickup
|
|
|
|
%dd= format_date(@order.pickup)
|
2012-12-22 14:42:19 +01:00
|
|
|
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
|
2013-11-23 17:28:21 +01:00
|
|
|
%dt= heading_helper Supplier, :min_order_quantity, short: true
|
2012-12-22 14:42:19 +01:00
|
|
|
%dd= @order.supplier.min_order_quantity
|
2013-02-09 02:01:31 +01:00
|
|
|
%dt= t '.sum_amount'
|
2012-12-22 14:42:19 +01:00
|
|
|
%dd= number_to_currency @order.sum
|
2013-11-24 02:16:15 +01:00
|
|
|
- unless @group_order.new_record?
|
|
|
|
%dt= heading_helper GroupOrder, :updated_by
|
|
|
|
%dd
|
|
|
|
= show_user(@group_order.updated_by)
|
|
|
|
(#{format_time(@group_order.updated_on)})
|
2017-10-10 18:20:54 +02:00
|
|
|
%dt= heading_helper Ordergroup, :account_balance
|
|
|
|
%dd= number_to_currency(@ordering_data[:account_balance])
|
|
|
|
- unless FoodsoftConfig[:charge_members_manually]
|
|
|
|
%dt= heading_helper Ordergroup, :available_funds
|
|
|
|
%dd= number_to_currency(@ordering_data[:available_funds])
|
2011-06-19 19:56:04 +02:00
|
|
|
|
2012-12-22 14:42:19 +01:00
|
|
|
.well.pull-right
|
2015-04-10 18:58:51 +02:00
|
|
|
= close_button :alert
|
2012-12-22 14:42:19 +01:00
|
|
|
= render 'switch_order', current_order: @order
|
2011-06-19 19:56:04 +02:00
|
|
|
|
2013-09-18 23:15:21 +02:00
|
|
|
.row-fluid
|
|
|
|
.well.clear
|
2013-09-23 21:31:54 +02:00
|
|
|
.form-search
|
|
|
|
.input-append
|
2013-10-04 18:28:45 +02:00
|
|
|
= text_field_tag :article, params[:article], placeholder: t('.search_article'), class: 'search-query delayed-search resettable'
|
2013-09-23 21:31:54 +02:00
|
|
|
%button.add-on.btn.reset-search{:type => :button, :title => t('.reset_article_search')}
|
|
|
|
%i.icon.icon-remove
|
2013-09-18 23:15:21 +02:00
|
|
|
|
2011-06-19 19:56:04 +02:00
|
|
|
= form_for @group_order do |f|
|
2011-06-19 15:30:33 +02:00
|
|
|
= f.hidden_field :lock_version
|
|
|
|
= f.hidden_field :order_id
|
|
|
|
= f.hidden_field :updated_by_user_id
|
|
|
|
= f.hidden_field :ordergroup_id
|
2012-10-15 21:19:17 +02:00
|
|
|
%table.table.table-hover
|
|
|
|
%thead
|
|
|
|
%tr
|
2013-11-23 17:28:21 +01:00
|
|
|
%th= heading_helper Article, :name
|
2013-03-12 19:08:18 +01:00
|
|
|
- if @order.stockit?
|
2013-11-23 17:28:21 +01:00
|
|
|
%th{style: 'width:120px'}= heading_helper StockArticle, :supplier
|
2012-10-15 21:19:17 +02:00
|
|
|
%th{style: "width:13px;"}
|
2013-02-09 02:01:31 +01:00
|
|
|
%th{style: "width:4.5em;"}= t '.price'
|
2013-11-23 17:28:21 +01:00
|
|
|
%th{style: "width:4.5em;"}= heading_helper Article, :unit
|
2012-10-15 21:19:17 +02:00
|
|
|
- unless @order.stockit?
|
2013-11-23 17:28:21 +01:00
|
|
|
%th{style: "width:70px;"}= heading_helper OrderArticle, :missing_units, short: true
|
|
|
|
%th#col_required= heading_helper GroupOrderArticle, :quantity
|
|
|
|
%th#col_tolerance= heading_helper GroupOrderArticle, :tolerance
|
2012-10-15 21:19:17 +02:00
|
|
|
- else
|
2013-11-23 17:28:21 +01:00
|
|
|
%th(style="width:20px")= heading_helper StockArticle, :available
|
|
|
|
%th#col_required= heading_helper GroupOrderArticle, :quantity
|
|
|
|
%th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price
|
2013-09-18 23:15:21 +02:00
|
|
|
%tbody.list
|
2012-10-15 21:19:17 +02:00
|
|
|
- @order.articles_grouped_by_category.each do |category, order_articles|
|
2013-09-24 21:21:08 +02:00
|
|
|
%tr.list-heading.article-category
|
2012-10-15 21:19:17 +02:00
|
|
|
%td
|
|
|
|
= category
|
|
|
|
%i.icon-tag
|
|
|
|
%td{colspan: "9"}
|
|
|
|
- order_articles.each do |order_article|
|
2015-05-03 20:05:39 +02:00
|
|
|
%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"}
|
2012-10-15 21:19:17 +02:00
|
|
|
%td.name= order_article.article.name
|
2013-03-12 19:08:18 +01:00
|
|
|
- if @order.stockit?
|
|
|
|
%td= truncate order_article.article.supplier.name, length: 15
|
2012-10-15 21:19:17 +02:00
|
|
|
%td= h order_article.article.origin
|
|
|
|
%td= number_to_currency(@ordering_data[:order_articles][order_article.id][:price])
|
|
|
|
%td= order_article.article.unit
|
|
|
|
%td
|
|
|
|
- if @order.stockit?
|
|
|
|
= @ordering_data[:order_articles][order_article.id][:quantity_available]
|
|
|
|
- else
|
|
|
|
%span{id: "missing_units_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:missing_units]
|
2011-06-19 19:56:04 +02:00
|
|
|
|
2012-10-15 21:19:17 +02:00
|
|
|
%td.quantity
|
2015-10-13 23:17:31 +02:00
|
|
|
%input{id: "q_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][quantity]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:quantity], 'data-min' => (@ordering_data[:order_articles][order_article.id][:quantity] if @order.boxfill?), 'data-max' => (@ordering_data[:order_articles][order_article.id][:quantity]+@ordering_data[:order_articles][order_article.id][:missing_units] if @order.boxfill?)}/
|
2012-10-15 21:19:17 +02:00
|
|
|
%span.used{id: "q_used_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:used_quantity]
|
|
|
|
+
|
|
|
|
%span.unused{id: "q_unused_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] - @ordering_data[:order_articles][order_article.id][:used_quantity]
|
2015-10-13 22:06:10 +02:00
|
|
|
.btn-group
|
|
|
|
%a.btn.btn-ordering{'data-increase_quantity' => order_article.id}
|
|
|
|
%i.icon-plus
|
|
|
|
%a.btn.btn-ordering{'data-decrease_quantity' => order_article.id}
|
|
|
|
%i.icon-minus
|
2011-06-19 19:56:04 +02:00
|
|
|
|
2012-10-15 21:19:17 +02:00
|
|
|
%td.tolerance{style: ('display:none' if @order.stockit?)}
|
2015-10-13 23:17:31 +02:00
|
|
|
%input{id: "t_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][tolerance]", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:tolerance], 'data-min' => (@ordering_data[:order_articles][order_article.id][:tolerance] if @order.boxfill?)}/
|
2012-10-15 21:19:17 +02:00
|
|
|
- if (@ordering_data[:order_articles][order_article.id][:unit] > 1)
|
|
|
|
%span.used{id: "t_used_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:used_tolerance]
|
|
|
|
+
|
|
|
|
%span.unused{id: "t_unused_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] - @ordering_data[:order_articles][order_article.id][:used_tolerance]
|
2015-10-13 22:06:10 +02:00
|
|
|
.btn-group
|
|
|
|
%a.btn.btn-ordering{'data-increase_tolerance' => order_article.id}
|
|
|
|
%i.icon-plus
|
|
|
|
%a.btn.btn-ordering{'data-decrease_tolerance' => order_article.id}
|
|
|
|
%i.icon-minus
|
2011-06-19 19:56:04 +02:00
|
|
|
|
2012-10-15 21:19:17 +02:00
|
|
|
%td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"}
|
2013-06-26 01:17:04 +02:00
|
|
|
%span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price])
|
2012-10-15 21:19:17 +02:00
|
|
|
.article-info
|
|
|
|
.article-name= order_article.article.name
|
|
|
|
.pull-right
|
2013-02-09 02:01:31 +01:00
|
|
|
= t('.units_full') + ':'
|
2012-10-15 21:19:17 +02:00
|
|
|
%span{id: "units_#{order_article.id}"}= order_article.units_to_order
|
|
|
|
%br/
|
2013-02-09 02:01:31 +01:00
|
|
|
= t('.units_total') + ':'
|
2012-10-15 21:19:17 +02:00
|
|
|
%span{id: "q_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] + @ordering_data[:order_articles][order_article.id][:others_quantity]
|
|
|
|
%br/
|
2013-02-09 02:01:31 +01:00
|
|
|
= t('.total_tolerance') + ':'
|
2012-10-15 21:19:17 +02:00
|
|
|
%span{id: "t_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] + @ordering_data[:order_articles][order_article.id][:others_tolerance]
|
|
|
|
%br/
|
|
|
|
.pull-left
|
2013-11-23 17:28:21 +01:00
|
|
|
#{heading_helper Article, :manufacturer}: #{order_article.article.manufacturer}
|
2012-10-15 21:19:17 +02:00
|
|
|
%br/
|
2013-11-24 01:47:34 +01:00
|
|
|
#{heading_helper Article, :units}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit}
|
2012-10-15 21:19:17 +02:00
|
|
|
%br/
|
2013-11-23 17:28:21 +01:00
|
|
|
#{heading_helper Article, :note}: #{order_article.article.note}
|
2012-10-15 21:19:17 +02:00
|
|
|
%br/
|
2011-06-19 19:56:04 +02:00
|
|
|
#order-footer
|
|
|
|
#info-box
|
|
|
|
#total-sum
|
|
|
|
%table
|
|
|
|
%tr
|
2013-02-09 02:01:31 +01:00
|
|
|
%td= t('.total_sum_amount') + ':'
|
2011-06-19 19:56:04 +02:00
|
|
|
%td.currency
|
2013-06-26 01:17:04 +02:00
|
|
|
%span#total_price= number_to_currency(@group_order.price)
|
2011-06-19 19:56:04 +02:00
|
|
|
%tr
|
2017-10-10 18:20:54 +02:00
|
|
|
- if FoodsoftConfig[:charge_members_manually]
|
|
|
|
- old_balance = @ordering_data[:account_balance]
|
|
|
|
%td= heading_helper(Ordergroup, :account_balance) + ':'
|
|
|
|
%td.currency= number_to_currency(@ordering_data[:account_balance])
|
|
|
|
- else
|
|
|
|
- old_balance = @ordering_data[:available_funds]
|
|
|
|
%td= heading_helper(Ordergroup, :available_funds) + ':'
|
|
|
|
%td.currency= number_to_currency(@ordering_data[:available_funds])
|
2011-06-19 19:56:04 +02:00
|
|
|
%tr
|
2013-02-09 02:01:31 +01:00
|
|
|
%td= t('.new_funds') + ':'
|
2011-06-19 19:56:04 +02:00
|
|
|
%td.currency
|
|
|
|
%strong
|
2017-10-10 18:20:54 +02:00
|
|
|
%span#new_balance= number_to_currency(old_balance - @group_order.price)
|
2011-06-19 19:56:04 +02:00
|
|
|
#order-button
|
2013-02-09 02:01:31 +01:00
|
|
|
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
2013-04-04 02:49:52 +02:00
|
|
|
#{link_to t('ui.or_cancel'), group_orders_path}
|
2012-10-15 21:19:17 +02:00
|
|
|
%input#total_balance{name: "total_balance", type: "hidden", value: @ordergroup.account_balance - @group_order.price}/
|
2013-02-09 02:01:31 +01:00
|
|
|
%input{name: "version", type: "hidden", value: @version}/
|