1160 lines
38 KiB
HTML
1160 lines
38 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static %}
|
|
|
|
{% block title %}Quality Projects Management{% endblock %}
|
|
|
|
{% block css %}
|
|
<link href="{% static 'plugins/datatables.net-bs5/css/dataTables.bootstrap5.min.css' %}" rel="stylesheet" />
|
|
<link href="{% static 'plugins/datatables.net-responsive-bs5/css/responsive.bootstrap5.min.css' %}" rel="stylesheet" />
|
|
<link href="{% static 'plugins/datatables.net-buttons-bs5/css/buttons.bootstrap5.min.css' %}" rel="stylesheet" />
|
|
<style>
|
|
.page-header-section {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
border-radius: 0.5rem;
|
|
padding: 2rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.stats-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.stat-card {
|
|
background: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1.5rem;
|
|
text-align: center;
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.stat-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.stat-card::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 3px;
|
|
background: var(--card-color);
|
|
}
|
|
|
|
.stat-icon {
|
|
width: 50px;
|
|
height: 50px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 1rem;
|
|
color: white;
|
|
font-size: 1.25rem;
|
|
}
|
|
|
|
.stat-number {
|
|
font-size: 2rem;
|
|
font-weight: bold;
|
|
color: #495057;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.stat-label {
|
|
color: #6c757d;
|
|
font-size: 0.875rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.filters-section {
|
|
background: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.filter-row {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1rem;
|
|
align-items: end;
|
|
}
|
|
|
|
.projects-table-section {
|
|
background: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.section-header {
|
|
background: #f8f9fa;
|
|
border-bottom: 1px solid #dee2e6;
|
|
padding: 1rem 1.5rem;
|
|
font-weight: 600;
|
|
color: #495057;
|
|
display: flex;
|
|
justify-content: between;
|
|
align-items: center;
|
|
}
|
|
|
|
.project-card {
|
|
background: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1.5rem;
|
|
margin-bottom: 1rem;
|
|
transition: all 0.2s;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.project-card:hover {
|
|
border-color: #007bff;
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.project-header {
|
|
display: flex;
|
|
justify-content: between;
|
|
align-items: start;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.project-title {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: #495057;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.project-id {
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
font-family: monospace;
|
|
}
|
|
|
|
.project-status {
|
|
padding: 0.375rem 0.75rem;
|
|
border-radius: 0.25rem;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.status-planning { background: #e3f2fd; color: #1976d2; }
|
|
.status-active { background: #e8f5e8; color: #2e7d32; }
|
|
.status-on-hold { background: #fff3e0; color: #f57c00; }
|
|
.status-completed { background: #f3e5f5; color: #7b1fa2; }
|
|
.status-cancelled { background: #ffebee; color: #d32f2f; }
|
|
|
|
.project-description {
|
|
color: #6c757d;
|
|
margin-bottom: 1rem;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.project-meta {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
gap: 1rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.meta-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.meta-icon {
|
|
color: #007bff;
|
|
width: 16px;
|
|
}
|
|
|
|
.project-progress {
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.progress-header {
|
|
display: flex;
|
|
justify-content: between;
|
|
align-items: center;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.progress-label {
|
|
font-size: 0.875rem;
|
|
font-weight: 600;
|
|
color: #495057;
|
|
}
|
|
|
|
.progress-percentage {
|
|
font-size: 0.875rem;
|
|
color: #007bff;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.progress-bar-container {
|
|
background: #e9ecef;
|
|
border-radius: 0.25rem;
|
|
height: 8px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-bar {
|
|
background: linear-gradient(90deg, #007bff, #0056b3);
|
|
height: 100%;
|
|
transition: width 0.3s ease;
|
|
border-radius: 0.25rem;
|
|
}
|
|
|
|
.project-team {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.team-avatars {
|
|
display: flex;
|
|
gap: -0.5rem;
|
|
}
|
|
|
|
.team-avatar {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 50%;
|
|
background: #007bff;
|
|
color: white;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
border: 2px solid white;
|
|
margin-left: -0.5rem;
|
|
}
|
|
|
|
.team-avatar:first-child {
|
|
margin-left: 0;
|
|
}
|
|
|
|
.team-count {
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
margin-left: 0.5rem;
|
|
}
|
|
|
|
.project-actions {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
justify-content: end;
|
|
}
|
|
|
|
.btn-action {
|
|
padding: 0.375rem 0.75rem;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.25rem;
|
|
background: white;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
font-size: 0.875rem;
|
|
text-decoration: none;
|
|
color: #495057;
|
|
}
|
|
|
|
.btn-action:hover {
|
|
border-color: #007bff;
|
|
color: #007bff;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-primary-action {
|
|
background: #007bff;
|
|
border-color: #007bff;
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary-action:hover {
|
|
background: #0056b3;
|
|
border-color: #0056b3;
|
|
color: white;
|
|
}
|
|
|
|
.quick-filters {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
margin-bottom: 1rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.quick-filter {
|
|
padding: 0.5rem 1rem;
|
|
border: 1px solid #dee2e6;
|
|
background: white;
|
|
border-radius: 0.25rem;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
font-size: 0.875rem;
|
|
text-decoration: none;
|
|
color: #495057;
|
|
}
|
|
|
|
.quick-filter:hover, .quick-filter.active {
|
|
background: #007bff;
|
|
color: white;
|
|
border-color: #007bff;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.priority-badge {
|
|
padding: 0.25rem 0.5rem;
|
|
border-radius: 0.25rem;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.priority-low { background: #e8f5e8; color: #2e7d32; }
|
|
.priority-medium { background: #fff3e0; color: #f57c00; }
|
|
.priority-high { background: #ffebee; color: #d32f2f; }
|
|
.priority-critical { background: #f3e5f5; color: #7b1fa2; }
|
|
|
|
.project-timeline {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.timeline-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.timeline-dot {
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
background: #dee2e6;
|
|
}
|
|
|
|
.timeline-dot.active {
|
|
background: #007bff;
|
|
}
|
|
|
|
.timeline-dot.completed {
|
|
background: #28a745;
|
|
}
|
|
|
|
.view-toggle {
|
|
display: flex;
|
|
gap: 0.25rem;
|
|
background: #f8f9fa;
|
|
border-radius: 0.25rem;
|
|
padding: 0.25rem;
|
|
}
|
|
|
|
.toggle-btn {
|
|
padding: 0.5rem 1rem;
|
|
border: none;
|
|
background: transparent;
|
|
border-radius: 0.25rem;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.toggle-btn.active {
|
|
background: white;
|
|
color: #007bff;
|
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.bulk-actions {
|
|
background: #f8f9fa;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.375rem;
|
|
padding: 1rem;
|
|
margin-bottom: 1rem;
|
|
display: none;
|
|
}
|
|
|
|
.bulk-actions.show {
|
|
display: block;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.page-header-section {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.stats-cards {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
|
|
.filter-row {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.project-header {
|
|
flex-direction: column;
|
|
align-items: start;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.project-meta {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.project-actions {
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
}
|
|
|
|
.quick-filters {
|
|
justify-content: center;
|
|
}
|
|
}
|
|
|
|
@media print {
|
|
.filters-section, .bulk-actions, .project-actions {
|
|
display: none !important;
|
|
}
|
|
|
|
.section-header {
|
|
background: none;
|
|
border-bottom: 2px solid #000;
|
|
color: #000;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div id="content" class="app-content">
|
|
<!-- Page Header -->
|
|
<div class="d-flex align-items-center mb-3">
|
|
<div>
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="{% url 'core:dashboard' %}">Dashboard</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'quality:dashboard' %}">Quality</a></li>
|
|
<li class="breadcrumb-item active">Projects</li>
|
|
</ol>
|
|
<h1 class="page-header mb-0">
|
|
<i class="fas fa-project-diagram me-2"></i>Quality Projects
|
|
</h1>
|
|
</div>
|
|
<div class="ms-auto">
|
|
<button type="button" class="btn btn-outline-secondary me-2" onclick="exportProjects()">
|
|
<i class="fas fa-download me-1"></i>Export
|
|
</button>
|
|
<button type="button" class="btn btn-outline-info me-2" onclick="importProjects()">
|
|
<i class="fas fa-upload me-1"></i>Import
|
|
</button>
|
|
<a href="{% url 'quality:improvement_project_create' %}" class="btn btn-primary">
|
|
<i class="fas fa-plus me-1"></i>New Project
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Statistics Cards -->
|
|
<div class="stats-cards">
|
|
<div class="stat-card" style="--card-color: #007bff;">
|
|
<div class="stat-icon" style="background: #007bff;">
|
|
<i class="fas fa-project-diagram"></i>
|
|
</div>
|
|
<div class="stat-number">{{ stats.total_projects|default:0 }}</div>
|
|
<div class="stat-label">Total Projects</div>
|
|
</div>
|
|
|
|
<div class="stat-card" style="--card-color: #28a745;">
|
|
<div class="stat-icon" style="background: #28a745;">
|
|
<i class="fas fa-play"></i>
|
|
</div>
|
|
<div class="stat-number">{{ stats.active_projects|default:0 }}</div>
|
|
<div class="stat-label">Active</div>
|
|
</div>
|
|
|
|
<div class="stat-card" style="--card-color: #ffc107;">
|
|
<div class="stat-icon" style="background: #ffc107;">
|
|
<i class="fas fa-pause"></i>
|
|
</div>
|
|
<div class="stat-number">{{ stats.on_hold_projects|default:0 }}</div>
|
|
<div class="stat-label">On Hold</div>
|
|
</div>
|
|
|
|
<div class="stat-card" style="--card-color: #17a2b8;">
|
|
<div class="stat-icon" style="background: #17a2b8;">
|
|
<i class="fas fa-check-circle"></i>
|
|
</div>
|
|
<div class="stat-number">{{ stats.completed_projects|default:0 }}</div>
|
|
<div class="stat-label">Completed</div>
|
|
</div>
|
|
|
|
<div class="stat-card" style="--card-color: #6f42c1;">
|
|
<div class="stat-icon" style="background: #6f42c1;">
|
|
<i class="fas fa-calendar"></i>
|
|
</div>
|
|
<div class="stat-number">{{ stats.overdue_projects|default:0 }}</div>
|
|
<div class="stat-label">Overdue</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Quick Filters -->
|
|
<div class="quick-filters">
|
|
<a href="?status=all" class="quick-filter {% if not request.GET.status or request.GET.status == 'all' %}active{% endif %}">
|
|
<i class="fas fa-list me-1"></i>All Projects
|
|
</a>
|
|
<a href="?status=active" class="quick-filter {% if request.GET.status == 'active' %}active{% endif %}">
|
|
<i class="fas fa-play me-1"></i>Active
|
|
</a>
|
|
<a href="?status=planning" class="quick-filter {% if request.GET.status == 'planning' %}active{% endif %}">
|
|
<i class="fas fa-clipboard-list me-1"></i>Planning
|
|
</a>
|
|
<a href="?status=on-hold" class="quick-filter {% if request.GET.status == 'on-hold' %}active{% endif %}">
|
|
<i class="fas fa-pause me-1"></i>On Hold
|
|
</a>
|
|
<a href="?status=completed" class="quick-filter {% if request.GET.status == 'completed' %}active{% endif %}">
|
|
<i class="fas fa-check me-1"></i>Completed
|
|
</a>
|
|
<a href="?priority=high" class="quick-filter {% if request.GET.priority == 'high' %}active{% endif %}">
|
|
<i class="fas fa-exclamation-triangle me-1"></i>High Priority
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Filters Section -->
|
|
<div class="filters-section">
|
|
<h6 class="mb-3">
|
|
<i class="fas fa-filter me-2"></i>Advanced Filters
|
|
</h6>
|
|
|
|
<form method="get" id="filter-form">
|
|
<div class="filter-row">
|
|
<div>
|
|
<label class="form-label">Project Name</label>
|
|
<input type="text" class="form-control" name="search"
|
|
value="{{ request.GET.search }}" placeholder="Search projects...">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="form-label">Status</label>
|
|
<select class="form-select" name="status">
|
|
<option value="">All Statuses</option>
|
|
<option value="planning" {% if request.GET.status == 'planning' %}selected{% endif %}>Planning</option>
|
|
<option value="active" {% if request.GET.status == 'active' %}selected{% endif %}>Active</option>
|
|
<option value="on-hold" {% if request.GET.status == 'on-hold' %}selected{% endif %}>On Hold</option>
|
|
<option value="completed" {% if request.GET.status == 'completed' %}selected{% endif %}>Completed</option>
|
|
<option value="cancelled" {% if request.GET.status == 'cancelled' %}selected{% endif %}>Cancelled</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="form-label">Priority</label>
|
|
<select class="form-select" name="priority">
|
|
<option value="">All Priorities</option>
|
|
<option value="low" {% if request.GET.priority == 'low' %}selected{% endif %}>Low</option>
|
|
<option value="medium" {% if request.GET.priority == 'medium' %}selected{% endif %}>Medium</option>
|
|
<option value="high" {% if request.GET.priority == 'high' %}selected{% endif %}>High</option>
|
|
<option value="critical" {% if request.GET.priority == 'critical' %}selected{% endif %}>Critical</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="form-label">Department</label>
|
|
<select class="form-select" name="department">
|
|
<option value="">All Departments</option>
|
|
{% for dept in departments %}
|
|
<option value="{{ dept.id }}" {% if request.GET.department == dept.id|stringformat:"s" %}selected{% endif %}>
|
|
{{ dept.name }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="form-label">Project Manager</label>
|
|
<select class="form-select" name="manager">
|
|
<option value="">All Managers</option>
|
|
{% for manager in managers %}
|
|
<option value="{{ manager.id }}" {% if request.GET.manager == manager.id|stringformat:"s" %}selected{% endif %}>
|
|
{{ manager.get_full_name }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="fas fa-search me-1"></i>Filter
|
|
</button>
|
|
<a href="{% url 'quality:improvement_project_list' %}" class="btn btn-outline-secondary ms-2">
|
|
<i class="fas fa-times me-1"></i>Clear
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Bulk Actions -->
|
|
<div class="bulk-actions" id="bulk-actions">
|
|
<div class="d-flex align-items-center justify-content-between">
|
|
<div>
|
|
<span id="selected-count">0</span> projects selected
|
|
</div>
|
|
<div>
|
|
<button type="button" class="btn btn-outline-primary btn-sm me-2" onclick="bulkExport()">
|
|
<i class="fas fa-download me-1"></i>Export Selected
|
|
</button>
|
|
<button type="button" class="btn btn-outline-info btn-sm me-2" onclick="bulkStatusUpdate()">
|
|
<i class="fas fa-edit me-1"></i>Update Status
|
|
</button>
|
|
<button type="button" class="btn btn-outline-warning btn-sm me-2" onclick="bulkArchive()">
|
|
<i class="fas fa-archive me-1"></i>Archive Selected
|
|
</button>
|
|
<button type="button" class="btn btn-outline-danger btn-sm" onclick="bulkDelete()">
|
|
<i class="fas fa-trash me-1"></i>Delete Selected
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Projects Section -->
|
|
<div class="projects-table-section">
|
|
<div class="section-header">
|
|
<div>
|
|
<i class="fas fa-project-diagram me-2"></i>Quality Projects ({{ projects|length }})
|
|
</div>
|
|
<div class="d-flex align-items-center gap-2">
|
|
<div class="view-toggle">
|
|
<button type="button" class="toggle-btn active" onclick="setView('cards')" data-view="cards">
|
|
<i class="fas fa-th-large"></i>
|
|
</button>
|
|
<button type="button" class="toggle-btn" onclick="setView('table')" data-view="table">
|
|
<i class="fas fa-table"></i>
|
|
</button>
|
|
</div>
|
|
<div class="form-check form-switch">
|
|
<input class="form-check-input" type="checkbox" id="select-all">
|
|
<label class="form-check-label" for="select-all">Select All</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="p-3" id="projects-container">
|
|
{% for project in projects %}
|
|
<div class="project-card" onclick="viewProject({{ project.id }})">
|
|
<div class="form-check position-absolute" style="top: 1rem; left: 1rem;">
|
|
<input class="form-check-input project-checkbox" type="checkbox" value="{{ project.id }}" onclick="event.stopPropagation();">
|
|
</div>
|
|
|
|
<div class="project-header">
|
|
<div>
|
|
<div class="project-title">{{ project.name }}</div>
|
|
<div class="project-id">ID: {{ project.project_id|default:project.id }}</div>
|
|
</div>
|
|
<div class="d-flex align-items-center gap-2">
|
|
<span class="priority-badge priority-{{ project.priority|lower }}">
|
|
{{ project.get_priority_display }}
|
|
</span>
|
|
<span class="project-status status-{{ project.status }}">
|
|
{{ project.get_status_display }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="project-description">
|
|
{{ project.description|truncatechars:150 }}
|
|
</div>
|
|
|
|
<div class="project-meta">
|
|
<div class="meta-item">
|
|
<i class="fas fa-user meta-icon"></i>
|
|
<span>{{ project.manager.get_full_name|default:"Unassigned" }}</span>
|
|
</div>
|
|
<div class="meta-item">
|
|
<i class="fas fa-building meta-icon"></i>
|
|
<span>{{ project.department.name|default:"No Department" }}</span>
|
|
</div>
|
|
<div class="meta-item">
|
|
<i class="fas fa-calendar-alt meta-icon"></i>
|
|
<span>{{ project.start_date|date:"M d, Y"|default:"Not set" }}</span>
|
|
</div>
|
|
<div class="meta-item">
|
|
<i class="fas fa-calendar-check meta-icon"></i>
|
|
<span>{{ project.end_date|date:"M d, Y"|default:"Not set" }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
{% if project.progress is not None %}
|
|
<div class="project-progress">
|
|
<div class="progress-header">
|
|
<span class="progress-label">Progress</span>
|
|
<span class="progress-percentage">{{ project.progress }}%</span>
|
|
</div>
|
|
<div class="progress-bar-container">
|
|
<div class="progress-bar" style="width: {{ project.progress }}%;"></div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if project.team_members.exists %}
|
|
<div class="project-team">
|
|
<div class="team-avatars">
|
|
{% for member in project.team_members.all|slice:":5" %}
|
|
<div class="team-avatar" title="{{ member.get_full_name }}">
|
|
{{ member.first_name.0|upper }}{{ member.last_name.0|upper }}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% if project.team_members.count > 5 %}
|
|
<span class="team-count">+{{ project.team_members.count|add:"-5" }} more</span>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="project-timeline">
|
|
<div class="timeline-item">
|
|
<div class="timeline-dot {% if project.status != 'planning' %}completed{% endif %}"></div>
|
|
<span>Planning</span>
|
|
</div>
|
|
<div class="timeline-item">
|
|
<div class="timeline-dot {% if project.status == 'active' %}active{% elif project.status == 'completed' %}completed{% endif %}"></div>
|
|
<span>Execution</span>
|
|
</div>
|
|
<div class="timeline-item">
|
|
<div class="timeline-dot {% if project.status == 'completed' %}completed{% endif %}"></div>
|
|
<span>Completion</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="project-actions">
|
|
<a href="{% url 'quality:project_detail' project.id %}" class="btn-action" onclick="event.stopPropagation();">
|
|
<i class="fas fa-eye me-1"></i>View
|
|
</a>
|
|
{% if project.can_edit %}
|
|
<a href="{% url 'quality:project_edit' project.id %}" class="btn-action" onclick="event.stopPropagation();">
|
|
<i class="fas fa-edit me-1"></i>Edit
|
|
</a>
|
|
{% endif %}
|
|
<button type="button" class="btn-action" onclick="event.stopPropagation(); generateReport({{ project.id }});">
|
|
<i class="fas fa-file-alt me-1"></i>Report
|
|
</button>
|
|
{% if project.status == 'planning' %}
|
|
<button type="button" class="btn-primary-action" onclick="event.stopPropagation(); startProject({{ project.id }});">
|
|
<i class="fas fa-play me-1"></i>Start
|
|
</button>
|
|
{% elif project.status == 'active' %}
|
|
<button type="button" class="btn-action" onclick="event.stopPropagation(); completeProject({{ project.id }});">
|
|
<i class="fas fa-check me-1"></i>Complete
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% empty %}
|
|
<div class="text-center py-5">
|
|
<div class="text-muted">
|
|
<i class="fas fa-project-diagram fa-3x mb-3"></i>
|
|
<h5>No Quality Projects Found</h5>
|
|
<p>No projects match your current filters.</p>
|
|
<a href="{% url 'quality:improvement_project_create' %}" class="btn btn-primary">
|
|
<i class="fas fa-plus me-1"></i>Create First Project
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if is_paginated %}
|
|
<div class="d-flex justify-content-between align-items-center p-3">
|
|
<div class="text-muted">
|
|
Showing {{ projects|length }} of {{ total_projects }} projects
|
|
</div>
|
|
|
|
<nav aria-label="Projects pagination">
|
|
<ul class="pagination pagination-sm mb-0">
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page=1{{ request.GET.urlencode }}">First</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{{ request.GET.urlencode }}">Previous</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
<li class="page-item active">
|
|
<span class="page-link">{{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
|
|
</li>
|
|
|
|
{% if page_obj.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.next_page_number }}{{ request.GET.urlencode }}">Next</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{{ request.GET.urlencode }}">Last</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Status Update Modal -->
|
|
<div class="modal fade" id="statusModal" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">
|
|
<i class="fas fa-edit me-2"></i>Update Project Status
|
|
</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label">New Status</label>
|
|
<select class="form-select" id="new-status">
|
|
<option value="planning">Planning</option>
|
|
<option value="active">Active</option>
|
|
<option value="on-hold">On Hold</option>
|
|
<option value="completed">Completed</option>
|
|
<option value="cancelled">Cancelled</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Status Change Reason</label>
|
|
<textarea class="form-control" id="status-reason" rows="3"
|
|
placeholder="Please provide a reason for this status change..."></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">
|
|
<i class="fas fa-times me-1"></i>Cancel
|
|
</button>
|
|
<button type="button" class="btn btn-primary" onclick="confirmStatusUpdate()">
|
|
<i class="fas fa-save me-1"></i>Update Status
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script src="{% static 'plugins/datatables.net/js/dataTables.min.js' %}"></script>
|
|
<script src="{% static 'plugins/datatables.net-bs5/js/dataTables.bootstrap5.min.js' %}"></script>
|
|
<script src="{% static 'plugins/datatables.net-responsive-bs5/js/responsive.bootstrap5.min.js' %}"></script>
|
|
<script src="{% static 'plugins/datatables.net-buttons-bs5/js/buttons.bootstrap5.min.js' %}"></script>
|
|
|
|
<script>
|
|
let selectedProjects = [];
|
|
|
|
$(document).ready(function() {
|
|
// Handle select all checkbox
|
|
$('#select-all').change(function() {
|
|
$('.project-checkbox').prop('checked', this.checked);
|
|
updateBulkActions();
|
|
});
|
|
|
|
// Handle individual checkboxes
|
|
$('.project-checkbox').change(function() {
|
|
updateBulkActions();
|
|
|
|
// Update select all checkbox
|
|
const totalCheckboxes = $('.project-checkbox').length;
|
|
const checkedCheckboxes = $('.project-checkbox:checked').length;
|
|
$('#select-all').prop('checked', totalCheckboxes === checkedCheckboxes);
|
|
});
|
|
});
|
|
|
|
function updateBulkActions() {
|
|
const selectedCount = $('.project-checkbox:checked').length;
|
|
$('#selected-count').text(selectedCount);
|
|
|
|
if (selectedCount > 0) {
|
|
$('#bulk-actions').addClass('show');
|
|
} else {
|
|
$('#bulk-actions').removeClass('show');
|
|
}
|
|
|
|
selectedProjects = $('.project-checkbox:checked').map(function() {
|
|
return this.value;
|
|
}).get();
|
|
}
|
|
|
|
function setView(viewType) {
|
|
$('.toggle-btn').removeClass('active');
|
|
$(`[data-view="${viewType}"]`).addClass('active');
|
|
|
|
// In a real implementation, this would switch between card and table views
|
|
if (viewType === 'table') {
|
|
// Convert to table view
|
|
showAlert('Table view activated', 'info');
|
|
} else {
|
|
// Convert to card view
|
|
showAlert('Card view activated', 'info');
|
|
}
|
|
}
|
|
|
|
function viewProject(projectId) {
|
|
window.location.href = `/quality/projects/${projectId}/`;
|
|
}
|
|
|
|
function startProject(projectId) {
|
|
if (confirm('Are you sure you want to start this project?')) {
|
|
fetch(`/quality/projects/${projectId}/start/`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]').value
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
showAlert('Project started successfully', 'success');
|
|
setTimeout(() => location.reload(), 1500);
|
|
} else {
|
|
showAlert('Error starting project', 'danger');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showAlert('Error starting project', 'danger');
|
|
});
|
|
}
|
|
}
|
|
|
|
function completeProject(projectId) {
|
|
if (confirm('Are you sure you want to mark this project as completed?')) {
|
|
fetch(`/quality/projects/${projectId}/complete/`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]').value
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
showAlert('Project completed successfully', 'success');
|
|
setTimeout(() => location.reload(), 1500);
|
|
} else {
|
|
showAlert('Error completing project', 'danger');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showAlert('Error completing project', 'danger');
|
|
});
|
|
}
|
|
}
|
|
|
|
function generateReport(projectId) {
|
|
window.open(`/quality/projects/${projectId}/report/`, '_blank');
|
|
}
|
|
|
|
function exportProjects() {
|
|
const selectedProjects = $('.project-checkbox:checked').map(function() {
|
|
return this.value;
|
|
}).get();
|
|
|
|
let url = '/quality/projects/export/';
|
|
if (selectedProjects.length > 0) {
|
|
url += '?projects=' + selectedProjects.join(',');
|
|
}
|
|
|
|
window.open(url, '_blank');
|
|
}
|
|
|
|
function importProjects() {
|
|
// Create file input for importing projects
|
|
const input = document.createElement('input');
|
|
input.type = 'file';
|
|
input.accept = '.csv,.xlsx';
|
|
input.onchange = function(e) {
|
|
const file = e.target.files[0];
|
|
if (file) {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
|
|
fetch('/quality/projects/import/', {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]').value
|
|
},
|
|
body: formData
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
showAlert(`${data.imported_count} projects imported successfully`, 'success');
|
|
setTimeout(() => location.reload(), 1500);
|
|
} else {
|
|
showAlert('Error importing projects: ' + (data.error || 'Unknown error'), 'danger');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showAlert('Error importing projects', 'danger');
|
|
});
|
|
}
|
|
};
|
|
input.click();
|
|
}
|
|
|
|
function bulkExport() {
|
|
if (selectedProjects.length === 0) {
|
|
showAlert('Please select projects to export', 'warning');
|
|
return;
|
|
}
|
|
|
|
const url = '/quality/projects/export/?projects=' + selectedProjects.join(',');
|
|
window.open(url, '_blank');
|
|
}
|
|
|
|
function bulkStatusUpdate() {
|
|
if (selectedProjects.length === 0) {
|
|
showAlert('Please select projects to update', 'warning');
|
|
return;
|
|
}
|
|
|
|
new bootstrap.Modal(document.getElementById('statusModal')).show();
|
|
}
|
|
|
|
function confirmStatusUpdate() {
|
|
const newStatus = document.getElementById('new-status').value;
|
|
const reason = document.getElementById('status-reason').value;
|
|
|
|
if (!reason.trim()) {
|
|
showAlert('Please provide a reason for the status change', 'warning');
|
|
return;
|
|
}
|
|
|
|
fetch('/quality/projects/bulk-status-update/', {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]').value,
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
project_ids: selectedProjects,
|
|
status: newStatus,
|
|
reason: reason
|
|
})
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
showAlert(`${data.updated_count} projects updated successfully`, 'success');
|
|
setTimeout(() => location.reload(), 1500);
|
|
} else {
|
|
showAlert('Error updating projects', 'danger');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showAlert('Error updating projects', 'danger');
|
|
});
|
|
|
|
bootstrap.Modal.getInstance(document.getElementById('statusModal')).hide();
|
|
}
|
|
|
|
function bulkArchive() {
|
|
if (selectedProjects.length === 0) {
|
|
showAlert('Please select projects to archive', 'warning');
|
|
return;
|
|
}
|
|
|
|
if (confirm(`Archive ${selectedProjects.length} selected projects?`)) {
|
|
fetch('/quality/projects/bulk-archive/', {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]').value,
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
project_ids: selectedProjects
|
|
})
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
showAlert(`${data.archived_count} projects archived successfully`, 'success');
|
|
setTimeout(() => location.reload(), 1500);
|
|
} else {
|
|
showAlert('Error archiving projects', 'danger');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showAlert('Error archiving projects', 'danger');
|
|
});
|
|
}
|
|
}
|
|
|
|
function bulkDelete() {
|
|
if (selectedProjects.length === 0) {
|
|
showAlert('Please select projects to delete', 'warning');
|
|
return;
|
|
}
|
|
|
|
if (confirm(`Are you sure you want to delete ${selectedProjects.length} selected projects? This action cannot be undone.`)) {
|
|
fetch('/quality/projects/bulk-delete/', {
|
|
method: 'DELETE',
|
|
headers: {
|
|
'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]').value,
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
project_ids: selectedProjects
|
|
})
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
showAlert(`${data.deleted_count} projects deleted successfully`, 'success');
|
|
setTimeout(() => location.reload(), 1500);
|
|
} else {
|
|
showAlert('Error deleting projects', 'danger');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showAlert('Error deleting projects', 'danger');
|
|
});
|
|
}
|
|
}
|
|
|
|
function showAlert(message, type) {
|
|
const alertDiv = document.createElement('div');
|
|
alertDiv.className = `alert alert-${type} alert-dismissible fade show position-fixed`;
|
|
alertDiv.style.cssText = 'top: 20px; right: 20px; z-index: 1060; min-width: 300px;';
|
|
alertDiv.innerHTML = `
|
|
${message}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
`;
|
|
|
|
document.body.appendChild(alertDiv);
|
|
|
|
setTimeout(() => {
|
|
if (alertDiv.parentNode) {
|
|
alertDiv.remove();
|
|
}
|
|
}, 5000);
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|