Merge pull request #387 from foodcoops/feature/boxfills
Add optional boxfill phase to orders (+ bootstrap buttons)
This commit is contained in:
commit
227ca0dd84
16 changed files with 271 additions and 76 deletions
|
|
@ -11,8 +11,18 @@
|
|||
%span.add-on= t 'number.currency.format.unit'
|
||||
= config_input_field form, :minimum_balance, as: :decimal, class: 'input-small'
|
||||
|
||||
%h4= t '.schedule_title'
|
||||
= form.simple_fields_for :order_schedule do |fields|
|
||||
#boxfill-schedule.collapse{class: ('in' if FoodsoftConfig[:use_boxfill])}
|
||||
= fields.simple_fields_for 'boxfill' do |fields|
|
||||
.fold-line
|
||||
= config_input fields, 'recurr', as: :select_recurring, input_html: {class: 'input-xlarge'}
|
||||
= config_input fields, 'time', input_html: {class: 'input-mini'}
|
||||
= fields.simple_fields_for 'ends' do |fields|
|
||||
.fold-line
|
||||
= config_input fields, 'recurr', as: :select_recurring, input_html: {class: 'input-xlarge'}, allow_blank: true
|
||||
= config_input fields, 'time', input_html: {class: 'input-mini'}
|
||||
-# can't use collapse and tooltip on same element :/
|
||||
= config_input form, :use_boxfill, as: :boolean do
|
||||
= config_tooltip form, :use_boxfill do
|
||||
= config_input_field form, :use_boxfill, as: :boolean, title: '', data: {toggle: 'collapse', target: '#boxfill-schedule'}
|
||||
|
|
|
|||
|
|
@ -102,21 +102,27 @@
|
|||
%span{id: "missing_units_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:missing_units]
|
||||
|
||||
%td.quantity
|
||||
%input{id: "q_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][quantity]", size: "2", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:quantity]}/
|
||||
%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?)}/
|
||||
%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]
|
||||
%input{type: 'button', value: '+', 'data-increase_quantity' => order_article.id}
|
||||
%input{type: 'button', value: '-', 'data-decrease_quantity' => order_article.id}
|
||||
.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
|
||||
|
||||
%td.tolerance{style: ('display:none' if @order.stockit?)}
|
||||
%input{id: "t_#{order_article.id}", name: "group_order[group_order_articles_attributes][#{order_article.id}][tolerance]", size: "2", type: "hidden", value: @ordering_data[:order_articles][order_article.id][:tolerance]}/
|
||||
%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?)}/
|
||||
- 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]
|
||||
%input{type: 'button', value: '+', 'data-increase_tolerance' => order_article.id}
|
||||
%input{type: 'button', value: '-', 'data-decrease_tolerance' => order_article.id}
|
||||
.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
|
||||
|
||||
%td{id: "td_price_#{order_article.id}", style: "text-align:right; padding-right:10px; width:4em"}
|
||||
%span{id: "price_#{order_article.id}_display"}= number_to_currency(@ordering_data[:order_articles][order_article.id][:total_price])
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
= f.hidden_field :supplier_id
|
||||
.fold-line
|
||||
= f.input :starts, as: :date_picker_time
|
||||
= f.input :boxfill, as: :date_picker_time if @order.is_boxfill_useful?
|
||||
= f.input :ends, as: :date_picker_time
|
||||
= f.input :note, input_html: {rows: 2, class: 'input-xxlarge'}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue