mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat(FE): adding column standard fcr in master data standar production
This commit is contained in:
+2
@@ -18,6 +18,7 @@ const LayingRepeaterFormSchema = Yup.object({
|
||||
),
|
||||
target_egg_weight: Yup.number().required('Berat telur wajib diisi!'),
|
||||
target_egg_mass: Yup.number().required('Massa telur wajib diisi!'),
|
||||
standard_fcr: Yup.number().required('FCR wajib diisi!'),
|
||||
}).required(),
|
||||
});
|
||||
|
||||
@@ -35,6 +36,7 @@ const GrowingRepeaterFormSchema = Yup.object({
|
||||
target_hen_house_production: Yup.number().optional(),
|
||||
target_egg_weight: Yup.number().optional(),
|
||||
target_egg_mass: Yup.number().optional(),
|
||||
standard_fcr: Yup.number().optional(),
|
||||
}).optional(),
|
||||
});
|
||||
|
||||
|
||||
+66
-1
@@ -30,6 +30,7 @@ import ConfirmationModal from '@/components/modal/ConfirmationModal';
|
||||
import { useModal } from '@/components/Modal';
|
||||
import RequirePermission from '@/components/helper/RequirePermission';
|
||||
import Tooltip from '@/components/Tooltip';
|
||||
import Alert from '@/components/Alert';
|
||||
|
||||
type TableRowsType = {
|
||||
customRow: boolean;
|
||||
@@ -42,6 +43,7 @@ type ProductionDetailsErrors = {
|
||||
target_hen_house_production?: string;
|
||||
target_egg_weight?: string;
|
||||
target_egg_mass?: string;
|
||||
standard_fcr?: string;
|
||||
};
|
||||
|
||||
type ProductionDetailsTouched = {
|
||||
@@ -49,6 +51,7 @@ type ProductionDetailsTouched = {
|
||||
target_hen_house_production?: boolean;
|
||||
target_egg_weight?: boolean;
|
||||
target_egg_mass?: boolean;
|
||||
standard_fcr?: boolean;
|
||||
};
|
||||
|
||||
const getProductionDetailsError = (
|
||||
@@ -92,6 +95,9 @@ const convertPayloadToNumberTypes = (payload: ProductionStandardFormValues) => {
|
||||
target_egg_mass: Number(
|
||||
detail.production_standard_details.target_egg_mass
|
||||
),
|
||||
standard_fcr: Number(
|
||||
detail.production_standard_details.standard_fcr
|
||||
),
|
||||
}
|
||||
: undefined,
|
||||
production_standard_uniformity_details: {
|
||||
@@ -132,6 +138,9 @@ const convertStandardValueToFormValues = (
|
||||
target_egg_mass: Number(
|
||||
detail.egg_production_standard_detail.target_egg_mass
|
||||
),
|
||||
standard_fcr: Number(
|
||||
detail.egg_production_standard_detail.standard_fcr
|
||||
),
|
||||
}
|
||||
: undefined,
|
||||
production_standard_uniformity_details: {
|
||||
@@ -226,6 +235,7 @@ const ProductionStandardForm = ({
|
||||
target_hen_house_production: '' as unknown as number,
|
||||
target_egg_weight: '' as unknown as number,
|
||||
target_egg_mass: '' as unknown as number,
|
||||
standard_fcr: '' as unknown as number,
|
||||
},
|
||||
production_standard_uniformity_details: {
|
||||
target_mean_bw: '' as unknown as number,
|
||||
@@ -364,6 +374,12 @@ const ProductionStandardForm = ({
|
||||
row.production_standard_details?.target_egg_mass,
|
||||
enableSorting: false,
|
||||
},
|
||||
{
|
||||
header: 'FCR',
|
||||
accessorFn: (row) =>
|
||||
row.production_standard_details?.standard_fcr,
|
||||
enableSorting: false,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
|
||||
@@ -676,6 +692,7 @@ const ProductionStandardForm = ({
|
||||
target_hen_house_production: 0,
|
||||
target_egg_weight: 0,
|
||||
target_egg_mass: 0,
|
||||
standard_fcr: 0,
|
||||
},
|
||||
}));
|
||||
}
|
||||
@@ -809,7 +826,7 @@ const ProductionStandardForm = ({
|
||||
className={cn(
|
||||
'grid gap-4 items-start',
|
||||
formik.values.project_category === 'LAYING'
|
||||
? 'grid-cols-9'
|
||||
? 'grid-cols-10'
|
||||
: 'grid-cols-5'
|
||||
)}
|
||||
>
|
||||
@@ -968,6 +985,41 @@ const ProductionStandardForm = ({
|
||||
)
|
||||
}
|
||||
/>
|
||||
<NumberInput
|
||||
name='production_standard_details.standard_fcr'
|
||||
label='FCR'
|
||||
placeholder='1'
|
||||
value={
|
||||
repeaterFormik.values
|
||||
.production_standard_details?.standard_fcr
|
||||
}
|
||||
onChange={repeaterFormik.handleChange}
|
||||
onBlur={repeaterFormik.handleBlur}
|
||||
endAdornment={
|
||||
<div className='w-full h-full flex items-center justify-center'>
|
||||
gr
|
||||
</div>
|
||||
}
|
||||
errorMessage={getProductionDetailsError(
|
||||
repeaterFormik.errors
|
||||
.production_standard_details,
|
||||
'standard_fcr'
|
||||
)}
|
||||
isError={
|
||||
Boolean(
|
||||
getProductionDetailsError(
|
||||
repeaterFormik.errors
|
||||
.production_standard_details,
|
||||
'standard_fcr'
|
||||
)
|
||||
) &&
|
||||
getProductionDetailsTouched(
|
||||
repeaterFormik.touched
|
||||
.production_standard_details,
|
||||
'standard_fcr'
|
||||
)
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<NumberInput
|
||||
@@ -1241,6 +1293,19 @@ const ProductionStandardForm = ({
|
||||
</div>
|
||||
)}
|
||||
</form>
|
||||
{productionStandardFormErrorMessage && (
|
||||
<Alert color='error' className='w-full'>
|
||||
<div className='flex items-center gap-2 stretch'>
|
||||
<Icon icon='mdi:alert' />
|
||||
<span>{productionStandardFormErrorMessage}</span>
|
||||
</div>
|
||||
<Icon
|
||||
icon='mdi:close'
|
||||
onClick={() => setProductionStandardFormErrorMessage('')}
|
||||
className='ms-auto'
|
||||
/>
|
||||
</Alert>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ConfirmationModal
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface ProductionStandardDetails {
|
||||
target_hen_house_production: number;
|
||||
target_egg_weight: number;
|
||||
target_egg_mass: number;
|
||||
standard_fcr: number;
|
||||
}
|
||||
|
||||
export interface StandardGrowthDetails {
|
||||
@@ -46,6 +47,7 @@ export interface CreateProductionStandardPayload {
|
||||
target_hen_house_production: number;
|
||||
target_egg_weight: number;
|
||||
target_egg_mass: number;
|
||||
standard_fcr: number;
|
||||
};
|
||||
}[];
|
||||
}
|
||||
@@ -66,6 +68,7 @@ export interface UpdateProductionStandardPayload {
|
||||
target_hen_house_production: number;
|
||||
target_egg_weight: number;
|
||||
target_egg_mass: number;
|
||||
standard_fcr: number;
|
||||
};
|
||||
}[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user