- 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
74 lines
1.9 KiB
PHP
74 lines
1.9 KiB
PHP
<?php
|
|
namespace App\Controllers\Qc;
|
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
use App\Controllers\BaseController;
|
|
use App\Models\Qc\ControlTestsModel;
|
|
|
|
class ControlTestsController extends BaseController
|
|
{
|
|
use ResponseTrait;
|
|
|
|
protected $model;
|
|
protected $rules = [
|
|
'controlId' => 'required|numeric',
|
|
'testId' => 'required|numeric',
|
|
'mean' => 'required|decimal',
|
|
'sd' => 'required|decimal',
|
|
];
|
|
|
|
public function __construct()
|
|
{
|
|
$this->model = new ControlTestsModel();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$keyword = $this->request->getGet('keyword');
|
|
return $this->respond([
|
|
'status' => 'success',
|
|
'data' => $this->model->search($keyword)
|
|
]);
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$input = $this->request->getJSON(true);
|
|
if (!$this->validate($this->rules)) {
|
|
return $this->failValidationErrors($this->validator->getErrors());
|
|
}
|
|
|
|
try {
|
|
$id = $this->model->insert($input);
|
|
return $this->respondCreated(['status' => 'success', 'data' => $id]);
|
|
} catch (\Exception $e) {
|
|
return $this->failServerError($e->getMessage());
|
|
}
|
|
}
|
|
|
|
public function update($id = null)
|
|
{
|
|
$input = $this->request->getJSON(true);
|
|
if (!$this->validate($this->rules)) {
|
|
return $this->failValidationErrors($this->validator->getErrors());
|
|
}
|
|
|
|
try {
|
|
$this->model->update($id, $input);
|
|
return $this->respond(['status' => 'success']);
|
|
} catch (\Exception $e) {
|
|
return $this->failServerError($e->getMessage());
|
|
}
|
|
}
|
|
|
|
public function delete($id = null)
|
|
{
|
|
try {
|
|
$this->model->delete($id);
|
|
return $this->respond(['status' => 'success']);
|
|
} catch (\Exception $e) {
|
|
return $this->failServerError($e->getMessage());
|
|
}
|
|
}
|
|
}
|