- Implement AuthController with login/logout functionality
- Create UsersModel with bcrypt password hashing
- Add AuthFilter to protect all application routes
- Create login page with error handling
- Add users database migration with email/username fields
- Rename ResultComments to TestComments for consistency
- Update all routes to require authentication filter
- Enhance EntryApiController with comment deletion and better error handling
- Update seeder to include demo users and improved test data
- Fix BaseController to handle auth sessions properly
- Update entry views (daily/monthly) with new API endpoints
- Update layout with logout button and user info display
- Refactor control test index view for better organization
- Replace dropdown components with select elements in department filters
- Add cache-control headers to test and control API endpoints
- Add merged report page for consolidated reporting
- Update navigation sidebar with separate report links
- Refactor AGENTS.md to concise format with Serena tools emphasis
- Clean up gitignore and remove CLAUDE.md
Implemented comprehensive department filtering across multiple pages in the QC
system to enable users to filter data by laboratory department.
## Backend Changes
**Models:**
- MasterControlsModel: Enhanced search() method to accept optional dept_id
parameter, added LEFT JOIN with master_depts to include department info
- MasterTestsModel: Updated search() to support dept_id filtering with JOIN
**Controllers:**
- MasterControlsController: Modified index() to accept and pass dept_id parameter
- MasterTestsController: Modified index() to accept and pass dept_id parameter
- EntryApiController: Updated getControls() to filter by dept_id using model search,
added debug logging for troubleshooting
## Frontend Changes
**Views Updated:**
1. Controls page (/master/control)
- Added department dropdown with DaisyUI styling
- Active filter badge and clear button
- Fetch controls filtered by selected department
- Added department field to control form dialog
2. Tests page (/master/test)
- Added department dropdown with active state indication
- Filter tests by department
- Clear button to reset filter
3. Daily Entry page (/entry/daily)
- Added department dropdown in filter section
- Resets control selection when department changes
- Fetches controls and tests filtered by department
4. Monthly Entry page (/entry/monthly)
- Added department dropdown with month selector
- Resets test selection when department changes
- Fetches tests filtered by department
## Key Features
- Dropdown UI shows "All Departments" as default
- Selected department name displayed in dropdown button
- Clear button appears when filter is active
- Active department highlighted in dropdown menu
- Loading state while fetching departments
- Automatic reset of dependent selections when department changes
- Consistent UI pattern across all pages using DaisyUI components
## Bug Fixes
- Fixed syntax error in MasterControlsModel search() method
- Removed duplicate/corrupted code that was causing incorrect results
- Added proper deptName field to SELECT query in MasterControlsModel
## Important Note: Department IDs Required
**ACTION REQUIRED**: Existing controls and tests in the database must be assigned
to departments for the filter to work correctly.
To update existing records, run:
UPDATE master_controls SET dept_id = 1 WHERE dept_id IS NULL;
UPDATE master_tests SET dept_id = 1 WHERE dept_id IS NULL;
Replace '1' with a valid department ID from master_depts table.
Alternatively, edit each control/test through the UI to assign a department.
## Technical Details
- Alpine.js data binding for reactive department selection
- API expects 'dept_id' query parameter (snake_case)
- Internal state uses camelCase (deptId)
- Departments loaded on init via /api/master/depts
- Search requests include both keyword and dept_id parameters
- Implement Monthly Entry interface with full data entry grid
- Add batch save with validation and statistics for monthly results
- Support daily comments per day per test
- Add result status indicators and validation summaries
- Consolidate Entry API controller
- Refactor EntryApiController to handle both daily/monthly operations
- Add batch save endpoints with comprehensive validation
- Implement statistics calculation for result entries
- Add Control Test master data management
- Create MasterControlsController for CRUD operations
- Add dialog forms for control test configuration
- Implement control-test associations with QC parameters
- Refactor Report API and views
- Implement new report index with Levey-Jennings charts placeholder
- Add monthly report functionality with result statistics
- Include QC summary with mean, SD, and CV calculations
- UI improvements
- Overhaul dashboard with improved layout
- Update daily entry interface with inline editing
- Enhance master data management with DaisyUI components
- Add proper modal dialogs and form validation
- Database and seeding
- Update migration for control_tests table schema
- Remove redundant migration and seed files
- Update seeders with comprehensive test data
- Documentation
- Update CLAUDE.md with comprehensive project documentation
- Add architecture overview and conventions
BREAKING CHANGES:
- Refactored Entry API endpoints structure
- Removed ReportApiController::view() - consolidated into new report index
- New EntryApiController (app/Controllers/Api/EntryApiController.php)
- Centralized API for entry operations (daily/monthly data retrieval and saving)
- getControls() - Fetch controls with optional date-based expiry filtering
- getTests() - Get tests associated with a control
- getDailyData() - Retrieve daily results for a date/control
- getMonthlyData() - Retrieve monthly results with per-day data and comments
- saveDaily() - Batch save daily results with validation
- saveMonthly() - Batch save monthly results with statistics
- New Monthly Entry View (app/Views/entry/monthly.php)
- Calendar grid interface for entering monthly QC results
- Month selector with quick navigation (prev/next/current)
- Test selector to filter controls
- 31-day grid per control with inline editing
- Visual QC range indicators (green for in-range, red for out-of-range)
- Weekend highlighting
- Per-control monthly comment field
- Keyboard shortcut (Ctrl+S) for saving
- Change tracking with pending save indicator
- Route Updates (app/Config/Routes.php)
- Added /entry/monthly page route
- Added /api/entry/daily GET endpoint
- Model Updates
- ResultsModel: Added updateMonthly() for upserting monthly results
- ResultCommentsModel: Added upsertMonthly() for monthly comments
- Reorganized Architecture: Moved Master data management (Controls, Departments, Tests) to a dedicated Master namespace/directory for better modularity.
- Unified Data Entry: Consolidated daily and monthly QC entry views and logic into a single streamlined system.
- UI/UX Modernization:
- Integrated DaisyUI and Alpine.js for a responsive, themeable, and interactive experience.
- Replaced legacy layouts with a new DaisyUI-based template.
- Updated branding with new logo and favicon assets.
- Cleaned up deprecated JavaScript assets (app.js, charts.js, tables.js).
- Backend Enhancements:
- Added `ControlEntryModel` and `ResultCommentsController` for improved data handling and auditing.
- Updated routing to support the new controller structure and consolidated API endpoints.
- Documentation & Assets:
- Added [docs/PRD.md](cci:7://file:///c:/www/tinyqc/docs/PRD.md:0:0-0:0) and [docs/llms.txt](cci:7://file:///c:/www/tinyqc/docs/llms.txt:0:0-0:0) for project context and requirements.
- Included database schema scripts and backups in the `backup/` directory.
- Cleanup: Removed legacy TUI progress files and unused commands.
- Add per-day comment input in monthly entry grid (comment icon per cell)
- Update saveMonthly() to save rescomment field for each result
- Update getMonthlyData() to return per-day comments
- Store comments in results.rescomment field with soft deletes support
- Replace modal-based entry with inline calendar grid view
- Add dynamic day rendering (28-31 days based on selected month)
- Implement weekend highlighting (Saturday/Sunday with red background)
- Add horizontal scrolling for multiple tests display
- Support multi-test selection via checkboxes
- Auto-load monthly data when selecting tests
- Improve UX with Ctrl+S save shortcut and draft persistence