Compare commits
30 Commits
c83ebf02bc
...
feature/or
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47e2646fac | ||
|
|
0b9b2f4dbc | ||
|
|
87a4dcefdd | ||
|
|
0679ad92ef | ||
| 9349a41f84 | |||
| 8103fdcb56 | |||
| a59864a3e2 | |||
| a252301ea0 | |||
| 48cdfb92bd | |||
|
|
279da05b32 | ||
|
|
c6d906ad62 | ||
|
|
418a121418 | ||
|
|
7647958e52 | ||
|
|
9e024af568 | ||
|
|
7fe62e7d6e | ||
|
|
f2db3774c9 | ||
|
|
02e3fdffa0 | ||
|
|
965d2d0be1 | ||
|
|
9121fcaa43 | ||
|
|
290bb3f0a3 | ||
|
|
e6e73e5289 | ||
|
|
b959fcf8db | ||
|
|
5e25848e22 | ||
|
|
ecf6c60cdc | ||
|
|
91fc91230b | ||
| d312445bf2 | |||
|
|
351420bc62 | ||
|
|
61b042eee6 | ||
|
|
ac006267a2 | ||
|
|
63d9d069c0 |
@@ -3,7 +3,9 @@ import { jest } from '@jest/globals';
|
|||||||
jest.mock('@brojs/cli', () => ({
|
jest.mock('@brojs/cli', () => ({
|
||||||
getConfigValue: jest.fn(() => '/api'),
|
getConfigValue: jest.fn(() => '/api'),
|
||||||
getFeatures: jest.fn(() => ({
|
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) => {
|
getNavigationValue: jest.fn((navKey: string) => {
|
||||||
switch (navKey) {
|
switch (navKey) {
|
||||||
|
|||||||
@@ -21,7 +21,21 @@ module.exports = {
|
|||||||
features: {
|
features: {
|
||||||
'dry-wash': {
|
'dry-wash': {
|
||||||
// add your features here in the format [featureName]: { value: string }
|
// add your features here in the format [featureName]: { value: string }
|
||||||
'order-view-status-polling': { value: '3000' }
|
'order-view-status-polling': {
|
||||||
|
on: true,
|
||||||
|
value: '3000',
|
||||||
|
key: 'order-view-status-polling',
|
||||||
|
},
|
||||||
|
'car-img-upload': {
|
||||||
|
on: true,
|
||||||
|
value: 'true',
|
||||||
|
key: 'car-img-upload',
|
||||||
|
},
|
||||||
|
'order-cost': {
|
||||||
|
on: true,
|
||||||
|
value: '1000',
|
||||||
|
key: 'order-cost',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
coverageProvider: 'v8',
|
coverageProvider: 'v8',
|
||||||
coverageDirectory: 'coverage',
|
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,
|
collectCoverage: true,
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
moduleNameMapper: {
|
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.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.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.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.placeholder": "Not specified",
|
||||||
"dry-wash.order-create.car-body-select.options.sedan": "Sedan",
|
"dry-wash.order-create.car-body-select.options.sedan": "Sedan",
|
||||||
"dry-wash.order-create.car-body-select.options.hatchback" : "Hatchback",
|
"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.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.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.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.placeholder": "Upload a file",
|
||||||
"dry-wash.order-view.upload-car-image.file-input.button": "Upload",
|
"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.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.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.master.add": "Add",
|
||||||
"dry-wash.arm.order.title": "Orders",
|
"dry-wash.arm.order.title": "Orders",
|
||||||
"dry-wash.arm.order.table.empty": "Table empty",
|
"dry-wash.arm.order.table.empty": "Table empty",
|
||||||
@@ -64,7 +78,7 @@
|
|||||||
"dry-wash.arm.order.status.complete": "Completed",
|
"dry-wash.arm.order.status.complete": "Completed",
|
||||||
"dry-wash.arm.order.status.pending": "Pending",
|
"dry-wash.arm.order.status.pending": "Pending",
|
||||||
"dry-wash.arm.order.status.working": "Working",
|
"dry-wash.arm.order.status.working": "Working",
|
||||||
"dry-wash.arm.order.status.canceled": "Canceled",
|
"dry-wash.arm.order.status.cancelled": "Canceled",
|
||||||
"dry-wash.arm.order.status.placeholder": "Select status",
|
"dry-wash.arm.order.status.placeholder": "Select status",
|
||||||
"dry-wash.arm.order.master.placeholder": "Select master",
|
"dry-wash.arm.order.master.placeholder": "Select master",
|
||||||
"dry-wash.arm.order.table.header.carNumber": "Car Number",
|
"dry-wash.arm.order.table.header.carNumber": "Car Number",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"dry-wash.arm.order.status.complete": "Завершено",
|
"dry-wash.arm.order.status.complete": "Завершено",
|
||||||
"dry-wash.arm.order.status.pending": "В ожидании",
|
"dry-wash.arm.order.status.pending": "В ожидании",
|
||||||
"dry-wash.arm.order.status.working": "В работе",
|
"dry-wash.arm.order.status.working": "В работе",
|
||||||
"dry-wash.arm.order.status.canceled": "Отменено",
|
"dry-wash.arm.order.status.cancelled": "Отменено",
|
||||||
"dry-wash.arm.order.status.placeholder": "Выберите статус",
|
"dry-wash.arm.order.status.placeholder": "Выберите статус",
|
||||||
"dry-wash.arm.order.master.placeholder": "Выберите мастера",
|
"dry-wash.arm.order.master.placeholder": "Выберите мастера",
|
||||||
"dry-wash.arm.order.table.header.carNumber": "Номер машины",
|
"dry-wash.arm.order.table.header.carNumber": "Номер машины",
|
||||||
@@ -81,6 +81,17 @@
|
|||||||
"dry-wash.order-create.form.washing-location-field.label": "Где находится автомобиль?",
|
"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.placeholder": "Введите адрес или выберите на карте",
|
||||||
"dry-wash.order-create.form.washing-location-field.help": "Например, 55.754364, 48.743295 Университетская улица, 1, Иннополис, Верхнеуслонский район, Республика Татарстан (Татарстан), 420500",
|
"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.placeholder": "Не указан",
|
||||||
"dry-wash.order-create.car-body-select.options.sedan": "Седан",
|
"dry-wash.order-create.car-body-select.options.sedan": "Седан",
|
||||||
"dry-wash.order-create.car-body-select.options.hatchback": "Хэтчбек",
|
"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.datetime-range": "Когда",
|
||||||
"dry-wash.order-view.details.alert": "С вами свяжется оператор насчет оплаты по указанному номеру телефона",
|
"dry-wash.order-view.details.alert": "С вами свяжется оператор насчет оплаты по указанному номеру телефона",
|
||||||
"dry-wash.order-view.upload-car-image.field.label": "Загрузите фото вашего автомобиля, и наш сервис быстро рассчитает предварительную стоимость заказа!",
|
"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.placeholder": "Загрузите файл",
|
||||||
"dry-wash.order-view.upload-car-image.file-input.button": "Загрузить",
|
"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.success.title": "Изображение автомобиля успешно загружено",
|
||||||
"dry-wash.order-view.upload-car-image-query.error.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.title": "Страница не найдена",
|
||||||
"dry-wash.notFound.description": "К сожалению, запрашиваемая вами страница не существует.",
|
"dry-wash.notFound.description": "К сожалению, запрашиваемая вами страница не существует.",
|
||||||
"dry-wash.notFound.button.back": "Вернуться на главную",
|
"dry-wash.notFound.button.back": "Вернуться на главную",
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.8.0",
|
"version": "0.9.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.8.0",
|
"version": "0.9.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.26.7",
|
"@babel/core": "^7.26.7",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.8.0",
|
"version": "0.9.2",
|
||||||
"description": "<a id=\"readme-top\"></a>",
|
"description": "<a id=\"readme-top\"></a>",
|
||||||
"main": "./src/index.tsx",
|
"main": "./src/index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -11,5 +11,8 @@ export const FEATURE = {
|
|||||||
return interval;
|
return interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
carImageUpload: {
|
||||||
|
isOn: Boolean(features?.['car-img-upload'])
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
51
src/components/Header/Header.tsx
Normal file
51
src/components/Header/Header.tsx
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import { Box, Button, Heading, HStack, Divider, Flex } from '@chakra-ui/react';
|
||||||
|
import React from 'react';
|
||||||
|
import { useLocation, Link } from 'react-router-dom';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { URLs } from '../../__data__/urls';
|
||||||
|
|
||||||
|
const Header = () => {
|
||||||
|
const location = useLocation();
|
||||||
|
const isActive = (keyword: string) => location.pathname.includes(keyword);
|
||||||
|
|
||||||
|
const { t } = useTranslation('~', {
|
||||||
|
keyPrefix: 'dry-wash.arm.master.sideBar',
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box as='header' bg='gray.50' boxShadow='md' px={6} py={4} w='100%'>
|
||||||
|
<Flex gap={50} align='center'>
|
||||||
|
<Heading color='green' size='lg'>
|
||||||
|
{t('title')}
|
||||||
|
</Heading>
|
||||||
|
<HStack spacing={4}>
|
||||||
|
{URLs.armOrder.isOn && (
|
||||||
|
<Button
|
||||||
|
as={Link}
|
||||||
|
to={URLs.armOrder.url}
|
||||||
|
colorScheme={isActive(URLs.armOrder.url) ? 'green' : 'blue'}
|
||||||
|
variant={isActive(URLs.armOrder.url) ? 'outline' : 'ghost'}
|
||||||
|
>
|
||||||
|
{t('orders')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<Divider orientation='vertical' height='30px' />
|
||||||
|
{URLs.armMaster.isOn && (
|
||||||
|
<Button
|
||||||
|
as={Link}
|
||||||
|
to={URLs.armMaster.url}
|
||||||
|
colorScheme={isActive(URLs.armMaster.url) ? 'green' : 'blue'}
|
||||||
|
variant={isActive(URLs.armMaster.url) ? 'outline' : 'ghost'}
|
||||||
|
data-testid='master-button'
|
||||||
|
>
|
||||||
|
{t('master')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</HStack>
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Header;
|
||||||
1
src/components/Header/index.ts
Normal file
1
src/components/Header/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './Header';
|
||||||
@@ -2,10 +2,10 @@ import { Box, Flex } from '@chakra-ui/react';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import Sidebar from '../Sidebar';
|
|
||||||
import Orders from '../Orders';
|
import Orders from '../Orders';
|
||||||
import Masters from '../Masters';
|
import Masters from '../Masters';
|
||||||
import { URLs } from '../../__data__/urls';
|
import { URLs } from '../../__data__/urls';
|
||||||
|
import Header from '../Header';
|
||||||
|
|
||||||
const LayoutArm = () => {
|
const LayoutArm = () => {
|
||||||
let defaultRedirect = null;
|
let defaultRedirect = null;
|
||||||
@@ -17,8 +17,8 @@ const LayoutArm = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex h='100vh'>
|
<Flex flexDirection='column' h='100vh'>
|
||||||
<Sidebar />
|
<Header />
|
||||||
<Box flex='1' bg='gray.50'>
|
<Box flex='1' bg='gray.50'>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route index element={<Navigate to={defaultRedirect} replace />} />
|
<Route index element={<Navigate to={defaultRedirect} replace />} />
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ import React, { ChangeEvent, useState } from 'react';
|
|||||||
import { Td, Tr, Link, Select } from '@chakra-ui/react';
|
import { Td, Tr, Link, Select } from '@chakra-ui/react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
import { ViewIcon } from '@chakra-ui/icons';
|
||||||
|
|
||||||
import { getTimeSlot } from '../../lib';
|
import { getTimeSlot } from '../../lib';
|
||||||
import { useUpdateOrdersMutation } from '../../__data__/service/api';
|
import { useUpdateOrdersMutation } from '../../__data__/service/api';
|
||||||
import { OrderArm, Status, statuses } from '../../models/api';
|
import { OrderArm, Status, statuses } from '../../models/api';
|
||||||
|
import PopoverTemplate from '../PopoverTemplate';
|
||||||
|
|
||||||
const statusColors: Record<Status, string> = {
|
const statusColors: Record<Status, string> = {
|
||||||
pending: 'yellow.100',
|
pending: 'yellow.100',
|
||||||
progress: 'blue.100',
|
progress: 'blue.100',
|
||||||
working: 'orange.100',
|
cancelled: 'red.100',
|
||||||
canceled: 'red.100',
|
|
||||||
complete: 'green.100',
|
complete: 'green.100',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ const OrderItem = ({
|
|||||||
|
|
||||||
const [statusSelect, setStatus] = useState(status);
|
const [statusSelect, setStatus] = useState(status);
|
||||||
const bgColor = statusColors[statusSelect];
|
const bgColor = statusColors[statusSelect];
|
||||||
const [masterSelect, setMaster] = useState(master?.name);
|
const [masterSelectId, setMasterSelectId] = useState(master);
|
||||||
|
|
||||||
const handelChangeMasters = (e: ChangeEvent<HTMLSelectElement>) => {
|
const handelChangeMasters = (e: ChangeEvent<HTMLSelectElement>) => {
|
||||||
const masterName = e.target.value;
|
const masterName = e.target.value;
|
||||||
@@ -43,7 +44,7 @@ const OrderItem = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (selectedMaster) {
|
if (selectedMaster) {
|
||||||
setMaster(masterName);
|
setMasterSelectId(selectedMaster.id);
|
||||||
updateOrders({ id, master: selectedMaster.id });
|
updateOrders({ id, master: selectedMaster.id });
|
||||||
} else {
|
} else {
|
||||||
console.error('Master not found');
|
console.error('Master not found');
|
||||||
@@ -56,6 +57,10 @@ const OrderItem = ({
|
|||||||
setStatus(status);
|
setStatus(status);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const masterSelectChange = allMasters.find(
|
||||||
|
(master) => master.id === masterSelectId,
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tr>
|
<Tr>
|
||||||
<Td>{carNumber}</Td>
|
<Td>{carNumber}</Td>
|
||||||
@@ -79,7 +84,7 @@ const OrderItem = ({
|
|||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<Select
|
<Select
|
||||||
value={masterSelect}
|
value={masterSelectChange?.name}
|
||||||
onChange={handelChangeMasters}
|
onChange={handelChangeMasters}
|
||||||
placeholder={t(`master.placeholder`)}
|
placeholder={t(`master.placeholder`)}
|
||||||
>
|
>
|
||||||
@@ -93,7 +98,9 @@ const OrderItem = ({
|
|||||||
<Td>
|
<Td>
|
||||||
<Link href='tel:'>{phone}</Link>
|
<Link href='tel:'>{phone}</Link>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>{location}</Td>
|
<Td>
|
||||||
|
<PopoverTemplate trigger={<ViewIcon />} description={location} />
|
||||||
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
35
src/components/PopoverTemplate/PopoverTemplate.tsx
Normal file
35
src/components/PopoverTemplate/PopoverTemplate.tsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Popover,
|
||||||
|
PopoverArrow,
|
||||||
|
PopoverBody,
|
||||||
|
PopoverCloseButton,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverHeader,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from '@chakra-ui/react';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
title?: string;
|
||||||
|
description: string;
|
||||||
|
trigger?: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PopoverTemplate = ({ title, description, trigger }: Props) => {
|
||||||
|
return (
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger>
|
||||||
|
<Button>{trigger}</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent>
|
||||||
|
<PopoverArrow />
|
||||||
|
<PopoverCloseButton />
|
||||||
|
{title && <PopoverHeader>{title}!</PopoverHeader>}
|
||||||
|
<PopoverBody mr={5}>{description}</PopoverBody>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PopoverTemplate;
|
||||||
1
src/components/PopoverTemplate/index.ts
Normal file
1
src/components/PopoverTemplate/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './PopoverTemplate';
|
||||||
75
src/components/PriceCar/PriceCar.tsx
Normal file
75
src/components/PriceCar/PriceCar.tsx
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import { Box, Image, Progress, Text, VStack } from '@chakra-ui/react';
|
||||||
|
import React from 'react';
|
||||||
|
import { getFeatures } from '@brojs/cli';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { formatPrice, getProgressColor } from './helper';
|
||||||
|
|
||||||
|
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,
|
||||||
|
);
|
||||||
|
|
||||||
|
const calculateWashPrice = (rating: number) => {
|
||||||
|
const priceIncrease =
|
||||||
|
(BASE_WASH_PRICE * PRICE_INCREASE_PERCENT_PER_RATING * rating) / 100;
|
||||||
|
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
|
||||||
|
gap={5}
|
||||||
|
width='100%'
|
||||||
|
display='flex'
|
||||||
|
justifyContent='center'
|
||||||
|
alignItems='flex-start'
|
||||||
|
flexWrap='wrap'
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
maxWidth='600px'
|
||||||
|
width='100%'
|
||||||
|
objectFit='contain'
|
||||||
|
borderRadius='md'
|
||||||
|
src={image}
|
||||||
|
alt=''
|
||||||
|
/>
|
||||||
|
<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>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PriceCar;
|
||||||
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%)`;
|
||||||
|
};
|
||||||
1
src/components/PriceCar/index.ts
Normal file
1
src/components/PriceCar/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './PriceCar';
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
import { Box, Button, Heading, VStack, Divider } from '@chakra-ui/react';
|
|
||||||
import React from 'react';
|
|
||||||
import { useLocation, Link } from 'react-router-dom';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import { URLs } from '../../__data__/urls';
|
|
||||||
|
|
||||||
const Sidebar = () => {
|
|
||||||
const location = useLocation();
|
|
||||||
const isActive = (keyword: string) => location.pathname.includes(keyword);
|
|
||||||
|
|
||||||
const { t } = useTranslation('~', {
|
|
||||||
keyPrefix: 'dry-wash.arm.master.sideBar',
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box
|
|
||||||
borderRight='1px solid black'
|
|
||||||
bg='gray.50'
|
|
||||||
color='white'
|
|
||||||
w='250px'
|
|
||||||
p='5'
|
|
||||||
pt='8'
|
|
||||||
>
|
|
||||||
<Heading color='green' size='lg' mb='5'>
|
|
||||||
{t('title')}
|
|
||||||
</Heading>
|
|
||||||
|
|
||||||
<VStack align='start' spacing='4'>
|
|
||||||
<Divider />
|
|
||||||
{URLs.armOrder.isOn && (
|
|
||||||
<Button
|
|
||||||
as={Link}
|
|
||||||
to={URLs.armOrder.url}
|
|
||||||
w='100%'
|
|
||||||
colorScheme={isActive(URLs.armOrder.url) ? 'green' : 'blue'}
|
|
||||||
variant={isActive(URLs.armOrder.url) ? 'solid' : 'ghost'}
|
|
||||||
>
|
|
||||||
{t('orders')}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
<Divider />
|
|
||||||
{URLs.armMaster.isOn && (
|
|
||||||
<Button
|
|
||||||
as={Link}
|
|
||||||
to={URLs.armMaster.url}
|
|
||||||
w='100%'
|
|
||||||
colorScheme={isActive(URLs.armMaster.url) ? 'green' : 'blue'}
|
|
||||||
variant={isActive(URLs.armMaster.url) ? 'solid' : 'ghost'}
|
|
||||||
data-testid='master-button'
|
|
||||||
>
|
|
||||||
{t('master')}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
<Divider />
|
|
||||||
</VStack>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Sidebar;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export { default } from './Sidebar';
|
|
||||||
@@ -21,9 +21,10 @@ import { CarBodySelectProps } from './types';
|
|||||||
export const CarBodySelect = forwardRef<HTMLInputElement, CarBodySelectProps>(
|
export const CarBodySelect = forwardRef<HTMLInputElement, CarBodySelectProps>(
|
||||||
function CarBodySelect(props, ref) {
|
function CarBodySelect(props, ref) {
|
||||||
const handleOptionClick: UseRadioGroupProps['onChange'] = (value) => {
|
const handleOptionClick: UseRadioGroupProps['onChange'] = (value) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
props.onChange({
|
||||||
// @ts-ignore
|
target: { value },
|
||||||
props.onChange(value);
|
} as React.ChangeEvent<HTMLInputElement>);
|
||||||
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const { value, getRadioProps, getRootProps } = useRadioGroup({
|
const { value, getRadioProps, getRootProps } = useRadioGroup({
|
||||||
@@ -39,12 +40,14 @@ export const CarBodySelect = forwardRef<HTMLInputElement, CarBodySelectProps>(
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box width='100%'>
|
<Box width='100%' pos='relative'>
|
||||||
<Popover
|
<Popover
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
autoFocus={false}
|
autoFocus={false}
|
||||||
placement='bottom-start'
|
placement='bottom-start'
|
||||||
matchWidth
|
matchWidth
|
||||||
|
gutter={2}
|
||||||
|
strategy="fixed"
|
||||||
>
|
>
|
||||||
<PopoverAnchor>
|
<PopoverAnchor>
|
||||||
<Input
|
<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'
|
code: '#ffffff'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'black',
|
value: Car.Color.BLACK,
|
||||||
|
labelTKey: 'black',
|
||||||
code: '#000000'
|
code: '#000000'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'silver',
|
value: Car.Color.SILVER,
|
||||||
|
labelTKey: 'silver',
|
||||||
code: '#c0c0c0'
|
code: '#c0c0c0'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'gray',
|
value: Car.Color.GRAY,
|
||||||
|
labelTKey: 'gray',
|
||||||
code: '#808080'
|
code: '#808080'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'beige-brown',
|
value: Car.Color.BEIGE_BROWN,
|
||||||
|
labelTKey: 'beige-brown',
|
||||||
code: '#796745'
|
code: '#796745'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'red',
|
value: Car.Color.RED,
|
||||||
|
labelTKey: 'red',
|
||||||
code: '#b90000'
|
code: '#b90000'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'blue',
|
value: Car.Color.BLUE,
|
||||||
|
labelTKey: 'blue',
|
||||||
code: '#003B62'
|
code: '#003B62'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'green',
|
value: Car.Color.GREEN,
|
||||||
|
labelTKey: 'green',
|
||||||
code: '#078d51'
|
code: '#078d51'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -1 +1,2 @@
|
|||||||
export { CarColorInput } from './car-color-input';
|
export { CarColorSelect } from './car-color-select';
|
||||||
|
export { carColorSelectOptions } from './helper';
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
export type { OrderFormValues, OrderFormProps } from './types';
|
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 {
|
import {
|
||||||
Input,
|
Input,
|
||||||
Box,
|
Box,
|
||||||
@@ -24,129 +24,130 @@ import {
|
|||||||
} from './helper';
|
} from './helper';
|
||||||
import { LocationInputProps } from './types';
|
import { LocationInputProps } from './types';
|
||||||
|
|
||||||
export const LocationInput = memo(
|
export const BaseLocationInput = withYMaps(
|
||||||
withYMaps(
|
({ ymaps, value = '', onChange, inputRef, ...props }: LocationInputProps & { inputRef: ForwardedRef<HTMLInputElement> }) => {
|
||||||
forwardRef<HTMLInputElement, LocationInputProps>(function LocationInput(
|
const [inputValue, setInputValue] = useState<string>('');
|
||||||
{ ymaps, value, onChange, ...props },
|
|
||||||
ref,
|
|
||||||
) {
|
|
||||||
const [inputValue, setInputValue] = useState<string>('');
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setInputValue(value);
|
setInputValue(value);
|
||||||
}, [value]);
|
}, [value]);
|
||||||
|
|
||||||
const [suggestions, setSuggestions] = useState<Suggestion[]>([]);
|
const [suggestions, setSuggestions] = useState<Suggestion[]>([]);
|
||||||
const [isSuggestionsPanelOpen, setIsSuggestionsPanelOpen] =
|
const [isSuggestionsPanelOpen, setIsSuggestionsPanelOpen] =
|
||||||
useState<boolean>(false);
|
useState<boolean>(false);
|
||||||
|
|
||||||
const onInputChange: InputProps['onChange'] = async (e) => {
|
const onInputChange: InputProps['onChange'] = async (e) => {
|
||||||
const newInputValue = e.target.value;
|
const newInputValue = e.target.value;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isValidLocation(newInputValue) &&
|
isValidLocation(newInputValue) &&
|
||||||
(await isRealLocation(ymaps, newInputValue))
|
(await isRealLocation(ymaps, newInputValue))
|
||||||
) {
|
) {
|
||||||
onChange(newInputValue);
|
onChange(newInputValue);
|
||||||
} else {
|
} else {
|
||||||
setInputValue(newInputValue);
|
setInputValue(newInputValue);
|
||||||
|
|
||||||
if (newInputValue.trim().length > 3) {
|
if (newInputValue.trim().length > 3) {
|
||||||
try {
|
try {
|
||||||
const address = extractAddress(newInputValue);
|
const address = extractAddress(newInputValue);
|
||||||
const results = await ymaps.suggest(address);
|
const results = await ymaps.suggest(address);
|
||||||
setSuggestions(results);
|
setSuggestions(results);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setSuggestions([]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
} else {
|
||||||
setInputValue(value);
|
setSuggestions([]);
|
||||||
}
|
}
|
||||||
setIsSuggestionsPanelOpen(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSuggestionClick = async ({ value: address }: Suggestion) => {
|
setIsSuggestionsPanelOpen(suggestions.length > 1);
|
||||||
try {
|
}
|
||||||
const location = await getLocationByAddress(ymaps, address);
|
};
|
||||||
const newValue = formatLocation(location);
|
|
||||||
setInputValue(newValue);
|
|
||||||
onChange(newValue);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const { t } = useTranslation('~', {
|
const onFocus: InputProps['onFocus'] = () => {
|
||||||
keyPrefix: 'dry-wash.order-create.form.washing-location-field',
|
setIsSuggestionsPanelOpen(suggestions.length > 1);
|
||||||
});
|
};
|
||||||
|
|
||||||
return (
|
const onBlur: InputProps['onBlur'] = async (e) => {
|
||||||
<Box width='100%'>
|
const inputValue = e.target.value;
|
||||||
<Popover
|
if (
|
||||||
isOpen={isSuggestionsPanelOpen}
|
isValidLocation(inputValue) &&
|
||||||
autoFocus={false}
|
(await isRealLocation(ymaps, inputValue))
|
||||||
placement='bottom-start'
|
) {
|
||||||
>
|
onChange(inputValue);
|
||||||
<PopoverAnchor>
|
} else {
|
||||||
<Input
|
setInputValue(value);
|
||||||
{...props}
|
}
|
||||||
ref={ref}
|
setIsSuggestionsPanelOpen(false);
|
||||||
onBlur={onBlur}
|
};
|
||||||
value={inputValue ?? value}
|
|
||||||
onChange={onInputChange}
|
const handleSuggestionClick = async ({ value: address }: Suggestion) => {
|
||||||
onFocus={onFocus}
|
try {
|
||||||
placeholder={t('placeholder')}
|
const location = await getLocationByAddress(ymaps, address);
|
||||||
/>
|
const newValue = formatLocation(location);
|
||||||
</PopoverAnchor>
|
setInputValue(newValue);
|
||||||
<PopoverContent width='100%' maxWidth='100%'>
|
onChange(newValue);
|
||||||
<PopoverBody border='1px' borderColor='gray.300' p={0}>
|
} catch (error) {
|
||||||
<List>
|
console.error(error);
|
||||||
{suggestions.map((suggestion, index) => (
|
}
|
||||||
<ListItem
|
};
|
||||||
key={index}
|
|
||||||
p={2}
|
const { t } = useTranslation('~', {
|
||||||
cursor='pointer'
|
keyPrefix: 'dry-wash.order-create.form.washing-location-field',
|
||||||
_hover={{
|
});
|
||||||
bgColor: 'primary.50',
|
|
||||||
}}
|
return (
|
||||||
_active={{
|
<Box width='100%'>
|
||||||
bgColor: 'primary.100',
|
<Popover
|
||||||
}}
|
isOpen={isSuggestionsPanelOpen}
|
||||||
onClick={() => handleSuggestionClick(suggestion)}
|
autoFocus={false}
|
||||||
>
|
placement='bottom-start'
|
||||||
{suggestion.displayName}
|
>
|
||||||
</ListItem>
|
<PopoverAnchor>
|
||||||
))}
|
<Input
|
||||||
</List>
|
{...props}
|
||||||
</PopoverBody>
|
ref={inputRef}
|
||||||
</PopoverContent>
|
onBlur={onBlur}
|
||||||
</Popover>
|
value={inputValue || value}
|
||||||
</Box>
|
onChange={onInputChange}
|
||||||
);
|
onFocus={onFocus}
|
||||||
}),
|
placeholder={t('placeholder')}
|
||||||
true,
|
/>
|
||||||
['suggest', 'geocode'],
|
</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: i18n
|
||||||
// todo: replace console.error with toast
|
// todo: replace console.error with toast
|
||||||
|
|||||||
@@ -31,8 +31,22 @@ export const MapComponent: FC<{
|
|||||||
}
|
}
|
||||||
}, [selectedLocation]);
|
}, [selectedLocation]);
|
||||||
|
|
||||||
|
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
||||||
|
useEffect(() => {
|
||||||
|
const handleResize = () => {
|
||||||
|
setWindowWidth(window.innerWidth);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('resize', handleResize);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('resize', handleResize);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Map
|
<Map
|
||||||
|
key={windowWidth}
|
||||||
state={{
|
state={{
|
||||||
center: mapCenter,
|
center: mapCenter,
|
||||||
zoom:
|
zoom:
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { Box, Flex, FormControl, FormLabel, VStack } from '@chakra-ui/react';
|
import { Box, Flex, FormControl, FormLabel, VStack } from '@chakra-ui/react';
|
||||||
|
|
||||||
import { CarBodySelect } from './car-body';
|
import { CarBodySelect } from './car-body';
|
||||||
import { CarColorInput } from './car-color';
|
|
||||||
import { CarNumberInput } from './car-number';
|
import { CarNumberInput } from './car-number';
|
||||||
import { FormInputField, FormControllerField } from './field';
|
import { FormInputField, FormControllerField } from './field';
|
||||||
import { OrderFormProps, OrderFormValues } from './types';
|
import { OrderFormProps, OrderFormValues } from './types';
|
||||||
@@ -18,6 +17,7 @@ import {
|
|||||||
StringLocation,
|
StringLocation,
|
||||||
YMapsProvider,
|
YMapsProvider,
|
||||||
} from './location';
|
} from './location';
|
||||||
|
import { CarColorSelect } from './car-color';
|
||||||
|
|
||||||
export const OrderForm = ({ onSubmit, loading, ...props }: OrderFormProps) => {
|
export const OrderForm = ({ onSubmit, loading, ...props }: OrderFormProps) => {
|
||||||
const {
|
const {
|
||||||
@@ -72,7 +72,7 @@ export const OrderForm = ({ onSubmit, loading, ...props }: OrderFormProps) => {
|
|||||||
name='carColor'
|
name='carColor'
|
||||||
label={t('car-color-field.label')}
|
label={t('car-color-field.label')}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
Input={CarColorInput}
|
Input={CarColorSelect}
|
||||||
/>
|
/>
|
||||||
<FormInputField
|
<FormInputField
|
||||||
control={control}
|
control={control}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export const CarImageForm: FC<CarImageFormProps> = memo(function CarImageForm({
|
|||||||
<Input
|
<Input
|
||||||
{...field}
|
{...field}
|
||||||
ref={fileInputRef}
|
ref={fileInputRef}
|
||||||
accept='.jpg,.png'
|
accept='image/png,image/jpeg'
|
||||||
value={value?.fileName}
|
value={value?.fileName}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
onChange(event.target.files[0]);
|
onChange(event.target.files[0]);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const useHandleUploadCarImageResponse = (query: {
|
|||||||
}) => {
|
}) => {
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const { t } = useTranslation('~', {
|
const { t } = useTranslation('~', {
|
||||||
keyPrefix: 'dry-wash.order-create.upload-car-image-query',
|
keyPrefix: 'dry-wash.order-view.upload-car-image-query',
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -10,12 +10,17 @@ import {
|
|||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
||||||
dayjs.extend(localizedFormat);
|
dayjs.extend(localizedFormat);
|
||||||
|
import 'dayjs/locale/ru';
|
||||||
|
import 'dayjs/locale/en';
|
||||||
|
|
||||||
import { Order } from '../../../models/landing';
|
import { Order } from '../../../models/landing';
|
||||||
import { formatDatetime } from '../../../lib';
|
import { formatDatetime } from '../../../lib';
|
||||||
import { carBodySelectOptions } from '../../order-form/form/car-body/helper';
|
import {
|
||||||
|
carBodySelectOptions,
|
||||||
|
carColorSelectOptions,
|
||||||
|
} from '../../order-form';
|
||||||
|
|
||||||
import { OrderStatus } from './status';
|
import { OrderStatus } from './status';
|
||||||
|
|
||||||
@@ -43,26 +48,32 @@ export const OrderDetails: FC<OrderDetailsProps> = ({
|
|||||||
location,
|
location,
|
||||||
startWashTime,
|
startWashTime,
|
||||||
endWashTime,
|
endWashTime,
|
||||||
created
|
created,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation('~', {
|
const { t, i18n } = useTranslation('~', {
|
||||||
keyPrefix: 'dry-wash.order-view.details',
|
keyPrefix: 'dry-wash.order-view.details',
|
||||||
});
|
});
|
||||||
|
dayjs.locale(i18n.language);
|
||||||
const { t: tCarBody } = useTranslation('~', {
|
const { t: tCarBody } = useTranslation('~', {
|
||||||
keyPrefix: 'dry-wash.order-create.car-body-select.options',
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Heading as='h2' size='lg' marginInline='auto'>
|
||||||
|
{t('title', { number: orderNumber })}
|
||||||
|
</Heading>
|
||||||
<HStack
|
<HStack
|
||||||
width='full'
|
width='full'
|
||||||
flexWrap='wrap'
|
flexWrap='wrap'
|
||||||
justifyContent='space-between'
|
justifyContent='space-between'
|
||||||
gap={2}
|
gap={2}
|
||||||
>
|
>
|
||||||
<Heading as='h2' size='lg'>
|
<Text>{dayjs(created).format('LLL')}</Text>
|
||||||
{t('title', { number: orderNumber })} ({dayjs(created).format('LLLL')})
|
|
||||||
</Heading>
|
|
||||||
<OrderStatus value={status} />
|
<OrderStatus value={status} />
|
||||||
</HStack>
|
</HStack>
|
||||||
<UnorderedList styleType='none'>
|
<UnorderedList styleType='none'>
|
||||||
@@ -78,7 +89,7 @@ export const OrderDetails: FC<OrderDetailsProps> = ({
|
|||||||
tCarBody(
|
tCarBody(
|
||||||
`${carBodySelectOptions.find(({ value }) => value === carBody)?.labelTKey}`,
|
`${carBodySelectOptions.find(({ value }) => value === carBody)?.labelTKey}`,
|
||||||
),
|
),
|
||||||
carColor,
|
carColorTKey ? tCarColor(carColorTKey) : carColor,
|
||||||
]
|
]
|
||||||
.filter((v) => v)
|
.filter((v) => v)
|
||||||
.join(', '),
|
.join(', '),
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ type GetArrItemType<ArrType> =
|
|||||||
export const statuses = [
|
export const statuses = [
|
||||||
'pending' as const,
|
'pending' as const,
|
||||||
'progress' as const,
|
'progress' as const,
|
||||||
'working' as const,
|
'cancelled' as const,
|
||||||
'canceled' as const,
|
|
||||||
'complete' as const,
|
'complete' as const,
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ export type OrderArm = {
|
|||||||
status?: GetArrItemType<typeof statuses>;
|
status?: GetArrItemType<typeof statuses>;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
location?: string;
|
location?: string;
|
||||||
master: Master;
|
master: string | [];
|
||||||
notes: '';
|
notes: '';
|
||||||
allMasters: Master[];
|
allMasters: Master[];
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
export type RegistrationNumber = string; // А012ВЕ16
|
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 {
|
export const enum BodyStyle {
|
||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
|
|||||||
@@ -1,29 +1,30 @@
|
|||||||
import { IsoDate } from "../common";
|
import { IsoDate } from '../common';
|
||||||
|
|
||||||
import { Car, Customer, Washing } from ".";
|
import { Car, Customer, Washing } from '.';
|
||||||
|
|
||||||
export type Id = string;
|
export type Id = string;
|
||||||
|
|
||||||
export type Status = 'pending' |
|
export type Status =
|
||||||
'progress' |
|
| 'pending'
|
||||||
'working' |
|
| 'progress'
|
||||||
'canceled' |
|
| 'working'
|
||||||
'complete';
|
| 'canceled'
|
||||||
|
| 'complete';
|
||||||
|
|
||||||
export type Create = {
|
export type Create = {
|
||||||
customer: {
|
customer: {
|
||||||
phone: Customer.PhoneNumber,
|
phone: Customer.PhoneNumber;
|
||||||
};
|
};
|
||||||
car: {
|
car: {
|
||||||
number: Car.RegistrationNumber,
|
number: Car.RegistrationNumber;
|
||||||
body: Car.BodyStyle,
|
body: Car.BodyStyle;
|
||||||
color: Car.Color,
|
color: Car.Color | string;
|
||||||
},
|
};
|
||||||
washing: {
|
washing: {
|
||||||
location: Washing.Location
|
location: Washing.Location;
|
||||||
begin: Washing.AvailableBeginDateTime,
|
begin: Washing.AvailableBeginDateTime;
|
||||||
end: Washing.AvailableEndDateTime,
|
end: Washing.AvailableEndDateTime;
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Number = string;
|
export type Number = string;
|
||||||
@@ -32,14 +33,17 @@ export type View = {
|
|||||||
phone: Customer.PhoneNumber;
|
phone: Customer.PhoneNumber;
|
||||||
carNumber: Car.RegistrationNumber;
|
carNumber: Car.RegistrationNumber;
|
||||||
carBody: Car.BodyStyle;
|
carBody: Car.BodyStyle;
|
||||||
carColor?: Car.Color;
|
carColor?: Car.Color | string;
|
||||||
location: Washing.Location;
|
location: Washing.Location;
|
||||||
startWashTime: Washing.AvailableBeginDateTime;
|
startWashTime: Washing.AvailableBeginDateTime;
|
||||||
endWashTime: Washing.AvailableEndDateTime;
|
endWashTime: Washing.AvailableEndDateTime;
|
||||||
orderNumber: Number,
|
orderNumber: Number;
|
||||||
status: Status,
|
status: Status;
|
||||||
notes: string;
|
notes: string;
|
||||||
created: IsoDate;
|
created: IsoDate;
|
||||||
updated: IsoDate;
|
updated: IsoDate;
|
||||||
id: Id;
|
id: Id;
|
||||||
|
image?: string;
|
||||||
|
imageRating?: string;
|
||||||
|
imageDescription?: string;
|
||||||
};
|
};
|
||||||
@@ -3,46 +3,42 @@
|
|||||||
exports[`Master Page should display master list and show details when master button is clicked 1`] = `
|
exports[`Master Page should display master list and show details when master button is clicked 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
class="css-1yeiifd"
|
class="css-s92abg"
|
||||||
>
|
>
|
||||||
<div
|
<header
|
||||||
class="css-13owfwq"
|
class="css-106dwq4"
|
||||||
>
|
>
|
||||||
<h2
|
|
||||||
class="chakra-heading css-173d1bl"
|
|
||||||
>
|
|
||||||
Сухой мастер
|
|
||||||
</h2>
|
|
||||||
<div
|
<div
|
||||||
class="chakra-stack css-1cggwyz"
|
class="css-br9knx"
|
||||||
>
|
>
|
||||||
<hr
|
<h2
|
||||||
aria-orientation="horizontal"
|
class="chakra-heading css-8w8uga"
|
||||||
class="chakra-divider css-svjswr"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-18yoix2"
|
|
||||||
href="/order"
|
|
||||||
>
|
>
|
||||||
Заказы
|
Сухой мастер
|
||||||
</a>
|
</h2>
|
||||||
<hr
|
<div
|
||||||
aria-orientation="horizontal"
|
class="chakra-stack css-1rafi8n"
|
||||||
class="chakra-divider css-svjswr"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-1kg18wp"
|
|
||||||
data-testid="master-button"
|
|
||||||
href="/master"
|
|
||||||
>
|
>
|
||||||
Мастера
|
<a
|
||||||
</a>
|
class="chakra-button css-19byqlw"
|
||||||
<hr
|
href="/order"
|
||||||
aria-orientation="horizontal"
|
>
|
||||||
class="chakra-divider css-svjswr"
|
Заказы
|
||||||
/>
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="vertical"
|
||||||
|
class="chakra-divider css-zw0v9u"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
class="chakra-button css-g11sl9"
|
||||||
|
data-testid="master-button"
|
||||||
|
href="/master"
|
||||||
|
>
|
||||||
|
Мастера
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</header>
|
||||||
<div
|
<div
|
||||||
class="css-jiwy8d"
|
class="css-jiwy8d"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -90,65 +90,163 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
>
|
>
|
||||||
Цвет автомобиля
|
Цвет автомобиля
|
||||||
</label>
|
</label>
|
||||||
<input
|
<div
|
||||||
class="chakra-input css-moii5c"
|
class="chakra-stack css-uv9e93"
|
||||||
id="field-:r2:"
|
|
||||||
list=":r3:"
|
|
||||||
name="carColor"
|
|
||||||
value=""
|
|
||||||
/>
|
|
||||||
<datalist
|
|
||||||
id=":r3:"
|
|
||||||
>
|
>
|
||||||
<option
|
<div
|
||||||
label="white"
|
class="css-ed0q6j"
|
||||||
value="#ffffff"
|
|
||||||
>
|
>
|
||||||
white
|
<button
|
||||||
</option>
|
class="css-6su6fj"
|
||||||
<option
|
type="button"
|
||||||
label="black"
|
>
|
||||||
value="#000000"
|
<div
|
||||||
>
|
class="css-11g98ql"
|
||||||
black
|
>
|
||||||
</option>
|
<div
|
||||||
<option
|
class="css-1k9efnl"
|
||||||
label="silver"
|
>
|
||||||
value="#c0c0c0"
|
<div
|
||||||
>
|
class="css-96lva5"
|
||||||
silver
|
/>
|
||||||
</option>
|
</div>
|
||||||
<option
|
</div>
|
||||||
label="gray"
|
</button>
|
||||||
value="#808080"
|
<button
|
||||||
>
|
class="css-6su6fj"
|
||||||
gray
|
type="button"
|
||||||
</option>
|
>
|
||||||
<option
|
<div
|
||||||
label="beige-brown"
|
class="css-11g98ql"
|
||||||
value="#796745"
|
>
|
||||||
>
|
<div
|
||||||
beige-brown
|
class="css-1k9efnl"
|
||||||
</option>
|
>
|
||||||
<option
|
<div
|
||||||
label="red"
|
class="css-c58w4d"
|
||||||
value="#b90000"
|
/>
|
||||||
>
|
</div>
|
||||||
red
|
</div>
|
||||||
</option>
|
</button>
|
||||||
<option
|
<button
|
||||||
label="blue"
|
class="css-6su6fj"
|
||||||
value="#003B62"
|
type="button"
|
||||||
>
|
>
|
||||||
blue
|
<div
|
||||||
</option>
|
class="css-11g98ql"
|
||||||
<option
|
>
|
||||||
label="green"
|
<div
|
||||||
value="#078d51"
|
class="css-1k9efnl"
|
||||||
>
|
>
|
||||||
green
|
<div
|
||||||
</option>
|
class="css-ltoa43"
|
||||||
</datalist>
|
/>
|
||||||
|
</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>
|
||||||
<div
|
<div
|
||||||
class="chakra-form-control css-1kxonj9"
|
class="chakra-form-control css-1kxonj9"
|
||||||
@@ -157,7 +255,7 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<label
|
<label
|
||||||
class="chakra-form__label css-g6pte"
|
class="chakra-form__label css-g6pte"
|
||||||
for="carBody"
|
for="carBody"
|
||||||
id="field-:r4:-label"
|
id="field-:r3:-label"
|
||||||
>
|
>
|
||||||
Тип кузова автомобиля
|
Тип кузова автомобиля
|
||||||
<span
|
<span
|
||||||
@@ -169,13 +267,13 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<div
|
<div
|
||||||
class="css-8atqhb"
|
class="css-1kxonj9"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-readonly="true"
|
aria-readonly="true"
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
class="chakra-input css-moii5c"
|
class="chakra-input css-moii5c"
|
||||||
id="field-:r4:"
|
id="field-:r3:"
|
||||||
name="carBody"
|
name="carBody"
|
||||||
placeholder="Не указан"
|
placeholder="Не указан"
|
||||||
readonly=""
|
readonly=""
|
||||||
@@ -184,19 +282,19 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="chakra-popover__popper css-iy22zq"
|
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
|
<section
|
||||||
aria-describedby="popover-body-:r8:"
|
aria-describedby="popover-body-:r7:"
|
||||||
class="chakra-popover__content css-1mvj5hv"
|
class="chakra-popover__content css-1mvj5hv"
|
||||||
id="popover-content-:r8:"
|
id="popover-content-:r7:"
|
||||||
role="dialog"
|
role="dialog"
|
||||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.95) translateZ(0);"
|
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.95) translateZ(0);"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="chakra-popover__body css-1uqsyei"
|
class="chakra-popover__body css-1uqsyei"
|
||||||
id="popover-body-:r8:"
|
id="popover-body-:r7:"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-124gwxm"
|
class="css-124gwxm"
|
||||||
@@ -211,8 +309,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:r9:"
|
id="radio-:r8:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -243,8 +341,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:ra:"
|
id="radio-:r9:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -275,8 +373,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:rb:"
|
id="radio-:ra:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -307,8 +405,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:rc:"
|
id="radio-:rb:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -339,8 +437,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:rd:"
|
id="radio-:rc:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -371,8 +469,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:re:"
|
id="radio-:rd:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -403,8 +501,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:rf:"
|
id="radio-:re:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -435,8 +533,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:rg:"
|
id="radio-:rf:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -467,8 +565,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:rh:"
|
id="radio-:rg:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -499,8 +597,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:ri:"
|
id="radio-:rh:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -531,8 +629,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<input
|
<input
|
||||||
aria-required="true"
|
aria-required="true"
|
||||||
hidden=""
|
hidden=""
|
||||||
id="radio-:rj:"
|
id="radio-:ri:"
|
||||||
name="radio-:r5:"
|
name="radio-:r4:"
|
||||||
required=""
|
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;"
|
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"
|
type="radio"
|
||||||
@@ -566,8 +664,8 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="chakra-form__label css-g6pte"
|
class="chakra-form__label css-g6pte"
|
||||||
for="field-:rk:"
|
for="field-:rj:"
|
||||||
id="field-:rk:-label"
|
id="field-:rj:-label"
|
||||||
>
|
>
|
||||||
В какое время автомобиль доступен?
|
В какое время автомобиль доступен?
|
||||||
<span
|
<span
|
||||||
@@ -590,7 +688,7 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
class="chakra-input css-moii5c"
|
class="chakra-input css-moii5c"
|
||||||
id="field-:rl:"
|
id="field-:rk:"
|
||||||
max=""
|
max=""
|
||||||
name="availableDatetimeBegin"
|
name="availableDatetimeBegin"
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
@@ -607,7 +705,7 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
class="chakra-input css-moii5c"
|
class="chakra-input css-moii5c"
|
||||||
id="field-:rm:"
|
id="field-:rl:"
|
||||||
min=""
|
min=""
|
||||||
name="availableDatetimeEnd"
|
name="availableDatetimeEnd"
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
@@ -624,7 +722,7 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<label
|
<label
|
||||||
class="chakra-form__label css-g6pte"
|
class="chakra-form__label css-g6pte"
|
||||||
for="carLocation"
|
for="carLocation"
|
||||||
id="field-:rn:-label"
|
id="field-:rm:-label"
|
||||||
>
|
>
|
||||||
Где находится автомобиль?
|
Где находится автомобиль?
|
||||||
<span
|
<span
|
||||||
@@ -638,7 +736,7 @@ exports[`Create Order page renders page structure 1`] = `
|
|||||||
<div />
|
<div />
|
||||||
<div
|
<div
|
||||||
class="chakra-form__helper-text css-186pyma"
|
class="chakra-form__helper-text css-186pyma"
|
||||||
id="field-:rn:-helptext"
|
id="field-:rm:-helptext"
|
||||||
>
|
>
|
||||||
Например, 55.754364, 48.743295 Университетская улица, 1, Иннополис, Верхнеуслонский район, Республика Татарстан (Татарстан), 420500
|
Например, 55.754364, 48.743295 Университетская улица, 1, Иннополис, Верхнеуслонский район, Республика Татарстан (Татарстан), 420500
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -3,46 +3,42 @@
|
|||||||
exports[`Страница заказов должна корректно отображать список заказов после загрузки данных 1`] = `
|
exports[`Страница заказов должна корректно отображать список заказов после загрузки данных 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
class="css-1yeiifd"
|
class="css-s92abg"
|
||||||
>
|
>
|
||||||
<div
|
<header
|
||||||
class="css-13owfwq"
|
class="css-106dwq4"
|
||||||
>
|
>
|
||||||
<h2
|
|
||||||
class="chakra-heading css-173d1bl"
|
|
||||||
>
|
|
||||||
Сухой мастер
|
|
||||||
</h2>
|
|
||||||
<div
|
<div
|
||||||
class="chakra-stack css-1cggwyz"
|
class="css-br9knx"
|
||||||
>
|
>
|
||||||
<hr
|
<h2
|
||||||
aria-orientation="horizontal"
|
class="chakra-heading css-8w8uga"
|
||||||
class="chakra-divider css-svjswr"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-1kg18wp"
|
|
||||||
href="/auth/login"
|
|
||||||
>
|
>
|
||||||
Заказы
|
Сухой мастер
|
||||||
</a>
|
</h2>
|
||||||
<hr
|
<div
|
||||||
aria-orientation="horizontal"
|
class="chakra-stack css-1rafi8n"
|
||||||
class="chakra-divider css-svjswr"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
class="chakra-button css-1kg18wp"
|
|
||||||
data-testid="master-button"
|
|
||||||
href="/auth/login"
|
|
||||||
>
|
>
|
||||||
Мастера
|
<a
|
||||||
</a>
|
class="chakra-button css-g11sl9"
|
||||||
<hr
|
href="/auth/login"
|
||||||
aria-orientation="horizontal"
|
>
|
||||||
class="chakra-divider css-svjswr"
|
Заказы
|
||||||
/>
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="vertical"
|
||||||
|
class="chakra-divider css-zw0v9u"
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
class="chakra-button css-g11sl9"
|
||||||
|
data-testid="master-button"
|
||||||
|
href="/auth/login"
|
||||||
|
>
|
||||||
|
Мастера
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</header>
|
||||||
<div
|
<div
|
||||||
class="css-jiwy8d"
|
class="css-jiwy8d"
|
||||||
>
|
>
|
||||||
@@ -75,7 +71,7 @@ exports[`Страница заказов должна корректно ото
|
|||||||
<p
|
<p
|
||||||
class="chakra-text css-52ukzg"
|
class="chakra-text css-52ukzg"
|
||||||
>
|
>
|
||||||
23.02.2025
|
12.03.2025
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
class="chakra-button css-ez23ye"
|
class="chakra-button css-ez23ye"
|
||||||
@@ -177,12 +173,7 @@ exports[`Страница заказов должна корректно ото
|
|||||||
Выполняется
|
Выполняется
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
value="working"
|
value="cancelled"
|
||||||
>
|
|
||||||
В работе
|
|
||||||
</option>
|
|
||||||
<option
|
|
||||||
value="canceled"
|
|
||||||
>
|
>
|
||||||
Отменено
|
Отменено
|
||||||
</option>
|
</option>
|
||||||
@@ -273,7 +264,80 @@ exports[`Страница заказов должна корректно ото
|
|||||||
<td
|
<td
|
||||||
class="css-zgoslk"
|
class="css-zgoslk"
|
||||||
>
|
>
|
||||||
Казань, ул. Баумана, 1
|
<button
|
||||||
|
aria-controls="popover-content-:r1:"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="dialog"
|
||||||
|
class="chakra-button css-ez23ye"
|
||||||
|
id="popover-trigger-:r1:"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="chakra-popover__popper css-iy22zq"
|
||||||
|
style="visibility: hidden; position: absolute; min-width: max-content; inset: 0 auto auto 0;"
|
||||||
|
>
|
||||||
|
<section
|
||||||
|
aria-describedby="popover-body-:r1:"
|
||||||
|
class="chakra-popover__content css-sjj62m"
|
||||||
|
id="popover-content-:r1:"
|
||||||
|
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__arrow-positioner css-0"
|
||||||
|
data-popper-arrow=""
|
||||||
|
style="position: absolute;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-popover__arrow css-0"
|
||||||
|
data-popper-arrow-inner=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
aria-label="Close"
|
||||||
|
class="chakra-popover__close-btn css-1o8qips"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="chakra-popover__body css-45vz3u"
|
||||||
|
id="popover-body-:r1:"
|
||||||
|
>
|
||||||
|
Казань, ул. Баумана, 1
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
@@ -316,12 +380,7 @@ exports[`Страница заказов должна корректно ото
|
|||||||
Выполняется
|
Выполняется
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
value="working"
|
value="cancelled"
|
||||||
>
|
|
||||||
В работе
|
|
||||||
</option>
|
|
||||||
<option
|
|
||||||
value="canceled"
|
|
||||||
>
|
>
|
||||||
Отменено
|
Отменено
|
||||||
</option>
|
</option>
|
||||||
@@ -412,7 +471,80 @@ exports[`Страница заказов должна корректно ото
|
|||||||
<td
|
<td
|
||||||
class="css-zgoslk"
|
class="css-zgoslk"
|
||||||
>
|
>
|
||||||
Казань, ул. Баумана, 43
|
<button
|
||||||
|
aria-controls="popover-content-:r3:"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="dialog"
|
||||||
|
class="chakra-button css-ez23ye"
|
||||||
|
id="popover-trigger-:r3:"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="chakra-popover__popper css-iy22zq"
|
||||||
|
style="visibility: hidden; position: absolute; min-width: max-content; inset: 0 auto auto 0;"
|
||||||
|
>
|
||||||
|
<section
|
||||||
|
aria-describedby="popover-body-:r3:"
|
||||||
|
class="chakra-popover__content css-sjj62m"
|
||||||
|
id="popover-content-:r3:"
|
||||||
|
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__arrow-positioner css-0"
|
||||||
|
data-popper-arrow=""
|
||||||
|
style="position: absolute;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="chakra-popover__arrow css-0"
|
||||||
|
data-popper-arrow-inner=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
aria-label="Close"
|
||||||
|
class="chakra-popover__close-btn css-1o8qips"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
aria-hidden="true"
|
||||||
|
class="chakra-icon css-onkibi"
|
||||||
|
focusable="false"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="chakra-popover__body css-45vz3u"
|
||||||
|
id="popover-body-:r3:"
|
||||||
|
>
|
||||||
|
Казань, ул. Баумана, 43
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
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');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -22,6 +22,7 @@ import { landingApi } from '../../__data__/service/landing.api';
|
|||||||
import { isErrorMessage } from '../../models/api';
|
import { isErrorMessage } from '../../models/api';
|
||||||
import { FEATURE } from '../../__data__/features';
|
import { FEATURE } from '../../__data__/features';
|
||||||
import { CarImageForm } from '../../components/order-view/car-img';
|
import { CarImageForm } from '../../components/order-view/car-img';
|
||||||
|
import PriceCar from '../../components/PriceCar';
|
||||||
|
|
||||||
const Page: FC = () => {
|
const Page: FC = () => {
|
||||||
const { t } = useTranslation('~', {
|
const { t } = useTranslation('~', {
|
||||||
@@ -70,7 +71,12 @@ const Page: FC = () => {
|
|||||||
<>
|
<>
|
||||||
<>
|
<>
|
||||||
{isSuccess && (
|
{isSuccess && (
|
||||||
<VStack p={4} alignItems='flex-start' gap={4} data-testid='order-details'>
|
<VStack
|
||||||
|
p={4}
|
||||||
|
alignItems='flex-start'
|
||||||
|
gap={4}
|
||||||
|
data-testid='order-details'
|
||||||
|
>
|
||||||
<OrderDetails
|
<OrderDetails
|
||||||
orderNumber={order.orderNumber}
|
orderNumber={order.orderNumber}
|
||||||
status={order.status}
|
status={order.status}
|
||||||
@@ -83,7 +89,16 @@ const Page: FC = () => {
|
|||||||
endWashTime={order.endWashTime}
|
endWashTime={order.endWashTime}
|
||||||
created={order.created}
|
created={order.created}
|
||||||
/>
|
/>
|
||||||
<CarImageForm orderId={orderId} />
|
{FEATURE.carImageUpload.isOn && (
|
||||||
|
<CarImageForm orderId={orderId} />
|
||||||
|
)}
|
||||||
|
{FEATURE.carImageUpload.isOn && order.image && (
|
||||||
|
<PriceCar
|
||||||
|
image={order?.image}
|
||||||
|
rating={order?.imageRating}
|
||||||
|
description={order?.imageDescription}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -9,12 +9,8 @@
|
|||||||
"orderDate": "2024-11-24T08:41:46.366Z",
|
"orderDate": "2024-11-24T08:41:46.366Z",
|
||||||
"status": "pending",
|
"status": "pending",
|
||||||
"phone": "79001234563",
|
"phone": "79001234563",
|
||||||
"location": "Казань, ул. Баумана, 1",
|
"location": "55.779905316526424,49.12446113769528 Республика Татарстан (Татарстан),н Казань, ул. Баумана, 1",
|
||||||
"master": {
|
"master": "4545423234",
|
||||||
"name": "Олег Макаров",
|
|
||||||
"phone": "79001234567",
|
|
||||||
"id": "23423442"
|
|
||||||
},
|
|
||||||
"notes": ""
|
"notes": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -25,7 +21,7 @@
|
|||||||
"orderDate": "2024-11-24T07:40:46.366Z",
|
"orderDate": "2024-11-24T07:40:46.366Z",
|
||||||
"status": "progress",
|
"status": "progress",
|
||||||
"phone": "79001234567",
|
"phone": "79001234567",
|
||||||
"location": "Казань, ул. Баумана, 43",
|
"location": "55.779905316526424,49.12446113769528 Республика Татарстан (Татарстан), Казань, озеро Нижний Кабан",
|
||||||
"master": [],
|
"master": [],
|
||||||
"notes": ""
|
"notes": ""
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
|||||||
"phone": "+79876543210",
|
"phone": "+79876543210",
|
||||||
"carNumber": "А123АА16",
|
"carNumber": "А123АА16",
|
||||||
"carBody": 2,
|
"carBody": 2,
|
||||||
"carColor": "#ffffff",
|
"carColor": "мокрый асфальт",
|
||||||
"startWashTime": "2025-01-19T14:03:00.000Z",
|
"startWashTime": "2025-01-19T14:03:00.000Z",
|
||||||
"endWashTime": "2025-01-19T14:03:00.000Z",
|
"endWashTime": "2025-01-19T14:03:00.000Z",
|
||||||
"location": "55.793833888711006,49.19037910644527 Республика Татарстан (Татарстан), Казань, жилой район Седьмое Небо",
|
"location": "55.793833888711006,49.19037910644527 Республика Татарстан (Татарстан), Казань, жилой район Седьмое Небо",
|
||||||
|
|||||||
Reference in New Issue
Block a user