diff --git a/src/App.js b/src/App.js index e3f40da..5d3d58f 100644 --- a/src/App.js +++ b/src/App.js @@ -50,6 +50,7 @@ function App() { } /> } /> } /> + } /> } diff --git a/src/pages/admin/AdminCompanyTable.js b/src/pages/admin/AdminCompanyTable.js index 837ab09..ecce6cc 100644 --- a/src/pages/admin/AdminCompanyTable.js +++ b/src/pages/admin/AdminCompanyTable.js @@ -71,9 +71,9 @@ const AdminCompanyTable = () => { } useEffect(() => { - axios.get("http://localhost:8080/admin/company/all", { withCredentials: true }) + axios.get("http://localhost:8080/admin/company/jobs", { withCredentials: true }) .then((res) => { - // console.log(res); + console.log(res.data.data); setCompanyTable(res.data.data); setLoading(false); }).catch((err) => { @@ -82,6 +82,11 @@ const AdminCompanyTable = () => { }) }, []) + const handleClick = async (e) => { + e.preventDefault(); + navigate("/admin/add-job", { state: {companyId: e.target.value}}); + } + if (isLoading) { return
@@ -92,7 +97,7 @@ const AdminCompanyTable = () => { return (
-

Company table

+

Company records

@@ -105,50 +110,17 @@ const AdminCompanyTable = () => {
- + {/*
- {/* */} - {/* - - - - - - - */} - {/* {companyTable.map((company, key) => ( - - - - - - {/* - - - ))} */} {companyTable.filter(company => company.name.toLowerCase().includes(searchQuery.toLowerCase())).map((company => ( @@ -163,13 +135,35 @@ const AdminCompanyTable = () => { - {/* */} + )))} -
Company name Job Round UpdateScheduleAction
Deutch BackSoftware DevelopmentRound - 5 -
-
- - -
-
-
25/11/2022View
{company.name}{company.profile}{ (company.currentRound === company.totalRounds) ? "Complete" : (!company.currentRound) ? "Upcoming" : `Round - ${company.currentRound}` } -
-
- - -
-
-
{company.currentRound >= company.totalRounds ? "Completed" : !company.currentRound ? company.driveDetails[0].date : company.driveDetails[company.currentRound + 1].date }View
{company.currentRound >= company.totalRounds ? "Completed" : !company.currentRound ? company.driveDetails[0].date : company.driveDetails[company.currentRound + 1].date }View
+ */} +
+ + {companyTable.filter(company => company.name.toLowerCase().includes(searchQuery.toLowerCase())).map((company=>( +
+
+
+
{company.name}
+
+
+

    + {company.jobDescriptions.length ? company.jobDescriptions.map((desc=>( +
  1. {desc.name} : round - {desc.currentRound} Link
  2. + ))) : "No job opening record available"} +
+

+
+ +
+
+
+ )))} +
) diff --git a/src/pages/admin/addCompany/AddJobOpen.js b/src/pages/admin/addCompany/AddJobOpen.js index 32c9aea..a24391a 100644 --- a/src/pages/admin/addCompany/AddJobOpen.js +++ b/src/pages/admin/addCompany/AddJobOpen.js @@ -1,14 +1,19 @@ import { useState } from "react"; import "../../../assets/css/admincompanytable.css"; import "../../../assets/css/studentprofile.css" +import { Link, useLocation } from 'react-router-dom'; const AddJobOpen = () => { + + const location = useLocation(); + const state = location.state; + console.log(state.companyId); const [company, setCompany] = useState({ ctc: "", - profile: "", + name: "", totalRounds: "", currentRound: 0, - startDate: "", + // startDate: "", endDate: "", criteria: { branch: { diff --git a/src/pages/admin/addCompany/BasicForm.js b/src/pages/admin/addCompany/BasicForm.js index 6521d2a..3d740e9 100644 --- a/src/pages/admin/addCompany/BasicForm.js +++ b/src/pages/admin/addCompany/BasicForm.js @@ -1,7 +1,7 @@ import { useState } from "react"; import "../../../assets/css/admincompanytable.css"; import "../../../assets/css/studentprofile.css" - +import axios from "axios"; const BasicForm = () => { const [company, setCompany] = useState({ @@ -11,10 +11,24 @@ const BasicForm = () => { companyLocation: "", }); + const handleSubmit = async (e) => { + e.preventDefault(); + + await axios.post('http://localhost:8080/company/add', company,{withCredentials:true}) + .then((res)=>{ + console.log("Res: ",res); + alert("Company added successfully!"); + window.location.reload(); + }) + .catch((err)=>{ + console.log("err: ",err); + }) + } + return (

Fill the company details

-
+

* All fields are mandatory