"use client"; import { FC, useState } from "react"; import { Grid, Button, Dialog, DialogActions, DialogContent, TextField, Autocomplete } from "@mui/material"; import { useSWRConfig } from "swr"; import { createTicketMutation } from "app/_graphql/createTicketMutation"; interface TicketCreateDialogProps { open: boolean; closeDialog: () => void; } export const TicketCreateDialog: FC = ({ open, closeDialog, }) => { const [kind, setKind] = useState("note"); const [customerID, setCustomerID] = useState(""); const [groupID, setGroupID] = useState(""); const [ownerID, setOwnerID] = useState(""); const [priorityID, setPriorityID] = useState(""); const [stateID, setStateID] = useState(""); const [tags, setTags] = useState([]); const [title, setTitle] = useState(""); const [body, setBody] = useState(""); const backgroundColor = kind === "note" ? "#FFB620" : "#1982FC"; const color = kind === "note" ? "black" : "white"; const { fetcher } = useSWRConfig(); const ticket = { customerId: customerID, groupId: groupID, ownerId: ownerID, priorityId: priorityID, stateId: stateID, tags, title, article: { body, type: kind, internal: kind === "note", } }; const createTicket = async () => { await fetcher({ document: createTicketMutation, variables: { input: { ticket }, }, }); closeDialog(); setBody(""); }; return ( setTitle(e.target.value)} /> setCustomerID(e.target.value)} renderInput={(params) => } /> setBody(e.target.value)} /> ); };