129 Commits

Author SHA1 Message Date
4a14dbddce Fix validate page PDF queueing
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.
2026-04-21 12:26:56 +07:00
ab8f4819e7 feat : change pdf from hostordernumber to accessnumber 2026-04-17 11:25:22 +07:00
f968b0c5e2 feat: default request sorting by status 2026-04-07 11:03:54 +07:00
cd05a93047 fix: make request search case-insensitive 2026-04-07 10:45:46 +07:00
cec2289105 fix: make requests table filter case-insensitive 2026-04-07 10:25:58 +07:00
2aa2ef50f2 feat: add v2 dashboards and server-side request pagination
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.
2026-04-02 13:02:29 +07:00
5262808860 fix report style 2026-04-02 09:12:48 +07:00
008ca712ff fix: normalize telephone data for JSON 2026-03-15 13:50:26 +07:00
09a1c6715f fix: show UnVal button for validated but incomplete requests
- 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
2026-03-12 12:49:52 +07:00
643413c8d3 chore: cleanup old files and Serena config 2026-03-11 10:05:49 +07:00
3ab2258b1b fix: reduce spooler timeout to prevent batch processing hang
- Reduce cURL timeout from 10s to 3s total (2s connection)
- Add better error messages for spooler failures
- Continue processing remaining items if one fails
- Prevents getting stuck when spooler is slow/unreachable
2026-03-11 09:43:40 +07:00
25c1eaaa3d perf: use direct method calls for PDF batch generation (option 3)
- Create PdfBatchService class with generatePdf() method
- Extract PDF generation logic from ReportController for reuse
- Update SuperuserController to use direct method calls instead of HTTP/cURL
- Eliminates HTTP overhead for ~10x faster batch processing
2026-03-11 09:40:59 +07:00
eab11dba95 fix: use cURL instead of direct controller instantiation for PDF batch
Fixes 'Call to a member function getIPAddress() on null' error by calling
report/{id}/pdf endpoint via HTTP request instead of instantiating
ReportController directly, which ensures proper request initialization.
2026-03-11 09:36:37 +07:00
0fad3baab7 feat: add PDF batch generation page for superuser
- 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
2026-03-11 09:34:11 +07:00
d8dc4e95f2 feat: add batch/pdf endpoint with no auth for internal PDF generation
Changes:
- app/Config/Routes.php: Add GET /batch/pdf/(:num) route without auth filter
- app/Controllers/ReportController.php: Add generatePdfNoAuth() method
- script.php: Update to use new batch/pdf endpoint with localhost URL

Usage: php script.php accessnumbers.txt
Endpoint: http://localhost/gdc_cmod/batch/pdf/{accessnumber}

No authentication required - for internal/batch processing only.
2026-03-11 09:17:21 +07:00
caf8b332f4 feat: rewrite batch PDF script to use curl endpoint with localhost bypass
Changes:
- app/Filters/RoleFilter.php: Add localhost/127.0.0.1 bypass at start of before()
- app/Controllers/ReportController.php: Add localhost bypass in generatePdf()
- script.php: Rewrite to use curl to http://glenlis/cmod/report/{accessnumber}/pdf

Benefits:
- Eliminates 94-second CLI database queries
- Uses optimized web endpoint (fast database connections)
- Simple curl-based implementation, no CI4 bootstrapping
- Maintains all existing logging (AUDIT_REQUESTS, ORU files)
2026-03-11 09:11:47 +07:00
eb7729478e debug: add timing info to identify bottlenecks in batch PDF generation
Add millisecond timing for each step:
- Database check
- Report data fetching (ReportHelper)
- HTML template rendering
- Spooler API call
- Total time per accessnumber
2026-03-11 08:56:53 +07:00
0b569c58d9 fix: add progress output and better timeout handling for batch PDF script
- Add flush() after each echo to show progress in real-time
- Increase curl timeout to 30 seconds with 10 second connect timeout
- Add curl error handling to diagnose connection issues
- Add progress messages (generating HTML, sending to spooler)
2026-03-11 08:54:49 +07:00
f35d6647c5 feat: add batch PDF generator CLI script
Add script.php for batch generating PDFs from a list of accessnumbers.
Features:
- Reads accessnumbers from text file (one per line)
- Validates requests exist and are validated (ISVAL2=1)
- Uses REPORT_LANG to determine language
- Sends to PDF spooler and logs to AUDIT_REQUESTS
- Creates ORU files for HL7 integration
- Outputs progress and saves detailed log

