Refactor PayrollAdjustmentModal to replace Select component with RadioGroup for type selection, enhancing user experience and streamlining form handling. Update imports and adjust layout for improved accessibility and clarity.

This commit is contained in:
Yoga Pangestu 2026-06-12 16:53:08 +07:00
parent dc335d4dab
commit 20378433d8

View File

@ -18,14 +18,9 @@ import {
FieldLabel, FieldLabel,
FieldSet, FieldSet,
} from '@/components/ui/field'; } from '@/components/ui/field';
import { Label } from '@/components/ui/label';
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
import { RupiahInput } from '@/components/ui/rupiah-input'; import { RupiahInput } from '@/components/ui/rupiah-input';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
import { Textarea } from '@/components/ui/textarea'; import { Textarea } from '@/components/ui/textarea';
import { parseRupiah } from '@/lib/rupiah'; import { parseRupiah } from '@/lib/rupiah';
import type { PayrollAdjustmentFormData, PayrollListItem, SelectOption } from '@/types/payroll'; import type { PayrollAdjustmentFormData, PayrollListItem, SelectOption } from '@/types/payroll';
@ -91,18 +86,16 @@ function submit() {
</Field> </Field>
<Field> <Field>
<FieldLabel for="type">Jenis</FieldLabel> <FieldLabel>Jenis</FieldLabel>
<Select v-model="form.type"> <RadioGroup v-model="form.type" class="flex flex-wrap gap-4 pt-1">
<SelectTrigger id="type"> <div v-for="option in adjustmentTypes" :key="option.value"
<SelectValue placeholder="Pilih jenis" /> class="flex items-center gap-2">
</SelectTrigger> <RadioGroupItem :id="`type-${option.value}`" :value="option.value" />
<SelectContent> <Label :for="`type-${option.value}`" class="font-normal">
<SelectItem v-for="option in adjustmentTypes" :key="option.value"
:value="option.value">
{{ option.label }} {{ option.label }}
</SelectItem> </Label>
</SelectContent> </div>
</Select> </RadioGroup>
<FieldError :message="form.errors.type" /> <FieldError :message="form.errors.type" />
</Field> </Field>