Skip to content

Commit

Permalink
Fix: Added cancel button in ValueSetForm (#10916)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijeetkhokhar authored Mar 1, 2025
1 parent 39bb22a commit ce6c912
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/components/ValueSet/ValueSetForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
} from "@/components/ui/select";
import { Textarea } from "@/components/ui/textarea";

import useAppHistory from "@/hooks/useAppHistory";

import mutate from "@/Utils/request/mutate";
import {
TERMINOLOGY_SYSTEMS,
Expand Down Expand Up @@ -399,6 +401,8 @@ export function ValueSetForm({
}: ValueSetFormProps) {
const { t } = useTranslation();

const { goBack } = useAppHistory();

const form = useForm<ValuesetFormType>({
resolver: zodResolver(valuesetFormSchema),
defaultValues: {
Expand Down Expand Up @@ -488,9 +492,19 @@ export function ValueSetForm({
<RuleFields type="exclude" form={form} />
</div>

<Button type="submit" disabled={isSubmitting}>
{isSubmitting ? t("saving") : t("save_valueset")}
</Button>
<div className="flex gap-2 w-full justify-end">
<Button
variant="outline"
disabled={isSubmitting}
type="button"
onClick={() => goBack("/admin/valuesets")}
>
{t("cancel")}
</Button>
<Button variant="primary" type="submit" disabled={isSubmitting}>
{isSubmitting ? t("saving") : t("save_valueset")}
</Button>
</div>
</form>
</Form>
);
Expand Down

0 comments on commit ce6c912

Please sign in to comment.