update api and add more features

This commit is contained in:
root
2026-06-04 02:24:41 -04:00
parent fa6c9519a0
commit 4e33882ac7
131 changed files with 34596 additions and 340 deletions
@@ -9,6 +9,8 @@ class FeeRefundResource extends JsonResource
{
public function toArray(Request $request): array
{
$students = $this->resource['students'] ?? [];
return [
'refund_amount' => (float) ($this->resource['refund_amount'] ?? 0),
'total_paid' => (float) ($this->resource['total_paid'] ?? 0),
@@ -16,6 +18,20 @@ class FeeRefundResource extends JsonResource
'school_end_date' => $this->resource['school_end_date'] ?? null,
'weeks_of_study' => (float) ($this->resource['weeks_of_study'] ?? 0),
'withdrawn_students' => (int) ($this->resource['withdrawn_students'] ?? 0),
'students' => array_map(function (array $row): array {
return [
'student_id' => $row['student_id'] ?? null,
'grade' => $row['grade'] ?? null,
'grade_level' => $row['grade_level'] ?? null,
'fee_category' => $row['fee_category'] ?? null,
'tuition_fee' => (float) ($row['tuition_fee'] ?? 0),
'withdrawal_date' => $row['withdrawal_date'] ?? null,
'weeks_remaining' => (int) ($row['weeks_remaining'] ?? 0),
'refund_amount' => (float) ($row['refund_amount'] ?? 0),
'eligible' => (bool) ($row['eligible'] ?? false),
'reason' => $row['reason'] ?? null,
];
}, $students),
];
}
}