- 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
47 lines
2.9 KiB
PHP
47 lines
2.9 KiB
PHP
<div class="max-w-2xl mx-auto">
|
|
<div class="bg-white rounded-lg shadow p-6">
|
|
<h2 class="text-2xl font-bold text-gray-800 mb-6"><?= isset($control) ? 'Edit Control' : 'Add New Control' ?></h2>
|
|
|
|
<form action="<?= isset($control) ? base_url('/control/update/' . $control['control_id']) : base_url('/control/save') ?>" method="post">
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Department</label>
|
|
<select name="deptid" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary-500 focus:border-primary-500">
|
|
<option value="">Select Department</option>
|
|
<?php foreach ($depts as $dept): ?>
|
|
<option value="<?= $dept['dept_id'] ?>" <?= (isset($control) && $control['dept_ref_id'] == $dept['dept_id']) ? 'selected' : '' ?>>
|
|
<?= $dept['name'] ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Control Name</label>
|
|
<input type="text" name="name" value="<?= $control['name'] ?? '' ?>" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary-500 focus:border-primary-500" required>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Lot Number</label>
|
|
<input type="text" name="lot" value="<?= $control['lot'] ?? '' ?>" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary-500 focus:border-primary-500">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Expiry Date</label>
|
|
<input type="date" name="expdate" value="<?= $control['expdate'] ?? '' ?>" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary-500 focus:border-primary-500">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Producer</label>
|
|
<textarea name="producer" rows="3" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-primary-500 focus:border-primary-500"><?= $control['producer'] ?? '' ?></textarea>
|
|
</div>
|
|
|
|
<div class="flex justify-end space-x-4 pt-4">
|
|
<a href="<?= base_url('/control') ?>" class="bg-gray-300 hover:bg-gray-400 text-gray-800 px-4 py-2 rounded-lg">Cancel</a>
|
|
<button type="submit" class="bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg">Save</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|