mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Update recording editability logic and extend
BaseRecording type
This commit is contained in:
@@ -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
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user