loaders, outSelectClose, notifications

This commit is contained in:
Mikola 2024-02-13 15:32:32 +03:00
parent 4d2ccf91eb
commit 992afead80
3 changed files with 38 additions and 3 deletions

View File

@ -40,6 +40,7 @@ import crossWhite from "assets/icons/crossWhite.svg";
import avatarMok from "assets/images/avatarMok.png"; import avatarMok from "assets/images/avatarMok.png";
import "./trackerModal.scss"; import "./trackerModal.scss";
import { Loader } from "@components/Common/Loader/Loader";
registerLocale("ru", ru); registerLocale("ru", ru);
@ -90,6 +91,7 @@ export const TrackerModal = ({
const [deadLineDate, setDeadLineDate] = useState(""); const [deadLineDate, setDeadLineDate] = useState("");
const [datePickerOpen, setDatePickerOpen] = useState(false); const [datePickerOpen, setDatePickerOpen] = useState(false);
const [startDate, setStartDate] = useState(new Date()); const [startDate, setStartDate] = useState(new Date());
const [loader, setLoader] = useState(false)
const priority = [ const priority = [
{ {
@ -138,6 +140,8 @@ export const TrackerModal = ({
return; return;
} }
setLoader(true)
apiRequest("/task/create-task", { apiRequest("/task/create-task", {
method: "POST", method: "POST",
data: { data: {
@ -158,6 +162,7 @@ export const TrackerModal = ({
text: "Задача с таким именем уже существует", text: "Задача с таким именем уже существует",
type: "error" type: "error"
}); });
setLoader(false)
} else { } else {
for (let i = 0; i < taskTags.length; i++) { for (let i = 0; i < taskTags.length; i++) {
apiRequest("/mark/attach", { apiRequest("/mark/attach", {
@ -185,9 +190,11 @@ export const TrackerModal = ({
setDescriptionTicket(""); setDescriptionTicket("");
setSelectedExecutorTask("Выберите исполнителя"); setSelectedExecutorTask("Выберите исполнителя");
setSelectedPriority(null); setSelectedPriority(null);
setLoader(false)
}); });
} else { } else {
setActive(false); setActive(false);
setLoader(false)
setValueTicket(""); setValueTicket("");
setDescriptionTicket(""); setDescriptionTicket("");
dispatch(setProjectBoardFetch(projectBoard.id)); dispatch(setProjectBoardFetch(projectBoard.id));
@ -702,9 +709,11 @@ export const TrackerModal = ({
</div> </div>
</div> </div>
</div> </div>
<BaseButton styles={"button-add"} onClick={createTicket}> {loader ? <Loader style={'green'} /> :
<BaseButton styles={"button-add"} onClick={createTicket}>
Создать Создать
</BaseButton> </BaseButton>
}
</div> </div>
</> </>
)} )}

View File

@ -5,7 +5,7 @@
position: fixed; position: fixed;
bottom: 25px; bottom: 25px;
right: 25px; right: 25px;
z-index: 20; z-index: 10000;
&__info { &__info {
display: flex; display: flex;

View File

@ -56,6 +56,7 @@ export const PartnerAddRequest = () => {
} }
useEffect(() => { useEffect(() => {
initListeners();
apiRequest(`/profile/positions-list`).then((el) => apiRequest(`/profile/positions-list`).then((el) =>
setSpecializationList(el) setSpecializationList(el)
); );
@ -141,6 +142,31 @@ export const PartnerAddRequest = () => {
} }
}; };
const initListeners = () => {
document.addEventListener("click", closeByClickingOut);
};
const closeByClickingOut = (event) => {
const path = event.path || (event.composedPath && event.composedPath());
if (
event &&
!path.find(
(div) =>
div.classList &&
(div.classList.contains("form__block__section__selects") ||
div.classList.contains("form__block__dropDown")
|| div.classList.contains("form__block__skills") ||
div.classList.contains("form__block__section__select"))
)
) {
setOpenSkillsSelect(false)
setOpenSpecializationListOpen(false)
setOpenLevelList(false)
setOpenCountList(false)
}
};
return ( return (
<div className="partnerAddRequest"> <div className="partnerAddRequest">
<ProfileHeader /> <ProfileHeader />