internetee/registry

View on GitHub
app/views/admin/invoices/partials/_search_form.html.erb

Summary

Maintainability
Test Coverage
<div class="row">
    <div class="col-md-12">
        <%= search_form_for @q, url: [:admin, :invoices], html: { style: 'margin-bottom: 0;' } do |f| %>
            <div class="row">
                <div class="col-md-3">
                    <div class="form-group">
                        <%= f.label t(:invoice_number) %>
                        <%= f.search_field :number_eq, class: 'form-control', placeholder: t(:invoice_number), autocomplete: 'off' %>
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="form-group">
                        <%= f.label t(:status) %>
                        <%= select_tag :status, options_for_select(%w(Paid Unpaid Cancelled Monthly),params[:status]),
                                       { multiple: false, include_blank: true, selected: params[:status], class: 'form-control selectize'} %>
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="form-group">
                        <%= f.label t(:due_date_from), for: nil %>
                        <%= f.search_field :due_date_gteq, value: params[:q][:due_date_gteq], class: 'form-control js-datepicker', placeholder: t(:due_date_from) %>
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="form-group">
                        <%= f.label t(:due_date_until), for: nil %>
                        <%= f.search_field :due_date_lteq, value: params[:q][:due_date_lteq], class: 'form-control js-datepicker', placeholder: t(:due_date_until) %>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <%= f.label "Registrar" %>
                        <%= f.select :buyer_id_in, Registrar.all.map { |x| [x, x.id] }, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true %>
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="form-group">
                        <%= f.label t(:receipt_date_from), for: nil %>
                        <%= f.search_field :receipt_date_gteq, value: params[:q][:receipt_date_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), for: nil %>
                        <%= f.search_field :receipt_date_lteq, value: params[:q][:receipt_date_lteq], class: 'form-control js-datepicker', placeholder: t(:receipt_date_until) %>
                    </div>
                </div>

                <div class="col-md-3"></div>
                <div class="col-md-3"></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-3" style="padding-top: 25px; float: right; padding-right: 10px;">
                    <button class="btn btn-primary">
                        &nbsp;
                        <span class="glyphicon glyphicon-search"></span>
                        &nbsp;
                    </button>
                    <%= link_to t('admin.invoices.search_form.download_btn'), admin_invoices_path(format: :csv, params: params.permit!),
                                "data-toggle" => "tooltip", "data-placement" => "bottom", "title" => t('admin.invoices.search_form.download_btn'),
                                class: 'btn btn-default' %>
                    <%= link_to t('admin.invoices.search_form.reset_btn'), admin_invoices_path, class: 'btn btn-default' %>
                </div>
            </div>
        <% end %>
    </div>
</div>