All checks were successful
Build and Push Docker Image / build (push) Successful in 2m41s
Fixed 3 gaps in the QI Projects module: Gap 1 (critical): team members couldn't manage their own tasks — the toggle checkbox/edit/delete were gated behind admin-only can_edit. Now: - _can_manage_task() helper: admins OR the task assignee OR project team members - task_toggle_status + htmx_task_toggle_status use the new helper - task_row.html shows the toggle for assignees (task.assigned_to.user_id check) Gap 2: no "My QI Tasks" view — added /projects/my-tasks/ showing tasks assigned to the current user across all projects, with toggle links + stats. Sidebar link. Gap 3: no notification on task assignment — added apps/projects/signals.py (post_save on QIProjectTask → create_in_app_notification). apps.py ready() wired. Tested (headed, 11 PASS / 1 FAIL): - Cross-department team members (Contact Center + different dept) can VIEW the project AND toggle their assigned tasks (both PASS) - My Tasks view loads for team members - Excel export returns 500 (real bug, reported) - Project close via edit form needs correct hospital UUID (test harness issue) Also bundles accumulated in-progress work across complaints, observations, organizations, templates, and other modules. Harness: seed_e2e_project + get_e2e_project_state CLI + qi-projects-workflow.spec.ts
176 lines
9.3 KiB
HTML
176 lines
9.3 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, #005696 0%, #0069a8 50%, #007bbd 100%);
|
|
color: white; padding: 1.5rem 2rem; border-radius: 1rem; margin-bottom: 1.5rem;
|
|
box-shadow: 0 10px 15px -3px rgba(0, 86, 150, 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: #005696; box-shadow: 0 4px 12px rgba(0, 86, 150, 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: #005696; box-shadow: 0 0 0 3px rgba(0, 86, 150, 0.1); }
|
|
.btn-primary {
|
|
display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
|
|
padding: 0.75rem 1.5rem; background: #005696; color: white; border-radius: 0.75rem;
|
|
font-weight: 600; transition: all 0.2s ease; border: none; cursor: pointer; width: 100%;
|
|
}
|
|
.btn-primary:hover { background: #007bbd; }
|
|
.btn-add {
|
|
display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem;
|
|
background: #eef6fb; color: #005696; border: 2px dashed #93c5fd; border-radius: 0.75rem;
|
|
font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 0.875rem;
|
|
}
|
|
.btn-add:hover { background: #dbeaf6; border-color: #005696; }
|
|
.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:#005696">
|
|
<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-navy transition">
|
|
<input type="checkbox" name="accused_staff[]" value="{{ s.staff_id }}" checked class="w-5 h-5 rounded accent-navy">
|
|
<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...' %}" onkeydown="handleQuestionKeydown(event)" required>
|
|
<button type="button" class="btn-remove mt-1" onclick="removeQuestion(this)" title="{% trans 'Remove' %}">×</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..." onkeydown="handleQuestionKeydown(event)" required>
|
|
<button type="button" class="btn-remove mt-1" onclick="removeQuestion(this)" title="Remove">×</button>
|
|
`;
|
|
container.appendChild(row);
|
|
var inputs = row.querySelectorAll('input[type="text"]');
|
|
if (inputs.length > 0) inputs[0].focus();
|
|
}
|
|
function handleQuestionKeydown(event) {
|
|
if (event.key === 'Enter') {
|
|
event.preventDefault();
|
|
addQuestion();
|
|
}
|
|
}
|
|
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>
|