{% extends "layouts/base.twig" %} {% block title %}{{ translations.rms_title }}{% endblock %} {% block head %} {% endblock %} {% block page_heading %}

{{ translations.rms_heading }}

{{ translations.rms_subtitle }}

{{ translations.rms_all_menu ?? 'All Shops' }} {{ translations.analytics_heading }}
{% endblock %} {% block content %} {% include "page_components/messages.twig" %} {# Filter form #}
{% if params.shop is not empty %} {% if sales is empty %}

{{ translations.rms_no_data }}

{% else %} {# KPI summary #} {% set totalQty = 0 %} {% set productCount = sales|length %} {% for row in sales %} {% set totalQty = totalQty + row.total_sold_quantity %} {% endfor %}
{{ translations.rms_kpi_products }}
{{ productCount }}
{{ params.from }} → {{ params.to }}
{# Results table #}
{{ translations.rms_table_title }}
{% set maxQty = sales[0].total_sold_quantity %} {% for row in sales %} {% endfor %}
{{ translations.rms_col_product }} {{ translations.rms_col_sku }} {{ translations.rms_col_material }} {{ translations.rms_col_qty }}
{{ row.catalog_product_name }} {{ row.catalog_product_sku }} {{ row.material_name }} {{ row.total_sold_quantity|number_format(3, '.', ' ')|replace({'.000': '', ',000': ''}) }} {{ row.unit_name }}
{{ maxQty > 0 ? ((row.total_sold_quantity / maxQty) * 100)|round : 0 }}%
{% endif %} {% else %}

{{ translations.rms_select_shop_prompt }}

{% endif %} {% endblock %}