mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-174): rename project_flock_kandangs_id to project_flock_kandang_id for consistency in RecordingForm schema
This commit is contained in:
@@ -12,7 +12,7 @@ type RecordingGrowingFormSchemaType = {
|
||||
value: number;
|
||||
label: string;
|
||||
} | null;
|
||||
project_flock_kandangs_id: number;
|
||||
project_flock_kandang_id: number;
|
||||
body_weights: {
|
||||
weight: number | string;
|
||||
avg_weight: number | string;
|
||||
@@ -118,7 +118,7 @@ export const RecordingGrowingFormSchema: Yup.ObjectSchema<RecordingGrowingFormSc
|
||||
value: Yup.number().min(1).required(),
|
||||
label: Yup.string().required(),
|
||||
}).nullable(),
|
||||
project_flock_kandangs_id: Yup.number()
|
||||
project_flock_kandang_id: Yup.number()
|
||||
.default(0)
|
||||
.typeError('Project Flock Kandang wajib diisi!')
|
||||
.test(
|
||||
@@ -168,7 +168,7 @@ export const RecordingLayingFormSchema: Yup.ObjectSchema<RecordingLayingFormSche
|
||||
|
||||
export const UpdateRecordingGrowingFormSchema =
|
||||
RecordingGrowingFormSchema.shape({
|
||||
project_flock_kandangs_id: Yup.number()
|
||||
project_flock_kandang_id: Yup.number()
|
||||
.default(0)
|
||||
.typeError('Project Flock Kandang wajib diisi!')
|
||||
.test(
|
||||
@@ -180,7 +180,7 @@ export const UpdateRecordingGrowingFormSchema =
|
||||
});
|
||||
|
||||
export const UpdateRecordingLayingFormSchema = RecordingLayingFormSchema.shape({
|
||||
project_flock_kandangs_id: Yup.number()
|
||||
project_flock_kandang_id: Yup.number()
|
||||
.default(0)
|
||||
.typeError('Project Flock Kandang wajib diisi!')
|
||||
.test(
|
||||
@@ -237,13 +237,13 @@ type RecordingFormData = Partial<Recording> & {
|
||||
export const getRecordingGrowingFormInitialValues = (
|
||||
initialValues?: RecordingFormData
|
||||
): RecordingGrowingFormValues => ({
|
||||
project_flock_kandang: initialValues?.project_flock_kandangs_id
|
||||
project_flock_kandang: initialValues?.project_flock_kandang_id
|
||||
? {
|
||||
value: initialValues.project_flock_kandangs_id,
|
||||
label: `Project Flock #${initialValues.project_flock_kandangs_id}`,
|
||||
value: initialValues.project_flock_kandang_id,
|
||||
label: `Project Flock #${initialValues.project_flock_kandang_id}`,
|
||||
}
|
||||
: null,
|
||||
project_flock_kandangs_id: initialValues?.project_flock_kandangs_id ?? 0,
|
||||
project_flock_kandang_id: initialValues?.project_flock_kandang_id ?? 0,
|
||||
body_weights: initialValues?.body_weights?.map(
|
||||
(bw: NonNullable<CreateGrowingRecordingPayload['body_weights']>[0]) => ({
|
||||
weight: bw.avg_weight * bw.qty,
|
||||
|
||||
Reference in New Issue
Block a user