kaauh_ats/templates/recruitment/agency_confirm_delete.html

410 lines
15 KiB
HTML

{% extends 'base.html' %}
{% load static i18n %}
{% block title %}{% trans "Delete Agency" %} - {{ agency.name }} - ATS{% endblock %}
{% block customCSS %}
<style>
/* KAAT-S UI Variables */
:root {
--kaauh-teal: #00636e;
--kaauh-teal-dark: #004a53;
--kaauh-border: #eaeff3;
--kaauh-primary-text: #343a40;
--kaauh-success: #28a745;
--kaauh-info: #17a2b8;
--kaauh-danger: #dc3545;
--kaauh-warning: #ffc107;
}
/* Primary Color Overrides */
.text-primary-theme { color: var(--kaauh-teal) !important; }
.bg-primary-theme { background-color: var(--kaauh-teal) !important; }
/* Main Container & Card Styling */
.kaauh-card {
border: 1px solid var(--kaauh-border);
border-radius: 0.75rem;
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
background-color: white;
}
/* Warning Section */
.warning-section {
background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
border: 1px solid #ffeeba;
border-radius: 0.75rem;
padding: 2rem;
margin-bottom: 2rem;
text-align: center;
}
.warning-icon {
font-size: 4rem;
color: var(--kaauh-warning);
margin-bottom: 1rem;
}
.warning-title {
color: #856404;
font-weight: 700;
margin-bottom: 1rem;
}
.warning-text {
color: #856404;
margin-bottom: 0;
}
/* Agency Info Card */
.agency-info {
background-color: #f8f9fa;
border-radius: 0.75rem;
padding: 1.5rem;
margin-bottom: 2rem;
border: 1px solid var(--kaauh-border);
}
.info-item {
display: flex;
align-items: center;
margin-bottom: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid #e9ecef;
}
.info-item:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.info-icon {
width: 40px;
height: 40px;
background-color: var(--kaauh-teal);
color: white;
border-radius: 0.5rem;
display: flex;
align-items: center;
justify-content: center;
margin-right: 1rem;
flex-shrink: 0;
}
.info-content {
flex: 1;
}
.info-label {
font-weight: 600;
color: var(--kaauh-primary-text);
margin-bottom: 0.25rem;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.info-value {
color: #6c757d;
font-size: 1rem;
}
/* Button Styling */
.btn-danger {
background-color: var(--kaauh-danger);
border-color: var(--kaauh-danger);
color: white;
font-weight: 600;
transition: all 0.2s ease;
}
.btn-danger:hover {
background-color: #c82333;
border-color: #bd2130;
box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}
.btn-secondary {
background-color: #6c757d;
border-color: #6c757d;
color: white;
font-weight: 600;
}
/* Candidate Count Alert */
.candidate-alert {
background-color: #f8d7da;
border: 1px solid #f5c6cb;
border-radius: 0.75rem;
padding: 1rem;
margin-bottom: 1.5rem;
}
.candidate-alert i {
color: var(--kaauh-danger);
margin-right: 0.5rem;
}
/* Consequence List */
.consequence-list {
list-style: none;
padding: 0;
margin: 0;
}
.consequence-list li {
padding: 0.5rem 0;
border-bottom: 1px solid #e9ecef;
color: #6c757d;
}
.consequence-list li:last-child {
border-bottom: none;
}
.consequence-list li i {
color: var(--kaauh-danger);
margin-right: 0.5rem;
}
</style>
{% endblock %}
{% block content %}
<div class="container-fluid py-4">
<!-- Header Section -->
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1 class="h3 mb-1" style="color: var(--kaauh-teal-dark); font-weight: 700;">
<i class="fas fa-exclamation-triangle me-2"></i>
{% trans "Delete Agency" %}
</h1>
<p class="text-muted mb-0">
{% trans "You are about to delete a hiring agency. This action cannot be undone." %}
</p>
</div>
<a href="{% url 'agency_detail' agency.slug %}" class="btn btn-secondary">
<i class="fas fa-arrow-left me-1"></i> {% trans "Back to Agency" %}
</a>
</div>
<div class="row justify-content-center">
<div class="col-lg-8">
<!-- Warning Section -->
<div class="warning-section">
<div class="warning-icon">
<i class="fas fa-exclamation-triangle"></i>
</div>
<h3 class="warning-title">{% trans "Warning: This action cannot be undone!" %}</h3>
<p class="warning-text">
{% trans "Deleting this agency will permanently remove all associated data. Please review the information below carefully before proceeding." %}
</p>
</div>
<!-- Agency Information -->
<div class="card kaauh-card mb-4">
<div class="card-header bg-white border-bottom">
<h5 class="mb-0" style="color: var(--kaauh-teal-dark);">
<i class="fas fa-building me-2"></i>
{% trans "Agency to be Deleted" %}
</h5>
</div>
<div class="card-body">
<div class="agency-info">
<div class="info-item">
<div class="info-icon">
<i class="fas fa-building"></i>
</div>
<div class="info-content">
<div class="info-label">{% trans "Agency Name" %}</div>
<div class="info-value">{{ agency.name }}</div>
</div>
</div>
{% if agency.contact_person %}
<div class="info-item">
<div class="info-icon">
<i class="fas fa-user"></i>
</div>
<div class="info-content">
<div class="info-label">{% trans "Contact Person" %}</div>
<div class="info-value">{{ agency.contact_person }}</div>
</div>
</div>
{% endif %}
{% if agency.email %}
<div class="info-item">
<div class="info-icon">
<i class="fas fa-envelope"></i>
</div>
<div class="info-content">
<div class="info-label">{% trans "Email" %}</div>
<div class="info-value">{{ agency.email }}</div>
</div>
</div>
{% endif %}
{% if agency.phone %}
<div class="info-item">
<div class="info-icon">
<i class="fas fa-phone"></i>
</div>
<div class="info-content">
<div class="info-label">{% trans "Phone" %}</div>
<div class="info-value">{{ agency.phone }}</div>
</div>
</div>
{% endif %}
<div class="info-item">
<div class="info-icon">
<i class="fas fa-calendar"></i>
</div>
<div class="info-content">
<div class="info-label">{% trans "Created" %}</div>
<div class="info-value">{{ agency.created_at|date:"F d, Y" }}</div>
</div>
</div>
</div>
</div>
</div>
<!-- Candidate Warning -->
{% if candidate_count > 0 %}
<div class="candidate-alert">
<h5 class="mb-3">
<i class="fas fa-users"></i>
{% trans "Associated Candidates Found" %}
</h5>
<p class="mb-2">
<strong>{{ candidate_count }}</strong> {% trans "candidate(s) are associated with this agency." %}
</p>
<p class="mb-0">
{% trans "Deleting this agency will affect these candidates. Their agency reference will be removed, but the candidates themselves will not be deleted." %}
</p>
</div>
{% endif %}
<!-- Consequences -->
<div class="card kaauh-card mb-4">
<div class="card-header bg-white border-bottom">
<h5 class="mb-0" style="color: var(--kaauh-teal-dark);">
<i class="fas fa-list me-2"></i>
{% trans "What will happen when you delete this agency?" %}
</h5>
</div>
<div class="card-body">
<ul class="consequence-list">
<li>
<i class="fas fa-times-circle"></i>
{% trans "The agency profile and all its information will be permanently deleted" %}
</li>
<li>
<i class="fas fa-times-circle"></i>
{% trans "All contact information and agency details will be removed" %}
</li>
{% if candidate_count > 0 %}
<li>
<i class="fas fa-exclamation-circle"></i>
{% trans "Associated candidates will lose their agency reference" %}
</li>
<li>
<i class="fas fa-exclamation-circle"></i>
{% trans "Historical data linking candidates to this agency will be lost" %}
</li>
{% endif %}
<li>
<i class="fas fa-times-circle"></i>
{% trans "This action cannot be undone under any circumstances" %}
</li>
</ul>
</div>
</div>
<!-- Confirmation Form -->
<div class="card kaauh-card">
<div class="card-body">
<form method="post" id="deleteForm">
{% csrf_token %}
<div class="mb-4">
<label for="confirm_name" class="form-label">
<strong>{% trans "Type the agency name to confirm deletion:" %}</strong>
</label>
<input type="text"
class="form-control"
id="confirm_name"
name="confirm_name"
placeholder="{{ agency.name }}"
required>
<div class="form-text">
{% trans "This is required to prevent accidental deletions." %}
</div>
</div>
<div class="mb-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="confirm_delete" name="confirm_delete" required>
<label class="form-check-label" for="confirm_delete">
<strong>{% trans "I understand that this action cannot be undone and I want to permanently delete this agency." %}</strong>
</label>
</div>
</div>
<div class="d-flex justify-content-between">
<a href="{% url 'agency_detail' agency.slug %}" class="btn btn-secondary btn-lg">
<i class="fas fa-times me-2"></i>
{% trans "Cancel" %}
</a>
<button type="submit"
class="btn btn-danger btn-lg"
id="deleteButton"
disabled>
<i class="fas fa-trash me-2"></i>
{% trans "Delete Agency Permanently" %}
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const confirmNameInput = document.getElementById('confirm_name');
const confirmDeleteCheckbox = document.getElementById('confirm_delete');
const deleteButton = document.getElementById('deleteButton');
const deleteForm = document.getElementById('deleteForm');
const agencyName = "{{ agency.name }}";
function validateForm() {
const nameMatches = confirmNameInput.value.trim() === agencyName;
const checkboxChecked = confirmDeleteCheckbox.checked;
deleteButton.disabled = !(nameMatches && checkboxChecked);
if (nameMatches && checkboxChecked) {
deleteButton.classList.remove('btn-secondary');
deleteButton.classList.add('btn-danger');
} else {
deleteButton.classList.remove('btn-danger');
deleteButton.classList.add('btn-secondary');
}
}
confirmNameInput.addEventListener('input', validateForm);
confirmDeleteCheckbox.addEventListener('change', validateForm);
// Add confirmation before final submission
deleteForm.addEventListener('submit', function(e) {
const confirmMessage = "{% trans 'Are you absolutely sure you want to delete this agency? This action cannot be undone.' %}";
if (!confirm(confirmMessage)) {
e.preventDefault();
}
});
});
</script>
{% endblock %}