{% extends "common/base.html" %}
{% load static i18n purchase django_htmx %}

{% block extrahead %}
    <link rel="stylesheet" href="{% static "purchase/css/reports.css" %}">
{% endblock %}

{% block content %}
    <h1>{% translate "Reports" %}</h1>
    <h2>{% translate "All times" %}</h2>
    <ul>
        <li>{% translate "Total turnover:" %} {{ turnover|currency }}</li>
        <li>{% translate "Average basket:" %} {{ average_basket|currency }}</li>
        <li>{% translate "Number of baskets:" %} {{ basket_count }}</li>
    </ul>

    <h3>{% translate "By day" %}</h3>
    {% include "purchase/snippets/by_day_table.html" %}

    {% if date %}
        <h3>{% translate "By hour" %} <small class="text-muted">{{ date }}</small></h3>
        {% include "purchase/snippets/htmx_plot.html" with url='purchase:by_hour_plot' %}
    {% endif %}

    <h2>{% translate "Products" %} <small class="text-muted">{{ date }}</small></h2>
    {% include "purchase/snippets/report_products.html" %}
    {% include "purchase/snippets/htmx_plot.html" with url='purchase:products_plots' %}

    <h2>{% translate "Turnover by payment method" %} <small class="text-muted">{{ date }}</small></h2>
    {% include "purchase/snippets/report_payment_methods.html" %}

{% endblock %}

{% block extrascript %}
    <script src="{% static 'vendor/htmx-1.8.6/htmx.min.js' %}" defer></script>
    {% django_htmx_script %}
{% endblock %}
