mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +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;
|
value: number;
|
||||||
label: string;
|
label: string;
|
||||||
} | null;
|
} | null;
|
||||||
project_flock_kandangs_id: number;
|
project_flock_kandang_id: number;
|
||||||
body_weights: {
|
body_weights: {
|
||||||
weight: number | string;
|
weight: number | string;
|
||||||
avg_weight: number | string;
|
avg_weight: number | string;
|
||||||
@@ -118,7 +118,7 @@ export const RecordingGrowingFormSchema: Yup.ObjectSchema<RecordingGrowingFormSc
|
|||||||
value: Yup.number().min(1).required(),
|
value: Yup.number().min(1).required(),
|
||||||
label: Yup.string().required(),
|
label: Yup.string().required(),
|
||||||
}).nullable(),
|
}).nullable(),
|
||||||
project_flock_kandangs_id: Yup.number()
|
project_flock_kandang_id: Yup.number()
|
||||||
.default(0)
|
.default(0)
|
||||||
.typeError('Project Flock Kandang wajib diisi!')
|
.typeError('Project Flock Kandang wajib diisi!')
|
||||||
.test(
|
.test(
|
||||||
@@ -168,7 +168,7 @@ export const RecordingLayingFormSchema: Yup.ObjectSchema<RecordingLayingFormSche
|
|||||||
|
|
||||||
export const UpdateRecordingGrowingFormSchema =
|
export const UpdateRecordingGrowingFormSchema =
|
||||||
RecordingGrowingFormSchema.shape({
|
RecordingGrowingFormSchema.shape({
|
||||||
project_flock_kandangs_id: Yup.number()
|
project_flock_kandang_id: Yup.number()
|
||||||
.default(0)
|
.default(0)
|
||||||
.typeError('Project Flock Kandang wajib diisi!')
|
.typeError('Project Flock Kandang wajib diisi!')
|
||||||
.test(
|
.test(
|
||||||
@@ -180,7 +180,7 @@ export const UpdateRecordingGrowingFormSchema =
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const UpdateRecordingLayingFormSchema = RecordingLayingFormSchema.shape({
|
export const UpdateRecordingLayingFormSchema = RecordingLayingFormSchema.shape({
|
||||||
project_flock_kandangs_id: Yup.number()
|
project_flock_kandang_id: Yup.number()
|
||||||
.default(0)
|
.default(0)
|
||||||
.typeError('Project Flock Kandang wajib diisi!')
|
.typeError('Project Flock Kandang wajib diisi!')
|
||||||
.test(
|
.test(
|
||||||
@@ -237,13 +237,13 @@ type RecordingFormData = Partial<Recording> & {
|
|||||||
export const getRecordingGrowingFormInitialValues = (
|
export const getRecordingGrowingFormInitialValues = (
|
||||||
initialValues?: RecordingFormData
|
initialValues?: RecordingFormData
|
||||||
): RecordingGrowingFormValues => ({
|
): RecordingGrowingFormValues => ({
|
||||||
project_flock_kandang: initialValues?.project_flock_kandangs_id
|
project_flock_kandang: initialValues?.project_flock_kandang_id
|
||||||
? {
|
? {
|
||||||
value: initialValues.project_flock_kandangs_id,
|
value: initialValues.project_flock_kandang_id,
|
||||||
label: `Project Flock #${initialValues.project_flock_kandangs_id}`,
|
label: `Project Flock #${initialValues.project_flock_kandang_id}`,
|
||||||
}
|
}
|
||||||
: null,
|
: 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(
|
body_weights: initialValues?.body_weights?.map(
|
||||||
(bw: NonNullable<CreateGrowingRecordingPayload['body_weights']>[0]) => ({
|
(bw: NonNullable<CreateGrowingRecordingPayload['body_weights']>[0]) => ({
|
||||||
weight: bw.avg_weight * bw.qty,
|
weight: bw.avg_weight * bw.qty,
|
||||||
|
|||||||
Reference in New Issue
Block a user