diff --git a/src/common/DeleteDialog.jsx b/src/common/DeleteDialog.jsx index 76d004bf..bc879d7c 100644 --- a/src/common/DeleteDialog.jsx +++ b/src/common/DeleteDialog.jsx @@ -101,13 +101,13 @@ const DeleteDialog = ({ Cancel diff --git a/src/common/Header.jsx b/src/common/Header.jsx index 782d7341..95d97832 100644 --- a/src/common/Header.jsx +++ b/src/common/Header.jsx @@ -155,10 +155,10 @@ const Header = () => { ]; return ( - <> + {isMobile ? ( - + ) : ( { columnGap={2} rowGap={2} > - {userData?.role !== "ADMIN" && (<> + + (<> { Tasks - )} + {userData?.role == "ADMIN" && + + isActive + ? `${classes.highlightedMenu} organizations` + : `${classes.headerMenu} organizations` + } + > + Admin + + } + ) {/* { handleClose={() => handleClose()} setOpenHelpDialog= {setOpenHelpDialog} />} - + ); }; export default Header; diff --git a/src/common/MobileNavbar.jsx b/src/common/MobileNavbar.jsx index 44c42b20..ba0aa175 100644 --- a/src/common/MobileNavbar.jsx +++ b/src/common/MobileNavbar.jsx @@ -1,7 +1,7 @@ import React, { useState } from "react"; -import { NavLink } from "react-router-dom"; +import { NavLink, useNavigate } from "react-router-dom"; -//Style +//Styles import { headerStyle } from "styles"; //Components @@ -10,40 +10,47 @@ import { IconButton, List, ListItem, - Grid, AppBar, Divider, Avatar, Typography, Box, + Tooltip, } from "@mui/material"; import MenuIcon from "@mui/icons-material/Menu"; +import HourglassBottomIcon from "@mui/icons-material/HourglassBottom"; +import HelpOutlineIcon from "@mui/icons-material/HelpOutline"; -function MobileNavbar({ UserMenu, SettingsMenu }) { +function MobileNavbar({ UserMenu, SettingsMenu, userData }) { const [openDrawer, setOpenDrawer] = useState(false); const classes = headerStyle(); + const navigate = useNavigate(); const tabs = [ { name: "Organizations", onClick: () => { + navigate(`/my-organization/${userData?.organization?.id}`); setOpenDrawer(false); }, }, { - name: "project", + name: "Tasks", onClick: () => { + navigate(`/task-list`); setOpenDrawer(false); }, }, - { - name: "workspace", - onClick: () => { - setOpenDrawer(false); - }, - }, - ]; - + userData?.role === "ADMIN" + ? { + name: "Admin", + onClick: () => { + navigate(`/admin`); + setOpenDrawer(false); + }, + } + : null, + ].filter(Boolean); return ( <> @@ -62,51 +70,45 @@ function MobileNavbar({ UserMenu, SettingsMenu }) { justifyContent: "space-between", height: "100%", paddingBottom: "16px", + }} > - setOpenDrawer(false)} + - + {userData?.first_name?.charAt(0)} + + - - U - - - User - - - + {userData?.first_name} {userData?.last_name} + + - + {tabs.map((tab, index) => ( - setOpenDrawer(false)}> - + + - - - App Settings + + {userData?.role === "ADMIN" || + userData?.role === "ORG_OWNER" || + userData?.role === "PROJECT_MANAGER" ? ( + { + navigate("/task-queue-status"); + setOpenDrawer(false); + }} + className={`${classes.icon} help`} + > + + + + + ) : ( + "" + )} + + { + // Assuming handleClickHelp is a function to open the help dialog + navigate("/help"); + setOpenDrawer(false); + }} + className={`${classes.icon} help`} + > + + + + + + {/* {SettingsMenu.map((setting, index) => ( - + { + setting.onClick(); + setOpenDrawer(false); + }}> ))} - + */} { - setting.onclick(); + setting.onClick(); setOpenDrawer(false); }} > @@ -177,6 +215,7 @@ function MobileNavbar({ UserMenu, SettingsMenu }) { color: "black", fontSize: "1rem", fontWeight: "400", + cursor:"pointer" }} > {setting.name} @@ -189,13 +228,12 @@ function MobileNavbar({ UserMenu, SettingsMenu }) { - @@ -205,22 +243,23 @@ function MobileNavbar({ UserMenu, SettingsMenu }) { className={classes.headerLogo} /> - Chitralekha + Chitralekha - + Powered by EkStep Foundation - - setOpenDrawer(!openDrawer)}> - - - - + setOpenDrawer(!openDrawer)}> + + + ); } + export default MobileNavbar; diff --git a/src/containers/Admin/OrganizationList.jsx b/src/containers/Admin/OrganizationList.jsx index 5a538f65..001a65bb 100644 --- a/src/containers/Admin/OrganizationList.jsx +++ b/src/containers/Admin/OrganizationList.jsx @@ -12,14 +12,19 @@ import { TableStyles } from "styles"; import { Box, IconButton, ThemeProvider, Tooltip } from "@mui/material"; import MUIDataTable from "mui-datatables"; import DeleteIcon from "@mui/icons-material/Delete"; +import ArchiveIcon from "@mui/icons-material/Archive"; +import UnarchiveIcon from "@mui/icons-material/Unarchive"; import EditIcon from "@mui/icons-material/Edit"; +import VisibilityIcon from "@mui/icons-material/Visibility"; import { DeleteDialog } from "common"; //APIs import { APITransport, - DeleteOrganizationAPI, + ArchiveOrganizationAPI, + UnarchiveOrganizationAPI, FetchOrganizationListAPI, + DeleteOrganizationAPI, } from "redux/actions"; const OrganizationList = () => { @@ -30,20 +35,23 @@ const OrganizationList = () => { const orgList = useSelector((state) => state.getOrganizationList.data); const apiStatus = useSelector((state) => state.apiStatus); - const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); + const [dialogOpen, setDialogOpen] = useState(false); const [currentOrgId, setCurrentOrgId] = useState(""); + const [isArchived, setIsArchived] = useState(false); + const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); useEffect(() => { const { progress, success, apiType } = apiStatus; if (!progress) { if (success) { - if (apiType === "DELETE_ORGANIZATION") { + if (apiType === "ARCHIVE_ORGANIZATION" || apiType === "UNARCHIVE_ORGANIZATION") { getOrgList(); } } setDeleteDialogOpen(false); + } // eslint-disable-next-line @@ -59,6 +67,12 @@ const OrganizationList = () => { // eslint-disable-next-line }, []); + const handleArchiveUnarchive = async () => { + setIsArchived(false) + setDialogOpen(false) + }; + const userData = useSelector((state) => state.getLoggedInUserDetails.data); + const columns = getColumns(adminOrgListColumns); columns.push({ name: "Action", @@ -71,19 +85,33 @@ const OrganizationList = () => { className: classes.cellHeaderProps, }), customBodyRender: (_value, tableMeta) => { + const rowIndex = tableMeta.rowIndex; + const archived = orgList[rowIndex]?.archived || false; // Adjust based on your data structure + return ( + + { + navigate(`/my-organization/${orgList[rowIndex]?.id}`); + }} + // disabled={archived} + > + + + + { - navigate(`/admin/edit-organization/${tableMeta.rowData[0]}`); + navigate(`/admin/edit-organization/${orgList[rowIndex]?.id}`); }} + // disabled={archived} > - - + {/* { setDeleteDialogOpen(true); @@ -92,13 +120,28 @@ const OrganizationList = () => { > - + */} + + {/* + { + setDialogOpen(true); + setCurrentOrgId(orgList[rowIndex]?.id); + setIsArchived(archived); + }} + > + {archived ? ( + + ) : ( + + )} + + */} ); }, }, }); - const handleDelete = async (currentOrgId) => { const apiObj = new DeleteOrganizationAPI(currentOrgId); dispatch(APITransport(apiObj)); @@ -114,17 +157,29 @@ const OrganizationList = () => { /> - {deleteDialogOpen && ( + {deleteDialogOpen && ( setDeleteDialogOpen(false)} - submit={() => handleDelete(currentOrgId)} - message={`Are you sure, you want to delete this Organization? All the associated videos, tasks, will be deleted.`} - loading={apiStatus.loading} + openDialog={deleteDialogOpen} + handleClose={() => setDeleteDialogOpen(false)} + submit={() => handleDelete(currentOrgId)} + message={`Are you sure, you want to delete this Organization? All the associated videos, tasks, will be deleted.`} + loading={apiStatus.loading} /> + )} ); }; export default OrganizationList; + + +{/* setDialogOpen(false)} + submit={handleArchiveUnarchive} + message={`Are you sure you want to ${isArchived ? "unarchive" : "archive"} this organization?`} + loading={apiStatus.loading} + confirmText={isArchived ? "Unarchive" : "Archive"} + closeText="Close" + /> */} \ No newline at end of file diff --git a/src/containers/Organization/MyOrganization.jsx b/src/containers/Organization/MyOrganization.jsx index 001252c5..54b85cc3 100644 --- a/src/containers/Organization/MyOrganization.jsx +++ b/src/containers/Organization/MyOrganization.jsx @@ -200,16 +200,16 @@ const MyOrganization = () => { > - {roles.filter((role) => role.value === userData?.role)[0] + { roles.filter((role) => role.value === userData?.role)[0] ?.canAddMembers && ( )} - {isUserOrgOwner&& ( + {(isUserOrgOwner|| userData?.role==="ADMIN") &&( )} - {isUserOrgOwner && ( + {(isUserOrgOwner || userData?.role==="ADMIN")&&( { alignItems="center" > - {isUserOrgOwner && ( + {(isUserOrgOwner|| userData?.role==="ADMIN") && ( - {(isUserOrgOwner || + {(isUserOrgOwner || loggedInUserData?.role==="ADMIN"|| + loggedInUserData.role === "PROJECT_MANAGER") && (