From 65188e7ef1576d7b43237796b60ce82a9b044cd3 Mon Sep 17 00:00:00 2001 From: sagarika-padmanaban Date: Mon, 2 Sep 2024 21:15:29 +0530 Subject: [PATCH 1/5] task dialog fixes --- src/common/CreateTaskDialog.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common/CreateTaskDialog.jsx b/src/common/CreateTaskDialog.jsx index 261991cb..aa452bd5 100644 --- a/src/common/CreateTaskDialog.jsx +++ b/src/common/CreateTaskDialog.jsx @@ -76,6 +76,9 @@ const[langLabel,setlabel] =useState("") const filteredMembers = projectMembers.filter((member) => member.languages.includes(langLabel) ); + const sourceLangMembers = projectMembers.filter((member) => + member.languages.includes(videoDetails?.language_label) + ); useEffect(() => { const taskObj = new FetchTaskTypeAPI(); dispatch(APITransport(taskObj)); @@ -89,8 +92,8 @@ const[langLabel,setlabel] =useState("") // eslint-disable-next-line }, []); useEffect(() => { - console.log(filteredMembers.length) - if (filteredMembers.length === 0) { + console.log(filteredMembers.length,videoDetails) + if (!taskType.includes("TRANSCRIPTION")&&filteredMembers.length === 0) { setShowPopup(true); } else{ @@ -384,7 +387,11 @@ const[langLabel,setlabel] =useState("") inputProps={{ "aria-label": "Without label" }} disabled={isAssignUserDropdownDisabled()} > - {filteredMembers.map((item, index) => ( + {langLabel?filteredMembers.map((item, index) => ( + + {`${item.first_name} ${item.last_name} (${item.email})`} + + )):sourceLangMembers.map((item, index) => ( {`${item.first_name} ${item.last_name} (${item.email})`} From 14a78f095586938aaa24300dc7dad08907d9fea8 Mon Sep 17 00:00:00 2001 From: sagarika-padmanaban Date: Mon, 2 Sep 2024 21:19:14 +0530 Subject: [PATCH 2/5] task dialog fixes --- src/common/AddOrganizationMember.jsx | 48 ++++++++++++++++--- src/common/Header.jsx | 4 +- src/containers/Admin/OrganizationList.jsx | 2 +- .../Organization/Project/EditProject.jsx | 8 ++-- 4 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/common/AddOrganizationMember.jsx b/src/common/AddOrganizationMember.jsx index 32ca81e3..518e7d98 100644 --- a/src/common/AddOrganizationMember.jsx +++ b/src/common/AddOrganizationMember.jsx @@ -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"; @@ -38,6 +38,7 @@ const AddOrganizationMember = ({ isAdmin, }) => { const dispatch = useDispatch(); + const [inputValue, setInputValue] = useState(""); const userRoles = useSelector((state) => state.getUserRoles.data); @@ -45,6 +46,31 @@ const AddOrganizationMember = ({ 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(); @@ -69,7 +95,10 @@ const AddOrganizationMember = ({ {title} { + addBtnClickHandler() + handleUserDialogClose() + }} sx={{ marginLeft: "auto" }} > @@ -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) => ( @@ -150,8 +184,8 @@ const AddOrganizationMember = ({ variant="contained" sx={{ marginLeft: "10px", borderRadius: "8px" }} onClick={() => { - addBtnClickHandler(); - handleUserDialogClose(); + addBtnClickHandler() + handleUserDialogClose() }} disabled={textFieldLabel || selectFieldValue ? false : true} > diff --git a/src/common/Header.jsx b/src/common/Header.jsx index 95d97832..4a2ff3e3 100644 --- a/src/common/Header.jsx +++ b/src/common/Header.jsx @@ -205,7 +205,7 @@ const Header = () => { rowGap={2} > - (<> + <> { Admin } - ) + {/* { }), 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 ( diff --git a/src/containers/Organization/Project/EditProject.jsx b/src/containers/Organization/Project/EditProject.jsx index 29640179..ec09fb87 100644 --- a/src/containers/Organization/Project/EditProject.jsx +++ b/src/containers/Organization/Project/EditProject.jsx @@ -301,13 +301,13 @@ const EditProject = () => { md={12} lg={12} xl={12} - style={{ display: "flex", justifyContent: "center" }} + style={{ display: "flex",justifyContent:"space-around"}} > - + Project Settings - + */} From 712d25f716fce0cfae951ce3808b79bb23db48d6 Mon Sep 17 00:00:00 2001 From: sagarika-padmanaban Date: Mon, 2 Sep 2024 21:23:03 +0530 Subject: [PATCH 3/5] task dialog fixes --- src/common/CreateTaskDialog.jsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/common/CreateTaskDialog.jsx b/src/common/CreateTaskDialog.jsx index aa452bd5..261991cb 100644 --- a/src/common/CreateTaskDialog.jsx +++ b/src/common/CreateTaskDialog.jsx @@ -76,9 +76,6 @@ const[langLabel,setlabel] =useState("") const filteredMembers = projectMembers.filter((member) => member.languages.includes(langLabel) ); - const sourceLangMembers = projectMembers.filter((member) => - member.languages.includes(videoDetails?.language_label) - ); useEffect(() => { const taskObj = new FetchTaskTypeAPI(); dispatch(APITransport(taskObj)); @@ -92,8 +89,8 @@ const[langLabel,setlabel] =useState("") // eslint-disable-next-line }, []); useEffect(() => { - console.log(filteredMembers.length,videoDetails) - if (!taskType.includes("TRANSCRIPTION")&&filteredMembers.length === 0) { + console.log(filteredMembers.length) + if (filteredMembers.length === 0) { setShowPopup(true); } else{ @@ -387,11 +384,7 @@ const[langLabel,setlabel] =useState("") inputProps={{ "aria-label": "Without label" }} disabled={isAssignUserDropdownDisabled()} > - {langLabel?filteredMembers.map((item, index) => ( - - {`${item.first_name} ${item.last_name} (${item.email})`} - - )):sourceLangMembers.map((item, index) => ( + {filteredMembers.map((item, index) => ( {`${item.first_name} ${item.last_name} (${item.email})`} From fd1c72d93286ba5abf4019f93f7e3d476a5d71fb Mon Sep 17 00:00:00 2001 From: sagarika-padmanaban Date: Mon, 2 Sep 2024 21:25:22 +0530 Subject: [PATCH 4/5] fixes --- src/common/CreateTaskDialog.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common/CreateTaskDialog.jsx b/src/common/CreateTaskDialog.jsx index 261991cb..aa452bd5 100644 --- a/src/common/CreateTaskDialog.jsx +++ b/src/common/CreateTaskDialog.jsx @@ -76,6 +76,9 @@ const[langLabel,setlabel] =useState("") const filteredMembers = projectMembers.filter((member) => member.languages.includes(langLabel) ); + const sourceLangMembers = projectMembers.filter((member) => + member.languages.includes(videoDetails?.language_label) + ); useEffect(() => { const taskObj = new FetchTaskTypeAPI(); dispatch(APITransport(taskObj)); @@ -89,8 +92,8 @@ const[langLabel,setlabel] =useState("") // eslint-disable-next-line }, []); useEffect(() => { - console.log(filteredMembers.length) - if (filteredMembers.length === 0) { + console.log(filteredMembers.length,videoDetails) + if (!taskType.includes("TRANSCRIPTION")&&filteredMembers.length === 0) { setShowPopup(true); } else{ @@ -384,7 +387,11 @@ const[langLabel,setlabel] =useState("") inputProps={{ "aria-label": "Without label" }} disabled={isAssignUserDropdownDisabled()} > - {filteredMembers.map((item, index) => ( + {langLabel?filteredMembers.map((item, index) => ( + + {`${item.first_name} ${item.last_name} (${item.email})`} + + )):sourceLangMembers.map((item, index) => ( {`${item.first_name} ${item.last_name} (${item.email})`} From 53e02c940a6ee1457c5208c8829172709fcbe4f8 Mon Sep 17 00:00:00 2001 From: sagarika-padmanaban Date: Tue, 3 Sep 2024 13:10:06 +0530 Subject: [PATCH 5/5] fixes --- src/common/CreateTaskDialog.jsx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/common/CreateTaskDialog.jsx b/src/common/CreateTaskDialog.jsx index aa452bd5..36ac2dc9 100644 --- a/src/common/CreateTaskDialog.jsx +++ b/src/common/CreateTaskDialog.jsx @@ -68,11 +68,13 @@ const[langLabel,setlabel] =useState("") const [user, setUser] = useState(""); const [language, setLanguage] = useState(""); const [priority, setPriority] = useState(""); + const [membersToShow,setmembersToShow]=useState(); const [date, setDate] = useState(moment().format()); const [allowedTaskType, setAllowedTaskType] = useState(""); const [showAllowedTaskList, setShowAllowedTaskList] = useState(false); const [showLimitWarning, setShowLimitWarning] = useState(false); const [showPopup, setShowPopup] = useState(false); + const filteredMembers = projectMembers.filter((member) => member.languages.includes(langLabel) ); @@ -92,7 +94,7 @@ const[langLabel,setlabel] =useState("") // eslint-disable-next-line }, []); useEffect(() => { - console.log(filteredMembers.length,videoDetails) + console.log(filteredMembers,videoDetails,taskType,langLabel,sourceLangMembers,projectMembers) if (!taskType.includes("TRANSCRIPTION")&&filteredMembers.length === 0) { setShowPopup(true); } @@ -100,6 +102,10 @@ const[langLabel,setlabel] =useState("") setShowPopup(false) } }, [filteredMembers]); + useEffect(()=>{ + setmembersToShow(taskType=="TRANSCRIPTION" ? sourceLangMembers : filteredMembers); + + },[langLabel,taskType]) useEffect(() => { if (taskType.length && !taskType.includes("TRANSCRIPTION")) { @@ -188,13 +194,13 @@ const[langLabel,setlabel] =useState("") const selectAllowedTaskHandler = (value) => { setAllowedTaskType(value); - const obj = new FetchProjectMembersAPI( - projectId, - value, - videoDetails.id, - language - ); - dispatch(APITransport(obj)); + // const obj = new FetchProjectMembersAPI( + // projectId, + // value, + // videoDetails.id, + // language + // ); + // dispatch(APITransport(obj)); }; const disableBtn = () => { @@ -387,11 +393,7 @@ const[langLabel,setlabel] =useState("") inputProps={{ "aria-label": "Without label" }} disabled={isAssignUserDropdownDisabled()} > - {langLabel?filteredMembers.map((item, index) => ( - - {`${item.first_name} ${item.last_name} (${item.email})`} - - )):sourceLangMembers.map((item, index) => ( + {membersToShow?.map((item, index) => ( {`${item.first_name} ${item.last_name} (${item.email})`}