Skip to content

Commit

Permalink
Merge pull request #30 from upendraTekdi/cohort_list
Browse files Browse the repository at this point in the history
Task #222930: UI building of cohort list, Add options to see archived data on the UI .
  • Loading branch information
itsvick authored Jul 18, 2024
2 parents 9ac045a + f313747 commit 80ff4da
Show file tree
Hide file tree
Showing 12 changed files with 512 additions and 111 deletions.
31 changes: 29 additions & 2 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
"REASON_FOR_DELETION": "Reason for Deletion",
"INCORRECT_DATA_ENTRY": "Incorrect Data Entry",
"DUPLICATED_USER": "Duplicate User",
"OTHER":"Other",
"SORT":"Sort"
"NO_GO_BACK": "No, go back",
"YES": "Yes",
"SURE_REASSIGN_CENTER": "Are you sure you want to re-assign Center to this user?",
"OTHER": "Other",
"SORT": "Sort",
"EDIT_COHORT_NAME": "Edit Cohort",
"NAME": "Name",
"UPDATE_COHORT": "Update Cohort"
},
"LOGIN_PAGE": {
"USERNAME": "Username",
Expand Down Expand Up @@ -67,5 +73,26 @@
"SEARCHBAR_PLACEHOLDER_DISTRICT": "Search Districts",
"SEARCHBAR_PLACEHOLDER_BLOCK": "Search Blocks",
"BLOCKS": "Blocks"
},
"CENTERS": {
"CENTERS": "Centers",
"REGULAR_CENTERS": "Regular Centers",
"REMOTE_CENTERS": "Remote Centers",
"REMOTE_CENTER": "Remote Center",
"REGULAR": "Regular",
"REMOTE": "Remote",
"SEARCH_BLOCKS": "Search Blocks",
"BLOCK_REQUEST": "You are sending a request to the state Team Leader to re-assign the Block to this user",
"NEW_CENTER": "New Center",
"CENTER_TYPE": "Center Type",
"UNIT_NAME": "Unit Name",
"NOTE": "Note: This will be the center name",
"CENTER_CREATED": "Center Created Successfully!",
"RENAME_CENTER": "Rename Center",
"REQUEST_TO_DELETE": "Request to Delete",
"RENAME": "Rename",
"CENTER_RENAMED": "Center Renamed Successfully!",
"SEND_REQUEST": "Send Request",
"REQUEST_TO_DELETE_HAS_BEEN_SENT": "Request to Delete has been sent"
}
}
34 changes: 33 additions & 1 deletion public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@
"PASSWORD_PLACEHOLDER": "पासवर्ड दर्ज करें",
"USERNAME_PASSWORD_NOT_CORRECT": "आपका यूजरनेम या पासवर्ड गलत है",
"FORGOT_PASSWORD": "पासवर्ड भूल गए?",
"REMEMBER_ME": "मुझे याद रखें"
"REMEMBER_ME": "मुझे याद रखें",
"NO_GO_BACK": "नहीं, वापस जाओ",
"YES": "हाँ",
"OTHER": "अन्य",
"SORT": "क्रमबद्ध करें",
"EDIT_COHORT_NAME": "समूह संपादित करें",
"UPDATE_COHORT": "अद्यतन समूह"


},
"COHORTS": {
"SEARCHBAR_PLACEHOLDER": "कोहॉर्ट्स खोजें.."
},
"ACTIONBUTONS": {
"EDIT": "संपादित करें",
Expand All @@ -30,5 +41,26 @@
"BLOCK_NAMES": "ब्लॉक के नाम",
"ALL_DISTRICTS": "सभी जिले",
"ALL_BLOCKS": "सभी ब्लॉक"
},
"CENTERS": {
"CENTERS": "केंद्र",
"REGULAR_CENTERS": "नियमित केंद्र",
"REMOTE_CENTERS": "दूरस्थ केंद्र",
"REMOTE_CENTER": "दूरस्थ केंद्र",
"REGULAR": "नियमित",
"REMOTE": "दूरस्थ",
"SEARCH_BLOCKS": "ब्लॉक खोजें",
"BLOCK_REQUEST": "आप इस उपयोगकर्ता को ब्लॉक पुनः असाइन करने के लिए राज्य टीम लीडर को अनुरोध भेज रहे हैं",
"NEW_CENTER": "नया केंद्र",
"CENTER_TYPE": "केंद्र प्रकार",
"UNIT_NAME": "इकाई का नाम",
"NOTE": "नोट: यह केंद्र का नाम होगा",
"CENTER_CREATED": "केंद्र सफलतापूर्वक बनाया गया!",
"RENAME_CENTER": "केंद्र का नाम बदलें",
"REQUEST_TO_DELETE": "हटाने का अनुरोध",
"RENAME": "नाम बदलें",
"CENTER_RENAMED": "केंद्र का नाम सफलतापूर्वक बदला गया!",
"SEND_REQUEST": "अनुरोध भेजें",
"REQUEST_TO_DELETE_HAS_BEEN_SENT": "हटाने का अनुरोध भेजा गया है"
}
}
35 changes: 33 additions & 2 deletions public/locales/mr/common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"COMMON": {
"LANGUAGE": "भाषा",
"LOADING": "लोड होत आहे"
"LOADING": "लोड होत आहे",
"OTHER": "इतर",
"SORT": "क्रमवारी लावा",
"EDIT_COHORT_NAME": "समूह संपादित करा",
"NAME": "नाव",
"UPDATE_COHORT": "कोहॉर्ट अपडेट करा"
},
"LOGIN_PAGE": {
"USERNAME": "वापरकर्तानाव",
Expand All @@ -11,7 +16,12 @@
"PASSWORD_PLACEHOLDER": "पासवर्ड टाका",
"USERNAME_PASSWORD_NOT_CORRECT": "आपलं वापरकर्तानाव किंवा संकेतशब्द चुकीचं आहे",
"FORGOT_PASSWORD": "पासवर्ड विसरलात?",
"REMEMBER_ME": "मला लक्षात ठेवा"
"REMEMBER_ME": "मला लक्षात ठेवा",
"NO_GO_BACK": "नाही, परत जा",
"YES": "होय"
},
"COHORTS": {
"SEARCHBAR_PLACEHOLDER": "कोहॉर्ट्स शोधा.."
},
"ACTIONBUTONS": {
"EDIT": "संपादित करा",
Expand All @@ -30,5 +40,26 @@
"BLOCK_NAMES": "ब्लॉकचे नावे",
"ALL_DISTRICTS": "सर्व जिल्हे",
"ALL_BLOCKS": "सर्व ब्लॉक"
},
"CENTERS": {
"CENTERS": "केंद्रे",
"REGULAR_CENTERS": "नियमित केंद्रे",
"REMOTE_CENTERS": "दूरस्थ केंद्रे",
"REMOTE_CENTER": "दूरस्थ केंद्र",
"REGULAR": "नियमित",
"REMOTE": "दूरस्थ",
"SEARCH_BLOCKS": "ब्लॉक शोधा",
"BLOCK_REQUEST": "आपण या वापरकर्त्यास ब्लॉक पुन्हा नियुक्त करण्यासाठी राज्य टीम लीडरला विनंती पाठवत आहात",
"NEW_CENTER": "नवीन केंद्र",
"CENTER_TYPE": "केंद्र प्रकार",
"UNIT_NAME": "युनिटचे नाव",
"NOTE": "टीप: हे केंद्राचे नाव असेल",
"CENTER_CREATED": "केंद्र यशस्वीरित्या तयार झाले!",
"RENAME_CENTER": "केंद्राचे नाव बदला",
"REQUEST_TO_DELETE": "हटविण्याची विनंती",
"RENAME": "नाव बदला",
"CENTER_RENAMED": "केंद्राचे नाव यशस्वीरित्या बदलले!",
"SEND_REQUEST": "विनंती पाठवा",
"REQUEST_TO_DELETE_HAS_BEEN_SENT": "हटविण्याची विनंती पाठविण्यात आली आहे"
}
}
37 changes: 34 additions & 3 deletions public/locales/or/common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"COMMON": {
"LANGUAGE": "ଭାଷା",
"LOADING": "ଲୋଡ୍ ହେଉଛି (Loading)"
"LOADING": "ଲୋଡ୍ ହେଉଛି (Loading)",
"UPDATE_COHORT": "କୋହୋର୍ଟ୍ ଅଦ୍ୟତନ କରନ୍ତୁ",
"SORT": "ସର୍ଟ",
"OTHER": "ଅନ୍ୟ",
"NAME": "ନାମ"
},
"LOGIN_PAGE": {
"USERNAME": "ଉପଯୋଗକର୍ତା ନାମ",
Expand All @@ -11,11 +15,17 @@
"PASSWORD_PLACEHOLDER": "ପାସୱାର୍ଡ ଏଣ୍ଟର କର",
"USERNAME_PASSWORD_NOT_CORRECT": "ଆପଣଙ୍କ ବ୍ୟବହାରକୃତ ନାମ କିମ୍ବା ପାସ୍‌ୱାର୍ଡ ଭୁଲ ଅଛି",
"FORGOT_PASSWORD": "ପାସ୍‌ୱାର୍ଡ ଭୁଲିଛନ୍ତି?",
"REMEMBER_ME": "ମୋତେ ମନ ରଖ"
"REMEMBER_ME": "ମୋତେ ମନ ରଖ",
"NO_GO_BACK": "ନାହିଁ, ପଛକୁ ଯାଆନ୍ତୁ",
"YES": "ହଁ"
},
"ACTIONBUTONS": {
"EDIT": "ସଂପାଦନା",
"DELETE": "ବିଲୋପ"},
"DELETE": "ବିଲୋପ"
},
"COHORTS": {
"SEARCHBAR_PLACEHOLDER": "କୋହର୍ଟସ୍ ସନ୍ଧାନ କରନ୍ତୁ.."
},
"MASTER": {
"STATE": "ରାଜ୍ୟ",
"SORT": "ଛାଟାନ୍ତୁ",
Expand All @@ -29,5 +39,26 @@
"BLOCK_NAMES": "ବ୍ଲକ୍ ନାମ",
"ALL_DISTRICTS": "ସମସ୍ତ ଜିଲ୍ଲା",
"ALL_BLOCKS": "ସମସ୍ତ ବ୍ଲକ୍‌"
},
"CENTERS": {
"CENTERS": "କେନ୍ଦ୍ରଗୁଡିକ",
"REGULAR_CENTERS": "ନିୟମିତ କେନ୍ଦ୍ରଗୁଡିକ",
"REMOTE_CENTERS": "ଦୂରସ୍ଥ କେନ୍ଦ୍ରଗୁଡିକ",
"REMOTE_CENTER": "ଦୂରସ୍ଥ କେନ୍ଦ୍ର",
"REGULAR": "ନିୟମିତ",
"REMOTE": "ଦୂରସ୍ଥ",
"SEARCH_BLOCKS": "ବ୍ଲକଗୁଡ଼ିକୁ ଖୋଜନ୍ତୁ",
"BLOCK_REQUEST": "ଆପଣ ଏହି ବ୍ୟବହାରକାରୀଙ୍କୁ ବ୍ଲକ ପୁନଃ ନିଯୁକ୍ତ କରିବା ପାଇଁ ରାଜ୍ୟ ଟିମ୍ ଲିଡରକୁ ଅନୁରୋଧ ପଠାଉଛନ୍ତି",
"NEW_CENTER": "ନୂତନ କେନ୍ଦ୍ର",
"CENTER_TYPE": "କେନ୍ଦ୍ର ପ୍ରକାର",
"UNIT_NAME": "ଅଂଶର ନାମ",
"NOTE": "ଟିପ୍ପଣୀ: ଏହା ହେବ କେନ୍ଦ୍ରର ନାମ",
"CENTER_CREATED": "କେନ୍ଦ୍ର ସଫଳତାପୂର୍ଣ୍ଣ ଭାବରେ ସୃଷ୍ଟି ହେଲା!",
"RENAME_CENTER": "କେନ୍ଦ୍ରର ନାମ ପରିବର୍ତ୍ତନ କରନ୍ତୁ",
"REQUEST_TO_DELETE": "ମିଟାଇବାକୁ ଅନୁରୋଧ",
"RENAME": "ନାମ ପରିବର୍ତ୍ତନ କରନ୍ତୁ",
"CENTER_RENAMED": "କେନ୍ଦ୍ରର ନାମ ସଫଳତାପୂର୍ଣ୍ଣ ଭାବରେ ପରିବର୍ତ୍ତିତ ହେଲା!",
"SEND_REQUEST": "ଅନୁରୋଧ ପଠାଅନ୍ତୁ",
"REQUEST_TO_DELETE_HAS_BEEN_SENT": "ମିଟାଇବା ପାଇଁ ଅନୁରୋଧ ପଠାଯାଇଛି"
}
}
66 changes: 38 additions & 28 deletions src/components/ActionCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,44 @@ const ActionCell: React.FC<ActionCellProps> = ({
};

return (
<Box>
<IconButton size="small" onClick={handleClick}>
<MoreVertIcon fontSize="small" />
</IconButton>
<Menu anchorEl={anchorEl} open={Boolean(anchorEl)} onClose={handleClose}>
{extraActions?.map((action, index) => (
<>
<Divider />
<MenuItem
sx={{ fontSize: "small" }}
onClick={() => {
action.onClick(rowData);
handleClose();
}}
>
{showIcons ? (
<ListItemIcon>
<action.icon fontSize="small" />
</ListItemIcon>
) : (
""
)}
<ListItemText primary={t(action.name)} />
</MenuItem>
</>
))}
</Menu>
</Box>
<React.Fragment>
{extraActions.length > 0 ? (
<Box>
<IconButton size="small" onClick={handleClick}>
<MoreVertIcon fontSize="small" />
</IconButton>
<Menu
anchorEl={anchorEl}
open={Boolean(anchorEl)}
onClose={handleClose}
>
{extraActions?.map((action, index) => (
<>
<Divider />
<MenuItem
sx={{ fontSize: "small" }}
onClick={() => {
action.onClick(rowData);
handleClose();
}}
>
{showIcons ? (
<ListItemIcon>
<action.icon fontSize="small" />
</ListItemIcon>
) : (
""
)}
<ListItemText primary={t(action.name)} />
</MenuItem>
</>
))}
</Menu>
</Box>
) : (
""
)}
</React.Fragment>
);
};

