before adding toll roads page

main
tteld 4 months ago
parent 82b59d8c54
commit d9477b2d8c

Binary file not shown.

@ -12,7 +12,7 @@ export type TUsersPutParams = {
first_name?: string; first_name?: string;
last_name?: string; last_name?: string;
username?: string; username?: string;
team_id?: number; team_id?: number | null;
}; };
export type TUsersPostParams = { export type TUsersPostParams = {
@ -48,7 +48,7 @@ export const userController = {
return data; return data;
}, },
async userPatch(obj: TUsersPutParams, id: string) { async userPatch(obj: TUsersPutParams, id: string | number) {
const { data } = await instance const { data } = await instance
.put<TUser>(`users/admin/${id}/`, obj) .put<TUser>(`users/admin/${id}/`, obj)
.then((u) => { .then((u) => {

@ -19,10 +19,11 @@ export const resetPass = async (value: resetType) => {
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
}); });
return data; return data;
} catch (error) { } catch (error: any) {
setTimeout(() => { setTimeout(() => {
message.error({ content: "Something went wrong", duration: 2 }); message.error({ content: error?.response?.data?.message, duration: 2 });
}, 1000); }, 1000);
return false;
} }
}; };
export const resetPassEmail = async (value: resetPassType) => { export const resetPassEmail = async (value: resetPassType) => {
@ -35,11 +36,11 @@ export const resetPassEmail = async (value: resetPassType) => {
const succesMessage = data?.message; const succesMessage = data?.message;
message.success({ content: succesMessage, duration: 2 }); message.success({ content: succesMessage, duration: 2 });
setTimeout(() => { setTimeout(() => {
document.location.replace('/auth/login') document.location.replace("/auth/login");
}, 2000); }, 2000);
} catch (error) { } catch (error) {
setTimeout(() => { setTimeout(() => {
message.error({ content: "Something went wrong", duration: 2 }); message.error({ content: "Something went wrong", duration: 2 });
}, 1000); }, 1000);
} }
} };

@ -791,3 +791,7 @@
overflow: scroll; overflow: scroll;
height: 50px; height: 50px;
} }
.ant-modal-mask {
background-color: rgba(0, 0, 0, 0.5) !important; /* Используйте нужный вам цвет фона */
}

@ -22,8 +22,10 @@ const ResetPassword: React.FC = () => {
const onSubmit = async (values: any) => { const onSubmit = async (values: any) => {
setEmail(values.login); setEmail(values.login);
await sleep(300); await sleep(300);
await resetPass({ login: values.login }).then(() => { await resetPass({ login: values.login }).then((e) => {
setOpen(true); if (e) {
setOpen(true);
}
}); });
}; };
@ -46,7 +48,7 @@ const ResetPassword: React.FC = () => {
> >
<Card <Card
bodyStyle={{ background: "rgb(250, 250, 250)" }} bodyStyle={{ background: "rgb(250, 250, 250)" }}
title="Login" title="Reset password"
className="login-form-card " className="login-form-card "
style={{ width: 400 }} style={{ width: 400 }}
> >

@ -93,21 +93,6 @@ const CallTable = ({
dataIndex: "note", dataIndex: "note",
width: "15%", width: "15%",
}, },
// {
// title: "Status",
// dataIndex: "status",
// width: "8%",
// render: (status: string) => (
// <span>
// {status === "Awaiting" && (
// <p className="status-new">Awaiting</p>
// )}
// {status === "Resolved" && (
// <p className="status-done">Resolved</p>
// )}
// </span>
// ),
// },
{ {
title: "Requested at", title: "Requested at",
dataIndex: "time", dataIndex: "time",
@ -134,7 +119,7 @@ const CallTable = ({
</Button> </Button>
<Modal <Modal
title="Add note" title="Add note"
visible={modalVisible} open={modalVisible}
onOk={handleOk} onOk={handleOk}
onCancel={handleCancel} onCancel={handleCancel}
> >

@ -20,7 +20,7 @@ const Service = () => {
{role !== "Checker" && ( {role !== "Checker" && (
<button onClick={showModal} className="btn-add d-flex"> <button onClick={showModal} className="btn-add d-flex">
<img src={addicon} style={{ marginRight: 8 }} alt="" /> <img src={addicon} style={{ marginRight: 8 }} alt="" />
Add Add Service
</button> </button>
)} )}
</div> </div>

@ -9,7 +9,7 @@ import {
message, message,
} from "antd"; } from "antd";
import TabPane from "antd/es/tabs/TabPane"; import TabPane from "antd/es/tabs/TabPane";
import { timeZone } from "../../App"; import { role, timeZone } from "../../App";
import { useTaskHistory } from "../../Hooks/Tasks"; import { useTaskHistory } from "../../Hooks/Tasks";
import TextArea from "antd/es/input/TextArea"; import TextArea from "antd/es/input/TextArea";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
@ -234,6 +234,7 @@ const TaskModal = ({
menu={{ items }} menu={{ items }}
placement="bottom" placement="bottom"
arrow={{ pointAtCenter: true }} arrow={{ pointAtCenter: true }}
disabled={role === "Checker" && status === "Done"}
> >
<button <button
style={{ marginLeft: 12, display: "flex", alignItems: "center" }} style={{ marginLeft: 12, display: "flex", alignItems: "center" }}

@ -22,7 +22,7 @@ const Team = () => {
onClick={showModal} onClick={showModal}
> >
<img src={addicon} style={{ marginRight: 8 }} alt="" /> <img src={addicon} style={{ marginRight: 8 }} alt="" />
Add Add Team
</button> </button>
</div> </div>
<TeamTable data={data} isLoading={isLoading} refetch={refetch} /> <TeamTable data={data} isLoading={isLoading} refetch={refetch} />

@ -31,9 +31,19 @@ const UserEdit = () => {
const { id } = useParams<params>(); const { id } = useParams<params>();
const { data, refetch, status } = useUserOne(id); const { data, refetch, status } = useUserOne(id);
const roleData = useRoleData();
const techSupport = roleData.data?.find(
(item) => item.name === "Tech Support"
);
const onSubmit = async (value: any) => { 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(); refetch();
document.location.replace("/#/users/"); document.location.replace("/#/users/");
}; };
@ -47,7 +57,6 @@ const UserEdit = () => {
if (TeamOption) { if (TeamOption) {
TeamOption.unshift(noTeamOption); TeamOption.unshift(noTeamOption);
} }
const roleData = useRoleData();
const ClickDelete = () => { const ClickDelete = () => {
const shouldDelete = window.confirm( const shouldDelete = window.confirm(

@ -1,4 +1,4 @@
import { Table, Tag } from "antd"; import { Button, Space, Table, Tag } from "antd";
import { useTeamData } from "../../Hooks/Teams"; import { useTeamData } from "../../Hooks/Teams";
import { TUser } from "../../types/User/TUser"; import { TUser } from "../../types/User/TUser";
import { import {
@ -9,6 +9,8 @@ import {
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
// @ts-ignore // @ts-ignore
import tagIcon from "../../assets/tagIcon.png"; import tagIcon from "../../assets/tagIcon.png";
import { isMobile, role } from "../../App";
import { userController } from "../../API/LayoutApi/users";
const UserTable = ({ const UserTable = ({
data, data,
isLoading, isLoading,

Loading…
Cancel
Save