This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user