HH/templates/complaints/investigation_review.html
ismail badb6a9ebf
All checks were successful
Build and Push Docker Image / build (push) Successful in 2m41s
feat: QI Projects — team-member task management + My Tasks + notifications
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
2026-06-16 23:55:58 +03:00

133 lines
6.8 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 "Review Investigation" %} - 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-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: #6d28d9; }
.staff-card {
border: 2px solid #e2e8f0; border-radius: 0.75rem; padding: 1rem;
margin-bottom: 1rem; transition: all 0.2s;
}
.staff-card:hover { border-color: #c4b5fd; }
.qa-block {
background: #f8fafc; border-radius: 0.5rem; padding: 0.75rem;
margin-bottom: 0.5rem;
}
</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 "Review Investigation Answers" %}</h1>
<p class="text-white/80 mt-1">{% trans "Review staff responses and write your final reply" %}</p>
</div>
{% if error %}
<div class="form-section">
<div class="bg-red-50 border-l-4 border-red-500 p-4 rounded-r-lg">
<p class="text-red-700 font-medium">{{ error }}</p>
</div>
</div>
{% endif %}
<div class="form-section">
<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-1">{% trans "Complaint" %} #{{ complaint.reference_number }}</h3>
<p class="text-sm text-gray-600">{{ complaint.title }}</p>
</div>
<h3 class="text-lg font-bold mb-4" style="color:#005696">{% trans "Staff Responses" %}</h3>
{% for sd in staff_data %}
<div class="staff-card">
<div class="flex items-center gap-3 mb-4 pb-3 border-b border-gray-100">
<div class="w-10 h-10 rounded-full flex items-center justify-center text-white font-bold text-sm" style="background:#005696">
{{ sd.staff.first_name|first }}{{ sd.staff.last_name|first }}
</div>
<div>
<p class="font-bold text-gray-800">{{ sd.staff.get_full_name }}</p>
{% if sd.staff.job_title %}<p class="text-xs text-gray-400">{{ sd.staff.job_title }}</p>{% endif %}
<span class="inline-flex items-center gap-1 text-xs mt-1 px-2 py-0.5 rounded-full
{% if sd.is_completed %}bg-green-100 text-green-700{% else %}bg-yellow-100 text-yellow-700{% endif %}">
{% if sd.is_completed %}{% trans "Responded" %}{% else %}{% trans "Pending" %}{% endif %}
</span>
</div>
</div>
{% if sd.is_completed %}
{% for pair in sd.qa_pairs %}
<div class="qa-block">
<div class="flex items-start gap-2 mb-2">
<span class="flex-shrink-0 w-5 h-5 flex items-center justify-center rounded-full text-white text-xs font-bold" style="background:#005696">{{ forloop.counter }}</span>
<p class="text-sm font-semibold text-gray-700">{{ pair.question.question_text }}</p>
</div>
<p class="text-sm text-gray-600 ml-7">{{ pair.answer|default:"&mdash;" }}</p>
</div>
{% endfor %}
{% else %}
<p class="text-sm text-gray-400 italic">{% trans "This staff member has not responded yet." %}</p>
{% endif %}
</div>
{% endfor %}
{% if staff_data %}
<hr class="my-6 border-gray-200">
<h3 class="text-lg font-bold mb-4" style="color:#005696">{% trans "Your Final Reply" %}</h3>
<p class="text-sm text-gray-500 mb-3">{% trans "Based on the investigation responses above, write your final reply. This will be sent to the department manager for review." %}</p>
<form method="post" enctype="multipart/form-data" class="space-y-4">
{% csrf_token %}
<textarea name="final_reply" rows="6" class="form-control resize-none"
placeholder="{% trans 'Write your final reply based on the investigation...' %}"
required>{{ investigation.final_reply }}</textarea>
<div>
<label class="form-label">{% trans "Attachments (Optional)" %}</label>
<input type="file" name="attachments" multiple class="block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4 file:rounded-xl file:border-0 file:text-sm
file:font-semibold file:bg-gray-100 file:text-gray-700 hover:file:bg-gray-200
file:transition cursor-pointer border-2 border-gray-200 rounded-xl">
</div>
<button type="submit" class="btn-primary py-4 text-lg">
{% trans "Submit Final Reply" %}
</button>
</form>
{% endif %}
</div>
<div class="text-center mt-6">
<p class="text-gray-400 text-xs">{% trans "PX360 Complaint Management System" %}</p>
</div>
</div>
</body>
</html>