Files
project-managment/templates/pages/projects/project_list.html
T
sankalp 057031ed1b feat(templates/pages): add admin delete actions and UI refinements
- New Features
  - Add delete buttons with confirmation modals for users, expenses, invoices, and tickets
  - Introduce a priority column with styled badges in the ticket list
  - Refactor form fields to a shared partial for cleaner markup
- Enhancements
  - Rename “Creator” to “Assignee” and improve status/priority badge rendering
  - Fix empty‑state colspan and correct broken delete‑modal label closing tag
  - Initialize Quill editor on the ticket detail page
- Bug Fixes
  - Resolve typo in button class name and mismatched table header count
2026-05-28 00:26:59 +05:45

70 lines
4.1 KiB
HTML

{% extends "base_authenticated.html" %}
{% block title %}Projects{% endblock %}
{% block content_inner %}
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-2xl font-bold text-gray-900">Projects</h1>
<p class="text-gray-500 mt-1">Manage and track all your projects.</p>
</div>
<a href="{% url 'project_create' %}" class="btn bg-blue-600 text-white hover:bg-blue-700 border-0">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
New Project
</a>
</div>
<div class="grid grid-cols-1 lg:grid-cols-4 gap-4 mb-6">
{% for s in status_counts %}
<div class="bg-white rounded-xl p-4 shadow-sm border border-gray-100">
<p class="text-sm text-gray-500">{{ s.status|title }}</p>
<p class="text-2xl font-bold text-gray-900">{{ s.count }}</p>
</div>
{% endfor %}
</div>
<div class="grid gap-4">
{% for project in projects %}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 hover:shadow-md transition-shadow">
<div class="p-5">
<div class="flex items-start justify-between">
<div class="flex items-start gap-4">
<div class="w-10 h-10 rounded-xl bg-blue-600 flex items-center justify-center text-white font-bold text-sm flex-shrink-0">
{{ project.name|first|upper }}
</div>
<div>
<a href="{% url 'project_detail' project.pk %}" class="text-lg font-semibold text-gray-900 hover:text-blue-600 transition-colors">{{ project.name }}</a>
<div class="flex items-center gap-3 mt-1">
<span class="text-xs px-2.5 py-1 rounded-full font-medium {% if project.status == 'active' %}bg-green-100 text-green-700{% elif project.status == 'planning' %}bg-blue-100 text-blue-700{% elif project.status == 'review' %}bg-amber-100 text-amber-700{% else %}bg-gray-100 text-gray-700{% endif %}">
{{ project.get_status_display }}
</span>
<span class="text-xs text-gray-500">Client: {{ project.client.username }}</span>
</div>
</div>
</div>
<div class="flex gap-2">
<a href="{% url 'project_detail' project.pk %}" class="btn btn-sm btn-ghost">View</a>
{% if user.is_admin %}
<a href="{% url 'project_edit' project.pk %}" class="btn btn-sm btn-ghost">Edit</a>
<label for="delete-project-{{ project.pk }}" class="btn btn-sm bg-red-50 text-red-600 hover:bg-red-100 border-0">Delete</label>
{% endif %}
</div>
</div>
</div>
</div>
{% empty %}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-12 text-center">
<svg class="w-12 h-12 text-gray-300 mx-auto mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg>
<p class="text-gray-500">No projects yet.</p>
<a href="{% url 'project_create' %}" class="btn bg-blue-600 text-white hover:bg-blue-700 border-0 mt-3">Create your first project</a>
</div>
{% endfor %}
</div>
{% if user.is_admin %}
{% for project in projects %}
{% with project_id=project.pk|stringformat:"s" %}
{% url 'project_delete' project.pk as delete_url %}
{% include "components/delete_modal.html" with modal_id="delete-project-"|add:project_id title="Delete Project" message="Are you sure you want to delete this project? This action cannot be undone." delete_url=delete_url %}
{% endwith %}
{% endfor %}
{% endif %}
{% endblock %}