Skip to content

Commit 9f3d8a7

Browse files
Student attachment (#195)
1 parent a41dd3c commit 9f3d8a7

File tree

6 files changed

+73
-51
lines changed

6 files changed

+73
-51
lines changed

Diff for: public/file.png

1.34 KB
Loading

Diff for: src/app/(routes)/student/job/[jobId]/page.tsx

+48-39
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
233233
<div className="my-4">
234234
<Separator />
235235
</div>
236-
<div className="grid md:grid-cols-2 lg:grid-cols-5 text-sm mx-2">
236+
<div className="grid md:grid-cols-2 lg:grid-cols-4 text-sm mx-2">
237237
<div>
238238
<div className="text-gray-500 font-semibold my-2">Website</div>{" "}
239239
<a
@@ -245,14 +245,6 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
245245
Link
246246
</a>
247247
</div>
248-
<div>
249-
<div className="text-gray-500 font-semibold my-2">Domain</div>{" "}
250-
<div>
251-
{jobData?.company.domains.length === 0
252-
? "Not Available"
253-
: jobData?.company.domains[0]}
254-
</div>
255-
</div>
256248
<div>
257249
<div className="text-gray-500 font-semibold my-2">Category</div>{" "}
258250
<div>{jobData?.company.category}</div>
@@ -273,32 +265,53 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
273265
<div className="my-4">
274266
<Separator />
275267
</div>
276-
<h1 className="text-lg font-semibold my-2">Job Coordinators</h1>
277-
<Table className="overflow-hidden">
278-
<TableHeader>
279-
<TableRow>
280-
<TableHead>Name</TableHead>
281-
<TableHead>Role</TableHead>
282-
<TableHead>Department</TableHead>
283-
<TableHead>Email</TableHead>
284-
<TableHead>Mobile Number</TableHead>
285-
</TableRow>
286-
</TableHeader>
287-
<TableBody>
288-
{jobData?.jobCoordinators.map((coordinator, index) => (
289-
<TableRow key={index}>
290-
<TableCell>{coordinator.tpcMember.student.user.name}</TableCell>
291-
<TableCell>{coordinator.role}</TableCell>
292-
<TableCell>{coordinator.tpcMember.student.program.department}</TableCell>
293-
<TableCell>{coordinator.tpcMember.student.user.email}</TableCell>
294-
<TableCell>{coordinator.tpcMember.student.user.contact}</TableCell>
295-
</TableRow>
296-
))}
297-
</TableBody>
298-
</Table>
299-
<div className="my-4">
300-
<Separator />
301-
</div>
268+
{jobData?.company.domains.length > 0 && (
269+
<>
270+
<div className="font-semibold text-md"> Domains </div>
271+
<div className="flex flex-wrap !text-md">
272+
{jobData.company.domains.map((domain, index) => (
273+
<div key={index} className="mx-2 my-2">
274+
<div className="border-2 border-gray-300 p-2 px-4 rounded-full bg-gray-200 text-gray-600">
275+
{domain}
276+
</div>
277+
</div>
278+
))}
279+
</div>
280+
<div className="my-4">
281+
<Separator />
282+
</div>
283+
</>
284+
)}
285+
{jobData?.jobCoordinators.length > 0 && (
286+
<>
287+
<h1 className="text-lg font-semibold my-2">Job Coordinators</h1>
288+
<Table className="overflow-hidden">
289+
<TableHeader>
290+
<TableRow>
291+
<TableHead>Name</TableHead>
292+
<TableHead>Role</TableHead>
293+
<TableHead>Department</TableHead>
294+
<TableHead>Email</TableHead>
295+
<TableHead>Mobile Number</TableHead>
296+
</TableRow>
297+
</TableHeader>
298+
<TableBody>
299+
{jobData.jobCoordinators.map((coordinator, index) => (
300+
<TableRow key={index}>
301+
<TableCell>{coordinator.tpcMember.student.user.name}</TableCell>
302+
<TableCell>{coordinator.role}</TableCell>
303+
<TableCell>{coordinator.tpcMember.student.program.department}</TableCell>
304+
<TableCell>{coordinator.tpcMember.student.user.email}</TableCell>
305+
<TableCell>{coordinator.tpcMember.student.user.contact}</TableCell>
306+
</TableRow>
307+
))}
308+
</TableBody>
309+
</Table>
310+
<div className="my-4">
311+
<Separator />
312+
</div>
313+
</>
314+
)}
302315
<h1 className="text-lg font-semibold my-2">Events</h1>
303316
<Table className="overflow-hidden">
304317
<TableHeader>
@@ -327,10 +340,6 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
327340
<div className="my-4">
328341
<Separator />
329342
</div>
330-
{/* <HorizontalTimeline eventsData={transformEvents(jobData.events)} />
331-
<div className="my-7">
332-
<Separator />
333-
</div> */}
334343
<div>
335344
<div className="flex justify-between">
336345
<div>

Diff for: src/components/JAF/JAF.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function JAF() {
126126
job: {
127127
role: values.role,
128128
description: values.description,
129-
attachment: values.attachment,//file
129+
attachments: values.attachment,//file
130130
skills: values.skills,
131131
location: values.location,
132132
noOfVacancies: values.noOfVacancies,
@@ -159,7 +159,7 @@ function JAF() {
159159
seasonId: values.seasonId,
160160
description: values.description,
161161
recruiterDetailsFilled: submitValues.recruiters,
162-
attachment: values.attachment,//file
162+
attachments: values.attachments,//file
163163
others: values.jobOthers,
164164
skills: values.skills,
165165
location: values.location,

Diff for: src/components/JAF/JobDetails.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ const JobDetails = ({ errors, values, handleChange, setFieldValue }: StepProps)
7171
try {
7272
const base64String = await getBase64(file);
7373
const files=values.attachments;
74-
console.log(`Base64 string length: ${base64String.length}`);
75-
console.log(`Base64 string: ${base64String.substring(0, 50)}...`);
7674
files.push(base64String);
7775
setFieldValue("attachments", files);
76+
console.log(values.attachments);
7877
message.success(`${info.file.name} file uploaded successfully`);
7978
} catch (error) {
8079
message.error("File conversion to Base64 failed.");

Diff for: src/components/jobs/JobCard.tsx

+21-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Link from "next/link";
33
import { Separator } from "../ui/separator";
44
import { useState } from "react";
55
import { Button } from "@/components/ui/button";
6+
import Image from 'next/image';
67
import { Jobs } from "@/helpers/student/types";
78
import DOMPurify from 'dompurify';
89
import "./styles/JobDescription.css"
@@ -47,7 +48,7 @@ const JobCard = ({ jobItem, type}: Props) => {
4748
<Separator />
4849
</div>
4950
<div
50-
className="grid md:grid-cols-2 lg:grid-cols-5 text-sm mx-2"
51+
className="grid md:grid-cols-2 lg:grid-cols-4 text-sm mx-2"
5152
onClick={handleViewDetails}
5253
style={{ cursor: "pointer" }}
5354
>
@@ -71,19 +72,16 @@ const JobCard = ({ jobItem, type}: Props) => {
7172
{jobItem.season.type} {jobItem.season.year}
7273
</div>
7374
</div>
74-
<div>
75-
<div className="text-gray-500 font-semibold my-2">Attachment</div>{" "}
76-
<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>
77-
</div>
7875
</div>
7976
{showDescription && (
8077
<div className="mt-4">
8178
<div className="my-4">
8279
<Separator />
8380
</div>
81+
<div className="font-semibold text-md"> Description </div>
8482
<div
85-
className="job-description"
86-
dangerouslySetInnerHTML={{ __html: cleanHTML }}
83+
className="job-description my-2"
84+
dangerouslySetInnerHTML={{ __html: jobItem.description }}
8785
/>
8886
<div className="my-4">
8987
<Separator />
@@ -101,6 +99,22 @@ const JobCard = ({ jobItem, type}: Props) => {
10199
<div className="my-4">
102100
<Separator />
103101
</div>
102+
{jobItem.attachments.length > 0 && (
103+
<>
104+
<div className="font-semibold text-md"> Attachments </div>
105+
<div className="flex flex-wrap !text-md">
106+
{jobItem.attachments.map((attachment, index) => (
107+
<div className="mx-2 my-2 cursor-pointer" key={index} onClick={() => handleOpenJD(attachment)}>
108+
<Image src={"/file.png"} alt="" width={150} height={150} />
109+
<div className="text-center text-blue-500 font-semibold cursor-pointer hover:text-blue-600">{`Attachment (${index})`}</div>
110+
</div>
111+
))}
112+
</div>
113+
<div className="my-4">
114+
<Separator />
115+
</div>
116+
</>
117+
)}
104118

105119
<div className="flex justify-between my-3">
106120
<Button>

Diff for: src/helpers/student/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export interface Jobs {
157157
id: string;
158158
role: string;
159159
duration: string;
160-
attachment: string;
160+
attachments: string[];
161161
skills: string[];
162162
description: string;
163163
active: boolean;

0 commit comments

Comments
 (0)