HH/templates/complaints/investigation_questions.html
ismail 7369d08012
All checks were successful
Build and Push Docker Image / build (push) Successful in 4m14s
feat: unified reference numbers + feedback modules QA audit
Reference numbers (unified scheme PREFIX-YYYYMM-HOSP-NNNN, e.g. CMP-202606-HHN-0001):
- new ReferenceSequence model + generate_reference() helper (apps/core)
- Complaint/Inquiry/Observation/Appreciation/Suggestion emit unified refs via save()
- prefix-based auto-routing in public track API (CMP/INQ/OBS trackable; APR/SGT internal-only)
- removed legacy CMP-/INQ- generators in ui_views, integrations, px_sources
- migrations: core.0003_referencesequence, appreciation.0006, feedback.0008, observations.0012
- unit tests (format, sanitization, monthly reset, 40-thread concurrency)

QA audit:
- isolated E2E hospital sandbox mirroring HH-N + 10 role users (create_e2e_isolated_env)
- feedback-modules-audit.spec.ts + audit helper (headed, run-to-completion)
- reports/feedback-modules-qa-report.md

Also bundles accumulated in-progress work across complaints, observations,
organizations, templates, and other modules.
2026-06-14 14:29:23 +03:00

168 lines
9.0 KiB
HTML

