Recompute filtered, sorted, and paginated validation state after a request is removed from the pending list.\nAdjust next-item selection so the dialog advances only when a valid next item exists, avoiding wraparound to stale entries.
Use the local accessnumber when queuing PDFs after val2, since the validation response does not include accessnumber. Add success and error toast feedback for the PDF generation request.
Introduces v2 role routes/views and moves request list filtering, sorting, and pagination to the backend for better performance. Also switches shared pages to a generated Tailwind CSS bundle with supporting npm assets.
- Update UnVal visibility condition from ISVAL check to VAL1USER && VAL2USER
- Fix validated-but-incomplete requests missing the UnVal action button
- Align isValidated() function with same logic for consistency
- Refactor AGENTS.md formatting
- Add /superuser/pdf-batch page with textarea input for access numbers
- Create API endpoint /api/superuser/pdf-batch to process batch PDF generation
- Use report/{id}/pdf endpoint for authenticated PDF generation
- Show results table with success/failed status, language, and type (new/regen)
- Remove deprecated /batch/pdf endpoint
- Add PDF Batch menu item to superuser navigation
- Add support for scanning sample numbers (8 digits) in addition to access numbers (10 digits)
- Backend: Detect input type based on length, extract sample code and access suffix
- Frontend: Auto-select matching sample and highlight with primary ring border
- When sample number scanned (e.g., 10135026), extracts sample code (101) and auto-checks it
PDFs were being saved based on collection date but links were using
REQDATE, causing mismatches. Updated both regular and English PDF
links to use COLLECTIONDATE for consistency.
- Add POST /api/requests/{accessnumber}/pdf endpoint (no auth required)
- Add setPdfFlag() method to update CM_REQUESTS.ISPDF to 1
- Log PDF_FLAG events to AUDIT_EVENTS table
- Include ISPDF field in dashboard API response
- Add PDF icon indicator in dashboard table (after Val column)
- Icon shows green when ISPDF=1, gray when null/0
- Pass accessnumber to PDF spooler for tracking
Files modified:
- app/Config/Routes.php: Add external PDF endpoint route
- app/Controllers/RequestsController.php: Add setPdfFlag method, include ISPDF in query
- app/Controllers/ReportController.php: Pass accessnumber to spooler
- app/Libraries/PdfHelper.php: Pass accessnumber to spooler
- app/Views/shared/content_requests.php: Add PDF column with icon
- Remove dialog_eng_result.php include from CS index view
- Add role-based status display for Phlebo (role 3) showing Ready/Pending badges
- Fix indentation inconsistencies in content_requests.php dropdown menus
- Add role restrictions: hide Generate Result and Create Eng Result buttons for CS (role 4) and Phlebo (role 3)
- Move status sorting logic from fetchList to computeSorted for proper Alpine.js reactivity
- Add statusOrder mapping (Pend -> Coll -> Recv -> Inc -> Fin) for consistent request sorting
- Simplify Actions dropdown for Phlebo role to show only status indicator
- Replace reactive watchers with explicit method calls
- Add setFilterKey() and setFilterTable() methods for manual updates
- Update sort(), nextPage(), prevPage() to trigger computations
- Update templates to use new setter methods
- Compute derived data explicitly after data loading
- Add toastTimeouts array to track and clear pending timeouts
- Consolidate duplicate watchers (sortCol, sortAsc, sorted, currentPage)
- Add destroy() method to clean up data structures and timeouts
- Cache audit events in _cachedAuditEvents instead of computed getter
- Clear item data when closing dialogs
- Update collect() and unreceive() to accept samplenumber as path param
- Improve unreceive logic with better Firebird update handling
- Update routes and frontend to match new endpoint signature
- Add PDF generation events (GEN_PDF, REGEN_PDF) to AUDIT_REQUESTS table
- Track PDF print/generate/regenerate with timestamp and language
- Fix language parameter handling in ReportController (engQuery vs engQuery typo)
- Simplify result dialog to show report in iframe instead of async PDF loading
- Add PDF tab to audit dialog showing generation history
This commit adds a print-friendly HTML version of the UAT checklist and enhances the report generation system with collection date tracking.
New Features:
- Add UAT_GDC_CMOD_Checklist.html with interactive checkboxes and print-friendly layout
- Simplify UAT markdown checklist by removing 'No.' column and refining instructions
Report Generation Enhancements:
- Add collection date tracking to report generation workflow
- ReportController now passes collection date to PDF spooler
- ReportHelper fetches collection date from SP_REQUESTS table via getCollectionDateRaw()
- Node spooler receives collection date parameter for report generation
UI Improvements (content_requests.php):
- Add new 'Result' column showing Ready/Pending status with visual indicators
- Move Print, Generate PDF, and Retry PDF actions from Actions menu to Result dropdown
- Result dropdown shows green 'Ready' for duavalidated requests, yellow 'Pending' otherwise
- Actions appropriately restricted by role and validation status
- Simplify Actions menu by relocating report-related functions
Add comprehensive printer configuration support:
- New Printers.php config with role-based printer defaults (lab, phlebo, reception)
- Update LabelController for configurable printer routing with error handling
- Add ResponseTrait for proper JSON responses (success/error status)
- Update routes to accept optional printer parameter for label printing
- Add default printer configuration per role in shared config
Enhance report generation workflow:
- Support REPORT_LANG from CM_REQUESTS table for language preference
- Prioritize URL parameter, then database value, then default
- Add language info to PDF generation response (Indonesian/English)
- Update all report methods (view, eng, preview, generate) with unified logic
Improve UI and user experience:
- Add dialog_results_generate to all role dashboards (superuser, admin, lab, phlebo, cs)
- Update skeleton loading states widths in content requests
- Add printer selection capability in sample collection flow
Add comprehensive UAT documentation:
- New UAT_GDC_CMOD_Checklist.md with 150+ test cases
- Cover all roles: superuser, admin, lab, phlebo, cs, and cross-role scenarios
- Include acceptance criteria (functional, security, performance, usability, data integrity)
- Test categories: authentication, user management, validation, sample management, audit trail, reporting
- Detailed sign-off structure for stakeholders
Add barcode printing documentation:
- docs/barcode_print_all.php - all labels printing implementation
- docs/barcode_print_coll.php - collection label implementation
- docs/barcode_print_disp.php - dispatch label implementation
Update TODO tracking:
- Mark Reprint Label and PDF Generation as completed
- Update pending tasks for testing and audit trails
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)
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
This commit expands report generation capabilities to Customer Service (CS) role
and refactors the report system for better maintainability and PDF support.
Changes Summary:
Access Control:
- Extended report access from Lab, Admin, Superuser to include CS role (filter: 0,1,2,4)
- Removed separate CS-only print routes, consolidated into unified report routes
- Routes now support /report/:num, /report/:num/eng, /report/:num/print, /report/:num/print/eng
Controller Refactoring (ReportController):
- Refactored generate() and print() methods to share common renderReport() logic
- Removed separate preview() method - preview now handled via preview parameter
- Added ispdf parameter support for PDF generation mode
- Print functionality now logs audit events to AUDIT_REQUESTS table
Database Queries (ReportHelper):
- Improved SQL queries with explicit aliases for better readability and maintainability
- Fixed date formatting issue: changed date_format() to date() with strtotime()
- Added getValData() method to retrieve validation user information (VAL1USER, VAL2USER)
- Added null coalescing operators (?? '') for safer array access
View Updates (report/template.php):
- Conditional CSS loading: uses pdf.css when ispdf=1, otherwise style.css
- Removed "PREVIEW ONLY - DO NOT PRINT" watermark
- Conditional header/footer images - only display when generating PDF
- Added validation user display: "Val1 By : {user} | Val2 By : {user}"
- Replaced signature placeholder with "This result is valid without signature" statement
- Improved footer layout spacing
Styling Adjustments (public/assets/report/style.css):
- Adjusted margins for better print layout: dinfo (2cm), dresult (17.5cm), footer (2cm)
- Increased footer width from 17cm to 18cm
- Added responsive image classes: .img and .img-footer with max-width: 100%
- Set footer image max-height to 2.5cm
Security:
- Maintained role-based access control with proper authentication checks
- All database queries use parameterized statements (no interpolation)
- Print actions still logged to AUDIT_REQUESTS for audit trail