@@ -111,4 +111,5 @@ margin-left: 3px; font-weight: 400; color: var(--new-ui-gray-color); + white-space: nowrap; } @@ -17,7 +17,6 @@ function getConsent(): string | null { export function CookieConsent() { const { status } = useSession() - const account_type = useAppSelector((state) => state.user.account_type) const meStatus = useAppSelector((state) => state.user.status) const uid = useAppSelector((state) => state.user.uid) const [consent, setConsent] = React.useState(undefined) @@ -25,17 +24,15 @@ export function CookieConsent() { React.useEffect(() => { if (meStatus !== 'succeeded') return - if (account_type.startsWith('business')) { - stopYandexMetrika() - return - } const stored = getConsent() setConsent(stored) + if (stored === 'all') { initYandexMetrika() if (uid) bindYandexMetrikaUserId(uid) } - }, [account_type, meStatus, uid]) + }, [ meStatus, uid]) + const choose = (value: string) => { localStorage.setItem('cookie-consent', value) @@ -47,7 +44,7 @@ export function CookieConsent() { } if (status !== 'authenticated' || meStatus !== 'succeeded') return null - if (account_type.startsWith('business') || consent !== null) return null + if (consent !== null) return null return (
@@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React from 'react' import { useCookies } from 'react-cookie' import { useForm } from 'react-hook-form' import { SubmitErrorHandler, SubmitHandler } from 'react-hook-form' @@ -16,8 +16,8 @@ import { IEmailForms } from '#/features/register-by-email/model/types' import { emailOptions } from '#/shared' import { InputStyleDark } from '#/shared' import { getApiUrl } from '#/shared/lib/constants' -import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' import { useDeviceType } from '#/shared/lib/hooks/use-device-type' +import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' interface IRegisterEmailFormProps { successLogin: () => void @@ -19,10 +19,10 @@ export const DateInput = ({ useEffect(() => { if (date) { - setDate(new Date().toISOString().split('T')[0]) + setDate(dayjs().format('YYYY-MM-DD')) } if (prevdate) { - setDate(dayjs(new Date().toISOString()).add(-1, 'year').format('YYYY-DD-MM')) + setDate(dayjs().subtract(1, 'year').format('YYYY-MM-DD')) } }, [date, prevdate]) @@ -51,10 +51,10 @@ export const DateInput = ({ } onChange={(date) => { if (date?.isValid()) { - setDate(JSON.stringify(date).split('"')[1].split('T')[0]) + setDate(date.format('YYYY-MM-DD')) } }} - format='MM-DD-YYYY' + format='DD.MM.YYYY' views={['year', 'month', 'day']} /> @@ -2,8 +2,25 @@ display: none; } +.passwordLabel { + font-size: 10pt; +} + .changePasswordButton { width: 150px; + background-color: var(--air-color) !important; + color: #fff !important; + border-radius: 13px; + text-transform: none; + height: 43px; + font-size: 13px; + font-weight: 600; + box-shadow: none !important; + + &:hover { + background-color: var(--text-color-purple) !important; + opacity: 0.9; + } } .deleteAccountButton { @@ -420,7 +420,9 @@ const Account: NextPageWithLayout = () => { Изменить пароль - Текущий пароль + + Текущий пароль + { - - Новый пароль + + + Новый пароль + { fullWidth /> - - Подтвердить пароль + + + Подтвердить пароль + { /> - + > + Изменить пароль + )} @@ -2,7 +2,7 @@ import * as React from 'react' import { useEffect, useState } from 'react' import { Box, Button, TextField, Typography } from '@mui/material' import axios from 'axios' -import { Dayjs } from 'dayjs' +import dayjs, { Dayjs } from 'dayjs' import { useSession } from 'next-auth/react' import styles from '#/app/styles/business.module.scss' @@ -36,7 +36,7 @@ export default function BusinessHost() { const [mailing, setMailing] = useState() const [toDate, setToDate] = useState('') const { data } = useSession() - const { message, isOpened } = useShowDataStore() + const { showMessage } = useShowDataStore() useEffect(() => { getPersons(data?.access, true).then((res) => setSecurityList(res ? res?.reverse() : null)) @@ -65,6 +65,10 @@ export default function BusinessHost() { } const download = () => { + if (dayjs(fromDate).isAfter(toDate) || dayjs(toDate).isAfter(dayjs())) { + showMessage('Указаны неверные даты') + return + } axios.get(getApiUrl() + `/auth/business-host/download-expenses?type=employees&from_date=${fromDate}&to_date=${toDate}`, { responseType: 'arraybuffer', headers: { Authorization: `Bearer ${data?.access}` }, @@ -7,11 +7,12 @@ import TableCell from '@mui/material/TableCell' import TableContainer from '@mui/material/TableContainer' import TableHead from '@mui/material/TableHead' import TableRow from '@mui/material/TableRow' -import { Dayjs } from 'dayjs' +import dayjs, { Dayjs } from 'dayjs' import { useSession } from 'next-auth/react' import { ResponseGetLogsList } from '#/features/invite-person-in-business/model/types' import { Search } from '#/shared' +import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' import { DateInput } from '#/shared/ui/date-input/date-input' import styles from '#/widgets/business-models/ui/models-list/models-list.module.scss' import { getLogsList } from '#/widgets/business-persons/api/get-logsList' @@ -29,8 +30,13 @@ export const LogList = () => { const [showPersons, setShowPersons] = useState(true) const [search, setSearch] = useState('') const { data } = useSession() + const { showMessage } = useShowDataStore() useEffect(() => { + if (fromDate && toDate && (dayjs(fromDate).isAfter(toDate) || dayjs(toDate).isAfter(dayjs()))) { + showMessage('Указаны неверные даты') + return + } getLogsList(offset, 20, logType, fromDate, toDate, data?.access).then((res) => setLogs(res ? res : null)) }, [data?.access, logType, fromDate, toDate])