Compare commits
No commits in common. "main" and "feature/order" have entirely different histories.
main
...
feature/or
@ -16,7 +16,6 @@ module.exports = {
|
|||||||
'dry-wash.order.view': '/order/:orderId',
|
'dry-wash.order.view': '/order/:orderId',
|
||||||
'dry-wash.arm.master': 'master',
|
'dry-wash.arm.master': 'master',
|
||||||
'dry-wash.arm.order': 'order',
|
'dry-wash.arm.order': 'order',
|
||||||
'dry-wash.arm.map': 'map',
|
|
||||||
'dry-wash.arm': '/arm/*',
|
'dry-wash.arm': '/arm/*',
|
||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
|
@ -125,8 +125,5 @@
|
|||||||
"dry-wash.errorBoundary.title": "Something went wrong",
|
"dry-wash.errorBoundary.title": "Something went wrong",
|
||||||
"dry-wash.errorBoundary.description": "We are already working on fixing the issue",
|
"dry-wash.errorBoundary.description": "We are already working on fixing the issue",
|
||||||
"dry-wash.errorBoundary.button.reload": "Reload Page",
|
"dry-wash.errorBoundary.button.reload": "Reload Page",
|
||||||
"dry-wash.washTime.timeSlot": "{{start}} - {{end}}",
|
"dry-wash.washTime.timeSlot": "{{start}} - {{end}}"
|
||||||
"dry-wash.arm.map.title": "Map of orders",
|
|
||||||
"dry-wash.arm.map.carNumber": "Car Number",
|
|
||||||
"dry-wash.arm.map.status": "Status"
|
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,5 @@
|
|||||||
"dry-wash.errorBoundary.title": "Что-то пошло не так",
|
"dry-wash.errorBoundary.title": "Что-то пошло не так",
|
||||||
"dry-wash.errorBoundary.description": "Мы уже работаем над исправлением проблемы",
|
"dry-wash.errorBoundary.description": "Мы уже работаем над исправлением проблемы",
|
||||||
"dry-wash.errorBoundary.button.reload": "Перезагрузить страницу",
|
"dry-wash.errorBoundary.button.reload": "Перезагрузить страницу",
|
||||||
"dry-wash.washTime.timeSlot": "{{start}} - {{end}}",
|
"dry-wash.washTime.timeSlot": "{{start}} - {{end}}"
|
||||||
"dry-wash.arm.map.title": " Карта заказов",
|
|
||||||
"dry-wash.arm.map.carNumber": " Номер автомобиля",
|
|
||||||
"dry-wash.arm.map.status": "Статус"
|
|
||||||
}
|
}
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.12.0",
|
"version": "0.9.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.12.0",
|
"version": "0.9.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.26.7",
|
"@babel/core": "^7.26.7",
|
||||||
@ -3610,6 +3610,7 @@
|
|||||||
"version": "1.2.5",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/@pbe/react-yandex-maps/-/react-yandex-maps-1.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/@pbe/react-yandex-maps/-/react-yandex-maps-1.2.5.tgz",
|
||||||
"integrity": "sha512-cBojin5e1fPx9XVCAqHQJsCnHGMeBNsP0TrNfpWCrPFfxb30ye+JgcGr2mn767Gbr1d+RufBLRiUcX2kaiAwjQ==",
|
"integrity": "sha512-cBojin5e1fPx9XVCAqHQJsCnHGMeBNsP0TrNfpWCrPFfxb30ye+JgcGr2mn767Gbr1d+RufBLRiUcX2kaiAwjQ==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/yandex-maps": "2.1.29"
|
"@types/yandex-maps": "2.1.29"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.12.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": {
|
||||||
|
@ -21,16 +21,8 @@ export const api = createApi({
|
|||||||
}),
|
}),
|
||||||
tagTypes: ['Masters', 'Orders'],
|
tagTypes: ['Masters', 'Orders'],
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
getMasters: builder.query<Master[], { date: Date }>({
|
getMasters: builder.query<Master[], void>({
|
||||||
query: ({ date }) => {
|
query: () => ({ url: '/arm/masters' }),
|
||||||
const startDate = dayjs(date).startOf('day').toISOString();
|
|
||||||
const endDate = dayjs(date).endOf('day').toISOString();
|
|
||||||
return {
|
|
||||||
url: '/arm/masters/list',
|
|
||||||
method: 'POST',
|
|
||||||
body: { startDate, endDate },
|
|
||||||
};
|
|
||||||
},
|
|
||||||
transformResponse: extractBodyFromResponse<Master[]>,
|
transformResponse: extractBodyFromResponse<Master[]>,
|
||||||
providesTags: ['Masters'],
|
providesTags: ['Masters'],
|
||||||
}),
|
}),
|
||||||
@ -40,7 +32,7 @@ export const api = createApi({
|
|||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
body: { status, notes, master },
|
body: { status, notes, master },
|
||||||
}),
|
}),
|
||||||
invalidatesTags: ['Orders', 'Masters'],
|
invalidatesTags: ['Orders'],
|
||||||
}),
|
}),
|
||||||
getOrders: builder.query<OrderArm[], { date: Date }>({
|
getOrders: builder.query<OrderArm[], { date: Date }>({
|
||||||
query: ({ date }) => {
|
query: ({ date }) => {
|
||||||
@ -62,14 +54,14 @@ export const api = createApi({
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: master,
|
body: master,
|
||||||
}),
|
}),
|
||||||
invalidatesTags: ['Masters', 'Orders'],
|
invalidatesTags: ['Masters'],
|
||||||
}),
|
}),
|
||||||
deleteMaster: builder.mutation<void, { id: string }>({
|
deleteMaster: builder.mutation<void, { id: string }>({
|
||||||
query: ({ id }) => ({
|
query: ({ id }) => ({
|
||||||
url: `/arm/masters/${id}`,
|
url: `/arm/masters/${id}`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
}),
|
}),
|
||||||
invalidatesTags: ['Masters', 'Orders'],
|
invalidatesTags: ['Masters'],
|
||||||
}),
|
}),
|
||||||
updateMaster: builder.mutation<void, UpdateMasterPayload>({
|
updateMaster: builder.mutation<void, UpdateMasterPayload>({
|
||||||
query: ({ id, name, phone }) => ({
|
query: ({ id, name, phone }) => ({
|
||||||
@ -77,7 +69,7 @@ export const api = createApi({
|
|||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
body: { name, phone },
|
body: { name, phone },
|
||||||
}),
|
}),
|
||||||
invalidatesTags: ['Masters', 'Orders'],
|
invalidatesTags: ['Masters'],
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@ -33,18 +33,6 @@ export const URLs = {
|
|||||||
url: getNavigationValue('dry-wash.arm.order'),
|
url: getNavigationValue('dry-wash.arm.order'),
|
||||||
isOn: Boolean(getNavigationValue('dry-wash.arm.order')),
|
isOn: Boolean(getNavigationValue('dry-wash.arm.order')),
|
||||||
},
|
},
|
||||||
armMap: {
|
|
||||||
url: getNavigationValue('dry-wash.arm.map'),
|
|
||||||
isOn: Boolean(getNavigationValue('dry-wash.arm.map')),
|
|
||||||
getUrl({ lat, lon, currentDate }) {
|
|
||||||
return (
|
|
||||||
getFullUrls('/arm') +
|
|
||||||
'/' +
|
|
||||||
getNavigationValue('dry-wash.arm.map') +
|
|
||||||
`?lat=${lat}&lon=${lon}¤tDate=${currentDate}`
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
armBase: {
|
armBase: {
|
||||||
url: getFullUrls(getNavigationValue('dry-wash.arm')),
|
url: getFullUrls(getNavigationValue('dry-wash.arm')),
|
||||||
isOn: Boolean(getNavigationValue('dry-wash.arm')),
|
isOn: Boolean(getNavigationValue('dry-wash.arm')),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Box, Button, Heading, HStack, Flex } from '@chakra-ui/react';
|
import { Box, Button, Heading, HStack, Divider, Flex } from '@chakra-ui/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useLocation, Link } from 'react-router-dom';
|
import { useLocation, Link } from 'react-router-dom';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -30,6 +30,7 @@ const Header = () => {
|
|||||||
{t('orders')}
|
{t('orders')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
<Divider orientation='vertical' height='30px' />
|
||||||
{URLs.armMaster.isOn && (
|
{URLs.armMaster.isOn && (
|
||||||
<Button
|
<Button
|
||||||
as={Link}
|
as={Link}
|
||||||
@ -41,17 +42,6 @@ const Header = () => {
|
|||||||
{t('master')}
|
{t('master')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{URLs.armMap.isOn && (
|
|
||||||
<Button
|
|
||||||
as={Link}
|
|
||||||
to={URLs.armMap.url}
|
|
||||||
colorScheme={isActive(URLs.armMap.url) ? 'green' : 'blue'}
|
|
||||||
variant={isActive(URLs.armMap.url) ? 'outline' : 'ghost'}
|
|
||||||
>
|
|
||||||
Карта заказов
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</HStack>
|
</HStack>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -6,7 +6,6 @@ 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';
|
import Header from '../Header';
|
||||||
import OrdersMap from '../Map';
|
|
||||||
|
|
||||||
const LayoutArm = () => {
|
const LayoutArm = () => {
|
||||||
let defaultRedirect = null;
|
let defaultRedirect = null;
|
||||||
@ -29,9 +28,6 @@ const LayoutArm = () => {
|
|||||||
{URLs.armMaster.isOn && (
|
{URLs.armMaster.isOn && (
|
||||||
<Route path={URLs.armMaster.url} element={<Masters />} />
|
<Route path={URLs.armMaster.url} element={<Masters />} />
|
||||||
)}
|
)}
|
||||||
{URLs.armMap.isOn && (
|
|
||||||
<Route path={URLs.armMap.url} element={<OrdersMap />} />
|
|
||||||
)}
|
|
||||||
</Routes>
|
</Routes>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -1,95 +0,0 @@
|
|||||||
import React, { useState } from 'react';
|
|
||||||
import { Box, Flex, Heading, Spinner } from '@chakra-ui/react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { YMaps, Map, Placemark } from '@pbe/react-yandex-maps';
|
|
||||||
import { useLocation } from 'react-router-dom';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
import { useGetOrdersQuery } from '../../__data__/service/api';
|
|
||||||
import getCoordinates from '../../utils/getCoordinates';
|
|
||||||
import DateNavigator from '../DateNavigator';
|
|
||||||
|
|
||||||
const OrdersMap = () => {
|
|
||||||
const { t } = useTranslation('~', {
|
|
||||||
keyPrefix: 'dry-wash.arm.map',
|
|
||||||
});
|
|
||||||
|
|
||||||
const location = useLocation();
|
|
||||||
const params = new URLSearchParams(location.search);
|
|
||||||
const latFromUrl = parseFloat(params.get('lat') || '55.78');
|
|
||||||
const lonFromUrl = parseFloat(params.get('lon') || '49.12');
|
|
||||||
|
|
||||||
const [currentDate, setCurrentDate] = useState(
|
|
||||||
params.get('currentDate')
|
|
||||||
? new Date(params.get('currentDate'))
|
|
||||||
: new Date(),
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
|
||||||
data: ordersData,
|
|
||||||
isLoading,
|
|
||||||
isSuccess,
|
|
||||||
} = useGetOrdersQuery({ date: currentDate });
|
|
||||||
|
|
||||||
// Получаем координаты из location
|
|
||||||
const orders = ordersData
|
|
||||||
?.map((order) => {
|
|
||||||
const coords = getCoordinates(order.location);
|
|
||||||
return coords ? { ...order, ...coords } : null;
|
|
||||||
})
|
|
||||||
.filter(Boolean);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box p='8'>
|
|
||||||
<Heading size='lg' mb='5'>
|
|
||||||
{t('title')}
|
|
||||||
</Heading>
|
|
||||||
|
|
||||||
<DateNavigator
|
|
||||||
currentDate={currentDate}
|
|
||||||
onPreviousDate={() =>
|
|
||||||
setCurrentDate((prevDate) =>
|
|
||||||
dayjs(prevDate).subtract(1, 'day').toDate(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
onNextDate={() =>
|
|
||||||
setCurrentDate((prevDate) => dayjs(prevDate).add(1, 'day').toDate())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{isLoading && (
|
|
||||||
<Flex justifyContent='center' alignItems='center'>
|
|
||||||
<Spinner size='lg' />
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{isSuccess && (
|
|
||||||
<YMaps>
|
|
||||||
<Map
|
|
||||||
defaultState={{ center: [latFromUrl, lonFromUrl], zoom: 12 }}
|
|
||||||
width='100%'
|
|
||||||
height='70vh'
|
|
||||||
modules={['geoObject.addon.balloon']}
|
|
||||||
>
|
|
||||||
{orders.map(({ id, lat, lon, carNumber, status }) => (
|
|
||||||
<Placemark
|
|
||||||
key={id}
|
|
||||||
geometry={[lat, lon]}
|
|
||||||
options={{
|
|
||||||
preset: 'islands#blueAutoIcon',
|
|
||||||
iconColor: 'blue',
|
|
||||||
balloonPanelMaxMapArea: 0,
|
|
||||||
}}
|
|
||||||
properties={{
|
|
||||||
balloonContent: `<strong>${t('carNumber')}</strong> ${carNumber}<br/><strong>${t('status')}</strong> ${status}`,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Map>
|
|
||||||
</YMaps>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default OrdersMap;
|
|
@ -1 +0,0 @@
|
|||||||
export { default } from './Map';
|
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Heading,
|
Heading,
|
||||||
@ -15,13 +15,11 @@ import {
|
|||||||
Spinner,
|
Spinner,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
import MasterItem from '../MasterItem';
|
import MasterItem from '../MasterItem';
|
||||||
import MasterDrawer from '../MasterDrawer';
|
import MasterDrawer from '../MasterDrawer';
|
||||||
import { useGetMastersQuery } from '../../__data__/service/api';
|
import { useGetMastersQuery } from '../../__data__/service/api';
|
||||||
import useShowToast from '../../hooks/useShowToast';
|
import useShowToast from '../../hooks/useShowToast';
|
||||||
import DateNavigator from '../DateNavigator';
|
|
||||||
|
|
||||||
const TABLE_HEADERS = [
|
const TABLE_HEADERS = [
|
||||||
'name' as const,
|
'name' as const,
|
||||||
@ -33,18 +31,12 @@ const TABLE_HEADERS = [
|
|||||||
const Masters = () => {
|
const Masters = () => {
|
||||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||||
const showToast = useShowToast();
|
const showToast = useShowToast();
|
||||||
const [currentDate, setCurrentDate] = useState(new Date());
|
|
||||||
|
|
||||||
const { t } = useTranslation('~', {
|
const { t } = useTranslation('~', {
|
||||||
keyPrefix: 'dry-wash.arm.master',
|
keyPrefix: 'dry-wash.arm.master',
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const { data: masters, error, isLoading, isSuccess } = useGetMastersQuery();
|
||||||
data: masters,
|
|
||||||
error,
|
|
||||||
isLoading,
|
|
||||||
isSuccess,
|
|
||||||
} = useGetMastersQuery({ date: currentDate });
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -54,24 +46,12 @@ const Masters = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box p='8'>
|
<Box p='8'>
|
||||||
<Flex justifyContent='space-between' alignItems='baseline' mb='5'>
|
<Flex justifyContent='space-between' alignItems='center' mb='5'>
|
||||||
<Heading size='lg'> {t('title')}</Heading>
|
<Heading size='lg'> {t('title')}</Heading>
|
||||||
|
|
||||||
<Button colorScheme='green' onClick={onOpen}>
|
<Button colorScheme='green' onClick={onOpen}>
|
||||||
+ {t('add')}
|
+ {t('add')}
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
<DateNavigator
|
|
||||||
currentDate={currentDate}
|
|
||||||
onPreviousDate={() =>
|
|
||||||
setCurrentDate((prevDate) =>
|
|
||||||
dayjs(prevDate).subtract(1, 'day').toDate(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
onNextDate={() =>
|
|
||||||
setCurrentDate((prevDate) => dayjs(prevDate).add(1, 'day').toDate())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Table variant='simple' colorScheme='blackAlpha'>
|
<Table variant='simple' colorScheme='blackAlpha'>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
import React, { ChangeEvent, useState } from 'react';
|
import React, { ChangeEvent, useState } from 'react';
|
||||||
import { Td, Tr, Link, Select, Button } 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 { ViewIcon } from '@chakra-ui/icons';
|
||||||
import { Link as LinkRouter } from 'react-router-dom';
|
|
||||||
|
|
||||||
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 getCoordinates from '../../utils/getCoordinates';
|
import PopoverTemplate from '../PopoverTemplate';
|
||||||
import { URLs } from '../../__data__/urls';
|
|
||||||
|
|
||||||
const statusColors: Record<Status, string> = {
|
const statusColors: Record<Status, string> = {
|
||||||
pending: 'yellow.100',
|
pending: 'yellow.100',
|
||||||
@ -29,7 +27,6 @@ const OrderItem = ({
|
|||||||
master,
|
master,
|
||||||
allMasters,
|
allMasters,
|
||||||
id,
|
id,
|
||||||
currentDate,
|
|
||||||
}: OrderArm) => {
|
}: OrderArm) => {
|
||||||
const [updateOrders] = useUpdateOrdersMutation();
|
const [updateOrders] = useUpdateOrdersMutation();
|
||||||
const { t } = useTranslation('~', {
|
const { t } = useTranslation('~', {
|
||||||
@ -64,8 +61,6 @@ const OrderItem = ({
|
|||||||
(master) => master.id === masterSelectId,
|
(master) => master.id === masterSelectId,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { lat = 55.78, lon = 49.12 } = getCoordinates(location);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tr>
|
<Tr>
|
||||||
<Td>{carNumber}</Td>
|
<Td>{carNumber}</Td>
|
||||||
@ -104,12 +99,7 @@ const OrderItem = ({
|
|||||||
<Link href='tel:'>{phone}</Link>
|
<Link href='tel:'>{phone}</Link>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<Button
|
<PopoverTemplate trigger={<ViewIcon />} description={location} />
|
||||||
as={LinkRouter}
|
|
||||||
to={URLs.armMap.getUrl({ lat, lon, currentDate })}
|
|
||||||
>
|
|
||||||
<ViewIcon />
|
|
||||||
</Button>
|
|
||||||
</Td>
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
);
|
);
|
||||||
|
@ -53,7 +53,7 @@ const Orders = () => {
|
|||||||
isSuccess: isMastersSuccess,
|
isSuccess: isMastersSuccess,
|
||||||
isError: isMastersError,
|
isError: isMastersError,
|
||||||
error: mastersError,
|
error: mastersError,
|
||||||
} = useGetMastersQuery({ date: currentDate });
|
} = useGetMastersQuery();
|
||||||
|
|
||||||
const isLoading = isOrdersLoading || isMastersLoading;
|
const isLoading = isOrdersLoading || isMastersLoading;
|
||||||
const isSuccess = isOrdersSuccess && isMastersSuccess;
|
const isSuccess = isOrdersSuccess && isMastersSuccess;
|
||||||
@ -112,7 +112,6 @@ const Orders = () => {
|
|||||||
key={index}
|
key={index}
|
||||||
{...order}
|
{...order}
|
||||||
status={order.status as OrderArm['status']}
|
status={order.status as OrderArm['status']}
|
||||||
currentDate={currentDate}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Tbody>
|
</Tbody>
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import dayjs from 'dayjs';
|
|
||||||
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
||||||
|
|
||||||
dayjs.extend(customParseFormat);
|
|
||||||
|
|
||||||
export const getMinDatetime = (dateTimeString: string, minDateTimeString: string) => {
|
|
||||||
const time = dayjs(dateTimeString);
|
|
||||||
|
|
||||||
const minDate = dayjs(minDateTimeString).format('YYYY-MM-DD');
|
|
||||||
const minTime = dayjs(minDateTimeString);
|
|
||||||
|
|
||||||
const newTime = (time && time.isAfter(minTime)) ? time : minTime;
|
|
||||||
|
|
||||||
return [minDate, newTime.format('HH:mm')].join('T');
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getMaxDatetime = (dateTimeString: string, maxDateTimeString: string) => {
|
|
||||||
const time = dayjs(dateTimeString);
|
|
||||||
|
|
||||||
const maxDate = dayjs(maxDateTimeString).format('YYYY-MM-DD');
|
|
||||||
const maxTime = dayjs(maxDateTimeString);
|
|
||||||
|
|
||||||
const newTime = (time && time.isBefore(maxTime)) ? time : maxTime;
|
|
||||||
|
|
||||||
return [maxDate, newTime.format('HH:mm')].join('T');
|
|
||||||
};
|
|
@ -1,2 +1 @@
|
|||||||
export { type DateTimeInputProps, DateTimeInput } from './date-time';
|
export { type DateTimeInputProps, DateTimeInput } from './date-time';
|
||||||
export { getMinDatetime, getMaxDatetime } from './helper';
|
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React from 'react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { useTranslation } from 'react-i18next';
|
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';
|
||||||
@ -10,7 +10,7 @@ import { OrderFormProps, OrderFormValues } from './types';
|
|||||||
import { PhoneInput } from './phone';
|
import { PhoneInput } from './phone';
|
||||||
import { SubmitButton } from './submit';
|
import { SubmitButton } from './submit';
|
||||||
import { defaultValues, useGetValidationRules } from './helper';
|
import { defaultValues, useGetValidationRules } from './helper';
|
||||||
import { DateTimeInput, getMinDatetime, getMaxDatetime } from './date-time';
|
import { DateTimeInput } from './date-time';
|
||||||
import {
|
import {
|
||||||
LocationInput,
|
LocationInput,
|
||||||
MapComponent,
|
MapComponent,
|
||||||
@ -40,19 +40,6 @@ export const OrderForm = ({ onSubmit, loading, ...props }: OrderFormProps) => {
|
|||||||
'carLocation',
|
'carLocation',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!availableDatetimeBegin) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setValue('availableDatetimeEnd', getMinDatetime(availableDatetimeEnd, availableDatetimeBegin));
|
|
||||||
}, [availableDatetimeBegin]);
|
|
||||||
useEffect(() => {
|
|
||||||
if (!availableDatetimeEnd) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setValue('availableDatetimeBegin', getMaxDatetime(availableDatetimeBegin, availableDatetimeEnd));
|
|
||||||
}, [availableDatetimeEnd]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box p={4} marginInline='auto' {...props}>
|
<Box p={4} marginInline='auto' {...props}>
|
||||||
<VStack
|
<VStack
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { FC } from 'react';
|
|
||||||
import { Flex, Image } from '@chakra-ui/react';
|
|
||||||
|
|
||||||
import { Order } from '../../../../models';
|
|
||||||
import {
|
|
||||||
carBodySelectOptions,
|
|
||||||
carColorSelectOptions,
|
|
||||||
} from '../../../order-form';
|
|
||||||
|
|
||||||
import { LicensePlate } from './license-plate';
|
|
||||||
|
|
||||||
type Props = Pick<Order.View, 'carNumber' | 'carBody' | 'carColor'>;
|
|
||||||
|
|
||||||
export const CarDetails: FC<Props> = ({ carNumber, carBody, carColor }) => {
|
|
||||||
const image = carBodySelectOptions.find(({ value }) => value === carBody).img;
|
|
||||||
const color =
|
|
||||||
carColorSelectOptions.find(({ value }) => value === carColor)?.code ??
|
|
||||||
'black';
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Flex direction='column' alignItems='center' p={2}>
|
|
||||||
<div style={{ backgroundColor: color, width: 'fit-content' }}>
|
|
||||||
<Image src={image} style={{ mixBlendMode: 'lighten' }} />
|
|
||||||
</div>
|
|
||||||
<LicensePlate carNumber={carNumber} />
|
|
||||||
</Flex>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1 +0,0 @@
|
|||||||
export { CarDetails } from './car-details';
|
|
@ -1 +0,0 @@
|
|||||||
export { LicensePlate } from './license-plate';
|
|
@ -1,52 +0,0 @@
|
|||||||
import React, { FC } from 'react';
|
|
||||||
import { Flex, HStack, Text } from '@chakra-ui/react';
|
|
||||||
|
|
||||||
import { Order } from '../../../../../models';
|
|
||||||
|
|
||||||
export const LicensePlate: FC<Pick<Order.View, 'carNumber'>> = ({
|
|
||||||
carNumber,
|
|
||||||
}) => {
|
|
||||||
const firstLetter = carNumber.substring(0, 1);
|
|
||||||
const digits = carNumber.substring(1, 4);
|
|
||||||
const lastLetters = carNumber.substring(4, 6);
|
|
||||||
const region = carNumber.substring(6);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Flex
|
|
||||||
align='center'
|
|
||||||
bg='black'
|
|
||||||
borderRadius='md'
|
|
||||||
width='fit-content'
|
|
||||||
boxShadow='md'
|
|
||||||
fontFamily='mono'
|
|
||||||
fontWeight='bold'
|
|
||||||
fontSize='24px'
|
|
||||||
textTransform='uppercase'
|
|
||||||
color='black'
|
|
||||||
alignItems='stretch'
|
|
||||||
>
|
|
||||||
<HStack
|
|
||||||
bg='white'
|
|
||||||
border='2px solid black'
|
|
||||||
borderRadius='md'
|
|
||||||
px={2}
|
|
||||||
gap={0}
|
|
||||||
alignItems='baseline'
|
|
||||||
>
|
|
||||||
<Text>{firstLetter}</Text>
|
|
||||||
<Text fontSize='28px' lineHeight={0}>{digits}</Text>
|
|
||||||
<Text>{lastLetters}</Text>
|
|
||||||
</HStack>
|
|
||||||
<Flex
|
|
||||||
bg='white'
|
|
||||||
border='2px solid black'
|
|
||||||
borderInlineStart='none'
|
|
||||||
borderRadius='md'
|
|
||||||
px={2}
|
|
||||||
alignItems='center'
|
|
||||||
>
|
|
||||||
{region}
|
|
||||||
</Flex>
|
|
||||||
</Flex>
|
|
||||||
);
|
|
||||||
};
|
|
@ -7,7 +7,6 @@ import {
|
|||||||
UnorderedList,
|
UnorderedList,
|
||||||
ListItem,
|
ListItem,
|
||||||
Text,
|
Text,
|
||||||
Flex,
|
|
||||||
} 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';
|
||||||
@ -18,10 +17,12 @@ import 'dayjs/locale/en';
|
|||||||
|
|
||||||
import { Order } from '../../../models/landing';
|
import { Order } from '../../../models/landing';
|
||||||
import { formatDatetime } from '../../../lib';
|
import { formatDatetime } from '../../../lib';
|
||||||
import { carBodySelectOptions, carColorSelectOptions } from '../../order-form';
|
import {
|
||||||
|
carBodySelectOptions,
|
||||||
|
carColorSelectOptions,
|
||||||
|
} from '../../order-form';
|
||||||
|
|
||||||
import { OrderStatus } from './status';
|
import { OrderStatus } from './status';
|
||||||
import { CarDetails } from './car';
|
|
||||||
|
|
||||||
type OrderDetailsProps = Pick<
|
type OrderDetailsProps = Pick<
|
||||||
Order.View,
|
Order.View,
|
||||||
@ -59,9 +60,7 @@ export const OrderDetails: FC<OrderDetailsProps> = ({
|
|||||||
const { t: tCarColor } = useTranslation('~', {
|
const { t: tCarColor } = useTranslation('~', {
|
||||||
keyPrefix: 'dry-wash.order-create.car-color-select.colors',
|
keyPrefix: 'dry-wash.order-create.car-color-select.colors',
|
||||||
});
|
});
|
||||||
const carColorTKey = carColorSelectOptions.find(
|
const carColorTKey = carColorSelectOptions.find(({ value }) => value === carColor)?.labelTKey;
|
||||||
({ value }) => value === carColor,
|
|
||||||
)?.labelTKey;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -77,22 +76,24 @@ export const OrderDetails: FC<OrderDetailsProps> = ({
|
|||||||
<Text>{dayjs(created).format('LLL')}</Text>
|
<Text>{dayjs(created).format('LLL')}</Text>
|
||||||
<OrderStatus value={status} />
|
<OrderStatus value={status} />
|
||||||
</HStack>
|
</HStack>
|
||||||
<Flex direction={{ base: 'column', md: 'row-reverse' }} gap={4}>
|
|
||||||
<CarDetails
|
|
||||||
carNumber={carNumber}
|
|
||||||
carBody={carBody}
|
|
||||||
carColor={carColor}
|
|
||||||
/>
|
|
||||||
<UnorderedList styleType='none'>
|
<UnorderedList styleType='none'>
|
||||||
{[
|
{[
|
||||||
{
|
|
||||||
label: t('car'),
|
|
||||||
value: `${tCarBody(carBodySelectOptions.find(({ value }) => value === carBody)?.labelTKey)} (${carColorTKey ? tCarColor(carColorTKey) : carColor})`,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: t('owner'),
|
label: t('owner'),
|
||||||
value: phone,
|
value: phone,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: t('car'),
|
||||||
|
value: [
|
||||||
|
carNumber,
|
||||||
|
tCarBody(
|
||||||
|
`${carBodySelectOptions.find(({ value }) => value === carBody)?.labelTKey}`,
|
||||||
|
),
|
||||||
|
carColorTKey ? tCarColor(carColorTKey) : carColor,
|
||||||
|
]
|
||||||
|
.filter((v) => v)
|
||||||
|
.join(', '),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('location'),
|
label: t('location'),
|
||||||
value: location,
|
value: location,
|
||||||
@ -106,14 +107,13 @@ export const OrderDetails: FC<OrderDetailsProps> = ({
|
|||||||
},
|
},
|
||||||
].map(({ label, value }, i) => (
|
].map(({ label, value }, i) => (
|
||||||
<ListItem key={i}>
|
<ListItem key={i}>
|
||||||
<Text as='span' color='primary.400'>
|
{label}:{' '}
|
||||||
{label}:
|
<Text as='span' color='primary.500' fontWeight='bold'>
|
||||||
</Text>{' '}
|
{value}
|
||||||
<Text as='span'>{value}</Text>
|
</Text>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
</UnorderedList>
|
</UnorderedList>
|
||||||
</Flex>
|
|
||||||
<Alert status='info' alignItems='flex-start'>
|
<Alert status='info' alignItems='flex-start'>
|
||||||
<AlertIcon />
|
<AlertIcon />
|
||||||
{t('alert')}
|
{t('alert')}
|
||||||
|
@ -56,5 +56,4 @@ export type OrderArm = {
|
|||||||
notes: '';
|
notes: '';
|
||||||
allMasters: Master[];
|
allMasters: Master[];
|
||||||
id: string;
|
id: string;
|
||||||
currentDate: Date;
|
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,10 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
>
|
>
|
||||||
Заказы
|
Заказы
|
||||||
</a>
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="vertical"
|
||||||
|
class="chakra-divider css-zw0v9u"
|
||||||
|
/>
|
||||||
<a
|
<a
|
||||||
class="chakra-button css-g11sl9"
|
class="chakra-button css-g11sl9"
|
||||||
data-testid="master-button"
|
data-testid="master-button"
|
||||||
@ -32,12 +36,6 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
>
|
>
|
||||||
Мастера
|
Мастера
|
||||||
</a>
|
</a>
|
||||||
<a
|
|
||||||
class="chakra-button css-19byqlw"
|
|
||||||
href="/map"
|
|
||||||
>
|
|
||||||
Карта заказов
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@ -48,7 +46,7 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
class="css-1glkkdp"
|
class="css-1glkkdp"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="css-1dvg3xs"
|
class="css-sd3fvu"
|
||||||
>
|
>
|
||||||
<h2
|
<h2
|
||||||
class="chakra-heading css-1jb3vzl"
|
class="chakra-heading css-1jb3vzl"
|
||||||
@ -64,45 +62,6 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
Добавить
|
Добавить
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
class="css-1u3smh"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="chakra-button css-ez23ye"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="chakra-icon css-onkibi"
|
|
||||||
focusable="false"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<p
|
|
||||||
class="chakra-text css-52ukzg"
|
|
||||||
>
|
|
||||||
17.03.2025
|
|
||||||
</p>
|
|
||||||
<button
|
|
||||||
class="chakra-button css-ez23ye"
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
class="chakra-icon css-onkibi"
|
|
||||||
focusable="false"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<table
|
<table
|
||||||
class="chakra-table css-5605sr"
|
class="chakra-table css-5605sr"
|
||||||
>
|
>
|
||||||
@ -257,11 +216,11 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
class="css-zgoslk"
|
class="css-zgoslk"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-controls="menu-list-:r3:"
|
aria-controls="menu-list-:r2:"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-haspopup="menu"
|
aria-haspopup="menu"
|
||||||
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||||
id="menu-button-:r3:"
|
id="menu-button-:r2:"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@ -292,7 +251,7 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
<div
|
<div
|
||||||
aria-orientation="vertical"
|
aria-orientation="vertical"
|
||||||
class="chakra-menu__menu-list css-s5t7bz"
|
class="chakra-menu__menu-list css-s5t7bz"
|
||||||
id="menu-list-:r3:"
|
id="menu-list-:r2:"
|
||||||
role="menu"
|
role="menu"
|
||||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
@ -301,7 +260,7 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="chakra-menu__menuitem css-y7jzs3"
|
class="chakra-menu__menuitem css-y7jzs3"
|
||||||
data-index="0"
|
data-index="0"
|
||||||
id="menu-list-:r3:-menuitem-:r4:"
|
id="menu-list-:r2:-menuitem-:r3:"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
type="button"
|
type="button"
|
||||||
@ -432,11 +391,11 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
class="css-zgoslk"
|
class="css-zgoslk"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-controls="menu-list-:r6:"
|
aria-controls="menu-list-:r5:"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-haspopup="menu"
|
aria-haspopup="menu"
|
||||||
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||||
id="menu-button-:r6:"
|
id="menu-button-:r5:"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@ -467,7 +426,7 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
<div
|
<div
|
||||||
aria-orientation="vertical"
|
aria-orientation="vertical"
|
||||||
class="chakra-menu__menu-list css-s5t7bz"
|
class="chakra-menu__menu-list css-s5t7bz"
|
||||||
id="menu-list-:r6:"
|
id="menu-list-:r5:"
|
||||||
role="menu"
|
role="menu"
|
||||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
@ -476,7 +435,7 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="chakra-menu__menuitem css-y7jzs3"
|
class="chakra-menu__menuitem css-y7jzs3"
|
||||||
data-index="0"
|
data-index="0"
|
||||||
id="menu-list-:r6:-menuitem-:r7:"
|
id="menu-list-:r5:-menuitem-:r6:"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
type="button"
|
type="button"
|
||||||
@ -612,11 +571,11 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
class="css-zgoslk"
|
class="css-zgoslk"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-controls="menu-list-:r9:"
|
aria-controls="menu-list-:r8:"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-haspopup="menu"
|
aria-haspopup="menu"
|
||||||
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
class="chakra-button chakra-menu__menu-button css-13sr8jm"
|
||||||
id="menu-button-:r9:"
|
id="menu-button-:r8:"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@ -647,7 +606,7 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
<div
|
<div
|
||||||
aria-orientation="vertical"
|
aria-orientation="vertical"
|
||||||
class="chakra-menu__menu-list css-s5t7bz"
|
class="chakra-menu__menu-list css-s5t7bz"
|
||||||
id="menu-list-:r9:"
|
id="menu-list-:r8:"
|
||||||
role="menu"
|
role="menu"
|
||||||
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
style="transform-origin: var(--popper-transform-origin); opacity: 0; visibility: hidden; transform: scale(0.8) translateZ(0);"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
@ -656,7 +615,7 @@ exports[`Master Page should display master list and show details when master but
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
class="chakra-menu__menuitem css-y7jzs3"
|
class="chakra-menu__menuitem css-y7jzs3"
|
||||||
data-index="0"
|
data-index="0"
|
||||||
id="menu-list-:r9:-menuitem-:ra:"
|
id="menu-list-:r8:-menuitem-:r9:"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -25,6 +25,10 @@ exports[`Страница заказов должна корректно ото
|
|||||||
>
|
>
|
||||||
Заказы
|
Заказы
|
||||||
</a>
|
</a>
|
||||||
|
<hr
|
||||||
|
aria-orientation="vertical"
|
||||||
|
class="chakra-divider css-zw0v9u"
|
||||||
|
/>
|
||||||
<a
|
<a
|
||||||
class="chakra-button css-g11sl9"
|
class="chakra-button css-g11sl9"
|
||||||
data-testid="master-button"
|
data-testid="master-button"
|
||||||
@ -32,12 +36,6 @@ exports[`Страница заказов должна корректно ото
|
|||||||
>
|
>
|
||||||
Мастера
|
Мастера
|
||||||
</a>
|
</a>
|
||||||
<a
|
|
||||||
class="chakra-button css-g11sl9"
|
|
||||||
href="/auth/login"
|
|
||||||
>
|
|
||||||
Карта заказов
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@ -73,7 +71,7 @@ exports[`Страница заказов должна корректно ото
|
|||||||
<p
|
<p
|
||||||
class="chakra-text css-52ukzg"
|
class="chakra-text css-52ukzg"
|
||||||
>
|
>
|
||||||
17.03.2025
|
12.03.2025
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
class="chakra-button css-ez23ye"
|
class="chakra-button css-ez23ye"
|
||||||
@ -266,9 +264,13 @@ exports[`Страница заказов должна корректно ото
|
|||||||
<td
|
<td
|
||||||
class="css-zgoslk"
|
class="css-zgoslk"
|
||||||
>
|
>
|
||||||
<a
|
<button
|
||||||
|
aria-controls="popover-content-:r1:"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="dialog"
|
||||||
class="chakra-button css-ez23ye"
|
class="chakra-button css-ez23ye"
|
||||||
href="/auth/login/arm//auth/login?lat=55.78&lon=49.12¤tDate=Mon Mar 17 2025 20:55:45 GMT+0300 (Moscow Standard Time)"
|
id="popover-trigger-:r1:"
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
class="chakra-icon css-onkibi"
|
class="chakra-icon css-onkibi"
|
||||||
@ -288,7 +290,54 @@ exports[`Страница заказов должна корректно ото
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</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
|
||||||
@ -422,9 +471,13 @@ exports[`Страница заказов должна корректно ото
|
|||||||
<td
|
<td
|
||||||
class="css-zgoslk"
|
class="css-zgoslk"
|
||||||
>
|
>
|
||||||
<a
|
<button
|
||||||
|
aria-controls="popover-content-:r3:"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="dialog"
|
||||||
class="chakra-button css-ez23ye"
|
class="chakra-button css-ez23ye"
|
||||||
href="/auth/login/arm//auth/login?lat=55.78&lon=49.12¤tDate=Mon Mar 17 2025 20:55:45 GMT+0300 (Moscow Standard Time)"
|
id="popover-trigger-:r3:"
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
class="chakra-icon css-onkibi"
|
class="chakra-icon css-onkibi"
|
||||||
@ -444,7 +497,54 @@ exports[`Страница заказов должна корректно ото
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</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>
|
||||||
|
@ -20,7 +20,7 @@ import { store } from '../../__data__/store';
|
|||||||
import Page from '../arm';
|
import Page from '../arm';
|
||||||
|
|
||||||
const server = setupServer(
|
const server = setupServer(
|
||||||
http.post('/api/arm/masters/list', () => {
|
http.get('/api/arm/masters', () => {
|
||||||
return HttpResponse.json({
|
return HttpResponse.json({
|
||||||
success: true,
|
success: true,
|
||||||
body: [
|
body: [
|
||||||
|
@ -25,7 +25,7 @@ const server = setupServer(
|
|||||||
body: [],
|
body: [],
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
http.post('/api/arm/masters/list', () => {
|
http.get('/api/arm/masters', () => {
|
||||||
return HttpResponse.json({
|
return HttpResponse.json({
|
||||||
success: true,
|
success: true,
|
||||||
body: [],
|
body: [],
|
||||||
|
@ -24,7 +24,7 @@ const server = setupServer(
|
|||||||
http.post('/api/arm/orders', () => {
|
http.post('/api/arm/orders', () => {
|
||||||
return HttpResponse.json({}, { status: 500 });
|
return HttpResponse.json({}, { status: 500 });
|
||||||
}),
|
}),
|
||||||
http.post('/api/arm/masters/list', () => {
|
http.get('/api/arm/masters', () => {
|
||||||
return HttpResponse.json({
|
return HttpResponse.json({
|
||||||
success: true,
|
success: true,
|
||||||
body: [
|
body: [
|
||||||
|
@ -55,7 +55,7 @@ const server = setupServer(
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
http.post('/api/arm/masters/list', () => {
|
http.get('/api/arm/masters', () => {
|
||||||
return HttpResponse.json({
|
return HttpResponse.json({
|
||||||
success: true,
|
success: true,
|
||||||
body: [
|
body: [
|
||||||
|
@ -74,7 +74,7 @@ const Page: FC = () => {
|
|||||||
<VStack
|
<VStack
|
||||||
p={4}
|
p={4}
|
||||||
alignItems='flex-start'
|
alignItems='flex-start'
|
||||||
gap={6}
|
gap={4}
|
||||||
data-testid='order-details'
|
data-testid='order-details'
|
||||||
>
|
>
|
||||||
<OrderDetails
|
<OrderDetails
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
const getCoordinates = (location: string) => {
|
|
||||||
if (!location) return {};
|
|
||||||
|
|
||||||
const [lat, lon] = location
|
|
||||||
.split(',')
|
|
||||||
.map((coord) => parseFloat(coord.trim()));
|
|
||||||
|
|
||||||
if (isNaN(lat) || isNaN(lon)) return {};
|
|
||||||
|
|
||||||
return { lat, lon };
|
|
||||||
};
|
|
||||||
|
|
||||||
export default getCoordinates;
|
|
@ -13,7 +13,7 @@ const sleep =
|
|||||||
|
|
||||||
router.use(sleep());
|
router.use(sleep());
|
||||||
|
|
||||||
router.post('/arm/masters/list', (req, res) => {
|
router.get('/arm/masters', (req, res) => {
|
||||||
res
|
res
|
||||||
.status(/error/.test(STUBS.masters) ? 500 : 200)
|
.status(/error/.test(STUBS.masters) ? 500 : 200)
|
||||||
.send(
|
.send(
|
||||||
@ -108,7 +108,9 @@ router.post('/order/:orderId/upload-car-img', (req, res) => {
|
|||||||
.send(require(`../json/landing-order-car-image-upload/${stubName}.json`));
|
.send(require(`../json/landing-order-car-image-upload/${stubName}.json`));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
res.status(500).send(commonError);
|
res
|
||||||
|
.status(500)
|
||||||
|
.send(commonError);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,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": "55.75060416346278,48.746329576898944 Республика Татарстан (Татарстан), Верхнеуслонский район, Иннополис",
|
"location": "55.779905316526424,49.12446113769528 Республика Татарстан (Татарстан), Казань, озеро Нижний Кабан",
|
||||||
"master": [],
|
"master": [],
|
||||||
"notes": ""
|
"notes": ""
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user