feat: add base salary default value to employee edit form
This commit is contained in:
parent
16487dadf5
commit
78c432eaa0
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Admin\HR;
|
namespace App\Http\Requests\Admin\HR;
|
||||||
|
|
||||||
|
use App\Concerns\CurrencyStripping;
|
||||||
use App\Enums\EmploymentStatus;
|
use App\Enums\EmploymentStatus;
|
||||||
use App\Enums\Gender;
|
use App\Enums\Gender;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
@ -9,12 +10,19 @@
|
|||||||
|
|
||||||
class EmployeeRequest extends FormRequest
|
class EmployeeRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
use CurrencyStripping;
|
||||||
|
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return $this->user()->can('employees.create')
|
return $this->user()->can('employees.create')
|
||||||
|| $this->user()->can('employees.update');
|
|| $this->user()->can('employees.update');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function prepareForValidation(): void
|
||||||
|
{
|
||||||
|
$this->merge($this->stripCurrencyDot($this->all(), 'base_salary'));
|
||||||
|
}
|
||||||
|
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$userId = $this->route('user')?->id;
|
$userId = $this->route('user')?->id;
|
||||||
|
|||||||
@ -401,6 +401,10 @@ export default function EmployeeEdit({ employee, roles, canViewAll }: Props) {
|
|||||||
</Label>
|
</Label>
|
||||||
<RupiahInput
|
<RupiahInput
|
||||||
name="base_salary"
|
name="base_salary"
|
||||||
|
defaultValue={
|
||||||
|
employee.employee
|
||||||
|
?.base_salary ?? 0
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<InputError
|
<InputError
|
||||||
message={
|
message={
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user