diff --git a/public/sitemap-0.xml b/public/sitemap-0.xml index d2dccee..9a79394 100644 --- a/public/sitemap-0.xml +++ b/public/sitemap-0.xml @@ -1,36 +1,36 @@ -https://roboticspec.com2026-08-14T11:39:37.785Zdaily0.7 -https://roboticspec.com/activities2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/ActivitiesEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/BlogsEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/BubbleMenu2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/EventsEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/FormatButton2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/HeroEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/MarkdownEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/MenuBar2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/ProjectsEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/ResourceEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/Role2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/SelectSearch2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/TeamEditor2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/role/RoleAccordion2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/role/RolesPanel2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/role/UserRow2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/components/role/UsersPanel2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/admin/page2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/apply2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/contact2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/events2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/events/components/EventCalendar2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/login2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/login/callback2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/panelist2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/panelist/dashboard2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/project2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/project/components/ProjectCard2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/resources2026-08-14T11:39:37.786Zdaily0.7 -https://roboticspec.com/resources/components/ResourceCard2026-08-14T11:39:37.786Zdaily0.7 +https://roboticspec.com2026-08-15T15:35:43.310Zdaily0.7 +https://roboticspec.com/activities2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/ActivitiesEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/BlogsEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/BubbleMenu2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/EventsEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/FormatButton2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/HeroEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/MarkdownEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/MenuBar2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/ProjectsEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/ResourceEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/Role2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/SelectSearch2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/TeamEditor2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/role/RoleAccordion2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/role/RolesPanel2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/role/UserRow2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/components/role/UsersPanel2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/admin/page2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/apply2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/contact2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/events2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/events/components/EventCalendar2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/login2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/login/callback2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/panelist2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/panelist/dashboard2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/project2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/project/components/ProjectCard2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/resources2026-08-15T15:35:43.311Zdaily0.7 +https://roboticspec.com/resources/components/ResourceCard2026-08-15T15:35:43.311Zdaily0.7 \ No newline at end of file diff --git a/src/components/panelist/ApplicantEditForm.tsx b/src/components/panelist/ApplicantEditForm.tsx new file mode 100644 index 0000000..e0e3ba5 --- /dev/null +++ b/src/components/panelist/ApplicantEditForm.tsx @@ -0,0 +1,370 @@ +import { useEffect, useState } from "react"; + +import { ApplicantType } from "@/types"; + +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { Button } from "@/components/ui/button"; + +import { + Save, + X, +} from "lucide-react"; + +import { APPLICATION_QUESTIONS } from "../ApplicationForm"; + +interface ApplicantEditFormProps { + applicant: ApplicantType; + + onSave: ( + updatedApplicant: ApplicantType + ) => Promise; + + onCancel: () => void; +} + +const ApplicantEditForm = ({ + applicant, + onSave, + onCancel, +}: ApplicantEditFormProps) => { + const [name, setName] = useState( + applicant.name || "" + ); + + const [sid, setSid] = useState( + applicant.sid || "" + ); + + const [phone, setPhone] = useState( + applicant.phone || "" + ); + + const [branch, setBranch] = useState( + applicant.branch || "" + ); + + const [remarks, setRemarks] = + useState( + applicant.remarks || "" + ); + + const [responses, setResponses] = + useState>( + applicant.responses || {} + ); + + const [isSaving, setIsSaving] = + useState(false); + + /* + * Keep form synchronized with the selected + * applicant. + */ + useEffect(() => { + setName(applicant.name || ""); + setSid(applicant.sid || ""); + setPhone(applicant.phone || ""); + setBranch(applicant.branch || ""); + + setRemarks( + applicant.remarks || "" + ); + + setResponses( + applicant.responses || {} + ); + }, [applicant]); + + const handleResponseChange = ( + questionId: string, + value: string + ) => { + setResponses( + (current) => ({ + ...current, + [questionId]: value, + }) + ); + }; + + const handleSave = async () => { + if (isSaving) { + return; + } + + if (!name.trim()) { + alert( + "Name cannot be empty." + ); + return; + } + + if (!sid.trim()) { + alert( + "SID cannot be empty." + ); + return; + } + + if ( + !applicant.isWalkin && + !branch.trim() + ) { + alert( + "Branch cannot be empty." + ); + return; + } + + setIsSaving(true); + + try { + const updatedApplicant: ApplicantType = + { + ...applicant, + + name: name.trim(), + + sid: sid.trim(), + + phone: phone.trim(), + + /* + * This works for BOTH: + * - pending + * - accepted + * - rejected + * + * and both: + * - normal applicants + * - walk-ins + */ + remarks: + remarks.trim(), + + ...(applicant.isWalkin + ? {} + : { + branch: + branch.trim(), + + responses, + }), + }; + + await onSave( + updatedApplicant + ); + } finally { + setIsSaving(false); + } + }; + + return ( +
+ +
+ +
+ +

+ Edit Applicant +

+ + {/* Basic details */} +
+ +
+ + + + setName( + e.target.value + ) + } + /> +
+ +
+ + + + setSid( + e.target.value + ) + } + /> +
+ +
+ + + + setPhone( + e.target.value + ) + } + /> +
+ + {!applicant.isWalkin && ( +
+ + + + setBranch( + e.target.value + ) + } + /> +
+ )} + +
+ + {/* ========================================= + REMARKS + ========================================= */} +
+ + + +