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}
className={restrictionInfo.isLocked ? 'text-error' : ''}
>
<Icon
icon={
restrictionInfo.isLocked
? 'material-symbols:lock-outline'
: 'material-symbols:more-vert'
}
width={16}
height={16}
/>
<Icon icon='material-symbols:more-vert' width={16} height={16} />
</PopoverButton>
</Tooltip>
@@ -218,7 +210,7 @@ const RowOptionsMenu = ({
</Button>
</RequirePermission>
)}
{!isApproved && !isRejected && (
{!restrictionInfo.isLocked && !isApproved && !isRejected && (
<RequirePermission permissions='lti.production.recording.approve'>
<Button
onClick={() => {
@@ -234,7 +226,7 @@ const RowOptionsMenu = ({
</Button>
</RequirePermission>
)}
{!isApproved && !isRejected && (
{!restrictionInfo.isLocked && !isApproved && !isRejected && (
<RequirePermission permissions='lti.production.recording.approve'>
<Button
onClick={() => {
@@ -513,14 +513,12 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
}, [initialValues, projectFlockKandangLookup]);
const recordingRestriction = useMemo(() => {
// Determine isLaying - check both is_laying flag AND category
// Determine isLaying primarily from transition flags.
let isLaying: boolean;
if (initialValues?.is_laying !== undefined) {
isLaying = initialValues.is_laying;
} else if (projectFlockKandangLookup) {
isLaying =
projectFlockKandangLookup.is_laying ||
projectFlockKandangLookup.project_flock?.category === 'LAYING';
} else if (projectFlockKandangLookup?.is_laying !== undefined) {
isLaying = projectFlockKandangLookup.is_laying;
} else {
isLaying =
projectFlockKandangDetail?.project_flock?.category === 'LAYING' ||
@@ -684,12 +682,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
return initialValues.is_laying;
}
// Priority 2: projectFlockKandangLookup (for add mode with lookup)
if (projectFlockKandangLookup) {
return (
projectFlockKandangLookup.is_laying ||
projectFlockKandangLookup.project_flock?.category === 'LAYING'
);
// Priority 2: projectFlockKandangLookup flag (for add mode)
if (projectFlockKandangLookup?.is_laying !== undefined) {
return projectFlockKandangLookup.is_laying;
}
// Priority 3: projectFlockKandangDetail (fallback for edit/detail mode)