Expand Down
107 changes: 107 additions & 0 deletions src/components/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import * as React from "react";

import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import { Divider } from "@mui/material";
import Modal from "@mui/material/Modal";
import { useTheme } from "@mui/material/styles";

interface ConfirmationModalProps {
message: string;
handleAction?: () => void;
buttonNames: ButtonNames;
handleCloseModal: () => void;
modalOpen: boolean;
}

interface ButtonNames {
primary: string;
secondary: string;
}

const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
modalOpen,
message,
handleAction,
buttonNames,
handleCloseModal,
}) => {
const theme = useTheme();

const style = {
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: "75%",
bgcolor: "#fff",
boxShadow: 24,
borderRadius: "16px",
"@media (min-width: 600px)": {
width: "350px",
},
};

return (
<Modal
open={modalOpen}
onClose={handleCloseModal}
aria-labelledby="confirmation-modal-title"
aria-describedby="confirmation-modal-description"
>
<Box sx={style}>
<Box sx={{ p: 3 }} id="confirmation-modal-title">
{message}
</Box>
<Divider />
<Box
sx={{
display: "flex",
justifyContent: "center",
gap: "18px",
p: 2,
}}
>
<Button
sx={{
border: "none",
color: theme.palette.secondary.main,
fontSize: "14px",
fontWeight: "500",
"&:hover": {
border: "none",
backgroundColor: "transparent",
},
}}
variant="outlined"
onClick={handleCloseModal}
>
{buttonNames.secondary}
</Button>
<Button
sx={{
width: "auto",
height: "40px",
fontSize: "14px",
fontWeight: "500",
}}
variant="contained"
color="primary"
onClick={() => {
if (handleAction !== undefined) {
handleAction();
handleCloseModal();
} else {
handleCloseModal();
}
}}
>
{buttonNames.primary}
</Button>
</Box>
</Box>
</Modal>
);
};

export default ConfirmationModal;
Loading

0 comments on commit 80ff4da

Please sign in to comment.