diff --git a/src/components/pages/production/recording/RecordingTable.tsx b/src/components/pages/production/recording/RecordingTable.tsx index 6ca8bb89..a83c8d38 100644 --- a/src/components/pages/production/recording/RecordingTable.tsx +++ b/src/components/pages/production/recording/RecordingTable.tsx @@ -107,6 +107,13 @@ const RowOptionsMenu = ({ }; const isRecordingEditable = (recording: Recording) => { + const isGrowingCategory = + recording.project_flock?.project_flock_category === 'GROWING'; + const isGrowingLockedByLaying = isGrowingCategory && recording.is_laying; + if (isGrowingLockedByLaying) { + return false; + } + const currentIsLaying = recording.project_flock?.project_flock_category === 'LAYING'; @@ -123,6 +130,20 @@ const RowOptionsMenu = ({ }; const getRecordingRestrictionInfo = (recording: Recording) => { + const isGrowingCategory = + recording.project_flock?.project_flock_category === 'GROWING'; + const isGrowingLockedByLaying = isGrowingCategory && recording.is_laying; + if (isGrowingLockedByLaying) { + return { + canEditStock: false, + canEditDepletion: false, + canEditEgg: false, + isLocked: true, + lockReason: + 'Recording Growing tidak dapat diubah karena sudah masuk fase laying dan dipakai pada recording laying', + }; + } + const currentIsLaying = recording.project_flock?.project_flock_category === 'LAYING'; @@ -800,10 +821,11 @@ const RecordingTable = () => { { header: 'Kategori', cell: (props) => { - const isLaying = props.row.original.is_laying; const isTransition = props.row.original.is_transition; - const category = isLaying ? 'LAYING' : 'GROWING'; - const color = isLaying ? 'info' : 'warning'; + const category = + props.row.original.project_flock?.project_flock_category || + 'GROWING'; + const color = category === 'LAYING' ? 'info' : 'warning'; return (
+ {(() => {
+ const category =
+ initialValues.project_flock?.project_flock_category ||
+ 'GROWING';
+ const color =
+ category === 'LAYING' ? 'info' : 'warning';
+ return (