965 lines
31 KiB
HTML
965 lines
31 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static %}
|
|
|
|
{% block title %}Delete Project - {{ project.name }}{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.delete-header {
|
|
background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
|
|
color: white;
|
|
border-radius: 0.5rem;
|
|
padding: 2rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.delete-layout {
|
|
display: grid;
|
|
grid-template-columns: 2fr 1fr;
|
|
gap: 2rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.delete-main {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2rem;
|
|
}
|
|
|
|
.delete-sidebar {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.section-card {
|
|
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;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.section-content {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.warning-box {
|
|
background: #fff3cd;
|
|
border: 1px solid #ffeaa7;
|
|
border-left: 4px solid #ffc107;
|
|
border-radius: 0.375rem;
|
|
padding: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.warning-icon {
|
|
color: #856404;
|
|
font-size: 1.25rem;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.warning-title {
|
|
font-weight: 600;
|
|
color: #856404;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.warning-text {
|
|
color: #856404;
|
|
margin: 0;
|
|
}
|
|
|
|
.danger-box {
|
|
background: #f8d7da;
|
|
border: 1px solid #f5c6cb;
|
|
border-left: 4px solid #dc3545;
|
|
border-radius: 0.375rem;
|
|
padding: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.danger-icon {
|
|
color: #721c24;
|
|
font-size: 1.25rem;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.danger-title {
|
|
font-weight: 600;
|
|
color: #721c24;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.danger-text {
|
|
color: #721c24;
|
|
margin: 0;
|
|
}
|
|
|
|
.project-info {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.info-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.info-label {
|
|
font-size: 0.75rem;
|
|
color: #6c757d;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.info-value {
|
|
font-size: 0.875rem;
|
|
color: #495057;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.impact-list {
|
|
list-style: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
.impact-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
padding: 0.75rem;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.impact-item:hover {
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.impact-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.impact-icon {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 50%;
|
|
background: #dc3545;
|
|
color: white;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.875rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.impact-content {
|
|
flex: 1;
|
|
}
|
|
|
|
.impact-title {
|
|
font-weight: 600;
|
|
color: #495057;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.impact-description {
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.impact-count {
|
|
font-size: 0.875rem;
|
|
font-weight: 600;
|
|
color: #dc3545;
|
|
background: #fff5f5;
|
|
padding: 0.25rem 0.5rem;
|
|
border-radius: 0.25rem;
|
|
}
|
|
|
|
.related-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
padding: 0.75rem;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.375rem;
|
|
margin-bottom: 0.75rem;
|
|
background: white;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.related-item:hover {
|
|
border-color: #dc3545;
|
|
background: #fff5f5;
|
|
}
|
|
|
|
.related-icon {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 0.375rem;
|
|
background: #dc3545;
|
|
color: white;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.875rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.related-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.related-title {
|
|
font-weight: 600;
|
|
color: #495057;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.related-meta {
|
|
font-size: 0.75rem;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.related-status {
|
|
padding: 0.25rem 0.5rem;
|
|
border-radius: 0.25rem;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.status-active { background: #e8f5e8; color: #2e7d32; }
|
|
.status-completed { background: #e3f2fd; color: #1976d2; }
|
|
.status-pending { background: #fff3e0; color: #f57c00; }
|
|
|
|
.confirmation-section {
|
|
background: #f8f9fa;
|
|
border: 2px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.confirmation-title {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: #495057;
|
|
margin-bottom: 1rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.confirmation-steps {
|
|
list-style: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
.confirmation-step {
|
|
display: flex;
|
|
align-items: start;
|
|
gap: 0.75rem;
|
|
margin-bottom: 1rem;
|
|
padding: 0.75rem;
|
|
background: white;
|
|
border-radius: 0.375rem;
|
|
border: 1px solid #dee2e6;
|
|
}
|
|
|
|
.step-number {
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: 50%;
|
|
background: #dc3545;
|
|
color: white;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.step-content {
|
|
flex: 1;
|
|
}
|
|
|
|
.step-title {
|
|
font-weight: 600;
|
|
color: #495057;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.step-description {
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.confirmation-checkbox {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
padding: 1rem;
|
|
background: #fff5f5;
|
|
border: 2px solid #dc3545;
|
|
border-radius: 0.375rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.confirmation-checkbox input[type="checkbox"] {
|
|
width: 20px;
|
|
height: 20px;
|
|
accent-color: #dc3545;
|
|
}
|
|
|
|
.confirmation-text {
|
|
font-weight: 600;
|
|
color: #721c24;
|
|
}
|
|
|
|
.delete-actions {
|
|
background: white;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 0.5rem;
|
|
padding: 1.5rem;
|
|
display: flex;
|
|
justify-content: between;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.btn-group {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.alternative-actions {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.alternative-text {
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.stats-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 1rem;
|
|
}
|
|
|
|
.stat-item {
|
|
text-align: center;
|
|
padding: 1rem;
|
|
background: #f8f9fa;
|
|
border-radius: 0.375rem;
|
|
}
|
|
|
|
.stat-number {
|
|
font-size: 1.5rem;
|
|
font-weight: bold;
|
|
color: #dc3545;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 0.75rem;
|
|
color: #6c757d;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
@media (max-width: 1200px) {
|
|
.delete-layout {
|
|
grid-template-columns: 1fr;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.delete-sidebar {
|
|
order: -1;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.delete-header {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.project-info {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.stats-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.delete-actions {
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
}
|
|
|
|
.btn-group {
|
|
justify-content: center;
|
|
}
|
|
}
|
|
|
|
@media print {
|
|
.delete-sidebar, .delete-actions {
|
|
display: none !important;
|
|
}
|
|
|
|
.delete-layout {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.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"><a href="{% url 'quality:project_list' %}">Projects</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'quality:project_detail' project.id %}">{{ project.name|truncatechars:20 }}</a></li>
|
|
<li class="breadcrumb-item active">Delete</li>
|
|
</ol>
|
|
<h1 class="page-header mb-0">
|
|
<i class="fas fa-trash me-2"></i>Delete Project
|
|
</h1>
|
|
</div>
|
|
<div class="ms-auto">
|
|
<a href="{% url 'quality:project_detail' project.id %}" class="btn btn-outline-secondary">
|
|
<i class="fas fa-arrow-left me-1"></i>Back to Project
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Delete Header -->
|
|
<div class="delete-header">
|
|
<div class="row align-items-center">
|
|
<div class="col-md-8">
|
|
<h2 class="mb-2">
|
|
<i class="fas fa-exclamation-triangle me-2"></i>
|
|
Delete Project: {{ project.name }}
|
|
</h2>
|
|
<p class="mb-0">This action will permanently delete the project and all associated data. Please review the impact before proceeding.</p>
|
|
</div>
|
|
<div class="col-md-4 text-md-end">
|
|
<div class="stats-grid">
|
|
<div class="stat-item">
|
|
<div class="stat-number">{{ project.team_members.count|default:0 }}</div>
|
|
<div class="stat-label">Team Members</div>
|
|
</div>
|
|
<div class="stat-item">
|
|
<div class="stat-number">{{ project.milestones.count|default:0 }}</div>
|
|
<div class="stat-label">Milestones</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="delete-layout">
|
|
<!-- Main Content -->
|
|
<div class="delete-main">
|
|
<!-- Warning Messages -->
|
|
<div class="danger-box">
|
|
<div class="d-flex align-items-start">
|
|
<i class="fas fa-exclamation-triangle danger-icon"></i>
|
|
<div>
|
|
<div class="danger-title">Permanent Deletion Warning</div>
|
|
<div class="danger-text">
|
|
This action cannot be undone. All project data, including milestones, deliverables,
|
|
team assignments, and progress tracking will be permanently deleted.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if project.status == 'active' %}
|
|
<div class="warning-box">
|
|
<div class="d-flex align-items-start">
|
|
<i class="fas fa-exclamation-circle warning-icon"></i>
|
|
<div>
|
|
<div class="warning-title">Active Project Warning</div>
|
|
<div class="warning-text">
|
|
This project is currently active with ongoing work. Consider archiving instead of deleting
|
|
to preserve historical data and team contributions.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Project Information -->
|
|
<div class="section-card">
|
|
<div class="section-header">
|
|
<i class="fas fa-info-circle"></i>
|
|
Project Information
|
|
</div>
|
|
<div class="section-content">
|
|
<div class="project-info">
|
|
<div class="info-item">
|
|
<div class="info-label">Project Name</div>
|
|
<div class="info-value">{{ project.name }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<div class="info-label">Project ID</div>
|
|
<div class="info-value">{{ project.project_id|default:project.id }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<div class="info-label">Department</div>
|
|
<div class="info-value">{{ project.department.name|default:"Not specified" }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<div class="info-label">Status</div>
|
|
<div class="info-value">{{ project.get_status_display }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<div class="info-label">Priority</div>
|
|
<div class="info-value">{{ project.get_priority_display }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<div class="info-label">Created</div>
|
|
<div class="info-value">{{ project.created_at|date:"M d, Y" }}</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<div class="info-label">Progress</div>
|
|
<div class="info-value">{{ project.progress|default:0 }}%</div>
|
|
</div>
|
|
|
|
<div class="info-item">
|
|
<div class="info-label">Manager</div>
|
|
<div class="info-value">{{ project.manager.get_full_name|default:"Not assigned" }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if project.description %}
|
|
<div class="mt-3">
|
|
<div class="info-label">Description</div>
|
|
<div class="info-value">{{ project.description|truncatechars:200 }}</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Impact Analysis -->
|
|
<div class="section-card">
|
|
<div class="section-header">
|
|
<i class="fas fa-chart-line"></i>
|
|
Deletion Impact Analysis
|
|
</div>
|
|
<div class="section-content">
|
|
<ul class="impact-list">
|
|
<li class="impact-item">
|
|
<div class="impact-icon">
|
|
<i class="fas fa-users"></i>
|
|
</div>
|
|
<div class="impact-content">
|
|
<div class="impact-title">Team Members</div>
|
|
<div class="impact-description">
|
|
{{ project.team_members.count }} team member{{ project.team_members.count|pluralize }} will lose access to this project
|
|
</div>
|
|
</div>
|
|
<div class="impact-count">{{ project.team_members.count }}</div>
|
|
</li>
|
|
|
|
<li class="impact-item">
|
|
<div class="impact-icon">
|
|
<i class="fas fa-flag-checkered"></i>
|
|
</div>
|
|
<div class="impact-content">
|
|
<div class="impact-title">Milestones</div>
|
|
<div class="impact-description">
|
|
All project milestones and their progress tracking will be deleted
|
|
</div>
|
|
</div>
|
|
<div class="impact-count">{{ project.milestones.count|default:0 }}</div>
|
|
</li>
|
|
|
|
<li class="impact-item">
|
|
<div class="impact-icon">
|
|
<i class="fas fa-box"></i>
|
|
</div>
|
|
<div class="impact-content">
|
|
<div class="impact-title">Deliverables</div>
|
|
<div class="impact-description">
|
|
All project deliverables and associated files will be permanently removed
|
|
</div>
|
|
</div>
|
|
<div class="impact-count">{{ project.deliverables.count|default:0 }}</div>
|
|
</li>
|
|
|
|
<li class="impact-item">
|
|
<div class="impact-icon">
|
|
<i class="fas fa-comments"></i>
|
|
</div>
|
|
<div class="impact-content">
|
|
<div class="impact-title">Comments & Notes</div>
|
|
<div class="impact-description">
|
|
All project discussions and documentation will be lost
|
|
</div>
|
|
</div>
|
|
<div class="impact-count">{{ project.comments.count|default:0 }}</div>
|
|
</li>
|
|
|
|
<li class="impact-item">
|
|
<div class="impact-icon">
|
|
<i class="fas fa-history"></i>
|
|
</div>
|
|
<div class="impact-content">
|
|
<div class="impact-title">Activity History</div>
|
|
<div class="impact-description">
|
|
Complete audit trail and activity history will be permanently deleted
|
|
</div>
|
|
</div>
|
|
<div class="impact-count">{{ project.activities.count|default:0 }}</div>
|
|
</li>
|
|
|
|
<li class="impact-item">
|
|
<div class="impact-icon">
|
|
<i class="fas fa-chart-bar"></i>
|
|
</div>
|
|
<div class="impact-content">
|
|
<div class="impact-title">Reports & Analytics</div>
|
|
<div class="impact-description">
|
|
Historical performance data and reports will no longer be available
|
|
</div>
|
|
</div>
|
|
<div class="impact-count">∞</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Confirmation Steps -->
|
|
<div class="confirmation-section">
|
|
<div class="confirmation-title">
|
|
<i class="fas fa-clipboard-check"></i>
|
|
Deletion Confirmation Process
|
|
</div>
|
|
|
|
<ol class="confirmation-steps">
|
|
<li class="confirmation-step">
|
|
<div class="step-number">1</div>
|
|
<div class="step-content">
|
|
<div class="step-title">Review Impact</div>
|
|
<div class="step-description">
|
|
Carefully review all data that will be permanently deleted above
|
|
</div>
|
|
</div>
|
|
</li>
|
|
|
|
<li class="confirmation-step">
|
|
<div class="step-number">2</div>
|
|
<div class="step-content">
|
|
<div class="step-title">Notify Team</div>
|
|
<div class="step-description">
|
|
Ensure all team members are aware of the project deletion
|
|
</div>
|
|
</div>
|
|
</li>
|
|
|
|
<li class="confirmation-step">
|
|
<div class="step-number">3</div>
|
|
<div class="step-content">
|
|
<div class="step-title">Backup Data</div>
|
|
<div class="step-description">
|
|
Export any important data or reports before deletion
|
|
</div>
|
|
</div>
|
|
</li>
|
|
|
|
<li class="confirmation-step">
|
|
<div class="step-number">4</div>
|
|
<div class="step-content">
|
|
<div class="step-title">Confirm Deletion</div>
|
|
<div class="step-description">
|
|
Check the confirmation box and proceed with deletion
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
|
|
<form method="post" id="delete-form">
|
|
{% csrf_token %}
|
|
|
|
<div class="confirmation-checkbox">
|
|
<input type="checkbox" id="confirm-delete" name="confirm_delete" required>
|
|
<label for="confirm-delete" class="confirmation-text">
|
|
I understand that this action cannot be undone and will permanently delete
|
|
"{{ project.name }}" and all associated data.
|
|
</label>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">Type project name to confirm:</label>
|
|
<input type="text" class="form-control" id="project-name-confirm"
|
|
placeholder="Enter: {{ project.name }}" required>
|
|
<div class="form-text">Type the exact project name to enable deletion</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Sidebar -->
|
|
<div class="delete-sidebar">
|
|
<!-- Related Items -->
|
|
{% if project.related_findings.exists or project.related_audits.exists %}
|
|
<div class="section-card">
|
|
<div class="section-header">
|
|
<i class="fas fa-link"></i>
|
|
Related Items
|
|
</div>
|
|
<div class="section-content">
|
|
{% for finding in project.related_findings.all|slice:":5" %}
|
|
<div class="related-item">
|
|
<div class="related-icon">
|
|
<i class="fas fa-search"></i>
|
|
</div>
|
|
<div class="related-info">
|
|
<div class="related-title">{{ finding.title|truncatechars:30 }}</div>
|
|
<div class="related-meta">Finding • {{ finding.date_identified|date:"M d, Y" }}</div>
|
|
</div>
|
|
<span class="related-status status-{{ finding.status }}">
|
|
{{ finding.get_status_display }}
|
|
</span>
|
|
</div>
|
|
{% endfor %}
|
|
|
|
{% for audit in project.related_audits.all|slice:":5" %}
|
|
<div class="related-item">
|
|
<div class="related-icon">
|
|
<i class="fas fa-clipboard-check"></i>
|
|
</div>
|
|
<div class="related-info">
|
|
<div class="related-title">{{ audit.title|truncatechars:30 }}</div>
|
|
<div class="related-meta">Audit • {{ audit.date_scheduled|date:"M d, Y" }}</div>
|
|
</div>
|
|
<span class="related-status status-{{ audit.status }}">
|
|
{{ audit.get_status_display }}
|
|
</span>
|
|
</div>
|
|
{% endfor %}
|
|
|
|
{% if project.related_findings.count > 5 or project.related_audits.count > 5 %}
|
|
<div class="text-center text-muted mt-2">
|
|
+{{ project.related_findings.count|add:project.related_audits.count|add:"-5" }} more related items
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Team Members -->
|
|
{% if project.team_members.exists %}
|
|
<div class="section-card">
|
|
<div class="section-header">
|
|
<i class="fas fa-users"></i>
|
|
Affected Team Members
|
|
</div>
|
|
<div class="section-content">
|
|
{% for member in project.team_members.all %}
|
|
<div class="related-item">
|
|
<div class="related-icon" style="background: #007bff;">
|
|
{{ member.first_name.0|upper }}{{ member.last_name.0|upper }}
|
|
</div>
|
|
<div class="related-info">
|
|
<div class="related-title">{{ member.get_full_name }}</div>
|
|
<div class="related-meta">{{ member.email }}</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Alternative Actions -->
|
|
<div class="section-card">
|
|
<div class="section-header">
|
|
<i class="fas fa-lightbulb"></i>
|
|
Alternative Actions
|
|
</div>
|
|
<div class="section-content">
|
|
<div class="alternative-text">
|
|
Consider these alternatives to permanent deletion:
|
|
</div>
|
|
|
|
<div class="alternative-actions">
|
|
<a href="{% url 'quality:project_archive' project.id %}" class="btn btn-outline-info btn-sm">
|
|
<i class="fas fa-archive me-1"></i>Archive Project
|
|
</a>
|
|
|
|
<button type="button" class="btn btn-outline-warning btn-sm" onclick="pauseProject()">
|
|
<i class="fas fa-pause me-1"></i>Pause Project
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-outline-success btn-sm" onclick="exportProject()">
|
|
<i class="fas fa-download me-1"></i>Export Data
|
|
</button>
|
|
|
|
<a href="{% url 'quality:project_edit' project.id %}" class="btn btn-outline-primary btn-sm">
|
|
<i class="fas fa-edit me-1"></i>Edit Instead
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Deletion History -->
|
|
<div class="section-card">
|
|
<div class="section-header">
|
|
<i class="fas fa-history"></i>
|
|
Recent Deletions
|
|
</div>
|
|
<div class="section-content">
|
|
{% for deleted_project in recent_deletions %}
|
|
<div class="related-item">
|
|
<div class="related-icon" style="background: #6c757d;">
|
|
<i class="fas fa-trash"></i>
|
|
</div>
|
|
<div class="related-info">
|
|
<div class="related-title">{{ deleted_project.name|truncatechars:25 }}</div>
|
|
<div class="related-meta">Deleted {{ deleted_project.deleted_at|timesince }} ago</div>
|
|
</div>
|
|
</div>
|
|
{% empty %}
|
|
<div class="text-center text-muted py-3">
|
|
<i class="fas fa-history fa-2x mb-2"></i>
|
|
<p>No recent deletions</p>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Delete Actions -->
|
|
<div class="delete-actions">
|
|
<div class="alternative-text">
|
|
<strong>Need help?</strong> Contact your system administrator if you're unsure about deleting this project.
|
|
</div>
|
|
|
|
<div class="btn-group">
|
|
<a href="{% url 'quality:project_detail' project.id %}" class="btn btn-outline-secondary">
|
|
<i class="fas fa-arrow-left me-1"></i>Cancel
|
|
</a>
|
|
<button type="button" class="btn btn-outline-info" onclick="exportProject()">
|
|
<i class="fas fa-download me-1"></i>Export First
|
|
</button>
|
|
<button type="submit" form="delete-form" class="btn btn-danger" id="delete-btn" disabled>
|
|
<i class="fas fa-trash me-1"></i>Delete Project
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_js %}
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Enable delete button only when conditions are met
|
|
function checkDeleteConditions() {
|
|
const confirmChecked = $('#confirm-delete').is(':checked');
|
|
const nameMatch = $('#project-name-confirm').val() === '{{ project.name }}';
|
|
|
|
$('#delete-btn').prop('disabled', !(confirmChecked && nameMatch));
|
|
}
|
|
|
|
$('#confirm-delete, #project-name-confirm').on('change keyup', checkDeleteConditions);
|
|
|
|
// Form submission confirmation
|
|
$('#delete-form').on('submit', function(e) {
|
|
if (!confirm('Are you absolutely sure you want to delete this project? This action cannot be undone.')) {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
|
|
function pauseProject() {
|
|
if (confirm('Pause this project instead of deleting it?')) {
|
|
fetch(`/quality/projects/{{ project.id }}/pause/`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]').value
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
showAlert('Project paused successfully', 'success');
|
|
setTimeout(() => {
|
|
window.location.href = '{% url "quality:project_detail" project.id %}';
|
|
}, 1500);
|
|
} else {
|
|
showAlert('Error pausing project', 'danger');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showAlert('Error pausing project', 'danger');
|
|
});
|
|
}
|
|
}
|
|
|
|
function exportProject() {
|
|
showAlert('Preparing project export...', 'info');
|
|
window.open(`/quality/projects/{{ project.id }}/export/`, '_blank');
|
|
}
|
|
|
|
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 %}
|
|
|