diff --git a/client/public/index.html b/client/public/index.html index 656fc25e..3bb0cb6c 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -3,23 +3,9 @@ - - - + + + diff --git a/client/src/views/admin/management/management_files/ManagementFileBin.js b/client/src/views/admin/management/management_files/ManagementFileBin.js index d8503dda..f59e2023 100644 --- a/client/src/views/admin/management/management_files/ManagementFileBin.js +++ b/client/src/views/admin/management/management_files/ManagementFileBin.js @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import {Header, HeaderEmail} from "../../../../components/headers/Header"; +import { Header, HeaderEmail } from "../../../../components/headers/Header"; import { LoadingAnimation, LoadingPageSkeletonText, @@ -19,7 +19,7 @@ import { faRotate, faTrash } from "@fortawesome/free-solid-svg-icons"; import { NoData } from "../../../../components/warnings/WarningMessages"; import { toast } from "react-toastify"; import { ItemsPerPage } from "../../../../components/items/Items"; -import {isAuth} from "../../../../helpers/Auth"; +import { isAuth } from "../../../../helpers/Auth"; /** * @description ManagementFileBin component for the application to manage the files in the bin @@ -243,282 +243,279 @@ export default function ManagementFileBin() { return (
- { - isAuth().verified_email === "Verified" ? ( - <> -
- handleSearchForFile(event)} - placeholder="Search" - type="text" - /> -
-
-
-
-

- Mass Actions -

-
- handleRestoreAll()} - title="Restore All Files" - > - {massRestore ? ( - <> - - {textChangeRestore} - - ) : ( - <> - - {textChangeRestore} - - )} - -
+ {isAuth().verified_email === "Verified" ? ( + <> +
+ handleSearchForFile(event)} + placeholder="Search" + type="text" + /> +
+
+
+
+

+ Mass Actions +

-
-
-
-

- Mass Danger Actions (This action is destructive and irreversible) -

-
- handleDeleteAllPermanently()} - title="Delete All Files Permanently" - > - {massDelete ? ( - <> - - {textChangeDelete} - - ) : ( - <> - - {textChangeDelete} - - )} - -
+ handleRestoreAll()} + title="Restore All Files" + > + {massRestore ? ( + <> + + {textChangeRestore} + + ) : ( + <> + + {textChangeRestore} + + )} + +
+
+
+
+
+

+ Mass Danger Actions (This action is destructive and + irreversible) +

+ handleDeleteAllPermanently()} + title="Delete All Files Permanently" + > + {massDelete ? ( + <> + + {textChangeDelete} + + ) : ( + <> + + {textChangeDelete} + + )} +
- - - -
- {loading ? ( - <> - - - - - ) : filteredListOfFiles.length > 0 ? ( - filteredListOfFiles.map((file) => ( -
-
-
-
-

- File ID -

-

- {file.id} -

-
-
-
-
-
-

- Status -

-
-
-
-

- {file.flag_deleted - ? "Archived" - : "Available"} -

-
-
-

- {file.flag_release ? "Published" : "Unpublished"} -

-
-
-
-

- Details -

-
-
-

- School Year: -

-

- {file.school_year} -

-
-
-

- School Semester: -

-

- {file.school_semester} -

-
-
-

- Topic: -

-

- {file.csv_question} -

-
+
+
+ + + +
+ {loading ? ( + <> + + + + + ) : filteredListOfFiles.length > 0 ? ( + filteredListOfFiles.map((file) => ( +
+
+
+
+

+ File ID +

+

+ {file.id} +

+
+
+
+
+
+

+ Status +

+
+
+
+

+ {file.flag_deleted ? "Archived" : "Available"} +

-
-
-

- Actions -

-
-
- - {loadingIdRestore[file.id] ? ( - <> - - Restoring... - - ) : ( - <> - - Restore - - )} - -
-
-

- Danger Zone (Destructive and Irreversible) -

-
-
- - {loadingIdPermanentDelete[file.id] ? ( - <> - - Permanently Deleting... - - ) : ( - <> - - Delete Permanently - - )} - -
+
+

+ {file.flag_release ? "Published" : "Unpublished"} +

+
+

+ Details +

+
+
+

+ School Year: +

+

+ {file.school_year} +

+
+
+

+ School Semester: +

+

+ {file.school_semester} +

+
+
+

+ Topic: +

+

+ {file.csv_question} +

+
+
+
+
+

+ Actions +

+
+
+ + {loadingIdRestore[file.id] ? ( + <> + + Restoring... + + ) : ( + <> + + Restore + + )} + +
+
+

+ Danger Zone (Destructive and Irreversible) +

+
+
+ + {loadingIdPermanentDelete[file.id] ? ( + <> + + Permanently Deleting... + + ) : ( + <> + + Delete Permanently + + )} + +
- )) - ) : ( -
-
- )} +
+ )) + ) : ( +
+
- - - - - ) : ( - - ) - } + )} +
+ + + + + ) : ( + + )}
); } diff --git a/client/src/views/admin/management/management_files/ManagementFilesCSV.js b/client/src/views/admin/management/management_files/ManagementFilesCSV.js index be0f6392..4e6c964e 100644 --- a/client/src/views/admin/management/management_files/ManagementFilesCSV.js +++ b/client/src/views/admin/management/management_files/ManagementFilesCSV.js @@ -11,7 +11,8 @@ import { faFileCsv, faFileArrowDown, faUpLong, - faDownLong, faBoxArchive, + faDownLong, + faBoxArchive, } from "@fortawesome/free-solid-svg-icons"; import httpClient from "../../../../http/httpClient"; import { @@ -20,7 +21,7 @@ import { } from "../../../../components/loading/LoadingPage"; import { toast } from "react-toastify"; import { Link } from "react-router-dom"; -import {Header, HeaderEmail} from "../../../../components/headers/Header"; +import { Header, HeaderEmail } from "../../../../components/headers/Header"; import { SearchBar } from "../../../../components/searchbar/SearchBar"; import { Paginator } from "../../../../components/listbox/ListBox"; import { NoData } from "../../../../components/warnings/WarningMessages"; @@ -28,7 +29,7 @@ import ModalConfirm, { ModalTypeOfDownload, } from "../../../../components/modal/ModalConfirm"; import { ItemsPerPage } from "../../../../components/items/Items"; -import {isAuth} from "../../../../helpers/Auth"; +import { isAuth } from "../../../../helpers/Auth"; /** * @description Handles the files to view and delete @@ -143,29 +144,27 @@ export default function ManagementFilesCSV() { // ...fileData, // loading: true, // }); - isAuth().verified_email === "Verified" ? ( - httpClient - .get(`/data/list-of-csv-files-to-view/${page}/${per_page_limit}`) - .then((response) => { - setFileData({ - ...fileData, - loading: false, - files_list: response.data.csv_files, - current_page: response.data.current_page, - has_next: response.data.has_next, - has_prev: response.data.has_prev, - total_items: response.data.total_items, - total_pages: response.data.total_pages, - }); - setFilteredListOfFiles(response.data.csv_files); - }) - .catch((error) => { - toast.error(error.response.data.message); - window.location.href = "/login-timeout"; - }) - ) : ( - "" - ) + isAuth().verified_email === "Verified" + ? httpClient + .get(`/data/list-of-csv-files-to-view/${page}/${per_page_limit}`) + .then((response) => { + setFileData({ + ...fileData, + loading: false, + files_list: response.data.csv_files, + current_page: response.data.current_page, + has_next: response.data.has_next, + has_prev: response.data.has_prev, + total_items: response.data.total_items, + total_pages: response.data.total_pages, + }); + setFilteredListOfFiles(response.data.csv_files); + }) + .catch((error) => { + toast.error(error.response.data.message); + window.location.href = "/login-timeout"; + }) + : ""; }; /** @@ -421,379 +420,377 @@ export default function ManagementFilesCSV() { return (
- { - isAuth().verified_email === "Verified" ? ( - <> -
+ {isAuth().verified_email === "Verified" ? ( + <> +
- handleSearchForFile(event)} - placeholder="Search" - type="text" - /> -
-
-
-
-

- Mass Actions -

-
- handlePublishAll()} - title="Publish All Files" - > - {massPublish ? ( - <> - - {textChangePublish} - - ) : ( - <> - - {textChangePublish} - - )} - - handleDownloadAll("csv")} - onConfirmExcel={() => handleDownloadAll("excel")} - title="Download File" - > - {massDownload ? ( - <> - - {textChangeDownload} - - ) : ( - <> - - {textChangeDownload} - - )} - - handleDeleteAll()} - title="Archive All Files" - > - {massDelete ? ( - <> - - {textChangeDelete} - - ) : ( - <> - - {textChangeDelete} - - )} - - handleUnpublishedAll()} - title="Unpublished All Files" - > - {massUnpublished ? ( - <> - - {textChangeUnpublished} - - ) : ( - <> - - {textChangeUnpublished} - - )} - -
+ handleSearchForFile(event)} + placeholder="Search" + type="text" + /> +
+
+
+
+

+ Mass Actions +

+ handlePublishAll()} + title="Publish All Files" + > + {massPublish ? ( + <> + + {textChangePublish} + + ) : ( + <> + + {textChangePublish} + + )} + + handleDownloadAll("csv")} + onConfirmExcel={() => handleDownloadAll("excel")} + title="Download File" + > + {massDownload ? ( + <> + + {textChangeDownload} + + ) : ( + <> + + {textChangeDownload} + + )} + + handleDeleteAll()} + title="Archive All Files" + > + {massDelete ? ( + <> + + {textChangeDelete} + + ) : ( + <> + + {textChangeDelete} + + )} + + handleUnpublishedAll()} + title="Unpublished All Files" + > + {massUnpublished ? ( + <> + + {textChangeUnpublished} + + ) : ( + <> + + {textChangeUnpublished} + + )} +
- - - -
- {loading ? ( - <> - - - - - ) : filteredListOfFiles.length > 0 ? ( - filteredListOfFiles.map((file) => ( -
-
-
-
-

- Evaluated File ID -

-

- {file.id}-{file.school_year} -

-
-
-
-
-
-

- Status -

-
-
-
-

- {file.flag_deleted - ? "Deleted Temporarily" - : "Available"} -

-
-
-

- {file.flag_release ? "Published" : "Unpublished"} -

-
-
-
-

- Details -

-
-
-

- School Year: -

-

- {file.school_year} -

-
-
-

- School Semester: -

-

- {file.school_semester} -

-
-
-

- Topic: -

-

- {file.csv_question} -

-
+
+
+ + + +
+ {loading ? ( + <> + + + + + ) : filteredListOfFiles.length > 0 ? ( + filteredListOfFiles.map((file) => ( +
+
+
+
+

+ Evaluated File ID +

+

+ {file.id}-{file.school_year} +

+
+
+
+
+
+

+ Status +

+
+
+
+

+ {file.flag_deleted + ? "Deleted Temporarily" + : "Available"} +

-
-
-

- Actions -

-
-
- - - {loadingIdDownload[file.id] ? ( - <> - - Downloading... - - ) : ( - <> - - Download Analysis - - )} - - - {loadingIdPublish[file.id] ? ( - <> - - Publishing File... - - ) : ( - <> - - Publish File - - )} - - - {loadingIdDelete[file.id] ? ( - <> - - Archiving File... - - ) : ( - <> - - Archive File - - )} - - - {loadingIdUnpublish[file.id] ? ( - <> - - Unpublishing File... - - ) : ( - <> - - Unpublish File - - )} - -
+
+

+ {file.flag_release ? "Published" : "Unpublished"} +

+
+

+ Details +

+
+
+

+ School Year: +

+

+ {file.school_year} +

+
+
+

+ School Semester: +

+

+ {file.school_semester} +

+
+
+

+ Topic: +

+

+ {file.csv_question} +

+
+
+
+
+

+ Actions +

+
+
+ + + {loadingIdDownload[file.id] ? ( + <> + + Downloading... + + ) : ( + <> + + Download Analysis + + )} + + + {loadingIdPublish[file.id] ? ( + <> + + Publishing File... + + ) : ( + <> + + Publish File + + )} + + + {loadingIdDelete[file.id] ? ( + <> + + Archiving File... + + ) : ( + <> + + Archive File + + )} + + + {loadingIdUnpublish[file.id] ? ( + <> + + Unpublishing File... + + ) : ( + <> + + Unpublish File + + )} + +
- )) - ) : ( -
-
- )} +
+ )) + ) : ( +
+
- - - - - ) : ( - - ) - } + )} +
+ + + + + ) : ( + + )}
); } diff --git a/client/src/views/admin/management/management_users/ManagementFilesUsers.js b/client/src/views/admin/management/management_users/ManagementFilesUsers.js index c10e81f2..0fb11afc 100644 --- a/client/src/views/admin/management/management_users/ManagementFilesUsers.js +++ b/client/src/views/admin/management/management_users/ManagementFilesUsers.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import {Header, HeaderEmail} from "../../../../components/headers/Header"; +import { Header, HeaderEmail } from "../../../../components/headers/Header"; import httpClient from "../../../../http/httpClient"; import { LoadingAnimation, @@ -14,7 +14,8 @@ import { } from "../../../../assets/styles/styled-components"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { - faBolt, faBoxArchive, + faBolt, + faBoxArchive, faCircleXmark, faLock, faRotate, @@ -25,7 +26,7 @@ import { toast } from "react-toastify"; import { Paginator } from "../../../../components/listbox/ListBox"; import { NoData } from "../../../../components/warnings/WarningMessages"; import { ItemsPerPage } from "../../../../components/items/Items"; -import {isAuth} from "../../../../helpers/Auth"; +import { isAuth } from "../../../../helpers/Auth"; /** * @description Handles the admin tables @@ -185,26 +186,26 @@ export default function ManagementFilesUsers() { * @param per_page_limit */ const loadListOfUsers = (page, per_page_limit) => { - if (isAuth().verified_email === "Verified"){ + if (isAuth().verified_email === "Verified") { httpClient - .get(`/data/list-of-users-to-view/${page}/${per_page_limit}`) - .then((response) => { - setUserDatas({ - ...userDatas, - loading: false, - users: response.data.evaluatees_to_create, - current_page: response.data.current_page, - has_next: response.data.has_next, - has_prev: response.data.has_prev, - total_items: response.data.total_items, - total_pages: response.data.total_pages, + .get(`/data/list-of-users-to-view/${page}/${per_page_limit}`) + .then((response) => { + setUserDatas({ + ...userDatas, + loading: false, + users: response.data.evaluatees_to_create, + current_page: response.data.current_page, + has_next: response.data.has_next, + has_prev: response.data.has_prev, + total_items: response.data.total_items, + total_pages: response.data.total_pages, + }); + setFilteredListOfUsers(response.data.evaluatees_to_create); + }) + .catch((error) => { + toast.error(error.response.data.message); + window.location.href = "/login-timeout"; }); - setFilteredListOfUsers(response.data.evaluatees_to_create); - }) - .catch((error) => { - toast.error(error.response.data.message); - window.location.href = "/login-timeout"; - }); } }; @@ -592,78 +593,342 @@ export default function ManagementFilesUsers() { return (
- { - isAuth().verified_email === "Verified" ? ( - <> -
-
- {loading ? ( - <> - - - - - - - - - - ) : ( - details.map((detail) => ( + {isAuth().verified_email === "Verified" ? ( + <> +
+
+ {loading ? ( + <> + + + + + + + + + + ) : ( + details.map((detail) => ( +
+
+
+ +
+
+

+ {detail.value} +

+

+ {detail.title} +

+
+
+
+ )) + )} +
+ handleSearchForUsers(event)} + placeholder="Search" + type="text" + /> +
+
+
+
+

+ Multiple Actions at once +

+
+ handleCreateAllUsers()} + title="Activate All Users" + > + {massActivation ? ( + <> + + {textChangeActivation} + + ) : ( + <> + + {textChangeActivation} + + )} + + handleUnlockAllUsers()} + title="Restore Authorization" + > + {massUnlocked ? ( + <> + + {textChangeUnlocked} + + ) : ( + <> + + {textChangeUnlocked} + + )} + + handleRestoreAllUsers()} + title="Restore Account" + > + {massRestore ? ( + <> + + {textChangeRestore} + + ) : ( + <> + + {textChangeRestore} + + )} + + handleDeactivateAllUsers()} + title="Deactivate all users" + > + {massDeactivation ? ( + <> + + {textChangeDeactivation} + + ) : ( + <> + + {textChangeDeactivation} + + )} + + handleLockAllUsers()} + title="Remove Authorization" + > + {massLocked ? ( + <> + + {textChangeLocked} + + ) : ( + <> + + {textChangeLocked} + + )} + + handleDeleteAllUsers()} + title="Archive User Confirmation" + > + {massDelete ? ( + <> + + {textChangeDelete} + + ) : ( + <> + + {textChangeDelete} + + )} + +
+
+
+ + + +
+ {loading_ ? ( + <> + + + + + ) : filteredListOfUsers.length > 0 ? ( + filteredListOfUsers.map((user) => ( +
+
+
+
+

+ {user.full_name} +

+
+
+
+
+
+

+ Status +

+
+
-
-
- -
-
-

- {detail.value} -

-

- {detail.title} -

-
-
+

+ {user.is_active ? "Activated" : "Deactivated"} +

- )) - )} -
- handleSearchForUsers(event)} - placeholder="Search" - type="text" - /> -
-
-
-
-

- Multiple Actions at once +
+

+ {user.is_locked ? "Locked" : "Unlocked"}

+
+

+ {user.is_deleted ? "Archived" : "Unarchived"} +

+
+

+
+

+ Details +

+
+
+

+ Email: +

+

+ {user.email} +

+
+
+

+ Username: +

+

+ {user.username} +

+
+
+

+ Role: +

+

+ {user.role} +

+
+
+

+ Department: +

+

+ {user.department_name} +

+
+
+
+
+

+ General +

+
+
handleCreateAllUsers()} - title="Activate All Users" + body={`Are you sure you want to Activate the user account of ${user.full_name}?`} + description="This action cannot be undone. The user you are trying to Activate will be able to access the system to view their sentiment scores." + disabled={disabledAllButtons[user.id]} + id={user.id} + is_many={false} + onConfirm={handleCreateUser} + title="Activate User Account" > - {massActivation ? ( + {loadingIDActivate[user.id] ? ( <> - - {textChangeActivation} + + Activating... ) : ( <> @@ -671,22 +936,23 @@ export default function ManagementFilesUsers() { className={`${ICON_PLACE_SELF_CENTER}`} icon={faBolt} /> - {textChangeActivation} + Activate )} handleUnlockAllUsers()} - title="Restore Authorization" + body={`Are you sure you want to unlock the user account of ${user.full_name}?`} + description="This action cannot be undone. The user you are trying to unlock will be able to access the system to view their sentiment scores." + disabled={disabledAllButtons[user.id]} + id={user.id} + is_many={false} + onConfirm={handleUnlockUser} + title="Unlock User Account" > - {massUnlocked ? ( + {loadingIDUnlock[user.id] ? ( <> - - {textChangeUnlocked} + + Unlocking... ) : ( <> @@ -694,22 +960,23 @@ export default function ManagementFilesUsers() { className={`${ICON_PLACE_SELF_CENTER}`} icon={faUnlock} /> - {textChangeUnlocked} + Unlock )} handleRestoreAllUsers()} - title="Restore Account" + disabled={disabledAllButtons[user.id]} + id={user.id} + is_many={false} + onConfirm={handleRestoreUser} + title="Restore User Account" > - {massRestore ? ( + {loadingIDRestore[user.id] ? ( <> - - {textChangeRestore} + + Restoring... ) : ( <> @@ -717,23 +984,24 @@ export default function ManagementFilesUsers() { className={`${ICON_PLACE_SELF_CENTER}`} icon={faRotate} /> - {textChangeRestore} + Restore )} handleDeactivateAllUsers()} - title="Deactivate all users" + is_many={false} + onConfirm={handleDeactivateUser} + title="Deactivate User Account" > - {massDeactivation ? ( + {loadingIDDeactivate[user.id] ? ( <> - {textChangeDeactivation} + Deactivating... ) : ( <> @@ -741,23 +1009,24 @@ export default function ManagementFilesUsers() { className={`${ICON_PLACE_SELF_CENTER}`} icon={faCircleXmark} /> - {textChangeDeactivation} + Deactivate )} handleLockAllUsers()} - title="Remove Authorization" + is_many={false} + onConfirm={handleLockUser} + title="Lock User Account" > - {massLocked ? ( + {loadingIDLock[user.id] ? ( <> - {textChangeLocked} + Locking... ) : ( <> @@ -765,23 +1034,24 @@ export default function ManagementFilesUsers() { className={`${ICON_PLACE_SELF_CENTER}`} icon={faLock} /> - {textChangeLocked} + Lock )} handleDeleteAllUsers()} - title="Archive User Confirmation" + is_many={false} + onConfirm={handleDeleteUser} + title="Delete User Account" > - {massDelete ? ( + {loadingIDDelete[user.id] ? ( <> - {textChangeDelete} + Archiving... ) : ( <> @@ -789,311 +1059,42 @@ export default function ManagementFilesUsers() { className={`${ICON_PLACE_SELF_CENTER}`} icon={faBoxArchive} /> - {textChangeDelete} + Archive )}
- - - -
- {loading_ ? ( - <> - - - - - ) : filteredListOfUsers.length > 0 ? ( - filteredListOfUsers.map((user) => ( -
-
-
-
-

- {user.full_name} -

-
-
-
-
-
-

- Status -

-
-
-
-

- {user.is_active ? "Activated" : "Deactivated"} -

-
-
-

- {user.is_locked ? "Locked" : "Unlocked"} -

-
-
-

- {user.is_deleted ? "Archived" : "Unarchived"} -

-
-
-
-

- Details -

-
-
-

- Email: -

-

- {user.email} -

-
-
-

- Username: -

-

- {user.username} -

-
-
-

- Role: -

-

- {user.role} -

-
-
-

- Department: -

-

- {user.department_name} -

-
-
-
-
-

- General -

-
-
- - {loadingIDActivate[user.id] ? ( - <> - - Activating... - - ) : ( - <> - - Activate - - )} - - - {loadingIDUnlock[user.id] ? ( - <> - - Unlocking... - - ) : ( - <> - - Unlock - - )} - - - {loadingIDRestore[user.id] ? ( - <> - - Restoring... - - ) : ( - <> - - Restore - - )} - - - {loadingIDDeactivate[user.id] ? ( - <> - - Deactivating... - - ) : ( - <> - - Deactivate - - )} - - - {loadingIDLock[user.id] ? ( - <> - - Locking... - - ) : ( - <> - - Lock - - )} - - - {loadingIDDelete[user.id] ? ( - <> - - Archiving... - - ) : ( - <> - - Archive - - )} - -
-
-
-
- )) - ) : ( -
- -
- )} -
- - - - - ) : () - } +
+ )) + ) : ( +
+ +
+ )} +
+ + + + + ) : ( + + )}
); } diff --git a/client/src/views/user/eval/EvalFiles.js b/client/src/views/user/eval/EvalFiles.js index 37ce7608..52ce2298 100644 --- a/client/src/views/user/eval/EvalFiles.js +++ b/client/src/views/user/eval/EvalFiles.js @@ -1,6 +1,6 @@ import { Link } from "react-router-dom"; import React, { useState, useEffect } from "react"; -import {Header, HeaderEmail} from "../../../components/headers/Header"; +import { Header, HeaderEmail } from "../../../components/headers/Header"; import httpClient from "../../../http/httpClient"; import { LoadingPageSkeletonText } from "../../../components/loading/LoadingPage"; import { SearchBar } from "../../../components/searchbar/SearchBar"; @@ -100,30 +100,30 @@ export default function EvalFiles() { * @param per_page */ const loadFiles = (page, per_page) => { - if(isAuth().verified_email === "Verified"){ + if (isAuth().verified_email === "Verified") { setFileData({ - ...fileData, - loading: true, - }); - httpClient - .get(`/data/list-of-csv-files-to-view-collections/${page}/${per_page}`) - .then((response) => { - setFileData({ - ...fileData, - loading: false, - files_list: response.data.csv_files, - current_page: response.data.current_page, - has_next: response.data.has_next, - has_prev: response.data.has_prev, - total_items: response.data.total_items, - total_pages: response.data.total_pages, - }); - setFilteredListOfFiles(response.data.csv_files); - }) - .catch((error) => { - toast.error(error.response.data.message); - window.location.href = "/login-timeout"; + ...fileData, + loading: true, }); + httpClient + .get(`/data/list-of-csv-files-to-view-collections/${page}/${per_page}`) + .then((response) => { + setFileData({ + ...fileData, + loading: false, + files_list: response.data.csv_files, + current_page: response.data.current_page, + has_next: response.data.has_next, + has_prev: response.data.has_prev, + total_items: response.data.total_items, + total_pages: response.data.total_pages, + }); + setFilteredListOfFiles(response.data.csv_files); + }) + .catch((error) => { + toast.error(error.response.data.message); + window.location.href = "/login-timeout"; + }); } }; @@ -136,198 +136,196 @@ export default function EvalFiles() { return (
- { - isAuth().verified_email === "Verified" ? ( - <> -
- handleSearchForFile(event)} - placeholder="Search" - type="text" - /> - - - -
- {loading ? ( - <> - - - - - ) : filteredListOfFiles.length > 0 ? ( - filteredListOfFiles.map((file) => ( -
-
-
-
-

- Evaluated File ID -

-

- {file.id}-{file.school_year} -

-
+ {isAuth().verified_email === "Verified" ? ( + <> +
+ handleSearchForFile(event)} + placeholder="Search" + type="text" + /> + + + +
+ {loading ? ( + <> + + + + + ) : filteredListOfFiles.length > 0 ? ( + filteredListOfFiles.map((file) => ( +
+
+
+
+

+ Evaluated File ID +

+

+ {file.id}-{file.school_year} +

+
+
+
+
+
+

+ Status +

+
+
+
+

+ {file.flag_deleted ? "Archived" : "Available"} +

-
-
-
-

- Status -

-
-
-
-

- {file.flag_deleted - ? "Archived" - : "Available"} -

-
-
-

- {file.flag_release ? "Published" : "Unpublished"} -

-
-
-
-

- Details -

-
-
-

- School Year: -

-

- {file.school_year} -

-
-
-

- School Semester: -

-

- {file.school_semester} -

-
-
-

- Topic: -

-

- {file.csv_question} -

-
+
+

+ {file.flag_release ? "Published" : "Unpublished"} +

- {!file.flag_release ? null : isAuth().verified_email === - "Verified" ? ( -
-
-

- Actions -

-
-
- -
-
- ) : ( -
-
-

- You need to verify your email to view this file -

-
-
- -
-
- )} +
+
+

+ Details +

+
+
+

+ School Year: +

+

+ {file.school_year} +

+
+
+

+ School Semester: +

+

+ {file.school_semester} +

+
+
+

+ Topic: +

+

+ {file.csv_question} +

- )) - ) : ( -
- + {!file.flag_release ? null : isAuth().verified_email === + "Verified" ? ( +
+
+

+ Actions +

+
+
+ +
+
+ ) : ( +
+
+

+ You need to verify your email to view this file +

+
+
+ +
+
+ )}
- )} +
+ )) + ) : ( +
+
- - - - - ) : () - } + )} +
+ + + + + ) : ( + + )}
); }