tinyqc/app/Models/Master/MasterTestsModel.php
mahdahar 0a96b04bdf feat: Implement Monthly Entry interface and consolidate Entry API controller
- 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
2026-01-21 13:41:37 +07:00

53 lines
1.5 KiB
PHP

<?php
namespace App\Models\Master;
use App\Models\BaseModel;
class MasterTestsModel extends BaseModel {
protected $table = 'master_tests';
protected $primaryKey = 'test_id';
protected $allowedFields = [
'dept_id',
'test_code',
'test_name',
'test_unit',
'test_method',
'cva',
'ba',
'tea',
'created_at',
'updated_at',
'deleted_at'
];
protected $useTimestamps = true;
protected $useSoftDeletes = true;
public function search($keyword = null) {
$builder = $this->builder();
$builder->select('
master_tests.test_id as testId,
master_tests.test_code as testCode,
master_tests.test_name as testName,
master_tests.test_unit as testUnit,
master_tests.test_method as testMethod,
master_tests.cva,
master_tests.ba,
master_tests.tea,
master_depts.dept_name as deptName
');
$builder->join('master_depts', 'master_depts.dept_id = master_tests.dept_id', 'left');
$builder->where('master_tests.deleted_at', null);
if ($keyword) {
$builder->groupStart()
->like('master_tests.test_name', $keyword)
->groupEnd();
}
$builder->groupBy('master_tests.test_id, master_depts.dept_name');
$builder->orderBy('master_tests.test_name', 'ASC');
return $builder->get()->getResultArray();
}
}