2015-09-08 19:39:13 +02:00
|
|
|
%h2= @user.name
|
2015-09-09 20:54:16 +02:00
|
|
|
|
2015-09-11 13:16:53 +02:00
|
|
|
= render 'transactions/new'
|
|
|
|
|
2015-09-10 21:12:03 +02:00
|
|
|
.panel.panel-default.data-table-filters
|
2015-09-11 14:52:26 +02:00
|
|
|
.panel-heading
|
2015-09-10 21:12:03 +02:00
|
|
|
%h3.panel-title Filters
|
|
|
|
.panel-body
|
2015-09-11 15:18:36 +02:00
|
|
|
.row
|
|
|
|
.col-md-8.col-md-offset-2
|
|
|
|
.bound.input-listen{ 'data-input-type': 'date-range', 'data-filter-name': 'Time' }
|
|
|
|
.row
|
|
|
|
.col-md-6
|
|
|
|
.input-group
|
|
|
|
%span.input-group-addon
|
|
|
|
%span.glyphicon.glyphicon-calendar
|
|
|
|
%input.lower-bound.form-control.filter-align{type: 'date', placeholder: 'after', class: 'pure-group-addon'}
|
|
|
|
.col-md-6
|
|
|
|
.input-group
|
|
|
|
%span.input-group-addon
|
|
|
|
%span.glyphicon.glyphicon-calendar
|
|
|
|
%input.upper-bound.form-control.filter-align{type: 'date', placeholder: 'after', class: 'pure-group-addon'}
|
|
|
|
.bound.input-listen.pure-u-1{ 'data-input-type': 'number-range', 'data-filter-name': 'Amount' }
|
|
|
|
.row
|
|
|
|
.col-md-6
|
|
|
|
.input-group
|
|
|
|
%span.input-group-addon
|
|
|
|
%span.glyphicon.glyphicon-euro
|
|
|
|
%input.lower-bound.form-control.filter-align{type: 'number', placeholder: 'Minimum'}
|
|
|
|
.col-md-6
|
|
|
|
.input-group
|
|
|
|
%span.input-group-addon
|
|
|
|
%span.glyphicon.glyphicon-euro
|
|
|
|
%input.upper-bound.form-control.filter-align{type: 'number', placeholder: 'Maximum'}
|
|
|
|
.row
|
|
|
|
.col-md-4
|
|
|
|
.input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Issuer' }
|
|
|
|
%input{type: 'text', placeholder: 'Filter on Issuer', class: "form-control" }
|
|
|
|
.col-md-4
|
|
|
|
.input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Peer' }
|
|
|
|
%input{type: 'text', placeholder: 'Filter on Peer', class: "form-control" }
|
|
|
|
.col-md-4
|
|
|
|
.input-listen{ 'data-input-type': 'text', 'data-filter-name': 'Message' }
|
|
|
|
%input{type: 'text', placeholder: 'Filter on Message', class: "form-control" }
|
2015-09-10 21:12:03 +02:00
|
|
|
|
2015-09-09 21:26:19 +02:00
|
|
|
%table#transactions.pure-table.pure-table-striped{data: { source: user_path(@user) }}
|
2015-09-08 19:39:13 +02:00
|
|
|
%thead
|
|
|
|
%tr
|
2015-09-09 20:00:47 +02:00
|
|
|
%th Time
|
2015-09-08 19:39:13 +02:00
|
|
|
%th Amount
|
2015-09-09 20:00:47 +02:00
|
|
|
%th Peer
|
2015-09-09 18:17:55 +02:00
|
|
|
%th Issuer
|
2015-09-08 19:39:13 +02:00
|
|
|
%th Message
|
2015-09-09 20:54:16 +02:00
|
|
|
%tbody
|
2015-09-08 20:45:32 +02:00
|
|
|
|
|
|
|
:javascript
|
|
|
|
$(document).ready(function() {
|
2015-09-09 17:14:06 +02:00
|
|
|
var table = $('#transactions').DataTable({
|
2015-09-09 14:46:06 +02:00
|
|
|
processing: true,
|
|
|
|
serverSide: true,
|
2015-09-11 10:20:11 +02:00
|
|
|
searching: true,
|
2015-09-09 21:26:19 +02:00
|
|
|
lengthChange: false,
|
2015-09-09 14:46:06 +02:00
|
|
|
ordering: false,
|
|
|
|
ajax: $('#transactions').data('source'),
|
|
|
|
pagingType: 'full_numbers',
|
2015-09-09 20:00:47 +02:00
|
|
|
autoWidth: false,
|
2015-09-09 20:54:16 +02:00
|
|
|
responsive: true,
|
2015-09-09 14:46:06 +02:00
|
|
|
columns: [
|
2015-09-10 21:12:03 +02:00
|
|
|
{ data: 'time', name: 'Time', width: "15%", className: 'min-tablet-l'},
|
|
|
|
{ data: 'amount', name: 'Amount', width: "10%", className: 'min-mobile'},
|
|
|
|
{ data: 'peer', name: 'Peer', width: "15%", className: 'min-mobile'},
|
|
|
|
{ data: 'issuer', name: 'Issuer', width: "15%", className: 'min-desktop'},
|
2015-09-11 09:59:31 +02:00
|
|
|
{ data: 'message', name: 'Message', width: "45%", className: 'min-tablet-p'}
|
2015-09-11 14:10:47 +02:00
|
|
|
],
|
|
|
|
columnDefs: [
|
|
|
|
{
|
|
|
|
targets: 0,
|
|
|
|
render: function(data, type, full, meta) {
|
|
|
|
return $.format.date(data, 'E dd/MM/yyyy HH:mm');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
targets: 1,
|
|
|
|
render: function(data, type, full, meta) {
|
2015-09-11 14:51:35 +02:00
|
|
|
return (data/100).toFixed(2);
|
2015-09-11 14:10:47 +02:00
|
|
|
}
|
|
|
|
}
|
2015-09-09 20:00:47 +02:00
|
|
|
]
|
2015-09-09 17:14:06 +02:00
|
|
|
});
|
|
|
|
|
2015-09-11 10:34:04 +02:00
|
|
|
$('.dataTables_filter').hide();
|
|
|
|
|
2015-09-11 09:59:31 +02:00
|
|
|
$('.input-listen').each(function(index, element) {
|
|
|
|
var filter = $(element);
|
|
|
|
var type = filter.attr('data-input-type');
|
2015-09-11 11:08:15 +02:00
|
|
|
var column = table.column(filter.attr('data-filter-name') + ':name');
|
|
|
|
console.log(column);
|
2015-09-11 09:59:31 +02:00
|
|
|
filter.find('input').on('keyup change', function() {
|
|
|
|
var value = null
|
|
|
|
if(filter.hasClass('bound')) {
|
|
|
|
var lower = filter.find('.lower-bound');
|
|
|
|
var upper = filter.find('.upper-bound');
|
2015-09-11 11:08:15 +02:00
|
|
|
value = lower.val() + '~' + upper.val();
|
2015-09-09 17:14:06 +02:00
|
|
|
} else {
|
2015-09-11 11:08:15 +02:00
|
|
|
value = $(this).val();
|
2015-09-09 17:14:06 +02:00
|
|
|
}
|
2015-09-11 10:24:29 +02:00
|
|
|
value = filter.attr('data-input-type') + ':' + value;
|
2015-09-09 17:14:06 +02:00
|
|
|
if(column.search() !== value) {
|
|
|
|
column.search(value).draw();
|
|
|
|
}
|
|
|
|
});
|
2015-09-09 14:46:06 +02:00
|
|
|
});
|
2015-09-08 20:45:32 +02:00
|
|
|
});
|