Compare commits
18 Commits
feature/ma
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
a98c948ad7 | ||
|
058f07e4e6 | ||
|
4a862ae383 | ||
|
eb91c89cd9 | ||
|
05e98b7afe | ||
b48e0e1247 | |||
066df51b58 | |||
1603d64caf | |||
|
771ea1d39b | ||
|
0b9d8c9fb6 | ||
|
47e2646fac | ||
9b84ab4c4d | |||
18c13628ba | |||
9f2d98a9ea | |||
f70aff175d | |||
|
0b9b2f4dbc | ||
|
87a4dcefdd | ||
|
0679ad92ef |
@ -3,7 +3,9 @@ import { jest } from '@jest/globals';
|
||||
jest.mock('@brojs/cli', () => ({
|
||||
getConfigValue: jest.fn(() => '/api'),
|
||||
getFeatures: jest.fn(() => ({
|
||||
['order-view-status-polling']: { value: '3000' }
|
||||
['order-view-status-polling']: { value: '3000' },
|
||||
['car-img-upload']: { value: 'true' },
|
||||
['order-cost']: { value: '1000' },
|
||||
})),
|
||||
getNavigationValue: jest.fn((navKey: string) => {
|
||||
switch (navKey) {
|
||||
|
@ -5,7 +5,7 @@ module.exports = {
|
||||
},
|
||||
coverageProvider: 'v8',
|
||||
coverageDirectory: 'coverage',
|
||||
collectCoverageFrom: ['**/src/**/*.{ts,tsx}', '!**/src/app.tsx'],
|
||||
collectCoverageFrom: ['**/src/**/*.{ts,tsx}', '!**/src/app.tsx', '!**/src/**/types.ts', '!**/src/**/*.d.ts', '!**/src/models/**/*'],
|
||||
collectCoverage: true,
|
||||
clearMocks: true,
|
||||
moduleNameMapper: {
|
||||
|
@ -26,6 +26,17 @@
|
||||
"dry-wash.order-create.form.washing-location-field.label": "Where is the car located?",
|
||||
"dry-wash.order-create.form.washing-location-field.placeholder": "Enter the address or select on the map",
|
||||
"dry-wash.order-create.form.washing-location-field.help": "For example, 55.754364, 48.743295 Universitetskaya Street, 1, Innopolis, Verkhneuslonsky district, Republic of Tatarstan (Tatarstan), 420500",
|
||||
"dry-wash.order-create.car-color-select.placeholder": "Input color",
|
||||
"dry-wash.order-create.car-color-select.custom": "Custom",
|
||||
"dry-wash.order-create.car-color-select.custom-label": "Custom:",
|
||||
"dry-wash.order-create.car-color-select.colors.white": "White",
|
||||
"dry-wash.order-create.car-color-select.colors.black": "Black",
|
||||
"dry-wash.order-create.car-color-select.colors.silver": "Silver",
|
||||
"dry-wash.order-create.car-color-select.colors.gray": "Gray",
|
||||
"dry-wash.order-create.car-color-select.colors.beige-brown": "Beige Brown",
|
||||
"dry-wash.order-create.car-color-select.colors.red": "Red",
|
||||
"dry-wash.order-create.car-color-select.colors.blue": "Blue",
|
||||
"dry-wash.order-create.car-color-select.colors.green": "Green",
|
||||
"dry-wash.order-create.car-body-select.placeholder": "Not specified",
|
||||
"dry-wash.order-create.car-body-select.options.sedan": "Sedan",
|
||||
"dry-wash.order-create.car-body-select.options.hatchback" : "Hatchback",
|
||||
@ -51,11 +62,14 @@
|
||||
"dry-wash.order-view.details.datetime-range": "When",
|
||||
"dry-wash.order-view.details.alert": "The operator will contact you about the payment at the specified phone number",
|
||||
"dry-wash.order-view.upload-car-image.field.label": "Upload a photo of your car, and our service will quickly calculate the pre-order price!",
|
||||
"dry-wash.order-view.upload-car-image.field.help": "Allowed formats: .jpg, .png. Maximum size: 5MB",
|
||||
"dry-wash.order-view.upload-car-image.field.help": "Allowed formats: .jpg, .png. Maximum size: 14MB",
|
||||
"dry-wash.order-view.upload-car-image.file-input.placeholder": "Upload a file",
|
||||
"dry-wash.order-view.upload-car-image.file-input.button": "Upload",
|
||||
"dry-wash.order-view.upload-car-image-query.success.title": "The car image is successfully uploaded",
|
||||
"dry-wash.order-view.upload-car-image-query.error.title": "Failed to upload the car image",
|
||||
"dry-wash.order-view.price-car.title": "The level of car contamination:",
|
||||
"dry-wash.order-view.price-car.description": "The cost of washing:",
|
||||
"dry-wash.order-view.price-car.error": "Failed to determine the level of car contamination",
|
||||
"dry-wash.arm.master.add": "Add",
|
||||
"dry-wash.arm.order.title": "Orders",
|
||||
"dry-wash.arm.order.table.empty": "Table empty",
|
||||
|
@ -81,6 +81,17 @@
|
||||
"dry-wash.order-create.form.washing-location-field.label": "Где находится автомобиль?",
|
||||
"dry-wash.order-create.form.washing-location-field.placeholder": "Введите адрес или выберите на карте",
|
||||
"dry-wash.order-create.form.washing-location-field.help": "Например, 55.754364, 48.743295 Университетская улица, 1, Иннополис, Верхнеуслонский район, Республика Татарстан (Татарстан), 420500",
|
||||
"dry-wash.order-create.car-color-select.placeholder": "Введите цвет",
|
||||
"dry-wash.order-create.car-color-select.custom": "Другой",
|
||||
"dry-wash.order-create.car-color-select.custom-label": "Другой:",
|
||||
"dry-wash.order-create.car-color-select.colors.white": "Белый",
|
||||
"dry-wash.order-create.car-color-select.colors.black": "Черный",
|
||||
"dry-wash.order-create.car-color-select.colors.silver": "Серебристый",
|
||||
"dry-wash.order-create.car-color-select.colors.gray": "Серый",
|
||||
"dry-wash.order-create.car-color-select.colors.beige-brown": "Бежево-коричневый",
|
||||
"dry-wash.order-create.car-color-select.colors.red": "Красный",
|
||||
"dry-wash.order-create.car-color-select.colors.blue": "Синий",
|
||||
"dry-wash.order-create.car-color-select.colors.green": "Зеленый",
|
||||
"dry-wash.order-create.car-body-select.placeholder": "Не указан",
|
||||
"dry-wash.order-create.car-body-select.options.sedan": "Седан",
|
||||
"dry-wash.order-create.car-body-select.options.hatchback": "Хэтчбек",
|
||||
@ -106,11 +117,14 @@
|
||||
"dry-wash.order-view.details.datetime-range": "Когда",
|
||||
"dry-wash.order-view.details.alert": "С вами свяжется оператор насчет оплаты по указанному номеру телефона",
|
||||
"dry-wash.order-view.upload-car-image.field.label": "Загрузите фото вашего автомобиля, и наш сервис быстро рассчитает предварительную стоимость заказа!",
|
||||
"dry-wash.order-view.upload-car-image.field.help": "Допустимые форматы: .jpg, .png. Максимальный размер: 5МБ",
|
||||
"dry-wash.order-view.upload-car-image.field.help": "Допустимые форматы: .jpg, .png. Максимальный размер: 14МБ",
|
||||
"dry-wash.order-view.upload-car-image.file-input.placeholder": "Загрузите файл",
|
||||
"dry-wash.order-view.upload-car-image.file-input.button": "Загрузить",
|
||||
"dry-wash.order-view.upload-car-image-query.success.title": "Изображение автомобиля успешно загружено",
|
||||
"dry-wash.order-view.upload-car-image-query.error.title": "Не удалось загрузить изображение автомобиля",
|
||||
"dry-wash.order-view.price-car.title": "Уровень загрязнения машины:",
|
||||
"dry-wash.order-view.price-car.description": "Стоимость мойки:",
|
||||
"dry-wash.order-view.price-car.error": "Не удалось определить уровень загрязнения машины",
|
||||
"dry-wash.notFound.title": "Страница не найдена",
|
||||
"dry-wash.notFound.description": "К сожалению, запрашиваемая вами страница не существует.",
|
||||
"dry-wash.notFound.button.back": "Вернуться на главную",
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "dry-wash",
|
||||
"version": "0.9.2",
|
||||
"version": "0.12.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "dry-wash",
|
||||
"version": "0.9.2",
|
||||
"version": "0.12.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.26.7",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dry-wash",
|
||||
"version": "0.9.2",
|
||||
"version": "0.12.0",
|
||||
"description": "<a id=\"readme-top\"></a>",
|
||||
"main": "./src/index.tsx",
|
||||
"scripts": {
|
||||
|
@ -21,8 +21,16 @@ export const api = createApi({
|
||||
}),
|
||||
tagTypes: ['Masters', 'Orders'],
|
||||
endpoints: (builder) => ({
|
||||
getMasters: builder.query<Master[], void>({
|
||||
query: () => ({ url: '/arm/masters' }),
|
||||
getMasters: builder.query<Master[], { date: Date }>({
|
||||
query: ({ date }) => {
|
||||
const startDate = dayjs(date).startOf('day').toISOString();
|
||||
const endDate = dayjs(date).endOf('day').toISOString();
|
||||
return {
|
||||
url: '/arm/masters/list',
|
||||
method: 'POST',
|
||||
body: { startDate, endDate },
|
||||
};
|
||||
},
|
||||
transformResponse: extractBodyFromResponse<Master[]>,
|
||||
providesTags: ['Masters'],
|
||||
}),
|
||||
@ -32,7 +40,7 @@ export const api = createApi({
|
||||
method: 'PATCH',
|
||||
body: { status, notes, master },
|
||||
}),
|
||||
invalidatesTags: ['Orders'],
|
||||
invalidatesTags: ['Orders', 'Masters'],
|
||||
}),
|
||||
getOrders: builder.query<OrderArm[], { date: Date }>({
|
||||
query: ({ date }) => {
|
||||
@ -54,14 +62,14 @@ export const api = createApi({
|
||||
method: 'POST',
|
||||
body: master,
|
||||
}),
|
||||
invalidatesTags: ['Masters'],
|
||||
invalidatesTags: ['Masters', 'Orders'],
|
||||
}),
|
||||
deleteMaster: builder.mutation<void, { id: string }>({
|
||||
query: ({ id }) => ({
|
||||
url: `/arm/masters/${id}`,
|
||||
method: 'DELETE',
|
||||
}),
|
||||
invalidatesTags: ['Masters'],
|
||||
invalidatesTags: ['Masters', 'Orders'],
|
||||
}),
|
||||
updateMaster: builder.mutation<void, UpdateMasterPayload>({
|
||||
query: ({ id, name, phone }) => ({
|
||||
@ -69,7 +77,7 @@ export const api = createApi({
|
||||
method: 'PATCH',
|
||||
body: { name, phone },
|
||||
}),
|
||||
invalidatesTags: ['Masters'],
|
||||
invalidatesTags: ['Masters', 'Orders'],
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
@ -3,7 +3,6 @@ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
|
||||
import { BaseResponse } from '../../models/api';
|
||||
|
||||
export const extractBodyFromResponse = <Body>(response: BaseResponse<Body>) => {
|
||||
console.log('response', response);
|
||||
if (response.success) {
|
||||
return response.body;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Box, Button, Heading, HStack, Divider, Flex } from '@chakra-ui/react';
|
||||
import { Box, Button, Heading, HStack, Flex } from '@chakra-ui/react';
|
||||
import React from 'react';
|
||||
import { useLocation, Link } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@ -30,7 +30,6 @@ const Header = () => {
|
||||
{t('orders')}
|
||||
</Button>
|
||||
)}
|
||||
<Divider orientation='vertical' height='30px' />
|
||||
{URLs.armMaster.isOn && (
|
||||
<Button
|
||||
as={Link}
|
||||
@ -49,7 +48,6 @@ const Header = () => {
|
||||
to={URLs.armMap.url}
|
||||
colorScheme={isActive(URLs.armMap.url) ? 'green' : 'blue'}
|
||||
variant={isActive(URLs.armMap.url) ? 'outline' : 'ghost'}
|
||||
data-testid='master-button'
|
||||
>
|
||||
Карта заказов
|
||||
</Button>
|
||||
|
@ -1,11 +1,13 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Box, Flex, Heading, Spinner } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { YMaps, Map, Placemark } from '@pbe/react-yandex-maps';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useGetOrdersQuery } from '../../__data__/service/api';
|
||||
import getCoordinates from '../../utils/getCoordinates';
|
||||
import DateNavigator from '../DateNavigator';
|
||||
|
||||
const OrdersMap = () => {
|
||||
const { t } = useTranslation('~', {
|
||||
@ -14,14 +16,13 @@ const OrdersMap = () => {
|
||||
|
||||
const location = useLocation();
|
||||
const params = new URLSearchParams(location.search);
|
||||
const latFromUrl = parseFloat(params.get('lat') || 55.78);
|
||||
const lonFromUrl = parseFloat(params.get('lon') || 49.12);
|
||||
const currentDate = useMemo(
|
||||
() =>
|
||||
params.get('currentDate')
|
||||
? new Date(params.get('currentDate'))
|
||||
: new Date(),
|
||||
[],
|
||||
const latFromUrl = parseFloat(params.get('lat') || '55.78');
|
||||
const lonFromUrl = parseFloat(params.get('lon') || '49.12');
|
||||
|
||||
const [currentDate, setCurrentDate] = useState(
|
||||
params.get('currentDate')
|
||||
? new Date(params.get('currentDate'))
|
||||
: new Date(),
|
||||
);
|
||||
|
||||
const {
|
||||
@ -44,6 +45,18 @@ const OrdersMap = () => {
|
||||
{t('title')}
|
||||
</Heading>
|
||||
|
||||
<DateNavigator
|
||||
currentDate={currentDate}
|
||||
onPreviousDate={() =>
|
||||
setCurrentDate((prevDate) =>
|
||||
dayjs(prevDate).subtract(1, 'day').toDate(),
|
||||
)
|
||||
}
|
||||
onNextDate={() =>
|
||||
setCurrentDate((prevDate) => dayjs(prevDate).add(1, 'day').toDate())
|
||||
}
|
||||
/>
|
||||
|
||||
{isLoading && (
|
||||
<Flex justifyContent='center' alignItems='center'>
|
||||
<Spinner size='lg' />
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Heading,
|
||||
@ -15,11 +15,13 @@ import {
|
||||
Spinner,
|
||||
} from '@chakra-ui/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import MasterItem from '../MasterItem';
|
||||
import MasterDrawer from '../MasterDrawer';
|
||||
import { useGetMastersQuery } from '../../__data__/service/api';
|
||||
import useShowToast from '../../hooks/useShowToast';
|
||||
import DateNavigator from '../DateNavigator';
|
||||
|
||||
const TABLE_HEADERS = [
|
||||
'name' as const,
|
||||
@ -31,12 +33,18 @@ const TABLE_HEADERS = [
|
||||
const Masters = () => {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const showToast = useShowToast();
|
||||
const [currentDate, setCurrentDate] = useState(new Date());
|
||||
|
||||
const { t } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.arm.master',
|
||||
});
|
||||
|
||||
const { data: masters, error, isLoading, isSuccess } = useGetMastersQuery();
|
||||
const {
|
||||
data: masters,
|
||||
error,
|
||||
isLoading,
|
||||
isSuccess,
|
||||
} = useGetMastersQuery({ date: currentDate });
|
||||
|
||||
useEffect(() => {
|
||||
if (error) {
|
||||
@ -46,12 +54,24 @@ const Masters = () => {
|
||||
|
||||
return (
|
||||
<Box p='8'>
|
||||
<Flex justifyContent='space-between' alignItems='center' mb='5'>
|
||||
<Flex justifyContent='space-between' alignItems='baseline' mb='5'>
|
||||
<Heading size='lg'> {t('title')}</Heading>
|
||||
|
||||
<Button colorScheme='green' onClick={onOpen}>
|
||||
+ {t('add')}
|
||||
</Button>
|
||||
</Flex>
|
||||
<DateNavigator
|
||||
currentDate={currentDate}
|
||||
onPreviousDate={() =>
|
||||
setCurrentDate((prevDate) =>
|
||||
dayjs(prevDate).subtract(1, 'day').toDate(),
|
||||
)
|
||||
}
|
||||
onNextDate={() =>
|
||||
setCurrentDate((prevDate) => dayjs(prevDate).add(1, 'day').toDate())
|
||||
}
|
||||
/>
|
||||
<Table variant='simple' colorScheme='blackAlpha'>
|
||||
<Thead>
|
||||
<Tr>
|
||||
|
@ -53,7 +53,7 @@ const Orders = () => {
|
||||
isSuccess: isMastersSuccess,
|
||||
isError: isMastersError,
|
||||
error: mastersError,
|
||||
} = useGetMastersQuery();
|
||||
} = useGetMastersQuery({ date: currentDate });
|
||||
|
||||
const isLoading = isOrdersLoading || isMastersLoading;
|
||||
const isSuccess = isOrdersSuccess && isMastersSuccess;
|
||||
|
@ -1,10 +1,13 @@
|
||||
import { Box, Image, Progress, Text } from '@chakra-ui/react';
|
||||
import { Box, Image, Progress, Text, VStack } from '@chakra-ui/react';
|
||||
import React from 'react';
|
||||
import { getFeatures } from '@brojs/cli';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const PRICE_INCREASE_PERCENT_PER_RATING = 10; // 10% за каждый балл
|
||||
import { formatPrice, getProgressColor } from './helper';
|
||||
|
||||
export const PriceCar = ({ image, rating }) => {
|
||||
const PRICE_INCREASE_PERCENT_PER_RATING = 10;
|
||||
|
||||
export const PriceCar = ({ image, rating, description }) => {
|
||||
const BASE_WASH_PRICE: number = Number(
|
||||
getFeatures('dry-wash')['order-cost']?.value || 1000,
|
||||
);
|
||||
@ -15,32 +18,56 @@ export const PriceCar = ({ image, rating }) => {
|
||||
return BASE_WASH_PRICE + priceIncrease;
|
||||
};
|
||||
|
||||
const { i18n, t } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.order-view.price-car',
|
||||
});
|
||||
const washPrice = calculateWashPrice(rating);
|
||||
const formattedPrice = formatPrice(washPrice, i18n.language);
|
||||
|
||||
const progressValue = (rating / 10) * 100;
|
||||
|
||||
return (
|
||||
<Box
|
||||
alignItems='center'
|
||||
gap={5}
|
||||
width='100%'
|
||||
display='flex'
|
||||
flexDirection='column'
|
||||
justifyContent='center'
|
||||
alignItems='flex-start'
|
||||
flexWrap='wrap'
|
||||
>
|
||||
<Image
|
||||
maxWidth='600px'
|
||||
width='100%'
|
||||
objectFit='contain'
|
||||
borderRadius='md'
|
||||
src={image}
|
||||
alt='Car Image'
|
||||
alt=''
|
||||
/>
|
||||
{rating ? (
|
||||
<Box width='100%' maxW='600px'>
|
||||
<Text>Рейтинг загрязнения машины:</Text>
|
||||
<Progress value={progressValue} size='sm' colorScheme='red' mt={2} />
|
||||
<Text mt={2}>Стоимость мойки: {washPrice.toFixed(2)} руб.</Text>
|
||||
</Box>
|
||||
) : (
|
||||
<Text>Не удалость определить уровень загрязнения машины</Text>
|
||||
)}
|
||||
<Box flex='1 1 40%'>
|
||||
{!Number.isNaN(progressValue) ? (
|
||||
<VStack alignItems='stretch'>
|
||||
<Box>
|
||||
<Text>{t('title')}</Text>
|
||||
<Progress
|
||||
value={progressValue}
|
||||
size='sm'
|
||||
sx={{
|
||||
'& > div': {
|
||||
backgroundColor: getProgressColor(progressValue),
|
||||
},
|
||||
}}
|
||||
mt={2}
|
||||
/>
|
||||
<Text mt={2}>
|
||||
{t('description')} <b>{formattedPrice}</b>
|
||||
</Text>
|
||||
</Box>
|
||||
<Text fontStyle='italic'>{description}</Text>
|
||||
</VStack>
|
||||
) : (
|
||||
<Text>{t('error')}</Text>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
15
src/components/PriceCar/helper.ts
Normal file
15
src/components/PriceCar/helper.ts
Normal file
@ -0,0 +1,15 @@
|
||||
export const formatPrice = (price: number, locale = 'ru-RU', currency = 'RUB') => {
|
||||
return new Intl.NumberFormat(locale, {
|
||||
style: 'currency',
|
||||
currency: currency,
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
}).format(price);
|
||||
};
|
||||
|
||||
export const getProgressColor = (value: number) => {
|
||||
const normalizedValue = value / 100;
|
||||
const hue = 120 - normalizedValue * 120;
|
||||
|
||||
return `hsl(${hue}, 100%, 50%)`;
|
||||
};
|
@ -21,9 +21,10 @@ import { CarBodySelectProps } from './types';
|
||||
export const CarBodySelect = forwardRef<HTMLInputElement, CarBodySelectProps>(
|
||||
function CarBodySelect(props, ref) {
|
||||
const handleOptionClick: UseRadioGroupProps['onChange'] = (value) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
props.onChange(value);
|
||||
props.onChange({
|
||||
target: { value },
|
||||
} as React.ChangeEvent<HTMLInputElement>);
|
||||
onClose();
|
||||
};
|
||||
|
||||
const { value, getRadioProps, getRootProps } = useRadioGroup({
|
||||
@ -39,12 +40,14 @@ export const CarBodySelect = forwardRef<HTMLInputElement, CarBodySelectProps>(
|
||||
});
|
||||
|
||||
return (
|
||||
<Box width='100%'>
|
||||
<Box width='100%' pos='relative'>
|
||||
<Popover
|
||||
isOpen={isOpen}
|
||||
autoFocus={false}
|
||||
placement='bottom-start'
|
||||
matchWidth
|
||||
gutter={2}
|
||||
strategy="fixed"
|
||||
>
|
||||
<PopoverAnchor>
|
||||
<Input
|
||||
|
@ -1 +1,2 @@
|
||||
export { CarBodySelect } from './car-body-select';
|
||||
export { CarBodySelect } from './car-body-select';
|
||||
export { carBodySelectOptions } from './helper';
|
@ -1,23 +0,0 @@
|
||||
import React, { forwardRef, useId } from 'react';
|
||||
import { Input, InputProps } from '@chakra-ui/react';
|
||||
|
||||
import { CAR_COLORS } from './helper';
|
||||
|
||||
export const CarColorInput = forwardRef<HTMLInputElement, InputProps>(
|
||||
function CarColorInput(props, ref) {
|
||||
const listId = useId();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Input ref={ref} list={listId} {...props} />
|
||||
<datalist id={listId}>
|
||||
{CAR_COLORS.map(({ code, name }) => (
|
||||
<option key={code} label={name} value={code}>{name}</option>
|
||||
))}
|
||||
</datalist>
|
||||
</>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
// todo: add option color visual indication
|
@ -0,0 +1,75 @@
|
||||
import React from 'react';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
import { CarColorSelect } from './car-color-select';
|
||||
|
||||
// Mock the translation hook
|
||||
jest.mock('react-i18next', () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string) => {
|
||||
// Return the last part of the key as that's what component is using
|
||||
const keyParts = key.split('.');
|
||||
return keyParts[keyParts.length - 1];
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
describe('CarColorSelect', () => {
|
||||
it('renders color options correctly', () => {
|
||||
const onChange = jest.fn();
|
||||
render(<CarColorSelect onChange={onChange} />);
|
||||
|
||||
// Check if color buttons are rendered
|
||||
const colorButtons = screen.getAllByRole('button');
|
||||
expect(colorButtons.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('handles color selection', () => {
|
||||
const onChange = jest.fn();
|
||||
render(<CarColorSelect onChange={onChange} />);
|
||||
|
||||
// Click the first color button
|
||||
const colorButtons = screen.getAllByRole('button');
|
||||
fireEvent.click(colorButtons[0]);
|
||||
|
||||
expect(onChange).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('handles custom color selection', () => {
|
||||
const onChange = jest.fn();
|
||||
render(<CarColorSelect onChange={onChange} />);
|
||||
|
||||
// Find and click the custom color button
|
||||
const customButton = screen.getByText('custom');
|
||||
fireEvent.click(customButton);
|
||||
|
||||
// Check if custom color input appears
|
||||
const customInput = screen.getByPlaceholderText('placeholder');
|
||||
expect(customInput).toBeInTheDocument();
|
||||
|
||||
// Test custom color input
|
||||
fireEvent.change(customInput, { target: { value: '#FF0000' } });
|
||||
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({
|
||||
target: { value: '#FF0000' },
|
||||
}));
|
||||
});
|
||||
|
||||
it('shows selected color label when color is selected', () => {
|
||||
const onChange = jest.fn();
|
||||
render(<CarColorSelect value="black" onChange={onChange} />);
|
||||
|
||||
// Since the color label might not be immediately visible,
|
||||
// we'll verify the component renders without crashing
|
||||
const buttons = screen.getAllByRole('button');
|
||||
expect(buttons.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('handles invalid state', () => {
|
||||
render(<CarColorSelect isInvalid={true} />);
|
||||
|
||||
// Since the component doesn't show explicit invalid state UI,
|
||||
// we'll verify that the component renders without crashing
|
||||
expect(screen.getAllByRole('button').length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
177
src/components/order-form/form/car-color/car-color-select.tsx
Normal file
177
src/components/order-form/form/car-color/car-color-select.tsx
Normal file
@ -0,0 +1,177 @@
|
||||
import React, { forwardRef, useState } from 'react';
|
||||
import { Input, Box, Stack, Text, Flex } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Car } from '../../../../models';
|
||||
|
||||
import { carColorSelectOptions } from './helper';
|
||||
|
||||
interface CarColorSelectProps {
|
||||
value?: string;
|
||||
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
name?: string;
|
||||
isInvalid?: boolean;
|
||||
}
|
||||
|
||||
export const CarColorSelect = forwardRef<HTMLInputElement, CarColorSelectProps>(
|
||||
function CarColorSelect(props, ref) {
|
||||
const [customColor, setCustomColor] = useState('');
|
||||
const [isCustom, setIsCustom] = useState(false);
|
||||
|
||||
const handleColorChange = (value: Car.Color | string) => {
|
||||
if (value === 'custom') {
|
||||
setIsCustom(true);
|
||||
return;
|
||||
}
|
||||
setIsCustom(false);
|
||||
props.onChange?.({
|
||||
target: { value },
|
||||
} as React.ChangeEvent<HTMLInputElement>);
|
||||
};
|
||||
|
||||
const handleCustomColorChange = (
|
||||
e: React.ChangeEvent<HTMLInputElement>,
|
||||
) => {
|
||||
const value = e.target.value;
|
||||
setCustomColor(value);
|
||||
props.onChange?.({
|
||||
target: { value },
|
||||
} as React.ChangeEvent<HTMLInputElement>);
|
||||
};
|
||||
|
||||
const { t } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.order-create.car-color-select',
|
||||
});
|
||||
|
||||
const currentValue = isCustom ? 'custom' : props.value;
|
||||
|
||||
return (
|
||||
<Stack spacing={4} width='100%' ref={ref}>
|
||||
<Flex gap={2} wrap='wrap' pb={2}>
|
||||
{carColorSelectOptions.map(({ value, labelTKey, code }) => (
|
||||
<Box
|
||||
key={value}
|
||||
flexShrink={0}
|
||||
as='button'
|
||||
type='button'
|
||||
onClick={() => handleColorChange(value)}
|
||||
>
|
||||
<Flex
|
||||
align='center'
|
||||
gap={2}
|
||||
p={1}
|
||||
borderRadius='full'
|
||||
borderWidth='2px'
|
||||
borderColor='gray.200'
|
||||
bg='white'
|
||||
_hover={{
|
||||
borderColor: 'primary.500',
|
||||
bg: 'gray.50',
|
||||
}}
|
||||
justify='center'
|
||||
transition='all 0.2s'
|
||||
{...(currentValue === value && {
|
||||
borderColor: 'primary.500',
|
||||
bg: 'primary.50',
|
||||
paddingInlineEnd: 3,
|
||||
_hover: {
|
||||
bg: 'primary.50',
|
||||
},
|
||||
})}
|
||||
>
|
||||
<Flex align='center' gap={2}>
|
||||
<Box
|
||||
w='32px'
|
||||
h='32px'
|
||||
borderRadius='full'
|
||||
bg={code}
|
||||
border='1px'
|
||||
borderColor='gray.200'
|
||||
transition='all 0.2s'
|
||||
boxShadow='none'
|
||||
{...(currentValue === value && {
|
||||
borderColor: 'primary.500',
|
||||
boxShadow: 'sm',
|
||||
})}
|
||||
/>
|
||||
{currentValue === value && (
|
||||
<Text fontSize='xs' color='primary.700' fontWeight='medium'>
|
||||
{t(`colors.${labelTKey}`)}
|
||||
</Text>
|
||||
)}
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Box>
|
||||
))}
|
||||
<Box
|
||||
flexShrink={0}
|
||||
as='button'
|
||||
type='button'
|
||||
onClick={() => handleColorChange('custom')}
|
||||
>
|
||||
<Flex
|
||||
align='center'
|
||||
gap={2}
|
||||
p={1}
|
||||
paddingInlineEnd={3}
|
||||
borderRadius='full'
|
||||
borderWidth='2px'
|
||||
borderColor='gray.200'
|
||||
bg='white'
|
||||
_hover={{
|
||||
borderColor: 'primary.500',
|
||||
bg: 'gray.50',
|
||||
}}
|
||||
justify='center'
|
||||
transition='all 0.2s'
|
||||
{...(isCustom && {
|
||||
borderColor: 'primary.500',
|
||||
paddingInlineStart: 3,
|
||||
bg: 'primary.50',
|
||||
_hover: {
|
||||
bg: 'primary.50',
|
||||
},
|
||||
})}
|
||||
>
|
||||
{isCustom ? (
|
||||
<Flex gap={2} align='center'>
|
||||
<Text fontSize='xs' color='primary.700' fontWeight='medium'>
|
||||
{t('custom-label')}
|
||||
</Text>
|
||||
<Input
|
||||
size='sm'
|
||||
width='120px'
|
||||
value={customColor}
|
||||
onChange={handleCustomColorChange}
|
||||
placeholder={t('placeholder')}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
borderColor='primary.200'
|
||||
_focus={{
|
||||
borderColor: 'primary.500',
|
||||
boxShadow: '0 0 0 1px var(--chakra-colors-primary-500)',
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
) : (
|
||||
<Flex align='center' gap={2}>
|
||||
<Box
|
||||
w='32px'
|
||||
h='32px'
|
||||
borderRadius='full'
|
||||
bg='gray.100'
|
||||
border='1px'
|
||||
borderColor='gray.200'
|
||||
transition='all 0.2s'
|
||||
/>
|
||||
<Text fontSize='xs' color='gray.500'>
|
||||
{t('custom')}
|
||||
</Text>
|
||||
</Flex>
|
||||
)}
|
||||
</Flex>
|
||||
</Box>
|
||||
</Flex>
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
);
|
@ -1,34 +1,44 @@
|
||||
export const CAR_COLORS: Record<'name' | 'code', string>[] = [
|
||||
import { Car } from "../../../../models";
|
||||
|
||||
export const carColorSelectOptions: { value: Car.Color | string; labelTKey: 'white' | 'black' | 'silver' | 'gray' | 'beige-brown' | 'red' | 'blue' | 'green'; code: string }[] = [
|
||||
{
|
||||
name: 'white',
|
||||
value: Car.Color.WHITE,
|
||||
labelTKey: 'white',
|
||||
code: '#ffffff'
|
||||
},
|
||||
{
|
||||
name: 'black',
|
||||
value: Car.Color.BLACK,
|
||||
labelTKey: 'black',
|
||||
code: '#000000'
|
||||
},
|
||||
{
|
||||
name: 'silver',
|
||||
value: Car.Color.SILVER,
|
||||
labelTKey: 'silver',
|
||||
code: '#c0c0c0'
|
||||
},
|
||||
{
|
||||
name: 'gray',
|
||||
value: Car.Color.GRAY,
|
||||
labelTKey: 'gray',
|
||||
code: '#808080'
|
||||
},
|
||||
{
|
||||
name: 'beige-brown',
|
||||
value: Car.Color.BEIGE_BROWN,
|
||||
labelTKey: 'beige-brown',
|
||||
code: '#796745'
|
||||
},
|
||||
{
|
||||
name: 'red',
|
||||
value: Car.Color.RED,
|
||||
labelTKey: 'red',
|
||||
code: '#b90000'
|
||||
},
|
||||
{
|
||||
name: 'blue',
|
||||
value: Car.Color.BLUE,
|
||||
labelTKey: 'blue',
|
||||
code: '#003B62'
|
||||
},
|
||||
{
|
||||
name: 'green',
|
||||
value: Car.Color.GREEN,
|
||||
labelTKey: 'green',
|
||||
code: '#078d51'
|
||||
},
|
||||
];
|
@ -1 +1,2 @@
|
||||
export { CarColorInput } from './car-color-input';
|
||||
export { CarColorSelect } from './car-color-select';
|
||||
export { carColorSelectOptions } from './helper';
|
26
src/components/order-form/form/date-time/helper.ts
Normal file
26
src/components/order-form/form/date-time/helper.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import dayjs from 'dayjs';
|
||||
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
|
||||
export const getMinDatetime = (dateTimeString: string, minDateTimeString: string) => {
|
||||
const time = dayjs(dateTimeString);
|
||||
|
||||
const minDate = dayjs(minDateTimeString).format('YYYY-MM-DD');
|
||||
const minTime = dayjs(minDateTimeString);
|
||||
|
||||
const newTime = (time && time.isAfter(minTime)) ? time : minTime;
|
||||
|
||||
return [minDate, newTime.format('HH:mm')].join('T');
|
||||
};
|
||||
|
||||
export const getMaxDatetime = (dateTimeString: string, maxDateTimeString: string) => {
|
||||
const time = dayjs(dateTimeString);
|
||||
|
||||
const maxDate = dayjs(maxDateTimeString).format('YYYY-MM-DD');
|
||||
const maxTime = dayjs(maxDateTimeString);
|
||||
|
||||
const newTime = (time && time.isBefore(maxTime)) ? time : maxTime;
|
||||
|
||||
return [maxDate, newTime.format('HH:mm')].join('T');
|
||||
};
|
@ -1 +1,2 @@
|
||||
export { type DateTimeInputProps, DateTimeInput } from './date-time';
|
||||
export { type DateTimeInputProps, DateTimeInput } from './date-time';
|
||||
export { getMinDatetime, getMaxDatetime } from './helper';
|
@ -1,2 +1,4 @@
|
||||
export type { OrderFormValues, OrderFormProps } from './types';
|
||||
export { OrderForm } from './order-form';
|
||||
export { OrderForm } from './order-form';
|
||||
export { carBodySelectOptions } from './car-body';
|
||||
export { carColorSelectOptions } from './car-color';
|
@ -1,4 +1,4 @@
|
||||
import React, { forwardRef, memo, useEffect, useState } from 'react';
|
||||
import React, { ForwardedRef, forwardRef, memo, useEffect, useState } from 'react';
|
||||
import {
|
||||
Input,
|
||||
Box,
|
||||
@ -24,129 +24,130 @@ import {
|
||||
} from './helper';
|
||||
import { LocationInputProps } from './types';
|
||||
|
||||
export const LocationInput = memo(
|
||||
withYMaps(
|
||||
forwardRef<HTMLInputElement, LocationInputProps>(function LocationInput(
|
||||
{ ymaps, value, onChange, ...props },
|
||||
ref,
|
||||
) {
|
||||
const [inputValue, setInputValue] = useState<string>('');
|
||||
export const BaseLocationInput = withYMaps(
|
||||
({ ymaps, value = '', onChange, inputRef, ...props }: LocationInputProps & { inputRef: ForwardedRef<HTMLInputElement> }) => {
|
||||
const [inputValue, setInputValue] = useState<string>('');
|
||||
|
||||
useEffect(() => {
|
||||
setInputValue(value);
|
||||
}, [value]);
|
||||
useEffect(() => {
|
||||
setInputValue(value);
|
||||
}, [value]);
|
||||
|
||||
const [suggestions, setSuggestions] = useState<Suggestion[]>([]);
|
||||
const [isSuggestionsPanelOpen, setIsSuggestionsPanelOpen] =
|
||||
useState<boolean>(false);
|
||||
const [suggestions, setSuggestions] = useState<Suggestion[]>([]);
|
||||
const [isSuggestionsPanelOpen, setIsSuggestionsPanelOpen] =
|
||||
useState<boolean>(false);
|
||||
|
||||
const onInputChange: InputProps['onChange'] = async (e) => {
|
||||
const newInputValue = e.target.value;
|
||||
const onInputChange: InputProps['onChange'] = async (e) => {
|
||||
const newInputValue = e.target.value;
|
||||
|
||||
if (
|
||||
isValidLocation(newInputValue) &&
|
||||
(await isRealLocation(ymaps, newInputValue))
|
||||
) {
|
||||
onChange(newInputValue);
|
||||
} else {
|
||||
setInputValue(newInputValue);
|
||||
|
||||
if (newInputValue.trim().length > 3) {
|
||||
try {
|
||||
const address = extractAddress(newInputValue);
|
||||
const results = await ymaps.suggest(address);
|
||||
setSuggestions(results);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
} else {
|
||||
setSuggestions([]);
|
||||
if (
|
||||
isValidLocation(newInputValue) &&
|
||||
(await isRealLocation(ymaps, newInputValue))
|
||||
) {
|
||||
onChange(newInputValue);
|
||||
} else {
|
||||
setInputValue(newInputValue);
|
||||
|
||||
if (newInputValue.trim().length > 3) {
|
||||
try {
|
||||
const address = extractAddress(newInputValue);
|
||||
const results = await ymaps.suggest(address);
|
||||
setSuggestions(results);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
setIsSuggestionsPanelOpen(suggestions.length > 1);
|
||||
}
|
||||
};
|
||||
|
||||
const onFocus: InputProps['onFocus'] = () => {
|
||||
setIsSuggestionsPanelOpen(suggestions.length > 1);
|
||||
};
|
||||
|
||||
const onBlur: InputProps['onBlur'] = async (e) => {
|
||||
const inputValue = e.target.value;
|
||||
if (
|
||||
isValidLocation(inputValue) &&
|
||||
(await isRealLocation(ymaps, inputValue))
|
||||
) {
|
||||
onChange(inputValue);
|
||||
} else {
|
||||
setInputValue(value);
|
||||
setSuggestions([]);
|
||||
}
|
||||
setIsSuggestionsPanelOpen(false);
|
||||
};
|
||||
|
||||
const handleSuggestionClick = async ({ value: address }: Suggestion) => {
|
||||
try {
|
||||
const location = await getLocationByAddress(ymaps, address);
|
||||
const newValue = formatLocation(location);
|
||||
setInputValue(newValue);
|
||||
onChange(newValue);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
setIsSuggestionsPanelOpen(suggestions.length > 1);
|
||||
}
|
||||
};
|
||||
|
||||
const { t } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.order-create.form.washing-location-field',
|
||||
});
|
||||
const onFocus: InputProps['onFocus'] = () => {
|
||||
setIsSuggestionsPanelOpen(suggestions.length > 1);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box width='100%'>
|
||||
<Popover
|
||||
isOpen={isSuggestionsPanelOpen}
|
||||
autoFocus={false}
|
||||
placement='bottom-start'
|
||||
>
|
||||
<PopoverAnchor>
|
||||
<Input
|
||||
{...props}
|
||||
ref={ref}
|
||||
onBlur={onBlur}
|
||||
value={inputValue ?? value}
|
||||
onChange={onInputChange}
|
||||
onFocus={onFocus}
|
||||
placeholder={t('placeholder')}
|
||||
/>
|
||||
</PopoverAnchor>
|
||||
<PopoverContent width='100%' maxWidth='100%'>
|
||||
<PopoverBody border='1px' borderColor='gray.300' p={0}>
|
||||
<List>
|
||||
{suggestions.map((suggestion, index) => (
|
||||
<ListItem
|
||||
key={index}
|
||||
p={2}
|
||||
cursor='pointer'
|
||||
_hover={{
|
||||
bgColor: 'primary.50',
|
||||
}}
|
||||
_active={{
|
||||
bgColor: 'primary.100',
|
||||
}}
|
||||
onClick={() => handleSuggestionClick(suggestion)}
|
||||
>
|
||||
{suggestion.displayName}
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
</PopoverBody>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</Box>
|
||||
);
|
||||
}),
|
||||
true,
|
||||
['suggest', 'geocode'],
|
||||
),
|
||||
const onBlur: InputProps['onBlur'] = async (e) => {
|
||||
const inputValue = e.target.value;
|
||||
if (
|
||||
isValidLocation(inputValue) &&
|
||||
(await isRealLocation(ymaps, inputValue))
|
||||
) {
|
||||
onChange(inputValue);
|
||||
} else {
|
||||
setInputValue(value);
|
||||
}
|
||||
setIsSuggestionsPanelOpen(false);
|
||||
};
|
||||
|
||||
const handleSuggestionClick = async ({ value: address }: Suggestion) => {
|
||||
try {
|
||||
const location = await getLocationByAddress(ymaps, address);
|
||||
const newValue = formatLocation(location);
|
||||
setInputValue(newValue);
|
||||
onChange(newValue);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const { t } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.order-create.form.washing-location-field',
|
||||
});
|
||||
|
||||
return (
|
||||
<Box width='100%'>
|
||||
<Popover
|
||||
isOpen={isSuggestionsPanelOpen}
|
||||
autoFocus={false}
|
||||
placement='bottom-start'
|
||||
>
|
||||
<PopoverAnchor>
|
||||
<Input
|
||||
{...props}
|
||||
ref={inputRef}
|
||||
onBlur={onBlur}
|
||||
value={inputValue || value}
|
||||
onChange={onInputChange}
|
||||
onFocus={onFocus}
|
||||
placeholder={t('placeholder')}
|
||||
/>
|
||||
</PopoverAnchor>
|
||||
<PopoverContent width='100%' maxWidth='100%'>
|
||||
<PopoverBody border='1px' borderColor='gray.300' p={0}>
|
||||
<List>
|
||||
{suggestions.map((suggestion, index) => (
|
||||
<ListItem
|
||||
key={index}
|
||||
p={2}
|
||||
cursor='pointer'
|
||||
_hover={{
|
||||
bgColor: 'primary.50',
|
||||
}}
|
||||
_active={{
|
||||
bgColor: 'primary.100',
|
||||
}}
|
||||
onClick={() => handleSuggestionClick(suggestion)}
|
||||
>
|
||||
{suggestion.displayName}
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
</PopoverBody>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</Box>
|
||||
);
|
||||
},
|
||||
true,
|
||||
['suggest', 'geocode'],
|
||||
);
|
||||
|
||||
export const LocationInput = memo(forwardRef<HTMLInputElement, LocationInputProps>(
|
||||
function LocationInput(props, ref) {
|
||||
return <BaseLocationInput {...props} inputRef={ref} />;
|
||||
},
|
||||
));
|
||||
|
||||
// todo: i18n
|
||||
// todo: replace console.error with toast
|
||||
|
@ -31,8 +31,22 @@ export const MapComponent: FC<{
|
||||
}
|
||||
}, [selectedLocation]);
|
||||
|
||||
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
||||
useEffect(() => {
|
||||
const handleResize = () => {
|
||||
setWindowWidth(window.innerWidth);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', handleResize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Map
|
||||
key={windowWidth}
|
||||
state={{
|
||||
center: mapCenter,
|
||||
zoom:
|
||||
|
@ -1,23 +1,23 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Box, Flex, FormControl, FormLabel, VStack } from '@chakra-ui/react';
|
||||
|
||||
import { CarBodySelect } from './car-body';
|
||||
import { CarColorInput } from './car-color';
|
||||
import { CarNumberInput } from './car-number';
|
||||
import { FormInputField, FormControllerField } from './field';
|
||||
import { OrderFormProps, OrderFormValues } from './types';
|
||||
import { PhoneInput } from './phone';
|
||||
import { SubmitButton } from './submit';
|
||||
import { defaultValues, useGetValidationRules } from './helper';
|
||||
import { DateTimeInput } from './date-time';
|
||||
import { DateTimeInput, getMinDatetime, getMaxDatetime } from './date-time';
|
||||
import {
|
||||
LocationInput,
|
||||
MapComponent,
|
||||
StringLocation,
|
||||
YMapsProvider,
|
||||
} from './location';
|
||||
import { CarColorSelect } from './car-color';
|
||||
|
||||
export const OrderForm = ({ onSubmit, loading, ...props }: OrderFormProps) => {
|
||||
const {
|
||||
@ -40,6 +40,19 @@ export const OrderForm = ({ onSubmit, loading, ...props }: OrderFormProps) => {
|
||||
'carLocation',
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!availableDatetimeBegin) {
|
||||
return;
|
||||
}
|
||||
setValue('availableDatetimeEnd', getMinDatetime(availableDatetimeEnd, availableDatetimeBegin));
|
||||
}, [availableDatetimeBegin]);
|
||||
useEffect(() => {
|
||||
if (!availableDatetimeEnd) {
|
||||
return;
|
||||
}
|
||||
setValue('availableDatetimeBegin', getMaxDatetime(availableDatetimeBegin, availableDatetimeEnd));
|
||||
}, [availableDatetimeEnd]);
|
||||
|
||||
return (
|
||||
<Box p={4} marginInline='auto' {...props}>
|
||||
<VStack
|
||||
@ -72,7 +85,7 @@ export const OrderForm = ({ onSubmit, loading, ...props }: OrderFormProps) => {
|
||||
name='carColor'
|
||||
label={t('car-color-field.label')}
|
||||
errors={errors}
|
||||
Input={CarColorInput}
|
||||
Input={CarColorSelect}
|
||||
/>
|
||||
<FormInputField
|
||||
control={control}
|
||||
|
29
src/components/order-view/details/car/car-details.tsx
Normal file
29
src/components/order-view/details/car/car-details.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import { FC } from 'react';
|
||||
import { Flex, Image } from '@chakra-ui/react';
|
||||
|
||||
import { Order } from '../../../../models';
|
||||
import {
|
||||
carBodySelectOptions,
|
||||
carColorSelectOptions,
|
||||
} from '../../../order-form';
|
||||
|
||||
import { LicensePlate } from './license-plate';
|
||||
|
||||
type Props = Pick<Order.View, 'carNumber' | 'carBody' | 'carColor'>;
|
||||
|
||||
export const CarDetails: FC<Props> = ({ carNumber, carBody, carColor }) => {
|
||||
const image = carBodySelectOptions.find(({ value }) => value === carBody).img;
|
||||
const color =
|
||||
carColorSelectOptions.find(({ value }) => value === carColor)?.code ??
|
||||
'black';
|
||||
|
||||
return (
|
||||
<Flex direction='column' alignItems='center' p={2}>
|
||||
<div style={{ backgroundColor: color, width: 'fit-content' }}>
|
||||
<Image src={image} style={{ mixBlendMode: 'lighten' }} />
|
||||
</div>
|
||||
<LicensePlate carNumber={carNumber} />
|
||||
</Flex>
|
||||
);
|
||||
};
|
1
src/components/order-view/details/car/index.ts
Normal file
1
src/components/order-view/details/car/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { CarDetails } from './car-details';
|
@ -0,0 +1 @@
|
||||
export { LicensePlate } from './license-plate';
|
@ -0,0 +1,52 @@
|
||||
import React, { FC } from 'react';
|
||||
import { Flex, HStack, Text } from '@chakra-ui/react';
|
||||
|
||||
import { Order } from '../../../../../models';
|
||||
|
||||
export const LicensePlate: FC<Pick<Order.View, 'carNumber'>> = ({
|
||||
carNumber,
|
||||
}) => {
|
||||
const firstLetter = carNumber.substring(0, 1);
|
||||
const digits = carNumber.substring(1, 4);
|
||||
const lastLetters = carNumber.substring(4, 6);
|
||||
const region = carNumber.substring(6);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
align='center'
|
||||
bg='black'
|
||||
borderRadius='md'
|
||||
width='fit-content'
|
||||
boxShadow='md'
|
||||
fontFamily='mono'
|
||||
fontWeight='bold'
|
||||
fontSize='24px'
|
||||
textTransform='uppercase'
|
||||
color='black'
|
||||
alignItems='stretch'
|
||||
>
|
||||
<HStack
|
||||
bg='white'
|
||||
border='2px solid black'
|
||||
borderRadius='md'
|
||||
px={2}
|
||||
gap={0}
|
||||
alignItems='baseline'
|
||||
>
|
||||
<Text>{firstLetter}</Text>
|
||||
<Text fontSize='28px' lineHeight={0}>{digits}</Text>
|
||||
<Text>{lastLetters}</Text>
|
||||
</HStack>
|
||||
<Flex
|
||||
bg='white'
|
||||
border='2px solid black'
|
||||
borderInlineStart='none'
|
||||
borderRadius='md'
|
||||
px={2}
|
||||
alignItems='center'
|
||||
>
|
||||
{region}
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
};
|
@ -7,17 +7,21 @@ import {
|
||||
UnorderedList,
|
||||
ListItem,
|
||||
Text,
|
||||
Flex,
|
||||
} from '@chakra-ui/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import dayjs from 'dayjs';
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
||||
dayjs.extend(localizedFormat);
|
||||
import 'dayjs/locale/ru';
|
||||
import 'dayjs/locale/en';
|
||||
|
||||
import { Order } from '../../../models/landing';
|
||||
import { formatDatetime } from '../../../lib';
|
||||
import { carBodySelectOptions } from '../../order-form/form/car-body/helper';
|
||||
import { carBodySelectOptions, carColorSelectOptions } from '../../order-form';
|
||||
|
||||
import { OrderStatus } from './status';
|
||||
import { CarDetails } from './car';
|
||||
|
||||
type OrderDetailsProps = Pick<
|
||||
Order.View,
|
||||
@ -43,66 +47,73 @@ export const OrderDetails: FC<OrderDetailsProps> = ({
|
||||
location,
|
||||
startWashTime,
|
||||
endWashTime,
|
||||
created
|
||||
created,
|
||||
}) => {
|
||||
const { t } = useTranslation('~', {
|
||||
const { t, i18n } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.order-view.details',
|
||||
});
|
||||
dayjs.locale(i18n.language);
|
||||
const { t: tCarBody } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.order-create.car-body-select.options',
|
||||
});
|
||||
const { t: tCarColor } = useTranslation('~', {
|
||||
keyPrefix: 'dry-wash.order-create.car-color-select.colors',
|
||||
});
|
||||
const carColorTKey = carColorSelectOptions.find(
|
||||
({ value }) => value === carColor,
|
||||
)?.labelTKey;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Heading as='h2' size='lg' marginInline='auto'>
|
||||
{t('title', { number: orderNumber })}
|
||||
</Heading>
|
||||
<HStack
|
||||
width='full'
|
||||
flexWrap='wrap'
|
||||
justifyContent='space-between'
|
||||
gap={2}
|
||||
>
|
||||
<Heading as='h2' size='lg'>
|
||||
{t('title', { number: orderNumber })} ({dayjs(created).format('LLLL')})
|
||||
</Heading>
|
||||
<Text>{dayjs(created).format('LLL')}</Text>
|
||||
<OrderStatus value={status} />
|
||||
</HStack>
|
||||
<UnorderedList styleType='none'>
|
||||
{[
|
||||
{
|
||||
label: t('owner'),
|
||||
value: phone,
|
||||
},
|
||||
{
|
||||
label: t('car'),
|
||||
value: [
|
||||
carNumber,
|
||||
tCarBody(
|
||||
`${carBodySelectOptions.find(({ value }) => value === carBody)?.labelTKey}`,
|
||||
),
|
||||
carColor,
|
||||
]
|
||||
.filter((v) => v)
|
||||
.join(', '),
|
||||
},
|
||||
{
|
||||
label: t('location'),
|
||||
value: location,
|
||||
},
|
||||
{
|
||||
label: t('datetime-range'),
|
||||
value: [
|
||||
formatDatetime(startWashTime),
|
||||
formatDatetime(endWashTime),
|
||||
].join(' - '),
|
||||
},
|
||||
].map(({ label, value }, i) => (
|
||||
<ListItem key={i}>
|
||||
{label}:{' '}
|
||||
<Text as='span' color='primary.500' fontWeight='bold'>
|
||||
{value}
|
||||
</Text>
|
||||
</ListItem>
|
||||
))}
|
||||
</UnorderedList>
|
||||
<Flex direction={{ base: 'column', md: 'row-reverse' }} gap={4}>
|
||||
<CarDetails
|
||||
carNumber={carNumber}
|
||||
carBody={carBody}
|
||||
carColor={carColor}
|
||||
/>
|
||||
<UnorderedList styleType='none'>
|
||||
{[
|
||||
{
|
||||
label: t('car'),
|
||||
value: `${tCarBody(carBodySelectOptions.find(({ value }) => value === carBody)?.labelTKey)} (${carColorTKey ? tCarColor(carColorTKey) : carColor})`,
|
||||
},
|
||||
{
|
||||
label: t('owner'),
|
||||
value: phone,
|
||||
},
|
||||
{
|
||||
label: t('location'),
|
||||
value: location,
|
||||
},
|
||||
{
|
||||
label: t('datetime-range'),
|
||||
value: [
|
||||
formatDatetime(startWashTime),
|
||||
formatDatetime(endWashTime),
|
||||
].join(' - '),
|
||||
},
|
||||
].map(({ label, value }, i) => (
|
||||
<ListItem key={i}>
|
||||
<Text as='span' color='primary.400'>
|
||||
{label}:
|
||||
</Text>{' '}
|
||||
<Text as='span'>{value}</Text>
|
||||
</ListItem>
|
||||
))}
|
||||
</UnorderedList>
|
||||
</Flex>
|
||||
<Alert status='info' alignItems='flex-start'>
|
||||
<AlertIcon />
|
||||
{t('alert')}
|
||||
|
@ -1,6 +1,15 @@
|
||||
export type RegistrationNumber = string; // А012ВЕ16
|
||||
|
||||
export type Color = string; // #000000
|
||||
export const enum Color {
|
||||
WHITE,
|
||||
BLACK,
|
||||
SILVER,
|
||||
GRAY,
|
||||
BEIGE_BROWN,
|
||||
RED,
|
||||
BLUE,
|
||||
GREEN,
|
||||
}
|
||||
|
||||
export const enum BodyStyle {
|
||||
UNKNOWN = 0,
|
||||
|
@ -18,7 +18,7 @@ export type Create = {
|
||||
car: {
|
||||
number: Car.RegistrationNumber;
|
||||
body: Car.BodyStyle;
|
||||
color: Car.Color;
|
||||
color: Car.Color | string;
|
||||
};
|
||||
washing: {
|
||||
location: Washing.Location;
|
||||
@ -33,7 +33,7 @@ export type View = {
|
||||
phone: Customer.PhoneNumber;
|
||||
carNumber: Car.RegistrationNumber;
|
||||
carBody: Car.BodyStyle;
|
||||
carColor?: Car.Color;
|
||||
carColor?: Car.Color | string;
|
||||
location: Washing.Location;
|
||||
startWashTime: Washing.AvailableBeginDateTime;
|
||||
endWashTime: Washing.AvailableEndDateTime;
|
||||
@ -45,4 +45,5 @@ export type View = {
|
||||
id: Id;
|
||||
image?: string;
|
||||
imageRating?: string;
|
||||
imageDescription?: string;
|
||||
};
|
||||
|
@ -3,46 +3,44 @@
|
||||
exports[`Master Page should display master list and show details when master button is clicked 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="css-1yeiifd"
|
||||
class="css-s92abg"
|
||||
>
|
||||
<div
|
||||
class="css-13owfwq"
|
||||
<header
|
||||
class="css-106dwq4"
|
||||
>
|
||||
<h2
|
||||
class="chakra-heading css-173d1bl"
|
||||
>
|
||||
Сухой мастер
|
||||
</h2>
|
||||
<div
|
||||
class="chakra-stack css-1cggwyz"
|
||||
class="css-br9knx"
|
||||
>
|
||||
<hr
|
||||
aria-orientation="horizontal"
|
||||
class="chakra-divider css-svjswr"
|
||||
/>
|
||||
<a
|
||||
class="chakra-button css-18yoix2"
|
||||
href="/order"
|
||||
<h2
|
||||
class="chakra-heading css-8w8uga"
|
||||
>
|
||||
Заказы
|
||||
</a>
|
||||
<hr
|
||||
aria-orientation="horizontal"
|
||||
class="chakra-divider css-svjswr"
|
||||
/>
|
||||
<a
|
||||
class="chakra-button css-1kg18wp"
|
||||
data-testid="master-button"
|
||||
href="/master"
|
||||
Сухой мастер
|
||||
</h2>
|
||||
<div
|
||||
class="chakra-stack css-1rafi8n"
|
||||
>
|
||||
Мастера
|
||||
</a>
|
||||
<hr
|
||||
aria-orientation="horizontal"
|
||||
class="chakra-divider css-svjswr"
|
||||
/>
|
||||
<a
|
||||
class="chakra-button css-19byqlw"
|
||||
href="/order"
|
||||
>
|
||||
Заказы
|
||||
</a>
|
||||
<a
|
||||
class="chakra-button css-g11sl9"
|
||||
data-testid="master-button"
|
||||
href="/master"
|
||||
>
|
||||
Мастера
|
||||
</a>
|
||||
<a
|
||||
class="chakra-button css-19byqlw"
|
||||
href="/map"
|
||||
>
|
||||
Карта заказов
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div
|
||||
class="css-jiwy8d"
|
||||
>
|
||||
@ -50,7 +48,7 @@ exports[`Master Page should display master list and show details when master but
|
||||
class="css-1glkkdp"
|
||||
>
|
||||
<div
|
||||
class="css-sd3fvu"
|
||||
class="css-1dvg3xs"
|
||||
>
|
||||
<h2
|
||||
class="chakra-heading css-1jb3vzl"
|
||||
@ -66,6 +64,45 @@ exports[`Master Page should display master list and show details when master but
|
||||
Добавить
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="css-1u3smh"
|
||||
>
|
||||
<button
|
||||
class="chakra-button css-ez23ye"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
class="chakra-icon css-onkibi"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<p
|
||||
class="chakra-text css-52ukzg"
|
||||
>
|
||||
17.03.2025
|
||||
</p>
|
||||
<button
|
||||
class="chakra-button css-ez23ye"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
class="chakra-icon css-onkibi"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<table
|
||||
class="chakra-table css-5605sr"
|
||||
>
|
||||
@ -220,11 +257,11 @@ exports[`Master Page should display master list and show details when master but
|
||||
class="css-zgoslk"
|
||||
>
|
||||
<button
|
||||
aria-controls="menu-list-:r2:"
|
||||
aria-controls="menu-list-:r3:"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="menu"
|
||||
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||
id="menu-button-:r2:"
|
||||
id="menu-button-:r3:"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
@ -255,7 +292,7 @@ exports[`Master Page should display master list and show details when master but
|
||||
<div
|
||||
aria-orientation="vertical"
|
||||
class="chakra-menu__menu-list css-s5t7bz"
|
||||
id="menu-list-:r2:"
|
||||
id="menu-list-:r3:"
|
||||
role="menu"
|
||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||
tabindex="-1"
|
||||
@ -264,7 +301,7 @@ exports[`Master Page should display master list and show details when master but
|
||||
aria-disabled="false"
|
||||
class="chakra-menu__menuitem css-y7jzs3"
|
||||
data-index="0"
|
||||
id="menu-list-:r2:-menuitem-:r3:"
|
||||
id="menu-list-:r3:-menuitem-:r4:"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
@ -395,11 +432,11 @@ exports[`Master Page should display master list and show details when master but
|
||||
class="css-zgoslk"
|
||||
>
|
||||
<button
|
||||
aria-controls="menu-list-:r5:"
|
||||
aria-controls="menu-list-:r6:"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="menu"
|
||||
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||
id="menu-button-:r5:"
|
||||
id="menu-button-:r6:"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
@ -430,7 +467,7 @@ exports[`Master Page should display master list and show details when master but
|
||||
<div
|
||||
aria-orientation="vertical"
|
||||
class="chakra-menu__menu-list css-s5t7bz"
|
||||
id="menu-list-:r5:"
|
||||
id="menu-list-:r6:"
|
||||
role="menu"
|
||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||
tabindex="-1"
|
||||
@ -439,7 +476,7 @@ exports[`Master Page should display master list and show details when master but
|
||||
aria-disabled="false"
|
||||
class="chakra-menu__menuitem css-y7jzs3"
|
||||
data-index="0"
|
||||
id="menu-list-:r5:-menuitem-:r6:"
|
||||
id="menu-list-:r6:-menuitem-:r7:"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
@ -575,11 +612,11 @@ exports[`Master Page should display master list and show details when master but
|
||||
class="css-zgoslk"
|
||||
>
|
||||
<button
|
||||
aria-controls="menu-list-:r8:"
|
||||
aria-controls="menu-list-:r9:"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="menu"
|
||||
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||
id="menu-button-:r8:"
|
||||
id="menu-button-:r9:"
|
||||
type="button"
|
||||
>
|
||||
<svg
|
||||
@ -610,7 +647,7 @@ exports[`Master Page should display master list and show details when master but
|
||||
<div
|
||||
aria-orientation="vertical"
|
||||
class="chakra-menu__menu-list css-s5t7bz"
|
||||
id="menu-list-:r8:"
|
||||
id="menu-list-:r9:"
|
||||
role="menu"
|
||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||
tabindex="-1"
|
||||
@ -619,7 +656,7 @@ exports[`Master Page should display master list and show details when master but
|
||||
aria-disabled="false"
|
||||
class="chakra-menu__menuitem css-y7jzs3"
|
||||
data-index="0"
|
||||
id="menu-list-:r8:-menuitem-:r9:"
|
||||
id="menu-list-:r9:-menuitem-:ra:"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
|
@ -90,65 +90,163 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
>
|
||||
Цвет автомобиля
|
||||
</label>
|
||||
<input
|
||||
class="chakra-input css-moii5c"
|
||||
id="field-:r2:"
|
||||
list=":r3:"
|
||||
name="carColor"
|
||||
value=""
|
||||
/>
|
||||
<datalist
|
||||
id=":r3:"
|
||||
<div
|
||||
class="chakra-stack css-uv9e93"
|
||||
>
|
||||
<option
|
||||
label="white"
|
||||
value="#ffffff"
|
||||
<div
|
||||
class="css-ed0q6j"
|
||||
>
|
||||
white
|
||||
</option>
|
||||
<option
|
||||
label="black"
|
||||
value="#000000"
|
||||
>
|
||||
black
|
||||
</option>
|
||||
<option
|
||||
label="silver"
|
||||
value="#c0c0c0"
|
||||
>
|
||||
silver
|
||||
</option>
|
||||
<option
|
||||
label="gray"
|
||||
value="#808080"
|
||||
>
|
||||
gray
|
||||
</option>
|
||||
<option
|
||||
label="beige-brown"
|
||||
value="#796745"
|
||||
>
|
||||
beige-brown
|
||||
</option>
|
||||
<option
|
||||
label="red"
|
||||
value="#b90000"
|
||||
>
|
||||
red
|
||||
</option>
|
||||
<option
|
||||
label="blue"
|
||||
value="#003B62"
|
||||
>
|
||||
blue
|
||||
</option>
|
||||
<option
|
||||
label="green"
|
||||
value="#078d51"
|
||||
>
|
||||
green
|
||||
</option>
|
||||
</datalist>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-96lva5"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-c58w4d"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-ltoa43"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-vqo9x6"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-1lr2es4"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-1wfunc4"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-fg5oe6"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-11g98ql"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-f0pfxe"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="css-6su6fj"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="css-bf4qsc"
|
||||
>
|
||||
<div
|
||||
class="css-1k9efnl"
|
||||
>
|
||||
<div
|
||||
class="css-r58uxc"
|
||||
/>
|
||||
<p
|
||||
class="chakra-text css-1xa8ojw"
|
||||
>
|
||||
Другой
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="chakra-form-control css-1kxonj9"
|
||||
@ -157,7 +255,7 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<label
|
||||
class="chakra-form__label css-g6pte"
|
||||
for="carBody"
|
||||
id="field-:r4:-label"
|
||||
id="field-:r3:-label"
|
||||
>
|
||||
Тип кузова автомобиля
|
||||
<span
|
||||
@ -169,13 +267,13 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="css-8atqhb"
|
||||
class="css-1kxonj9"
|
||||
>
|
||||
<input
|
||||
aria-readonly="true"
|
||||
aria-required="true"
|
||||
class="chakra-input css-moii5c"
|
||||
id="field-:r4:"
|
||||
id="field-:r3:"
|
||||
name="carBody"
|
||||
placeholder="Не указан"
|
||||
readonly=""
|
||||
@ -184,19 +282,19 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
/>
|
||||
<div
|
||||
class="chakra-popover__popper css-iy22zq"
|
||||
style="visibility: hidden; position: absolute; inset: 0 auto auto 0;"
|
||||
style="visibility: hidden; position: fixed; inset: 0 auto auto 0;"
|
||||
>
|
||||
<section
|
||||
aria-describedby="popover-body-:r8:"
|
||||
aria-describedby="popover-body-:r7:"
|
||||
class="chakra-popover__content css-1mvj5hv"
|
||||
id="popover-content-:r8:"
|
||||
id="popover-content-:r7:"
|
||||
role="dialog"
|
||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.95) translateZ(0);"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="chakra-popover__body css-1uqsyei"
|
||||
id="popover-body-:r8:"
|
||||
id="popover-body-:r7:"
|
||||
>
|
||||
<div
|
||||
class="css-124gwxm"
|
||||
@ -211,8 +309,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:r9:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:r8:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -243,8 +341,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:ra:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:r9:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -275,8 +373,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:rb:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:ra:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -307,8 +405,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:rc:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:rb:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -339,8 +437,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:rd:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:rc:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -371,8 +469,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:re:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:rd:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -403,8 +501,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:rf:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:re:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -435,8 +533,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:rg:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:rf:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -467,8 +565,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:rh:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:rg:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -499,8 +597,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:ri:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:rh:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -531,8 +629,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<input
|
||||
aria-required="true"
|
||||
hidden=""
|
||||
id="radio-:rj:"
|
||||
name="radio-:r5:"
|
||||
id="radio-:ri:"
|
||||
name="radio-:r4:"
|
||||
required=""
|
||||
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; width: 1px; margin: -1px; padding: 0px; overflow: hidden; white-space: nowrap; position: absolute;"
|
||||
type="radio"
|
||||
@ -566,8 +664,8 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
>
|
||||
<label
|
||||
class="chakra-form__label css-g6pte"
|
||||
for="field-:rk:"
|
||||
id="field-:rk:-label"
|
||||
for="field-:rj:"
|
||||
id="field-:rj:-label"
|
||||
>
|
||||
В какое время автомобиль доступен?
|
||||
<span
|
||||
@ -590,7 +688,7 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
>
|
||||
<input
|
||||
class="chakra-input css-moii5c"
|
||||
id="field-:rl:"
|
||||
id="field-:rk:"
|
||||
max=""
|
||||
name="availableDatetimeBegin"
|
||||
type="datetime-local"
|
||||
@ -607,7 +705,7 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
>
|
||||
<input
|
||||
class="chakra-input css-moii5c"
|
||||
id="field-:rm:"
|
||||
id="field-:rl:"
|
||||
min=""
|
||||
name="availableDatetimeEnd"
|
||||
type="datetime-local"
|
||||
@ -624,7 +722,7 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<label
|
||||
class="chakra-form__label css-g6pte"
|
||||
for="carLocation"
|
||||
id="field-:rn:-label"
|
||||
id="field-:rm:-label"
|
||||
>
|
||||
Где находится автомобиль?
|
||||
<span
|
||||
@ -638,7 +736,7 @@ exports[`Create Order page renders page structure 1`] = `
|
||||
<div />
|
||||
<div
|
||||
class="chakra-form__helper-text css-186pyma"
|
||||
id="field-:rn:-helptext"
|
||||
id="field-:rm:-helptext"
|
||||
>
|
||||
Например, 55.754364, 48.743295 Университетская улица, 1, Иннополис, Верхнеуслонский район, Республика Татарстан (Татарстан), 420500
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
@ -3,46 +3,44 @@
|
||||
exports[`Страница заказов должна корректно отображать список заказов после загрузки данных 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="css-1yeiifd"
|
||||
class="css-s92abg"
|
||||
>
|
||||
<div
|
||||
class="css-13owfwq"
|
||||
<header
|
||||
class="css-106dwq4"
|
||||
>
|
||||
<h2
|
||||
class="chakra-heading css-173d1bl"
|
||||
>
|
||||
Сухой мастер
|
||||
</h2>
|
||||
<div
|
||||
class="chakra-stack css-1cggwyz"
|
||||
class="css-br9knx"
|
||||
>
|
||||
<hr
|
||||
aria-orientation="horizontal"
|
||||
class="chakra-divider css-svjswr"
|
||||
/>
|
||||
<a
|
||||
class="chakra-button css-1kg18wp"
|
||||
href="/auth/login"
|
||||
<h2
|
||||
class="chakra-heading css-8w8uga"
|
||||
>
|
||||
Заказы
|
||||
</a>
|
||||
<hr
|
||||
aria-orientation="horizontal"
|
||||
class="chakra-divider css-svjswr"
|
||||
/>
|
||||
<a
|
||||
class="chakra-button css-1kg18wp"
|
||||
data-testid="master-button"
|
||||
href="/auth/login"
|
||||
Сухой мастер
|
||||
</h2>
|
||||
<div
|
||||
class="chakra-stack css-1rafi8n"
|
||||
>
|
||||
Мастера
|
||||
</a>
|
||||
<hr
|
||||
aria-orientation="horizontal"
|
||||
class="chakra-divider css-svjswr"
|
||||
/>
|
||||
<a
|
||||
class="chakra-button css-g11sl9"
|
||||
href="/auth/login"
|
||||
>
|
||||
Заказы
|
||||
</a>
|
||||
<a
|
||||
class="chakra-button css-g11sl9"
|
||||
data-testid="master-button"
|
||||
href="/auth/login"
|
||||
>
|
||||
Мастера
|
||||
</a>
|
||||
<a
|
||||
class="chakra-button css-g11sl9"
|
||||
href="/auth/login"
|
||||
>
|
||||
Карта заказов
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div
|
||||
class="css-jiwy8d"
|
||||
>
|
||||
@ -75,7 +73,7 @@ exports[`Страница заказов должна корректно ото
|
||||
<p
|
||||
class="chakra-text css-52ukzg"
|
||||
>
|
||||
23.02.2025
|
||||
17.03.2025
|
||||
</p>
|
||||
<button
|
||||
class="chakra-button css-ez23ye"
|
||||
@ -177,12 +175,7 @@ exports[`Страница заказов должна корректно ото
|
||||
Выполняется
|
||||
</option>
|
||||
<option
|
||||
value="working"
|
||||
>
|
||||
В работе
|
||||
</option>
|
||||
<option
|
||||
value="canceled"
|
||||
value="cancelled"
|
||||
>
|
||||
Отменено
|
||||
</option>
|
||||
@ -273,7 +266,29 @@ exports[`Страница заказов должна корректно ото
|
||||
<td
|
||||
class="css-zgoslk"
|
||||
>
|
||||
Казань, ул. Баумана, 1
|
||||
<a
|
||||
class="chakra-button css-ez23ye"
|
||||
href="/auth/login/arm//auth/login?lat=55.78&lon=49.12¤tDate=Mon Mar 17 2025 20:55:45 GMT+0300 (Moscow Standard Time)"
|
||||
>
|
||||
<svg
|
||||
class="chakra-icon css-onkibi"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<g
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
d="M23.432,10.524C20.787,7.614,16.4,4.538,12,4.6,7.6,4.537,3.213,7.615.568,10.524a2.211,2.211,0,0,0,0,2.948C3.182,16.351,7.507,19.4,11.839,19.4h.308c4.347,0,8.671-3.049,11.288-5.929A2.21,2.21,0,0,0,23.432,10.524ZM7.4,12A4.6,4.6,0,1,1,12,16.6,4.6,4.6,0,0,1,7.4,12Z"
|
||||
/>
|
||||
<circle
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="2"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
@ -316,12 +331,7 @@ exports[`Страница заказов должна корректно ото
|
||||
Выполняется
|
||||
</option>
|
||||
<option
|
||||
value="working"
|
||||
>
|
||||
В работе
|
||||
</option>
|
||||
<option
|
||||
value="canceled"
|
||||
value="cancelled"
|
||||
>
|
||||
Отменено
|
||||
</option>
|
||||
@ -412,7 +422,29 @@ exports[`Страница заказов должна корректно ото
|
||||
<td
|
||||
class="css-zgoslk"
|
||||
>
|
||||
Казань, ул. Баумана, 43
|
||||
<a
|
||||
class="chakra-button css-ez23ye"
|
||||
href="/auth/login/arm//auth/login?lat=55.78&lon=49.12¤tDate=Mon Mar 17 2025 20:55:45 GMT+0300 (Moscow Standard Time)"
|
||||
>
|
||||
<svg
|
||||
class="chakra-icon css-onkibi"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<g
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
d="M23.432,10.524C20.787,7.614,16.4,4.538,12,4.6,7.6,4.537,3.213,7.615.568,10.524a2.211,2.211,0,0,0,0,2.948C3.182,16.351,7.507,19.4,11.839,19.4h.308c4.347,0,8.671-3.049,11.288-5.929A2.21,2.21,0,0,0,23.432,10.524ZM7.4,12A4.6,4.6,0,1,1,12,16.6,4.6,4.6,0,0,1,7.4,12Z"
|
||||
/>
|
||||
<circle
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="2"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -20,7 +20,7 @@ import { store } from '../../__data__/store';
|
||||
import Page from '../arm';
|
||||
|
||||
const server = setupServer(
|
||||
http.get('/api/arm/masters', () => {
|
||||
http.post('/api/arm/masters/list', () => {
|
||||
return HttpResponse.json({
|
||||
success: true,
|
||||
body: [
|
||||
|
63
src/pages/__tests__/notFound.test.tsx
Normal file
63
src/pages/__tests__/notFound.test.tsx
Normal file
@ -0,0 +1,63 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
|
||||
import NotFound from '../notFound/notFound';
|
||||
|
||||
// Mock the translation hook
|
||||
jest.mock('react-i18next', () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string) => {
|
||||
const translations = {
|
||||
'notFound.title': 'Page Not Found',
|
||||
'notFound.description': 'The page you are looking for does not exist',
|
||||
'notFound.button.back': 'Back to Home'
|
||||
};
|
||||
return translations[key] || key;
|
||||
}
|
||||
})
|
||||
}));
|
||||
|
||||
// Mock the Lottie Player component
|
||||
jest.mock('@lottiefiles/react-lottie-player', () => ({
|
||||
Player: () => <div data-testid="lottie-animation">Animation Mock</div>
|
||||
}));
|
||||
|
||||
describe('NotFound Component', () => {
|
||||
const renderNotFound = () => {
|
||||
return render(
|
||||
<ChakraProvider>
|
||||
<BrowserRouter>
|
||||
<NotFound />
|
||||
</BrowserRouter>
|
||||
</ChakraProvider>
|
||||
);
|
||||
};
|
||||
|
||||
it('renders without crashing', () => {
|
||||
renderNotFound();
|
||||
});
|
||||
|
||||
it('displays the correct content', () => {
|
||||
renderNotFound();
|
||||
|
||||
// Check if title is present
|
||||
expect(screen.getByText('Page Not Found')).toBeInTheDocument();
|
||||
|
||||
// Check if description is present
|
||||
expect(screen.getByText('The page you are looking for does not exist')).toBeInTheDocument();
|
||||
|
||||
// Check if back button is present
|
||||
expect(screen.getByText('Back to Home')).toBeInTheDocument();
|
||||
|
||||
// Check if Lottie animation is rendered
|
||||
expect(screen.getByTestId('lottie-animation')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('contains a link to the dry-wash page', () => {
|
||||
renderNotFound();
|
||||
const backButton = screen.getByText('Back to Home');
|
||||
expect(backButton.closest('a')).toHaveAttribute('href', '/dry-wash');
|
||||
});
|
||||
});
|
@ -25,7 +25,7 @@ const server = setupServer(
|
||||
body: [],
|
||||
});
|
||||
}),
|
||||
http.get('/api/arm/masters', () => {
|
||||
http.post('/api/arm/masters/list', () => {
|
||||
return HttpResponse.json({
|
||||
success: true,
|
||||
body: [],
|
||||
|
@ -24,7 +24,7 @@ const server = setupServer(
|
||||
http.post('/api/arm/orders', () => {
|
||||
return HttpResponse.json({}, { status: 500 });
|
||||
}),
|
||||
http.get('/api/arm/masters', () => {
|
||||
http.post('/api/arm/masters/list', () => {
|
||||
return HttpResponse.json({
|
||||
success: true,
|
||||
body: [
|
||||
|
@ -55,7 +55,7 @@ const server = setupServer(
|
||||
],
|
||||
});
|
||||
}),
|
||||
http.get('/api/arm/masters', () => {
|
||||
http.post('/api/arm/masters/list', () => {
|
||||
return HttpResponse.json({
|
||||
success: true,
|
||||
body: [
|
||||
|
@ -74,7 +74,7 @@ const Page: FC = () => {
|
||||
<VStack
|
||||
p={4}
|
||||
alignItems='flex-start'
|
||||
gap={4}
|
||||
gap={6}
|
||||
data-testid='order-details'
|
||||
>
|
||||
<OrderDetails
|
||||
@ -96,6 +96,7 @@ const Page: FC = () => {
|
||||
<PriceCar
|
||||
image={order?.image}
|
||||
rating={order?.imageRating}
|
||||
description={order?.imageDescription}
|
||||
/>
|
||||
)}
|
||||
</VStack>
|
||||
|
@ -1,11 +1,11 @@
|
||||
const getCoordinates = (location: string) => {
|
||||
if (!location) return null;
|
||||
if (!location) return {};
|
||||
|
||||
const [lat, lon] = location
|
||||
.split(',')
|
||||
.map((coord) => parseFloat(coord.trim()));
|
||||
|
||||
if (isNaN(lat) || isNaN(lon)) return null;
|
||||
if (isNaN(lat) || isNaN(lon)) return {};
|
||||
|
||||
return { lat, lon };
|
||||
};
|
||||
|
@ -8,12 +8,12 @@ const commonError = { success: false, message: 'Что-то пошло не та
|
||||
|
||||
const sleep =
|
||||
(duration = 1000) =>
|
||||
(req, res, next) =>
|
||||
setTimeout(next, duration);
|
||||
(req, res, next) =>
|
||||
setTimeout(next, duration);
|
||||
|
||||
router.use(sleep());
|
||||
|
||||
router.get('/arm/masters', (req, res) => {
|
||||
router.post('/arm/masters/list', (req, res) => {
|
||||
res
|
||||
.status(/error/.test(STUBS.masters) ? 500 : 200)
|
||||
.send(
|
||||
@ -108,9 +108,7 @@ router.post('/order/:orderId/upload-car-img', (req, res) => {
|
||||
.send(require(`../json/landing-order-car-image-upload/${stubName}.json`));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
res
|
||||
.status(500)
|
||||
.send(commonError);
|
||||
res.status(500).send(commonError);
|
||||
}
|
||||
});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
"phone": "+79876543210",
|
||||
"carNumber": "А123АА16",
|
||||
"carBody": 2,
|
||||
"carColor": "#ffffff",
|
||||
"carColor": "мокрый асфальт",
|
||||
"startWashTime": "2025-01-19T14:03:00.000Z",
|
||||
"endWashTime": "2025-01-19T14:03:00.000Z",
|
||||
"location": "55.793833888711006,49.19037910644527 Республика Татарстан (Татарстан), Казань, жилой район Седьмое Небо",
|
||||
|
Loading…
x
Reference in New Issue
Block a user