@@ -4,8 +4,7 @@ interface SendReport { errorMessage: string email: string file?: File - company?:string -} +} export async function sendReport({errorMessage, email, file}: SendReport) { let formData = new FormData() @@ -16,15 +15,3 @@ export async function sendReport({errorMessage, email, file}: SendReport) { } return await api.post('/reports/', formData) } - - -export async function sendBusinessReport({errorMessage, email, company, file}: SendReport) { - let formData = new FormData() - - formData.append('report_text', `${email}: ${errorMessage}`) - formData.append('company_name', `${company}`) - if (file) { - formData.append('images', file) - } - return await api.post('/reports/business-support/', formData) -} @@ -5,11 +5,11 @@ import { useAppSelector } from '#/app/store/store' import { makePrivateRequest } from '#/shared/api' import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' -import { sendBusinessReport, sendReport } from '../api' +import { sendReport } from '../api' const MAX_FILE_SIZE = 4.5 * 1024 * 1024 // 4.5 MB -export const useErrorReport = (reportType:'business' | 'default' = 'default') => { +export const useErrorReport = () => { const email = useAppSelector((state) => state.user.email) const [file, setFile] = React.useState() @@ -34,7 +34,7 @@ export const useErrorReport = (reportType:'business' | 'default' = 'default') => } } - const sendError = makePrivateRequest(async (company) => { + const sendError = makePrivateRequest(async () => { if (errorMessage.trim() === '') { showMessage('Поле не должно быть пустым.') setError(true) @@ -42,10 +42,7 @@ export const useErrorReport = (reportType:'business' | 'default' = 'default') => return } - const response = await (reportType === 'business' - ? sendBusinessReport({ errorMessage, email, company, file }) - : sendReport({ errorMessage, email, file }) - ) + const response = await sendReport({ errorMessage, email, file }) if (response.status === 201) { setErrorMessage('') @@ -1,120 +0,0 @@ -import * as React from 'react' -import { useForm } from 'react-hook-form' -import { Typography } from '@mui/material' - -import { useAppSelector } from '#/app/store/store' -import AttachSvg from '#/assets/svg/attach.svg?react' -import PlusSvg from '#/assets/svg/plus.svg?react' -import { BUSINESS_ERROR_REPORT, getModalById, PlateTemplate } from '#/features/modals' -import { CompanyAutocomplete } from '#/features/register-business/api/company-autocomplete' -import { companyNameOptions } from '#/features/register-business/lib/constatnts-step-legal-informative' -import { c } from '#/shared' -import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' -import { CommonButton } from '#/shared/ui/button' -import { CommonTextArea } from '#/shared/ui/common-textarea' - -import { useErrorReport } from '../model/use-error-report' - -import styles from './error-report.module.scss' - -export const BusinessErrorReportPlate = () => { - const modal = getModalById(BUSINESS_ERROR_REPORT) - const { error, isSend, setErrorMessage, handleFileChange, file, setFile, sendError } = useErrorReport('business') - const { showMessage } = useShowDataStore() - - const { companyName } = useAppSelector((state) => state.stepper.dataForCreate) - - const methods = useForm({ - defaultValues: { - companyName - }, - }) - - const handleSubmit = () => { - const formValues = methods.getValues() - const company = formValues.companyName?.trim() - - if (!company) { - showMessage('Пожалуйста, укажите наименование организации') - return - } - - sendError(company) - } - - return ( - - {isSend ? ( -
-

Спасибо!

-

Ваше сообщение направлено нашим специалистам. Ответ придет на почту, указанную при регистрации

-
- ) : ( -
e.stopPropagation()}> -

Запрос для компаний и партнеров

