add controllers, servoices
This commit is contained in:
@@ -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),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user