fixing disable field detail

This commit is contained in:
ragilap
2026-03-10 17:34:52 +07:00
parent 5540787154
commit 1621f2ab7d
2 changed files with 9 additions and 22 deletions
@@ -173,15 +173,7 @@ const RowOptionsMenu = ({
anchorName={popoverAnchorName} anchorName={popoverAnchorName}
className={restrictionInfo.isLocked ? 'text-error' : ''} className={restrictionInfo.isLocked ? 'text-error' : ''}
> >
<Icon <Icon icon='material-symbols:more-vert' width={16} height={16} />
icon={
restrictionInfo.isLocked
? 'material-symbols:lock-outline'
: 'material-symbols:more-vert'
}
width={16}
height={16}
/>
</PopoverButton> </PopoverButton>
</Tooltip> </Tooltip>
@@ -218,7 +210,7 @@ const RowOptionsMenu = ({
</Button> </Button>
</RequirePermission> </RequirePermission>
)} )}
{!isApproved && !isRejected && ( {!restrictionInfo.isLocked && !isApproved && !isRejected && (
<RequirePermission permissions='lti.production.recording.approve'> <RequirePermission permissions='lti.production.recording.approve'>
<Button <Button
onClick={() => { onClick={() => {
@@ -234,7 +226,7 @@ const RowOptionsMenu = ({
</Button> </Button>
</RequirePermission> </RequirePermission>
)} )}
{!isApproved && !isRejected && ( {!restrictionInfo.isLocked && !isApproved && !isRejected && (
<RequirePermission permissions='lti.production.recording.approve'> <RequirePermission permissions='lti.production.recording.approve'>
<Button <Button
onClick={() => { onClick={() => {
@@ -513,14 +513,12 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
}, [initialValues, projectFlockKandangLookup]); }, [initialValues, projectFlockKandangLookup]);
const recordingRestriction = useMemo(() => { const recordingRestriction = useMemo(() => {
// Determine isLaying - check both is_laying flag AND category // Determine isLaying primarily from transition flags.
let isLaying: boolean; let isLaying: boolean;
if (initialValues?.is_laying !== undefined) { if (initialValues?.is_laying !== undefined) {
isLaying = initialValues.is_laying; isLaying = initialValues.is_laying;
} else if (projectFlockKandangLookup) { } else if (projectFlockKandangLookup?.is_laying !== undefined) {
isLaying = isLaying = projectFlockKandangLookup.is_laying;
projectFlockKandangLookup.is_laying ||
projectFlockKandangLookup.project_flock?.category === 'LAYING';
} else { } else {
isLaying = isLaying =
projectFlockKandangDetail?.project_flock?.category === 'LAYING' || projectFlockKandangDetail?.project_flock?.category === 'LAYING' ||
@@ -684,12 +682,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
return initialValues.is_laying; return initialValues.is_laying;
} }
// Priority 2: projectFlockKandangLookup (for add mode with lookup) // Priority 2: projectFlockKandangLookup flag (for add mode)
if (projectFlockKandangLookup) { if (projectFlockKandangLookup?.is_laying !== undefined) {
return ( return projectFlockKandangLookup.is_laying;
projectFlockKandangLookup.is_laying ||
projectFlockKandangLookup.project_flock?.category === 'LAYING'
);
} }
// Priority 3: projectFlockKandangDetail (fallback for edit/detail mode) // Priority 3: projectFlockKandangDetail (fallback for edit/detail mode)