allow to edit GroupOrderArticle result from orders screen
Conflicts: app/assets/javascripts/application.js
This commit is contained in:
parent
f9d2c20aaa
commit
60826ceedc
34 changed files with 393 additions and 220 deletions
|
|
@ -4,38 +4,31 @@
|
|||
%tr
|
||||
%td
|
||||
%td{:style => "width:8em"}= Ordergroup.model_name.human
|
||||
%td= t('.units')
|
||||
-#%td.center= t('.units')
|
||||
%td.center
|
||||
%acronym{:title => t('shared.articles.received_desc')}= t 'shared.articles.received'
|
||||
%td= t('.total')
|
||||
%td{:colspan => "3",:style => "width:14em"}
|
||||
= link_to t('.add_group'), new_finance_group_order_article_path(order_article_id: order_article.id),
|
||||
= link_to t('.add_group'), new_group_order_article_path(order_article_id: order_article.id),
|
||||
remote: true, class: 'btn btn-mini'
|
||||
%tbody
|
||||
- totals = {result: 0}
|
||||
- for group_order_article in order_article.group_order_articles.select { |goa| goa.result > 0 }
|
||||
%tr[group_order_article]
|
||||
%td
|
||||
%td{:style=>"width:50%"}
|
||||
= group_order_article.group_order.ordergroup.name
|
||||
%td{:id => "group_order_article_#{group_order_article.id}_quantity", :style => "white-space:nowrap"}
|
||||
= group_order_article.result
|
||||
= link_to "+", update_result_finance_group_order_article_path(group_order_article, modifier: '+'),
|
||||
method: :put, remote: true, class: 'btn btn-mini'
|
||||
= link_to "-", update_result_finance_group_order_article_path(group_order_article, modifier: '-'),
|
||||
method: :put, remote: true, class: 'btn btn-mini'
|
||||
%td.numeric
|
||||
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result)
|
||||
%td.center= group_order_article_edit_result(group_order_article)
|
||||
%td.numeric= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result)
|
||||
%td.actions{:style=>"width:1em"}
|
||||
= link_to t('ui.edit'), edit_finance_group_order_article_path(group_order_article), remote: true,
|
||||
class: 'btn btn-mini'
|
||||
%td.actions{:style=>"width:1em"}
|
||||
= link_to t('ui.delete'), finance_group_order_article_path(group_order_article), method: :delete,
|
||||
= link_to t('ui.delete'), group_order_article_path(group_order_article), method: :delete,
|
||||
remote: true, class: 'btn btn-mini btn-danger'
|
||||
%td
|
||||
- totals[:result] += group_order_article.result
|
||||
%tfoot
|
||||
%tr
|
||||
%td
|
||||
%td{:style => "width:8em"}= t('.total_fc')
|
||||
%td{:id => "group_orders_sum_quantity_#{order_article.id}"}
|
||||
= order_article.group_orders_sum[:quantity]
|
||||
%td.numeric{:id => "group_orders_sum_price_#{order_article.id}"}
|
||||
= number_to_currency(order_article.group_orders_sum[:price])
|
||||
%td.center= totals[:result]
|
||||
%td.numeric= number_to_currency(order_article.group_orders_sum[:price])
|
||||
%td{:colspan => "3"}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
$(function() {
|
||||
// Subscribe to database changes.
|
||||
// See publish/subscribe design pattern in /doc.
|
||||
$(document).on('OrderArticle#update', function(e) {
|
||||
$(document).on('OrderArticle#update GroupOrderArticle#create GroupOrderArticle#update', function(e) {
|
||||
$.ajax({
|
||||
url: '#{new_on_order_article_update_finance_order_path(@order)}',
|
||||
type: 'get',
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
});
|
||||
});
|
||||
});
|
||||
= render 'shared/articles_by/common', order: @order
|
||||
|
||||
- title t('.title', name: @order.name)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
= simple_form_for [:finance, @group_order_article], remote: true do |form|
|
||||
= form.hidden_field :order_article_id
|
||||
.modal-header
|
||||
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
|
||||
%h3= t('.amount_change_for', article: @order_article.article.name)
|
||||
.modal-body
|
||||
= form.input :ordergroup_id, as: :select, collection: Ordergroup.all.map { |g| [g.name, g.id] }
|
||||
= form.input :result, hint: I18n.t('finance.group_order_articles.form.result_hint', unit: @order_article.article.unit) # Why do we need the full prefix?
|
||||
.modal-footer
|
||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||
= form.submit t('ui.save'), class: 'btn btn-primary'
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
$('#modalContainer').html('#{j(render("form"))}');
|
||||
$('#modalContainer').modal();
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
$('#modalContainer').html('#{j(render("form"))}');
|
||||
$('#modalContainer').modal();
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
$('#modalContainer').modal('hide');
|
||||
$('#order_article_#{@order_article.id}').html('#{j(render('finance/balancing/order_article', order_article: @order_article))}');
|
||||
$('#group_order_articles_#{@order_article.id}').html('#{j(render('finance/balancing/group_order_articles', order_article: @order_article))}');
|
||||
$('#summaryChangedWarning').show();
|
||||
Loading…
Add table
Add a link
Reference in a new issue