diff --git a/.woodpecker.yml b/.woodpecker.yml index 62a9d7b..82bee88 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -12,4 +12,6 @@ steps: - npm run build - ssh root@10.0.10.4 'rm -rf /mnt/sda1/files/projects/borrowing_tracker_frontend/*' - scp -r dist/* root@10.0.10.4:/mnt/sda1/files/projects/borrowing_tracker_frontend + when: + - branch: master secrets: [SSH_KEY] diff --git a/index.html b/index.html index 6010514..cd834f8 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - CITC Equipment Tracker + CSM Equipment Tracker
diff --git a/package-lock.json b/package-lock.json index 5d37b69..97891f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,12 +23,15 @@ "react-redux": "^8.1.3", "react-router-dom": "^6.18.0", "react-toastify": "^9.1.3", + "react-virtuoso": "^4.6.2", + "react-window": "^1.8.10", "reactjs-popup": "^2.0.6", "styled-components": "^6.1.1" }, "devDependencies": { "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", + "@types/react-window": "^1.8.8", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-react": "^4.0.3", @@ -1761,6 +1764,15 @@ "@types/react": "*" } }, + "node_modules/@types/react-window": { + "version": "1.8.8", + "resolved": "https://registry.npmjs.org/@types/react-window/-/react-window-1.8.8.tgz", + "integrity": "sha512-8Ls660bHR1AUA2kuRvVG9D/4XpRC6wjAaPT9dil7Ckc76eP9TKWZwwmgfq8Q1LANX3QNDnoU4Zp48A3w+zK69Q==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@types/scheduler": { "version": "0.16.5", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.5.tgz", @@ -3372,6 +3384,11 @@ "resolved": "https://registry.npmjs.org/media-engine/-/media-engine-1.0.3.tgz", "integrity": "sha512-aa5tG6sDoK+k70B9iEX1NeyfT8ObCKhNDs6lJVpwF6r8vhUfuKMslIcirq6HIUYuuUYLefcEQOn9bSBOvawtwg==" }, + "node_modules/memoize-one": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz", + "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==" + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -3895,6 +3912,34 @@ "react-dom": ">=16.6.0" } }, + "node_modules/react-virtuoso": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/react-virtuoso/-/react-virtuoso-4.6.2.tgz", + "integrity": "sha512-vvlqvzPif+MvBrJ09+hJJrVY0xJK9yran+A+/1iwY78k0YCVKsyoNPqoLxOxzYPggspNBNXqUXEcvckN29OxyQ==", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": ">=16 || >=17 || >= 18", + "react-dom": ">=16 || >=17 || >= 18" + } + }, + "node_modules/react-window": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/react-window/-/react-window-1.8.10.tgz", + "integrity": "sha512-Y0Cx+dnU6NLa5/EvoHukUD0BklJ8qITCtVEPY1C/nL8wwoZ0b5aEw8Ff1dOVHw7fCzMt55XfJDd8S8W8LCaUCg==", + "dependencies": { + "@babel/runtime": "^7.0.0", + "memoize-one": ">=3.1.1 <6" + }, + "engines": { + "node": ">8.0.0" + }, + "peerDependencies": { + "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/reactjs-popup": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/reactjs-popup/-/reactjs-popup-2.0.6.tgz", diff --git a/package.json b/package.json index 389aa1a..a1000f4 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,15 @@ "react-redux": "^8.1.3", "react-router-dom": "^6.18.0", "react-toastify": "^9.1.3", + "react-virtuoso": "^4.6.2", + "react-window": "^1.8.10", "reactjs-popup": "^2.0.6", "styled-components": "^6.1.1" }, "devDependencies": { "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", + "@types/react-window": "^1.8.8", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-react": "^4.0.3", diff --git a/src/Components/API/API.tsx b/src/Components/API/API.tsx index 10984e0..4c43e72 100644 --- a/src/Components/API/API.tsx +++ b/src/Components/API/API.tsx @@ -27,7 +27,7 @@ const debug = false; let backendURL; if (debug) { - backendURL = "http://localhost:8000/"; + backendURL = "http://localhost:8092/"; } else { backendURL = "https://csm-backend.keannu1.duckdns.org/"; } diff --git a/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx b/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx index 188ea7d..b412176 100644 --- a/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx +++ b/src/Components/DashboardPage/Technician/TechnicianWidgets.tsx @@ -6,7 +6,6 @@ import { UserAPI, TransactionsAPI, } from "../../API/API"; -import CircularProgress from "@mui/material/CircularProgress"; import moment from "moment"; export default function TechnicianWidgets() { @@ -34,22 +33,6 @@ export default function TechnicianWidgets() { }, ], }); - const isLoading = queries.some((result) => result.isLoading); - if (isLoading) { - return ( - <> - -

- Loading -

- - ); - } return (
{queries[1].data?.filter( (equipment) => equipment.status == "Pending" - ).length || 0} + ).length || "Loading..."}

- {queries[1].data?.length || 0} + {queries[1].data?.length || "Loading..."}

@@ -167,7 +150,7 @@ export default function TechnicianWidgets() { > {queries[1].data?.filter( (equipment) => equipment.status == "Available" - ).length || 0} + ).length || "Loading..."}

{queries[1].data?.filter( (equipment) => equipment.status == "Broken" - ).length || 0} + ).length || "Loading..."}

@@ -247,7 +230,7 @@ export default function TechnicianWidgets() { todayStartOfDay, todayEndOfDay ) - ).length || 0} + ).length || "Loading..."}

diff --git a/src/Components/TransactionReportPDF/TransactionReportPDF.tsx b/src/Components/TransactionReportPDF/TransactionReportPDF.tsx index f18627f..2c6889c 100644 --- a/src/Components/TransactionReportPDF/TransactionReportPDF.tsx +++ b/src/Components/TransactionReportPDF/TransactionReportPDF.tsx @@ -72,20 +72,6 @@ export default function TransactionReportPDF(props: props) { ).length } - - Rejected Transactions:{" "} - { - transactions_today.filter( - (transaction) => transaction.transaction_status == "Rejected" - ).length - } - - Items Requested - + equipments: newValue.map((item) => item.id), + }); + }} + renderInput={(params) => ( + + )} + /> - Assigned Teacher + + Assigned Teacher + - Subject + + Subject + ) => { @@ -181,7 +208,14 @@ export default function AddTransactionPage() { /> - Remarks + + Remarks + - Consumables + + Consumables + - Additional Members + + Additional Members + {/* ADDED/INSERTED BUTTON,POPUP, TWO CATEGORY BUTTONS*/} @@ -200,76 +199,73 @@ export default function EquipmentInstancesListPage() {

-
-
+ + + theme.palette.getContrastText(theme.palette.background.paper), + }, + }} + value={filter} + onChange={(_event, newValue) => { + setFilter(newValue); + }} + freeSolo + id="custom-input-demo" + options={["Available", "Broken", "Glassware", "Miscellaneous"]} + renderInput={(params) => ( +
+ +
+ )} + /> +

