From 01908bb00264b311a356cbece8b12da1938bc973 Mon Sep 17 00:00:00 2001
From: mahdahar <89adham@gmail.com>
Date: Mon, 2 Feb 2026 14:27:12 +0700
Subject: [PATCH] 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
---
AGENTS.md | 10 +
CLAUDE.md | 120 ---------
CHECKLIST.md => TODO.md | 5 +-
app/Views/shared/content_requests.php | 34 +--
app/Views/shared/content_validation.php | 2 +-
app/Views/shared/content_validation_new.php | 276 --------------------
app/Views/shared/dialog_val.php | 2 +-
app/Views/shared/layout.php | 7 +
app/Views/shared/script_requests.php | 38 ++-
app/Views/shared/script_validation.php | 21 +-
10 files changed, 64 insertions(+), 451 deletions(-)
delete mode 100644 CLAUDE.md
rename CHECKLIST.md => TODO.md (93%)
delete mode 100644 app/Views/shared/content_validation_new.php
diff --git a/AGENTS.md b/AGENTS.md
index 9a372a7..6634ca2 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -6,6 +6,16 @@ This file provides guidance to agents when working with code in this repository.
CodeIgniter 4 PHP application for laboratory management (GDC CMOD). Handles specimen tracking, request validation, and result management with role-based access control. SQL Server database with Firebird legacy patient data.
+## Tool Usage
+
+Always use Serena MCP tools for anything possible:
+- Use `serena_find_symbol` instead of grep when looking for classes, methods, or functions
+- Use `serena_search_for_pattern` instead of grep for code pattern searches
+- Use `serena_read_file` or `serena_replace_content` instead of Read/Edit tools
+- Use `serena_find_referencing_symbols` to find where symbols are used
+- Use `serena_replace_symbol_body` or `serena_insert_after_symbol` for code modifications
+- Only use Bash for shell commands (git, composer, php, etc.)
+
## Commands
```bash
diff --git a/CLAUDE.md b/CLAUDE.md
deleted file mode 100644
index 2b0f5ef..0000000
--- a/CLAUDE.md
+++ /dev/null
@@ -1,120 +0,0 @@
-# CLAUDE.md
-
-This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
-
-## Project Overview
-
-This is a **CodeIgniter 4** PHP application for laboratory management (GDC CMOD - Laboratory Request Management System). It handles specimen collection tracking, request validation, and result management with role-based access control.
-
-## Development Commands
-
-```bash
-# Run PHP built-in server (from project root)
-php spark serve
-
-# Run tests
-composer test
-```
-
-**Note:** This is a Windows-based deployment using IIS/XAMPP. For production, configure a virtual host pointing to the `public/` folder.
-
-## Database Configuration
-
-- **Primary DB:** SQL Server (`GDC_CMOD.dbo`) via Microsoft ODBC Driver (MSOLEDBSQL)
-- **Legacy DB:** Firebird/InterBase (`GLENEAGLES` via ODBC) for patient data
-- **Connection:** `\Config\Database::connect()` returns MySQLi connection
-- **No CI4 Models** - uses raw SQL queries via `Database::connect()`
-
-## Architecture
-
-### Role-Based Access Control (RBAC)
-
-| Role ID | Name | Route Prefix | Permissions |
-|---------|------|--------------|-------------|
-| 0 | Superuser | `/superuser` | Full access + Users CRUD |
-| 1 | Admin | `/admin` | Full access + Users CRUD |
-| 2 | Lab | `/lab` | Request validation, Sample collection |
-| 3 | Phlebo | `/phlebo` | Request validation, Sample collection |
-| 4 | CS | `/cs` | Request validation, Sample collection |
-
-### Authentication Flow
-
-1. `Auth::login()` - Verifies credentials against `GDC_CMOD.dbo.USERS`, sets session
-2. `RoleFilter` - Checks `session()->get('isLoggedIn')` and role ID
-3. `GuestFilter` - Redirects logged-in users to role-based dashboard
-
-### Key Database Tables
-
-- `GDC_CMOD.dbo.USERS` - Users with `USERID`, `USERROLEID`, `PASSWORD`
-- `GDC_CMOD.dbo.CM_REQUESTS` - Validation tracking (`ISVAL1`, `ISVAL2`, validation users/dates)
-- `GDC_CMOD.dbo.TUBES` - Sample collection status
-- `GDC_CMOD.dbo.V_DASHBOARD_DEV` - Dashboard data view
-- `glendb.dbo.*` - Legacy Firebird patient data
-
-### Request Validation (Dual-Level)
-
-Validation requires 2 different users to validate the same request:
-1. First validation sets `ISVAL1=1`, `VAL1USER`, `VAL1DATE`
-2. Second validation (different user) sets `ISVAL2=1`, `VAL2USER`, `VAL2DATE`
-
-## Code Conventions
-
-### Controllers
-- All extend `BaseController` (which extends `CodeIgniter\Controller`)
-- Use `ResponseTrait` for JSON APIs
-- Raw SQL queries via `\Config\Database::connect()->query()`
-
-### Routing Pattern
-
-```php
-$routes->group('prefix', ['filter' => 'role:N'], function($routes) {
- $routes->get('', 'Controller::index');
- $routes->get('api/resource', 'Controller::method');
-});
-```
-
-### Session Structure
-
-```php
-session()->set([
- 'isLoggedIn' => true,
- 'userid' => (string) $user['USERID'],
- 'userroleid' => (int) $user['USERROLEID'],
- 'userrole' => (string) $role,
-]);
-```
-
-## Important Routes
-
-| Route | Purpose |
-|-------|---------|
-| `/login`, `/logout` | Authentication |
-| `/label/coll/:accessnumber` | Zebra printer label (public) |
-| `/api/requests` | Dashboard data (date-filtered) |
-| `/api/requests/validate/:accessnumber` | Dual-level validation |
-| `/api/samples/collect/:accessnumber` | Mark sample collected |
-| `/api/samples/receive/:accessnumber` | Mark sample received (Admin/Superuser only) |
-
-## Frontend Stack
-
-- TailwindCSS + DaisyUI 5 (CDN)
-- Alpine.js for reactivity
-- Font Awesome 7 for icons
-
-## Common Patterns
-
-### JSON API Response
-```php
-return $this->response->setJSON(['status' => 'success', 'data' => $result]);
-```
-
-### Database Query
-```php
-$db = \Config\Database::connect();
-$result = $db->query("SELECT * FROM table WHERE col = ?", [$value])->getResultArray();
-```
-
-### Date Formatting from SQL Server
-```php
-$row['DATE_COLUMN'] = date('Y-m-d H:i', strtotime($row['DATE_COLUMN']));
-```
diff --git a/CHECKLIST.md b/TODO.md
similarity index 93%
rename from CHECKLIST.md
rename to TODO.md
index e237424..0eddb22 100644
--- a/CHECKLIST.md
+++ b/TODO.md
@@ -1,11 +1,10 @@
# Project Checklist: Glen RME & Lab Management System
-**Last Updated:** January 26, 2026
+**Last Updated:** 20260202
Pending:
- Restrict Print/Save-to-PDF to CS Role only (Lab can only preview, CS can print/save)
- Add Dedicated Print Button (Trigger browser/system print dialog)
-- Update PDF Report Metadata (Replace 'Printed By' with validating user's name)
- Reprint Label (Add functionality to reprint labels)
- Print Result Audit (Track when result reports are printed/exported, log user and timestamp)
@@ -28,6 +27,8 @@ Completed:
- 16 : Remove 'UnCollect'
- 17 : Audit Trail (Track all actions: validation, unvalidation, collection, uncollection)
- 18 : Create Validate Page
+- 19 : Sync color with old gdc_cmod
+- 20 : Add Val1 Val2 on the result
Addition on dev :
diff --git a/app/Views/shared/content_requests.php b/app/Views/shared/content_requests.php
index 32a0e9d..4870723 100644
--- a/app/Views/shared/content_requests.php
+++ b/app/Views/shared/content_requests.php
@@ -18,27 +18,27 @@
All