HH/apps/complaints/urls.py

85 lines
5.1 KiB
Python

from django.urls import include, path
from rest_framework.routers import DefaultRouter
from .views import (
ComplaintAttachmentViewSet,
ComplaintViewSet,
InquiryViewSet,
complaint_explanation_form,
generate_complaint_pdf,
)
from . import ui_views
app_name = "complaints"
router = DefaultRouter()
router.register(r"api/complaints", ComplaintViewSet, basename="complaint-api")
router.register(r"api/attachments", ComplaintAttachmentViewSet, basename="complaint-attachment-api")
router.register(r"api/inquiries", InquiryViewSet, basename="inquiry-api")
urlpatterns = [
# Complaints UI Views
path("", ui_views.complaint_list, name="complaint_list"),
path("new/", ui_views.complaint_create, name="complaint_create"),
path("<uuid:pk>/", ui_views.complaint_detail, name="complaint_detail"),
path("<uuid:pk>/assign/", ui_views.complaint_assign, name="complaint_assign"),
path("<uuid:pk>/change-status/", ui_views.complaint_change_status, name="complaint_change_status"),
path("<uuid:pk>/change-department/", ui_views.complaint_change_department, name="complaint_change_department"),
path("<uuid:pk>/add-note/", ui_views.complaint_add_note, name="complaint_add_note"),
path("<uuid:pk>/escalate/", ui_views.complaint_escalate, name="complaint_escalate"),
# Export Views
path("export/csv/", ui_views.complaint_export_csv, name="complaint_export_csv"),
path("export/excel/", ui_views.complaint_export_excel, name="complaint_export_excel"),
# Bulk Actions
path("bulk/assign/", ui_views.complaint_bulk_assign, name="complaint_bulk_assign"),
path("bulk/status/", ui_views.complaint_bulk_status, name="complaint_bulk_status"),
path("bulk/escalate/", ui_views.complaint_bulk_escalate, name="complaint_bulk_escalate"),
# Inquiries UI Views
path("inquiries/", ui_views.inquiry_list, name="inquiry_list"),
path("inquiries/new/", ui_views.inquiry_create, name="inquiry_create"),
path("inquiries/<uuid:pk>/", ui_views.inquiry_detail, name="inquiry_detail"),
path("inquiries/<uuid:pk>/assign/", ui_views.inquiry_assign, name="inquiry_assign"),
path("inquiries/<uuid:pk>/change-status/", ui_views.inquiry_change_status, name="inquiry_change_status"),
path("inquiries/<uuid:pk>/add-note/", ui_views.inquiry_add_note, name="inquiry_add_note"),
path("inquiries/<uuid:pk>/respond/", ui_views.inquiry_respond, name="inquiry_respond"),
# Analytics
path("analytics/", ui_views.complaints_analytics, name="complaints_analytics"),
# SLA Configuration Management
path("settings/sla/", ui_views.sla_config_list, name="sla_config_list"),
path("settings/sla/new/", ui_views.sla_config_create, name="sla_config_create"),
path("settings/sla/<uuid:pk>/edit/", ui_views.sla_config_edit, name="sla_config_edit"),
path("settings/sla/<uuid:pk>/delete/", ui_views.sla_config_delete, name="sla_config_delete"),
# Escalation Rules Management
path("settings/escalation-rules/", ui_views.escalation_rule_list, name="escalation_rule_list"),
path("settings/escalation-rules/new/", ui_views.escalation_rule_create, name="escalation_rule_create"),
path("settings/escalation-rules/<uuid:pk>/edit/", ui_views.escalation_rule_edit, name="escalation_rule_edit"),
path("settings/escalation-rules/<uuid:pk>/delete/", ui_views.escalation_rule_delete, name="escalation_rule_delete"),
# Complaint Thresholds Management
path("settings/thresholds/", ui_views.complaint_threshold_list, name="complaint_threshold_list"),
path("settings/thresholds/new/", ui_views.complaint_threshold_create, name="complaint_threshold_create"),
path("settings/thresholds/<uuid:pk>/edit/", ui_views.complaint_threshold_edit, name="complaint_threshold_edit"),
path("settings/thresholds/<uuid:pk>/delete/", ui_views.complaint_threshold_delete, name="complaint_threshold_delete"),
# AJAX Helpers
path("ajax/departments/", ui_views.get_departments_by_hospital, name="get_departments_by_hospital"),
path("ajax/physicians/", ui_views.get_staff_by_department, name="get_physicians_by_department"),
path("ajax/search-patients/", ui_views.search_patients, name="search_patients"),
# Public Complaint Form (No Authentication Required)
path("public/submit/", ui_views.public_complaint_submit, name="public_complaint_submit"),
path("public/success/<str:reference>/", ui_views.public_complaint_success, name="public_complaint_success"),
path("public/api/lookup-patient/", ui_views.api_lookup_patient, name="api_lookup_patient"),
path("public/api/load-departments/", ui_views.api_load_departments, name="api_load_departments"),
path("public/api/load-categories/", ui_views.api_load_categories, name="api_load_categories"),
# Public Explanation Form (No Authentication Required)
path("<uuid:complaint_id>/explain/<str:token>/", complaint_explanation_form, name="complaint_explanation_form"),
# Resend Explanation
path(
"<uuid:pk>/resend-explanation/",
ComplaintViewSet.as_view({"post": "resend_explanation"}),
name="complaint_resend_explanation",
),
# PDF Export
path("<uuid:pk>/pdf/", generate_complaint_pdf, name="complaint_pdf"),
# API Routes
path("", include(router.urls)),
]