- @page_title = t('workarea.admin.reports.customers.title') .view .view__header .view__heading = link_to "↑ #{t('workarea.admin.reports.all_reports')}", reports_dashboards_path %h1.heading.heading--no-margin= t('workarea.admin.reports.customers.title') %p= t('workarea.admin.reports.reference_link_html', path: reference_report_path) .view__container .browsing-controls.browsing-controls--with-divider.browsing-controls--center.browsing-controls--filters-displayed = form_tag customers_report_path, method: 'get', class: 'browsing-controls__form' do .browsing-controls__filter .property.property--inline = label_tag 'results_filter', t('workarea.admin.reports.customers.results_filter'), class: 'property__name' = select_tag 'results_filter', options_for_select(customers_report_filter_options, params[:results_filter]), data: { form_submitting_control: '' } .browsing-controls__count = render_reports_results_message(@report) = render 'workarea/admin/reports/export', report: @report %table %thead %tr %th= t('workarea.admin.fields.email') %th= t('workarea.admin.fields.name') %th.align-center= link_to_reports_sorting t('workarea.admin.fields.first_order_at'), report: @report, sort_by: 'first_order_at' %th.align-center= link_to_reports_sorting t('workarea.admin.fields.last_order_at'), report: @report, sort_by: 'last_order_at' %th.align-center= link_to_reports_sorting t('workarea.admin.fields.orders'), report: @report, sort_by: 'orders' %th.align-right= link_to_reports_sorting t('workarea.admin.fields.average_order_value'), report: @report, sort_by: 'average_order_value' %th.align-right= link_to_reports_sorting t('workarea.admin.fields.revenue'), report: @report, sort_by: 'revenue' %tbody - @report.results.each do |result| %tr %td - if result.user.present? = link_to result._id, user_path(result.user) - else = result._id %td - if result.user.present? = link_to result.user.name.presence || t('workarea.admin.reports.unknown'), user_path(result.user) - else = result.name.presence || t('workarea.admin.reports.unknown') %td.align-center= local_time_ago(result.first_order_at) %td.align-center= local_time_ago(result.last_order_at) %td.align-center= number_with_delimiter result.orders %td.align-right= number_to_currency(result.average_order_value) %td.align-right= number_to_currency(result.revenue)