mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
feat(FE-33): create customers forms
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import * as Yup from 'yup';
|
||||
|
||||
export const CustomerFormSchema = Yup.object({
|
||||
name: Yup.string()
|
||||
.required('Nama wajib diisi!'),
|
||||
|
||||
picId: Yup.number()
|
||||
.min(1, 'PIC wajib diisi!')
|
||||
.required('PIC wajib diisi!'),
|
||||
|
||||
pic: Yup.object({
|
||||
value: Yup.number().min(1).required(),
|
||||
label: Yup.string().required(),
|
||||
}).nullable(),
|
||||
|
||||
type: Yup.string()
|
||||
.oneOf(['INDIVIDUAL', 'BISNIS'], 'Tipe harus INDIVIDUAL atau BISNIS')
|
||||
.required('Tipe wajib diisi!'),
|
||||
|
||||
address: Yup.string()
|
||||
.required('Alamat wajib diisi!'),
|
||||
|
||||
phone: Yup.string()
|
||||
.matches(/^[0-9]+$/, 'Nomor telepon hanya boleh berisi angka!')
|
||||
.min(10, 'Nomor telepon minimal 10 digit!')
|
||||
.max(12, 'Nomor telepon maksimal 12 digit!')
|
||||
.required('Nomor telepon wajib diisi!'),
|
||||
|
||||
email: Yup.string()
|
||||
.email('Format email tidak valid!')
|
||||
.required('Email wajib diisi!'),
|
||||
|
||||
account_number: Yup.string()
|
||||
.matches(/^[0-9]+$/, 'Nomor rekening hanya boleh berisi angka!')
|
||||
.required('Nomor rekening wajib diisi!'),
|
||||
});
|
||||
|
||||
export const UpdateCustomerFormSchema = CustomerFormSchema;
|
||||
|
||||
export type CustomerFormValues = Yup.InferType<typeof CustomerFormSchema>;
|
||||
Reference in New Issue
Block a user