Fix remove uneditable fields on task edition
Signed-off-by: Bryan Frimin <bryan@getprobo.com> Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
aa1ab4096d
commit
e0a3cfc2cb
@@ -147,7 +147,8 @@ export default function TaskFormDialog(props: Props) {
|
|||||||
dialogRef.current?.close();
|
dialogRef.current?.close();
|
||||||
});
|
});
|
||||||
const isUpdating = !!task;
|
const isUpdating = !!task;
|
||||||
const showMeasure = !props.measureId;
|
const showMeasure = !props.measureId && !isUpdating;
|
||||||
|
const isCreating = !isUpdating;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
@@ -180,24 +181,24 @@ export default function TaskFormDialog(props: Props) {
|
|||||||
{/* Properties form */}
|
{/* Properties form */}
|
||||||
<div className="py-5 px-6 bg-subtle">
|
<div className="py-5 px-6 bg-subtle">
|
||||||
<Label>{__("Properties")}</Label>
|
<Label>{__("Properties")}</Label>
|
||||||
<PropertyRow
|
{isCreating && (
|
||||||
label={__("Assigned to")}
|
<PropertyRow
|
||||||
error={formState.errors.assignedToId?.message}
|
label={__("Assigned to")}
|
||||||
>
|
error={formState.errors.assignedToId?.message}
|
||||||
<PeopleSelectField
|
>
|
||||||
disabled={isUpdating}
|
<PeopleSelectField
|
||||||
name="assignedToId"
|
name="assignedToId"
|
||||||
control={control}
|
control={control}
|
||||||
organizationId={organizationId}
|
organizationId={organizationId}
|
||||||
/>
|
/>
|
||||||
</PropertyRow>
|
</PropertyRow>
|
||||||
|
)}
|
||||||
{showMeasure && (
|
{showMeasure && (
|
||||||
<PropertyRow
|
<PropertyRow
|
||||||
label={__("Measure")}
|
label={__("Measure")}
|
||||||
error={formState.errors.measureId?.message}
|
error={formState.errors.measureId?.message}
|
||||||
>
|
>
|
||||||
<MeasureSelectField
|
<MeasureSelectField
|
||||||
disabled={isUpdating}
|
|
||||||
name="measureId"
|
name="measureId"
|
||||||
control={control}
|
control={control}
|
||||||
organizationId={organizationId}
|
organizationId={organizationId}
|
||||||
|
|||||||
Reference in New Issue
Block a user