2012-11-10 16:44:05 +01:00
|
|
|
- unless @orders.empty?
|
|
|
|
- if Order.finished.count > 20
|
|
|
|
= items_per_page
|
|
|
|
= pagination_links_remote @orders
|
|
|
|
%table.table.table-striped
|
|
|
|
%thead
|
|
|
|
%tr
|
2013-02-10 09:05:20 +01:00
|
|
|
%th= t('.name')
|
|
|
|
%th= t('.end')
|
|
|
|
%th= t('.state')
|
2014-02-24 14:33:05 +01:00
|
|
|
%th= heading_helper Order, :updated_by
|
2023-07-24 10:50:35 +02:00
|
|
|
%th= heading_helper GroupOrderInvoice, :name
|
|
|
|
%th
|
2012-11-10 16:44:05 +01:00
|
|
|
%th
|
|
|
|
%tbody
|
|
|
|
- @orders.each do |order|
|
2023-11-03 16:37:43 +01:00
|
|
|
%tr{:class => cycle("even","odd", :name => "order"), 'data-order_id' => order.id}
|
2012-11-10 16:44:05 +01:00
|
|
|
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
|
|
|
|
%td=h format_time(order.ends) unless order.ends.nil?
|
2013-06-12 22:37:02 +02:00
|
|
|
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
|
2013-09-20 22:40:13 +02:00
|
|
|
%td= show_user(order.updated_by)
|
2023-11-03 16:37:43 +01:00
|
|
|
%td{id: "group-order-invoices-for-order-#{order.id}", class: 'expand-trigger'}
|
2023-07-24 10:50:35 +02:00
|
|
|
- if order.closed?
|
|
|
|
-if FoodsoftConfig[:contact][:tax_number] && order.ordergroups.present?
|
2023-11-03 16:37:43 +01:00
|
|
|
= link_to I18n.t('activerecord.attributes.group_order_invoice.open_details_modal'), "#", remote: true, class: 'btn btn-small'
|
2023-07-24 10:50:35 +02:00
|
|
|
-else
|
|
|
|
= I18n.t('activerecord.attributes.group_order_invoice.tax_number_not_set')
|
|
|
|
- else
|
|
|
|
= t('orders.index.not_closed')
|
2012-11-10 16:44:05 +01:00
|
|
|
%td
|
|
|
|
- unless order.closed?
|
2013-12-18 22:19:36 +01:00
|
|
|
- if current_user.role_orders?
|
2013-12-21 17:36:25 +01:00
|
|
|
- unless order.stockit?
|
2014-03-21 10:51:22 +01:00
|
|
|
= link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-small'
|
2013-12-21 17:36:25 +01:00
|
|
|
- else
|
2014-03-21 10:51:22 +01:00
|
|
|
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-small disabled'
|
|
|
|
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-small btn-primary'
|
2023-11-03 16:37:43 +01:00
|
|
|
%tr{:class => 'expanded-row', :id => "expanded-row-#{order.id}", :style => 'display: none;'}
|
|
|
|
%td{:colspan => '6'}
|
|
|
|
= render partial: 'group_order_invoices/modal', locals: { order: order }
|
2012-11-10 16:44:05 +01:00
|
|
|
- else
|
2013-06-12 22:37:02 +02:00
|
|
|
%i= t('.no_closed_orders')
|
2023-11-03 16:37:43 +01:00
|
|
|
|
|
|
|
- content_for :javascript do
|
|
|
|
:javascript
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.expand-trigger').click(function() {
|
|
|
|
var orderId = $(this).closest('tr').data('order_id');
|
|
|
|
var expandedRow = $('#expanded-row-' + orderId);
|
|
|
|
|
|
|
|
// Toggle visibility of the expanded row
|
|
|
|
expandedRow.slideToggle();
|
|
|
|
|
|
|
|
return false; // Prevent the default behavior of the link
|
|
|
|
});
|
|
|
|
});
|