Skip to content

Commit

Permalink
Jd access (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanGKulkarni authored Sep 28, 2024
1 parent 732d711 commit 4b49974
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 24 deletions.
24 changes: 13 additions & 11 deletions src/app/(routes)/admin/jobs/[jobId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Link from "next/link";
import { Separator } from "@/components/ui/separator";
import { getJafDetails } from "@/helpers/recruiter/api";
import { JAFdetailsFC } from "@/helpers/recruiter/types";
import { patchJobData } from "@/helpers/api";
import { OpenJD, patchJobData } from "@/helpers/api";
import { patchSalaryData } from "@/helpers/api";
import {
CategorySelectList,
Expand Down Expand Up @@ -104,6 +104,10 @@ const JobDetailPage = ({ params }: { params: { jobId: string } }) => {
fetchData();
}, [params.jobId]);

const handleOpenJD = async (filename: string) => {
OpenJD(filename);
};


const updateFacultyDropDown = (index, value) => {
setFacultyDropdown((prevState) => {
Expand Down Expand Up @@ -361,16 +365,14 @@ const JobDetailPage = ({ params }: { params: { jobId: string } }) => {
</div>
<div>
<div className="font-semibold my-2">Attachment</div>{" "}
{editMode ? (
<input
type="text"
name="attachment"
value={formData.attachment}
onChange={handleChange}
/>
) : (
<div>{job.attachment}</div>
)}
<div
className="text-blue-500 font-semibold cursor-pointer hover:text-blue-600 transition-all fade-in-out"
onClick={() =>
handleOpenJD(job.attachment)
}
>
Link
</div>
</div>
</div>
</div>
Expand Down
22 changes: 11 additions & 11 deletions src/app/(routes)/recruiter/jobs/[jobID]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import React, { useState, useEffect } from "react";
import { JobDetailFC } from "@/helpers/recruiter/types";
import { getJobDetail } from "@/helpers/recruiter/api";
import { getJobDetail, OpenJD } from "@/helpers/recruiter/api";
import loadingImg from "@/../public/loadingSpinner.svg";
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
import PersonIcon from "@mui/icons-material/Person";
Expand Down Expand Up @@ -58,6 +58,10 @@ const JobDetailPage = ({ params }: { params: { jobID: string } }) => {
setFormData((prev) => ({ ...prev, [name]: value }));
};

const handleOpenJD = async (filename: string) => {
OpenJD(filename);
};

const handleSubmit = async () => {
const c1 = await patchJobData(job.id, formData);
if (true) {
Expand Down Expand Up @@ -208,16 +212,12 @@ const JobDetailPage = ({ params }: { params: { jobID: string } }) => {
</div>
<div>
<div className="font-semibold my-2">Attachment</div>{" "}
{editMode ? (
<input
type="text"
name="attachment"
value={formData.attachment}
onChange={handleChange}
/>
) : (
<div>{job.attachment}</div>
)}
<div
className="text-blue-500 font-semibold cursor-pointer hover:text-blue-600 transition-all fade-in-out"
onClick={() =>
handleOpenJD(job.attachment)
}
>{job.attachment? "Link": ""}</div>
</div>
</div>
</div>
Expand Down
9 changes: 7 additions & 2 deletions src/components/jobs/JobCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button";
import { Jobs } from "@/helpers/student/types";
import DOMPurify from 'dompurify';
import "./styles/JobDescription.css"
import { OpenJD } from "@/helpers/student/api";
const baseUrl = process.env.NEXT_PUBLIC_FRONTEND_URL;

const url = (NextUrl: string) => {
Expand All @@ -23,6 +24,10 @@ const JobCard = ({ jobItem, type}: Props) => {
setShowDescription(!showDescription);
};

const handleOpenJD = async (filename: string) => {
OpenJD(filename);
};

return (
<div className="">
<div className="rounded-xl bg-white text-black p-5">
Expand Down Expand Up @@ -70,8 +75,8 @@ const JobCard = ({ jobItem, type}: Props) => {
</div>
</div>
<div>
<div className="text-gray-500 font-semibold my-2">Recruiter</div>{" "}
<div>{jobItem.recruiter.user.name}</div>
<div className="text-gray-500 font-semibold my-2">Attachment</div>{" "}
<div onClick={() => handleOpenJD(jobItem.attachment)} className="text-blue-500 font-semibold cursor-pointer hover:text-blue-600 transition-all fade-in-out">{jobItem.attachment? "Link": ""}</div>
</div>
</div>
{showDescription && (
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ export const getResumeFile = async (fileName: string) => {
OpenFile(`/resumes/file/${fileName}`);
};

export const OpenJD = async (fileName: string) => {
OpenFile(`/jobs/jd/${fileName}`);
};

export const patchResumeVerify = async (changes: ResumePatchData[]) => {
return apiCall(`/resumes`, {
method: "PATCH",
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/recruiter/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export const getResume = (filename: string) => {
OpenFile(`/recruiter-view/resume/${filename}`);
};

export const OpenJD = (filename: string) => {
OpenFile(`/recruiter-view/jd/${filename}`);
};

export const patchJobData = async (jobId: string, changes: JobDetailFC) => {
const patchFormat = {
role: "string",
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/student/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export const OpenInterviewExpirience = async (filename: string) => {
OpenFile(`/student-view/interview-experiences/${filename}`);
};

export const OpenJD = async (filename: string) => {
OpenFile(`/student-view/jd/${filename}`);
};

export const GetStudentData = async () => {
return apiCall("/student-view", { next: { tags: ["Students"] } });
};
Expand Down
1 change: 1 addition & 0 deletions src/helpers/student/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export interface Jobs {
id: string;
role: string;
duration: string;
attachment: string;
description: string;
active: boolean;
currentStatus: string;
Expand Down

0 comments on commit 4b49974

Please sign in to comment.