fix teacher pages and adopt the school year
Tests / PHPUnit (push) Successful in 1m14s

This commit is contained in:
root
2026-07-17 00:38:59 -04:00
parent 539d0eb220
commit 0d0a771dd1
7 changed files with 97 additions and 26 deletions
@@ -3,6 +3,7 @@
namespace App\Controllers\View;
use App\Controllers\BaseController;
use App\Exceptions\SchoolYear\SchoolYearWriteConflictException;
use App\Models\ClassSectionModel;
use App\Models\InventoryItemModel;
use App\Models\InventoryCategoryModel;
@@ -713,6 +714,8 @@ class InventoryController extends BaseController
*/
public function teacherDistributeForm()
{
$schoolYearContext = $this->resolveSchoolYearContext();
// 1) Build teacher/class context (auth/role/no-class handled inside)
$ctx = $this->buildTeacherClassContext();
if ($ctx instanceof \CodeIgniter\HTTP\RedirectResponse) {
@@ -858,11 +861,19 @@ class InventoryController extends BaseController
'schoolYear' => $ctx['schoolYear'],
'semester' => $ctx['semester'],
'isEditable' => ! $schoolYearContext->isReadonly(),
]);
}
public function teacherDistributeStore()
{
$schoolYearContext = $this->resolveSchoolYearContext();
try {
$this->assertSchoolYearWritable($schoolYearContext);
} catch (SchoolYearWriteConflictException $e) {
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
$ctx = $this->buildTeacherClassContext();
if ($ctx instanceof \CodeIgniter\HTTP\RedirectResponse) {
return $ctx;