- Add UserProfileModel and migration for user profile data
- Enhance User Management views, controller, and doctor/nurse search integration
- Refactor handleAuthError to separate 401 session expiry from 403 access restriction
- Apply granular permission checks to sidebar navigation links
- Open Bed Status view for all authenticated users
- Support GET and POST on charges item routes and exempt billing charges from CSRF desync
- Support hospital, patient, doctor, and date placeholders matching template variables
- Convert local logo and signature paths to base64 Data URIs for mPDF
- Apply token replacement to report body in single and compiled prints
- Add interactive placeholder toolbar in diagnosis template settings view
- Add unit tests in tests/unit/DiagnosisTemplateTokenTest.php
- Add Day Care (<24h) and Emergency (Casualty) admission pathways with prefixes DC- and ER-
- Add dedicated physical wards, ESI 5-level triage, MLC tracking, and PADSS day care discharge
- Implement audited 'Convert to IPD' workflow with SBAR handover and automated bed transfer
- Support unified IPD billing with dedicated group headers for Day Care and Emergency charges
- Redesign Hospital Admission Desk with executive card layout and modern triage controls
- Add comprehensive user documentation and SVG flowchart in public/help.html
- Completely remove legacy patient_master.p_lname column from database and application code
Route User Management and Role Master action results through fixed top-right notifications, including SPA partial responses, validation failures, session actions, and network errors.
Move per-user permissions into row actions, add contextual module permission guides, show selected-user details, and relocate online sessions to the profile menu.
Add configurable role management, expanded project permission coverage, secured module routes, and single-active-session enforcement with online user administration.
Load referral master data into patient registration/edit screens, persist patient referby, expose searchable referral inputs in patient and IPD forms, and make referral title editable as free text in referral master CRUD.
- Add checkForUpdates() with 10-minute cached GitHub API check
- Add fetchLatestCommitInfo() to get latest commit SHA + message from GitHub API
- Save deployed commit SHA to writable/deployed_commit.txt after each deploy
- Invalidate update cache on successful deploy so next check is always fresh
- Button turns yellow + red NEW badge when update available
- Show commit message and short SHA diff (deployed → latest) in alert
- Show green 'Up to date' with deployed SHA when already current
- GitHub API rate limit safe: checks once per 10 mins via file cache
- Remove initial 'running' history entry (orphans when PHP times out)
- Add purgeStaleRunning() to mark old 'running' entries as 'timeout' on next deploy
- Add set_time_limit(300) to prevent PHP timeout during large ZIP download
- Add timestamps to log file entries for easier debugging
- Include ZIP size and source URL in success detail
- History now keeps last 20 entries (was 12)
- Show dash instead of blank for entries with no detail
- Style 'timeout' status same as 'failed' (red pill)
- Move detail modal from system_ops_panel.php to system_ops.php
- Modal is now outside #systemOpsPanel so panel refresh never destroys it
- Skip refreshPanel() while modal is open (prevents backdrop desync)
- Add hidden.bs.modal handler to clean up lingering backdrop and body classes
- Fix show.bs.modal handler to correctly read data-detail via jQuery .data()
- Add white-space:pre-wrap to detail content for readable log output
- readNetworkStatus() now returns array of all interfaces instead of single string
- Parses 'ip addr' output (with ifconfig fallback) for all IPv4 interfaces
- Each interface classified as LAN / VPN / Public by name and IP range
- VPN detected by interface prefix: wg*, tun*, tap*, vpn*
- RFC1918 ranges (192.168.x, 10.x, 172.16-31.x) shown as LAN
- Display: icon + IP + interface name badge + type label per row
- Handles NAT servers showing both local LAN and VPN IPs simultaneously
- Remove Restart Web, Restart PHP-FPM, Shutdown, Reboot buttons
- Remove runServerAction() library method and action() controller
- Remove /system-ops/action route (no longer needed)
- Parse /proc/mdstat into structured array (name, level, health, drives)
- Show each RAID array as a card with colored drive icons per-slot
- Green drive = healthy, red = failed, blue = spare
- Show rebuild progress bar when array is rebuilding
- Internet status shown as colored badge with wifi icon
- Services shown as colored badges (green=running, grey=other)
- Remove 'Update HMS (Git)' button and related functionality
- Remove runUpdate() method from SystemOperations
- Remove update() controller method
- Remove /setting/admin/system-ops/update route
- Remove setup_git_config.sh (no longer needed)
- Keep 'Deploy from GitHub' button as the only update method
- Rationale: Direct GitHub deployment is more reliable and requires no git config
Result: Single, simpler deployment method that always works
- New 'Deploy from GitHub' button downloads latest code directly
- No git configuration required - more reliable for git-unfriendly servers
- Automatically syncs changed files (skips .git, vendor, writable)
- Both methods available: git pull (if configured) or direct GitHub download
- Each has a clear confirmation dialog explaining the method
- Handles temporary extraction and cleanup automatically
This solves HMS deployment when git is not accessible to PHP process
- HMS_FEATURES_PRESENTATION.html: full styled presentation with cover,
professional introduction, 11 feature sections, tech stack, compliance,
print/PDF button, and proper @media print A4 layout
- HMS_FEATURES_PRESENTATION.md: plain Markdown version of the same content
- system_ops.php: fix confirm dialog text for Update HMS button
- Added "Details" column to Update History table
- Shows info icon button when error details are available
- Clicking button opens a modal with full error message
- Details displayed in pre-formatted text for easy reading
- Helps diagnose why HMS updates failed or timed out
When an update fails, users can now click the info icon to see the exact
git error output, making troubleshooting much easier.
Update improvements:
- Renamed button from "Update System" to "Update HMS"
- Changed update to run only 'git pull' (removed database migrations)
- Added 60-second timeout to prevent system hangup
- Better error messages for timeouts and failures
- Logs update status (running/success/failed/timeout) to history
- Confirmation dialog now says "Pull latest HMS code from repository?"
This ensures quick updates without long-running migrations that could hang
the admin interface. Database migrations can be run separately as needed.
Resource Usage improvements:
- Added visual progress bars for CPU, RAM, and Disk usage
- Progress bars use Bootstrap styling (success/info/warning colors)
- Display percentage and detailed metrics (e.g., RAM 4 / 128 MB (3%))
- Bars animate smoothly with CSS transitions
CPU detection enhancements:
- Added fallback to /proc/stat parsing when shell commands unavailable
- Added fallback to PHP getrusage() for CPU time estimation
- CPU now displays even when shell_exec is disabled
- Graceful fallback chain ensures data is always available
Progress bar styling:
- Success (green) for CPU
- Info (blue) for RAM
- Warning (orange/yellow) for Disk
- All bars styled with height, rounded corners, and smooth transitions
- Added System Operations link to Admin dashboard (app/Views/Setting/Admin/index.php)
- Uses load_form_div to load the system operations page inline
- Added SystemOperations library for server status collection and actions
- Tile uses server icon (bi-server) and appears in the admin panel grid
- Link: javascript:load_form_div(base_url('setting/admin/system-ops'), 'maindiv', 'System Operations')
- Added SystemOps controller with index and panel endpoints for dynamic content refresh
- Created system_ops_panel.php fragment for AJAX-based UI updates (no full page reload)
- Implemented 30-second auto-refresh using AJAX instead of location.reload()
- Fixed health badge contrast by adding explicit dark text color (#1f2937)
- Added jQuery availability checks to prevent script errors on page load
- Included server overview, resource usage, services, events, and update history
- Integrated delegated event handlers for action buttons (Update, Restart, Reboot, Shutdown)
- All buttons are protected with confirmation dialogs
- Layout maintains NiceAdmin card styling and responsive design
Routes added:
- GET /admin/system-ops/panel - returns panel fragment for refresh
- Diagnosis.php: resolve doctor mapping via ABDM Report Doctor Mapping,
compile pathology/diagnosis reports into separate Letter Head and
Plain Paper PDFs, add compiled-pdf-links endpoint
- Routes.php: add diagnosis/compiled-pdf-links route
- pathology_detail.php: render/persist dual compiled PDF buttons
- Setting/Template.php: per-modality Letter Head / Plain Paper template
mapping via hospital_setting keys
- Setting/Template/index.php: fix tile links using load_form (which only
replaces #main) instead of load_form_div, which broke every internal
AJAX reload (template type switch, modality switch, reset) on the
diagnosis/discharge/document print template settings pages
- diagnosis_print_settings.php: fix corrupted watermark_alpha number
input (missing step attribute) that silently blocked form submission
for templates with non-integer-step legacy values
Adds a 'Verify SSL Certificate' switch on Admin -> ABDM Gateway page,
persisted as hospital_setting.ABDM_BRIDGE_SSL_VERIFY (default ON/secure).
Wired into M3HiuGatewayClient, EAtriaBridgeConnector, and the settings
page's own Test Connection check. Per-machine ABDM_BRIDGE_SSL_VERIFY env
var still overrides this DB setting for deployments needing a quick
local-only workaround. Verification stays on by default everywhere;
disabling it is an explicit, visible opt-in with an on-page warning.
ISSUE: Templates auto-regenerate when deleted
User deletes template ID 3, page reload creates template ID 4 automatically
ROOT CAUSE: ensureDefaultDischargeTemplateSeeded() called on EVERY page load
- discharge_templates() method called it on every view
- getDischargeTemplateRows() called it on every discharge PDF generation
- When count=0, it auto-inserted default templates
- Made it impossible to delete all templates
SOLUTION: Changed to manual opt-in template creation
1. Removed auto-seeding calls:
- Setting/Template::discharge_templates() - removed ensureDefaultDischargeTemplateSeeded()
- Ipd_discharge::getDischargeTemplateRows() - removed ensureDefaultDischargeTemplateSeeded()
- Both now only call ensureDischargeTemplateTable() (structure check only)
2. Added manual template creation:
- New 'Create Default Templates' button shown when table is empty
- New endpoint: discharge_templates_seed() - creates defaults on demand
- Route: POST /setting/template/discharge_templates_seed
- Button confirms before creating, shows success message, reloads page
3. Preserved seeding functions:
- ensureDefaultDischargeTemplateSeeded() kept but not auto-called
- Can be manually triggered via new button
- Creates 'Default Discharge Template' and 'NABH Compliant Discharge Summary'
BEHAVIOR NOW:
- Users can delete ALL templates - they stay deleted
- Empty table shows helpful message with creation button
- Templates only created when user explicitly requests them
- No more surprise template regeneration
TESTING:
- Delete all templates
- Page reloads showing empty table with button
- Click 'Create Default Templates'
- 2 templates created (ID 1 and 2)
ISSUE: Template delete returns success but record appears not deleted
ROOT CAUSE: Delete WAS working (verified in database), but page wasn't refreshing properly after success
CHANGES:
1. JavaScript fix (discharge_templates.php):
- Replaced conditional load_form_div / location.assign logic
- Now uses simple location.reload() after 500ms delay
- Ensures page always refreshes after successful delete
2. Controller debug logging (Template.php):
- Added comprehensive debug logs to trace delete flow
- Logs: request ID, row fetch, query compilation, affected rows
- Logs error codes and messages for troubleshooting
- Will help diagnose future issues
VERIFIED:
- Database confirmed template ID 2 was deleted
- Only frontend refresh was failing
- Now forces reload to show updated list
ISSUE: User reported alignment tools not showing and delete not working
ROOT CAUSE: Over-complicated toolbar config with too many additions
- Added Strike, Subscript, Superscript (not in standard build)
- Added Image (might not be in build)
- Added ShowBlocks (might not be in build)
- Added extra config options that might conflict
SOLUTION: Return to ORIGINAL working toolbar + ONLY alignment buttons
- Restored original toolbar config that was working
- Kept ONLY the alignment row: JustifyLeft, Center, Right, Block
- Removed Strike, Subscript, Superscript, Image, ShowBlocks
- Removed extra config: allowedContent, entities, fillEmptyBlocks, etc.
- Delete function unchanged (already fixed in commit d025111)
TOOLBAR NOW:
✅ Original working buttons (Source, Undo, Redo, Bold, Italic, etc.)
✅ Text alignment buttons (JustifyLeft, Center, Right, Block) - USER'S REQUEST
❌ Removed bonus features that caused issues
This is minimal change - only adds what user asked for.
ERROR: Uncaught TypeError: can't access property 'icons', h is null
FILE: ckeditor.js:267
ROOT CAUSE:
Previous commit added 'extraPlugins: justify,pagebreak' to CKEditor config.
The pagebreak plugin is NOT included in the standard CKEditor build being used.
CKEditor tried to load pagebreak plugin, failed, and threw null reference error.
SOLUTION:
1. Removed 'PageBreak' button from insert toolbar
2. Removed 'extraPlugins: justify,pagebreak' config line
3. Justify plugin is CORE plugin - included by default, no need to load explicitly
4. Text alignment buttons (JustifyLeft, Center, Right, Block) still work perfectly
WHAT STILL WORKS:
✅ Text alignment buttons (user's original request)
✅ All other enhanced buttons (Strike, Subscript, Superscript, Image, ShowBlocks)
✅ No console errors
WHAT WAS REMOVED:
❌ PageBreak button (was bonus feature, not in CKEditor build)
TESTING: Reload /setting/template/discharge_templates - no console errors
ISSUE: Delete button executed but did not actually delete templates
ROUTE: /setting/template/discharge_templates/delete/{id}
ROOT CAUSE:
The delete button's fetch() call was sending 'new FormData(form)' which:
1. Included entire edit form data (template_html, header_html, footer_html)
2. These are HUGE LONGTEXT fields that can cause request payload issues
3. CSRF token from form might be stale or missing if no template is being edited
4. Server received malformed request and silently failed
SOLUTION:
- Create fresh FormData with ONLY the CSRF token
- Delete request now lightweight and reliable
- Added success message display after successful delete
- Server-side delete logic already correct (line 2969-3028 in Template.php)
CHANGED:
- app/Views/Setting/Template/discharge_templates.php (line 618-653)
- Replace: body: new FormData(form)
- With: body: deleteFormData (contains only CSRF token)
- Added: setNotice('success', ...) to show success message
TESTING:
1. Go to /setting/template/discharge_templates
2. Click Delete on any non-default template
3. Confirm deletion
4. Template should now be removed from list
5. Success message should display