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

View File

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

View File

@ -56,6 +56,7 @@ export const PartnerAddRequest = () => {
}
useEffect(() => {
initListeners();
apiRequest(`/profile/positions-list`).then((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 (
<div className="partnerAddRequest">
<ProfileHeader />