add user by email

This commit is contained in:
Victor Batischev 2024-02-06 18:59:08 +03:00
parent ef8a0813b3
commit 8c68366152
2 changed files with 23 additions and 23 deletions

View File

@ -1,6 +1,6 @@
.calendar-component { .calendar-component {
position: relative; position: relative;
margin: 30px 0; margin: 10px 0;
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 20px 30px; padding: 20px 30px;
font-family: "LabGrotesque", sans-serif; font-family: "LabGrotesque", sans-serif;
@ -94,7 +94,7 @@
} }
&__rectangle { &__rectangle {
margin: 20px 0; margin: 10px 0;
img { img {
width: 100%; width: 100%;

View File

@ -70,6 +70,7 @@ export const TrackerModal = ({
const [workers, setWorkers] = useState([]); const [workers, setWorkers] = useState([]);
const [selectWorkersOpen, setSelectWorkersOpen] = useState(false); const [selectWorkersOpen, setSelectWorkersOpen] = useState(false);
const [selectedWorker, setSelectedWorker] = useState(null); const [selectedWorker, setSelectedWorker] = useState(null);
const [emailWorker, setEmailWorker] = useState("");
const [selectColumnPriority, setSelectColumnPriority] = useState( const [selectColumnPriority, setSelectColumnPriority] = useState(
"Выберите приоритет колонки" "Выберите приоритет колонки"
); );
@ -305,6 +306,19 @@ export const TrackerModal = ({
}); });
} }
function inviteUserByEmail() {
apiRequest("/project/add-user-by-email", {
method: "POST",
data: {
email: emailWorker,
project_id: projectBoard.id
}
}).then((el) => {
setActive(false);
setEmailWorker("");
});
}
useEffect(() => { useEffect(() => {
modalType === "add-worker" modalType === "add-worker"
? apiRequest("/project/my-employee").then((el) => { ? apiRequest("/project/my-employee").then((el) => {
@ -386,26 +400,12 @@ export const TrackerModal = ({
}; };
return ( return (
<ModalLayout <ModalLayout active={active} setActive={setActive} type={modalType}>
active={active}
setActive={setActive}
type={modalType}
// onClick={() => {
// setSelectWorkersOpen(false);
// }}
>
{modalType === "add-worker" && ( {modalType === "add-worker" && (
<> <>
<div className="select__person"> <div className="select__person">
<div className="title-project select-person"> <div className="title-project select-person">
<h4>Добавьте участника</h4> <h4>Добавьте участника</h4>
{/*<div className="input-container">*/}
{/* <input*/}
{/* className="name-project"*/}
{/* value={emailWorker}*/}
{/* onChange={(e) => setEmailWorker(e.target.value)}*/}
{/* />*/}
{/*</div>*/}
<p className="select-person__info"> <p className="select-person__info">
Выберите пользователя в проекте или добавьте по e-mail Выберите пользователя в проекте или добавьте по e-mail
</p> </p>
@ -468,9 +468,14 @@ export const TrackerModal = ({
className="name-project" className="name-project"
placeholder="e-mail" placeholder="e-mail"
type="email" type="email"
value={emailWorker}
onChange={(e) => setEmailWorker(e.target.value)}
/> />
</div> </div>
<BaseButton styles={"button-add invite-person-block__btn"}> <BaseButton
styles={"button-add invite-person-block__btn"}
onClick={inviteUserByEmail}
>
Отправить приглашение Отправить приглашение
</BaseButton> </BaseButton>
</div> </div>
@ -494,11 +499,6 @@ export const TrackerModal = ({
alt="avatar" alt="avatar"
/> />
</div> </div>
{/*<span>Этап</span>*/}
{/*<div className="createTaskHead__selectColumn">*/}
{/* <span>Backlog</span>*/}
{/* <img src={arrowCreateTask} alt="arrow" />*/}
{/*</div>*/}
</div> </div>
<div className="createTaskBody"> <div className="createTaskBody">
<div className="createTaskBody__left"> <div className="createTaskBody__left">