2013-02-11 03:57:33 +01:00
|
|
|
- title t('.title')
|
2011-06-09 21:35:05 +02:00
|
|
|
|
2012-11-10 16:44:05 +01:00
|
|
|
- content_for :javascript do
|
2011-06-09 21:35:05 +02:00
|
|
|
:javascript
|
2016-03-06 11:53:31 +01:00
|
|
|
var ordergroup = $($.parseHTML("#{escape_javascript(render('ordergroup'))}"));
|
2011-06-09 21:35:05 +02:00
|
|
|
|
|
|
|
$(function() {
|
2014-01-25 15:19:50 +01:00
|
|
|
$(document).on('touchclick', 'a[data-remove-transaction]', function() {
|
2011-06-09 21:35:05 +02:00
|
|
|
$(this).parents('tr').remove();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2014-01-25 15:19:50 +01:00
|
|
|
$(document).on('touchclick', 'a[data-add-transaction]', function() {
|
2016-03-06 11:53:31 +01:00
|
|
|
ordergroup.clone().appendTo('#ordergroups');
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).on('touchclick', 'a[data-add-all-ordergroups]', function() {
|
|
|
|
var value = prompt("#{escape_javascript(heading_helper(FinancialTransaction, :amount))}:");
|
|
|
|
if (value === null)
|
|
|
|
return false;
|
|
|
|
$('#ordergroups > tbody > tr').remove();
|
|
|
|
var options = ordergroup.find('td > select > option').each(function() {
|
|
|
|
var row = ordergroup.clone();
|
|
|
|
row.find('td > input').val(value);
|
|
|
|
row.find('td > select').val(this.value);
|
|
|
|
row.appendTo('#ordergroups');
|
|
|
|
});
|
2011-06-09 21:35:05 +02:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2012-11-10 16:44:05 +01:00
|
|
|
- content_for :sidebar do
|
2013-02-11 03:57:33 +01:00
|
|
|
.well.well-small= t('.sidebar')
|
2012-11-10 16:44:05 +01:00
|
|
|
|
|
|
|
= form_tag finance_create_transaction_collection_path do
|
2011-06-09 21:35:05 +02:00
|
|
|
%p
|
2013-11-23 12:05:29 +01:00
|
|
|
%b= heading_helper FinancialTransaction, :note
|
2012-11-10 16:44:05 +01:00
|
|
|
= text_field_tag :note, params[:note], class: 'input-xlarge', required: 'required'
|
2011-06-09 21:35:05 +02:00
|
|
|
%p
|
|
|
|
%table#ordergroups{:style => "width:20em"}
|
2016-03-06 11:53:31 +01:00
|
|
|
%thead
|
|
|
|
%tr
|
|
|
|
%th= heading_helper FinancialTransaction, :ordergroup
|
|
|
|
%th= heading_helper FinancialTransaction, :amount
|
|
|
|
%tbody
|
|
|
|
= render :partial => 'ordergroup', :collection => [1, 2, 3]
|
2011-06-09 21:35:05 +02:00
|
|
|
%p
|
2013-02-11 03:57:33 +01:00
|
|
|
= link_to t('.new_ordergroup'), '#', 'data-add-transaction' => true, class: 'btn'
|
2016-03-06 11:53:31 +01:00
|
|
|
= link_to t('.add_all_ordergroups'), '#', 'data-add-all-ordergroups' => true, class: 'btn'
|
2012-11-10 16:44:05 +01:00
|
|
|
.form-actions
|
2013-02-11 03:57:33 +01:00
|
|
|
= submit_tag t('.save'), class: 'btn btn-primary'
|
2013-04-04 02:49:52 +02:00
|
|
|
= link_to t('ui.or_cancel'), finance_ordergroups_path
|