bp/app/Views/organizations/index.twig

109 lines
5.5 KiB
Twig
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends 'layouts/base.twig' %}
{% block content %}
<div class="container" style="max-width: 900px;">
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="mb-0">Мои организации</h4>
<a href="{{ base_url('/organizations/create') }}" class="btn btn-primary">
<i class="fa-solid fa-plus me-2"></i>Создать организацию
</a>
</div>
{% if organizations is empty %}
<div class="card shadow-sm">
<div class="card-body text-center py-5">
<i class="fa-solid fa-building display-1 text-muted mb-3"></i>
<h5 class="text-muted">Организаций пока нет</h5>
<p class="text-muted">Создайте свою первую организацию для начала работы</p>
<a href="{{ base_url('/organizations/create') }}" class="btn btn-primary">
<i class="fa-solid fa-plus me-2"></i>Создать организацию
</a>
</div>
</div>
{% else %}
<div class="row">
{% for org in organizations %}
{# Декодируем JSON реквизиты #}
{% set req = org.requisites ? org.requisites|json_decode : {} %}
<div class="col-md-6 mb-3">
<div class="card shadow-sm h-100 {{ org.id == session.get('active_org_id') ? 'border-primary' : '' }}">
<div class="card-body">
<div class="d-flex justify-content-between align-items-start mb-3">
<div>
<h5 class="card-title mb-1">
{% if org.type == 'personal' %}
<i class="fa-solid fa-user text-info me-2"></i>
{% else %}
<i class="fa-solid fa-building text-primary me-2"></i>
{% endif %}
{{ org.name }}
</h5>
<small class="text-muted">
{% if org.type == 'personal' %}
Личное пространство
{% else %}
{% if req.inn %}ИНН: {{ req.inn }}{% endif %}
{% endif %}
</small>
</div>
{% if org.id == session.get('active_org_id') %}
<span class="badge bg-primary">Активна</span>
{% endif %}
</div>
{# Краткая информация #}
{% if req.phone or req.email %}
<div class="mb-3">
{% if req.phone %}
<small class="d-block text-muted">
<i class="fa-solid fa-phone me-1"></i>{{ req.phone }}
</small>
{% endif %}
{% if req.email %}
<small class="d-block text-muted">
<i class="fa-solid fa-envelope me-1"></i>{{ req.email }}
</small>
{% endif %}
</div>
{% endif %}
<div class="d-flex flex-wrap gap-2">
{# Кнопка выбора/переключения #}
{% if org.id != session.get('active_org_id') %}
<a href="{{ base_url('/organizations/switch/' ~ org.id) }}"
class="btn btn-outline-primary btn-sm">
<i class="fa-solid fa-check me-1"></i>Выбрать
</a>
{% endif %}
{# Кнопка редактирования #}
<a href="{{ base_url('/organizations/edit/' ~ org.id) }}"
class="btn btn-outline-secondary btn-sm">
<i class="fa-solid fa-pen me-1"></i>Ред.
</a>
{# Кнопка удаления (только для бизнес-организаций) #}
{% if org.type == 'business' %}
<a href="{{ base_url('/organizations/delete/' ~ org.id) }}"
class="btn btn-outline-danger btn-sm">
<i class="fa-solid fa-trash me-1"></i>Удалить
</a>
{% endif %}
</div>
</div>
<div class="card-footer bg-transparent text-muted small">
Создана: {{ org.created_at|date('d.m.Y') }}
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{# Статистика #}
<div class="mt-4 text-center text-muted small">
Всего организаций: {{ count }}
</div>
</div>
{% endblock %}