mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore: rename ExpenseForm.schema.ts to ExpenseRequestForm.schema.ts
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import * as Yup from 'yup';
|
||||
|
||||
type ExpenseFormSchemaType = {
|
||||
name: string;
|
||||
location?: {
|
||||
value: number;
|
||||
label: string;
|
||||
};
|
||||
transaction_date?: string;
|
||||
kandangs?: number[];
|
||||
vendor?: {
|
||||
value: number;
|
||||
label: string;
|
||||
};
|
||||
requestDocuments?: File[];
|
||||
// kandangExpenses: {
|
||||
// nonstock?: {
|
||||
// value: number;
|
||||
// label: string;
|
||||
// };
|
||||
// }[];
|
||||
};
|
||||
|
||||
export const ExpenseRequestFormSchema: Yup.ObjectSchema<ExpenseFormSchemaType> =
|
||||
Yup.object({
|
||||
name: Yup.string().required('Nama wajib diisi!'),
|
||||
|
||||
location: Yup.object({
|
||||
value: Yup.number().min(1).required(),
|
||||
label: Yup.string().required(),
|
||||
}).required('Lokasi wajib diisi!'),
|
||||
|
||||
transaction_date: Yup.string().required('Tanggal transaksi wajib diisi!'),
|
||||
kandangs: Yup.array().of(Yup.number().required('Kandang wajib dipilih!')),
|
||||
|
||||
vendor: Yup.object({
|
||||
value: Yup.number().min(1).required(),
|
||||
label: Yup.string().required(),
|
||||
}).required('Vendor wajib diisi!'),
|
||||
|
||||
requestDocuments: Yup.array().of(Yup.mixed<File>().required()).optional(),
|
||||
});
|
||||
|
||||
export const UpdateExpenseRequestFormSchema = ExpenseRequestFormSchema;
|
||||
|
||||
export type ExpenseRequestFormValues = Yup.InferType<
|
||||
typeof ExpenseRequestFormSchema
|
||||
>;
|
||||
Reference in New Issue
Block a user