partial update create kpi and progress bar

This commit is contained in:
2025-07-04 18:27:32 +07:00
parent 0ef03fe7cb
commit fa554446ca
19 changed files with 2150 additions and 45 deletions

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Http\Requests\KPI;
use Illuminate\Foundation\Http\FormRequest;
use Carbon\Carbon;
class StoreKpiTargetRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'user_id' => 'required|exists:users,id',
'target_value' => 'required|integer|min:1',
'description' => 'nullable|string|max:1000',
'is_active' => 'boolean'
];
}
/**
* Get custom messages for validator errors.
*/
public function messages(): array
{
return [
'user_id.required' => 'Mekanik harus dipilih',
'user_id.exists' => 'Mekanik yang dipilih tidak valid',
'target_value.required' => 'Target nilai harus diisi',
'target_value.integer' => 'Target nilai harus berupa angka',
'target_value.min' => 'Target nilai minimal 1',
'description.max' => 'Deskripsi maksimal 1000 karakter',
];
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$this->merge([
'is_active' => $this->boolean('is_active', true)
]);
}
}