Skip to content

Commit

Permalink
Revert "Merge pull request spo-iitk#259 from yashlm/pastcompanies"
Browse files Browse the repository at this point in the history
This reverts commit 5c7303c, reversing
changes made to 2b08142.
  • Loading branch information
AshNewar committed Feb 10, 2024
1 parent 4fdd966 commit 9a78246
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 56 deletions.
24 changes: 1 addition & 23 deletions callbacks/admin/company/company.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import axios, { AxiosResponse } from "axios";

import {
ADMIN_COMPANY_URL,
ADMIN_RC_URL,
ErrorType,
SERVER_ERROR,
StatusResponse,
Expand All @@ -27,23 +26,12 @@ export interface HR {
phone: string;
designation: string;
}
export interface CompanyHistory {
id: number;
recruitmentDrive: string;
comments: string;
}
const adminCompanyInstance = axios.create({
baseURL: ADMIN_COMPANY_URL,
timeout: 15000,
timeoutErrorMessage: SERVER_ERROR,
});

const adminRcInstance = axios.create({
baseURL: ADMIN_RC_URL,
timeout: 15000,
timeoutErrorMessage: SERVER_ERROR,
});

const addCompanyRequest = {
post: (body: Company, token: string) =>
adminCompanyInstance
Expand Down Expand Up @@ -170,19 +158,9 @@ const addCompanyRequest = {
return false;
});
},
getCompanyHistory: (token: string, companyId: string) =>
adminRcInstance
.get<CompanyHistory[]>(`/company/${companyId}/history`, setConfig(token))
.then(responseBody)
.catch((err: ErrorType) => {
errorNotification(
"Error in fetching Company History",
err.response?.data?.error || err.message
);
return [] as CompanyHistory[];
}),
};

export default addCompanyRequest;

// get compnay, edit company, bulk add company
// delete
2 changes: 1 addition & 1 deletion components/Layouts/LayoutWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function LayoutWrapper({ children }: { children: JSX.Element }) {
role === 100 || role === 101
? {
avatar: <BarChartIcon />,
name: "Master Database (Company HR)",
name: "Master Database (Company HR",
id: "/companyHR",
}
: { avatar: <></>, name: "", id: "", hidden: true },
Expand Down
43 changes: 11 additions & 32 deletions sections/CompanyHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { FormControl, Stack, TextField } from "@mui/material";
import { FormControl, IconButton, Stack, TextField } from "@mui/material";
import { GridColDef } from "@mui/x-data-grid";
import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
import React from "react";
import MoreVertIcon from "@mui/icons-material/MoreVert";

import DataGrid from "@components/DataGrid";
import addCompanyRequest, {
CompanyHistory,
} from "@callbacks/admin/company/company";
import useStore from "@store/store";

const CompanyHistoryColumns: GridColDef[] = [
{
Expand All @@ -16,15 +12,15 @@ const CompanyHistoryColumns: GridColDef[] = [
width: 150,
},
{
field: "recruitmentCycleID",
field: "RecruitmentDrive",
headerName: "Recruitment Drive",
flex: 1,
},
{
field: "comments",
field: "Comments",
headerName: "Comments",
flex: 1,
renderCell: (params) => (
renderCell: () => (
<Stack
direction="row"
alignItems="center"
Expand All @@ -36,37 +32,20 @@ const CompanyHistoryColumns: GridColDef[] = [
label="Comment"
id="comment"
variant="standard"
value={params.row.Comments}
sx={{ minWidth: "20vw" }}
disabled
/>
</FormControl>
<IconButton>
<MoreVertIcon />
</IconButton>
</Stack>
),
},
];

function CompanyHistory() {
const [companyHistoryRows, setCompanyHistoryRows] = useState<
CompanyHistory[]
>([]);
const { token } = useStore();
const router = useRouter();

useEffect(() => {
const fetchCompanyHistory = async () => {
const companyId = router.query.companyId?.toString() || "";

const historyData = await addCompanyRequest.getCompanyHistory(
token,
companyId
);
setCompanyHistoryRows(historyData);
};

fetchCompanyHistory();
}, [router.query.companyId, token]);
const companyHistoryRows: never[] = [];

function CompanyHistory() {
return (
<div>
<Stack>
Expand Down

0 comments on commit 9a78246

Please sign in to comment.