import { EditBase, Form, useNotify, useRecordContext, useRedirect, } from "ra-core"; import { Link } from "react-router"; import { DeleteButton } from "@/components/ds/admin/delete-button"; import { ReferenceField } from "@/components/ds/admin/reference-field"; import { Button } from "@/components/ds/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogTitle, } from "@/components/ds/ui/dialog"; import { FormToolbar } from "../layout/FormToolbar"; import { CompanyAvatar } from "../companies/CompanyAvatar"; import type { Deal } from "../types"; import { DealInputs } from "./DealInputs"; export const DealEdit = ({ open, id }: { open: boolean; id?: string }) => { const redirect = useRedirect(); const notify = useNotify(); const handleClose = () => { redirect("/deals", undefined, undefined, undefined, { _scrollToTop: false, }); }; return ( handleClose()}> {id ? ( { notify("Deal updated"); redirect(`/deals/${id}/show`, undefined, undefined, undefined, { _scrollToTop: false, }); }, }} >
) : null}
); }; function EditHeader() { const deal = useRecordContext(); if (!deal) { return null; } return ( <>

Edit {deal.name} deal

Edit deal information including name, company, contacts, and other details ); }