129 lines
8.4 KiB
HTML
129 lines
8.4 KiB
HTML
{% extends 'layouts/base.html' %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% if action %}{% trans "Edit Action Plan" %}{% else %}{% trans "Create Action Plan" %}{% endif %} - PX360{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="max-w-3xl mx-auto">
|
|
<div class="mb-8">
|
|
<h1 class="text-3xl font-bold text-navy mb-2">
|
|
{% if action %}{% trans "Edit Action Plan" %}{% else %}{% trans "Create Action Plan" %}{% endif %}
|
|
</h1>
|
|
<p class="text-slate">
|
|
{% if action %}{% trans "Update action plan details" %}{% else %}{% trans "Create a new improvement action plan" %}{% endif %}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="bg-white rounded-2xl shadow-sm border border-slate-100 overflow-hidden">
|
|
<form method="post">
|
|
{% csrf_token %}
|
|
{% if linked_complaint_id %}
|
|
<input type="hidden" name="complaint_id" value="{{ linked_complaint_id }}">
|
|
{% endif %}
|
|
|
|
{% if form.errors %}
|
|
<div class="m-6 p-4 bg-red-50 border border-red-200 rounded-xl">
|
|
<p class="text-sm font-bold text-red-700 mb-2">{% trans "Please fix the following errors:" %}</p>
|
|
<ul class="text-sm text-red-600 space-y-1">
|
|
{% for field in form %}
|
|
{% for error in field.errors %}
|
|
<li>{{ field.label }}: {{ error }}</li>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
{% for error in form.non_field_errors %}
|
|
<li>{{ error }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="p-6 space-y-6">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="title" class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Title" %} <span class="text-navy">*</span></label>
|
|
<input type="text" class="w-full px-4 py-3 border border-slate-200 rounded-xl text-navy focus:ring-2 focus:ring-navy focus:border-transparent transition" id="title" name="title" value="{{ action.title|default:'' }}" required placeholder="{% trans 'Enter action plan title' %}">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="priority" class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Priority" %} <span class="text-navy">*</span></label>
|
|
<select class="w-full px-4 py-3 border border-slate-200 rounded-xl text-navy focus:ring-2 focus:ring-navy focus:border-transparent transition" id="priority" name="priority" required>
|
|
<option value="low" {% if action.priority == 'low' or not action %}selected{% endif %}>{% trans "Low" %}</option>
|
|
<option value="medium" {% if action.priority == 'medium' %}selected{% endif %}>{% trans "Medium" %}</option>
|
|
<option value="high" {% if action.priority == 'high' %}selected{% endif %}>{% trans "High" %}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="description" class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Description" %} <span class="text-navy">*</span></label>
|
|
<textarea class="w-full px-4 py-3 border border-slate-200 rounded-xl text-navy focus:ring-2 focus:ring-navy focus:border-transparent transition" id="description" name="description" rows="4" required placeholder="{% trans 'Describe the action plan...' %}">{{ action.description|default:'' }}</textarea>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="assigned_to" class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Assigned To" %}</label>
|
|
<select class="w-full px-4 py-3 border border-slate-200 rounded-xl text-navy focus:ring-2 focus:ring-navy focus:border-transparent transition" id="assigned_to" name="assigned_to">
|
|
<option value="">{% trans "Select User" %}</option>
|
|
{% for user in users %}
|
|
<option value="{{ user.id }}" {% if action.assigned_to_id == user.id %}selected{% endif %}>{{ user.get_full_name|default:user.username }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="due_at" class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Due Date" %} <span class="text-navy">*</span></label>
|
|
<input type="datetime-local" class="w-full px-4 py-3 border border-slate-200 rounded-xl text-navy focus:ring-2 focus:ring-navy focus:border-transparent transition" id="due_at" name="due_at" required>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label for="category" class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Category" %} <span class="text-navy">*</span></label>
|
|
<select class="w-full px-4 py-3 border border-slate-200 rounded-xl text-navy focus:ring-2 focus:ring-navy focus:border-transparent transition" id="category" name="category" required>
|
|
<option value="process_improvement" selected>{% trans "Process Improvement" %}</option>
|
|
<option value="clinical_quality">{% trans "Clinical Quality" %}</option>
|
|
<option value="patient_safety">{% trans "Patient Safety" %}</option>
|
|
<option value="service_quality">{% trans "Service Quality" %}</option>
|
|
<option value="staff_behavior">{% trans "Staff Behavior" %}</option>
|
|
<option value="facility">{% trans "Facility & Environment" %}</option>
|
|
<option value="other">{% trans "Other" %}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="severity" class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Severity" %} <span class="text-navy">*</span></label>
|
|
<select class="w-full px-4 py-3 border border-slate-200 rounded-xl text-navy focus:ring-2 focus:ring-navy focus:border-transparent transition" id="severity" name="severity" required>
|
|
<option value="low">{% trans "Low" %}</option>
|
|
<option value="medium" selected>{% trans "Medium" %}</option>
|
|
<option value="high">{% trans "High" %}</option>
|
|
<option value="critical">{% trans "Critical" %}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
{% if linked_complaint %}
|
|
<div>
|
|
<label class="block text-sm font-semibold text-slate-700 mb-2">{% trans "Related Complaint" %}</label>
|
|
<div class="flex items-center gap-2 px-4 py-3 bg-blue-50 border border-blue-200 rounded-xl">
|
|
<i data-lucide="link" class="w-4 h-4 text-blue-600 shrink-0"></i>
|
|
<div class="min-w-0">
|
|
<p class="text-sm font-bold text-navy truncate">{{ linked_complaint.reference_number }}</p>
|
|
<p class="text-xs text-slate-500 truncate">{{ linked_complaint.title|truncatechars:60 }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="px-6 py-4 bg-slate-50 border-t border-slate-100 flex justify-end gap-3">
|
|
<a href="{% url 'actions:action_list' %}" class="px-6 py-3 bg-slate-200 text-slate-700 rounded-xl font-semibold hover:bg-slate-300 transition">
|
|
{% trans "Cancel" %}
|
|
</a>
|
|
<button type="submit" class="px-6 py-3 bg-gradient-to-r from-navy to-blue text-white rounded-xl font-semibold hover:opacity-90 transition">
|
|
{% trans "Save" %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %} |