diff --git a/example.env.local b/example.env.local index ab2e819..3e60318 100644 --- a/example.env.local +++ b/example.env.local @@ -1,4 +1,4 @@ -NEXT_PUBLIC_VERSION = "2.1.0" +NEXT_PUBLIC_VERSION = "2.1.5" NEXT_PUBLIC_API_URL = "https://crm.witel.ir/server" NEXT_PUBLIC_SERVER_SOCKET_URL = "wss://crm.witel.ir" diff --git a/src/app/layout.js b/src/app/layout.js index 4c01ad4..12228f6 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -1,3 +1,4 @@ +import favicon from "@/assets/images/favicon.png"; import { Rtl } from "@/core/utils/cacheRtl"; import { AuthProvider } from "@/lib/contexts/auth"; import { TableSettingProvider } from "@/lib/contexts/tableSetting"; @@ -13,7 +14,9 @@ export const metadata = { export default function RootLayout({ children }) { return ( - + + + { + const [showPassword, setShowPassword] = useState(false); const requestServer = useRequest(); const { getUser } = useAuth(); const defaultValues = { username: "", password: "", + telephone_id: "", }; const validationSchema = object({ username: string().required("لطفا نام کاربری را وارد کنید!"), password: string().required("لطفا رمز عبور را وارد کنید!"), + telephone_id: string().required("لطفا شماره تماس داخلی را وارد کنید!"), }); const { @@ -32,18 +50,19 @@ const LoginForm = () => { mode: "all", }); + const handleClickShowPassword = () => setShowPassword((show) => !show); + const onSubmit = async (data) => { try { const formData = new FormData(); formData.append("username", data.username); formData.append("password", data.password); + formData.append("telephone_id", data.telephone_id); await requestServer(GET_USER_LOGIN_ROUTE, "post", { data: formData, }); getUser(); - } catch (error) { - console.error("Login error:", error); - } + } catch (error) {} }; return ( @@ -82,6 +101,15 @@ const LoginForm = () => { {...field} label="نام کاربری" variant="outlined" + slotProps={{ + input: { + endAdornment: ( + + + + ), + }, + }} fullWidth error={!!error} helperText={!!error && error.message} @@ -98,7 +126,27 @@ const LoginForm = () => { {...field} label="رمزعبور" variant="outlined" - type="password" + type={showPassword ? "text" : "password"} + slotProps={{ + input: { + startAdornment: ( + + + {showPassword ? ( + + ) : ( + + )} + + + ), + endAdornment: ( + + + + ), + }, + }} fullWidth error={!!error} helperText={!!error && error.message} @@ -107,6 +155,32 @@ const LoginForm = () => { }} name={"password"} /> + { + return ( + + + + ), + }, + }} + fullWidth + error={!!error} + helperText={!!error && error.message} + /> + ); + }} + name={"telephone_id"} + /> + + + + ); +}; +export default ChangePassword; diff --git a/src/core/components/Profile/ProfileActions.jsx b/src/core/components/Profile/ProfileActions.jsx index eeb500c..46dcc92 100644 --- a/src/core/components/Profile/ProfileActions.jsx +++ b/src/core/components/Profile/ProfileActions.jsx @@ -7,6 +7,7 @@ import PowerSettingsNewIcon from "@mui/icons-material/PowerSettingsNew"; import VpnKeyIcon from "@mui/icons-material/VpnKey"; import { Box, Divider, IconButton, Tooltip } from "@mui/material"; import { useState } from "react"; +import ChangePassword from "./ChangePassword"; const ProfileActions = () => { const { getUser, logout } = useAuth(); @@ -27,7 +28,7 @@ const ProfileActions = () => { return ( <> - + {/* { variant="middle" flexItem sx={{ mx: 1 }} - /> + /> */} @@ -65,8 +66,8 @@ const ProfileActions = () => { - {/* - */} + {/* */} + ); }; diff --git a/src/core/utils/routes.js b/src/core/utils/routes.js index 37e72fe..577f689 100644 --- a/src/core/utils/routes.js +++ b/src/core/utils/routes.js @@ -1,6 +1,7 @@ const api = process.env.NEXT_PUBLIC_API_URL; export const GET_USER_ROUTE = api + "/profile/info"; +export const CHANGE_USER_PASSWORD = api + "/profile/change_password"; export const GET_USER_LOGIN_ROUTE = api + "/auth/login"; export const GET_USER_LOGOUT_ROUTE = api + "/auth/logout"; export const GET_PERMISSIONS_ROUTE = ""; diff --git a/src/core/utils/theme.js b/src/core/utils/theme.js index 64f93f8..49bc95d 100644 --- a/src/core/utils/theme.js +++ b/src/core/utils/theme.js @@ -9,19 +9,21 @@ const theme = createTheme({ }, palette: { primary: { - main: "#0D47A1", - contrastText: "#fff", + main: "#1b4332", + contrastText: "#FFFFFF", + }, secondary: { - main: "#90A4AE", + main: "#1B4043", + contrastText: "#FFFFFF", }, }, components: { MuiBackdrop: { styleOverrides: { root: { - backdropFilter: "blur(2px)", - backgroundColor: "rgba(0, 0, 0, 0.5)", + backdropFilter: "blur(3px)", + backgroundColor: "rgba(0, 0, 0, 0.3)", }, }, }, diff --git a/src/lib/hooks/useCallerHistory.js b/src/lib/hooks/useCallerHistory.js index 90857ba..21cee61 100644 --- a/src/lib/hooks/useCallerHistory.js +++ b/src/lib/hooks/useCallerHistory.js @@ -28,7 +28,6 @@ const useCallerHistory = (callId, phoneNumber, maxSize) => { setHistoryData(unique); } catch (error) { - console.error("Error fetching caller history:", error); setHasError(true); setHistoryData([]); } finally {