refactor(FE): Update recording editability logic and extend

BaseRecording type
This commit is contained in:
rstubryan
2026-03-09 03:18:41 +07:00
parent 3042b54577
commit d236138aa7
3 changed files with 12 additions and 11 deletions
@@ -105,11 +105,11 @@ const RowOptionsMenu = ({
}; };
const isRecordingEditable = (recording: Recording) => { const isRecordingEditable = (recording: Recording) => {
if ( if (recording.project_flock?.project_flock_category === 'GROWING') {
recording.executed_at && if (recording.transfer_executed) {
recording.project_flock?.project_flock_category === 'GROWING' return false;
) { }
return false; return recording.population_can_change === true;
} }
return true; return true;
}; };
@@ -273,11 +273,11 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
}, []); }, []);
const isRecordingEditable = useCallback((recording?: Recording) => { const isRecordingEditable = useCallback((recording?: Recording) => {
if ( if (recording?.project_flock?.project_flock_category === 'GROWING') {
recording?.executed_at && if (recording?.transfer_executed) {
recording?.project_flock?.project_flock_category === 'GROWING' return false;
) { }
return false; return recording?.population_can_change === true;
} }
return true; return true;
}, []); }, []);
+2 -1
View File
@@ -49,7 +49,8 @@ export type BaseRecording = {
project_flock: ProjectFlock; project_flock: ProjectFlock;
record_datetime: string; record_datetime: string;
day: number; day: number;
executed_at: string; population_can_change: boolean;
transfer_executed: boolean;
} & ProductionMetrics; } & ProductionMetrics;
export type RecordingDepletion = { export type RecordingDepletion = {