Added the exam information to the ticket submission
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import {Ticket, TicketType, TicketTypeLabel} from "@/interfaces/ticket";
|
import {Ticket, TicketType, TicketTypeLabel} from "@/interfaces/ticket";
|
||||||
import {User} from "@/interfaces/user";
|
import {User} from "@/interfaces/user";
|
||||||
|
import useExamStore from "@/stores/examStore";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {useState} from "react";
|
import {useState} from "react";
|
||||||
import {toast} from "react-toastify";
|
import {toast} from "react-toastify";
|
||||||
@@ -20,6 +21,8 @@ export default function TicketSubmission({user, page, onClose}: Props) {
|
|||||||
const [description, setDescription] = useState("");
|
const [description, setDescription] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
const examState = useExamStore((state) => state);
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
if (!type) return toast.error("Please choose a type!", {toastId: "missing-type"});
|
if (!type) return toast.error("Please choose a type!", {toastId: "missing-type"});
|
||||||
if (subject.trim() === "")
|
if (subject.trim() === "")
|
||||||
@@ -48,6 +51,18 @@ export default function TicketSubmission({user, page, onClose}: Props) {
|
|||||||
type,
|
type,
|
||||||
reportedFrom: page,
|
reportedFrom: page,
|
||||||
description,
|
description,
|
||||||
|
examInformation:
|
||||||
|
page.includes("exam") || page.includes("exercises")
|
||||||
|
? {
|
||||||
|
exam: examState.exam?.id || "",
|
||||||
|
exams: examState.exams.map((x) => x.id),
|
||||||
|
exerciseIndex: examState.exerciseIndex,
|
||||||
|
moduleIndex: examState.moduleIndex,
|
||||||
|
partIndex: examState.partIndex,
|
||||||
|
questionIndex: examState.questionIndex,
|
||||||
|
selectedModules: examState.selectedModules,
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
axios
|
axios
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export default function Navbar({user, path, navDisabled = false, focusMode = fal
|
|||||||
<button
|
<button
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"border-mti-purple-light tooltip tooltip-bottom flex h-8 w-8 flex-col items-center justify-center rounded-full border p-1",
|
"border-mti-purple-light tooltip tooltip-bottom flex h-8 w-8 flex-col items-center justify-center rounded-full border p-1",
|
||||||
"hover:bg-mti-purple-light transition duration-300 ease-in-out hover:text-white",
|
"hover:bg-mti-purple-light transition duration-300 ease-in-out hover:text-white z-20",
|
||||||
)}
|
)}
|
||||||
data-tip="Submit a help/feedback ticket"
|
data-tip="Submit a help/feedback ticket"
|
||||||
onClick={() => setIsTicketOpen(true)}>
|
onClick={() => setIsTicketOpen(true)}>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import {Module} from ".";
|
||||||
import {Type} from "./user";
|
import {Type} from "./user";
|
||||||
|
|
||||||
export interface Ticket {
|
export interface Ticket {
|
||||||
@@ -10,6 +11,15 @@ export interface Ticket {
|
|||||||
description: string;
|
description: string;
|
||||||
subject: string;
|
subject: string;
|
||||||
assignedTo?: string;
|
assignedTo?: string;
|
||||||
|
examInformation?: {
|
||||||
|
exams: string[];
|
||||||
|
exam: string;
|
||||||
|
selectedModules: Module[];
|
||||||
|
moduleIndex: number;
|
||||||
|
partIndex: number;
|
||||||
|
exerciseIndex: number;
|
||||||
|
questionIndex: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TicketReporter {
|
export interface TicketReporter {
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ export default function Tickets() {
|
|||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={!!selectedTicket}
|
isOpen={!!selectedTicket}
|
||||||
|
title={selectedTicket ? selectedTicket.id : undefined}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
reload();
|
reload();
|
||||||
setSelectedTicket(undefined);
|
setSelectedTicket(undefined);
|
||||||
|
|||||||
Reference in New Issue
Block a user