commit ff90e0eb2918fb122f2297a2435ca04bab0dcd6b Author: mahdahar <89adham@gmail.com> Date: Wed Jan 14 16:49:27 2026 +0700 Initial commit: Add CodeIgniter 4 QC application with full MVC structure - CodeIgniter 4 framework setup with SQL Server database config - Models: Control, Test, Dept, Result, Daily/ Monthly entry models - Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints - Views: CRUD pages with modal dialogs, dashboard, reports - Database: Migrations for control test and daily/monthly result tables - Legacy v1 PHP application preserved in /v1 directory - Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..87e86b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,126 @@ +#------------------------- +# Operating Specific Junk Files +#------------------------- + +# OS X +.DS_Store +.AppleDouble +.LSOverride + +# OS X Thumbnails +._* + +# Windows image file caches +Thumbs.db +ehthumbs.db +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Linux +*~ + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +#------------------------- +# Environment Files +#------------------------- +# These should never be under version control, +# as it poses a security risk. +.env +.vagrant +Vagrantfile + +#------------------------- +# Temporary Files +#------------------------- +writable/cache/* +!writable/cache/index.html + +writable/logs/* +!writable/logs/index.html + +writable/session/* +!writable/session/index.html + +writable/uploads/* +!writable/uploads/index.html + +writable/debugbar/* +!writable/debugbar/index.html + +php_errors.log + +#------------------------- +# User Guide Temp Files +#------------------------- +user_guide_src/build/* +user_guide_src/cilexer/build/* +user_guide_src/cilexer/dist/* +user_guide_src/cilexer/pycilexer.egg-info/* + +#------------------------- +# Test Files +#------------------------- +tests/coverage* + +# Don't save phpunit under version control. +phpunit + +#------------------------- +# Composer +#------------------------- +vendor/ + +#------------------------- +# IDE / Development Files +#------------------------- + +# Modules Testing +_modules/* + +# phpenv local config +.php-version + +# Jetbrains editors (PHPStorm, etc) +.idea/ +*.iml + +# NetBeans +/nbproject/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/nbactions.xml +/nb-configuration.xml +/.nb-gradle/ + +# Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +.phpintel +/api/ + +# Visual Studio Code +.vscode/ + +/results/ +/phpunit*.xml diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..ca17ce0 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,340 @@ +# AGENTS.md - QC Application Development Guide + +This document provides guidelines for agentic coding agents working on this PHP QC (Quality Control) application built with CodeIgniter 4. + +## Project Overview + +This is a CodeIgniter 4 PHP application using SQL Server database for quality control data management. The app handles control tests, daily/monthly entries, and reporting. Uses Tailwind CSS and Alpine.js for UI. + +## Build/Lint/Test Commands + +```bash +# PHP syntax check single file +php -l app/Controllers/Dashboard.php + +# PHP syntax check all files recursively +find . -name "*.php" -exec php -l {} \; 2>&1 | grep -v "No syntax errors" + +# Run all PHPUnit tests +./vendor/bin/phpunit + +# Run single test class +./vendor/bin/phpunit tests/unit/HealthTest.php + +# Run single test method +./vendor/bin/phpunit tests/unit/HealthTest.php --filter=testIsDefinedAppPath + +# Run with coverage report +./vendor/bin/phpunit --coverage-html coverage/ + +# Start development server +php spark serve +``` + +## Code Style Guidelines + +### General Principles + +- Follow CodeIgniter 4 MVC patterns +- Maintain consistency with surrounding code +- Keep files focused (<200 lines preferred) +- Use clear, descriptive names + +### PHP Style + +- Use `dictTestModel = new DictTestModel(); + } + + public function index(): string + { + $data = [ + 'title' => 'Test Dictionary', + 'tests' => $this->dictTestModel->findAll(), + ]; + + return view('layout', [ + 'content' => view('test/index', $data), + 'page_title' => 'Test Dictionary', + 'active_menu' => 'test' + ]); + } +} +``` + +**Models** extend `CodeIgniter\Model`: +```php +namespace App\Models; + +use CodeIgniter\Model; + +class TestModel extends Model +{ + protected $table = 'dict_test'; + protected $primaryKey = 'id'; + protected $returnType = 'array'; + protected $useSoftDeletes = false; + protected $allowedFields = ['deptid', 'name', 'unit', 'method']; +} +``` + +**Views** use PHP short tags `= ?>` for output: +```php +
| = $record['name'] ?> | ++ + + | +
Module description
+Loading...
+No data found
+| # | +Code | +Name | +Actions | +
|---|---|---|---|
| + | + + | ++ | + + + | +
Select an item to view details
+