mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
refactor(FE): Use initialValues total_chick_qty for edit/detail
This commit is contained in:
@@ -729,17 +729,8 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
return projectFlockKandangLookup.available_quantity || null;
|
return projectFlockKandangLookup.available_quantity || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type === 'edit' || type === 'detail') && projectFlockKandangDetail) {
|
if ((type === 'edit' || type === 'detail') && initialValues) {
|
||||||
if (
|
return initialValues.project_flock?.total_chick_qty || null;
|
||||||
projectFlockKandangDetail.available_qtys &&
|
|
||||||
projectFlockKandangDetail.available_qtys.length > 0
|
|
||||||
) {
|
|
||||||
return projectFlockKandangDetail.available_qtys.reduce(
|
|
||||||
(sum, item) => sum + (item.available_qty || 0),
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isResponseSuccess(existingRecordings) || !selectedKandang) {
|
if (!isResponseSuccess(existingRecordings) || !selectedKandang) {
|
||||||
@@ -765,6 +756,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
return recording?.project_flock.total_chick_qty || null;
|
return recording?.project_flock.total_chick_qty || null;
|
||||||
}, [
|
}, [
|
||||||
type,
|
type,
|
||||||
|
initialValues,
|
||||||
existingRecordings,
|
existingRecordings,
|
||||||
selectedKandang,
|
selectedKandang,
|
||||||
projectFlockKandangLookup,
|
projectFlockKandangLookup,
|
||||||
|
|||||||
Reference in New Issue
Block a user