add refund and event logic
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Events;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class EventChargeIndexRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'school_year' => ['nullable', 'string', 'max:20'],
|
||||
'semester' => ['nullable', 'string', 'max:20'],
|
||||
'parent_id' => ['nullable', 'integer', 'min:1'],
|
||||
'event_id' => ['nullable', 'integer', 'min:1'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Events;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class EventChargeUpdateRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => ['required', 'integer', 'min:1'],
|
||||
'school_year' => ['required', 'string', 'max:20'],
|
||||
'semester' => ['required', 'string', 'max:20'],
|
||||
'participation' => ['required', 'array'],
|
||||
'participation.*' => ['required', 'string', 'in:yes,no'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Events;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class EventIndexRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'school_year' => ['nullable', 'string', 'max:20'],
|
||||
'semester' => ['nullable', 'string', 'max:20'],
|
||||
'q' => ['nullable', 'string', 'max:200'],
|
||||
'active' => ['nullable', 'boolean'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
|
||||
'sort_by' => ['nullable', 'string', 'in:created_at,expiration_date,event_name'],
|
||||
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Events;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use App\Services\Events\EventCategoryService;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class EventStoreRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'event_name' => ['required', 'string', 'max:150'],
|
||||
'event_category' => ['required', 'string', Rule::in(EventCategoryService::categories())],
|
||||
'description' => ['nullable', 'string', 'max:2000'],
|
||||
'amount' => ['required', 'numeric', 'min:0'],
|
||||
'flyer' => ['nullable', 'file', 'mimes:pdf,jpg,jpeg,png'],
|
||||
'expiration_date' => ['required', 'date'],
|
||||
'semester' => ['required', 'string', 'max:20'],
|
||||
'school_year' => ['required', 'string', 'max:20'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Events;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class EventStudentsWithChargesRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => ['required', 'integer', 'min:1'],
|
||||
'school_year' => ['required', 'string', 'max:20'],
|
||||
'semester' => ['required', 'string', 'max:20'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Events;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use App\Services\Events\EventCategoryService;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class EventUpdateRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'event_name' => ['sometimes', 'required', 'string', 'max:150'],
|
||||
'event_category' => ['sometimes', 'required', 'string', Rule::in(EventCategoryService::categories())],
|
||||
'description' => ['nullable', 'string', 'max:2000'],
|
||||
'amount' => ['sometimes', 'required', 'numeric', 'min:0'],
|
||||
'flyer' => ['nullable', 'file', 'mimes:pdf,jpg,jpeg,png'],
|
||||
'expiration_date' => ['sometimes', 'required', 'date'],
|
||||
'semester' => ['sometimes', 'required', 'string', 'max:20'],
|
||||
'school_year' => ['sometimes', 'required', 'string', 'max:20'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Finance;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class FeeRefundRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => ['required', 'integer', 'min:1'],
|
||||
'students' => ['required', 'array'],
|
||||
'students.*.student_id' => ['nullable', 'integer'],
|
||||
'students.*.class_section_id' => ['required', 'integer', 'min:1'],
|
||||
'students.*.enrollment_status' => ['required', 'string', 'max:50'],
|
||||
'students.*.admission_status' => ['required', 'string', 'max:50'],
|
||||
'students.*.withdrawal_date' => ['nullable', 'date'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Finance;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class FeeTuitionTotalRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'students' => ['required', 'array'],
|
||||
'students.*.class_section_id' => ['required', 'integer', 'min:1'],
|
||||
'students.*.grade' => ['nullable', 'string', 'max:20'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Refunds;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use App\Models\Refund;
|
||||
|
||||
class RefundDecisionRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'status' => ['required', 'string', 'in:' . implode(',', [
|
||||
Refund::STATUS_APPROVED,
|
||||
Refund::STATUS_REJECTED,
|
||||
])],
|
||||
'reason' => ['required', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Refunds;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use App\Models\Refund;
|
||||
|
||||
class RefundIndexRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'status' => ['nullable', 'string', 'in:' . implode(',', [
|
||||
Refund::STATUS_PENDING,
|
||||
Refund::STATUS_APPROVED,
|
||||
Refund::STATUS_PARTIAL,
|
||||
Refund::STATUS_PAID,
|
||||
Refund::STATUS_REJECTED,
|
||||
Refund::STATUS_CANCELED,
|
||||
])],
|
||||
'request' => ['nullable', 'string', 'in:tuition,overpayment,duplicate,extra'],
|
||||
'parent_id' => ['nullable', 'integer', 'min:1'],
|
||||
'invoice_id' => ['nullable', 'integer', 'min:1'],
|
||||
'school_year' => ['nullable', 'string', 'max:20'],
|
||||
'semester' => ['nullable', 'string', 'max:20'],
|
||||
'q' => ['nullable', 'string', 'max:200'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
|
||||
'sort_by' => ['nullable', 'string', 'in:created_at,updated_at,refund_amount,status,parent_id,invoice_id'],
|
||||
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Refunds;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class RefundPaymentRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'paid_amount' => ['required', 'numeric', 'min:0.01'],
|
||||
'payment_method' => ['required', 'string', 'max:50', 'in:Check,Online,Cash'],
|
||||
'check_number' => ['nullable', 'string', 'max:80'],
|
||||
'check_file' => ['nullable', 'file', 'mimes:pdf,jpg,jpeg,png'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Refunds;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class RefundRecalculateRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'invoice_number' => ['nullable', 'string', 'max:100'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Refunds;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class RefundRejectRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'reason' => ['required', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Refunds;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class RefundStoreRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => ['required', 'integer', 'min:1'],
|
||||
'request_type' => ['required', 'string', 'in:tuition,overpayment,duplicate,extra'],
|
||||
'amount' => ['required_unless:request_type,tuition', 'numeric', 'min:0.01'],
|
||||
'invoice_id' => ['nullable', 'integer', 'min:1'],
|
||||
'payment_id' => ['nullable', 'integer', 'min:1'],
|
||||
'reason' => ['nullable', 'string', 'max:2000'],
|
||||
'school_year' => ['nullable', 'string', 'max:20'],
|
||||
'semester' => ['nullable', 'string', 'max:20'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user