mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 06:34:46 +02:00
Merge pull request #1410 from internetee/fix-account-activity-search-form
Fix account activity search form
This commit is contained in:
commit
1a267a5ce9
8 changed files with 179 additions and 103 deletions
65
app/views/admin/account_activities/_search_form.html.erb
Normal file
65
app/views/admin/account_activities/_search_form.html.erb
Normal file
|
@ -0,0 +1,65 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= search_form_for @q, url: [:admin, :account_activities], html: { style: 'margin-bottom: 0;' } do |f| %>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:registrar_name) %>
|
||||
<%= f.select :account_registrar_id_in, Registrar.all.map { |x| [x, x.id] }, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="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 %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:description) %>
|
||||
<%= f.search_field :description_cont, class: 'form-control', placeholder: t(:description), autocomplete: 'off' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:receipt_date_from) %>
|
||||
<%= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_from) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:receipt_date_until) %>
|
||||
<%= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_until) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="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) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5 text-right" style="padding-top: 25px;">
|
||||
<button class="btn btn-default search">
|
||||
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
|
||||
</button>
|
||||
<%= button_tag t('.download_btn'),
|
||||
formaction: admin_account_activities_path(format: 'csv'),
|
||||
class: 'btn btn-default' %>
|
||||
<%= link_to(t('.reset_btn'), admin_account_activities_path, class: 'btn btn-default') %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,44 +1,6 @@
|
|||
- 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)
|
||||
= render 'search_form'
|
||||
|
||||
.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_name)
|
||||
= 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 js-datepicker', placeholder: t(:receipt_date_from)
|
||||
.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 js-datepicker', placeholder: t(:receipt_date_until)
|
||||
.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
|
||||
|
||||
= link_to(t('.reset_btn'), admin_account_activities_path, class: 'btn btn-default')
|
||||
.row
|
||||
.col-md-3
|
||||
.col-md-3
|
||||
|
|
49
app/views/registrar/account_activities/_search_form.html.erb
Normal file
49
app/views/registrar/account_activities/_search_form.html.erb
Normal file
|
@ -0,0 +1,49 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= search_form_for @q, url: [:registrar, :account_activities], html: { style: 'margin-bottom: 0;' } do |f| %>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="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 %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:description) %>
|
||||
<%= f.search_field :description_cont, class: 'form-control', placeholder: t(:description), autocomplete: 'off' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:receipt_date_from) %>
|
||||
<%= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_from) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:receipt_date_until) %>
|
||||
<%= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_until) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6" style="padding-top: 25px;">
|
||||
<button class="btn btn-default">
|
||||
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
|
||||
</button>
|
||||
<%= button_tag t('.download_btn'),
|
||||
formaction: registrar_account_activities_path(format: 'csv'),
|
||||
class: 'btn btn-default' %>
|
||||
<%= link_to(t('.reset_btn'), registrar_account_activities_path, class: 'btn btn-default') %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,61 +0,0 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:back_to_billing), registrar_invoices_path, class: 'btn btn-default')
|
||||
= link_to(t(:export_csv), url_for(params.merge(format: 'csv')), 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 js-datepicker', placeholder: t(:receipt_date_from)
|
||||
.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 js-datepicker', placeholder: t(:receipt_date_until)
|
||||
.col-md-6{style: 'padding-top: 25px;'}
|
||||
%button.btn.btn-default
|
||||
|
||||
%span.glyphicon.glyphicon-search
|
||||
|
||||
= link_to(t('.reset_btn'), registrar_account_activities_path, class: 'btn btn-default')
|
||||
%hr
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.table-responsive
|
||||
%table.table.table-hover.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-5'}
|
||||
= sort_link(@q, 'description')
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'activity_type')
|
||||
%th{class: 'col-xs-3'}
|
||||
= sort_link(@q, 'created_at', AccountActivity.human_attribute_name(:created_at))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'sum')
|
||||
%tbody
|
||||
- @account_activities.each do |x|
|
||||
%tr
|
||||
%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}"
|
||||
%td{class: c}= s
|
||||
.row
|
||||
.col-md-12
|
||||
= paginate @account_activities
|
60
app/views/registrar/account_activities/index.html.erb
Normal file
60
app/views/registrar/account_activities/index.html.erb
Normal file
|
@ -0,0 +1,60 @@
|
|||
<% content_for :actions do %>
|
||||
<%= link_to(t(:back_to_billing), registrar_invoices_path, class: 'btn btn-default') %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'shared/title', name: t(:account_activity) %>
|
||||
|
||||
<%= render 'search_form' %>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-5">
|
||||
<%= sort_link(@q, 'description') %>
|
||||
</th>
|
||||
<th class="col-xs-2">
|
||||
<%= sort_link(@q, 'activity_type') %>
|
||||
</th>
|
||||
<th class="col-xs-3">
|
||||
<%= sort_link(@q, 'created_at', AccountActivity.human_attribute_name(:created_at)) %>
|
||||
</th>
|
||||
<th class="col-xs-2">
|
||||
<%= sort_link(@q, 'sum') %>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @account_activities.each do |x| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= x.description.present? ? x.description : '-' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= x.activity_type ? t(x.activity_type) : '' %>
|
||||
</td>
|
||||
<td>
|
||||
<%= l(x.created_at) %>
|
||||
</td>
|
||||
<% c = x.sum > 0.0 ? 'text-success' : 'text-danger' %>
|
||||
<% s = x.sum > 0.0 ? "+#{x.sum} #{x.currency}" : "#{x.sum} #{x.currency}" %>
|
||||
<td class="<%= c %>">
|
||||
<%= s %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= paginate @account_activities %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
en:
|
||||
admin:
|
||||
account_activities:
|
||||
index:
|
||||
search_form:
|
||||
download_btn: Download CSV
|
||||
reset_btn: Reset
|
||||
|
|
|
@ -592,7 +592,6 @@ en:
|
|||
receipt_date_from: 'Receipt date from'
|
||||
receipt_date_until: 'Receipt date until'
|
||||
add_credit: 'Add credit'
|
||||
export_csv: 'Export CSV'
|
||||
invalid_yaml: 'Invalid YAML'
|
||||
reserved_pw: 'Reserved pw'
|
||||
no_transfers_found: 'No transfers found'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
en:
|
||||
registrar:
|
||||
account_activities:
|
||||
index:
|
||||
search_form:
|
||||
download_btn: Download CSV
|
||||
reset_btn: Reset
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue