first
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class AssignApplicationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'saluran_mengundi_id' => blank($this->input('saluran_mengundi_id')) ? null : $this->input('saluran_mengundi_id'),
|
||||
'reports_to_assignment_id' => blank($this->input('reports_to_assignment_id')) ? null : $this->input('reports_to_assignment_id'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position_id' => ['required', 'integer', 'exists:positions,id'],
|
||||
'pusat_mengundi_id' => ['required', 'integer', 'exists:pusat_mengundis,id'],
|
||||
'saluran_mengundi_id' => ['nullable', 'integer', 'exists:saluran_mengundis,id'],
|
||||
'reports_to_assignment_id' => ['nullable', 'integer', 'exists:staff_assignments,id'],
|
||||
'status' => ['nullable', Rule::in(['active', 'inactive', 'replaced', 'cancelled'])],
|
||||
'note' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DeleteRepresentativeRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'note' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreManualApplicationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'ic_number' => preg_replace('/\D+/', '', (string) $this->input('ic_number')),
|
||||
'phone_number' => trim((string) $this->input('phone_number')),
|
||||
'email' => blank($this->input('email')) ? null : strtolower(trim((string) $this->input('email'))),
|
||||
'selected_ktm_assignment_id' => blank($this->input('selected_ktm_assignment_id')) ? null : $this->input('selected_ktm_assignment_id'),
|
||||
'bank_name' => blank($this->input('bank_name')) ? null : trim((string) $this->input('bank_name')),
|
||||
'bank_account_number' => blank($this->input('bank_account_number')) ? null : preg_replace('/\D+/', '', (string) $this->input('bank_account_number')),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'election_id' => ['required', 'integer', 'exists:elections,id'],
|
||||
'pusat_mengundi_id' => ['required', 'integer', 'exists:pusat_mengundis,id'],
|
||||
'selected_ktm_assignment_id' => ['nullable', 'integer', 'exists:staff_assignments,id'],
|
||||
'requested_position_id' => ['required', 'integer', 'exists:positions,id'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'ic_number' => ['required', 'digits:12'],
|
||||
'phone_number' => ['required', 'string', 'max:30'],
|
||||
'email' => ['nullable', 'email', 'max:255'],
|
||||
'address' => ['nullable', 'string', 'max:2000'],
|
||||
'bank_name' => ['nullable', 'string', 'max:255'],
|
||||
'bank_account_number' => ['nullable', 'string', 'max:50'],
|
||||
'note' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreRepresentativeRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'ic_number' => blank($this->input('ic_number')) ? null : preg_replace('/\D+/', '', (string) $this->input('ic_number')),
|
||||
'saluran_mengundi_id' => blank($this->input('saluran_mengundi_id')) ? null : $this->input('saluran_mengundi_id'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'type' => ['required', Rule::in(['police', 'kkm', 'jkm'])],
|
||||
'election_id' => ['required', 'integer', 'exists:elections,id'],
|
||||
'pusat_mengundi_id' => ['required', 'integer', 'exists:pusat_mengundis,id'],
|
||||
'saluran_mengundi_id' => ['nullable', 'integer', 'exists:saluran_mengundis,id'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'ic_number' => ['nullable', 'digits:12'],
|
||||
'phone_number' => ['nullable', 'string', 'max:30'],
|
||||
'rank' => ['nullable', 'string', 'max:255'],
|
||||
'station' => ['nullable', 'string', 'max:255'],
|
||||
'agency' => ['nullable', 'string', 'max:255'],
|
||||
'notes' => ['nullable', 'string', 'max:2000'],
|
||||
'note' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreReturnTransactionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'quantity' => ['required', 'integer', 'min:1', 'max:9999'],
|
||||
'returned_at' => ['nullable', 'date'],
|
||||
'returned_by_name' => ['required', 'string', 'max:255'],
|
||||
'return_condition' => ['required', Rule::in(['baik', 'rosak'])],
|
||||
'notes' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreTakenTransactionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'quantity' => ['required', 'integer', 'min:1', 'max:9999'],
|
||||
'taken_at' => ['nullable', 'date'],
|
||||
'taken_by_name' => ['required', 'string', 'max:255'],
|
||||
'notes' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreWheelchairTransactionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'transaction_type' => ['required', Rule::in(['taken', 'returned'])],
|
||||
'quantity' => ['required', 'integer', 'min:1', 'max:9999'],
|
||||
'taken_at' => ['nullable', 'date'],
|
||||
'taken_by_name' => ['nullable', 'string', 'max:255', 'required_if:transaction_type,taken'],
|
||||
'returned_at' => ['nullable', 'date'],
|
||||
'return_condition' => ['nullable', Rule::in(['baik', 'rosak']), 'required_if:transaction_type,returned'],
|
||||
'notes' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateManagedApplicationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'ic_number' => preg_replace('/\D+/', '', (string) $this->input('ic_number')),
|
||||
'phone_number' => trim((string) $this->input('phone_number')),
|
||||
'email' => blank($this->input('email')) ? null : strtolower(trim((string) $this->input('email'))),
|
||||
'selected_ktm_assignment_id' => blank($this->input('selected_ktm_assignment_id')) ? null : $this->input('selected_ktm_assignment_id'),
|
||||
'approved_position_id' => blank($this->input('approved_position_id')) ? null : $this->input('approved_position_id'),
|
||||
'bank_name' => blank($this->input('bank_name')) ? null : trim((string) $this->input('bank_name')),
|
||||
'bank_account_number' => blank($this->input('bank_account_number')) ? null : preg_replace('/\D+/', '', (string) $this->input('bank_account_number')),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'pusat_mengundi_id' => ['required', 'integer', 'exists:pusat_mengundis,id'],
|
||||
'selected_ktm_assignment_id' => ['nullable', 'integer', 'exists:staff_assignments,id'],
|
||||
'requested_position_id' => ['required', 'integer', 'exists:positions,id'],
|
||||
'approved_position_id' => ['nullable', 'integer', 'exists:positions,id'],
|
||||
'status' => ['required', Rule::in(['draft', 'submitted', 'under_ppm_review', 'approved', 'rejected', 'assigned', 'cancelled'])],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'ic_number' => ['required', 'digits:12'],
|
||||
'phone_number' => ['required', 'string', 'max:30'],
|
||||
'email' => ['nullable', 'email', 'max:255'],
|
||||
'address' => ['nullable', 'string', 'max:2000'],
|
||||
'bank_name' => ['nullable', 'string', 'max:255'],
|
||||
'bank_account_number' => ['nullable', 'string', 'max:50'],
|
||||
'note' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateStaffAssignmentRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'saluran_mengundi_id' => blank($this->input('saluran_mengundi_id')) ? null : $this->input('saluran_mengundi_id'),
|
||||
'reports_to_assignment_id' => blank($this->input('reports_to_assignment_id')) ? null : $this->input('reports_to_assignment_id'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position_id' => ['required', 'integer', 'exists:positions,id'],
|
||||
'pusat_mengundi_id' => ['required', 'integer', 'exists:pusat_mengundis,id'],
|
||||
'saluran_mengundi_id' => ['nullable', 'integer', 'exists:saluran_mengundis,id'],
|
||||
'reports_to_assignment_id' => ['nullable', 'integer', 'exists:staff_assignments,id'],
|
||||
'status' => ['required', Rule::in(['active', 'inactive', 'replaced', 'cancelled'])],
|
||||
'note' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Management;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpsertWheelchairAllocationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'election_id' => ['required', 'integer', 'exists:elections,id'],
|
||||
'pusat_mengundi_id' => ['required', 'integer', 'exists:pusat_mengundis,id'],
|
||||
'allocated_quantity' => ['required', 'integer', 'min:0', 'max:9999'],
|
||||
'notes' => ['nullable', 'string', 'max:2000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user