282 lines
13 KiB
HTML
282 lines
13 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Delete Delivery Log{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="d-flex align-items-center mb-3">
|
|
<div>
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="{% url 'communications:dashboard' %}">Communications</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'communications:delivery_log_list' %}">Delivery Logs</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'communications:delivery_log_detail' object.pk %}">Log #{{ object.pk }}</a></li>
|
|
<li class="breadcrumb-item active">Delete</li>
|
|
</ol>
|
|
<h1 class="page-header mb-0">Delete Delivery Log</h1>
|
|
</div>
|
|
<div class="ms-auto">
|
|
<a href="{% url 'communications:delivery_log_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fas fa-arrow-left me-2"></i>Back to Log
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row justify-content-center">
|
|
<div class="col-xl-8">
|
|
<div class="card">
|
|
<div class="card-header bg-danger text-white">
|
|
<h4 class="card-title mb-0">
|
|
<i class="fas fa-exclamation-triangle me-2"></i>
|
|
Confirm Delivery Log Deletion
|
|
</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="alert alert-warning">
|
|
<h5 class="alert-heading">
|
|
<i class="fas fa-exclamation-triangle me-2"></i>
|
|
Are you sure you want to delete this delivery log?
|
|
</h5>
|
|
<p class="mb-0">
|
|
This action cannot be undone. The delivery log and all associated tracking information will be permanently removed.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Delivery Log Details -->
|
|
<div class="row mb-4">
|
|
<div class="col-md-6">
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h6 class="card-title">
|
|
<i class="fas fa-envelope me-2"></i>Message Information
|
|
</h6>
|
|
<div class="mb-2">
|
|
<strong>Message:</strong> {{ object.message.subject|default:"No subject" }}
|
|
</div>
|
|
<div class="mb-2">
|
|
<strong>Type:</strong> {{ object.message.get_message_type_display|default:"Unknown" }}
|
|
</div>
|
|
<div class="mb-2">
|
|
<strong>Recipient:</strong> {{ object.recipient }}
|
|
</div>
|
|
<div>
|
|
<strong>Method:</strong> {{ object.get_delivery_method_display }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h6 class="card-title">
|
|
<i class="fas fa-shipping-fast me-2"></i>Delivery Status
|
|
</h6>
|
|
<div class="mb-2">
|
|
<strong>Status:</strong>
|
|
<span class="badge bg-{% if object.status == 'delivered' %}success{% elif object.status == 'failed' %}danger{% elif object.status == 'sending' %}info{% else %}warning{% endif %}">
|
|
{{ object.get_status_display }}
|
|
</span>
|
|
</div>
|
|
<div class="mb-2">
|
|
<strong>Sent At:</strong>
|
|
{% if object.sent_at %}
|
|
{{ object.sent_at|date:"M d, Y g:i A" }}
|
|
{% else %}
|
|
Not sent
|
|
{% endif %}
|
|
</div>
|
|
<div class="mb-2">
|
|
<strong>Delivered At:</strong>
|
|
{% if object.delivered_at %}
|
|
{{ object.delivered_at|date:"M d, Y g:i A" }}
|
|
{% else %}
|
|
Not delivered
|
|
{% endif %}
|
|
</div>
|
|
<div>
|
|
<strong>Retry Count:</strong> {{ object.retry_count|default:0 }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if object.error_message %}
|
|
<div class="row mb-4">
|
|
<div class="col-12">
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h6 class="card-title">
|
|
<i class="fas fa-exclamation-circle me-2 text-danger"></i>Error Information
|
|
</h6>
|
|
<div class="alert alert-danger mb-0">
|
|
{{ object.error_message }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.delivery_details %}
|
|
<div class="row mb-4">
|
|
<div class="col-12">
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h6 class="card-title">
|
|
<i class="fas fa-info-circle me-2"></i>Delivery Details
|
|
</h6>
|
|
<p class="mb-0">{{ object.delivery_details }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Deletion Form -->
|
|
<form method="post">
|
|
{% csrf_token %}
|
|
|
|
<div class="mb-3">
|
|
<label for="deletion_reason" class="form-label">
|
|
<strong>Reason for Deletion *</strong>
|
|
</label>
|
|
<select class="form-select" id="deletion_reason" name="deletion_reason" required>
|
|
<option value="">Select a reason</option>
|
|
<option value="data_cleanup">Data Cleanup</option>
|
|
<option value="privacy_request">Privacy Request</option>
|
|
<option value="duplicate_entry">Duplicate Entry</option>
|
|
<option value="test_data">Test Data</option>
|
|
<option value="system_error">System Error</option>
|
|
<option value="compliance">Compliance Requirement</option>
|
|
<option value="other">Other</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="deletion_notes" class="form-label">
|
|
<strong>Additional Notes</strong>
|
|
</label>
|
|
<textarea class="form-control"
|
|
id="deletion_notes"
|
|
name="deletion_notes"
|
|
rows="3"
|
|
placeholder="Provide additional details about why this log is being deleted..."></textarea>
|
|
<div class="form-text">
|
|
These notes will be recorded for audit purposes.
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input"
|
|
type="checkbox"
|
|
id="confirm_deletion"
|
|
name="confirm_deletion"
|
|
required>
|
|
<label class="form-check-label" for="confirm_deletion">
|
|
I understand that this action cannot be undone and confirm the deletion of this delivery log.
|
|
</label>
|
|
</div>
|
|
|
|
<div class="alert alert-info">
|
|
<h6 class="alert-heading">
|
|
<i class="fas fa-info-circle me-2"></i>What happens when you delete this log?
|
|
</h6>
|
|
<ul class="mb-0">
|
|
<li>The delivery log record will be permanently removed</li>
|
|
<li>All tracking information will be lost</li>
|
|
<li>This action will be recorded in the audit log</li>
|
|
<li>Related message records will remain intact</li>
|
|
<li>Delivery statistics may be affected</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-between">
|
|
<a href="{% url 'communications:delivery_log_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fas fa-times me-2"></i>Cancel
|
|
</a>
|
|
<button type="submit" class="btn btn-danger" onclick="return confirmDeletion()">
|
|
<i class="fas fa-trash me-2"></i>Delete Delivery Log
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Related Information -->
|
|
<div class="card mt-4">
|
|
<div class="card-header">
|
|
<h5 class="card-title">
|
|
<i class="fas fa-link me-2"></i>
|
|
Related Information
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h6>Message Details</h6>
|
|
<ul class="list-unstyled">
|
|
<li><strong>Created:</strong> {{ object.message.created_at|date:"M d, Y g:i A" }}</li>
|
|
<li><strong>Priority:</strong> {{ object.message.get_priority_display|default:"Normal" }}</li>
|
|
<li><strong>Channel:</strong> {{ object.message.channel|default:"Default" }}</li>
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6>System Information</h6>
|
|
<ul class="list-unstyled">
|
|
<li><strong>Log ID:</strong> {{ object.pk }}</li>
|
|
<li><strong>Created:</strong> {{ object.created_at|date:"M d, Y g:i A" }}</li>
|
|
<li><strong>Last Updated:</strong> {{ object.updated_at|date:"M d, Y g:i A" }}</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function confirmDeletion() {
|
|
const reason = document.getElementById('deletion_reason').value;
|
|
const confirmed = document.getElementById('confirm_deletion').checked;
|
|
|
|
if (!reason) {
|
|
alert('Please select a reason for deletion.');
|
|
return false;
|
|
}
|
|
|
|
if (!confirmed) {
|
|
alert('Please confirm that you understand this action cannot be undone.');
|
|
return false;
|
|
}
|
|
|
|
const logId = "{{ object.pk }}";
|
|
const recipient = "{{ object.recipient }}";
|
|
const status = "{{ object.get_status_display }}";
|
|
|
|
const message = `Are you absolutely sure you want to delete this delivery log?\n\nLog ID: ${logId}\nRecipient: ${recipient}\nStatus: ${status}\n\nThis action cannot be undone.`;
|
|
|
|
return confirm(message);
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Auto-focus on deletion reason
|
|
document.getElementById('deletion_reason').focus();
|
|
|
|
// Show/hide additional notes based on reason
|
|
const reasonSelect = document.getElementById('deletion_reason');
|
|
const notesTextarea = document.getElementById('deletion_notes');
|
|
|
|
reasonSelect.addEventListener('change', function() {
|
|
if (this.value === 'other') {
|
|
notesTextarea.required = true;
|
|
notesTextarea.placeholder = 'Please specify the reason for deletion...';
|
|
} else {
|
|
notesTextarea.required = false;
|
|
notesTextarea.placeholder = 'Provide additional details about why this log is being deleted...';
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|
|
|