HH/apps/complaints/urls.py
2026-02-22 08:35:53 +03:00

130 lines
9.0 KiB
Python

from django.urls import include, path
from rest_framework.routers import DefaultRouter
from .views import (
ComplaintAttachmentViewSet,
ComplaintMeetingViewSet,
ComplaintPRInteractionViewSet,
ComplaintViewSet,
InquiryViewSet,
complaint_explanation_form,
generate_complaint_pdf,
api_locations,
api_sections,
api_subsections,
api_departments,
)
from . import ui_views, ui_views_explanation, ui_views_oncall
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")
router.register(r"api/pr-interactions", ComplaintPRInteractionViewSet, basename="pr-interaction-api")
router.register(r"api/meetings", ComplaintMeetingViewSet, basename="complaint-meeting-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"),
path("<uuid:pk>/activate/", ui_views.complaint_activate, name="complaint_activate"),
# 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>/activate/", ui_views.inquiry_activate, name="inquiry_activate"),
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/track/", ui_views.public_complaint_track, name="public_complaint_track"),
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"),
# Location Hierarchy APIs (No Authentication Required)
path("public/api/locations/", api_locations, name="api_locations"),
path("public/api/locations/<int:location_id>/sections/", api_sections, name="api_sections"),
path("public/api/locations/<int:location_id>/sections/<int:section_id>/subsections/", api_subsections, name="api_subsections"),
path("public/api/hospitals/<int:hospital_id>/departments/", api_departments, name="api_departments"),
# 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"),
# Involved Departments Management
path("<uuid:complaint_pk>/departments/add/", ui_views.involved_department_add, name="involved_department_add"),
path("departments/<uuid:pk>/edit/", ui_views.involved_department_edit, name="involved_department_edit"),
path("departments/<uuid:pk>/remove/", ui_views.involved_department_remove, name="involved_department_remove"),
path("departments/<uuid:pk>/response/", ui_views.involved_department_response, name="involved_department_response"),
# Request Explanation Form
path("<uuid:pk>/request-explanation/", ui_views_explanation.request_explanation_form, name="request_explanation_form"),
# Involved Staff Management
path("<uuid:complaint_pk>/staff/add/", ui_views.involved_staff_add, name="involved_staff_add"),
path("staff/<uuid:pk>/edit/", ui_views.involved_staff_edit, name="involved_staff_edit"),
path("staff/<uuid:pk>/remove/", ui_views.involved_staff_remove, name="involved_staff_remove"),
path("staff/<uuid:pk>/explanation/", ui_views.involved_staff_explanation, name="involved_staff_explanation"),
# On-Call Admin Schedule Management
path("oncall/", ui_views_oncall.oncall_dashboard, name="oncall_dashboard"),
path("oncall/schedules/", ui_views_oncall.oncall_schedule_list, name="oncall_schedule_list"),
path("oncall/schedules/new/", ui_views_oncall.oncall_schedule_create, name="oncall_schedule_create"),
path("oncall/schedules/<uuid:pk>/", ui_views_oncall.oncall_schedule_detail, name="oncall_schedule_detail"),
path("oncall/schedules/<uuid:pk>/edit/", ui_views_oncall.oncall_schedule_edit, name="oncall_schedule_edit"),
path("oncall/schedules/<uuid:pk>/delete/", ui_views_oncall.oncall_schedule_delete, name="oncall_schedule_delete"),
path("oncall/schedules/<uuid:schedule_pk>/admins/add/", ui_views_oncall.oncall_admin_add, name="oncall_admin_add"),
path("oncall/admins/<uuid:pk>/edit/", ui_views_oncall.oncall_admin_edit, name="oncall_admin_edit"),
path("oncall/admins/<uuid:pk>/delete/", ui_views_oncall.oncall_admin_delete, name="oncall_admin_delete"),
# Complaint Adverse Action Management
path("adverse-actions/", ui_views.adverse_action_list, name="adverse_action_list"),
path("<uuid:complaint_pk>/adverse-actions/add/", ui_views.adverse_action_add, name="adverse_action_add"),
path("adverse-actions/<uuid:pk>/edit/", ui_views.adverse_action_edit, name="adverse_action_edit"),
path("adverse-actions/<uuid:pk>/status/", ui_views.adverse_action_update_status, name="adverse_action_update_status"),
path("adverse-actions/<uuid:pk>/escalate/", ui_views.adverse_action_escalate, name="adverse_action_escalate"),
path("adverse-actions/<uuid:pk>/delete/", ui_views.adverse_action_delete, name="adverse_action_delete"),
# API Routes
path("", include(router.urls)),
]