import { ReactSelectProps } from '@/types';
import { Select } from './Select';

const OPTION_JURNAL_AKUN = [
    { label: '1 : DEBET', value: 'D' },
    { label: '2 : KREDIT', value: 'K' },
];

export const SelectJurnal = (props: ReactSelectProps) => {
    const value = OPTION_JURNAL_AKUN.find((item) => item.value === props.value) ?? '';

    return (
        <Select
            value={value}
            defaultValue={value}
            options={OPTION_JURNAL_AKUN}
            isDisabled={props.disable}
            placeholder="Pilih Jurnal"
            onChange={(newValue: unknown) => {
                const option = newValue as { label: string; value: string };
                props.onChange?.(option?.value);
            }}
        />
    );
};
