diff --git a/frontend/src/components/fields/DropField.tsx b/frontend/src/components/fields/DropField.tsx new file mode 100644 index 0000000..2e0b10e --- /dev/null +++ b/frontend/src/components/fields/DropField.tsx @@ -0,0 +1,76 @@ +import { cva } from "class-variance-authority"; +import { FormControl, FormField, FormItem, FormMessage } from "../ui/form"; +import { + Select, + SelectValue, + SelectContent, + SelectItem, + SelectTrigger, +} from "../ui/select"; +import { ChevronsUpIcon, EqualIcon, MinusIcon } from "lucide-react"; + +export default function DropField({ control, name, items, variant }: any) { + if(variant === 'difficulty'){ + return ( + ( + + + + + )} + /> + ); + } + return ( + ( + + + + + )} + /> + ); +} \ No newline at end of file diff --git a/frontend/src/components/fields/SearchFilterField.tsx b/frontend/src/components/fields/SearchFilterField.tsx new file mode 100644 index 0000000..b59ce82 --- /dev/null +++ b/frontend/src/components/fields/SearchFilterField.tsx @@ -0,0 +1,90 @@ +import { CaretSortIcon } from "@radix-ui/react-icons"; +import { Button } from "../ui/button"; +import { FormControl, FormField, FormItem, FormMessage } from "../ui/form"; +import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; +import { Command, CommandGroup, CommandInput, CommandItem } from "../ui/command"; +import { CommandEmpty } from "cmdk"; +import { ScrollArea } from "../ui/scroll-area"; +import { CheckIcon } from "lucide-react"; +import { cn } from "@/lib/utils"; + +export default function SearchFilterField({ control, name, key, items, form }: any){ + return( + ( + + + + + + + + + + + nothing found... + + + {items?.data.map((tutor: any) => ( + { + { + form.setValue("tutor", tutor.name); + } + }} + > + {tutor.name} + + + ))} + + + + + + + + )} + /> + ) +} \ No newline at end of file diff --git a/frontend/src/components/tables/TicketTable.tsx b/frontend/src/components/tables/TicketTable.tsx index b8a6b81..221f0c4 100644 --- a/frontend/src/components/tables/TicketTable.tsx +++ b/frontend/src/components/tables/TicketTable.tsx @@ -123,7 +123,6 @@ export default function TicketTable({ tickets }: any) { rowSelection, }, }); - console.log(tickets); if (tickets) { return (
diff --git a/frontend/src/forms/TutorTicketForm.tsx b/frontend/src/forms/TutorTicketForm.tsx index 56d3971..86dfa9e 100644 --- a/frontend/src/forms/TutorTicketForm.tsx +++ b/frontend/src/forms/TutorTicketForm.tsx @@ -7,13 +7,13 @@ import { AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Separator } from "@/components/ui/separator"; -import { Switch } from "@/components/ui/switch"; import { DropdownMenuTrigger, DropdownMenuContent, DropdownMenu, DropdownMenuItem, DropdownMenuLabel, + DropdownMenuCheckboxItem, } from "../components/ui/dropdown-menu"; import { CopyIcon, FlagIcon } from "lucide-react"; import { DotsHorizontalIcon } from "@radix-ui/react-icons"; @@ -24,15 +24,11 @@ import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; import { Form } from "@/components/ui/form"; import { ScrollArea } from "@/components/ui/scroll-area"; -// import LoadingSelect from "@/components/loading/loading_select"; -// import { useMutation } from "@tanstack/react-query"; -// import { useToast } from "@/components/ui/use-toast"; -// import { createTicket } from "@/API/tickets/ticketRequests"; -// import { useNavigate } from "react-router-dom"; -// import useFetchTutor from "@/API/tutors/useFetchTutor"; import TextareaField from "../components/fields/TextareaField"; import DropdownField from "../components/fields/DropdownField"; import useFetchTutor from "@/API/tutors/useFetchTutor"; +import SearchFilterField from "@/components/fields/SearchFilterField"; +import DropField from "@/components/fields/DropField"; function DetailLink({ label, content }: any) { return ( @@ -46,7 +42,8 @@ function DetailLink({ label, content }: any) { const FormSchema = z.object({ description: z.string().min(4).max(500), status: z.string().min(1).max(10), - tutor: z.string().min(2).max(50) + tutor: z.string(), + was_successful: z.boolean() }); function onSubmit(data: z.infer) { @@ -62,7 +59,8 @@ export default function TutorTicketForm({ ticket }: any) { defaultValues: { description: ticket.description, status: ticket.status, - tutor: "Tutor" + tutor: "", + was_successful: ticket.was_successful }, }); @@ -150,14 +148,16 @@ export default function TutorTicketForm({ ticket }: any) { - Actions - - navigator.clipboard.writeText(ticket.id) + + {form.setValue('was_successful', !form.getValues('was_successful'))} } > - ... - + Successful +
@@ -226,23 +226,39 @@ export default function TutorTicketForm({ ticket }: any) { ({value: tutor.name, text: tutor.name}))} + form={form} + key={form.id} + items={tutors} />} /> } /> - } + content={} />