Skip to content

Commit

Permalink
Merge pull request #11 from chaitanyakole/tenant_data_separation
Browse files Browse the repository at this point in the history
Tenant,cohort- admin creation , Added filters of tenant and cohort, correction of listing
  • Loading branch information
gouravmore authored Dec 24, 2024
2 parents b982e30 + 3d0c1fb commit c30e48b
Show file tree
Hide file tree
Showing 24 changed files with 869 additions and 313 deletions.
16 changes: 13 additions & 3 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"DUPLICATED_USER": "Duplicate User",
"NO_USER_FOUND": "User not found",
"NO_CENTER_FOUND": "Centers not found",
"NO_TENANT_FOUND": "Tenant Not Found",
"NO_COHORT_FOUND": "Cohort Not Found",
"ALL": "All",
"NO_GO_BACK": "No, go back",
"YES": "Yes",
Expand Down Expand Up @@ -208,13 +210,16 @@
"SEARCHBAR_PLACEHOLDER": "Search Center..",
"COHORTS": "Cohorts",
"CREATE_SUCCESSFULLY": "Cohort Created Successfully",
"COHORT_ADMIN_CREATE_SUCCESSFULLY": "Cohort Admin Created Successfully",
"COHORT_ADMIN_CREATE_FAILED": "Cohort Admin Created Failed",
"CREATE_FAILED": "Cohort Creation Failed",
"ADD_NEW_COHORT": "Add New Cohort",
"UPDATE_COHORT": "Update Cohort",
"SEARCH_COHORT": "Search Cohort",
"DELETE_SUCCESSFULLY": "Cohort Deleted Successfully",
"ALL_STATES": "All States",
"COHORT_MEMBER": "Cohort Member"
"COHORT_MEMBER": "Cohort Member",
"ADD_NEW_COHORT_ADMIN": "Add New Cohort Admin"
},
"COURSE_PLANNER": {
"GRADE": "Grade",
Expand Down Expand Up @@ -425,7 +430,8 @@
"EMAIL": "Email",
"USERNAME": "Username",
"DOMAIN": "Domain",
"CREATE_TENANT_ADMIN": "Create Tenant Admin"
"CREATE_TENANT_ADMIN": "Create Tenant Admin",
"CREATE_COHORT_ADMIN": "Create Cohort Admin"
},
"WORKSPACE": {
"EDITOR_WORKSPACE": "Editor Workspace",
Expand All @@ -444,16 +450,20 @@
"ROLE_ASSIGNED_fAILED": "Role Assigned Failed",
"TENANT_MEMBER": "Tenant Member",
"ALL_TENANTS": "All Tenants",
"ADD_NEW_TENANT_ADMIN": "Add New Tenant Admin"
"ADD_NEW_TENANT_ADMIN": "Add New Tenant Admin",
"TENANT_ADMIN_CREATE": "Tenant Admin Created Successfully",
"TENANT_ADMIN_FAILED_TO_CREATE": "Failed to Create Tenant Admin"
},
"USER": {
"ADD_NEW_USER": "Add New User",
"UPDATE_USER": "Update User",
"CREATE_SUCCESSFULLY": "User Created Successfully",
"FAILED_TO_CREATE": "User Creation Failed ",
"DELETE_SUCCESSFULLY": "User Deleted Successfully",
"UPDATE_SUCCESSFULLY": "User Updated Successfully",
"FAILED_TO_UPDATE": "Failed to Update User",
"FAILED_TO_DELETE:": "Failed to Delete User",
"USER_ALREADY_EXIST": "User already exists",
"SEARCH": "Search User",
"NO_USER_FOUND": "Users not found",
"USER_NOT_FOUND": "User not found",
Expand Down
245 changes: 126 additions & 119 deletions src/components/ActionIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import { useTranslation } from "next-i18next";
import { Box, Typography, Tooltip,useTheme, Button } from "@mui/material";
import { Box, Typography, Tooltip, useTheme, Button } from "@mui/material";
import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/Delete";
import deleteIcon from '../../public/images/deleteIcon.svg';
import editIcon from '../../public/images/editIcon.svg';
import cohortIcon from '../../public/images/apartment.svg';
import addIcon from '../../public/images/addIcon.svg';
import deleteIcon from "../../public/images/deleteIcon.svg";
import editIcon from "../../public/images/editIcon.svg";
import cohortIcon from "../../public/images/apartment.svg";
import addIcon from "../../public/images/addIcon.svg";

import Image from "next/image";

Expand All @@ -18,9 +18,10 @@ interface ActionCellProps {
rowData: any;
disable: boolean;
addAction?: boolean;
userAction?:boolean
roleButton?:boolean
onAdd:(rowData:any)=>void;
userAction?: boolean;
roleButton?: boolean;
allowEditIcon?: boolean;
onAdd: (rowData: any) => void;
}

const ActionIcon: React.FC<ActionCellProps> = ({
Expand All @@ -29,14 +30,15 @@ const ActionIcon: React.FC<ActionCellProps> = ({
onDelete,
onAdd,
reassignCohort,
roleButton=false,
addAction=false,
userAction=false,
roleButton = false,
addAction = false,
userAction = false,
disable = false,
reassignType
allowEditIcon = false,
reassignType,
}) => {
const { t } = useTranslation();
const theme = useTheme<any>();
const theme = useTheme<any>();
return (
<Box
sx={{
Expand All @@ -47,125 +49,130 @@ const ActionIcon: React.FC<ActionCellProps> = ({
pointerEvents: disable ? "none" : "auto",
}}
>
{roleButton && (
<Tooltip title={t("COMMON.ADD")}>
<Button
onClick={() => {
onAdd(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor: "#EAF2FF",
p: "10px",
"&:hover": {
backgroundColor: "#d0e5ff", // Optional: adjust hover color
},
}}
>
{/* Optional typography or icon within the button */}
<Typography variant="body2" fontFamily={"Poppins"}>
{t("COMMON.ADD")}
</Typography>
</Button>
</Tooltip>
)}
{roleButton && (
<Tooltip title={t("COMMON.ADD")}>
<Button
onClick={() => {
onAdd(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor: "#EAF2FF",
p: "10px",
"&:hover": {
backgroundColor: "#d0e5ff", // Optional: adjust hover color
},
}}
>
{/* Optional typography or icon within the button */}
<Typography variant="body2" fontFamily={"Poppins"}>
{t("COMMON.ADD")}
</Typography>
</Button>
</Tooltip>
)}

{addAction&&<Tooltip title={t("COMMON.ADD")}>
<Box
onClick={() => {
onAdd(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor:"#EAF2FF",
p:"10px"
}}
>
<Image src={addIcon} alt="" />
{/*
{addAction && (
<Tooltip title={t("COMMON.ADD")}>
<Box
onClick={() => {
onAdd(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor: "#EAF2FF",
p: "10px",
}}
>
<Image src={addIcon} alt="" />
{/*
<Typography variant="body2" fontFamily={"Poppins"}>
{t("COMMON.DELETE")}
</Typography> */}
</Box>
</Tooltip>}
<Tooltip title={t("COMMON.EDIT")}>
<Box
onClick={() => {
onEdit(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor:"#E3EAF0",
p:"10px"


}}
>
<Image src={editIcon} alt="" />
{/* <Typography variant="body2" fontFamily={"Poppins"}>
</Box>
</Tooltip>
)}
{!allowEditIcon && (
<>
<Tooltip title={t("COMMON.EDIT")}>
<Box
onClick={() => {
onEdit(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor: "#E3EAF0",
p: "10px",
}}
>
<Image src={editIcon} alt="" />
{/* <Typography variant="body2" fontFamily={"Poppins"}>
{t("COMMON.EDIT")}
</Typography> */}
</Box>
</Tooltip>
<Tooltip title={t("COMMON.DELETE")}>
<Box
onClick={() => {
onDelete(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor:"#EAF2FF",
p:"10px"
}}
>
<Image src={deleteIcon} alt="" />
{/*
</Box>
</Tooltip>

<Tooltip title={t("COMMON.DELETE")}>
<Box
onClick={() => {
onDelete(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor: "#EAF2FF",
p: "10px",
}}
>
<Image src={deleteIcon} alt="" />
{/*
<Typography variant="body2" fontFamily={"Poppins"}>
{t("COMMON.DELETE")}
</Typography> */}
</Box>
</Tooltip>
</Box>
</Tooltip>
</>
)}

{ userAction && ( <Tooltip title={reassignType}>
<Box
onClick={() => {
if(reassignCohort)
reassignCohort(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor:"#E5E5E5",
p:"10px"
}}
>
<Image src={cohortIcon} alt="" />
{/*
{userAction && (
<Tooltip title={reassignType}>
<Box
onClick={() => {
if (reassignCohort) reassignCohort(rowData);
}}
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
cursor: "pointer",
color: disable ? theme?.palette?.secondary.contrastText : "",
backgroundColor: "#E5E5E5",
p: "10px",
}}
>
<Image src={cohortIcon} alt="" />
{/*
<Typography variant="body2" fontFamily={"Poppins"}>
{t("COMMON.DELETE")}
</Typography> */}
</Box>
</Tooltip>)}

</Box>
</Tooltip>
)}
</Box>
);
};
Expand Down
Loading

0 comments on commit c30e48b

Please sign in to comment.