Skip to content

Commit

Permalink
Merge pull request #804 from AI4Bharat/dev2-s
Browse files Browse the repository at this point in the history
Dev2 s
  • Loading branch information
aparna-aa authored Sep 2, 2024
2 parents b313bd4 + 4220f0c commit 1646654
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 14 deletions.
48 changes: 41 additions & 7 deletions src/common/AddOrganizationMember.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, useEffect } from "react";
import { Fragment, useEffect,useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { MenuProps } from "utils";

Expand Down Expand Up @@ -38,13 +38,39 @@ const AddOrganizationMember = ({
isAdmin,
}) => {
const dispatch = useDispatch();
const [inputValue, setInputValue] = useState("");

const userRoles = useSelector((state) => state.getUserRoles.data);

const getUserRolesList = () => {
const userObj = new FetchUserRolesAPI();
dispatch(APITransport(userObj));
};
const handleKeyDown = (event) => {
if (event.key === "Enter" || event.key === " " || event.key === ",") {
event.preventDefault();
if (inputValue.trim()) {
handleTextField((prev) => [...prev, inputValue.trim()]);
setInputValue("");
}
}
};
// const save =(event)=>{
// if (inputValue.trim()) {
// handleTextField((prev) => [...prev, inputValue.trim()]);
// setInputValue("");
// }
// }

// const handleAddButtonClick = async() => {
// save();
// await(handleTextField)
// setTimeout(() => {
// addBtnClickHandler();
// handleUserDialogClose();
// }, 1000);
// };


useEffect(() => {
getUserRolesList();
Expand All @@ -69,7 +95,10 @@ const AddOrganizationMember = ({
<Typography variant="h4">{title}</Typography>
<IconButton
aria-label="close"
onClick={handleUserDialogClose}
onClick={()=>{
addBtnClickHandler()
handleUserDialogClose()
}}
sx={{ marginLeft: "auto" }}
>
<CloseIcon />
Expand All @@ -82,10 +111,15 @@ const AddOrganizationMember = ({
freeSolo
id="add-members"
value={textFieldValue}
onChange={(event) => {
event.target.value.trim().length &&
handleTextField((prev) => [...prev, event.target.value]);
onChange={(event, newValue, reason) => {
console.log("hello",event,newValue,reason);

}}
inputValue={inputValue}
onInputChange={(event, newInputValue) => {
setInputValue(newInputValue);
}}
onKeyDown={handleKeyDown}
options={[]}
renderTags={(tagValue) => {
return tagValue.map((option) => (
Expand Down Expand Up @@ -150,8 +184,8 @@ const AddOrganizationMember = ({
variant="contained"
sx={{ marginLeft: "10px", borderRadius: "8px" }}
onClick={() => {
addBtnClickHandler();
handleUserDialogClose();
addBtnClickHandler()
handleUserDialogClose()
}}
disabled={textFieldLabel || selectFieldValue ? false : true}
>
Expand Down
4 changes: 2 additions & 2 deletions src/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const Header = () => {
rowGap={2}
>

(<>
<>
<Typography variant="body1">
<NavLink
to={`/my-organization/${userData?.organization?.id}`}
Expand Down Expand Up @@ -242,7 +242,7 @@ const Header = () => {
Admin
</NavLink>
</Typography>}
</>)
</>
{/* <Typography variant="body1">
<NavLink
to="/projects"
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Admin/OrganizationList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const OrganizationList = () => {
}),
customBodyRender: (_value, tableMeta) => {
const rowIndex = tableMeta.rowIndex;
const archived = orgList[rowIndex]?.archived || false; // Adjust based on your data structure
const archived = orgList[rowIndex]?.archived || false;

return (
<Box sx={{ display: "flex" }}>
Expand Down
8 changes: 4 additions & 4 deletions src/containers/Organization/Project/EditProject.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ const EditProject = () => {
md={12}
lg={12}
xl={12}
style={{ display: "flex", justifyContent: "center" }}
style={{ display: "flex",justifyContent:"space-around"}}
>
<Typography variant="h3" align="center" marginLeft={"auto"}>
<Typography variant="h3" align="center" >
Project Settings
</Typography>

<Button
{/* <Button
color="primary"
variant="contained"
onClick={() => handleSubmit()}
Expand All @@ -321,7 +321,7 @@ const EditProject = () => {
{apiStatus.loading && (
<Loader size={20} margin="0 0 0 10px" color="secondary" />
)}
</Button>
</Button> */}
</Grid>

<Grid item xs={12} sm={12} md={6} lg={6} xl={6}>
Expand Down

0 comments on commit 1646654

Please sign in to comment.