mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 23:05:46 +00:00
28 lines
918 B
TypeScript
28 lines
918 B
TypeScript
import { OptionType } from '@/components/input/SelectInput';
|
|
import * as Yup from 'yup';
|
|
|
|
// Type for form values (includes option objects for SelectInput)
|
|
export type InjectionFormValues = {
|
|
bank_id_option: OptionType | null;
|
|
adjustment_date: string;
|
|
injection_type?: OptionType | null | undefined;
|
|
nominal: string;
|
|
note: string;
|
|
};
|
|
|
|
export const InjectionFormSchema = Yup.object<InjectionFormValues>({
|
|
bank_id_option: Yup.mixed()
|
|
.nullable()
|
|
.test(
|
|
'is-valid-option',
|
|
'Bank wajib diisi',
|
|
(value) => value !== null && value !== undefined
|
|
),
|
|
adjustment_date: Yup.string().required('Tanggal penyesuaian wajib diisi'),
|
|
injection_type: Yup.mixed().nullable().required('Tipe injeksi wajib diisi'),
|
|
nominal: Yup.string().required('Nominal wajib diisi'),
|
|
note: Yup.string().required('Catatan wajib diisi'),
|
|
});
|
|
|
|
export const UpdateInjectionFormSchema = InjectionFormSchema;
|