Files
evo-sync/web/templates/catalog_groups.html

109 lines
6.0 KiB
HTML
Raw Normal View History

{% extends "base.html" %}
{% block title %}Группы — {{ store.name }} — EvoSync{% endblock %}
{% block content %}
<nav aria-label="breadcrumb" class="mb-3">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/catalog">Каталог</a></li>
<li class="breadcrumb-item active">{{ store.name }}</li>
</ol>
</nav>
<div class="d-flex align-items-center justify-content-between mb-3">
<h1 class="h4 mb-0">Группы товаров</h1>
<a href="/catalog/export?type=groups&store_id={{ store.evotor_id }}" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-download me-1"></i>Экспорт CSV
</a>
</div>
{% if not groups %}
<div class="text-center py-5 text-muted">
<i class="bi bi-folder fs-1 mb-3 d-block"></i>
<p>Группы не найдены в этом магазине.</p>
<a href="/catalog/products?store_id={{ store.evotor_id }}" class="btn btn-outline-primary btn-sm">
Посмотреть все товары магазина
</a>
</div>
{% else %}
<div class="table-responsive">
<table class="table table-striped table-hover align-middle">
<thead class="table-light">
<tr>
<th>Название</th>
<th>Кол-во товаров</th>
<th>Фильтр</th>
<th></th>
</tr>
</thead>
<tbody>
{% for group in groups %}
{% set mode = filter_map.get(group.evotor_id) %}
<tr>
<td>{{ group.name }}</td>
<td class="text-muted">{{ product_counts.get(group.evotor_id, 0) }}</td>
<td>
{% if mode == "include" %}
<span class="badge bg-success">✓ Включено</span>
{% elif mode == "exclude" %}
<span class="badge bg-danger">✗ Исключено</span>
{% else %}
<span class="badge bg-light text-muted border">— Нет правила</span>
{% endif %}
</td>
<td class="text-end">
<div class="d-flex gap-1 justify-content-end">
<a href="/catalog/products?store_id={{ store.evotor_id }}&group_id={{ group.evotor_id }}"
class="btn btn-outline-secondary btn-sm" title="Товары">
<i class="bi bi-arrow-right"></i>
</a>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown">
<i class="bi bi-funnel"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li>
<form method="post" action="/catalog/filter">
<input type="hidden" name="entity_type" value="group">
<input type="hidden" name="entity_id" value="{{ group.evotor_id }}">
<input type="hidden" name="entity_name" value="{{ group.name }}">
<input type="hidden" name="filter_mode" value="include">
<input type="hidden" name="parent_entity_id" value="{{ store.evotor_id }}">
<input type="hidden" name="redirect_to" value="/catalog/groups?store_id={{ store.evotor_id }}">
<button type="submit" class="dropdown-item">✓ Включить в синхронизацию</button>
</form>
</li>
<li>
<form method="post" action="/catalog/filter">
<input type="hidden" name="entity_type" value="group">
<input type="hidden" name="entity_id" value="{{ group.evotor_id }}">
<input type="hidden" name="entity_name" value="{{ group.name }}">
<input type="hidden" name="filter_mode" value="exclude">
<input type="hidden" name="parent_entity_id" value="{{ store.evotor_id }}">
<input type="hidden" name="redirect_to" value="/catalog/groups?store_id={{ store.evotor_id }}">
<button type="submit" class="dropdown-item">✗ Исключить из синхронизации</button>
</form>
</li>
<li><hr class="dropdown-divider"></li>
<li>
<form method="post" action="/catalog/filter">
<input type="hidden" name="entity_type" value="group">
<input type="hidden" name="entity_id" value="{{ group.evotor_id }}">
<input type="hidden" name="entity_name" value="{{ group.name }}">
<input type="hidden" name="filter_mode" value="none">
<input type="hidden" name="parent_entity_id" value="{{ store.evotor_id }}">
<input type="hidden" name="redirect_to" value="/catalog/groups?store_id={{ store.evotor_id }}">
<button type="submit" class="dropdown-item text-muted">— Убрать правило</button>
</form>
</li>
</ul>
</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endblock %}