- - - theme.palette.getContrastText( - theme.palette.background.paper - ), - }, - }} - value={filter} - onChange={(_event, newValue) => { - setFilter(newValue); - }} - freeSolo - id="custom-input-demo" - options={["Available", "Broken", "Glassware", "Miscellaneous"]} - renderInput={(params) => ( -

- -
- )} - /> -

- Results Found:{" "} - { - equipment_instances?.data?.filter((equipment) => - filter !== null - ? // If filter is not null, we filter if it matches any criteria - equipment.equipment_name - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.category - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.last_updated - .toLowerCase() - .includes(filter?.toLowerCase()) || - equipment.status.toLowerCase() == filter.toLowerCase() - : // If filter keyword is null then we just pass through everything as if we did not filter at all - true - ).length - } -

-
+ Results Found:{" "} + { + equipment_instances?.data?.filter((equipment) => + filter !== null + ? // If filter is not null, we filter if it matches any criteria + equipment.equipment_name + .toLowerCase() + .includes(filter.toLowerCase()) || + equipment.category + .toLowerCase() + .includes(filter.toLowerCase()) || + equipment.last_updated + .toLowerCase() + .includes(filter?.toLowerCase()) || + equipment.status.toLowerCase() == filter.toLowerCase() + : // If filter keyword is null then we just pass through everything as if we did not filter at all + true + ).length + } +

+
-
-
+ + + theme.palette.getContrastText(theme.palette.background.paper), + }, + }} + value={filter} + onChange={(_event, newValue) => { + setFilter(newValue); + }} + freeSolo + id="custom-input-demo" + options={["Glassware", "Miscellaneous"]} + renderInput={(params) => ( +
+ +
+ )} + /> +

- - - theme.palette.getContrastText( - theme.palette.background.paper - ), - }, - }} - value={filter} - onChange={(_event, newValue) => { - setFilter(newValue); - }} - freeSolo - id="custom-input-demo" - options={["Glassware", "Miscellaneous"]} - renderInput={(params) => ( -

- -
- )} - /> -

- Results Found:{" "} - { - equipments?.data?.filter((equipment) => - filter !== null - ? // If filter is not null, we filter if it matches any criteria - equipment.name - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.category - .toLowerCase() - .includes(filter.toLowerCase()) || - equipment.last_updated - .toLowerCase() - .includes(filter?.toLowerCase()) || - equipment.category.toLowerCase() == filter.toLowerCase() - : // If filter keyword is null then we just pass through everything as if we did not filter at all - true - ).length - } -

-
+ Results Found:{" "} + { + equipment_instances?.data?.filter((equipment) => + filter !== null + ? // If filter is not null, we filter if it matches any criteria + equipment.equipment_name + .toLowerCase() + .includes(filter.toLowerCase()) || + equipment.category + .toLowerCase() + .includes(filter.toLowerCase()) || + equipment.last_updated + .toLowerCase() + .includes(filter?.toLowerCase()) || + equipment.status.toLowerCase() == filter.toLowerCase() + : // If filter keyword is null then we just pass through everything as if we did not filter at all + true + ).length + } +

+