changing view for group_order_invoices
testing ui of goi restructuring
This commit is contained in:
parent
de6643722a
commit
90c5450525
52 changed files with 783 additions and 57 deletions
|
|
@ -15,10 +15,16 @@
|
|||
= config_input form, :use_self_service, as: :boolean
|
||||
%h4= t '.group_order_invoices'
|
||||
= form.fields_for :group_order_invoices do |field|
|
||||
= config_input field, :ignore_minimum_balance, as: :boolean
|
||||
= config_input field, :use_automatic_invoices, as: :boolean
|
||||
= config_input field, :separate_deposits, as: :boolean
|
||||
= config_input field, :vat_exempt, as: :boolean
|
||||
= config_input field, :payment_method, as: :string, input_html: {class: 'input-medium'}
|
||||
= config_input field, :payment_method, collection: FinancialTransactionType.all.map { |t| [t.name, t.id] }, as: :select, include_blank: true
|
||||
%p
|
||||
%i Für SEPA-Lastschrift-Export:
|
||||
= config_input field, :iban
|
||||
= config_input field, :bic
|
||||
= config_input field, :creditor_identifier
|
||||
|
||||
%h4= t '.schedule_title'
|
||||
= form.simple_fields_for :order_schedule do |fields|
|
||||
|
|
|
|||
|
|
@ -6,12 +6,14 @@
|
|||
= f.input :contact_person
|
||||
= f.input :contact_phone
|
||||
= f.input :contact_address
|
||||
= render 'shared/sepa_account_holder', f: f
|
||||
= render 'shared/custom_form_fields', f: f, type: :ordergroup
|
||||
.fold-line
|
||||
= f.input :break_start, as: :date_picker, label: Ordergroup.human_attribute_name('break')
|
||||
= f.input :break_end, as: :date_picker, label: Ordergroup.human_attribute_name('break_until')
|
||||
- if FoodsoftConfig[:use_apple_points]
|
||||
= f.input :ignore_apple_restriction, :label => false, :inline_label => true
|
||||
|
||||
= render 'shared/group_form_fields', f: f, captured: captured
|
||||
.form-actions
|
||||
= f.button :submit
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@
|
|||
%th
|
||||
%tbody
|
||||
- @orders.each do |order|
|
||||
%tr{:class => cycle("even","odd", :name => "order")}
|
||||
%tr{:class => cycle("even","odd", :name => "order"), 'data-order_id' => order.id}
|
||||
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
|
||||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
|
||||
%td= show_user(order.updated_by)
|
||||
%td{id: "generate-invoice#{order.id}"}
|
||||
%td{id: "group-order-invoices-for-order-#{order.id}", class: 'expand-trigger'}
|
||||
- if order.closed?
|
||||
-if FoodsoftConfig[:contact][:tax_number] && order.ordergroups.present?
|
||||
= render :partial => 'group_order_invoices/links', locals:{order: order}
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.open_details_modal'), "#", remote: true, class: 'btn btn-small'
|
||||
-else
|
||||
= I18n.t('activerecord.attributes.group_order_invoice.tax_number_not_set')
|
||||
- else
|
||||
|
|
@ -35,5 +35,22 @@
|
|||
- else
|
||||
= 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'
|
||||
%tr{:class => 'expanded-row', :id => "expanded-row-#{order.id}", :style => 'display: none;'}
|
||||
%td{:colspan => '6'}
|
||||
= render partial: 'group_order_invoices/modal', locals: { order: order }
|
||||
- else
|
||||
%i= t('.no_closed_orders')
|
||||
|
||||
- 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
|
||||
});
|
||||
});
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
- if FinancialTransactionType.has_multiple_types
|
||||
%p
|
||||
%b= heading_helper FinancialTransaction, :financial_transaction_type
|
||||
= select_tag :type, options_for_select(FinancialTransactionType.order(:name).map { |t| [ t.name, t.id ] })
|
||||
= select_tag :type, options_for_select(FinancialTransactionType.order(:name).map { |t| [ t.name, t.id ] }, selected: FoodsoftConfig[:group_order_invoices]&.[](:payment_method))
|
||||
%table.table.table-striped{:style => "width:35em"}
|
||||
- for group_order in @order.group_orders
|
||||
%tr{:class => cycle('even', 'odd')}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
- if foodsoft_sepa_ready?
|
||||
= link_to 'Sammellastschrift für alle (.xml)', collective_direct_debit_order_path(id: order.id, mode: 'all'), class: 'btn btn-block'
|
||||
= link_to 'Sammellastschrift für ausgewählt (.xml)', collective_direct_debit_order_path(id: order.id, mode: 'selected'), remote: true, class: 'btn btn-block', data: { turbolinks: true }, id: "collective-direct-debit-link-#{order.id}"
|
||||
- else
|
||||
%i
|
||||
= t('activerecord.attributes.group_order_invoice.links.sepa_not_ready')
|
||||
- content_for :javascript do
|
||||
:javascript
|
||||
$(document).off('click', "#collective-direct-debit-link-#{order.id}").on('click', "#collective-direct-debit-link-#{order.id}", function(e) {
|
||||
e.preventDefault();
|
||||
// Extract selected group_order_ids
|
||||
var selectedGroupOrderIds = $('input[name^="group_order_ids_for_order_#{order.id}"]:checked').map(function() {
|
||||
return $(this).val();
|
||||
}).get();
|
||||
|
||||
// Log the selected IDs (for testing purposes)
|
||||
console.log('Selected Group Order IDs:', selectedGroupOrderIds);
|
||||
var url = $(this).closest('a').attr('href');
|
||||
//suppress generic error warning
|
||||
$.ajaxSetup({
|
||||
global: false,
|
||||
});
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'GET', // You may adjust the HTTP method as needed
|
||||
data: { group_order_ids: selectedGroupOrderIds },
|
||||
dataType: 'xml',
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
console.log('AJAX request successful:', response);
|
||||
// Convert XML response to a Blob
|
||||
var blob = new Blob([new XMLSerializer().serializeToString(response)], { type: 'text/xml' });
|
||||
|
||||
// Create a temporary link element
|
||||
var link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob);
|
||||
|
||||
if(selectedGroupOrderIds.length > 1){
|
||||
link.download = "#{order.supplier.name}-Sammellastschrift.xml";
|
||||
} else {
|
||||
link.download = "#{order.supplier.name}-Lastschrift.xml";
|
||||
}
|
||||
|
||||
// Append the link to the document and trigger the click event
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// Clean up
|
||||
document.body.removeChild(link);
|
||||
$("group-order-invoices-for-order-#{order.id}" + " .expand-trigger a").click();
|
||||
|
||||
},
|
||||
error: function(error) {
|
||||
// Handle error
|
||||
if (error.responseJSON) {
|
||||
alert('AJAX request error:' + "\n" + error.responseJSON.message);
|
||||
} else{
|
||||
var errorText = JSON.parse(error.responseText).error;
|
||||
var alertDiv = '<div class="alert fade in alert-error"><button class="close" data-dismiss="alert">×</button>' + errorText + '</div>';
|
||||
$('.page-header').before(alertDiv);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -1,29 +1,69 @@
|
|||
.row
|
||||
.column.small-12
|
||||
- show_generate_with_date = true
|
||||
- order.group_orders.each do |go|
|
||||
- if go.group_order_invoice.present?
|
||||
- show_generate_with_date = false
|
||||
- if show_generate_with_date
|
||||
= form_for :group_order_invoice, url: url_for('group_order_invoice#create_multiple'), remote: true do |f|
|
||||
= f.label :invoice_date, I18n.t('activerecord.attributes.group_order_invoice.links.invoice_date')
|
||||
= f.date_field :invoice_date, {value: Date.today, max: Date.today, required: true}
|
||||
= f.hidden_field :order_id, value: order.id
|
||||
= f.submit I18n.t('activerecord.attributes.group_order_invoice.links.generate_with_date'), class: 'btn btn small'
|
||||
|
||||
- order.group_orders.includes([:group_order_invoice, :ordergroup]).each do |go|
|
||||
.row
|
||||
.column.small-3
|
||||
= label_tag go.ordergroup.name
|
||||
- if go.group_order_invoice
|
||||
.column.small-3
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.download'), group_order_invoice_path(go.group_order_invoice, :format => 'pdf'), class: 'btn btn-small'
|
||||
.column.small-3
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.delete'), go.group_order_invoice, method: :delete, class: 'btn btn-danger btn-small', remote: true
|
||||
- else
|
||||
= button_to I18n.t('activerecord.attributes.group_order_invoice.links.generate'), group_order_invoices_path(:method => :post, group_order: go) ,class: 'btn btn-small', params: {id: order.id}, remote: true
|
||||
- if order.group_orders.map(&:group_order_invoice).compact.present?
|
||||
%br/
|
||||
.row
|
||||
.column.small-3
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.download_all_zip'), download_all_group_order_invoices_path(order), class: 'btn btn-small'
|
||||
|
||||
- show_generate_with_date = true
|
||||
- order.group_orders.each do |go|
|
||||
- if go.group_order_invoice.present?
|
||||
- show_generate_with_date = false
|
||||
- if show_generate_with_date
|
||||
= form_for :group_order_invoice, url: url_for('group_order_invoice#create_multiple'), remote: true do |f|
|
||||
= f.label :invoice_date, I18n.t('activerecord.attributes.group_order_invoice.links.invoice_date')
|
||||
= f.date_field :invoice_date, {value: Date.today, max: Date.today, required: true}
|
||||
= f.hidden_field :order_id, value: order.id
|
||||
|
||||
= f.submit I18n.t('activerecord.attributes.group_order_invoice.links.generate_with_date'), class: 'btn btn'
|
||||
|
||||
%table.table.group-order-invoices-table
|
||||
%thead
|
||||
%tr
|
||||
%th=I18n.t('activerecord.attributes.group_order_invoice.links.ordergroup')
|
||||
%th=I18n.t('activerecord.attributes.group_order_invoice.links.payed')
|
||||
%th=I18n.t('activerecord.attributes.group_order_invoice.links.sepa_downloaded')
|
||||
%th=I18n.t('activerecord.attributes.group_order_invoice.links.sepa_sequence_type')
|
||||
%th=I18n.t('activerecord.attributes.group_order_invoice.links.sepa_select')
|
||||
%th
|
||||
%tbody
|
||||
- order.group_orders.includes([:group_order_invoice, :ordergroup]).each do |go|
|
||||
- if go.group_order_invoice
|
||||
%tr.order-row
|
||||
%td= link_to go.ordergroup.name, edit_admin_ordergroup_path(go.ordergroup)
|
||||
%td
|
||||
.div{id: "payed_#{go.group_order_invoice.id}"}
|
||||
= render :partial => "group_order_invoices/toggle_payed", locals: { group_order_invoice: go.group_order_invoice }
|
||||
%td
|
||||
.div{id: "sepa_downloaded_#{go.group_order_invoice.id}"}
|
||||
= render :partial => "group_order_invoices/toggle_sepa_downloaded", locals: { group_order_invoice: go.group_order_invoice }
|
||||
%td
|
||||
.div{id: "select_sepa_sequence_type_#{go.group_order_invoice.id}"}
|
||||
=render :partial => 'group_order_invoices/select_sepa_sequence_type', locals:{ group_order_invoice: go.group_order_invoice }
|
||||
%td
|
||||
= check_box_tag "group_order_ids_for_order_#{order.id}", go.id, false, class: "group-order-checkbox", id: "group_order_#{go.id}_included_in_sepa", data: { order_id: go.id }
|
||||
%td
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.download'), group_order_invoice_path(go.group_order_invoice, :format => 'pdf'), class: 'btn btn-block'
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.delete'), go.group_order_invoice, method: :delete, class: 'btn btn-block btn-danger', remote: true, data: { confirm: I18n.t('ui.confirm_delete', name: "Bestellgruppenrechnung für #{go.ordergroup.name}" ) }
|
||||
- else
|
||||
%tr
|
||||
%td
|
||||
= go.ordergroup.name
|
||||
= button_to I18n.t('activerecord.attributes.group_order_invoice.links.generate'), group_order_invoices_path(:method => :post, group_order: go) ,class: 'btn btn-small', params: {id: order.id}, remote: true
|
||||
%td
|
||||
%td
|
||||
%td
|
||||
%td
|
||||
%td
|
||||
|
||||
- if order.group_orders.map(&:group_order_invoice).compact.present?
|
||||
%tr.order-row
|
||||
%td= I18n.t('activerecord.attributes.group_order_invoice.links.actions_for_all')
|
||||
%td
|
||||
.div{id: "toggle_all_payed_#{order.id}"}
|
||||
= render :partial => 'group_order_invoices/toggle_all_payed', locals: { order: order }
|
||||
%td
|
||||
.div{id: "toggle_all_sepa_downloaded_#{order.id}"}
|
||||
= render :partial => 'group_order_invoices/toggle_all_sepa_downloaded', locals: { order: order }
|
||||
%td
|
||||
.div{id: "select_all_sepa_sequence_type_#{order.id}"}
|
||||
= render :partial => 'group_order_invoices/select_all_sepa_sequence_type', locals: { order: order }
|
||||
%td
|
||||
= render :partial => 'group_order_invoices/collective_direct_debit', locals: { order: order }
|
||||
%td
|
||||
= link_to I18n.t('activerecord.attributes.group_order_invoice.links.download_all_zip'), download_all_group_order_invoices_path(order), class: 'btn btn-block'
|
||||
|
|
|
|||
2
app/views/group_order_invoices/_modal.html.haml
Normal file
2
app/views/group_order_invoices/_modal.html.haml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.div{id: "order_#{order.id}_modal"}
|
||||
= render :partial => 'group_order_invoices/links', locals: { order: order }
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
= link_to select_all_sepa_sequence_type_group_order_invoices_path(order_id: order.id), remote: true, method: :patch, class: "ajax-update-all-link-#{order.id}" , data: { turbolinks: false } do
|
||||
= select_tag 'sepa_sequence_type', options_for_select(GroupOrderInvoice.sequence_types.keys.map { |st| [I18n.t("activerecord.attributes.group_order_invoice.sequence_type.#{st}"), st] }, selected: @sequence_type || order.group_orders.map(&:group_order_invoice)&.compact&.first.sepa_sequence_type), class: 'form-control', id: "all_sepa_sequence_type_#{order.id}"
|
||||
|
||||
- content_for :javascript do
|
||||
:javascript
|
||||
$(document).off('change', ".ajax-update-all-link-#{order.id} select").on('change', ".ajax-update-all-link-#{order.id} select", function() {
|
||||
var selectedValue = $(this).val();
|
||||
var url = $(this).closest('a').attr('href');
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'PATCH',
|
||||
data: { sepa_sequence_type: selectedValue },
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
}
|
||||
});})
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
= link_to select_sepa_sequence_type_group_order_invoice_path(group_order_invoice), remote: true, method: :patch, class: "ajax-update-link-#{group_order_invoice.id}", data: { turbolinks: false } do
|
||||
= select_tag 'sepa_sequence_type', options_for_select(GroupOrderInvoice.sequence_types.keys.map { |st| [I18n.t("activerecord.attributes.group_order_invoice.sequence_type.#{st}"), st] }, selected: group_order_invoice.sepa_sequence_type ), class: 'form-control', id: "sepa_sequence_type_#{group_order_invoice.id}"
|
||||
|
||||
- content_for :javascript do
|
||||
:javascript
|
||||
$(document).off('change', ".ajax-update-link-#{group_order_invoice.id} select").on('change', ".ajax-update-link-#{group_order_invoice.id} select", function() {
|
||||
var selectedValue = $(this).val();
|
||||
var url = $(this).closest('a').attr('href');
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'PATCH',
|
||||
data: { sepa_sequence_type: selectedValue },
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
},
|
||||
error: function(error) {
|
||||
// Handle error
|
||||
}
|
||||
});})
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
= link_to toggle_all_payed_group_order_invoices_path(order_id: order.id,payed: order.group_orders.map(&:group_order_invoice).compact.map(&:payed)&.all? ), remote: true, method: :patch, data: { confirm: I18n.t('ui.confirm_mark_all', name: "payed" ) } do
|
||||
= check_box_tag :payed, '1', order.group_orders.map(&:group_order_invoice).compact.map(&:payed)&.all? , class: 'form-check-input'
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
= link_to toggle_all_sepa_downloaded_group_order_invoices_path(order_id: order.id, sepa_downloaded: order.group_orders.map(&:group_order_invoice).compact.map(&:sepa_downloaded)&.all? ), remote: true, method: :patch, data: { confirm: I18n.t('ui.confirm_mark_all', name: "sepa_downloaded" ) } do
|
||||
= check_box_tag :sepa_downloaded, '1', order.group_orders.map(&:group_order_invoice).compact.map(&:sepa_downloaded)&.all? , class: 'form-check-input'
|
||||
2
app/views/group_order_invoices/_toggle_payed.html.haml
Normal file
2
app/views/group_order_invoices/_toggle_payed.html.haml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
= link_to toggle_payed_group_order_invoice_path(group_order_invoice), remote: true, method: :patch, data: { turbolinks: false } do
|
||||
= check_box_tag 'payed', '1', group_order_invoice.payed , class: 'form-check-input', id: "payed_#{group_order_invoice.id}"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
= link_to toggle_sepa_downloaded_group_order_invoice_path(group_order_invoice), remote: true, method: :patch do
|
||||
= check_box_tag 'sepa_downloaded', '1', group_order_invoice.sepa_downloaded , class: 'form-check-input', id: "sepa_downloaded_#{group_order_invoice.id}"
|
||||
|
|
@ -1 +1 @@
|
|||
$("#generate-invoice<%= params[:id] %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
$("#order_<%= @order.id %>_modal").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
$("#generate-invoice<%= @order.id %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
$("#order_<%= @order.id %>_modal").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
$("#generate-invoice<%= @order.id %>").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
$("#order_<%= @order.id %>_modal").html("<%= escape_javascript(render partial: 'links', locals: {order: @order}) %>");
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#order_<%= @order.id %>_modal").html("<%= escape_javascript(render partial: 'modal', locals: { order: @order, sequence_type: @sequence_type }) %>");
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#select_sepa_sequence_type_<%= @group_order_invoice.id %>").html("<%= j(render partial: 'select_sepa_sequence_type', locals: {group_order_invoice: @group_order_invoice}) %>");
|
||||
4
app/views/group_order_invoices/toggle_all_payed.js.erb
Normal file
4
app/views/group_order_invoices/toggle_all_payed.js.erb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<% @group_order_invoices.each do |group_order_invoice| %>
|
||||
$("#payed_<%= group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_payed', locals: { group_order_invoice: group_order_invoice }) %>");
|
||||
<% end %>
|
||||
$("#toggle_all_payed_<%= @order.id %>").html("<%= escape_javascript(render partial: 'toggle_all_payed', locals: { order: @order }) %>");
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<% @group_order_invoices.each do |group_order_invoice| %>
|
||||
$("#sepa_downloaded_<%= group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_sepa_downloaded', locals: { group_order_invoice: group_order_invoice }) %>");
|
||||
<% end %>
|
||||
$("#toggle_all_sepa_downloaded_<%= @order.id %>").html("<%= escape_javascript(render partial: 'toggle_all_sepa_downloaded', locals: { order: @order }) %>");
|
||||
1
app/views/group_order_invoices/toggle_payed.js.erb
Normal file
1
app/views/group_order_invoices/toggle_payed.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$("#payed_<%= @group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_payed', locals: {group_order_invoice: @group_order_invoice}) %>");
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#sepa_downloaded_<%= @group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_sepa_downloaded', locals: {group_order_invoice: @group_order_invoice}) %>");
|
||||
|
|
@ -174,7 +174,10 @@
|
|||
%strong
|
||||
%span#new_balance= number_to_currency(old_balance - @group_order.price)
|
||||
#order-button
|
||||
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
||||
- if FoodsoftConfig[:group_order_invoices]&.[](:ignore_minimum_balance)
|
||||
= submit_tag( t('.action_save'), id: 'submit_sepa_button', class: 'btn btn-primary' )
|
||||
- else
|
||||
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
|
||||
#{link_to t('ui.or_cancel'), group_orders_path}
|
||||
%input#total_balance{name: "total_balance", type: "hidden", value: @ordergroup.account_balance - @group_order.price}/
|
||||
%input{name: "version", type: "hidden", value: @version}/
|
||||
|
|
|
|||
1
app/views/orders/collective_direct_debit.js.erb
Normal file
1
app/views/orders/collective_direct_debit.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$("#order_<%= @order.id %>_modal").html("<%= escape_javascript(render partial: 'group_order_invoices/links', locals: {order: @order}) %>");
|
||||
2
app/views/orders/render_modal.js.erb
Normal file
2
app/views/orders/render_modal.js.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$('#modalContainer').html('<%= j(render("group_order_invoices/modal", order: @order)) %>');
|
||||
$('#modalContainer').modal();
|
||||
20
app/views/shared/_sepa_account_holder.html.haml
Normal file
20
app/views/shared/_sepa_account_holder.html.haml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
= f.simple_fields_for :sepa_account_holder, @ordergroup.sepa_account_holder || @ordergroup.build_sepa_account_holder do |sepa_f|
|
||||
= sepa_f.input :user_id, collection: f.object.users.map { |user| [user.name, user.id, { 'data-iban' => user.iban, 'data-bic' => user.bic }] }, selected: sepa_f.object.user_id, as: :select, label: 'SEPA Account Holder', include_blank: true, input_html: { id: 'user_id_select' }
|
||||
= sepa_f.hidden_field :group_id, value: @ordergroup.id
|
||||
= sepa_f.input :iban
|
||||
= sepa_f.input :bic
|
||||
= sepa_f.input :mandate_id
|
||||
= sepa_f.input :mandate_date_of_signature, as: :date_picker
|
||||
|
||||
- content_for :javascript do
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
$('#user_id_select').on('change', function() {
|
||||
var selectedOption = $(this).find('option:selected');
|
||||
var iban = selectedOption.data('iban');
|
||||
var bic = selectedOption.data('bic');
|
||||
|
||||
$('#ordergroup_sepa_account_holder_attributes_iban').val(iban || ''); // Update the IBAN input field
|
||||
$('#ordergroup_sepa_account_holder_attributes_bic').val(bic || ''); // Update the BIC input field
|
||||
});
|
||||
});
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
= f.input :phone
|
||||
- if FoodsoftConfig[:use_iban]
|
||||
= f.input :iban
|
||||
= f.input :bic
|
||||
|
||||
- if local_assigns[:with_address] && (f.object.ordergroup || f.object.new_record?)
|
||||
= f.fields_for [:ordergroup, f.object.ordergroup || Ordergroup.new] do |ogf|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue