diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb index 79e5176792..92bc138f31 100644 --- a/app/controllers/admin/reports_controller.rb +++ b/app/controllers/admin/reports_controller.rb @@ -30,7 +30,7 @@ module Admin assign_view_data load_form_options - render report_type + render "show" end def assign_view_data @@ -39,6 +39,9 @@ module Admin @report_subtypes = report_class.report_subtypes.map do |subtype| [t("packing.#{subtype}_report", scope: i18n_scope), subtype] end + if @report_type == "packing" + @report_message = I18n.t("spree.admin.reports.customer_names_message.customer_names_tip") + end end def load_form_options diff --git a/app/views/admin/reports/_rendering_options.html.haml b/app/views/admin/reports/_rendering_options.html.haml index 2fb1dc5e1e..a137477034 100644 --- a/app/views/admin/reports/_rendering_options.html.haml +++ b/app/views/admin/reports/_rendering_options.html.haml @@ -1,8 +1,15 @@ +- if @report_subtypes.any? + .row + .alpha.two.columns= label_tag nil, t(:report_type) + .omega.fourteen.columns + = select_tag(:report_subtype, options_for_select(@report_subtypes, @report_subtype)) + .row.rendering-options .alpha.two.columns = label_tag :report_format, t(".generate_report") .omega.fourteen.columns = select_tag :report_format, options_for_select({t('.on_screen') => '', t('.csv_spreadsheet') => 'csv', t('.excel_spreadsheet') => 'xlsx', t('.openoffice_spreadsheet') => 'ods'}) - -#.inline-checkbox - -# = check_box_tag "options[exclude_summaries]", true, params[:options].andand[:exclude_summaries] - -# = label_tag t(".hide_summary_rows") + +-#.inline-checkbox +-# = check_box_tag "options[exclude_summaries]", true, params[:options].andand[:exclude_summaries] +-# = label_tag t(".hide_summary_rows") diff --git a/app/views/admin/reports/_table.html.haml b/app/views/admin/reports/_table.html.haml index 70b2c2e3aa..df47bdd881 100644 --- a/app/views/admin/reports/_table.html.haml +++ b/app/views/admin/reports/_table.html.haml @@ -1,5 +1,5 @@ - if params[:q].present? - %table.report__table{id: id} + %table.report__table %thead %tr - @report.table_headers.each do |heading| diff --git a/app/views/admin/reports/filters/_packing.html.haml b/app/views/admin/reports/filters/_packing.html.haml new file mode 100644 index 0000000000..c7f54750ee --- /dev/null +++ b/app/views/admin/reports/filters/_packing.html.haml @@ -0,0 +1,16 @@ += render partial: 'admin/reports/date_range_form' + +.row + .alpha.two.columns= label_tag nil, t(:report_hubs) + .omega.fourteen.columns + = collection_select("q", "order_distributor_id_in", @distributors, :id, :name, {selected: params.dig(:q, :order_distributor_id_in)}, {class: "select2 fullwidth", multiple: true}) + +.row + .alpha.two.columns= label_tag nil, t(:report_producers) + .omega.fourteen.columns + = select_tag("q[supplier_id_in]", options_from_collection_for_select(@suppliers, :id, :name, params.dig(:q, :supplier_id_in)), {class: "select2 fullwidth", multiple: true}) + +.row + .alpha.two.columns= label_tag nil, t(:report_customers_cycle) + .omega.fourteen.columns + = select_tag("q[order_cycle_id_in]", options_for_select(report_order_cycle_options(@order_cycles), params.dig(:q, :order_cycle_id_in)), {class: "select2 fullwidth", multiple: true}) \ No newline at end of file diff --git a/app/views/admin/reports/packing.html.haml b/app/views/admin/reports/packing.html.haml deleted file mode 100644 index f79c737ee2..0000000000 --- a/app/views/admin/reports/packing.html.haml +++ /dev/null @@ -1,36 +0,0 @@ -= form_tag main_app.admin_reports_path, report_type: 'packing' do - %fieldset.no-border-bottom - %legend{ align: 'center'}= t(:report_filters) - = render partial: 'date_range_form' - - .row - .alpha.two.columns= label_tag nil, t(:report_hubs) - .omega.fourteen.columns - = collection_select("q", "order_distributor_id_in", @distributors, :id, :name, {selected: params.dig(:q, :order_distributor_id_in)}, {class: "select2 fullwidth", multiple: true}) - - .row - .alpha.two.columns= label_tag nil, t(:report_producers) - .omega.fourteen.columns - = select_tag("q[supplier_id_in]", options_from_collection_for_select(@suppliers, :id, :name, params.dig(:q, :supplier_id_in)), {class: "select2 fullwidth", multiple: true}) - - .row - .alpha.two.columns= label_tag nil, t(:report_customers_cycle) - .omega.fourteen.columns - = select_tag("q[order_cycle_id_in]", options_for_select(report_order_cycle_options(@order_cycles), params.dig(:q, :order_cycle_id_in)), {class: "select2 fullwidth", multiple: true}) - - %fieldset - %legend{ align: 'center'}= t(:report_display_options) - .row - .alpha.two.columns= label_tag nil, t(:report_type) - .omega.fourteen.columns - = select_tag(:report_subtype, options_for_select(@report_subtypes, @report_subtype)) - - = render partial: "rendering_options" - - .actions.filter-actions - = button t(:go), "report__submit-btn" - -- if params[:q].present? - = render partial: "spree/admin/reports/customer_names_message" - -= render "table", id: "listing_orders" diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml new file mode 100644 index 0000000000..eb159cde4b --- /dev/null +++ b/app/views/admin/reports/show.html.haml @@ -0,0 +1,16 @@ += form_tag main_app.admin_reports_path, report_type: @report_type do + %fieldset.no-border-bottom + %legend{ align: 'center'}= t(:report_filters) + = render partial: "admin/reports/filters/#{@report_type}" + + %fieldset + %legend{ align: 'center'}= t(:report_render_options) + = render partial: "rendering_options" + + .actions.filter-actions + = button t(:go), "report__submit-btn" + +- if @report_message.present? + %p.report__message= @report_message + += render "table" diff --git a/config/locales/en.yml b/config/locales/en.yml index cae025c8ff..c0dbb1412f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2637,7 +2637,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using report_tax_rates: Tax rates report_tax_types: Tax types report_filters: Report Filters - report_display_options: Display Options + report_render_options: Render Options report_header_order_cycle: Order Cycle report_header_user: User report_header_email: Email