add controllers, servoices
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Auth;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class RegisterResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
$user = $this->resource['user'] ?? null;
|
||||
|
||||
return [
|
||||
'user_id' => $user?->id,
|
||||
'email' => $user?->email,
|
||||
'firstname' => $user?->firstname,
|
||||
'lastname' => $user?->lastname,
|
||||
'role' => $this->resource['role'] ?? null,
|
||||
'activation_sent' => (bool) ($this->resource['activation_sent'] ?? false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Discounts;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DiscountParentResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this['id'] ?? null,
|
||||
'firstname' => $this['firstname'] ?? '',
|
||||
'lastname' => $this['lastname'] ?? '',
|
||||
'email' => $this['email'] ?? '',
|
||||
'total_discount' => (float) ($this['total_discount'] ?? 0),
|
||||
'has_discount' => (int) ($this['has_discount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Discounts;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DiscountVoucherResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'code' => $this->code,
|
||||
'discount_type' => $this->discount_type,
|
||||
'discount_value' => $this->discount_value,
|
||||
'max_uses' => $this->max_uses,
|
||||
'times_used' => $this->times_used,
|
||||
'valid_from' => $this->valid_from,
|
||||
'valid_until' => $this->valid_until,
|
||||
'is_active' => (bool) $this->is_active,
|
||||
'description' => $this->description,
|
||||
'school_year' => $this->school_year,
|
||||
'semester' => $this->semester,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Expenses;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ExpenseResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this['id'] ?? $this->id,
|
||||
'category' => $this['category'] ?? $this->category,
|
||||
'amount' => $this['amount'] ?? $this->amount,
|
||||
'receipt_path' => $this['receipt_path'] ?? $this->receipt_path,
|
||||
'receipt_url' => $this['receipt_url'] ?? null,
|
||||
'description' => $this['description'] ?? $this->description,
|
||||
'retailor' => $this['retailor'] ?? $this->retailor,
|
||||
'date_of_purchase' => $this['date_of_purchase'] ?? $this->date_of_purchase,
|
||||
'purchased_by' => $this['purchased_by'] ?? $this->purchased_by,
|
||||
'added_by' => $this['added_by'] ?? $this->added_by,
|
||||
'school_year' => $this['school_year'] ?? $this->school_year,
|
||||
'semester' => $this['semester'] ?? $this->semester,
|
||||
'status' => $this['status'] ?? $this->status,
|
||||
'status_reason' => $this['status_reason'] ?? $this->status_reason,
|
||||
'approved_by' => $this['approved_by'] ?? $this->approved_by,
|
||||
'updated_by' => $this['updated_by'] ?? $this->updated_by,
|
||||
'purchaser_firstname' => $this['purchaser_firstname'] ?? null,
|
||||
'purchaser_lastname' => $this['purchaser_lastname'] ?? null,
|
||||
'approver_firstname' => $this['approver_firstname'] ?? null,
|
||||
'approver_lastname' => $this['approver_lastname'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Expenses;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ExpenseStaffResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this['id'] ?? null,
|
||||
'firstname' => $this['firstname'] ?? '',
|
||||
'lastname' => $this['lastname'] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\ExtraCharges;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ExtraChargeInvoiceOptionResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this['id'] ?? null,
|
||||
'invoice_number' => $this['invoice_number'] ?? '',
|
||||
'status' => $this['status'] ?? '',
|
||||
'balance' => $this['balance'] ?? 0,
|
||||
'issue_date' => $this['issue_date'] ?? null,
|
||||
'text' => $this['text'] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\ExtraCharges;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ExtraChargeParentOptionResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this['id'] ?? null,
|
||||
'text' => $this['text'] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\ExtraCharges;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ExtraChargeResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
$data = is_array($this->resource) ? $this->resource : $this->resource->toArray();
|
||||
|
||||
return [
|
||||
'id' => (int) ($data['id'] ?? 0),
|
||||
'parent_id' => $data['parent_id'] ?? null,
|
||||
'invoice_id' => $data['invoice_id'] ?? null,
|
||||
'school_year' => $data['school_year'] ?? null,
|
||||
'semester' => $data['semester'] ?? null,
|
||||
'charge_type' => $data['charge_type'] ?? null,
|
||||
'title' => $data['title'] ?? null,
|
||||
'description' => $data['description'] ?? null,
|
||||
'amount' => $data['amount'] ?? null,
|
||||
'due_date' => $data['due_date'] ?? null,
|
||||
'status' => $data['status'] ?? null,
|
||||
'created_by' => $data['created_by'] ?? null,
|
||||
'created_at' => $data['created_at'] ?? null,
|
||||
'parent_name' => $data['parent_name'] ?? null,
|
||||
'invoice_number' => $data['invoice_number'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Files;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FileMetaResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->resource['name'] ?? null,
|
||||
'mime' => $this->resource['mime'] ?? null,
|
||||
'size' => $this->resource['size'] ?? null,
|
||||
'etag' => $this->resource['etag'] ?? null,
|
||||
'last_modified' => $this->resource['last_modified'] ?? null,
|
||||
'download_name' => $this->resource['download_name'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialDiscountResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'invoice_id' => (int) ($this->resource['invoice_id'] ?? 0),
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'discount_amount' => (float) ($this->resource['discount_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialExpenseSummaryResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'category' => $this->resource['category'] ?? null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialInvoiceResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? 0),
|
||||
'invoice_number' => $this->resource['invoice_number'] ?? null,
|
||||
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
||||
'parent_name' => $this->resource['parent_name'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
'paid_amount' => (float) ($this->resource['paid_amount'] ?? 0),
|
||||
'balance' => (float) ($this->resource['balance'] ?? 0),
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'issue_date' => $this->resource['issue_date'] ?? null,
|
||||
'due_date' => $this->resource['due_date'] ?? null,
|
||||
'created_at' => $this->resource['created_at'] ?? null,
|
||||
'updated_at' => $this->resource['updated_at'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialPaymentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'invoice_id' => (int) ($this->resource['invoice_id'] ?? 0),
|
||||
'paid_amount' => (float) ($this->resource['paid_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialRefundResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'invoice_id' => (int) ($this->resource['invoice_id'] ?? 0),
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'total_refunded' => (float) ($this->resource['total_refunded'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialReimbursementSummaryResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialReportResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'selectedYear' => $this->resource['selectedYear'] ?? null,
|
||||
'dateFrom' => $this->resource['dateFrom'] ?? null,
|
||||
'dateTo' => $this->resource['dateTo'] ?? null,
|
||||
'schoolYears' => $this->resource['schoolYears'] ?? [],
|
||||
'invoices' => FinancialInvoiceResource::collection($this->resource['invoices'] ?? []),
|
||||
'payments' => FinancialPaymentResource::collection($this->resource['payments'] ?? []),
|
||||
'paymentBreakdown' => $this->resource['paymentBreakdown'] ?? [],
|
||||
'paymentTotals' => $this->resource['paymentTotals'] ?? [],
|
||||
'refunds' => FinancialRefundResource::collection($this->resource['refunds'] ?? []),
|
||||
'expenses' => FinancialExpenseSummaryResource::collection($this->resource['expenses'] ?? []),
|
||||
'reimbursements' => FinancialReimbursementSummaryResource::collection($this->resource['reimbursements'] ?? []),
|
||||
'discounts' => FinancialDiscountResource::collection($this->resource['discounts'] ?? []),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialSummaryResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'schoolYear' => $this->resource['schoolYear'] ?? null,
|
||||
'dateFrom' => $this->resource['dateFrom'] ?? null,
|
||||
'dateTo' => $this->resource['dateTo'] ?? null,
|
||||
'totalCharges' => (float) ($this->resource['totalCharges'] ?? 0),
|
||||
'totalExtraCharges' => (float) ($this->resource['totalExtraCharges'] ?? 0),
|
||||
'totalDiscounts' => (float) ($this->resource['totalDiscounts'] ?? 0),
|
||||
'totalRefunds' => (float) ($this->resource['totalRefunds'] ?? 0),
|
||||
'totalExpenses' => (float) ($this->resource['totalExpenses'] ?? 0),
|
||||
'totalReimbursements' => (float) ($this->resource['totalReimbursements'] ?? 0),
|
||||
'donationToSchool' => (float) ($this->resource['donationToSchool'] ?? 0),
|
||||
'totalPaid' => (float) ($this->resource['totalPaid'] ?? 0),
|
||||
'amountCollected' => (float) ($this->resource['amountCollected'] ?? 0),
|
||||
'totalUnpaid' => (float) ($this->resource['totalUnpaid'] ?? 0),
|
||||
'netAmount' => (float) ($this->resource['netAmount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialUnpaidParentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
||||
'parent_name' => $this->resource['parent_name'] ?? null,
|
||||
'email' => $this->resource['email'] ?? null,
|
||||
'total_invoice' => (float) ($this->resource['total_invoice'] ?? 0),
|
||||
'total_balance' => (float) ($this->resource['total_balance'] ?? 0),
|
||||
'total_discount' => (float) ($this->resource['total_discount'] ?? 0),
|
||||
'remaining_installments' => (int) ($this->resource['remaining_installments'] ?? 0),
|
||||
'installment_amount' => (float) ($this->resource['installment_amount'] ?? 0),
|
||||
'type' => $this->resource['type'] ?? null,
|
||||
'total_paid' => (float) ($this->resource['total_paid'] ?? 0),
|
||||
'payment_count' => (int) ($this->resource['payment_count'] ?? 0),
|
||||
'has_installment' => (int) ($this->resource['has_installment'] ?? 0),
|
||||
'next_installment' => $this->resource['next_installment'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Grading;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class BelowSixtyStudentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'student_id' => (int) ($this->resource['student_id'] ?? 0),
|
||||
'school_id' => $this->resource['school_id'] ?? null,
|
||||
'firstname' => $this->resource['firstname'] ?? null,
|
||||
'lastname' => $this->resource['lastname'] ?? null,
|
||||
'class_section_name' => $this->resource['class_section_name'] ?? null,
|
||||
'homework_avg' => $this->resource['homework_avg'] ?? null,
|
||||
'project_avg' => $this->resource['project_avg'] ?? null,
|
||||
'participation_score' => $this->resource['participation_score'] ?? null,
|
||||
'test_avg' => $this->resource['test_avg'] ?? null,
|
||||
'ptap_score' => $this->resource['ptap_score'] ?? null,
|
||||
'attendance_score' => $this->resource['attendance_score'] ?? null,
|
||||
'midterm_exam_score' => $this->resource['midterm_exam_score'] ?? null,
|
||||
'final_exam_score' => $this->resource['final_exam_score'] ?? null,
|
||||
'semester_score' => $this->resource['semester_score'] ?? null,
|
||||
'comment' => $this->resource['comment'] ?? null,
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Grading;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class GradingScoreResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return $this->resource->toArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Grading;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class HomeworkTrackingTeacherResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'class_section_id' => (int) ($this->resource['class_section_id'] ?? 0),
|
||||
'class_id' => $this->resource['class_id'] ?? null,
|
||||
'class_section_name' => $this->resource['class_section_name'] ?? null,
|
||||
'teachers' => $this->resource['teachers'] ?? [],
|
||||
'tas' => $this->resource['tas'] ?? [],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Incidents;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class IncidentAnalysisStudentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'student_id' => $this->resource['student_id'] ?? null,
|
||||
'student_name' => $this->resource['student_name'] ?? null,
|
||||
'grade' => $this->resource['grade'] ?? null,
|
||||
'total' => (int) ($this->resource['total'] ?? 0),
|
||||
'open' => (int) ($this->resource['open'] ?? 0),
|
||||
'closed' => (int) ($this->resource['closed'] ?? 0),
|
||||
'canceled' => (int) ($this->resource['canceled'] ?? 0),
|
||||
'last_incident' => $this->resource['last_incident'] ?? null,
|
||||
'logs' => $this->resource['logs'] ?? [],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Incidents;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class IncidentGradeResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->resource['id'] ?? null,
|
||||
'name' => $this->resource['name'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Incidents;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class IncidentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->resource['id'] ?? null,
|
||||
'student_id' => $this->resource['student_id'] ?? null,
|
||||
'student_name' => $this->resource['student_name'] ?? null,
|
||||
'grade' => $this->resource['grade'] ?? null,
|
||||
'incident' => $this->resource['incident'] ?? null,
|
||||
'incident_datetime' => $this->resource['incident_datetime'] ?? null,
|
||||
'incident_state' => $this->resource['incident_state'] ?? null,
|
||||
'updated_by_open' => $this->resource['updated_by_open'] ?? null,
|
||||
'updated_by_open_name' => $this->resource['updated_by_open_name'] ?? null,
|
||||
'open_description' => $this->resource['open_description'] ?? null,
|
||||
'updated_by_closed' => $this->resource['updated_by_closed'] ?? null,
|
||||
'updated_by_closed_name' => $this->resource['updated_by_closed_name'] ?? null,
|
||||
'close_description' => $this->resource['close_description'] ?? null,
|
||||
'action_taken' => $this->resource['action_taken'] ?? null,
|
||||
'updated_by_canceled' => $this->resource['updated_by_canceled'] ?? null,
|
||||
'updated_by_canceled_name' => $this->resource['updated_by_canceled_name'] ?? null,
|
||||
'cancel_description' => $this->resource['cancel_description'] ?? null,
|
||||
'semester' => $this->resource['semester'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'created_at' => $this->resource['created_at'] ?? null,
|
||||
'updated_at' => $this->resource['updated_at'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Incidents;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class IncidentStudentOptionResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? 0),
|
||||
'name' => $this->resource['name'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Invoices;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class InvoiceManagementParentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'parent_name' => $this->resource['parent_name'] ?? '',
|
||||
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
||||
'enrolledKids' => $this->resource['enrolledKids'] ?? [],
|
||||
'withdrawnKids' => $this->resource['withdrawnKids'] ?? [],
|
||||
'invoice_amount' => (float) ($this->resource['invoice_amount'] ?? 0),
|
||||
'refund_amount' => (float) ($this->resource['refund_amount'] ?? 0),
|
||||
'last_updated' => $this->resource['last_updated'] ?? null,
|
||||
'invoice_date' => $this->resource['invoice_date'] ?? null,
|
||||
'invoice_id' => $this->resource['invoice_id'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Invoices;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class InvoiceResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? 0),
|
||||
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
||||
'invoice_number' => $this->resource['invoice_number'] ?? null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
'paid_amount' => (float) ($this->resource['paid_amount'] ?? 0),
|
||||
'balance' => (float) ($this->resource['balance'] ?? 0),
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'semester' => $this->resource['semester'] ?? null,
|
||||
'issue_date' => $this->resource['issue_date'] ?? null,
|
||||
'due_date' => $this->resource['due_date'] ?? null,
|
||||
'created_at' => $this->resource['created_at'] ?? null,
|
||||
'updated_at' => $this->resource['updated_at'] ?? null,
|
||||
'refund_amount' => (float) ($this->resource['refund_amount'] ?? 0),
|
||||
'last_paid_amount' => (float) ($this->resource['last_paid_amount'] ?? 0),
|
||||
'last_payment_date' => $this->resource['last_payment_date'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Payments;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PaymentNotificationLogResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$parent = $this->resource->parent ?? null;
|
||||
$parentName = $parent ? trim(($parent->firstname ?? '') . ' ' . ($parent->lastname ?? '')) : null;
|
||||
|
||||
return [
|
||||
'id' => (int) ($this->resource->id ?? 0),
|
||||
'parent_id' => (int) ($this->resource->parent_id ?? 0),
|
||||
'parent_name' => $parentName,
|
||||
'invoice_id' => $this->resource->invoice_id ? (int) $this->resource->invoice_id : null,
|
||||
'school_year' => $this->resource->school_year ?? null,
|
||||
'period_year' => (int) ($this->resource->period_year ?? 0),
|
||||
'period_month' => (int) ($this->resource->period_month ?? 0),
|
||||
'type' => $this->resource->type ?? null,
|
||||
'to_email' => $this->resource->to_email ?? null,
|
||||
'cc_email' => $this->resource->cc_email ?? null,
|
||||
'status' => $this->resource->status ?? null,
|
||||
'error_message' => $this->resource->error_message ?? null,
|
||||
'balance_snapshot' => (float) ($this->resource->balance_snapshot ?? 0),
|
||||
'sent_at' => $this->resource->sent_at ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Payments;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PaymentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? 0),
|
||||
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
||||
'invoice_id' => isset($this->resource['invoice_id']) ? (int) $this->resource['invoice_id'] : null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
'paid_amount' => (float) ($this->resource['paid_amount'] ?? 0),
|
||||
'balance' => (float) ($this->resource['balance'] ?? 0),
|
||||
'number_of_installments' => (int) ($this->resource['number_of_installments'] ?? 0),
|
||||
'transaction_id' => $this->resource['transaction_id'] ?? null,
|
||||
'payment_method' => $this->resource['payment_method'] ?? null,
|
||||
'payment_date' => $this->resource['payment_date'] ?? null,
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'semester' => $this->resource['semester'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'created_at' => $this->resource['created_at'] ?? null,
|
||||
'updated_at' => $this->resource['updated_at'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Payments;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PaymentTransactionResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'transaction_id' => $this->resource['transaction_id'] ?? null,
|
||||
'payment_id' => (int) ($this->resource['payment_id'] ?? 0),
|
||||
'transaction_date' => $this->resource['transaction_date'] ?? null,
|
||||
'amount' => (float) ($this->resource['amount'] ?? 0),
|
||||
'payment_method' => $this->resource['payment_method'] ?? null,
|
||||
'payment_status' => $this->resource['payment_status'] ?? null,
|
||||
'transaction_fee' => isset($this->resource['transaction_fee']) ? (float) $this->resource['transaction_fee'] : null,
|
||||
'payment_reference' => $this->resource['payment_reference'] ?? null,
|
||||
'is_full_payment' => isset($this->resource['is_full_payment']) ? (bool) $this->resource['is_full_payment'] : null,
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'semester' => $this->resource['semester'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Payments;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PaypalTransactionResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? 0),
|
||||
'transaction_id' => $this->resource['transaction_id'] ?? null,
|
||||
'order_id' => $this->resource['order_id'] ?? null,
|
||||
'parent_school_id' => $this->resource['parent_school_id'] ?? null,
|
||||
'payer_email' => $this->resource['payer_email'] ?? null,
|
||||
'amount' => (float) ($this->resource['amount'] ?? 0),
|
||||
'net_amount' => (float) ($this->resource['net_amount'] ?? 0),
|
||||
'currency' => $this->resource['currency'] ?? null,
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'event_type' => $this->resource['event_type'] ?? null,
|
||||
'created_at' => $this->resource['created_at'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Reimbursements;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReimbursementBatchResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'batchId' => (int) ($this->resource['batchId'] ?? 0),
|
||||
'batchNumber' => (int) ($this->resource['batchNumber'] ?? 0),
|
||||
'label' => $this->resource['label'] ?? null,
|
||||
'sequence' => (int) ($this->resource['sequence'] ?? 0),
|
||||
'yearly_batch_number' => (int) ($this->resource['yearly_batch_number'] ?? 0),
|
||||
'slots' => $this->resource['slots'] ?? [],
|
||||
'itemIds' => $this->resource['itemIds'] ?? [],
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Reimbursements;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReimbursementExpenseResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'expense_id' => (int) ($this->resource['id'] ?? $this->resource['expense_id'] ?? 0),
|
||||
'amount' => (float) ($this->resource['amount'] ?? 0),
|
||||
'category' => $this->resource['category'] ?? null,
|
||||
'description' => $this->resource['description'] ?? null,
|
||||
'retailor' => $this->resource['retailor'] ?? null,
|
||||
'purchased_by' => $this->resource['purchased_by'] ?? null,
|
||||
'expense_receipt_url' => $this->resource['expense_receipt_url'] ?? null,
|
||||
'reimbursement_id' => $this->resource['reimb_id'] ?? null,
|
||||
'reimbursement_amount' => isset($this->resource['reimb_amount']) ? (float) $this->resource['reimb_amount'] : null,
|
||||
'reimbursement_method' => $this->resource['reimbursement_method'] ?? null,
|
||||
'check_number' => $this->resource['check_number'] ?? null,
|
||||
'reimb_receipt_url' => $this->resource['reimb_receipt_url'] ?? null,
|
||||
'reimb_status' => $this->resource['reimb_status'] ?? null,
|
||||
'reimbursed_to' => $this->resource['reimb_recipient_id'] ?? null,
|
||||
'reimbursed_firstname' => $this->resource['reimb_firstname'] ?? null,
|
||||
'reimbursed_lastname' => $this->resource['reimb_lastname'] ?? null,
|
||||
'approver_firstname' => $this->resource['approver_firstname'] ?? null,
|
||||
'approver_lastname' => $this->resource['approver_lastname'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'semester' => $this->resource['semester'] ?? null,
|
||||
'reimb_created_at' => $this->resource['reimb_created_at'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Reimbursements;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReimbursementRecipientResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$id = (int) ($this->resource['id'] ?? 0);
|
||||
$first = $this->resource['firstname'] ?? '';
|
||||
$last = $this->resource['lastname'] ?? '';
|
||||
$name = trim($first . ' ' . $last);
|
||||
|
||||
return [
|
||||
'id' => $id,
|
||||
'firstname' => $first,
|
||||
'lastname' => $last,
|
||||
'name' => $name,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Reimbursements;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReimbursementResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? $this->resource->id ?? 0),
|
||||
'expense_id' => isset($this->resource['expense_id']) ? (int) $this->resource['expense_id'] : (int) ($this->resource->expense_id ?? 0),
|
||||
'amount' => (float) ($this->resource['amount'] ?? $this->resource->amount ?? 0),
|
||||
'reimbursed_to' => isset($this->resource['reimbursed_to']) ? (int) $this->resource['reimbursed_to'] : (int) ($this->resource->reimbursed_to ?? 0),
|
||||
'description' => $this->resource['description'] ?? $this->resource->description ?? null,
|
||||
'status' => $this->resource['status'] ?? $this->resource->status ?? null,
|
||||
'reimbursement_method' => $this->resource['reimbursement_method'] ?? $this->resource->reimbursement_method ?? null,
|
||||
'check_number' => $this->resource['check_number'] ?? $this->resource->check_number ?? null,
|
||||
'receipt_path' => $this->resource['receipt_path'] ?? $this->resource->receipt_path ?? null,
|
||||
'receipt_url' => $this->resource['receipt_url'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? $this->resource->school_year ?? null,
|
||||
'semester' => $this->resource['semester'] ?? $this->resource->semester ?? null,
|
||||
'batch_number' => isset($this->resource['batch_number']) ? (int) $this->resource['batch_number'] : (int) ($this->resource->batch_number ?? 0),
|
||||
'created_at' => $this->resource['created_at'] ?? $this->resource->created_at ?? null,
|
||||
'updated_at' => $this->resource['updated_at'] ?? $this->resource->updated_at ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Reimbursements;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReimbursementUnderProcessingItemResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? 0),
|
||||
'expense_id' => (int) ($this->resource['expense_id'] ?? 0),
|
||||
'reimbursement_id' => $this->resource['reimbursement_id'] ?? null,
|
||||
'expense_amount' => (float) ($this->resource['expense_amount'] ?? 0),
|
||||
'vendor' => $this->resource['vendor'] ?? null,
|
||||
'description' => $this->resource['description'] ?? null,
|
||||
'purchased_by' => $this->resource['purchased_by'] ?? null,
|
||||
'receipt_url' => $this->resource['receipt_url'] ?? null,
|
||||
'batch_id' => $this->resource['batch_id'] ?? null,
|
||||
'batch_label' => $this->resource['batch_label'] ?? null,
|
||||
'admin_id' => $this->resource['admin_id'] ?? null,
|
||||
'admin_name' => $this->resource['admin_name'] ?? null,
|
||||
'batch_number' => (int) ($this->resource['batch_number'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Scores;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ScoreCommentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'student_id' => (int) ($this->resource['student_id'] ?? 0),
|
||||
'firstname' => $this->resource['firstname'] ?? null,
|
||||
'lastname' => $this->resource['lastname'] ?? null,
|
||||
'school_id' => $this->resource['school_id'] ?? null,
|
||||
'comments' => $this->resource['comments'] ?? [],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Scores;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ScorePredictorStudentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'student_id' => (int) ($this->resource['student_id'] ?? 0),
|
||||
'school_id' => $this->resource['school_id'] ?? null,
|
||||
'firstname' => $this->resource['firstname'] ?? null,
|
||||
'lastname' => $this->resource['lastname'] ?? null,
|
||||
'class_section_id' => $this->resource['class_section_id'] ?? null,
|
||||
'fall_score' => $this->resource['fall_score'] ?? null,
|
||||
'spring_score' => $this->resource['spring_score'] ?? null,
|
||||
'final_average' => $this->resource['final_average'] ?? null,
|
||||
'required_spring_score' => $this->resource['required_spring_score'] ?? null,
|
||||
'winning_risk' => $this->resource['winning_risk'] ?? null,
|
||||
'required_spring_to_pass' => $this->resource['required_spring_to_pass'] ?? null,
|
||||
'failure_risk' => $this->resource['failure_risk'] ?? null,
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'trophy_awarded' => (bool) ($this->resource['trophy_awarded'] ?? false),
|
||||
'trophy_reason' => $this->resource['trophy_reason'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Scores;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ScoreStudentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'student_id' => (int) ($this->resource['student_id'] ?? 0),
|
||||
'firstname' => $this->resource['firstname'] ?? null,
|
||||
'lastname' => $this->resource['lastname'] ?? null,
|
||||
'school_id' => $this->resource['school_id'] ?? null,
|
||||
'scores' => $this->resource['scores'] ?? [],
|
||||
'comments' => $this->resource['comments'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Semesters;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class SemesterRangeResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'start_date' => $this->resource['start_date'] ?? null,
|
||||
'end_date' => $this->resource['end_date'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Semesters;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class SemesterResolveResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'date' => $this->resource['date'] ?? null,
|
||||
'semester' => $this->resource['semester'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Users;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class LoginActivityResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'user_id' => $this->resource['user_id'] ?? null,
|
||||
'email' => $this->resource['email'] ?? null,
|
||||
'login_time' => $this->resource['login_time'] ?? null,
|
||||
'logout_time' => $this->resource['logout_time'] ?? null,
|
||||
'ip_address' => $this->resource['ip_address'] ?? null,
|
||||
'user_agent' => $this->resource['user_agent'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Users;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class UserWithRolesResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'user' => $this->resource['user'] ?? null,
|
||||
'roles' => $this->resource['roles'] ?? [],
|
||||
'role_ids' => $this->resource['role_ids'] ?? [],
|
||||
'parent_type' => $this->resource['parent_type'] ?? '',
|
||||
'second_from_parents' => $this->resource['second_from_parents'] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user