app/views/searches/_form.html.slim
// Use by SimpleSearchForHelper#simple_search_for helper
- if save_search && @saved_searches
.flex.justify-end.mb-5
.flex.items-center.w-1/6
= button_tag t("searchs.actions.open_save_search_panel"),
class: 'mr-5 hover:text-enroute-blue open_search_panel',
id: 'open_search_panel',
'x-on:click.prevent': "saveSearchPanel = ! saveSearchPanel"
span.far.fa-save.fa-2x
- if graph_panel == :button
= button_tag t("searchs.actions.open_graph_panel"),
class: 'mr-5 hover:text-enroute-blue open_graph_panel',
id: 'open_graph_panel',
'x-on:click.prevent': "graphPanel = ! graphPanel"
span.far.fa-chart-bar.fa-2x
= form_tag index_path, method: :get, "x-ref": "searchForm", class: "w-full"
= select_tag "search_id",
options_from_collection_for_select(@saved_searches, :id, :name, params[:search_id]),
class: "form-control select",
"x-on:change": "$refs.searchForm.submit()",
include_blank: true
= simple_form_for search, options do |f|
= f.simple_fields_for :order, search.order, defaults: { wrapper: false } do |form_order|
- search.order.attributes.keys.each do |attribute|
= form_order.input attribute, as: :hidden
.flex.flex-col.w-full
= yield f
- if save_search
.flex.items-center.border-t.border-white x-show="saveSearchPanel"
= f.input :saved_name, wrapper_html: {class: "border-l w-2/5"}
= f.input :saved_description, wrapper_html: {class: "border-l w-2/5"}
= hidden_field_tag :_method, "post", "x-ref": "method"
= hidden_field_tag :authenticity_token, form_authenticity_token, "x-ref": "authenticity_token"
= f.submit t('searchs.actions.save'), class: 'btn btn-default ml-5', "@click": "$root.action = save_path ; $root.method = 'post' ; $refs.method.value = save_method; $refs.method.disabled = false; ; $refs.authenticity_token.disabled = false"
- if search.saved_search&.persisted?
= link_to t('searchs.actions.destroy'), saved_search_path(search.saved_search), method: :delete, data: { :confirm => t('searchs.actions.destroy_confirm') }, class: 'btn btn-danger ml-5'
- if graph_panel != :never
.flex.items-center.border-t.border-white x-show="graphPanel"
= f.input :group_by_attribute, as: :select, collection: f.object.candidate_group_by_attributes.map { |attr_name, attr| [attr.human_name(f.object.searched_class), attr_name] }, include_blank: false, wrapper_html: {class: "border-l"}
= f.input :first, as: :select, collection: [[I18n.t('enumerize.search/base.first.first'), '1'], [I18n.t('enumerize.search/base.first.last'), '']], include_blank: false, selected: f.object.first ? '1' : '', label: false, wrapper_html: {class: "border-l"}
= f.input :top_count, as: :integer, label: false, wrapper_html: {class: "border-l"}
= f.input :sort_by, include_blank: false, wrapper_html: {class: "border-l"}
= f.input :aggregate_operation, collection: !f.object.candidate_aggregate_attributes.any? && [[f.object.class.aggregate_operation.find_value('count').text, 'count']], include_blank: false, label: false, wrapper_html: {class: "border-l"}
- if f.object.candidate_aggregate_attributes.any?
= f.input :aggregate_attribute, collection: f.object.candidate_aggregate_attributes.map { |attr_name, attr| [attr.human_name(f.object.searched_class), attr_name] }, include_blank: '-', label: false, wrapper_html: {class: "border-l"}
= f.input :display_percent, as: :boolean, boolean_style: :inline, wrapper_html: {class: "flex items-center py-3 px-6 border-white border-l"}, input_html: {class: "cursor-pointer"}, wrapper: :horizontal_boolean_tailwind
= f.input :chart_type, wrapper_html: {class: "border-l"}
.flex.flex-col.justify-center.items-center.actions.ml-auto.py-3.w-80.border-white.border-t.border-l.h-max
.flex.items-center.mb-3.ml-8
= f.label :per_page, class: 'control-label'
= f.input :per_page, as: :select, collection: [ 30, 50, 100 ], include_blank: false, label: false, width: 2, wrapper_html: {class: "border-none"}
.flex.items-center
= link_to t('actions.erase'), index_path, class: 'btn btn-link'
= f.submit t('actions.filter'), class: 'btn btn-default', id: 'filter'