rework group order edit form
* make switch order a menu list * table more slim * alert when balance negative instead of making everything red * search to the right
This commit is contained in:
parent
fec94f9683
commit
657b3e63bc
7 changed files with 159 additions and 157 deletions
|
@ -179,17 +179,13 @@ function updateBalance() {
|
||||||
var balance = groupBalance - total;
|
var balance = groupBalance - total;
|
||||||
$('#new_balance').html(I18n.l("currency", balance));
|
$('#new_balance').html(I18n.l("currency", balance));
|
||||||
$('#total_balance').val(I18n.l("currency", balance));
|
$('#total_balance').val(I18n.l("currency", balance));
|
||||||
// determine bgcolor and submit button state according to balance
|
|
||||||
var bgcolor = '';
|
|
||||||
if (balance < minimumBalance) {
|
if (balance < minimumBalance) {
|
||||||
bgcolor = '#FF0000';
|
|
||||||
$('#submit_button').attr('disabled', 'disabled')
|
$('#submit_button').attr('disabled', 'disabled')
|
||||||
|
$('#balance-alert').css('display', 'block')
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#submit_button').removeAttr('disabled')
|
$('#submit_button').removeAttr('disabled')
|
||||||
}
|
$('#balance-alert').css('display', 'none')
|
||||||
// update bgcolor
|
|
||||||
for (i in itemTotal) {
|
|
||||||
$('#td_price_' + i).css('background-color', bgcolor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,49 +22,23 @@
|
||||||
|
|
||||||
- title t('.title'), false
|
- title t('.title'), false
|
||||||
|
|
||||||
|
.alert.alert-error#balance-alert{style: ('display:none')}
|
||||||
|
=t 'group_orders.errors.balance_alert'
|
||||||
.row-fluid
|
.row-fluid
|
||||||
.well.span9
|
|
||||||
%h2= @order.name
|
|
||||||
%a(href='#tab1' data-toggle="collapse")
|
|
||||||
Show Details
|
|
||||||
#tab1.collapse
|
|
||||||
%dl.dl-horizontal
|
|
||||||
- unless @order.note.blank?
|
|
||||||
%dt= heading_helper Order, :note
|
|
||||||
%dd= @order.note
|
|
||||||
%dt= heading_helper Order, :created_by
|
|
||||||
%dd= show_user_link(@order.created_by)
|
|
||||||
%dt= heading_helper Order, :ends
|
|
||||||
%dd= format_time(@order.ends)
|
|
||||||
%dt= heading_helper Order, :pickup
|
|
||||||
%dd= format_date(@order.pickup)
|
|
||||||
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
|
|
||||||
%dt= heading_helper Supplier, :min_order_quantity, short: true
|
|
||||||
%dd= @order.supplier.min_order_quantity
|
|
||||||
%dt= t '.sum_amount'
|
|
||||||
%dd= number_to_currency @order.sum
|
|
||||||
- unless @group_order.new_record?
|
|
||||||
%dt= heading_helper GroupOrder, :updated_by
|
|
||||||
%dd
|
|
||||||
= show_user(@group_order.updated_by)
|
|
||||||
(#{format_time(@group_order.updated_on)})
|
|
||||||
%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])
|
|
||||||
.well.span3
|
.well.span3
|
||||||
= render 'switch_order', current_order: @order
|
= render 'switch_order', current_order: @order
|
||||||
.row-fluid
|
.well.span8
|
||||||
.well.span12
|
%h2= @order.name
|
||||||
|
%a(href='#tab1' data-toggle="collapse")
|
||||||
|
=t '.details'
|
||||||
|
#tab1.collapse
|
||||||
|
= render 'order_details'
|
||||||
.form-search.pull-right
|
.form-search.pull-right
|
||||||
.input-append
|
.input-append
|
||||||
= text_field_tag :article, params[:article], placeholder: t('.search_article'), class: 'search-query delayed-search resettable'
|
= text_field_tag :article, params[:article], placeholder: t('.search_article'), class: 'search-query delayed-search resettable'
|
||||||
%button.add-on.btn.reset-search{:type => :button, :title => t('.reset_article_search')}
|
%button.add-on.btn.reset-search{:type => :button, :title => t('.reset_article_search')}
|
||||||
%i.icon.icon-remove
|
%i.icon.icon-remove
|
||||||
|
= form_for @group_order do |f|
|
||||||
|
|
||||||
= form_for @group_order do |f|
|
|
||||||
= f.hidden_field :lock_version
|
= f.hidden_field :lock_version
|
||||||
= f.hidden_field :order_id
|
= f.hidden_field :order_id
|
||||||
= f.hidden_field :updated_by_user_id
|
= f.hidden_field :updated_by_user_id
|
||||||
|
@ -87,7 +61,7 @@
|
||||||
%th#col_required= heading_helper GroupOrderArticle, :quantity
|
%th#col_required= heading_helper GroupOrderArticle, :quantity
|
||||||
%th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price
|
%th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price
|
||||||
%tbody.list
|
%tbody.list
|
||||||
- @order.articles_grouped_by_category.each do |category, order_articles|
|
- @order.articles_grouped_by_category.each do | category, order_articles|
|
||||||
%tr.list-heading.article-category
|
%tr.list-heading.article-category
|
||||||
%td
|
%td
|
||||||
= category
|
= category
|
||||||
|
@ -154,25 +128,7 @@
|
||||||
#order-footer
|
#order-footer
|
||||||
#info-box
|
#info-box
|
||||||
#total-sum
|
#total-sum
|
||||||
%table
|
= render 'total_sum'
|
||||||
%tr
|
|
||||||
%td= t('.total_sum_amount') + ':'
|
|
||||||
%td.currency
|
|
||||||
%span#total_price= number_to_currency(@group_order.price)
|
|
||||||
%tr
|
|
||||||
- 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])
|
|
||||||
%tr
|
|
||||||
%td= t('.new_funds') + ':'
|
|
||||||
%td.currency
|
|
||||||
%strong
|
|
||||||
%span#new_balance= number_to_currency(old_balance - @group_order.price)
|
|
||||||
#order-button
|
#order-button
|
||||||
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
||||||
#{link_to t('ui.or_cancel'), group_orders_path}
|
#{link_to t('ui.or_cancel'), group_orders_path}
|
||||||
|
|
28
app/views/group_orders/_order_details.haml
Normal file
28
app/views/group_orders/_order_details.haml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
%a(href='#tab1' data-toggle="collapse")
|
||||||
|
=t '.details'
|
||||||
|
#tab1.collapse
|
||||||
|
%dl.dl-horizontal
|
||||||
|
- unless @order.note.blank?
|
||||||
|
%dt= heading_helper Order, :note
|
||||||
|
%dd= @order.note
|
||||||
|
%dt= heading_helper Order, :created_by
|
||||||
|
%dd= show_user_link(@order.created_by)
|
||||||
|
%dt= heading_helper Order, :ends
|
||||||
|
%dd= format_time(@order.ends)
|
||||||
|
%dt= heading_helper Order, :pickup
|
||||||
|
%dd= format_date(@order.pickup)
|
||||||
|
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
|
||||||
|
%dt= heading_helper Supplier, :min_order_quantity, short: true
|
||||||
|
%dd= @order.supplier.min_order_quantity
|
||||||
|
%dt= t 'group_orders.form.sum_amount'
|
||||||
|
%dd= number_to_currency @order.sum
|
||||||
|
- unless @group_order.new_record?
|
||||||
|
%dt= heading_helper GroupOrder, :updated_by
|
||||||
|
%dd
|
||||||
|
= show_user(@group_order.updated_by)
|
||||||
|
(#{format_time(@group_order.updated_on)})
|
||||||
|
%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])
|
19
app/views/group_orders/_total_sum.haml
Normal file
19
app/views/group_orders/_total_sum.haml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
%table
|
||||||
|
%tr
|
||||||
|
%td= t('group_orders.form.total_sum_amount') + ':'
|
||||||
|
%td.currency
|
||||||
|
%span#total_price= number_to_currency(@group_order.price)
|
||||||
|
%tr
|
||||||
|
- 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])
|
||||||
|
%tr
|
||||||
|
%td= t('group_orders.form.new_funds') + ':'
|
||||||
|
%td.currency
|
||||||
|
%strong
|
||||||
|
%span#new_balance= number_to_currency(old_balance - @group_order.price)
|
|
@ -1045,6 +1045,7 @@ de:
|
||||||
error_stale: In der Zwischenzeit hat jemand anderes auch bestellt, daher konnte die Bestellung nicht aktualisiert werden.
|
error_stale: In der Zwischenzeit hat jemand anderes auch bestellt, daher konnte die Bestellung nicht aktualisiert werden.
|
||||||
notice: Die Bestellung wurde gespeichert.
|
notice: Die Bestellung wurde gespeichert.
|
||||||
errors:
|
errors:
|
||||||
|
balance_alert: Kontostand im Minus
|
||||||
closed: Diese Bestellung ist bereits abgeschlossen.
|
closed: Diese Bestellung ist bereits abgeschlossen.
|
||||||
no_member: Du bist kein Mitglieder einer Bestellgruppe.
|
no_member: Du bist kein Mitglieder einer Bestellgruppe.
|
||||||
notfound: Fehlerhafte URL, das ist nicht Deine Bestellung.
|
notfound: Fehlerhafte URL, das ist nicht Deine Bestellung.
|
||||||
|
|
|
@ -1047,6 +1047,7 @@ en:
|
||||||
error_stale: Someone else has ordered in the meantime, couldn't update the order.
|
error_stale: Someone else has ordered in the meantime, couldn't update the order.
|
||||||
notice: The order was saved.
|
notice: The order was saved.
|
||||||
errors:
|
errors:
|
||||||
|
balance_alert: Negative account balance
|
||||||
closed: This order is already closed.
|
closed: This order is already closed.
|
||||||
no_member: You are not a member of an ordergroup.
|
no_member: You are not a member of an ordergroup.
|
||||||
notfound: Incorrect URL, this is not your order.
|
notfound: Incorrect URL, this is not your order.
|
||||||
|
|
|
@ -1017,6 +1017,7 @@ nl:
|
||||||
error_stale: In de tussentijd heeft iemand anders ook bestelt, daarom kon de bestelling niet bijgewerkt worden.
|
error_stale: In de tussentijd heeft iemand anders ook bestelt, daarom kon de bestelling niet bijgewerkt worden.
|
||||||
notice: Bestelling opgeslagen.
|
notice: Bestelling opgeslagen.
|
||||||
errors:
|
errors:
|
||||||
|
balance_alert: Accountsaldo in het rood
|
||||||
closed: Deze bestelling is al gesloten.
|
closed: Deze bestelling is al gesloten.
|
||||||
no_member: Je bent geen lid van dit huishouden.
|
no_member: Je bent geen lid van dit huishouden.
|
||||||
notfound: Foute URL, dit is niet jouw bestelling.
|
notfound: Foute URL, dit is niet jouw bestelling.
|
||||||
|
|
Loading…
Reference in a new issue