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) => {
if (
recording.executed_at &&
recording.project_flock?.project_flock_category === 'GROWING'
) {
return false;
if (recording.project_flock?.project_flock_category === 'GROWING') {
if (recording.transfer_executed) {
return false;
}
return recording.population_can_change === true;
}
return true;
};
@@ -273,11 +273,11 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
}, []);
const isRecordingEditable = useCallback((recording?: Recording) => {
if (
recording?.executed_at &&
recording?.project_flock?.project_flock_category === 'GROWING'
) {
return false;
if (recording?.project_flock?.project_flock_category === 'GROWING') {
if (recording?.transfer_executed) {
return false;
}
return recording?.population_can_change === true;
}
return true;
}, []);
+2 -1
View File
@@ -49,7 +49,8 @@ export type BaseRecording = {
project_flock: ProjectFlock;
record_datetime: string;
day: number;
executed_at: string;
population_can_change: boolean;
transfer_executed: boolean;
} & ProductionMetrics;
export type RecordingDepletion = {