Add filter to account activities #2691

This commit is contained in:
Martin Lensment 2015-07-07 11:22:32 +03:00
parent d6a151b141
commit ca2a2db9ad
4 changed files with 61 additions and 4 deletions

View file

@ -2,16 +2,50 @@
= link_to(t(:back_to_billing), registrar_invoices_path, class: 'btn btn-default')
= render 'shared/title', name: t(:account_activity)
.row
.col-md-12
= search_form_for @q, url: [:registrar, :account_activities], html: { style: 'margin-bottom: 0;' } do |f|
.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{style: 'padding-top: 25px;'}
%button.btn.btn-default
 
%span.glyphicon.glyphicon-search
 
%button.btn.btn-default.js-reset-form
= t(:clear_fields)
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-condensed
%thead
%tr
%th{class: 'col-xs-5'}= t(:description)
%th{class: 'col-xs-3'}= t(:receipt_date)
%th{class: 'col-xs-2'}= t(:invoice)
%th{class: 'col-xs-2'}= t(:sum)
%th{class: 'col-xs-5'}
= sort_link(@q, 'description')
%th{class: 'col-xs-3'}
= sort_link(@q, 'created_at', t(:receipt_date))
%th{class: 'col-xs-2'}
= sort_link(@q, 'invoice_id', t(:invoice))
%th{class: 'col-xs-2'}
= sort_link(@q, 'sum')
%tbody
- @account_activities.each do |x|
%tr
@ -27,3 +61,8 @@
.row
.col-md-12
= paginate @account_activities
:coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{registrar_account_activities_path}"