274 lines
14 KiB
HTML
274 lines
14 KiB
HTML
{% extends 'layouts/base.html' %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% trans "Create Action Plan" %} - PX360{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid px-4 py-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<div>
|
|
<h1 class="h3 mb-1">{% trans "Create Action Plan" %}</h1>
|
|
<p class="text-muted mb-0">{% trans "Create a new improvement action plan manually" %}</p>
|
|
</div>
|
|
<a href="{% url 'actions:action_list' %}" class="btn btn-outline-secondary">
|
|
<i class="fas fa-arrow-left me-2"></i>{% trans "Back to Actions" %}
|
|
</a>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-8">
|
|
<div class="card shadow-sm">
|
|
<div class="card-header bg-white py-3">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fas fa-plus-circle text-primary me-2"></i>
|
|
{% trans "Action Plan Details" %}
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="post" id="actionForm" novalidate>
|
|
{% csrf_token %}
|
|
|
|
<!-- Source Information -->
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label for="{{ form.source_type.id_for_label }}" class="form-label">
|
|
{% trans "Source Type" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.source_type }}
|
|
{% if form.source_type.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.source_type.errors.0 }}</div>
|
|
{% endif %}
|
|
<small class="form-text text-muted">
|
|
{% trans "Select where this action plan originated from" %}
|
|
</small>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Title -->
|
|
<div class="mb-3">
|
|
<label for="{{ form.title.id_for_label }}" class="form-label">
|
|
{% trans "Title" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.title }}
|
|
{% if form.title.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.title.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Description -->
|
|
<div class="mb-3">
|
|
<label for="{{ form.description.id_for_label }}" class="form-label">
|
|
{% trans "Description" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.description }}
|
|
{% if form.description.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.description.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Organization -->
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label for="{{ form.hospital.id_for_label }}" class="form-label">
|
|
{% trans "Hospital" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.hospital }}
|
|
{% if form.hospital.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.hospital.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="{{ form.department.id_for_label }}" class="form-label">
|
|
{% trans "Department" %}
|
|
</label>
|
|
{{ form.department }}
|
|
{% if form.department.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.department.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Classification -->
|
|
<div class="row mb-3">
|
|
<div class="col-md-4">
|
|
<label for="{{ form.category.id_for_label }}" class="form-label">
|
|
{% trans "Category" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.category }}
|
|
{% if form.category.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.category.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="{{ form.priority.id_for_label }}" class="form-label">
|
|
{% trans "Priority" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.priority }}
|
|
{% if form.priority.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.priority.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="{{ form.severity.id_for_label }}" class="form-label">
|
|
{% trans "Severity" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.severity }}
|
|
{% if form.severity.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.severity.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Assignment -->
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<label for="{{ form.assigned_to.id_for_label }}" class="form-label">
|
|
{% trans "Assign To" %}
|
|
</label>
|
|
{{ form.assigned_to }}
|
|
{% if form.assigned_to.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.assigned_to.errors.0 }}</div>
|
|
{% endif %}
|
|
<small class="form-text text-muted">
|
|
{% trans "User responsible for implementing this action" %}
|
|
</small>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="{{ form.due_at.id_for_label }}" class="form-label">
|
|
{% trans "Due Date" %} <span class="text-danger">*</span>
|
|
</label>
|
|
{{ form.due_at }}
|
|
{% if form.due_at.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.due_at.errors.0 }}</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Action Plan -->
|
|
<div class="mb-4">
|
|
<label for="{{ form.action_plan.id_for_label }}" class="form-label">
|
|
{% trans "Action Plan" %}
|
|
</label>
|
|
{{ form.action_plan }}
|
|
{% if form.action_plan.errors %}
|
|
<div class="invalid-feedback d-block">{{ form.action_plan.errors.0 }}</div>
|
|
{% endif %}
|
|
<small class="form-text text-muted">
|
|
{% trans "Describe the steps to address this issue" %}
|
|
</small>
|
|
</div>
|
|
|
|
<!-- Approval Required -->
|
|
<div class="mb-4">
|
|
<div class="form-check">
|
|
{{ form.requires_approval }}
|
|
<label class="form-check-label" for="{{ form.requires_approval.id_for_label }}">
|
|
{% trans "Requires PX Admin approval before closure" %}
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Submit -->
|
|
<div class="d-flex justify-content-between">
|
|
<a href="{% url 'actions:action_list' %}" class="btn btn-outline-secondary">
|
|
{% trans "Cancel" %}
|
|
</a>
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="fas fa-save me-2"></i>{% trans "Create Action Plan" %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Sidebar with Info -->
|
|
<div class="col-lg-4">
|
|
<div class="card shadow-sm mb-3">
|
|
<div class="card-header bg-white py-3">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fas fa-info-circle text-info me-2"></i>
|
|
{% trans "Action Plan Types" %}
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<h6 class="fw-bold mb-2">{% trans "Meeting Sources:" %}</h6>
|
|
<ul class="list-unstyled small text-muted mb-3">
|
|
<li><i class="fas fa-users me-2"></i>Patient & Family Rights Committee</li>
|
|
<li><i class="fas fa-briefcase me-2"></i>Executive Committee</li>
|
|
<li><i class="fas fa-building me-2"></i>Department Meetings</li>
|
|
<li><i class="fas fa-clipboard-check me-2"></i>Ward/Department Rounds</li>
|
|
</ul>
|
|
|
|
<h6 class="fw-bold mb-2">{% trans "Other Sources:" %}</h6>
|
|
<ul class="list-unstyled small text-muted mb-0">
|
|
<li><i class="fas fa-comment me-2"></i>Staff Feedback/Comments</li>
|
|
<li><i class="fas fa-eye me-2"></i>Patient Observation</li>
|
|
<li><i class="fas fa-clipboard-list me-2"></i>Quality Audit</li>
|
|
<li><i class="fas fa-tasks me-2"></i>Management Review</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="card-header bg-white py-3">
|
|
<h5 class="card-title mb-0">
|
|
<i class="fas fa-lightbulb text-warning me-2"></i>
|
|
{% trans "Tips" %}
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<ul class="mb-0">
|
|
<li class="mb-2">{% trans "Select the appropriate source type for accurate tracking" %}</li>
|
|
<li class="mb-2">{% trans "Assign to a responsible person for accountability" %}</li>
|
|
<li class="mb-2">{% trans "Set realistic due dates based on priority" %}</li>
|
|
<li class="mb-0">{% trans "Provide clear action steps for implementation" %}</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Cascading dropdown: Hospital -> Department
|
|
const hospitalSelect = document.getElementById('{{ form.hospital.id_for_label }}');
|
|
const departmentSelect = document.getElementById('{{ form.department.id_for_label }}');
|
|
|
|
if (hospitalSelect && departmentSelect) {
|
|
hospitalSelect.addEventListener('change', function() {
|
|
const hospitalId = this.value;
|
|
|
|
if (hospitalId) {
|
|
// Fetch departments for selected hospital
|
|
fetch(`/api/organizations/departments/?hospital=${hospitalId}`)
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
departmentSelect.innerHTML = '<option value="">-- Select Department --</option>';
|
|
data.results.forEach(dept => {
|
|
const option = document.createElement('option');
|
|
option.value = dept.id;
|
|
option.textContent = dept.name;
|
|
departmentSelect.appendChild(option);
|
|
});
|
|
})
|
|
.catch(error => console.error('Error fetching departments:', error));
|
|
} else {
|
|
departmentSelect.innerHTML = '<option value="">-- Select Department --</option>';
|
|
}
|
|
});
|
|
}
|
|
|
|
// Form validation
|
|
const form = document.getElementById('actionForm');
|
|
form.addEventListener('submit', function(event) {
|
|
if (!form.checkValidity()) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
form.classList.add('was-validated');
|
|
}, false);
|
|
});
|
|
</script>
|
|
{% endblock %} |