diff --git a/build.zip b/build.zip index 3f1b99e..d636771 100644 Binary files a/build.zip and b/build.zip differ diff --git a/src/API/LayoutApi/users.ts b/src/API/LayoutApi/users.ts index 3e9af08..d6bd14d 100644 --- a/src/API/LayoutApi/users.ts +++ b/src/API/LayoutApi/users.ts @@ -12,7 +12,7 @@ export type TUsersPutParams = { first_name?: string; last_name?: string; username?: string; - team_id?: number; + team_id?: number | null; }; export type TUsersPostParams = { @@ -48,7 +48,7 @@ export const userController = { return data; }, - async userPatch(obj: TUsersPutParams, id: string) { + async userPatch(obj: TUsersPutParams, id: string | number) { const { data } = await instance .put(`users/admin/${id}/`, obj) .then((u) => { diff --git a/src/API/auth/resetPass.ts b/src/API/auth/resetPass.ts index b6af69f..2fa938d 100644 --- a/src/API/auth/resetPass.ts +++ b/src/API/auth/resetPass.ts @@ -19,10 +19,11 @@ export const resetPass = async (value: resetType) => { headers: { "Content-Type": "application/json" }, }); return data; - } catch (error) { + } catch (error: any) { setTimeout(() => { - message.error({ content: "Something went wrong", duration: 2 }); + message.error({ content: error?.response?.data?.message, duration: 2 }); }, 1000); + return false; } }; export const resetPassEmail = async (value: resetPassType) => { @@ -35,11 +36,11 @@ export const resetPassEmail = async (value: resetPassType) => { const succesMessage = data?.message; message.success({ content: succesMessage, duration: 2 }); setTimeout(() => { - document.location.replace('/auth/login') + document.location.replace("/auth/login"); }, 2000); } catch (error) { setTimeout(() => { message.error({ content: "Something went wrong", duration: 2 }); }, 1000); } -} +}; diff --git a/src/App.css b/src/App.css index b7e640e..9fb544f 100644 --- a/src/App.css +++ b/src/App.css @@ -790,4 +790,8 @@ .ant-upload-list-text{ overflow: scroll; height: 50px; +} + +.ant-modal-mask { + background-color: rgba(0, 0, 0, 0.5) !important; /* Используйте нужный вам цвет фона */ } \ No newline at end of file diff --git a/src/Auth/ResetPassword.tsx b/src/Auth/ResetPassword.tsx index 5411937..73055ec 100644 --- a/src/Auth/ResetPassword.tsx +++ b/src/Auth/ResetPassword.tsx @@ -22,8 +22,10 @@ const ResetPassword: React.FC = () => { const onSubmit = async (values: any) => { setEmail(values.login); await sleep(300); - await resetPass({ login: values.login }).then(() => { - setOpen(true); + await resetPass({ login: values.login }).then((e) => { + if (e) { + setOpen(true); + } }); }; @@ -46,7 +48,7 @@ const ResetPassword: React.FC = () => { > diff --git a/src/Components/CallRequests/CallTable.tsx b/src/Components/CallRequests/CallTable.tsx index 2747b88..3fd9f38 100644 --- a/src/Components/CallRequests/CallTable.tsx +++ b/src/Components/CallRequests/CallTable.tsx @@ -93,21 +93,6 @@ const CallTable = ({ dataIndex: "note", width: "15%", }, - // { - // title: "Status", - // dataIndex: "status", - // width: "8%", - // render: (status: string) => ( - // - // {status === "Awaiting" && ( - //

Awaiting

- // )} - // {status === "Resolved" && ( - //

Resolved

- // )} - //
- // ), - // }, { title: "Requested at", dataIndex: "time", @@ -134,7 +119,7 @@ const CallTable = ({ diff --git a/src/Components/Services/Services.tsx b/src/Components/Services/Services.tsx index 17cd632..2b8f84b 100644 --- a/src/Components/Services/Services.tsx +++ b/src/Components/Services/Services.tsx @@ -20,7 +20,7 @@ const Service = () => { {role !== "Checker" && ( )} diff --git a/src/Components/Tasks/TaskModal.tsx b/src/Components/Tasks/TaskModal.tsx index 4ce4d87..a3f6fe6 100644 --- a/src/Components/Tasks/TaskModal.tsx +++ b/src/Components/Tasks/TaskModal.tsx @@ -9,7 +9,7 @@ import { message, } from "antd"; import TabPane from "antd/es/tabs/TabPane"; -import { timeZone } from "../../App"; +import { role, timeZone } from "../../App"; import { useTaskHistory } from "../../Hooks/Tasks"; import TextArea from "antd/es/input/TextArea"; import { useEffect, useState } from "react"; @@ -234,6 +234,7 @@ const TaskModal = ({ menu={{ items }} placement="bottom" arrow={{ pointAtCenter: true }} + disabled={role === "Checker" && status === "Done"} > diff --git a/src/Components/Users/UserEdit.tsx b/src/Components/Users/UserEdit.tsx index d1e2bb7..1838fba 100644 --- a/src/Components/Users/UserEdit.tsx +++ b/src/Components/Users/UserEdit.tsx @@ -31,9 +31,19 @@ const UserEdit = () => { const { id } = useParams(); const { data, refetch, status } = useUserOne(id); - + const roleData = useRoleData(); + const techSupport = roleData.data?.find( + (item) => item.name === "Tech Support" + ); const onSubmit = async (value: any) => { - id && (await userController.userPatch(value, id)); + if (value.role_id === techSupport?.id) { + value.team_id = null; + + id && (await userController.userPatch(value, id)); + } else { + id && (await userController.userPatch(value, id)); + } + refetch(); document.location.replace("/#/users/"); }; @@ -47,7 +57,6 @@ const UserEdit = () => { if (TeamOption) { TeamOption.unshift(noTeamOption); } - const roleData = useRoleData(); const ClickDelete = () => { const shouldDelete = window.confirm( diff --git a/src/Components/Users/UserTable.tsx b/src/Components/Users/UserTable.tsx index e16e5a0..9572d3b 100644 --- a/src/Components/Users/UserTable.tsx +++ b/src/Components/Users/UserTable.tsx @@ -1,4 +1,4 @@ -import { Table, Tag } from "antd"; +import { Button, Space, Table, Tag } from "antd"; import { useTeamData } from "../../Hooks/Teams"; import { TUser } from "../../types/User/TUser"; import { @@ -9,6 +9,8 @@ import { import { useNavigate } from "react-router-dom"; // @ts-ignore import tagIcon from "../../assets/tagIcon.png"; +import { isMobile, role } from "../../App"; +import { userController } from "../../API/LayoutApi/users"; const UserTable = ({ data, isLoading,