Usage: php script.php accessnumbers.txt
2026-03-11 08:52:06 +07:00
e5eac13036 feat: auto-select sample when scanning sample number
- 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
2026-03-10 15:52:11 +07:00
2b1cccd2be fix: allow admin and superuser to unvalidate any validated record 2026-03-10 12:17:55 +07:00
8b91bc8dc3 fix: use COLLECTIONDATE instead of REQDATE for PDF links
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.
2026-03-09 14:25:17 +07:00
d9e72c0e95 always enable save button on collection 2026-03-09 14:02:32 +07:00
70517d68f0 perf: move PHP session/config logic outside table loop to reduce RAM usage 2026-03-09 12:33:31 +07:00
4fcf17c905 add print button on preview 2026-03-09 12:10:39 +07:00
80a6100575 fix dasboard status button 2026-03-09 09:23:13 +07:00
38e27f1172 feat: reset form after save on collection page 2026-03-07 16:25:06 +07:00
527e047e68 add our creation 2026-03-07 09:25:42 +07:00
4990934126 Add Serena configuration and project memories; update report controller and view scripts 2026-03-06 16:56:13 +07:00
ea32cdab67 Fix undefined array key error in report template by ensuring sequential array keys 2026-03-06 15:07:21 +07:00
1ea1fd4d0e Fix memory leaks in dashboard: clear iframe src on dialog close, limit toast queue, add cleanup destroy method 2026-03-05 16:18:43 +07:00
a65feb0495 Update report filtering, helper, and template
- Updated Filters.php configuration
- Enhanced ReportHelper library functionality
- Modified report template view for improved rendering
2026-03-05 12:34:24 +07:00
b102ba657c Add ISPDF flag endpoint and dashboard indicator
- 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
2026-03-05 09:59:02 +07:00
c2c70505e5 Remove unused dialog include and add Phlebo role-specific UI logic
- 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
2026-03-04 13:49:46 +07:00
c2d66d0082 Add uncollect feature and security improvements
- Add DELETE /api/samples/collect/:accessnumber/:samplenumber endpoint
- Convert SQL queries to parameterized queries for security
- Add uncollect() method to SamplesController
- Update collect view to support uncollecting samples
- Fix checkbox logic to allow toggling collected samples
- Update hasChanges() to detect both collect and uncollect actions
2026-03-04 13:12:21 +07:00
ee68d22d15 Update ReportController, RequestsController, and PdfHelper 2026-02-26 13:13:27 +07:00
42d5abc25a Update printer configuration, label controller, and shared views 2026-02-26 12:42:49 +07:00
5f6cf47689 Add engineering result dialog and functionality across all roles 2026-02-25 16:38:07 +07:00
4fa33194a5 Add validation user column and Reports menu items, fix phlebo routes 2026-02-24 10:32:28 +07:00
5d1b01c4e8 Fix empty table data - add missing compute chain calls 2026-02-16 10:54:56 +07:00
8d762261d4 Remove all Alpine.js calls to fix memory leaks
- 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
2026-02-16 10:52:49 +07:00
e947fc74d4 Refactor Alpine.js components: remove memory cleanup code from requests, fix keyboard event handling in validation 2026-02-16 10:23:23 +07:00
79e6ab63a0 fix: additional memory leak prevention in Alpine.js watchers and audit events
- 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
2026-02-16 07:17:09 +07:00
3577ee870f Fix memory leak in Alpine.js computed properties
Replace getter-based computed properties with cached properties
and explicit watchers to prevent memory leak in:
- script_requests.php
- script_validation.php
2026-02-15 18:16:16 +07:00
c1cf2bbc9f fix: line ending normalization for content_requests.php 2026-02-13 09:20:06 +07:00
0b30d76a86 feat: conditionally disable preview based on request status - Show pending button for Pend/PartColl/Coll statuses instead of preview 2026-02-13 09:15:44 +07:00
0d8e998c50 feat: add datetime to val1 and val2 on report - Display validation timestamps in dd-MM-yyyy hh:mm format 2026-02-12 13:55:02 +07:00
f2e01adfc5 feat: auto-generate PDF after val2 validation from preview - Call /report/{accessnumber}/pdf endpoint when second validation succeeds 2026-02-12 13:50:01 +07:00
7b6d7f6d85 fix: capture accessnumber in local variable for PDF fetch - Prevents null value in async PDF generation URL after val2 2026-02-12 13:09:30 +07:00
9e374103fa feat: auto-generate PDF after second validation - Trigger PDF generation via /report/{accessnumber}/pdf endpoint after VAL2 - Add preview dialog for admin/lab/superuser roles - Update role configs with previewEnabled flag 2026-02-12 13:02:31 +07:00