Skip to content

Commit

Permalink
Merge pull request #283 from upendraTekdi/latest_code_admin_oblf
Browse files Browse the repository at this point in the history
Option to delete in master data - Cluster, School, Class
  • Loading branch information
itsvick authored Oct 25, 2024
2 parents 7c42fa1 + ba96b31 commit 7ccf940
Show file tree
Hide file tree
Showing 6 changed files with 342 additions and 236 deletions.
9 changes: 8 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
"STATE_NAME_REQUIRED": "State Name is Required",
"DISTRICT_NAME_REQUIRED": "District Name is Required",
"CREATE": "Create",
"CLUSTER_DELETED_FAILURE": "Cluster is not Deleted!",
"CLUSTER_DELETED_SUCCESS": "Cluster Deleted Successfully!",
"CLASS_DELETED_FAILURE": "Class is not Deleted!",
"CLASS_DELETED_SUCCESS": "Class Deleted Successfully!",
"SCHOOL_DELETED_FAILURE": "School is not Deleted!",
"SCHOOL_DELETED_SUCCESS": "School Deleted Successfully!",
"STATE_DELETED_SUCCESS": "State Deleted Successfully!",
"STATE_DELETED_FAILURE": "State is not Deleted!",
"STATE_ADDED_SUCCESS": "State Added Successfully!",
Expand Down Expand Up @@ -289,7 +295,8 @@
"RENAME": "Rename",
"CENTER_RENAMED": "Class Renamed Successfully!",
"SEND_REQUEST": "Send Request",
"SURE_DELETE_CLASS": "Are you sure you want to Delete ",
"SURE_DELETE_CLASS": "Are you sure you want to Delete",
"SURE_DELETE_DATA": "Are you sure you want to Delete {{data}} ?",
"YOU_CANT_DELETE_CLASS_HAS_ACTIVE_LEARNERS": "You can't delete the Class because it has {{activeMembers}} Active Students",
"CLASS_UPDATE_SUCCESSFULLY": "Class has been Successfully Updated",
"CLASS_DELETE_SUCCESSFULLY": "Class has been Successfully Deleted",
Expand Down
143 changes: 72 additions & 71 deletions src/components/ActionIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
import React from "react";
import { useTranslation } from "next-i18next";
import { Box, Typography, Tooltip,useTheme } from "@mui/material";
import { Box, Typography, Tooltip, useTheme } 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 deleteIcon from "../../public/images/deleteIcon.svg";
import editIcon from "../../public/images/editIcon.svg";
import cohortIcon from "../../public/images/apartment.svg";

import Image from "next/image";

interface ActionCellProps {
onEdit: (rowData: any) => void;
onDelete: (rowData: any) => void;
onEdit?: (rowData: any) => void;
onDelete?: (rowData: any) => void;
reassignCohort?: (rowData: any) => void;
reassignType?: string;
rowData: any;
disable: boolean;
userAction?:boolean
userAction?: boolean;
}

const ActionIcon: React.FC<ActionCellProps> = ({
rowData,
onEdit,
onDelete,
reassignCohort,
userAction=false,
userAction = false,
disable = false,
reassignType
reassignType,
}) => {
const { t } = useTranslation();
const theme = useTheme<any>();
Expand All @@ -41,76 +40,78 @@ const ActionIcon: React.FC<ActionCellProps> = ({
pointerEvents: disable ? "none" : "auto",
}}
>
<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"}>
{onEdit && (
<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:"#F8EFE7",
p:"10px"
}}
>
<Image src={deleteIcon} alt="" />
{/*
</Box>
</Tooltip>
)}
{onDelete && (
<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: "#F8EFE7",
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 7ccf940

Please sign in to comment.