Sidebar and edit updates

This commit is contained in:
Darren Clarke 2023-10-16 09:20:40 +02:00
parent d73b194d1f
commit f13530f043
32 changed files with 3057 additions and 1114 deletions

View file

@ -17,6 +17,7 @@ interface ArticleCreateDialogProps {
open: boolean;
closeDialog: () => void;
kind: string;
recipient?: string;
}
export const ArticleCreateDialog: FC<ArticleCreateDialogProps> = ({
@ -24,22 +25,29 @@ export const ArticleCreateDialog: FC<ArticleCreateDialogProps> = ({
open,
closeDialog,
kind,
recipient,
}) => {
const [body, setBody] = useState("");
const backgroundColor = kind === "note" ? "#FFB620" : "#1982FC";
const color = kind === "note" ? "black" : "white";
const { fetcher } = useSWRConfig();
const article = {
body,
type: kind,
internal: kind === "note",
};
if (kind === "email") {
article["to"] = recipient;
}
const createArticle = async () => {
await fetcher({
document: updateTicketMutation,
variables: {
ticketId: `gid://zammad/Ticket/${ticketID}`,
input: {
article: {
body,
type: kind,
internal: kind === "note",
},
article,
},
},
});

View file

@ -53,8 +53,10 @@ export const TicketDetail: FC<TicketDetailProps> = ({ id }) => {
: null;
const mostRecentExternalArticleKind =
mostRecentExternalArticle?.type?.name ?? "phone";
const mostRecentEmailRecipient = mostRecentExternalArticle?.to?.name ?? "";
const [dialogOpen, setDialogOpen] = useState(false);
const [articleKind, setArticleKind] = useState("phone");
const [recipient, setRecipient] = useState("");
const closeDialog = () => setDialogOpen(false);
const shouldRender =