- Add EmployeeAdvanceService for handling employee advance operations including create, update, delete, approve, and pay. - Create new components for date picking and calendar UI. - Develop Employee Advance columns for data table representation. - Implement Employee Advance index page with CRUD operations and dialogs for creating, editing, approving, and paying advances. - Update routes to include employee advances resource and specific actions for approval and payment. - Add necessary dependencies for date handling and UI components.
43 lines
929 B
PHP
43 lines
929 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Finance;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Override;
|
|
|
|
class EmployeeAdvanceRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
#[Override]
|
|
public function prepareForValidation()
|
|
{
|
|
if ($this->has('amount')) {
|
|
$this->merge([
|
|
'amount' => str_replace('.', '', $this->amount),
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'amount' => ['required', 'integer', 'min:1'],
|
|
'description' => ['required', 'string', 'max:100'],
|
|
'due_date' => ['required', 'date', 'after_or_equal:today'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'amount' => 'jumlah',
|
|
'description' => 'keterangan',
|
|
'due_date' => 'jatuh tempo',
|
|
];
|
|
}
|
|
}
|