add inventory and supply logic

This commit is contained in:
root
2026-03-10 18:21:08 -04:00
parent 17d73e2f92
commit 25e7b3c67c
62 changed files with 3846 additions and 2781 deletions
@@ -0,0 +1,23 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryAdjustRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'mode' => ['required', 'in:in,out,adjust'],
'quantity' => ['required', 'integer', 'min:1'],
'reason' => ['nullable', 'string', 'max:120'],
'note' => ['nullable', 'string'],
];
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryAuditRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'needs_repair_qty' => ['nullable', 'integer', 'min:0'],
'need_replace_qty' => ['nullable', 'integer', 'min:0'],
'cannot_find_qty' => ['nullable', 'integer', 'min:0'],
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryCategoryIndexRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'type' => ['nullable', 'string', 'max:20'],
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryCategoryStoreRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'type' => ['required', 'string', 'max:20'],
'name' => ['required', 'string', 'max:120'],
'description' => ['nullable', 'string'],
'grade_min' => ['nullable', 'integer', 'min:0', 'max:13'],
'grade_max' => ['nullable', 'integer', 'min:0', 'max:13'],
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryCategoryUpdateRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'type' => ['sometimes', 'string', 'max:20'],
'name' => ['sometimes', 'string', 'max:120'],
'description' => ['nullable', 'string'],
'grade_min' => ['nullable', 'integer', 'min:0', 'max:13'],
'grade_max' => ['nullable', 'integer', 'min:0', 'max:13'],
];
}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryItemIndexRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'type' => ['nullable', 'string', 'max:20'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
'q' => ['nullable', 'string', 'max:120'],
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryItemStoreRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'type' => ['required', 'string', 'max:20'],
'category_id' => ['nullable', 'integer', 'min:1'],
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'quantity' => ['nullable', 'integer'],
'unit' => ['nullable', 'string', 'max:50'],
'condition' => ['nullable', 'string', 'max:50'],
'isbn' => ['nullable', 'string', 'max:50'],
'edition' => ['nullable', 'string', 'max:50'],
'sku' => ['nullable', 'string', 'max:50'],
'notes' => ['nullable', 'string'],
];
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryItemUpdateRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'category_id' => ['nullable', 'integer', 'min:1'],
'name' => ['sometimes', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'quantity' => ['nullable', 'integer'],
'unit' => ['nullable', 'string', 'max:50'],
'condition' => ['nullable', 'string', 'max:50'],
'isbn' => ['nullable', 'string', 'max:50'],
'edition' => ['nullable', 'string', 'max:50'],
'sku' => ['nullable', 'string', 'max:50'],
'notes' => ['nullable', 'string'],
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryMovementBulkDeleteRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'ids' => ['required', 'array', 'min:1'],
'ids.*' => ['integer', 'min:1'],
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryMovementIndexRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
];
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryMovementStoreRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'item_id' => ['required', 'integer', 'min:1'],
'qty_change' => ['required', 'integer'],
'movement_type' => ['required', 'in:initial,in,out,adjust,distribution'],
'reason' => ['nullable', 'string', 'max:120'],
'note' => ['nullable', 'string'],
'semester' => ['nullable', 'string', 'max:20'],
'school_year' => ['nullable', 'string', 'max:20'],
'teacher_id' => ['nullable', 'integer', 'min:1'],
'student_id' => ['nullable', 'integer', 'min:1'],
'class_section_id' => ['nullable', 'integer', 'min:1'],
];
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryMovementUpdateRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'qty_change' => ['required', 'integer'],
'movement_type' => ['required', 'in:initial,in,out,adjust,distribution'],
'reason' => ['nullable', 'string', 'max:120'],
'note' => ['nullable', 'string'],
'semester' => ['nullable', 'string', 'max:20'],
'school_year' => ['nullable', 'string', 'max:20'],
'teacher_id' => ['nullable', 'integer', 'min:1'],
'student_id' => ['nullable', 'integer', 'min:1'],
'class_section_id' => ['nullable', 'integer', 'min:1'],
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryTeacherDistributionRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'class_section_id' => ['nullable', 'integer', 'min:1'],
'item_id' => ['nullable', 'integer', 'min:1'],
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class InventoryTeacherDistributionStoreRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'item_id' => ['required', 'integer', 'min:1'],
'class_section_id' => ['nullable', 'integer', 'min:1'],
'student_ids' => ['required', 'array', 'min:1'],
'student_ids.*' => ['integer', 'min:1'],
'note' => ['nullable', 'string'],
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class SupplierIndexRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'q' => ['nullable', 'string', 'max:120'],
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class SupplierStoreRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => ['nullable', 'email', 'max:255'],
'phone' => ['nullable', 'string', 'max:50'],
'address' => ['nullable', 'string', 'max:255'],
'notes' => ['nullable', 'string'],
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class SupplierUpdateRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'name' => ['sometimes', 'string', 'max:255'],
'email' => ['nullable', 'email', 'max:255'],
'phone' => ['nullable', 'string', 'max:50'],
'address' => ['nullable', 'string', 'max:255'],
'notes' => ['nullable', 'string'],
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class SupplyCategoryStoreRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Requests\Inventory;
use App\Http\Requests\ApiFormRequest;
class SupplyCategoryUpdateRequest extends ApiFormRequest
{
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
];
}
}