395 lines
14 KiB
HTML
395 lines
14 KiB
HTML
{% extends "base.html" %}
|
|
{% load static i18n %}
|
|
|
|
{% block title %}{% trans "Delete Application" %} - {{ block.super }}{% endblock %}
|
|
|
|
{% block customCSS %}
|
|
<style>
|
|
/* KAAT-S UI Variables */
|
|
:root {
|
|
--kaauh-teal: #00636e;
|
|
--kaauh-teal-dark: #004a53;
|
|
--kaauh-border: #eaeff3;
|
|
--kaauh-primary-text: #343a40;
|
|
--kaauh-danger: #dc3545;
|
|
--kaauh-warning: #ffc107;
|
|
}
|
|
|
|
/* 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;
|
|
}
|
|
|
|
/* Info Card */
|
|
.app-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;
|
|
}
|
|
|
|
/* 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;
|
|
}
|
|
|
|
/* Candidate Info Style */
|
|
.candidate-avatar {
|
|
width: 80px;
|
|
height: 80px;
|
|
border-radius: 50%;
|
|
object-fit: cover;
|
|
border: 3px solid var(--kaauh-teal);
|
|
}
|
|
|
|
.avatar-placeholder {
|
|
width: 80px;
|
|
height: 80px;
|
|
border-radius: 50%;
|
|
background-color: #e9ecef;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border: 3px solid var(--kaauh-teal);
|
|
}
|
|
|
|
/* Heroicon adjustments to match font-awesome size */
|
|
.heroicon {
|
|
width: 1.2em;
|
|
height: 1.2em;
|
|
vertical-align: -0.125em;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid py-4">
|
|
<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 Application" %}
|
|
</h1>
|
|
<p class="text-muted mb-0">
|
|
{% trans "You are about to delete an Application record. This action cannot be undone." %}
|
|
</p>
|
|
</div>
|
|
{# Assuming application_detail URL takes object.pk or object.slug #}
|
|
<a href="{% url 'application_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fas fa-arrow-left me-1"></i> {% trans "Back to Application" %}
|
|
</a>
|
|
</div>
|
|
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-8">
|
|
<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">
|
|
{% blocktrans with candidate_name=object.candidate.full_name job_title=object.job.title %}
|
|
Deleting the application submitted by **{{ candidate_name }}** for the job **{{ job_title }}** will permanently remove all associated data. Please review the information below carefully before proceeding.
|
|
{% endblocktrans %}
|
|
</p>
|
|
</div>
|
|
|
|
<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-file-alt me-2"></i>
|
|
{% trans "Application to be Deleted" %}
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="app-info">
|
|
{% if object.candidate %}
|
|
<div class="d-flex align-items-center mb-4">
|
|
{# Assuming candidate has a profile_image field #}
|
|
{% if object.candidate.profile_image %}
|
|
<img src="{{ object.candidate.profile_image.url }}" alt="{{ object.candidate.full_name }}" class="candidate-avatar me-3">
|
|
{% else %}
|
|
<div class="avatar-placeholder me-3">
|
|
<i class="fas fa-user text-muted fa-2x"></i>
|
|
</div>
|
|
{% endif %}
|
|
<div>
|
|
<h4 class="mb-1">{{ object.candidate.full_name }}</h4>
|
|
{% if object.candidate.email %}
|
|
<p class="text-muted mb-0">{{ object.candidate.email }}</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.job %}
|
|
<div class="info-item">
|
|
<div class="info-icon">
|
|
<i class="fas fa-briefcase"></i>
|
|
</div>
|
|
<div class="info-content">
|
|
<div class="info-label">{% trans "Job Title" %}</div>
|
|
<div class="info-value">{{ object.job.title }}</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="info-item">
|
|
<div class="info-icon">
|
|
<i class="fas fa-calendar-alt"></i>
|
|
</div>
|
|
<div class="info-content">
|
|
<div class="info-label">{% trans "Applied On" %}</div>
|
|
<div class="info-value">{{ object.created_at|date:"F d, Y \a\t P" }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if object.status %}
|
|
<div class="info-item">
|
|
<div class="info-icon">
|
|
<i class="fas fa-cogs"></i>
|
|
</div>
|
|
<div class="info-content">
|
|
<div class="info-label">{% trans "Current Status" %}</div>
|
|
<div class="info-value">{{ object.get_status_display }}</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<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 Application?" %}
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<ul class="consequence-list">
|
|
<li>
|
|
<i class="fas fa-times-circle"></i>
|
|
{% trans "The Application record and all status history will be permanently deleted." %}
|
|
</li>
|
|
<li>
|
|
<i class="fas fa-times-circle"></i>
|
|
{% trans "All associated screening results, scores, and evaluations will be removed." %}
|
|
</li>
|
|
<li>
|
|
<i class="fas fa-times-circle"></i>
|
|
{% trans "Any linked documents (CV, cover letter) specific to this application will be lost." %}
|
|
</li>
|
|
<li>
|
|
<i class="fas fa-times-circle"></i>
|
|
{% trans "The Candidate will still exist, but this specific application history will be lost." %}
|
|
</li>
|
|
<li>
|
|
<i class="fas fa-times-circle"></i>
|
|
{% trans "This action cannot be undone under any circumstances." %}
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card kaauh-card">
|
|
<div class="card-body">
|
|
<form method="post" id="deleteForm">
|
|
{% csrf_token %}
|
|
|
|
<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 application." %}</strong>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-between">
|
|
<a href="{% url 'application_detail' object.pk %}" 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 Application Permanently" %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const confirmDeleteCheckbox = document.getElementById('confirm_delete');
|
|
const deleteButton = document.getElementById('deleteButton');
|
|
const deleteForm = document.getElementById('deleteForm');
|
|
|
|
function validateForm() {
|
|
const checkboxChecked = confirmDeleteCheckbox.checked;
|
|
deleteButton.disabled = !checkboxChecked;
|
|
|
|
// Toggle button classes for visual feedback
|
|
if (checkboxChecked) {
|
|
deleteButton.classList.remove('btn-secondary');
|
|
deleteButton.classList.add('btn-danger');
|
|
} else {
|
|
deleteButton.classList.remove('btn-danger');
|
|
deleteButton.classList.add('btn-secondary');
|
|
}
|
|
}
|
|
|
|
confirmDeleteCheckbox.addEventListener('change', validateForm);
|
|
// Initialize state on page load
|
|
validateForm();
|
|
|
|
// Add confirmation and prevent double submission before final submission
|
|
deleteForm.addEventListener('submit', function(event) {
|
|
event.preventDefault();
|
|
|
|
const candidateName = "{{ object.candidate.full_name|escapejs }}";
|
|
const jobTitle = "{{ object.job.title|escapejs }}";
|
|
|
|
// Construct a confirmation message using string replacement for safety
|
|
const confirmationMessageTemplate = "{% blocktrans with candidate_name='CANDIDATE_PLACEHOLDER' job_title='JOB_PLACEHOLDER' %}Are you absolutely sure you want to permanently delete the application by CANDIDATE_PLACEHOLDER for JOB_PLACEHOLDER? This action cannot be reversed!{% endblocktrans %}";
|
|
|
|
const confirmationMessage = confirmationMessageTemplate
|
|
.replace('CANDIDATE_PLACEHOLDER', candidateName)
|
|
.replace('JOB_PLACEHOLDER', jobTitle);
|
|
|
|
if (confirm(confirmationMessage)) {
|
|
// Disable button and show loading state
|
|
deleteButton.disabled = true;
|
|
deleteButton.innerHTML = '<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>{% trans "Deleting..." %}';
|
|
|
|
// Submit the form programmatically
|
|
deleteForm.submit();
|
|
} else {
|
|
// If the user cancels the dialog, ensure the button state is reset/validated
|
|
validateForm();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %} |