diff --git a/.DS_Store b/.DS_Store index 357bf9326..3896b92e7 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/package.json b/package.json index 4ed239000..e109b1fa4 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "jquery": "^3.6.1", "jspdf": "^2.5.2", "jwt-decode": "^3.1.2", - "lucide-react": "^0.461.0", + "lucide-react": "^0.460.0", "mini-css-extract-plugin": "^2.6.1", "moment": "^2.29.4", "next-preload-headers": "^3.0.4", diff --git a/src/assets/Group.svg b/src/assets/Group.svg index 3c6880691..bc71b635c 100644 --- a/src/assets/Group.svg +++ b/src/assets/Group.svg @@ -1,4 +1,4 @@ - - + + diff --git a/src/assets/assets/NotFoundImg.svg b/src/assets/assets/NotFoundImg.svg index ce3c21637..95fc6c2b4 100644 --- a/src/assets/assets/NotFoundImg.svg +++ b/src/assets/assets/NotFoundImg.svg @@ -1,4 +1,4 @@ - + diff --git a/src/assets/assets/logo.svg b/src/assets/assets/logo.svg index ca91f01bb..59d2efad9 100644 --- a/src/assets/assets/logo.svg +++ b/src/assets/assets/logo.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/src/assets/assets/logoWhite.svg b/src/assets/assets/logoWhite.svg index 47b1ab43e..455f5a304 100644 --- a/src/assets/assets/logoWhite.svg +++ b/src/assets/assets/logoWhite.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/src/assets/logo.svg b/src/assets/logo.svg index a17c2f46e..7cb50b02c 100644 --- a/src/assets/logo.svg +++ b/src/assets/logo.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/src/assets/logoWhite.svg b/src/assets/logoWhite.svg index 080522826..37293ad7b 100644 --- a/src/assets/logoWhite.svg +++ b/src/assets/logoWhite.svg @@ -1,5 +1,5 @@ - - - + + + \ No newline at end of file diff --git a/src/components/Invitation/ScheduleInterview.tsx b/src/components/Invitation/ScheduleInterview.tsx deleted file mode 100644 index 158e99458..000000000 --- a/src/components/Invitation/ScheduleInterview.tsx +++ /dev/null @@ -1,410 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { IoIosSend } from "react-icons/io"; -import { IoCloseCircleOutline } from "react-icons/io5"; -import { useAppDispatch, useAppSelector } from "../../hooks/hooks"; -import { sendInterviewInvitations } from "../../redux/actions/applicationStage"; -import { getAllCoordinators } from "../../redux/actions/users"; -import { updateInterviewStatuses } from "../../redux/actions/applicationStage"; -import toast from "react-hot-toast"; - -interface Props { - applicantId: string; - stage: string; - status?: string; - onClose: () => void; - availableStatuses?: string[]; - technicalInterviews?: any[]; // Added to handle existing interviews -} - -const ScheduleInterview: React.FC = ({ - applicantId, - stage, - status, - onClose, - technicalInterviews = [], - availableStatuses = ["Scheduled", "Completed", "No show", "Cancelled"], -}) => { - const dispatch = useAppDispatch(); - const [isModelOpen, setIsModelOpen] = useState(false); - const [activeTab, setActiveTab] = useState<"invite" | "update-status">( - "invite" - ); - - // Invite Form States - const [meetingLink, setMeetingLink] = useState(""); - const [scheduledDateTime, setScheduledDateTime] = useState(""); - const [coordinatorId, setCoordinatorId] = useState(""); - const [platForm, setPlatForm] = useState(""); - const [coordinators, setCoordinators] = useState([]); - - // Update Status States - const [newStatus, setNewStatus] = useState(""); - const [selectedInterviewId, setSelectedInterviewId] = useState(""); - - const [error, setError] = useState(null); - const [isLoading, setIsLoading] = useState(false); - - useEffect(() => { - const fetchCoordinators = async () => { - try { - const fetchedCoordinators = await dispatch(getAllCoordinators()); - setCoordinators(fetchedCoordinators); - } catch (err) { - console.error("Failed to fetch coordinators:", err); - } - }; - - fetchCoordinators(); - }, [dispatch]); - - useEffect(() => { - // Ensure technicalInterviews is an array and has length - if (Array.isArray(technicalInterviews) && technicalInterviews.length > 0) { - setSelectedInterviewId(technicalInterviews[0]._id); - } else { - setSelectedInterviewId(""); - } - }, [technicalInterviews]); - - const handleOpenModel = () => { - setIsModelOpen(true); - setActiveTab("invite"); - }; - - const handleCloseModel = () => { - setIsModelOpen(false); - onClose(); - }; - - const handleInviteSubmit = async (event: React.FormEvent) => { - event.preventDefault(); - - if (!coordinatorId) { - setError("Please select a coordinator"); - return; - } - - if (!meetingLink.trim()) { - setError("Link is required"); - return; - } - - const validPlatforms = ["Zoom", "Teams"]; - const platform = - platForm.charAt(0).toUpperCase() + platForm.slice(1).toLowerCase(); - - if (!validPlatforms.includes(platform)) { - setError( - `Invalid meeting platform. Must be one of: ${validPlatforms.join(", ")}` - ); - return; - } - - const formattedDateTime = new Date(scheduledDateTime).toISOString(); - - setIsLoading(true); - await dispatch( - sendInterviewInvitations( - applicantId, - coordinatorId, - meetingLink, - formattedDateTime, - platform - ) - ).then(() => { - setError(null); - onClose(); - setIsLoading(false); - }); - }; - - const handleStatusUpdate = async (event: React.FormEvent) => { - event.preventDefault(); - - if (!newStatus) { - setError("Please select a status"); - return; - } - - if (!selectedInterviewId) { - setError("No interview found. Please schedule an interview first."); - return; - } - - const currentInterview = technicalInterviews.find( - (interview) => interview._id === selectedInterviewId - ); - - // Define valid status transitions - const validStatusTransitions = { - Scheduled: ["Completed", "No show", "Cancelled"], - Completed: [], - Cancelled: [], - "No show": [], - }; - - if (currentInterview) { - const currentStatus = currentInterview.status; - const allowedNextStatuses = validStatusTransitions[currentStatus] || []; - - if (!allowedNextStatuses.includes(newStatus)) { - setError( - `Invalid status transition from ${currentStatus} to ${newStatus}` - ); - return; - } - } - - try { - setIsLoading(true); - await dispatch(updateInterviewStatuses(selectedInterviewId, newStatus)); - onClose(); - setIsLoading(false); - } catch (err) { - console.error("Error updating interview status:", err); - setError("Failed to update status"); - setIsLoading(false); - } - }; - - return ( -
- - {isModelOpen && ( -
-
-
- - - {/* Tab Navigation */} -
- - -
- - {/* Invite Form */} - {activeTab === "invite" && ( -
-
- - -
- -
- - setPlatForm(e.target.value)} - /> -
-
- - setMeetingLink(e.target.value)} - /> -
-
- - setScheduledDateTime(e.target.value)} - className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg w-full p-2.5 dark:border-gray-600 dark:bg-gray-700 dark:text-white" - required - /> -
- -
- )} - - {/* Update Status Form */} - {activeTab === "update-status" && ( -
-
- - -
- -
- )} - - {/* Error Message */} - {error && ( -
- {error} -
- )} -
-
-
- )} -
- ); -}; - -export default ScheduleInterview; diff --git a/src/components/Invitation/ScheduleTechnical.tsx b/src/components/Invitation/ScheduleTechnical.tsx index c8b7f5e87..8090545f3 100644 --- a/src/components/Invitation/ScheduleTechnical.tsx +++ b/src/components/Invitation/ScheduleTechnical.tsx @@ -26,10 +26,10 @@ const ScheduleTechnical: React.FC = ({ const [error, setError] = useState(null); const [isLoading, setIsLoading] = useState(false); const handleOpenModel = () => { - setIsModelOpen((prev) => !prev); + setIsModelOpen((prev)=> !prev); }; const handleCloseModel = () => { - setIsModelOpen((prev) => !prev); + setIsModelOpen((prev)=> !prev); onClose(); }; const handleFormSubmit = async (event: any) => { @@ -39,22 +39,20 @@ const ScheduleTechnical: React.FC = ({ return; } setIsLoading(true); - await dispatch( - sendInvitations(applicantId, email, platForm, invitationLink) - ) - .then(() => { + await dispatch(sendInvitations(applicantId, email, platForm, invitationLink)).then( + () => { setIsLoading(false); setError(null); onClose(); - setIsModelOpen((prev) => !prev); + setIsModelOpen((prev)=> !prev); // setEmail(""); // setInvitationLink(""); // setPlatForm(""); - }) - .catch((error: any) => { - setIsLoading(false); - setError(error.message); - }); + } + ).catch((error:any) => { + setIsLoading(false); + setError(error.message); + }); }; return ( @@ -69,7 +67,7 @@ const ScheduleTechnical: React.FC = ({ : false } className={`px-4 py-2 w-full text-sm font-medium text-white ${ - status === "Moved" + status === "Moved" ? "bg-gray-400 cursor-not-allowed" : " bg-[#0c6a0c] hover:bg-[#367a4e] dark:bg-[#1bf84b8d] dark:hover:bg-emerald-700 dark:hover:text-gray-800 cursor-pointer" } focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500`} diff --git a/src/components/form/Button.tsx b/src/components/form/Button.tsx index 2733648ec..d503f6b10 100644 --- a/src/components/form/Button.tsx +++ b/src/components/form/Button.tsx @@ -27,7 +27,7 @@ const Button: React.FC = ({ type={type} onClick={onClick} disabled={disabled} - className={`w-[25vw] rounded-md px-2 py-3 text-white sm:text-[12px] my-2 focus:bg-[#56C870] bg-primary dark:bg-[#56C870] hover:bg-primary dark:hover:bg-[#80d293] cursor-pointer ${className}`} + className={` w-[25vw] rounded-md px-2 py-3 text-white sm:text-[12px] my-2 focus:bg-[#56C870] bg-primary dark:bg-[#56C870] hover:bg-primary dark:hover:bg-[#80d293] cursor-pointer ${className}`} role={role} > {label} {children} diff --git a/src/components/form/addApplicantScore.tsx b/src/components/form/addApplicantScore.tsx index 962990503..d3800aef9 100644 --- a/src/components/form/addApplicantScore.tsx +++ b/src/components/form/addApplicantScore.tsx @@ -8,19 +8,16 @@ import { darkTheme, } from "../../pages/FilterTeainee/FilterTrainee"; import { useTheme } from "../../hooks/darkmode"; - interface scoreProps { applicantId: string; stage: string; onClose: () => void; - technicalInterviews?: any[]; } -const AddApplicantScore: React.FC = ({ +const addApplicantScore: React.FC = ({ applicantId, stage, onClose, - technicalInterviews = [], }) => { const dispatch = useAppDispatch(); const { data, loading, success, error } = useAppSelector( @@ -30,19 +27,10 @@ const AddApplicantScore: React.FC = ({ const [isModelOpen, setIsModelOpen] = useState(false); const [isError, setIsError] = useState(false); const [errorMsg, setErrorMsg] = useState(null); - const { theme } = useTheme(); - const [isValid, setIsValid] = useState(""); + const { theme, setTheme } = useTheme(); + const [isValid, setIsValid] = useState("") const handleOpen = () => { - // Check if interview is completed before opening - if (stage === "Interview Assessment" && technicalInterviews.length > 0) { - const lastInterview = technicalInterviews[0]; - if (lastInterview.status !== "Completed") { - toast.error("Cannot add score. Interview is not completed."); - return; - } - } - setIsModelOpen(true); setIsError(false); setErrorMsg(null); @@ -56,24 +44,12 @@ const AddApplicantScore: React.FC = ({ setErrorMsg(null); onClose(); }; - const handleAddMarks = async () => { - // Additional check before adding marks - if (stage === "Interview Assessment" && technicalInterviews.length > 0) { - const lastInterview = technicalInterviews[0]; - if (lastInterview.status !== "Completed") { - setErrorMsg("Cannot add score. Interview is not completed."); - setIsError(true); - return; - } - } - if (!score) { setErrorMsg("Score is required"); setIsError(true); return; } - await dispatch(addMarks(applicantId, stage, score)); if (success && data?.success) { toast.success(data?.message); @@ -91,18 +67,17 @@ const AddApplicantScore: React.FC = ({ handleClose(); } }, [success]); - const handleScoreChange = (e) => { const input = e.target.value; - if (e.target.value === "") { + if (e.target.value === '') { setScore(null); setIsValid(""); return; } if (/^0\d/.test(input)) { - setIsValid("Score cannot have leading zeros"); - return; + setIsValid('Score cannot have leading zeros'); + return } const value = Number(input); @@ -110,31 +85,13 @@ const AddApplicantScore: React.FC = ({ setScore(value); setIsValid(""); } else { - setIsValid("Score must be between 1 and 100"); + setIsValid('Score must be between 1 and 100'); } - - toast.success("Score added successfully"); }; - - // Determine if score button should be disabled - const isScoreButtonDisabled = () => { - if (stage === "Interview Assessment" && technicalInterviews.length > 0) { - const lastInterview = technicalInterviews[0]; - return lastInterview.status !== "Completed"; - } - return false; - }; - return ( <>
- {isModelOpen && ( @@ -200,4 +157,4 @@ const AddApplicantScore: React.FC = ({ ); }; -export default AddApplicantScore; +export default addApplicantScore; diff --git a/src/components/iconss/SvgIcons.tsx b/src/components/iconss/SvgIcons.tsx index b5b1afe75..079e99ba7 100644 --- a/src/components/iconss/SvgIcons.tsx +++ b/src/components/iconss/SvgIcons.tsx @@ -58,16 +58,16 @@ export const CohortIcon = () => ( -); +); \ No newline at end of file diff --git a/src/pages/ApplicationCycle/myApplication.tsx b/src/pages/ApplicationCycle/myApplication.tsx index 9e0eab051..6f3c90a39 100644 --- a/src/pages/ApplicationCycle/myApplication.tsx +++ b/src/pages/ApplicationCycle/myApplication.tsx @@ -1,15 +1,15 @@ -import { useEffect, useState } from "react"; -import { useAppDispatch, useAppSelector } from "../../hooks/hooks"; -import { toast, ToastContainer } from "react-toastify"; -import { AiFillFilePdf } from "react-icons/ai"; +import { useEffect, useState } from 'react'; +import { useAppDispatch, useAppSelector } from '../../hooks/hooks'; +import { toast, ToastContainer } from 'react-toastify'; +import { AiFillFilePdf } from 'react-icons/ai'; import { getApplicantCyclesApplications, getCyclesApplicationAttributes, getCyclesStages, -} from "../../redux/actions/applications"; -import { Link } from "react-router-dom"; -import ViewExternalDocumentsModal from "../../pages/viewExternalDocuments"; +} from '../../redux/actions/applications'; +import { Link } from 'react-router-dom'; +import ViewExternalDocumentsModal from '../../pages/viewExternalDocuments'; export const MyApplication = () => { const dispatch = useAppDispatch(); @@ -18,7 +18,7 @@ export const MyApplication = () => { const [attributes, setAttributes] = useState(null); const [stages, setStages] = useState(null); const [show, setShow] = useState(false); - const [fileUrl, setFileUrl] = useState(""); + const [fileUrl, setFileUrl] = useState(''); const viewExternalDocumentsModal = (url: any) => { setFileUrl(url); setShow(true); @@ -32,12 +32,12 @@ export const MyApplication = () => { const response = await getApplicantCyclesApplications(); if (response?.data?.getTraineeCyclesApplications) { setApplication(response.data.getTraineeCyclesApplications); - console.log("Appl", response.data.getTraineeCyclesApplications); + console.log('Appl', response.data.getTraineeCyclesApplications); } else { - throw new Error("No applications found"); + throw new Error('No applications found'); } } catch (error) { - toast.error("No applications found!"); + toast.error('No applications found!'); } finally { setIsLoading(false); } @@ -63,7 +63,7 @@ export const MyApplication = () => { } } } catch (error) { - toast.error("Something went wrong while fetching details!"); + toast.error('Something went wrong while fetching details!'); } finally { setIsLoading(false); } @@ -75,13 +75,13 @@ export const MyApplication = () => { const formatDate = (timestamp) => { const date = new Date(Number(timestamp)); - console.log("DDD", date); - if (isNaN(date.getTime())) return ""; + console.log('DDD', date); + if (isNaN(date.getTime())) return ''; - return new Intl.DateTimeFormat("en-US", { - day: "2-digit", - month: "short", - year: "numeric", + return new Intl.DateTimeFormat('en-US', { + day: '2-digit', + month: 'short', + year: 'numeric', }).format(date); }; @@ -90,7 +90,7 @@ export const MyApplication = () => { <>
@@ -101,7 +101,7 @@ export const MyApplication = () => {
@@ -127,14 +127,14 @@ export const MyApplication = () => {
); } - console.log("APPJJA", application); + console.log('APPJJA', application); return ( <>

My Application @@ -163,19 +163,19 @@ export const MyApplication = () => { )} {application?.cycle_id?.name && (
  • - Application Cycle:{" "} + Application Cycle:{' '} {application.cycle_id.name}
  • )} {application?.cycle_id?.createdAt && (
  • - Published date:{" "} + Published date:{' '} {formatDate(application.cycle_id.createdAt)}
  • )} {application?.createdAt && (
  • - Application date:{" "} + Application date:{' '} {formatDate(application.createdAt)}
  • )} @@ -276,11 +276,11 @@ export const MyApplication = () => {

    Current Stage: - {application?.applicationPhase === "Rejected" ? ( + {application?.applicationPhase === 'Rejected' ? ( Rejected ) : ( - {" "} + {' '} {application?.applicationPhase} )} @@ -308,7 +308,7 @@ export const MyApplication = () => { {stages.dismissed?.stageDismissedFrom && (

    - Stage dismissed from:{" "} + Stage dismissed from:{' '} {stages.dismissed.stageDismissedFrom}

    )} @@ -321,7 +321,7 @@ export const MyApplication = () => { {stages.dismissed?.createdAt && (

    - Date:{" "} + Date:{' '} {formatDate(stages.dismissed.createdAt)}

    )} @@ -332,10 +332,10 @@ export const MyApplication = () => {
  • Admitted {stages?.allStages?.history - .filter((history: any) => history.stage === "Admitted") + .filter((history: any) => history.stage === 'Admitted') .map((history: any, index: any) => ( -   ({formatDate(history.enteredAt)} -{" "} +   ({formatDate(history.enteredAt)} -{' '} {formatDate(history.exitedAt)}) ))} @@ -367,11 +367,11 @@ export const MyApplication = () => { {stages?.allStages?.history .filter( (history: any) => - history.stage === "Technical Assessment" + history.stage === 'Technical Assessment' ) .map((history: any, index: any) => ( -   ({formatDate(history.enteredAt)} -{" "} +   ({formatDate(history.enteredAt)} -{' '} {formatDate(history.exitedAt)}) ))} @@ -403,11 +403,11 @@ export const MyApplication = () => { {stages?.allStages?.history .filter( (history: any) => - history.stage === "Technical Assessment" + history.stage === 'Technical Assessment' ) .map((history: any, index: any) => ( -   ({formatDate(history.enteredAt)} -{" "} +   ({formatDate(history.enteredAt)} -{' '} {formatDate(history.exitedAt)}) ))} @@ -437,10 +437,10 @@ export const MyApplication = () => {
  • Shortlist {stages?.allStages?.history - .filter((history: any) => history.stage === "Shortlisted") + .filter((history: any) => history.stage === 'Shortlisted') .map((history: any, index: any) => ( -   ({formatDate(history.enteredAt)} -{" "} +   ({formatDate(history.enteredAt)} -{' '} {formatDate(history.exitedAt)}) ))} diff --git a/src/pages/TraineApplicant/ApplicantStages.tsx b/src/pages/TraineApplicant/ApplicantStages.tsx index 13e4b225c..48e810f8e 100644 --- a/src/pages/TraineApplicant/ApplicantStages.tsx +++ b/src/pages/TraineApplicant/ApplicantStages.tsx @@ -30,12 +30,8 @@ import toast from "react-hot-toast"; import { Link } from "react-router-dom"; import ScheduleTechnical from "../../components/Invitation/ScheduleTechnical"; import axios from "axios"; +import { exportToExcel } from "../../utils/exports/exportToExcel"; import DocumentSelector from "../../components/DocumentPreviewButton"; -import { - exportInterviewDataToExcel, - exportToExcel, -} from "../../utils/exports/exportToExcel"; -import ScheduleInterview from "../../components/Invitation/ScheduleInterview"; const ApplicantStages = (props: any) => { // New state for search input and search field @@ -91,8 +87,6 @@ const ApplicantStages = (props: any) => { const filtered = traine.filter( (trainee) => trainee?.cycle_id?.name === decodedString ); - console.log("FILTERED TRAINEES =>>>>>>:", traine); - setFilteredTraines(filtered); }, [traines, cycleName]); @@ -183,17 +177,6 @@ const ApplicantStages = (props: any) => { return dateObj.toLocaleDateString(); }; - const handleConvertInterviewDate = (date: string | number) => { - const timestamp = - typeof date === "string" && /^\d+$/.test(date) ? parseInt(date) : date; - - const dateObj = new Date(timestamp); - - return !isNaN(dateObj.getTime()) - ? dateObj.toLocaleDateString() - : "Invalid Date"; - }; - const handleTurnCutText = (text: string) => { if (text.length > 10) { return text.slice(0, 10) + "..."; @@ -209,41 +192,14 @@ const ApplicantStages = (props: any) => { const handleToExport = async (stage: string) => { let data; - let interviewData; - setIsOpen((prev) => !prev); + setIsOpen((prev) => !prev) switch (stage) { - case "All": - data = filteredTrainees.filter( - (item: any) => item.applicationPhase === "Technical Assessment" - ); - - interviewData = filteredTrainees.filter( - (item: any) => item.applicationPhase === "Interview Assessment" - ); - - // Call exportToExcel function - exportToExcel({ data, docName: "All Technical Assessment Data" }); - exportInterviewDataToExcel({ - interviewData, - docName: "All Interview Assessment Data", - }); - break; - case "Technical Assessment": // Use pre-filtered data (filterData) data = filterData; // Call exportToExcel function - exportToExcel({ data, docName: "Technical_Assessment_Stage_Data" }); - break; - - case "Interview Assessment": - interviewData = filterData; - - exportInterviewDataToExcel({ - interviewData, - docName: "Interview Assessment Stage Data", - }); + exportToExcel({ data, docName: 'Technical_Assessment_Stage_Data' }); break; default: @@ -251,21 +207,6 @@ const ApplicantStages = (props: any) => { } }; - const getStatusText = (item: any) => { - if (item.applicationPhase === "Interview Assessment") { - if (item.technicalInterviews && item.technicalInterviews.length > 0) { - return item.technicalInterviews[0].status; - } - return item.status; - } - - if (item.technicalInterviews && item.technicalInterviews.length > 0) { - return item.technicalInterviews[0].status; - } - - return item.status; - }; - return ( <>
    @@ -318,11 +259,10 @@ const ApplicantStages = (props: any) => { {stages.map((stage) => ( ))}
    -
    +
    + + + )) ) : ( @@ -930,7 +783,7 @@ const ApplicantStages = (props: any) => {
  • -
    +
    ); }; diff --git a/src/redux/actions/applicationStage.ts b/src/redux/actions/applicationStage.ts index 563200285..badaabe1b 100644 --- a/src/redux/actions/applicationStage.ts +++ b/src/redux/actions/applicationStage.ts @@ -4,8 +4,6 @@ import { advanceToNextStage, filterByStage, getApplicantStage, - sendInterviewInvitation, - updateInterviewStatus, sendInvitation, } from "../actiontypes/applicationTypes"; import toast from "react-hot-toast"; @@ -171,42 +169,29 @@ export const filterStage = (stage: string) => async (dispatch: any) => { try { const response = await axios.post("/", { query: `query GetApplicantsByStage($stage: String!) { - getApplicantsByStage(stage: $stage) { - applicant { - _id - applicationPhase - email - firstName - lastName - status - } - technicalInterviews { - _id - meetingLink - meetingPlatform - status - scheduledDate - createdAt - updatedAt - coordinatorId { - firstname - lastname - } - } + getApplicantsByStage(stage: $stage) { + applicant { + _id + applicationPhase + email + firstName + lastName status - comments - score - platform - invitationLink - updatedAt - createdAt - } - }`, + } + status + comments + score + platform + invitationLink + updatedAt + createdAt + } +}`, variables: { stage: stage, }, }); - if (response.data?.data?.getApplicantsByStage) { + if (response.data.data !== undefined || response.data.data !== null) { dispatch({ type: filterByStage.FILTER_STAGE_SUCCESS, data: response.data.data.getApplicantsByStage, @@ -222,12 +207,7 @@ export const filterStage = (stage: string) => async (dispatch: any) => { }; export const sendInvitations = - ( - applicantId: string, - email: string, - platform: string, - invitationLink: string - ) => + (applicantId: string, email: string, platform:string, invitationLink: string) => async (dispatch: any) => { dispatch({ type: sendInvitation.SEND_INVITATION_STAGE_LOADING, @@ -242,17 +222,14 @@ export const sendInvitations = success } }`, - variables: { + variables:{ applicantId: applicantId, email: email, platform: platform, invitationLink: invitationLink, - }, + } }); - - const invitationResponse = response.data?.data?.sendInvitation; - - if (invitationResponse) { + if (response.data.data !== undefined || response.data.data !== null) { dispatch({ type: sendInvitation.SEND_INVITATION_STAGE_SUCCESS, data: response.data.data.sendInvitation, @@ -267,111 +244,3 @@ export const sendInvitations = console.error(error); } }; -export const sendInterviewInvitations = - ( - applicantId: string, - coordinatorId: string, - meetingLink: string, - scheduledDate: string, - meetingPlatform: string - ) => - async (dispatch: any) => { - dispatch({ - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_LOADING, - message: "loading", - }); - - try { - const response = await axios.post("/", { - query: `mutation ScheduleTechnicalInterview($input: ScheduleInterviewInput!) { - scheduleTechnicalInterview(input: $input) { - success - message - } -}`, - variables: { - input: { - applicantId, - coordinatorId, - meetingLink, - scheduledDate, - meetingPlatform, - }, - }, - }); - - console.log("Full response:", response.data); - - if (response.data?.data?.scheduleTechnicalInterview) { - dispatch({ - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_SUCCESS, - data: response.data.data.scheduleTechnicalInterview, - }); - toast.success(response.data.data.scheduleTechnicalInterview.message); - } else if (response.data.errors) { - const errorMessage = response.data.errors[0].message; - dispatch({ - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_FAIL, - error: errorMessage, - }); - toast.error(errorMessage); - } else { - dispatch({ - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_FAIL, - error: "No data returned from the server", - }); - toast.error("Failed to schedule interview"); - } - } catch (error) { - dispatch({ - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_FAIL, - error, - }); - console.error(error); - } - }; - -export const updateInterviewStatuses = - (interviewId: string, status: string) => async (dispatch: any) => { - dispatch({ - type: updateInterviewStatus.UPDATE_INTERVIEW_STATUS_LOADING, - message: "loading", - }); - - try { - const response = await axios.post("/", { - query: `mutation UpdateInterviewStatus($interviewId: ID!, $status: String!) { - updateInterviewStatus(interviewId: $interviewId, status: $status) { - success - message - } - }`, - variables: { - interviewId, - status, - }, - }); - - if (response.data?.data?.updateInterviewStatus) { - dispatch({ - type: updateInterviewStatus.UPDATE_INTERVIEW_STATUS_SUCCESS, - data: response.data.data.updateInterviewStatus, - }); - toast.success(response.data.data.updateInterviewStatus.message); - } else if (response.data.errors) { - const errorMessage = response.data.errors[0].message; - dispatch({ - type: updateInterviewStatus.UPDATE_INTERVIEW_STATUS_FAIL, - error: errorMessage, - }); - toast.error(errorMessage); - } - } catch (error) { - dispatch({ - type: updateInterviewStatus.UPDATE_INTERVIEW_STATUS_FAIL, - error: "Failed to update interview status", - }); - console.error(error); - toast.error("Failed to update interview status"); - } - }; diff --git a/src/redux/actions/deletetraine.ts b/src/redux/actions/deletetraine.ts index 6fda2df20..d484c58ff 100644 --- a/src/redux/actions/deletetraine.ts +++ b/src/redux/actions/deletetraine.ts @@ -164,23 +164,6 @@ export const fetchtraine = ({ page, itemsPerPage, All }: any) => { resumeUrl cycle_id { name - startDate - endDate - } - technicalInterviews { - _id - meetingLink - meetingPlatform - status - scheduledDate - createdAt - updatedAt - coordinatorId { - _id - firstname - lastname - email - } } } itemsPerPage @@ -204,7 +187,7 @@ export const fetchtraine = ({ page, itemsPerPage, All }: any) => { } ) .then((res) => { - console.log("All traineessss", res); + console.log("All traineessss", res) if (res.data.data) { dispatch({ type: fetchtrainesss.fetchtraines_success, diff --git a/src/redux/actions/users.ts b/src/redux/actions/users.ts index ff9668e73..ecad6adf9 100644 --- a/src/redux/actions/users.ts +++ b/src/redux/actions/users.ts @@ -9,10 +9,12 @@ import { } from ".."; import creator from "./creator"; -export const getAllMembers = () => async (dispatch: any) => { - try { - const data = await axios.post("/", { - query: ` + +export const getAllMembers=() => async (dispatch: any) => { + + try { + const data = await axios.post("/", + { query: ` query getMembers { getUsers_Logged { firstname @@ -37,19 +39,22 @@ export const getAllMembers = () => async (dispatch: any) => { telephone } } - `, - }); + ` + } + ); dispatch({ type: fetchUser.fetchMembers, - data: data.data, + data: data.data + , }); - + return data.data; - } catch (err) { +} catch (err){ console.log(err); return err; - } -}; + +} +} export const getSingleUser = (userId: string) => async (dispatch: any) => { try { const { data } = await axios.post("/", { @@ -142,10 +147,11 @@ export const update_User = } }; -export const assignMemberRoles = async (userId, roleId) => { +export const assignMemberRoles= async (userId, roleId) => { + try { - const data = await axios.post("/", { - query: ` + const data = await axios.post("/", + { query: ` mutation Mutation( $assignRoleToUserId2: ID!, $roleId: ID!) { assignRoleToUser(ID: $assignRoleToUserId2, roleID: $roleId) { role { @@ -165,24 +171,30 @@ export const assignMemberRoles = async (userId, roleId) => { } } - `, - variables: { - assignRoleToUserId2: userId, - roleId, - }, - }); - - return data.data; - } catch (err) { - console.log(err); - return err; - } -}; + ` + , + variables: { + assignRoleToUserId2: userId, + roleId + } + } + ); + + return data.data; + +} catch (err){ + console.log(err); + return err; + +} +} -export const getUserbyFilter = async (filter) => { - try { - const data = await axios.post("/", { - query: ` +export const getUserbyFilter= async (filter) => { + + try{ + const data = await axios.post("/", + { + query: ` query GetByFilter($filter: UserFilterInput!) { getByFilter(filter: $filter) { id @@ -201,18 +213,18 @@ export const getUserbyFilter = async (filter) => { } `, - variables: { - filter: { - ...filter, - }, - }, - }); - return data.data; - } catch (err) { - console.log(err); - return err; - } -}; + variables: { + filter: { + ...filter + } + } + }); + return data.data; + } catch (err){ + console.log(err); + return err; + } +} export const updateUserSelf = async (id: string, data: object) => { const query = ` @@ -225,7 +237,7 @@ export const updateUserSelf = async (id: string, data: object) => { id, editUserInput: { ...data }, }; - + try { const response = await axios.post("/", { query, @@ -243,7 +255,6 @@ export const getAllCoordinators = () => async (dispatch: any) => { query: ` query getMembers { getUsers_Logged { - id firstname lastname email @@ -267,8 +278,8 @@ export const getAllCoordinators = () => async (dispatch: any) => { data: coordinators, }); - return coordinators; + return coordinators.length; } catch (err) { - return 0; + return 0; } }; diff --git a/src/redux/actiontypes/applicationTypes.ts b/src/redux/actiontypes/applicationTypes.ts index b54b29f86..91e92e88e 100644 --- a/src/redux/actiontypes/applicationTypes.ts +++ b/src/redux/actiontypes/applicationTypes.ts @@ -1,41 +1,37 @@ export enum fetchMyApplications { - FETCH_MYAPPLICATIONS_LOADING = "FETCH_MY_APPLICATIONS_LOADING", - FETCH_MYAPPLICATIONS_SUCCESS = "FETCH_MY_APPLICATIONS_SUCCESS", - FETCH_MYAPPLICATIONS_FAIL = "FETCH_MY_APPLICATIONS_FAIL", - APPLICATION_DELETED_SUCCESS = "APPLICATION_DELETED_SUCCESS", + FETCH_MYAPPLICATIONS_LOADING = 'FETCH_MY_APPLICATIONS_LOADING', + FETCH_MYAPPLICATIONS_SUCCESS = 'FETCH_MY_APPLICATIONS_SUCCESS', + FETCH_MYAPPLICATIONS_FAIL = 'FETCH_MY_APPLICATIONS_FAIL', + APPLICATION_DELETED_SUCCESS = 'APPLICATION_DELETED_SUCCESS', } export enum deleteOwnApplication { - DELETE_APPLICATION_LOADING = "DELETE_APPLICATION_LOADING", - DELETE_APPLICATION_SUCCESS = "DELETE_APPLICATION_SUCCESS", - DELETE_APPLICATION_FAIL = "DELETE_APPLICATION_FAIL", + DELETE_APPLICATION_LOADING = 'DELETE_APPLICATION_LOADING', + DELETE_APPLICATION_SUCCESS = 'DELETE_APPLICATION_SUCCESS', + DELETE_APPLICATION_FAIL = 'DELETE_APPLICATION_FAIL', } export enum fetchSingleOwnApplication { - FETCH_SINGLE_APPLICATION_LOADING = "FETCH_SINGLE_APPLICATION_LOADING", - FETCH_SINGLE_APPLICATION_SUCCESS = "FETCH_SINGLE_APPLICATION_SUCCESS", - FETCH_SINGLE_APPLICATION_FAIL = "FETCH_SINGLE_APPLICATION_FAIL", + FETCH_SINGLE_APPLICATION_LOADING = 'FETCH_SINGLE_APPLICATION_LOADING', + FETCH_SINGLE_APPLICATION_SUCCESS = 'FETCH_SINGLE_APPLICATION_SUCCESS', + FETCH_SINGLE_APPLICATION_FAIL = 'FETCH_SINGLE_APPLICATION_FAIL', } export enum advanceToNextStage { - ADVANCE_TO_NEXT_STAGE_LOADING = "ADVANCE_TO_NEXT_STAGE_LOADING", - ADVANCE_TO_NEXT_STAGE_SUCCESS = "ADVANCE_TO_NEXT_STAGE_SUCCESS", - ADVANCE_TO_NEXT_STAGE_FAIL = "ADVANCE_TO_NEXT_STAGE_FAIL", -} -export enum updateInterviewStatus { - UPDATE_INTERVIEW_STATUS_LOADING = "UPDATE_INTERVIEW_STATUS_LOADING", - UPDATE_INTERVIEW_STATUS_SUCCESS = "UPDATE_INTERVIEW_STATUS_SUCCESS", - UPDATE_INTERVIEW_STATUS_FAIL = "UPDATE_INTERVIEW_STATUS_FAIL", + ADVANCE_TO_NEXT_STAGE_LOADING = 'ADVANCE_TO_NEXT_STAGE_LOADING', + ADVANCE_TO_NEXT_STAGE_SUCCESS = 'ADVANCE_TO_NEXT_STAGE_SUCCESS', + ADVANCE_TO_NEXT_STAGE_FAIL = 'ADVANCE_TO_NEXT_STAGE_FAIL', } export enum getApplicantStage { - GET_APPLICANT_STAGE_LOADING = "GET_APPLICANT_STAGE_LOADING", - GET_APPLICANT_STAGE_SUCCESS = "GET_APPLICANT_STAGE_SUCCESS", - GET_APPLICANT_STAGE_FAIL = "GET_APPLICANT_STAGE_FAIL", + GET_APPLICANT_STAGE_LOADING = 'GET_APPLICANT_STAGE_LOADING', + GET_APPLICANT_STAGE_SUCCESS = 'GET_APPLICANT_STAGE_SUCCESS', + GET_APPLICANT_STAGE_FAIL = 'GET_APPLICANT_STAGE_FAIL', } export enum addStageMark { ADD_STAGE_MARK_LOADING = "ADD_STAGE_MARK_LOADING", ADD_STAGE_MARK_SUCCESS = "ADD_STAGE_MARK_SUCCESS", ADD_STAGE_MARK_FAIL = "ADD_STAGE_MARK_FAIL", + } export enum filterByStage { @@ -49,11 +45,6 @@ export enum sendInvitation { SEND_INVITATION_STAGE_SUCCESS = "SEND_INVITATION_STAGE_SUCCESS", SEND_INVITATION_STAGE_FAIL = "SEND_INVITATION_STAGE_FAIL", } -export enum sendInterviewInvitation { - SEND_INTERVIEW_INVITATION_STAGE_LOADING = "SEND_INTERVIEW_INVITATION_STAGE_LOADING", - SEND_INTERVIEW_INVITATION_STAGE_SUCCESS = "SEND_INTERVIEW_INVITATION_STAGE_SUCCESS", - SEND_INTERVIEW_INVITATION_STAGE_FAIL = "SEND_INTERVIEW_INVITATION_STAGE_FAIL", -} interface actionPending { type: fetchMyApplications.FETCH_MYAPPLICATIONS_LOADING; } @@ -115,84 +106,57 @@ interface advanceToNextStageActionFail { message: any; } -interface updateInterviewStatusActionPending { - type: updateInterviewStatus.UPDATE_INTERVIEW_STATUS_LOADING; -} -interface updateInterviewStatusActionSuccess { - type: updateInterviewStatus.UPDATE_INTERVIEW_STATUS_SUCCESS; - message: string; - data: any; -} - -interface updateInterviewStatusActionFail { - type: updateInterviewStatus.UPDATE_INTERVIEW_STATUS_FAIL; - message: any; -} - -interface getApplicantStageActionPending { +interface getApplicantStageActionPending{ type: getApplicantStage.GET_APPLICANT_STAGE_LOADING; } -interface getApplicantStageActionSuccess { +interface getApplicantStageActionSuccess{ type: getApplicantStage.GET_APPLICANT_STAGE_SUCCESS; message: string; data: any; } -interface getApplicantStageActionFail { +interface getApplicantStageActionFail{ type: getApplicantStage.GET_APPLICANT_STAGE_FAIL; error: any; } -interface addStageMarkActionPending { +interface addStageMarkActionPending{ type: addStageMark.ADD_STAGE_MARK_LOADING; } -interface addStageMarkActionSuccess { +interface addStageMarkActionSuccess{ type: addStageMark.ADD_STAGE_MARK_SUCCESS; message: string; data: any; } -interface filterByStageActionFail { +interface filterByStageActionFail{ type: filterByStage.FILTER_STAGE_FAIL; message: any; } -interface filterByStageActionPending { +interface filterByStageActionPending{ type: filterByStage.FILTER_STAGE_LOADING; } -interface filterByStageActionSuccess { +interface filterByStageActionSuccess{ type: filterByStage.FILTER_STAGE_SUCCESS; message: string; data: any; } -interface sendInvitationActionFail { +interface sendInvitationActionFail{ type: sendInvitation.SEND_INVITATION_STAGE_FAIL; message: any; } -interface sendInvitationActionPending { +interface sendInvitationActionPending{ type: sendInvitation.SEND_INVITATION_STAGE_LOADING; } -interface sendInvitationActionSuccess { +interface sendInvitationActionSuccess{ type: sendInvitation.SEND_INVITATION_STAGE_SUCCESS; message: string; data: any; } -interface sendInterviewInvitationActionFail { - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_FAIL; - message: any; -} - -interface sendInterviewInvitationActionPending { - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_LOADING; -} -interface sendInterviewInvitationActionSuccess { - type: sendInterviewInvitation.SEND_INTERVIEW_INVITATION_STAGE_SUCCESS; - message: string; - data: any; -} -interface addStageMarkActionFail { +interface addStageMarkActionFail{ type: addStageMark.ADD_STAGE_MARK_FAIL; message: any; } @@ -210,9 +174,6 @@ export type Action = | advanceToNextStageActionPending | advanceToNextStageActionFail | advanceToNextStageActionSuccess - | updateInterviewStatusActionPending - | updateInterviewStatusActionFail - | updateInterviewStatusActionSuccess | getApplicantStageActionPending | getApplicantStageActionFail | getApplicantStageActionSuccess @@ -225,6 +186,3 @@ export type Action = | sendInvitationActionPending | sendInvitationActionFail | sendInvitationActionSuccess - | sendInterviewInvitationActionPending - | sendInterviewInvitationActionFail - | sendInterviewInvitationActionSuccess; diff --git a/src/redux/index.ts b/src/redux/index.ts index 9127c0ddf..ccbbcf383 100644 --- a/src/redux/index.ts +++ b/src/redux/index.ts @@ -1,69 +1,68 @@ -export const INCREMENT = "INCREMENT"; -export const DECREMENT = "DECREMENT"; -export const GET_ONE_TRAINEES_ALL_DETAILS = "GET_ONE_TRAINEES_ALL_DETAILS"; -export const GET_TRAINEE = "GET_TRAINEE"; -export const SET_TRAINEE = "SET_TRAINEE"; -export const CREATE_TRAINEES = "CREATE_TRAINEES"; -export const GET_CYCLES = "GET_CYCLES"; -export const CREATE_CYCLES = "CREATE_CYCLES"; -export const UPDATE_CYCLE = "UPDATE_CYCLE"; -export const DELETE_CYCLE = "DELETE_CYCLE"; -export const CREATE_CYCLE_ERROR = "CREATE_CYCLE_ERROR"; -export const UPDATE_CYCLE_ERROR = "UPDATE_CYCLE_ERROR"; -export const DELETE_CYCLE_ERROR = "DELETE_CYCLE_ERROR"; -export const GET_SOFT_DELETED_TRAINEES = "GET_SOFT_DELETED_TRAINEES"; -export const GET_SOFT_DELETED_TRAINEES_ERROR = - "GET_SOFT_DELETED_TRAINEES_ERROR"; -export const GET_ALL_FILTERED_TRAINEES = "GET_ALL_FILTERED_TRAINEES"; -export const GET_ALL_FILTERED_PROGRAMS = "GET_ALL_FILTERED_PROGRAMS"; -export const GET_ALL_FILTERED_JOB_POST = "GET_ALL_FILTERED_JOB_POST"; -export const GET_ALL_FILTERED_ROLES_ACCESS = "GET_ALL_FILTERED_ROLES_ACCESS"; -export const LOAD_DATA_INTO_DB_REQUEST = "LOAD_DATA_INTO_DB_REQUEST"; -export const LOAD_DATA_INTO_DB_SUCCESS = "LOAD_DATA_INTO_DB_SUCCESS"; -export const LOAD_DATA_INTO_DB_FAIL = "LOAD_DATA_INTO_DB_FAIL"; -export const RESEND_MAPPED_DATA_INTO_DB = "RESEND_MAPPED_DATA_INTO_DB"; -export const GET_TRAINEE_TO_UPDATE = "GET_TRAINEE_TO_UPDATE"; -export const GET_TRAINEE_TO_UPDATE_FAIL = "GET_TRAINEE_TO_UPDATE_FAIL"; -export const UPDATE_TRAINEE = "UPDATE_TRAINEE"; -export const UPDATE_TRAINEE_FAIL = "UPDATE_TRAINEE_FAIL"; -export const UPDATE_TRAINEE_ATTRIBUTE = "UPDATE_TRAINEE_ATTRIBUTE"; -export const UPDATE_TRAINEE_ATTRIBUTE_FAIL = "UPDATE_TRAINEE_ATTRIBUTE_FAIL"; -export const EMPTYING_TRASH = "EMPTYING_TRASH"; -export const GET_ONE_TRAINEE_SCORE = "GET_ONE_TRAINEE_SCORE"; -export const UPDATE_TRAINEE_SCORE = "UPDATE_TRAINEE_SCORE"; -export const CREATE_TRAINEE_SCORE = "CREATE_TRAINEE_SCORE"; -export const GET_SCORE_TYPES = "GET_SCORE_TYPES"; -export const CREATE_SCORE_TYPE = "CREATE_SCORE_TYPE"; -export const CREATE_SCORE_ERROR = "CREATE_SCORE_ERROR"; -export const GET_ONE_SCORE_TYPE = "GET_ONE_SCORE_TYPE"; -export const GET_SCORE_VALUES = "GET_SCORE_VALUES"; -export const CREATE_SCORE_VALUES = "CREATE_SCORE_VALUES"; -export const CREATE_SCORE_VALUE_ERROR = "CREATE_SCORE_VALUE_ERROR"; -export const DELETE_SCORE_TYPE = "DELETE_SCORE_TYPE"; -export const DELETE_SCORE_ERROR = "DELETE_SCORE_ERROR"; -export const UPDATE_SCORE_TYPE = "UPDATE_SCORE_TYPE"; -export const UPDATE_SCORE_ERROR = "UPDATE_SCORE_ERROR"; -export const UPDATE_SCORE_VALUE = "UPDATE_SCORE_VALUE"; -export const UPDATE_SCORE_VALUE_ERROR = "UPDATE_SCORE_VALUE_ERROR"; -export const DELETE_SCORE_VALUE = "DELETE_SCORE_VALUE"; -export const DELETE_SCORE_VALUE_ERROR = "DELETE_SCORE_VALUE_ERROR"; -export const UPDATE_MANY_SCORE_VALUES = "UPDATE_MANY_SCORE_VALUES"; -export const UPDATE_TRAINEE_STATUS_FAIL = "UPDATE_TRAINEE_STATUS_FAIL"; -export const UPDATE_TRAINEE_STATUS = "UPDATE_TRAINEE_STATUS"; -export const LOGIN_USER = "LOGIN_USER"; -export const SEND_EMAIL = "SEND_EMAIL"; -export const SEND_EMAIL_ERROR = "SEND_EMAIL_ERROR"; -export const MY_APPLICATIONS = "MY_APPLICATIONS"; -export const GET_PROGRAMS = "GET_PROGRAMS"; -export const GET_Docs = "GET_Docs"; -export const GET_COHORTS = "GET_COHORTS"; -export const GET_TRAINEE_COHORT = "GET__TRAINEE_COHORT"; -export const CREATE_COHORT_SUCCESS = "CREATE_COHORT_SUCCESS"; -export const CREATE_COHORT_ERROR = "CREATE_COHORT_ERROR"; -export const GET_ONE_JOB_POST_ALL_DETAILS = "GET_ONE_JOB_POST_ALL_DETAILS"; -export const GET_TRAINEE_ATTENDANCE = "GET_TRAINEE_ATTENDANCE"; -export const GET_TRAINEE_PERFORMANCE = "GET_TRAINEE_PERFORMANCE"; -export const SINGLE_USER = "SINGLE_USER"; +export const INCREMENT = 'INCREMENT'; +export const DECREMENT = 'DECREMENT'; +export const GET_ONE_TRAINEES_ALL_DETAILS = 'GET_ONE_TRAINEES_ALL_DETAILS'; +export const GET_TRAINEE = 'GET_TRAINEE'; +export const SET_TRAINEE = 'SET_TRAINEE'; +export const CREATE_TRAINEES = 'CREATE_TRAINEES'; +export const GET_CYCLES = 'GET_CYCLES'; +export const CREATE_CYCLES = 'CREATE_CYCLES'; +export const UPDATE_CYCLE = 'UPDATE_CYCLE'; +export const DELETE_CYCLE = 'DELETE_CYCLE'; +export const CREATE_CYCLE_ERROR = 'CREATE_CYCLE_ERROR'; +export const UPDATE_CYCLE_ERROR = 'UPDATE_CYCLE_ERROR'; +export const DELETE_CYCLE_ERROR = 'DELETE_CYCLE_ERROR'; +export const GET_SOFT_DELETED_TRAINEES = 'GET_SOFT_DELETED_TRAINEES'; +export const GET_SOFT_DELETED_TRAINEES_ERROR ='GET_SOFT_DELETED_TRAINEES_ERROR'; +export const GET_ALL_FILTERED_TRAINEES = 'GET_ALL_FILTERED_TRAINEES'; +export const GET_ALL_FILTERED_PROGRAMS = 'GET_ALL_FILTERED_PROGRAMS'; +export const GET_ALL_FILTERED_JOB_POST = 'GET_ALL_FILTERED_JOB_POST'; +export const GET_ALL_FILTERED_ROLES_ACCESS = 'GET_ALL_FILTERED_ROLES_ACCESS'; +export const LOAD_DATA_INTO_DB_REQUEST = 'LOAD_DATA_INTO_DB_REQUEST'; +export const LOAD_DATA_INTO_DB_SUCCESS = 'LOAD_DATA_INTO_DB_SUCCESS'; +export const LOAD_DATA_INTO_DB_FAIL = 'LOAD_DATA_INTO_DB_FAIL'; +export const RESEND_MAPPED_DATA_INTO_DB = 'RESEND_MAPPED_DATA_INTO_DB'; +export const GET_TRAINEE_TO_UPDATE = 'GET_TRAINEE_TO_UPDATE'; +export const GET_TRAINEE_TO_UPDATE_FAIL = 'GET_TRAINEE_TO_UPDATE_FAIL'; +export const UPDATE_TRAINEE = 'UPDATE_TRAINEE'; +export const UPDATE_TRAINEE_FAIL = 'UPDATE_TRAINEE_FAIL'; +export const UPDATE_TRAINEE_ATTRIBUTE = 'UPDATE_TRAINEE_ATTRIBUTE'; +export const UPDATE_TRAINEE_ATTRIBUTE_FAIL = 'UPDATE_TRAINEE_ATTRIBUTE_FAIL'; +export const EMPTYING_TRASH = 'EMPTYING_TRASH'; +export const GET_ONE_TRAINEE_SCORE = 'GET_ONE_TRAINEE_SCORE'; +export const UPDATE_TRAINEE_SCORE = 'UPDATE_TRAINEE_SCORE'; +export const CREATE_TRAINEE_SCORE = 'CREATE_TRAINEE_SCORE'; +export const GET_SCORE_TYPES = 'GET_SCORE_TYPES'; +export const CREATE_SCORE_TYPE = 'CREATE_SCORE_TYPE'; +export const CREATE_SCORE_ERROR = 'CREATE_SCORE_ERROR'; +export const GET_ONE_SCORE_TYPE = 'GET_ONE_SCORE_TYPE'; +export const GET_SCORE_VALUES = 'GET_SCORE_VALUES'; +export const CREATE_SCORE_VALUES = 'CREATE_SCORE_VALUES'; +export const CREATE_SCORE_VALUE_ERROR = 'CREATE_SCORE_VALUE_ERROR'; +export const DELETE_SCORE_TYPE = 'DELETE_SCORE_TYPE'; +export const DELETE_SCORE_ERROR = 'DELETE_SCORE_ERROR'; +export const UPDATE_SCORE_TYPE = 'UPDATE_SCORE_TYPE'; +export const UPDATE_SCORE_ERROR = 'UPDATE_SCORE_ERROR'; +export const UPDATE_SCORE_VALUE = 'UPDATE_SCORE_VALUE'; +export const UPDATE_SCORE_VALUE_ERROR = 'UPDATE_SCORE_VALUE_ERROR'; +export const DELETE_SCORE_VALUE = 'DELETE_SCORE_VALUE'; +export const DELETE_SCORE_VALUE_ERROR = 'DELETE_SCORE_VALUE_ERROR'; +export const UPDATE_MANY_SCORE_VALUES = 'UPDATE_MANY_SCORE_VALUES'; +export const UPDATE_TRAINEE_STATUS_FAIL = 'UPDATE_TRAINEE_STATUS_FAIL'; +export const UPDATE_TRAINEE_STATUS = 'UPDATE_TRAINEE_STATUS'; +export const LOGIN_USER = 'LOGIN_USER'; +export const SEND_EMAIL = 'SEND_EMAIL'; +export const SEND_EMAIL_ERROR = 'SEND_EMAIL_ERROR'; +export const MY_APPLICATIONS = 'MY_APPLICATIONS'; +export const GET_PROGRAMS = 'GET_PROGRAMS'; +export const GET_Docs = 'GET_Docs'; +export const GET_COHORTS = 'GET_COHORTS'; +export const GET_TRAINEE_COHORT = 'GET__TRAINEE_COHORT'; +export const CREATE_COHORT_SUCCESS = 'CREATE_COHORT_SUCCESS'; +export const CREATE_COHORT_ERROR = 'CREATE_COHORT_ERROR'; +export const GET_ONE_JOB_POST_ALL_DETAILS = 'GET_ONE_JOB_POST_ALL_DETAILS'; +export const GET_TRAINEE_ATTENDANCE = 'GET_TRAINEE_ATTENDANCE'; +export const GET_TRAINEE_PERFORMANCE = 'GET_TRAINEE_PERFORMANCE'; +export const SINGLE_USER = 'SINGLE_USER'; export const SINGLE_USER_FAIL = "SINGLE_USER_FAIL"; export const USER_TO_UPDATE = "USER_TO_UPDATE"; export const USER_TO_UPDATE_FAIL = "USER_TO_UPDATE_FAIL"; @@ -109,16 +108,13 @@ export const FETCH_USER_BLOGS_FAIL = "FETCH_USER_BLOGS_FAIL"; export const FETCH_SINGLE_BLOG_LOADING = "FETCH_SINGLE_BLOG_LOADING"; export const FETCH_SINGLE_BLOG_SUCCESS = "FETCH_SINGLE_BLOG_SUCCESS"; export const FETCH_SINGLE_BLOG_FAIL = "FETCH_SINGLE_BLOG_FAIL"; -export const FETCH_BLOG_RELATED_ARTICLE_LOADING = - "FETCH_BLOG_RELATED_ARTICLE_LOADING"; -export const FETCH_BLOG_RELATED_ARTICLE_SUCCESS = - "FETCH_BLOG_RELATED_ARTICLE_SUCCESS"; -export const FETCH_BLOG_RELATED_ARTICLE_FAIL = - "FETCH_BLOG_RELATED_ARTICLE_FAIL"; +export const FETCH_BLOG_RELATED_ARTICLE_LOADING = "FETCH_BLOG_RELATED_ARTICLE_LOADING"; +export const FETCH_BLOG_RELATED_ARTICLE_SUCCESS = "FETCH_BLOG_RELATED_ARTICLE_SUCCESS"; +export const FETCH_BLOG_RELATED_ARTICLE_FAIL = "FETCH_BLOG_RELATED_ARTICLE_FAIL"; export const HIDE_BLOG_LOADING = "HIDE_BLOG_LOADING"; export const HIDE_BLOG_SUCCESS = "HIDE_BLOG_SUCCESS"; -export const HIDE_BLOG_FAIL = "HIDE_BLOG_FAIL"; -export const GET_DOCS_BY_ROLE = "GET_DOCS_BY_ROLE"; +export const HIDE_BLOG_FAIL = "HIDE_BLOG_FAIL" +export const GET_DOCS_BY_ROLE="GET_DOCS_BY_ROLE" export const FETCH_COMMENTS_LOADING = "FETCH_COMMENTS_LOADING"; export const FETCH_COMMENTS_SUCCESS = "FETCH_COMMENTS_SUCCESS"; export const FETCH_COMMENTS_FAIL = "FETCH_COMMENTS_FAIL"; diff --git a/src/redux/reducers/applicationReducer.ts b/src/redux/reducers/applicationReducer.ts index e606ff08b..daa4909e9 100644 --- a/src/redux/reducers/applicationReducer.ts +++ b/src/redux/reducers/applicationReducer.ts @@ -1,16 +1,15 @@ -import { toast } from "react-toastify"; +import { toast } from 'react-toastify'; import { Action, fetchMyApplications, deleteOwnApplication, fetchSingleOwnApplication, advanceToNextStage, - updateInterviewStatus, getApplicantStage, addStageMark, filterByStage, - sendInvitation, -} from "../actiontypes/applicationTypes"; + sendInvitation +} from '../actiontypes/applicationTypes'; interface State { success: boolean; @@ -34,10 +33,10 @@ const initial = { error: false, message: null, data: null, -}; +} export const applicationsReducer = ( state: State = initialState, - action: Action + action: Action, ): State => { switch (action.type) { case fetchMyApplications.FETCH_MYAPPLICATIONS_LOADING: @@ -67,7 +66,7 @@ export const applicationsReducer = ( case deleteOwnApplication.DELETE_APPLICATION_SUCCESS: if (!action.data.id) { - toast.error("Application has already been withdrawn"); + toast.error('Application has already been withdrawn'); } return { // remove the application from the state @@ -75,7 +74,7 @@ export const applicationsReducer = ( loading: false, data: { applications: state.data.applications.filter( - (application: any) => application._id !== action.data.id + (application: any) => application._id !== action.data.id, ), }, }; @@ -85,7 +84,7 @@ export const applicationsReducer = ( }; export const singleApplicationReducer = ( state: State = initialState, - action: Action + action: Action, ): State => { switch (action.type) { case fetchSingleOwnApplication.FETCH_SINGLE_APPLICATION_LOADING: @@ -117,10 +116,7 @@ export const singleApplicationReducer = ( } }; -export const FetchApplicantStageReducer = ( - state: State = initial, - action: Action -) => { +export const FetchApplicantStageReducer = (state:State = initial, action:Action) => { switch (action.type) { case getApplicantStage.GET_APPLICANT_STAGE_LOADING: return { @@ -147,12 +143,9 @@ export const FetchApplicantStageReducer = ( default: return state; } -}; +} -export const advanceToNextStageReducer = ( - state: State = initial, - action: Action -) => { +export const advanceToNextStageReducer = (state:State = initial, action:Action) => { switch (action.type) { case advanceToNextStage.ADVANCE_TO_NEXT_STAGE_LOADING: return { @@ -174,7 +167,7 @@ export const advanceToNextStageReducer = ( return { loading: false, error: true, - success: false, + success:false, message: action.message, data: null, }; @@ -182,12 +175,9 @@ export const advanceToNextStageReducer = ( default: return state; } -}; +} -export const AddApplicantScoreReducer = ( - state: State = initial, - action: Action -) => { +export const AddApplicantScoreReducer = (state:State = initial, action:Action) => { switch (action.type) { case addStageMark.ADD_STAGE_MARK_LOADING: return { @@ -214,12 +204,9 @@ export const AddApplicantScoreReducer = ( default: return state; } -}; +} -export const filterApplicantByStageReducer = ( - state: State = initial, - action: Action -) => { +export const filterApplicantByStageReducer = (state:State = initial, action:Action) => { switch (action.type) { case filterByStage.FILTER_STAGE_LOADING: return { @@ -246,12 +233,9 @@ export const filterApplicantByStageReducer = ( default: return state; } -}; +} -export const sendInvitationReducer = ( - state: State = initial, - action: Action -) => { +export const sendInvitationReducer = (state:State = initial, action:Action) => { switch (action.type) { case sendInvitation.SEND_INVITATION_STAGE_LOADING: return { @@ -278,36 +262,4 @@ export const sendInvitationReducer = ( default: return state; } -}; - -export const updateInterviewStatusReducer = ( - state: State = initial, - action: Action -) => { - switch (action.type) { - case updateInterviewStatus.UPDATE_INTERVIEW_STATUS_LOADING: - return { - loading: true, - success: false, - error: null, - message: null, - data: null, - }; - case updateInterviewStatus.UPDATE_INTERVIEW_STATUS_SUCCESS: - return { - loading: false, - success: true, - message: action.message, - data: action.data, - }; - case updateInterviewStatus.UPDATE_INTERVIEW_STATUS_FAIL: - return { - loading: false, - message: action.message, - data: null, - }; - - default: - return state; - } -}; +} \ No newline at end of file diff --git a/src/redux/reducers/index.ts b/src/redux/reducers/index.ts index 2ef59088e..a670a9588 100644 --- a/src/redux/reducers/index.ts +++ b/src/redux/reducers/index.ts @@ -42,9 +42,8 @@ import { FetchApplicantStageReducer, AddApplicantScoreReducer, advanceToNextStageReducer, - updateInterviewStatusReducer, filterApplicantByStageReducer, - sendInvitationReducer, + sendInvitationReducer } from "./applicationReducer"; import filterTicketReducer from "./filterTicketReducer"; @@ -126,7 +125,6 @@ const allReducers = combineReducers({ traineePerformance: performanceReducer, loggedUser: getLoggedUserReducer, nextStage: advanceToNextStageReducer, - interviewStatus: updateInterviewStatusReducer, fetchApplicantStage: FetchApplicantStageReducer, AddedApplicantScore: AddApplicantScoreReducer, filterApplicantByStage: filterApplicantByStageReducer, diff --git a/src/redux/reducers/usersReducer.ts b/src/redux/reducers/usersReducer.ts index 3a8aac82a..efc5611bb 100644 --- a/src/redux/reducers/usersReducer.ts +++ b/src/redux/reducers/usersReducer.ts @@ -1,44 +1,45 @@ import { - Action, - fetchtrainesss, - fetchtrainapplicantscount, - fetchtrainapplicantcount, - fetchMembers, - fetchUser, -} from "../actiontypes/deleteactiontype"; + Action, + fetchtrainesss, + fetchtrainapplicantscount, + fetchtrainapplicantcount, + fetchMembers, + fetchUser, + } from "../actiontypes/deleteactiontype"; -interface State { - success: boolean; - loading: boolean; - error: any; - message: any; -} -const initialState = { - loading: false, - success: false, - error: null, - message: null, -}; + interface State { + success: boolean; + loading: boolean; + error: any; + message: any; + } -const traineState = { - loading: false, - success: false, - error: null, - message: null, -}; + const initialState = { + loading: false, + success: false, + error: null, + message: null, + }; -export const membersReducer = ( - state: any = traineState, - action: fetchMembers -): State => { - switch (action.type) { - case fetchUser.fetchMembers: - return { - ...state, - message: action.data, - }; - default: - return state; - } -}; + const traineState = { + loading: false, + success: false, + error: null, + message: null, + }; + + export const membersReducer = ( + state: any = traineState, + action: fetchMembers + ): State => { + switch (action.type) { + case fetchUser.fetchMembers: + return { + ...state, + message: action.data.data, + }; + default: + return state; + } + }; \ No newline at end of file diff --git a/src/routes/routes.tsx b/src/routes/routes.tsx index 84a3a3da1..a6d645baf 100644 --- a/src/routes/routes.tsx +++ b/src/routes/routes.tsx @@ -67,7 +67,7 @@ import SignupPage from "./../pages/SignupPage"; import ApplicantStages from "./../pages/TraineApplicant/ApplicantStages"; import AdminNotification from "../pages/AdminNotifications/AdminNotifications"; import { MyApplication } from "../pages/ApplicationCycle/myApplication"; -import ApplyJobPost from "../pages/ApplyJobPost"; +import ApplyJobPost from "../pages/ApplyJobPost" import TraineeApply from "../pages/TraineeApply/TraineeApply"; import TraineeAttribute from "../pages/TraineeApply/TraineeAttribute"; @@ -81,9 +81,9 @@ import CohortPage from "../pages/Cohort/Cohort"; import CohortsDetailPage from "../pages/Cohort/CohortDetailPage"; import AllBlogs from "../pages/Blogs/allBlogs"; import SingleBlogView from "../pages/Blogs/singleBlog"; -import SingleBlogPage from "../pages/LandingPage/SingleBlogPage"; +import SingleBlogPage from "../pages/LandingPage/SingleBlogPage" import LandingPage from "../pages/LandingPage/LandingPage"; -import Blogs from "../pages/Blogs/Blogs"; +import Blogs from "../pages/Blogs/Blogs" import Documents from "../pages/documents/documents"; import UpdateDocumentation from "../pages/documents/updateDocumentation"; import SingleDocumentationDetails from "../pages/documents/singleDocumentation"; @@ -100,12 +100,12 @@ function Navigation() { } /> } /> } /> - } /> + }/> } /> } /> } /> } /> - } /> + }/> - {/* Documentation routes */} - @@ -269,6 +270,9 @@ function Navigation() { } /> + + + + - + } /> @@ -480,7 +485,7 @@ function Navigation() { path="ticket/:id" element={ - + } /> @@ -488,7 +493,7 @@ function Navigation() { path="ticket/:id/resolve" element={ - + } /> @@ -496,7 +501,7 @@ function Navigation() { path="tickets" element={ - + } /> @@ -504,7 +509,7 @@ function Navigation() { path="ticket/:id" element={ - + } /> @@ -512,7 +517,7 @@ function Navigation() { path="ticket/:id/resolve" element={ - + } /> @@ -525,6 +530,7 @@ function Navigation() { } /> + {/* Applicant Routes (Protected) */} + } @@ -632,10 +638,11 @@ function Navigation() { } /> - + } @@ -643,12 +650,13 @@ function Navigation() { + } /> + + - + } /> @@ -787,7 +796,7 @@ function Navigation() { path="ticket/:id" element={ - + } /> @@ -795,7 +804,7 @@ function Navigation() { path="ticket/:id/reply" element={ - + } /> @@ -868,6 +877,7 @@ function Navigation() { } /> + {/* Catch-All Route */} { - const validData = interviewData - .filter((item) => item) - .map((item, index) => { - const { email, firstName, lastName } = item.applicant || item; - - // Get interview status - const interviewStatus = - item.technicalInterviews && item.technicalInterviews[0]?.status - ? item.technicalInterviews[0].status - : item.status; - - const meetingPlatform = - item.technicalInterviews && - item.technicalInterviews[0]?.meetingPlatform; - - return { - Count: index + 1, - EMAIL: email, - "FIRST NAME": firstName, - "LAST NAME": lastName, - STATUS: interviewStatus || "N/A", - "MEETING PLATFORM": meetingPlatform || "N/A", - }; - }) - .filter( - (row) => row.EMAIL && row["FIRST NAME"] && row["LAST NAME"] && row.STATUS - ); - - if (validData.length === 0) { - console.warn("No valid data to export!"); - return; - } - - const worksheet = XLSX.utils.json_to_sheet(validData); - - const headerRow = Object.keys(validData[0]); - - headerRow.forEach((header, index) => { - const cellAddress = XLSX.utils.encode_cell({ r: 0, c: index }); - if (!worksheet[cellAddress]) return; - worksheet[cellAddress].s = { - fill: { fgColor: { rgb: "FFFF00" } }, - font: { bold: true, color: { rgb: "000000" } }, - alignment: { horizontal: "center", vertical: "center" }, - }; - }); - - const workbook = XLSX.utils.book_new(); - XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1"); - - const fileName = `${docName}.xlsx`; - XLSX.writeFile(workbook, fileName); - - console.log(`Excel file created: ${fileName}`); -};