HH/templates/projects/template_list.html
2026-03-09 16:10:24 +03:00

97 lines
4.8 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% block title %}{% trans "Project Templates" %} - PX360{% endblock %}
{% block content %}
<!-- Header -->
<header class="mb-6">
<div class="flex justify-between items-start">
<div>
<h1 class="text-2xl font-bold text-navy flex items-center gap-3">
<i data-lucide="layout-template" class="w-6 h-6"></i>
{% trans "Project Templates" %}
</h1>
<p class="text-sm text-slate mt-1">{% trans "Reusable templates for quality improvement projects" %}</p>
</div>
<div class="flex items-center gap-3">
<a href="{% url 'projects:project_list' %}" class="bg-white text-blue border-2 border-blue/30 px-4 py-2 rounded-xl text-sm font-bold hover:bg-blue hover:text-white flex items-center gap-2 transition">
<i data-lucide="kanban" class="w-4 h-4"></i> {% trans "View Projects" %}
</a>
{% if can_create %}
<a href="{% url 'projects:template_create' %}" class="bg-navy text-white px-4 py-2 rounded-xl text-sm font-bold shadow-lg shadow-navy/20 hover:bg-blue flex items-center gap-2 transition">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "New Template" %}
</a>
{% endif %}
</div>
</div>
</header>
<!-- Templates Grid -->
{% if templates %}
<div class="grid grid-cols-3 gap-6">
{% for template in templates %}
<div class="bg-white rounded-2xl border shadow-sm overflow-hidden hover:shadow-md transition-shadow">
<div class="p-6">
<div class="flex items-start justify-between mb-3">
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-blue/10 rounded-xl flex items-center justify-center">
<i data-lucide="layout-template" class="w-5 h-5 text-blue"></i>
</div>
<div>
<h3 class="font-bold text-navy">{{ template.name }}</h3>
{% if template.is_active %}
<span class="text-[10px] font-bold text-green-600 uppercase">{% trans "Active" %}</span>
{% else %}
<span class="text-[10px] font-bold text-slate uppercase">{% trans "Inactive" %}</span>
{% endif %}
</div>
</div>
</div>
{% if template.description %}
<p class="text-xs text-slate mb-4 line-clamp-2">{{ template.description }}</p>
{% endif %}
<div class="flex items-center gap-4 text-xs text-slate mb-4">
<span class="flex items-center gap-1">
<i data-lucide="check-square" class="w-3 h-3"></i>
{{ template.tasks.count }} {% trans "tasks" %}
</span>
<span class="flex items-center gap-1">
<i data-lucide="calendar" class="w-3 h-3"></i>
{{ template.created_at|date:"M d, Y" }}
</span>
</div>
<div class="flex items-center gap-2 pt-4 border-t">
{% if can_edit %}
<a href="{% url 'projects:template_detail' pk=template.pk %}" class="flex-1 bg-blue/10 text-blue text-center px-3 py-2 rounded-lg text-xs font-bold hover:bg-blue/20 transition">
{% trans "View" %}
</a>
{% else %}
<a href="{% url 'projects:template_detail' pk=template.pk %}" class="flex-1 bg-slate-100 text-slate text-center px-3 py-2 rounded-lg text-xs font-bold hover:bg-slate-200 transition">
{% trans "View" %}
</a>
{% endif %}
<a href="{% url 'projects:project_create_from_template' template_pk=template.pk %}" class="flex-1 bg-navy text-white text-center px-3 py-2 rounded-lg text-xs font-bold hover:bg-blue transition">
{% trans "Use" %}
</a>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="bg-white rounded-2xl border shadow-sm p-12 text-center">
<i data-lucide="layout-template" class="w-16 h-16 mx-auto text-slate-300 mb-4"></i>
<h3 class="text-lg font-bold text-navy mb-2">{% trans "No Templates Yet" %}</h3>
<p class="text-sm text-slate mb-6">{% trans "Create templates to quickly start new quality improvement projects" %}</p>
{% if can_create %}
<a href="{% url 'projects:template_create' %}" class="bg-navy text-white px-5 py-2.5 rounded-xl text-sm font-bold shadow-lg shadow-navy/20 hover:bg-blue inline-flex items-center gap-2 transition">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Create First Template" %}
</a>
{% endif %}
</div>
{% endif %}
{% endblock %}