security fix and fix parent pages
API CI/CD / Validate (composer + pint) (push) Successful in 3m7s
API CI/CD / Test (PHPUnit) (push) Failing after 5m46s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped

This commit is contained in:
root
2026-07-06 02:14:16 -04:00
parent 39228168c8
commit 90f9857b06
43 changed files with 4323 additions and 132 deletions
@@ -9,6 +9,7 @@ use App\Http\Requests\Inventory\InventoryMovementStoreRequest;
use App\Http\Requests\Inventory\InventoryMovementUpdateRequest;
use App\Http\Resources\Inventory\InventoryMovementResource;
use App\Services\Inventory\InventoryMovementService;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
@@ -23,9 +24,65 @@ class InventoryMovementController extends BaseApiController
{
$rows = $this->movements->list($request->validated());
return $this->success([
return $this->success(array_merge([
'movements' => InventoryMovementResource::collection($rows),
]);
], $this->movementFormPayload()));
}
public function editForm(int $id): JsonResponse
{
$movement = collect($this->movements->list(['include_voided' => 1]))
->first(fn ($row) => (int) ($row['id'] ?? 0) === $id);
if (! $movement) {
return $this->error('Movement not found.', Response::HTTP_NOT_FOUND);
}
return $this->success(array_merge($this->movementFormPayload(), [
'movement' => new InventoryMovementResource($movement),
]));
}
private function movementFormPayload(): array
{
$items = DB::table('inventory_items')
->select('id', 'name', 'type', 'quantity')
->orderBy('name')
->get()
->map(fn ($row) => (array) $row)
->all();
$teachers = DB::table('users')
->select('id', 'firstname', 'lastname', 'email')
->orderBy('firstname')
->orderBy('lastname')
->get()
->map(fn ($row) => (array) $row)
->all();
$students = DB::table('students')
->select('id', 'firstname', 'lastname')
->orderBy('firstname')
->orderBy('lastname')
->get()
->map(fn ($row) => (array) $row)
->all();
$classSections = DB::table('classSection')
->select('class_section_id as id', 'class_section_id', 'class_section_name')
->orderBy('class_section_name')
->get()
->map(fn ($row) => (array) $row)
->all();
return [
'items' => $items,
'teachers' => $teachers,
'students' => $students,
'classSections' => $classSections,
'movementTypes' => ['initial', 'in', 'out', 'adjust', 'distribution'],
'semesters' => ['Fall', 'Spring'],
];
}
public function store(InventoryMovementStoreRequest $request): JsonResponse