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,20 @@
<?php
namespace App\Http\Resources\Inventory;
use Illuminate\Http\Resources\Json\JsonResource;
class InventoryCategoryResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'type' => (string) ($this['type'] ?? ''),
'name' => (string) ($this['name'] ?? ''),
'description' => $this['description'] ?? null,
'grade_min' => $this['grade_min'] ?? null,
'grade_max' => $this['grade_max'] ?? null,
];
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Resources\Inventory;
use Illuminate\Http\Resources\Json\JsonResource;
class InventoryItemResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'type' => (string) ($this['type'] ?? ''),
'category_id' => $this['category_id'] ?? null,
'name' => (string) ($this['name'] ?? ''),
'description' => $this['description'] ?? null,
'quantity' => (int) ($this['quantity'] ?? 0),
'good_qty' => $this['good_qty'] ?? null,
'needs_repair_qty' => $this['needs_repair_qty'] ?? null,
'need_replace_qty' => $this['need_replace_qty'] ?? null,
'cannot_find_qty' => $this['cannot_find_qty'] ?? null,
'unit' => $this['unit'] ?? null,
'condition' => $this['condition'] ?? null,
'isbn' => $this['isbn'] ?? null,
'edition' => $this['edition'] ?? null,
'sku' => $this['sku'] ?? null,
'notes' => $this['notes'] ?? null,
'semester' => $this['semester'] ?? null,
'school_year' => $this['school_year'] ?? null,
'updated_by' => $this['updated_by'] ?? null,
];
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Resources\Inventory;
use Illuminate\Http\Resources\Json\JsonResource;
class InventoryMovementResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'item_id' => (int) ($this['item_id'] ?? 0),
'item_name' => $this['item_name'] ?? null,
'qty_change' => (int) ($this['qty_change'] ?? 0),
'movement_type' => (string) ($this['movement_type'] ?? ''),
'reason' => $this['reason'] ?? null,
'note' => $this['note'] ?? null,
'semester' => $this['semester'] ?? null,
'school_year' => $this['school_year'] ?? null,
'performed_by' => $this['performed_by'] ?? null,
'performed_by_name' => $this['performed_by_name'] ?? null,
'teacher_id' => $this['teacher_id'] ?? null,
'teacher_name' => $this['teacher_name'] ?? null,
'student_id' => $this['student_id'] ?? null,
'student_name' => $this['student_name'] ?? null,
'class_section_id' => $this['class_section_id'] ?? null,
'class_section_name' => $this['class_section_name'] ?? null,
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Resources\Inventory;
use Illuminate\Http\Resources\Json\JsonResource;
class SupplierResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'name' => (string) ($this['name'] ?? ''),
'email' => $this['email'] ?? null,
'phone' => $this['phone'] ?? null,
'address' => $this['address'] ?? null,
'notes' => $this['notes'] ?? null,
];
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Http\Resources\Inventory;
use Illuminate\Http\Resources\Json\JsonResource;
class SupplyCategoryResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => (int) ($this['id'] ?? 0),
'name' => (string) ($this['name'] ?? ''),
];
}
}