{% load i18n %}
{% load static %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:'en' }}" dir="{% if LANGUAGE_CODE == 'ar' %}rtl{% else %}ltr{% endif %}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% trans "Investigation Questions" %} - PX360</title>
<link rel="stylesheet" href="{% static 'dist/css/tailwind.css' %}">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
body { font-family: 'Inter', sans-serif; }
.page-header-gradient {
background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #f59e0b 100%);
color: white; padding: 1.5rem 2rem; border-radius: 1rem; margin-bottom: 1.5rem;
box-shadow: 0 10px 15px -3px rgba(217, 119, 6, 0.2);
}
.form-section {
background: #fff; border: 2px solid #e2e8f0; border-radius: 1rem;
padding: 1.5rem; margin-bottom: 1.5rem;
}
.form-section:hover { border-color: #d97706; box-shadow: 0 4px 12px rgba(217, 119, 6, 0.1); }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; color: #1e293b; margin-bottom: 0.5rem; }
.form-control {
width: 100%; padding: 0.75rem 1rem; border: 2px solid #e2e8f0;
border-radius: 0.75rem; font-size: 0.875rem; transition: all 0.2s ease;
}
.form-control:focus { outline: none; border-color: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1); }
.btn-primary {
display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
padding: 0.75rem 1.5rem; background: #d97706; color: white; border-radius: 0.75rem;
font-weight: 600; transition: all 0.2s ease; border: none; cursor: pointer; width: 100%;
}
.btn-primary:hover { background: #b45309; }
.btn-add {
display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem;
background: #fef3c7; color: #92400e; border: 2px dashed #fbbf24; border-radius: 0.75rem;
font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 0.875rem;
}
.btn-add:hover { background: #fde68a; border-color: #f59e0b; }
.btn-remove {
width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
background: #fee2e2; color: #dc2626; border: none; border-radius: 0.5rem; cursor: pointer;
font-size: 1.25rem; transition: all 0.2s; flex-shrink: 0;
}
.btn-remove:hover { background: #fecaca; }
</style>
</head>
<body class="bg-gray-50 min-h-screen flex items-center py-8 px-4">
<div class="w-full max-w-3xl mx-auto">
<div class="page-header-gradient text-center">
<h1 class="text-2xl font-bold">{% trans "Investigation Questions" %}</h1>
<p class="text-white/80 mt-1">{% trans "Create questions for the accused staff member(s)" %}</p>
</div>
{% if success %}
<div class="form-section">
<div class="text-center py-8">
<div class="w-20 h-20 mx-auto bg-green-100 rounded-full flex items-center justify-center mb-4">
<svg class="w-10 h-10 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
</div>
<h2 class="text-xl font-bold text-gray-800 mb-2">{% trans "Investigation Started" %}</h2>
<p class="text-gray-600">{{ success }}</p>
<p class="text-gray-400 text-sm mt-4">{% trans "You will be notified when all staff members respond." %}</p>
</div>
</div>
{% else %}
<div class="form-section">
{% if error %}
<div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6 rounded-r-lg">
<p class="text-red-700 font-medium">{{ error }}</p>
</div>
{% endif %}
{% if explanation.staff %}
<div class="p-4 text-white rounded-lg mb-6" style="background:#1e3a5f">
<h3 class="text-sm font-semibold text-blue-200 mb-1">{% trans "Investigating as" %}</h3>
<p class="font-bold">{{ explanation.staff.first_name }} {{ explanation.staff.last_name }}</p>
{% if explanation.staff.department %}<p class="text-sm text-blue-100">{{ explanation.staff.department.name }}</p>{% endif %}
</div>
{% endif %}
<div class="border border-gray-200 rounded-xl p-4 mb-6" style="background:#f8fafc">
<h3 class="text-sm font-semibold text-gray-700 mb-2">{% trans "Complaint" %} #{{ complaint.reference_number }}</h3>
<p class="text-sm text-gray-600">{{ complaint.title }}</p>
{% if complaint.short_description_en %}<p class="text-xs text-gray-400 mt-2">{{ complaint.short_description_en|truncatewords:30 }}</p>{% endif %}
</div>
<form method="post" class="space-y-6">
{% csrf_token %}
<div>
<h3 class="text-lg font-bold mb-4" style="color:#005696">{% trans "Select Accused Staff" %}</h3>
{% if accused_staff %}
<div class="space-y-2">
{% for s in accused_staff %}
<label class="flex items-center gap-3 p-3 border-2 border-gray-200 rounded-xl cursor-pointer hover:border-amber-400 transition">
<input type="checkbox" name="accused_staff[]" value="{{ s.staff_id }}" checked class="w-5 h-5 rounded text-amber-600">
<div class="flex-1">
<span class="font-semibold" style="color:#1e293b">{{ s.staff.get_full_name }}</span>
{% if s.staff.job_title %}<span class="text-sm text-gray-400 ml-2">{{ s.staff.job_title }}</span>{% endif %}
{% if s.staff.department %}<span class="text-xs text-gray-400 ml-2">({{ s.staff.department.name }})</span>{% endif %}
</div>
</label>
{% endfor %}
</div>
{% else %}
<p class="text-gray-400 text-sm">{% trans "No accused staff linked to this complaint." %}</p>
{% endif %}
</div>
<div>
<h3 class="text-lg font-bold mb-4" style="color:#005696">{% trans "Investigation Questions" %}</h3>
<div id="questions-container" class="space-y-3">
<div class="question-row flex items-start gap-2">
<span class="q-num mt-2 text-sm font-bold text-gray-400">1.</span>
<input type="text" name="questions[]" class="form-control flex-1" placeholder="{% trans 'Enter your question...' %}" required>
<button type="button" class="btn-remove mt-1" onclick="removeQuestion(this)" title="{% trans 'Remove' %}">&times;</button>
</div>
</div>
<button type="button" onclick="addQuestion()" class="btn-add mt-3">
+ {% trans "Add Question" %}
</button>
</div>
<button type="submit" class="btn-primary py-4 text-lg">
{% trans "Send Questions to Staff" %}
</button>
</form>
</div>
{% endif %}
<div class="text-center mt-6">
<p class="text-gray-400 text-xs">{% trans "PX360 Complaint Management System" %}</p>
</div>
</div>
<script>
let qCount = 1;
function addQuestion() {
qCount++;
const container = document.getElementById('questions-container');
const row = document.createElement('div');
row.className = 'question-row flex items-start gap-2';
row.innerHTML = `
<span class="q-num mt-2 text-sm font-bold text-gray-400">${qCount}.</span>
<input type="text" name="questions[]" class="form-control flex-1" placeholder="Enter your question..." required>
<button type="button" class="btn-remove mt-1" onclick="removeQuestion(this)" title="Remove">&times;</button>
`;
container.appendChild(row);
}
function removeQuestion(btn) {
const container = document.getElementById('questions-container');
if (container.children.length > 1) {
btn.closest('.question-row').remove();
renumber();
}
}
function renumber() {
const rows = document.querySelectorAll('.question-row');
rows.forEach((row, i) => { row.querySelector('.q-num').textContent = (i + 1) + '.'; });
qCount = rows.length;
}
</script>
</body>
</html>