Skip to content

Commit

Permalink
remove package.json & yarn.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
qu-bit1 committed Feb 10, 2024
1 parent fc52213 commit a39399c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4,153 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
}
}
4 changes: 3 additions & 1 deletion callbacks/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { AxiosError, AxiosResponse } from "axios";

export const BASE_URL = "https://placement.iitk.ac.in";
export const BASE_URL = "http://localhost:49770";

// export const BASE_URL = "https://placement.iitk.ac.in";

export const AUTH_URL = `${BASE_URL}/api/auth`;
export const RAS_URL = `${BASE_URL}/api/ras`;
Expand Down
60 changes: 0 additions & 60 deletions package.json

This file was deleted.

43 changes: 42 additions & 1 deletion pages/admin/rc/[rcid]/student/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import AddIcon from "@mui/icons-material/Add";
import HowToRegIcon from "@mui/icons-material/HowToReg";
import EditIcon from "@mui/icons-material/Edit";
import SyncIcon from "@mui/icons-material/Sync";
import Download from "@mui/icons-material/Download";
import { AcUnit } from "@mui/icons-material";
import ExcelJS from "exceljs";
import { saveAs } from "file-saver";

import DataGrid from "@components/DataGrid";
import useStore from "@store/store";
Expand Down Expand Up @@ -149,13 +152,38 @@ const columns: GridColDef[] = [
),
},
];

function downloadExcel(rows, columns, name) {
const wb = new ExcelJS.Workbook();
wb.creator = name;
wb.lastModifiedBy = name;
wb.created = new Date(1985, 8, 30);
wb.modified = new Date();
wb.lastPrinted = new Date(2016, 9, 27);
const ws = wb.addWorksheet("Sheet 1");

const headers = columns.map((column) => column.headerName);
ws.addRow(headers);

rows.forEach((row) => {
const rowData = columns.map((column) => {
const { field } = column;
return row[field] || "";
});
ws.addRow(rowData);
});

wb.xlsx.writeBuffer().then((excelBuffer) => {
saveAs(new Blob([excelBuffer]), "students.xlsx");
});
}
function Index() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [rows, setRows] = useState<any>([]);
const router = useRouter();
const { rcid } = router.query;
const rid = (rcid || "").toString();
const { token, rcName, role } = useStore();
const { token, rcName, role, name } = useStore();
const [showButtons, setShowButtons] = useState(false);
const [loading, setLoading] = useState(true);
const [openEnroll, setOpenEnroll] = useState(false);
Expand Down Expand Up @@ -210,6 +238,10 @@ function Index() {
});
}, [rid, token]);

const handleDownloadExcel = () => {
downloadExcel(rows, columns, name);
};

const [openSync, setOpenSync] = useState(false);
const handleOpenSync = () => {
setOpenSync(true);
Expand Down Expand Up @@ -268,6 +300,15 @@ function Index() {
<div />
)}
</Tooltip> */}
<Tooltip title="Download Table Data">
{role === 100 ? (
<IconButton onClick={handleDownloadExcel}>
<Download />
</IconButton>
) : (
<div />
)}
</Tooltip>
<Tooltip title="Edit Student Data">
{role === 100 ? (
<IconButton onClick={handleOpenNew}>
Expand Down
Loading

0 comments on commit a39399c

Please sign in to comment.