~homeworkprod/byceps

cfe1e06e749d964c5037db799c79bd1a0f844c74 — Jochen Kupperschmidt a month ago 4c94629
Display number of open orders per shop on global admin dashboard
M byceps/blueprints/admin/dashboard/templates/admin/dashboard/_active_shops.html => byceps/blueprints/admin/dashboard/templates/admin/dashboard/_active_shops.html +5 -2
@@ 8,10 8,13 @@

<div class="grid">

{%- if active_shops %}
  {%- for shop in active_shops %}
{%- if active_shops_with_open_orders_counts %}
  {%- for shop, open_orders_count in active_shops_with_open_orders_counts %}
    {%- call render_cell(href=url_for('shop_shop_admin.view', shop_id=shop.id)) %}
  <div>{{ shop.title }}</div>
      {%- if open_orders_count %}
      <div style="font-size: 0.6875rem; margin-top: 1rem;"><strong style="color: #ee3322;">{{ open_orders_count }}</strong> offene Bestellungen</div>
      {%- endif %}
    {%- endcall %}
  {%- endfor %}
{%- else %}

M byceps/blueprints/admin/dashboard/views.py => byceps/blueprints/admin/dashboard/views.py +6 -1
@@ 24,6 24,7 @@ from ....services.seating import (
    area_service as seating_area_service,
    seat_service,
)
from ....services.shop.order import service as shop_order_service
from ....services.shop.shop import service as shop_service
from ....services.site import service as site_service
from ....services.ticketing import ticket_service


@@ 59,6 60,10 @@ def view_global():
    ]

    active_shops = shop_service.get_active_shops()
    active_shops_with_open_orders_counts = [
        (shop, shop_order_service.count_open_orders(shop.id))
        for shop in active_shops
    ]

    brands = brand_service.get_all_brands()
    party_count = party_service.count_parties()


@@ 82,7 87,7 @@ def view_global():
    return {
        'current_sites': current_sites,
        'active_parties_with_ticket_stats': active_parties_with_ticket_stats,
        'active_shops': active_shops,
        'active_shops_with_open_orders_counts': active_shops_with_open_orders_counts,

        'brands': brands,
        'party_count': party_count,