{% extends "layouts/mobile_base.twig" %} {% set active_nav = 'shops' %} {% set currency = currency_symbol ?? '€' %} {% set today_date = 'now' | date('Y-m-d') %} {% block title %}{{ shop.name ?? translations.shop ?? 'Shop' }}{% endblock %} {% block page_title %}{{ shop.name ?? translations.shop ?? 'Shop' }}{% endblock %} {% block page_subtitle %}{{ shop.city ?? '' }}{% endblock %} {% block topbar_actions %}
{# ← poprzedni dzień #} {% set prev_date = date | date_modify('-1 day') | date('Y-m-d') %} {% set next_date = date | date_modify('+1 day') | date('Y-m-d') %} {% if next_date <= today_date %} {% else %} {% endif %} {% if date != today_date %} {{ translations.today ?? 'Today' }} {% endif %}
{% endblock %} {% block head %} {% endblock %} {% block content %} {# ──────────────── DANE KONTAKTOWE ──────────────── #} {% if shop is not empty %}
{% if shop.street is defined %}
{{ translations.address ?? 'Address' }}
{{ shop.street }} {{ shop.street_num }}, {{ shop.zip }} {{ shop.city }}
{% endif %} {% if shop.phone is defined %}
{{ translations.phone ?? 'Phone' }}
{{ shop.phone }}
{% endif %} {% if shop.email is defined %}
{{ translations.email ?? 'Email' }}
{{ shop.email }}
{% endif %} {% if shop.opening_hours is defined %}
{{ translations.opening_hours ?? 'Opening hours' }}
{{ shop.opening_hours }} – {{ shop.closing_hours }}
{% endif %} {% if shop.total_employees is defined %}
{{ translations.team_size ?? 'Team size' }}
{{ shop.total_employees }} {{ translations.employees ?? 'employees' }}
{% endif %}
{% endif %} {# ──────────────── ZMIANY DZIENNE — PODSUMOWANIE KASY ──────────────── #} {% set shift_data = shifts ?? {} %} {% set summary = shift_data.summary ?? {} %} {% set shift_list = shift_data.shifts ?? [] %} {% if summary is not empty %}
{{ translations.cash_status ?? 'Cash status' }} · {{ date | date('d.m.Y') }}
{{ summary.total_initial_cash is defined ? summary.total_initial_cash | number_format(2, '.', ' ') : '—' }} {{ currency }}
{{ translations.initial_cash ?? 'Initial cash' }}
{% if summary.all_shifts_closed ?? false %} {{ translations.closed ?? 'Closed' }} {% else %} {{ translations.open ?? 'Open' }} {% endif %}
{% if summary.total_final_cash is not null and summary.total_final_cash is defined %}
{{ translations.final_cash ?? 'Final cash' }}
{{ summary.total_final_cash | number_format(2, '.', ' ') }} {{ currency }}
{% endif %}
{{ (summary.shifts_count ?? 0) }} {{ translations.devices ?? 'devices' }} {% if summary.all_shifts_closed ?? false %} {{ translations.day_closed ?? 'Day closed' }} {% else %} {{ translations.shift_in_progress ?? 'Shift in progress' }} {% endif %}
{% endif %} {# ──────────────── PER URZĄDZENIE ──────────────── #} {% if shift_list | length > 0 %}
{{ translations.per_device ?? 'Per device' }}
{% for shift in shift_list %}
{{ translations.device ?? 'Device' }} #{{ loop.index }} {% if shift.opening_time is defined %} {{ shift.opening_time | date('H:i') }} {% if shift.closing_time %}– {{ shift.closing_time | date('H:i') }}{% endif %} {% endif %}
{% if shift.is_closed %} {{ translations.closed ?? 'Closed' }} {% else %} {{ translations.open ?? 'Open' }} {% endif %}
{{ shift.initial_cash | number_format(2, '.', ' ') }} {{ currency }}
{{ translations.initial_cash ?? 'Initial cash' }}
{% if shift.is_closed and shift.final_cash is defined %}
{{ shift.final_cash | number_format(2, '.', ' ') }} {{ currency }}
{{ translations.final_cash ?? 'Final cash' }}
{% else %}
{{ translations.final_cash ?? 'Final cash' }}
{% endif %} {% if shift.is_closed and shift.left_cash_for_next_day is defined %}
{{ shift.left_cash_for_next_day | number_format(2, '.', ' ') }} {{ currency }}
{{ translations.left_for_next_day ?? 'Left for next day' }}
{% endif %} {% if shift.shift_duration is defined and shift.is_closed %}
{{ shift.shift_duration | slice(0, 5) }}
{{ translations.shift_duration ?? 'Duration' }}
{% endif %}
{{ translations.opened_by ?? 'Opened by' }}: {{ shift.opening_employee }} {% if shift.closing_employee %}  ·  {{ translations.closed_by ?? 'Closed by' }}: {{ shift.closing_employee }} {% endif %}
{% endfor %} {% elseif date is defined %}
{{ translations.no_shifts_for_date ?? 'No shifts recorded for this day.' }}
{% endif %} {# ──────────────── KOSZTY STAŁE MIESIĄCA ──────────────── #}
{{ translations.monthly_costs ?? 'Monthly costs' }} {# month picker #} {% set prev_period = period | date_modify('-1 month') | date('Y-m') %} {% set next_period = period | date_modify('+1 month') | date('Y-m') %} {% set cur_period = 'now' | date('Y-m') %} {{ period }} {% if next_period <= cur_period %} {% else %} {% endif %}
{% set costs_data = costs ?? {} %} {% set cost_items = costs_data.items ?? [] %}
{% if cost_items | length > 0 %} {% for item in cost_items %}
{{ item.cost_name }}
{% if item.description %}
{{ item.description }}
{% endif %}
{{ item.date | date('d.m.Y') }}
{{ item.amount | number_format(2, '.', ' ') }} {{ currency }}
{% endfor %}
{{ translations.total ?? 'Total' }} {{ costs_data.total | number_format(2, '.', ' ') }} {{ currency }}
{% else %}
{{ translations.no_costs_for_period ?? 'No costs recorded for this period.' }}
{% endif %}
{% endblock %}