- - Опишите ваш сценарий — подберем решение и ответим за день. Работаем для корпораций, агентств и интеграторов - - - - - setErrorMessage(evt.target.value)} - buttomSlot={ - <> - - - } - /> - {file && ( -
-
- -
- {file.name} - {(file.size / 1024).toFixed(1)} KB -
-
- - -
- )} - -
- modal.setState(false)}> - Отмена - - - Отправить - -
-
- )} -
- ) -} \ No newline at end of file @@ -1,7 +1,6 @@ export const PLATE_CHANGE_PASSWORD = 'plate-change-password' export const RESEND_INVATION_PASSWORD = 'resend-invation-password' export const ERROR_REPORT = 'error-report' -export const BUSINESS_ERROR_REPORT = 'business-error-report' export const LOW_BALANCE_OFFER = 'low-balance-offer' export const SUBSCRIPTION_CHANGE_NOTIFICATION = 'subscription-change-notification' export const PLATE_ADD_VOICE = 'plate-add-voice' @@ -1,6 +0,0 @@ -import BusinessReportsMobile from '#/views/reports-mobile/ui/business-error-reports-mobile' -import { getDefaultLayout } from '#/widgets/layouts' - -BusinessReportsMobile.getLayout = getDefaultLayout({ titlePage: 'Компаниям', device: 'mobile' }) - -export default BusinessReportsMobile @@ -1,112 +0,0 @@ -import React from 'react' -import { useForm } from 'react-hook-form' -import { Typography } from '@mui/material' - -import { useAppSelector } from '#/app/store/store' -import AttachSvg from '#/assets/svg/attach.svg?react' -import PlusSvg from '#/assets/svg/plus.svg?react' -import { useErrorReport } from '#/features/error-report/model/use-error-report' -import { CompanyAutocomplete } from '#/features/register-business/api/company-autocomplete' -import { companyNameOptions } from '#/features/register-business/lib/constatnts-step-legal-informative' -import { NextPageWithLayout } from '#/pages/_app' -import { c } from '#/shared' -import { useBodyScrollLock } from '#/shared/lib/hooks/use-body-scroll-lock' -import { CommonButton } from '#/shared/ui/button/ui' -import { CommonTextArea } from '#/shared/ui/common-textarea' - -import styles from './error-mobile.module.scss' - -const BusinessReportsMobile: NextPageWithLayout = () => { - const { error, isSend, setErrorMessage, handleFileChange, file, setFile, sendError, handleGoBackPage } = useErrorReport('business') - - const { companyName } = useAppSelector((state) => state.stepper.dataForCreate) - const [isAutocompleteOpen, setAutocompleteOpen] = React.useState(false) - - // хук для предотвращения скрола по странице - useBodyScrollLock(isAutocompleteOpen) - - const methods = useForm({ - defaultValues: { - companyName - }, - }) - - return ( - <> - {isSend ? ( -
-

Спасибо!

-

Ваше сообщение направлено нашим специалистам. Ответ придет на почту, указанную при регистрации

-
- ) : ( -
-

Запрос для компаний и партнеров

- - Опишите ваш сценарий — подберем решение и ответим за день. Работаем для корпораций, агентств и интеграторов - - - setAutocompleteOpen(true)} - onClose={() => setAutocompleteOpen(false)} - /> - - setErrorMessage(evt.target.value)} - buttomSlot={ - <> - - - } - /> - {file && ( -
-
- -
- {file.name} - {(file.size / 1024).toFixed(1)} KB -
-
- - -
- )} -
- - Отправить - - - Отмена - -
-
- )} - - ) -} - -export default BusinessReportsMobile @@ -11,7 +11,6 @@ import { getUserBalance } from '#/entities/balance' import { getAllInfo } from '#/entities/user-account' import { ChangePasswordPlate } from '#/features/change-password-corp' import { ErrorReportPlate } from '#/features/error-report' -import { BusinessErrorReportPlate } from '#/features/error-report/ui/business-error-report' import { change } from '#/features/pending' import { SlowLoading } from '#/features/slow-loading' import { Loader } from '#/shared' @@ -145,7 +144,6 @@ export const Layout: React.FC = ({ children, titlePage, isLoader, h {/* Дефолтные модалки */} - ) @@ -109,13 +109,6 @@ export const MainMenuMobile = memo(() => { link={'/reports-mobile'} icon={'/svg/side-menu/side-question'} /> - { const { isNextStepVisible } = useNextStep() const error_report = getModalById(ERROR_REPORT) - const business_error_report = getModalById(BUSINESS_ERROR_REPORT) - const match = useMediaQuery('(min-height:800px)') const [open, setOpen] = useState<'opened' | 'closed'>('closed') @@ -255,19 +253,6 @@ export const SideMenu = ({}) => { icon={'/svg/side-menu/side-question'} /> - { - business_error_report.setState(true) - }} - > - -