enable actions for multi (group) orders and ordergroup invoices
This commit is contained in:
parent
f676497e43
commit
e902aa0d5a
44 changed files with 550 additions and 324 deletions
|
|
@ -1,6 +1,5 @@
|
|||
%tr{:class => cycle("even","odd", :name => "multi_order"), 'data-multi_order_id' => multi_order.id}
|
||||
%td
|
||||
= check_box_tag "multi_order_ids_for_multi_multi_order[]", multi_order.id, false, class: "multi_order-checkbox", id: "multi_order_#{multi_order.id}_combine", data: { multi_order_id: multi_order.id }
|
||||
%td
|
||||
= "*Multi*"
|
||||
-multi_order.orders.each do |order|
|
||||
|
|
@ -9,14 +8,19 @@
|
|||
%td=h format_time(multi_order.ends) unless multi_order.ends.nil?
|
||||
%td= multi_order.closed? ? t('finance.balancing.orders.cleared', amount: number_to_currency(multi_order.foodcoop_result)) : t('finance.balancing.orders.ended')
|
||||
%td= show_user(multi_order.updated_by)
|
||||
%td{id: "group-multi_order-invoices-for-multi-order-#{multi_order.id}", class: 'expand-trigger'}
|
||||
%td{id: "group-multi_order-invoices-for-multi-order-#{multi_order.id}"}
|
||||
- if multi_order.closed?
|
||||
-if FoodsoftConfig[:contact][:tax_number] && multi_order.group_orders.present?
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.open_details_modal'), "#", remote: true, class: 'btn btn-small'
|
||||
-if FoodsoftConfig[:contact][:tax_number] && multi_order.multi_group_orders.present?
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.open_details_modal'), "#", remote: true, class: 'btn btn-small expand-trigger'
|
||||
-else
|
||||
= I18n.t('activerecord.attributes.group_order_invoice.tax_number_not_set')
|
||||
- else
|
||||
= t('orders.index.not_closed')
|
||||
%tr{:class => 'expanded-row', :id => "expanded-row-#{multi_order.id}", :style => 'display: none;'}
|
||||
%td{:colspan => '6'}
|
||||
%td
|
||||
= link_to multi_order, method: :delete, data: { confirm: I18n.t('ui.confirm_delete', name: "Multi Bestellung #{multi_order.name}" ) } do
|
||||
Multi Bestellung auflösen
|
||||
%i.icon-remove
|
||||
|
||||
%tr{:class => 'expanded-row hidden', :id => "expanded-multi-row-#{multi_order.id}"}
|
||||
%td{:colspan => '7'}
|
||||
= render partial: 'ordergroup_invoices/modal', locals: { multi_order: multi_order }
|
||||
|
|
@ -5,10 +5,10 @@
|
|||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
%td= order.closed? ? t('finance.balancing.orders.cleared', amount: number_to_currency(order.foodcoop_result)) : t('finance.balancing.orders.ended')
|
||||
%td= show_user(order.updated_by)
|
||||
%td{id: "group-order-invoices-for-order-#{order.id}", class: 'expand-trigger'}
|
||||
%td{id: "group-order-invoices-for-order-#{order.id}"}
|
||||
- if order.closed?
|
||||
-if FoodsoftConfig[:contact][:tax_number] && order.ordergroups.present?
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.open_details_modal'), "#", remote: true, class: 'btn btn-small'
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.open_details_modal'), "#", remote: true, class: 'btn btn-small expand-trigger'
|
||||
-else
|
||||
= I18n.t('activerecord.attributes.group_order_invoice.tax_number_not_set')
|
||||
- else
|
||||
|
|
@ -21,6 +21,6 @@
|
|||
- else
|
||||
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-small disabled'
|
||||
= link_to t('finance.balancing.orders.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-small btn-primary'
|
||||
%tr{:class => 'expanded-row', :id => "expanded-row-#{order.id}", :style => 'display: none;'}
|
||||
%tr{:class => 'expanded-row hidden', :id => "expanded-row-#{order.id}"}
|
||||
%td{:colspan => '7'}
|
||||
= render partial: 'group_order_invoices/modal', locals: { order: order }
|
||||
|
|
@ -1,27 +1,24 @@
|
|||
- unless @orders.empty? && @multi_orders.empty?
|
||||
- unless @results.empty?
|
||||
- if Order.finished.count > 20
|
||||
= items_per_page
|
||||
= pagination_links_remote @orders
|
||||
-# following posed a real problem, multiple submit buttons are within the same form, so only one of them will be submitted
|
||||
-# convert to javascript
|
||||
= form_with url: multi_orders_path, method: :post, local: true do |form|
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th=I18n.t('activerecord.attributes.group_order_invoice.links.combine')
|
||||
%th= t('.name')
|
||||
%th= t('.end')
|
||||
%th= t('.state')
|
||||
%th= heading_helper Order, :updated_by
|
||||
%th= heading_helper GroupOrderInvoice, :name
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @multi_orders.each do |multi_order|
|
||||
= render partial: 'multi_order_row', locals: { multi_order: multi_order }
|
||||
- @orders.each do |order|
|
||||
= render partial: 'order_row', locals: { order: order }
|
||||
= form.submit "Zusammenführen", class: 'btn btn-primary'
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th=I18n.t('activerecord.attributes.group_order_invoice.links.combine')
|
||||
%th= t('.name')
|
||||
%th= t('.end')
|
||||
%th= t('.state')
|
||||
%th= heading_helper Order, :updated_by
|
||||
%th= heading_helper GroupOrderInvoice, :name
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @results.each do |result|
|
||||
- if result.class == Order
|
||||
= render partial: 'order_row', locals: { order: result }
|
||||
- else
|
||||
= render partial: 'multi_order_row', locals: { multi_order: result }
|
||||
= button_tag 'Zusammenführen', class: 'btn btn-primary merge-orders-btn', type: 'button', data: { url: multi_orders_path }
|
||||
|
||||
- else
|
||||
%i= t('.no_closed_orders')
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@ $('#ordersTable').html('#{j(render('orders'))}');
|
|||
var orderId = $(this).closest('tr').data('order_id');
|
||||
var expandedRow = $('#expanded-row-' + orderId);
|
||||
// Toggle visibility of the expanded row
|
||||
expandedRow.slideToggle();
|
||||
expandedRow.toggleClass('hidden');
|
||||
|
||||
tableRow.toggleClass('border');
|
||||
expandedRow.toggleClass('bordered');
|
||||
|
||||
return false; // Prevent the default behavior of the link
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue