- @page_title = t('workarea.admin.pricing_discounts.index.page_title') .view .view__header .grid.grid--middle.grid--center .grid__cell.grid__cell--50 .view__heading = link_to "↑ #{t('workarea.admin.pricing_discounts.index.dashboard_link')}", marketing_dashboards_path, class: 'view__dashboard-button' %h1= t('workarea.admin.pricing_discounts.index.page_title') .view__container .browsing-controls.browsing-controls--with-divider.browsing-controls--center{ class: ('browsing-controls--filters-displayed' unless @search.toggle_facets?) } = form_tag pricing_discounts_path, method: 'get', id: 'search_form', class: 'browsing-controls__form' do = facet_hidden_inputs(@search.facets) .browsing-controls__sort .property.property--inline = label_tag 'sort', t('workarea.admin.search.sort_by'), class: 'property__name' = select_tag :sort, options_for_select(@search.sorts, selected: @search.sort), data: { form_submitting_control: '' } .browsing-controls__search .search-form = text_field_tag :q, params[:q], class: 'search-form__input', id: 'search_products', title: t('workarea.admin.search.keywords'), placeholder: t('workarea.admin.search.keywords') = submit_tag 'search_discounts', class: 'search-form__button' = render 'workarea/admin/shared/creation_date', search: @search, form_path: pricing_discounts_path - @search.facets.each do |facet| = render "workarea/admin/facets/#{facet.type}", facet: facet - if @search.toggle_facets? .browsing-controls__toggle-filters %button.text-button{ type: 'button', data: { toggle_filters: '' } }= t('workarea.admin.search.show_filters') = render 'workarea/admin/facets/applied', search: @search, reset_path: pricing_discounts_path %p.browsing-controls__count{ data: { browsing_controls_count: @search.total } } = t('workarea.admin.pricing_discounts.index.discount', count: @search.total) - if @search.results.any? %table.index-table %thead %tr %th.index-table__control-cell .checkbox = check_box_tag 'select_all', nil, false, id: 'select_all', class: 'checkbox__input', data: { bulk_action_select_all: '' } = label_tag 'select_all', t('workarea.admin.bulk_actions.select_all'), class: 'checkbox__label' %th= t('workarea.admin.fields.name') %th= t('workarea.admin.fields.type') %th.align-center= t('workarea.admin.fields.single_use') %th.align-center= t('workarea.admin.fields.allow_sale_items') %th.align-center= t('workarea.admin.fields.redemptions') %th.align-center= t('workarea.admin.fields.insights') %th= t('workarea.admin.fields.updated_at') %tbody - @search.results.each do |result| %tr.index-table__row{ class: ('index-table__row--inactive' unless result.active) } %td.index-table__control-cell .checkbox = check_box_tag 'global_id', result.to_gid_param, false, class: 'checkbox__input', id: dom_id(result), data: { bulk_action_item: '' } = label_tag dom_id(result), '', class: 'checkbox__label', title: t('workarea.admin.bulk_actions.add_summary_button') %td = link_to result.name, pricing_discount_path(result) = upcoming_changesets_icon_for(result) = comments_icon_for(result) = top_icon_for(result) = segments_icon_for(result) %td= result.slug.titleize %td.align-center= t("workarea.admin.#{result.single_use?}") %td.align-center= t("workarea.admin.#{result.allow_sale_items?}") %td.align-center= result.redemptions.size %td.align-center = link_to insights_pricing_discount_path(result), class: 'link link--no-underline' do %span.spark{ title: t('workarea.admin.pricing_discounts.index.sparkline_title') } {#{sparkline_analytics_data_for(result.insights.orders_sparkline).join(',')}} %td= local_time_ago(result.updated_at) - if @search.results.total_pages > 1 = render 'workarea/admin/shared/pagination', collection: @search.results .workflow-bar .grid .grid__cell.grid__cell--50 = render 'workarea/admin/shared/bulk_actions', klass: Workarea::Pricing::Discount, search: @search .grid__cell.grid__cell--50.align-right = link_to t('workarea.admin.pricing_discounts.index.add_new'), create_pricing_discounts_path, id: 'add_discount', class: 'workflow-bar__button workflow-bar__button--create'