- content_for :actions do = link_to(t(:export_csv), url_for(params.merge(format: 'csv')), class: 'btn btn-default') = render 'shared/title', name: t(:account_activities) .row .col-md-12 = search_form_for @q, url: [:admin, :account_activities], html: { style: 'margin-bottom: 0;' } do |f| .row .col-md-12 .form-group = f.label t(:registrar) = f.select :account_registrar_id_in, Registrar.all.map { |x| [x, x.id] }, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true .row .col-md-6 .form-group = f.label t(:activity_type) = f.select :activity_type_in, AccountActivity.types_for_select, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true .col-md-6 .form-group = f.label t(:description) = f.search_field :description_cont, class: 'form-control', placeholder: t(:description), autocomplete: 'off' .row .col-md-3 .form-group = f.label t(:receipt_date_from) = f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:receipt_date_from), autocomplete: 'off' .col-md-3 .form-group = f.label t(:receipt_date_until) = f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:receipt_date_until), autocomplete: 'off' .col-md-3 .form-group = label_tag t(:results_per_page) = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) .col-md-3{style: 'padding-top: 25px;'} %button.btn.btn-default.search   %span.glyphicon.glyphicon-search   %button.btn.btn-default.js-reset-form = t(:clear_fields) .row .col-md-3 .col-md-3 .col-md-2 .col-md-4{class: 'text-right'} = t(:starting_balance) + " #{@sum.to_f} EUR" %hr .row .col-md-12 .table-responsive %table.table.table-hover.table-condensed %thead %tr %th{class: 'col-xs-2'} = sort_link(@q, 'registrar') %th{class: 'col-xs-3'} = sort_link(@q, 'description') %th{class: 'col-xs-2'} = sort_link(@q, 'activity_type') %th{class: 'col-xs-3'} = sort_link(@q, 'created_at', t(:receipt_date)) %th{class: 'col-xs-2'} = sort_link(@q, 'sum') %tbody -total = @sum.to_f - @account_activities.each do |x| %tr %td= x.account.registrar && link_to(x.account.registrar.try(:code), admin_registrar_path(x.account.registrar)) %td= x.description.present? ? x.description : '-' %td= x.activity_type ? t(x.activity_type) : '' %td= l(x.created_at) - c = x.sum > 0.0 ? 'text-success' : 'text-danger' - s = x.sum > 0.0 ? "+#{x.sum} #{x.currency}" : "#{x.sum} #{x.currency}" -total += x.sum %td{class: c}= s - if @account_activities.count > 0 %tr %td %td %td %td{class: 'text-right'}= t(:total) %td{class: total > 0 ? 'text-success' : 'text-danger'}= total > 0 ? "+#{total} EUR" : "#{total} EUR" .row .col-md-12 = paginate @account_activities :coffee $(".js-reset-form").on "click", (e) -> e.preventDefault(); window.location = "#{admin_account_activities_path}"