HH/templates/complaints/investigation_respond.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

91 lines
4.9 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 Response" %} - 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: #007bbd; }
</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 "Please answer the following questions" %}</p>
</div>
<div class="form-section">
<div class="p-4 rounded-lg mb-6" style="background:#f0f9ff;border:1px solid #bae6fd">
<div class="flex items-center gap-2 mb-1">
<svg class="w-5 h-5" style="color:#0369a1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
<span class="font-semibold text-sm" style="color:#0369a1">{% trans "Requested by" %}</span>
</div>
<p class="font-bold" style="color:#0c4a6e">{{ inv_response.investigation.champion.get_full_name }}</p>
<p class="text-sm" style="color:#0369a1">{% trans "Department Champion" %}</p>
</div>
<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>
<form method="post" class="space-y-6">
{% csrf_token %}
{% for pair in question_answer_pairs %}
<div class="p-4 border-2 border-gray-100 rounded-xl" style="background:#fafafa">
<div class="flex items-start gap-2 mb-3">
<span class="flex-shrink-0 w-7 h-7 flex items-center justify-center rounded-full text-white text-sm font-bold" style="background:#005696">{{ forloop.counter }}</span>
<p class="font-semibold text-gray-800 pt-0.5">{{ pair.question.question_text }}</p>
</div>
<textarea name="question_{{ pair.question.id }}" rows="4" class="form-control resize-none"
placeholder="{% trans 'Type your answer here...' %}"
required>{{ pair.existing_answer }}</textarea>
</div>
{% endfor %}
<div class="p-4 rounded-xl" style="background:#eef6fb;border:1px solid #93c5fd">
<p class="text-sm" style="color:#005696">
<strong>{% trans "Important:" %}</strong> {% trans "This link can only be used once. After submitting, it will expire." %}
</p>
</div>
<button type="submit" class="btn-primary py-4 text-lg">
{% trans "Submit My Answers" %}
</button>
</form>
</div>
<div class="text-center mt-6">
<p class="text-gray-400 text-xs">{% trans "PX360 Complaint Management System" %}</p>
</div>
</div>
</body>
</html>