HH/templates/partials/notes_panel.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

51 lines
2.5 KiB
HTML

{% load i18n %}
<section class="bg-white rounded-2xl p-4 shadow-sm border border-slate-100">
<h3 class="font-bold text-navy mb-4 flex items-center gap-2">
<i data-lucide="message-square" class="w-5 h-5 text-blue"></i>
{% trans "Notes" %}
</h3>
{% if request.user.is_authenticated %}
<form method="post" action="{% url 'core:add_note' %}" class="mb-4">
{% csrf_token %}
<input type="hidden" name="content_type_id" value="{{ content_type_id }}">
<input type="hidden" name="object_id" value="{{ object_id }}">
<textarea name="note" rows="3"
class="w-full px-4 py-3 border-2 border-slate-200 rounded-xl focus:outline-none focus:border-navy focus:ring-2 focus:ring-navy/20 resize-none text-sm mb-3"
placeholder="{% trans 'Add a note...' %}" required></textarea>
<div class="flex justify-end">
<button type="submit" class="px-4 py-2 bg-navy text-white rounded-xl font-semibold hover:bg-blue transition text-sm inline-flex items-center gap-2">
<i data-lucide="plus-circle" class="w-4 h-4"></i>
{% trans "Add Note" %}
</button>
</div>
</form>
{% endif %}
{% if notes %}
<div class="space-y-4">
{% for note in notes %}
<div class="border border-slate-100 rounded-xl p-4 bg-slate-50">
<div class="flex items-center justify-between mb-2">
<div class="flex items-center gap-2">
<div class="w-7 h-7 bg-navy rounded-full flex items-center justify-center text-white font-bold text-[10px]">
{% if note.created_by %}{{ note.created_by.first_name|first }}{{ note.created_by.last_name|first }}{% else %}?{% endif %}
</div>
<span class="text-sm font-semibold text-navy">
{% if note.created_by %}{{ note.created_by.get_full_name }}{% else %}{% trans "Unknown" %}{% endif %}
</span>
</div>
<span class="text-xs text-slate">{{ note.created_at|date:"M d, Y h:i A" }}</span>
</div>
<p class="text-sm text-slate-700 leading-relaxed pl-9">{{ note.note|linebreaksbr }}</p>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center py-8">
<i data-lucide="message-square" class="w-12 h-12 mx-auto text-slate-300 mb-3"></i>
<p class="text-slate text-sm">{% trans "No notes yet" %}</p>
</div>
{% endif %}
</section>