mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +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) => {
|
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
@@ -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 = {
|
||||||
|
|||||||
Reference in New Issue
Block a user