6 Commits

Author SHA1 Message Date
0b4fdcfe5f feat: Extend audit trail with tube received tracking and enhance PDF workflow
Major Updates:

1. Extended Audit Trail System
   - Added tube received events tracking from SP_TUBES table (TUBESTATUS=4)
   - New audit tab "Receive" in dialog_audit.php to display tube reception history
   - ApiRequestsAuditController now fetches and returns tube received events with:
     * Sample type, tube status, collection date, and user information
   - Audit events sorted chronologically combining validation, sampling, and receiving events

2. Enhanced PDF Generation Workflow
   - Created new PdfHelper library with methods for PDF generation and posting to spooler
   - Reports can now be generated via GET /report/{accessnumber}/pdf endpoint
   - Updated PDF spooler API endpoint from port 3030 to 3000
   - Added retry PDF button with spinner animation for failed generations
   - Fixed PDF status check to use correct spooler endpoint

3. Validation UI Improvements
   - Added toast notification showing PDF queued after second validation (val2)
   - Retry PDF button appears when val1 and val2 are complete
   - Toast notifications success/error states with auto-dismiss after 2 seconds
   - Loading state with spinning icon during PDF retry operation

4. Report Template Fixes
   - Fixed typo in Val2 By display (added missing ":")
   - Consistent formatting with Val1 By : and Val2 By :

5. Documentation Updates
   - TODO.md updated with:
     * Auto generate PDF (in progress)
     * Print Eng Result (pending)
     * Add Receive to Audit (completed)

6. Cleanup
   - Removed legacy Node.js spooler implementation (node_spooler directory)
   - Deleted P0_log.txt (SQL setup scripts no longer needed in repo)
   - Cleaned up .gitignore to remove stale node_spooler entries

Files Changed:
- app/Controllers/ApiRequestsAuditController.php (tube received audit)
- app/Controllers/ReportController.php (port update: 3030 → 3000)
- app/Libraries/PdfHelper.php (new library)
- app/Views/report/template.php (typo fix)
- app/Views/shared/content_requests.php (retry PDF button)
- app/Views/shared/dialog_audit.php (receive tab)
- app/Views/shared/script_requests.php (retry handler, tube events)
- app/Views/shared/script_validation.php (enhanced toast)
- TODO.md (pending/completed tasks)
- .gitignore (cleanup)
- Deleted: node_spooler/* (legacy implementation)
- Deleted: P0_log.txt (no longer needed)
2026-02-04 11:09:42 +07:00
2843ddd392 Migrate PDF generation from legacy spooler_db to CI4 + node_spooler
BREAKING CHANGE: Remove public/spooler_db/ legacy system

Changes:
- Migrate validation preview from http://glenlis/spooler_db/main_dev.php to CI4 /report/{accessnumber}
- Add ReportController::preview() for HTML preview in validation dialog
- Add ReportController::generatePdf() to queue PDF generation via node_spooler at http://glenlis:3030
- Add ReportController::checkPdfStatus() to poll spooler job status
- Add ReportController::postToSpooler() helper for curl requests to spooler API
- Add routes: GET /report/(:num)/preview, GET /report/(:num)/pdf, GET /report/status/(:any)
- Delete public/spooler_db/ directory (40+ legacy files)
- Compact node_spooler/README.md from 577 to 342 lines

Technical Details:
- New architecture: CI4 Controller -> node_spooler (port 3030) -> Chrome CDP (port 42020)
- API endpoints: POST /api/pdf/generate, GET /api/pdf/status/:jobId, GET /api/queue/stats
- Features: Max 5 concurrent jobs, max 100 in queue, auto-cleanup after 60 min
- Error handling: Chrome crash detection, manual error review in data/error/
- PDF infrastructure ready, frontend PDF buttons to be updated later in production

Migration verified:
- No external code references spooler_db
- All assets duplicated in public/assets/report/
- Syntax checks passed for ReportController.php and Routes.php

Refs: node_spooler/README.md
2026-02-03 11:33:55 +07:00
01908bb002 feat: Implement status-based row coloring and enhance validation dialog
This commit implements a comprehensive status color system across the dashboard and validation interfaces, ensuring visual consistency between table rows and filter buttons.

Color System Changes:
- Updated statusRowBg mapping in script_requests.php with custom hex colors:
  * Pend: white (#ffffff) with black text
  * PartColl: pink (#ff99aa) with black text
  * Coll: red (#d63031) with white text
  * PartRecv: light blue (#a0c0d9) with black text
  * Recv: blue (#0984e3) with white text
  * Inc: yellow (#ffff00) with black text
  * Fin: green (#008000) with white text
- Added custom CSS button classes in layout.php matching row background colors
- Applied color backgrounds to table rows (Order through Tests columns)
- Removed hardcoded text-white classes, now using dynamic text colors from mapping

UI/UX Improvements:
- Table rows now have consistent color-coded backgrounds based on request status
- Filter button badges match their corresponding row background colors
- Yellow status uses black text for better readability
- Swapped Coll (yellow) and Inc (orange) colors as requested

Validation Dialog Enhancement:
- Updated dialog_val.php iframe to use dynamic URL generation
- Removed preview type selection (ID, EN, PDF options) - uses default only
- Added getPreviewUrl() method in script_validation.php
- Now uses same URL pattern as preview dialog: http://glenlis/spooler_db/main_dev.php?acc={accessnumber}

Documentation Updates:
- Added Serena MCP tool usage guidelines to AGENTS.md
- Renamed CHECKLIST.md to TODO.md
- Removed CLAUDE.md

Technical Details:
- Color mappings now include both background and text color classes
- Implemented using Tailwind arbitrary values for precise hex color matching
- Status buttons use btn-status-{status} and badge-status-{status} classes
- All 7 columns from Order through Tests have status-colored backgrounds
2026-02-02 14:27:12 +07:00
582faacdad add project_backlog.md 2026-01-19 11:21:08 +07:00
2857935545 add TODO.md 2026-01-19 11:01:46 +07:00
b29f807295 Refactor: Remove V2 namespace and consolidate role-based architecture
- Moved all V2 controllers (Lab, Requests, Samples, Users) to App\Controllers
- Removed deprecated role controllers (Admin, Doctor, Analyst, CustomerService)
- Simplified routes by removing /v2 prefix
- Added AGENTS.md with project conventions and TODO.md with task tracking
- Updated README.md with RBAC documentation
- Fixed hardcoded dates, status color mappings, and duplicate database calls
2026-01-19 10:55:10 +07:00