Maintenance Module Documentation
Overview
The Maintenance Module tracks physical assets and their repair lifecycles. It allows Housekeeping to report issues ("Broken AC Room 101") and Maintenance Managers to assign, track, and close "Tickets". It features an Auto-Escalation system for verifying SLA compliance.
Architecture
Domain Layer (app/Domain/Maintenance)
Models
MaintenanceTicket (MaintenanceTicket.php)
- Table:
maintenance_tickets - Source: Can be reported by Guest, Staff, or Housekeeping.
- Priority: LOW (72h) | MEDIUM (24h) | HIGH (8h) | URGENT (2h).
- Status: OPEN -> ASSIGNED -> IN_PROGRESS -> RESOLVED -> CLOSED.
Services
MaintenanceService (MaintenanceService.php)
Purpose: Workflow engine.
Key Methods:
createTicket(data)
- Logic: Creates record. Calls
tryAutoAssign(). Logs activity.
tryAutoAssign(ticket)
Attempts to route the ticket.
- Logic: Selects the first active Staff member in the 'Maintenance' department.
- Critique: Extremely simplistic. Does not check if that staff member already has 50 tickets.
escalateOverdueTickets()
Cron-job handler.
- Logic:
- Finds tickets where
created_at + priority_sla < now. - Bumps Priority (Low -> Medium -> High -> Urgent).
- Logs "Auto-escalated due to SLA breach".
- Finds tickets where
Audit Findings & Improvements
Strengths
- SLA Enforcement: The escalation logic ensures tickets don't get lost in the void. A "Low" priority dripping tap will eventually become "Urgent" if ignored for a week.
- Audit Logging: Every state change (Open -> Assigned) is logged via
ActivityLog, providing accountability.
Issues Identified
Major
- Assignment Load Balancing: The
tryAutoAssignmethod assigns every single ticket to the first alphabetized employee in the Maintenance department until they quit found.- Fix: Implement Round Robin or Least-Loaded assignment.
Minor
- Duplication: Information from
HousekeepingChecklist(the report source) is copied intoMaintenanceTicketrather than referenced. If the housekeeper updates the description, the ticket doesn't see it.
Module Version
Version: 1.0 Status: Needs Improvement (Assignment Logic)