Skip to content

Commit

Permalink
disable unless dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
rajku-dev committed Jan 8, 2025
1 parent 2f7d401 commit 27e1e0d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/components/Encounter/CreateEncounterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ export default function CreateEncounterForm({
}}
/>

<Button type="submit" className="w-full" disabled={isPending}>
<Button
type="submit"
className="w-full"
disabled={isPending || !form.formState.isDirty}
>
{isPending ? "Creating..." : "Create Encounter"}
</Button>
</form>
Expand Down
6 changes: 5 additions & 1 deletion src/components/Facility/CreateFacilityForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,11 @@ export default function CreateFacilityForm({
)}
</div>

<Button type="submit" className="w-full" disabled={isPending}>
<Button
type="submit"
className="w-full"
disabled={isPending || !form.formState.isDirty}
>
{isPending ? (
<>
<CareIcon
Expand Down
6 changes: 5 additions & 1 deletion src/components/Facility/FacilityCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,11 @@ export const FacilityCreate = (props: FacilityProps) => {
>
{t("cancel")}
</Button>
<Button variant="primary" type="submit" disabled={isLoading}>
<Button
variant="primary"
type="submit"
disabled={isLoading || !form.formState.isDirty}
>
{isLoading ? (
<Loading />
) : facilityId ? (
Expand Down
6 changes: 5 additions & 1 deletion src/components/Schedule/ScheduleExceptionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ export default function ScheduleExceptionForm({ user, onRefresh }: Props) {
Cancel
</Button>
</SheetClose>
<Button variant="primary" type="submit" disabled={isPending}>
<Button
variant="primary"
type="submit"
disabled={isPending || !form.formState.isDirty}
>
Confirm Unavailability
</Button>
</SheetFooter>
Expand Down

0 comments on commit 27e1e0d

Please sign in to comment.