Compare commits
25 Commits
fix/arm-or
...
feature/ma
| Author | SHA1 | Date | |
|---|---|---|---|
| fea4a54c83 | |||
| 9349a41f84 | |||
| 8103fdcb56 | |||
| a59864a3e2 | |||
| a252301ea0 | |||
| 48cdfb92bd | |||
|
|
351420bc62 | ||
|
|
61b042eee6 | ||
|
|
ac006267a2 | ||
|
|
63d9d069c0 | ||
| c83ebf02bc | |||
|
|
1968df7bb3 | ||
|
|
811e0e3f24 | ||
| a2ffd6f38f | |||
|
|
20017cad3c | ||
|
|
de54ac6669 | ||
|
|
eda869622e | ||
|
|
7b3889aa02 | ||
|
|
cee124fca5 | ||
|
|
b77eccc8e8 | ||
|
|
ebfaa7ea8f | ||
|
|
0027cc09b1 | ||
|
|
dd612d662c | ||
|
|
69251745fa | ||
|
|
253e3b3856 |
@@ -16,21 +16,27 @@ 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: {
|
||||||
'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": {
|
'order-view-status-polling': {
|
||||||
"on": true,
|
on: true,
|
||||||
"value": "3000",
|
value: '3000',
|
||||||
"key": "order-view-status-polling"
|
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',
|
||||||
},
|
},
|
||||||
"car-img-upload": {
|
|
||||||
"on": true,
|
|
||||||
"value": "true",
|
|
||||||
"key": "car-img-upload"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
|
|||||||
@@ -111,5 +111,8 @@
|
|||||||
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,5 +117,8 @@
|
|||||||
"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.9.1",
|
"version": "0.9.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dry-wash",
|
"name": "dry-wash",
|
||||||
"version": "0.9.1",
|
"version": "0.9.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.26.7",
|
"@babel/core": "^7.26.7",
|
||||||
@@ -3610,7 +3610,6 @@
|
|||||||
"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.9.1",
|
"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": {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
|
|||||||
import { BaseResponse } from '../../models/api';
|
import { BaseResponse } from '../../models/api';
|
||||||
|
|
||||||
export const extractBodyFromResponse = <Body>(response: BaseResponse<Body>) => {
|
export const extractBodyFromResponse = <Body>(response: BaseResponse<Body>) => {
|
||||||
|
console.log('response', response);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
return response.body;
|
return response.body;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,18 @@ 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')),
|
||||||
|
|||||||
@@ -42,6 +42,18 @@ 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'}
|
||||||
|
data-testid='master-button'
|
||||||
|
>
|
||||||
|
Карта заказов
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</HStack>
|
</HStack>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ 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;
|
||||||
@@ -28,6 +29,9 @@ 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>
|
||||||
|
|||||||
82
src/components/Map/Map.tsx
Normal file
82
src/components/Map/Map.tsx
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import React, { useMemo } 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 { useGetOrdersQuery } from '../../__data__/service/api';
|
||||||
|
import getCoordinates from '../../utils/getCoordinates';
|
||||||
|
|
||||||
|
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 = useMemo(
|
||||||
|
() =>
|
||||||
|
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>
|
||||||
|
|
||||||
|
{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
src/components/Map/index.ts
Normal file
1
src/components/Map/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './Map';
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
import React, { ChangeEvent, useState } from 'react';
|
import React, { ChangeEvent, useState } from 'react';
|
||||||
import { Td, Tr, Link, Select } from '@chakra-ui/react';
|
import { Td, Tr, Link, Select, Button } 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 PopoverTemplate from '../PopoverTemplate';
|
import getCoordinates from '../../utils/getCoordinates';
|
||||||
|
import { URLs } from '../../__data__/urls';
|
||||||
|
|
||||||
const statusColors: Record<Status, string> = {
|
const statusColors: Record<Status, string> = {
|
||||||
pending: 'yellow.100',
|
pending: 'yellow.100',
|
||||||
@@ -27,6 +29,7 @@ const OrderItem = ({
|
|||||||
master,
|
master,
|
||||||
allMasters,
|
allMasters,
|
||||||
id,
|
id,
|
||||||
|
currentDate,
|
||||||
}: OrderArm) => {
|
}: OrderArm) => {
|
||||||
const [updateOrders] = useUpdateOrdersMutation();
|
const [updateOrders] = useUpdateOrdersMutation();
|
||||||
const { t } = useTranslation('~', {
|
const { t } = useTranslation('~', {
|
||||||
@@ -61,6 +64,8 @@ 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>
|
||||||
@@ -99,7 +104,12 @@ const OrderItem = ({
|
|||||||
<Link href='tel:'>{phone}</Link>
|
<Link href='tel:'>{phone}</Link>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<PopoverTemplate trigger={<ViewIcon />} description={location} />
|
<Button
|
||||||
|
as={LinkRouter}
|
||||||
|
to={URLs.armMap.getUrl({ lat, lon, currentDate })}
|
||||||
|
>
|
||||||
|
<ViewIcon />
|
||||||
|
</Button>
|
||||||
</Td>
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ const Orders = () => {
|
|||||||
key={index}
|
key={index}
|
||||||
{...order}
|
{...order}
|
||||||
status={order.status as OrderArm['status']}
|
status={order.status as OrderArm['status']}
|
||||||
|
currentDate={currentDate}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Tbody>
|
</Tbody>
|
||||||
|
|||||||
48
src/components/PriceCar/PriceCar.tsx
Normal file
48
src/components/PriceCar/PriceCar.tsx
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import { Box, Image, Progress, Text } from '@chakra-ui/react';
|
||||||
|
import React from 'react';
|
||||||
|
import { getFeatures } from '@brojs/cli';
|
||||||
|
|
||||||
|
const PRICE_INCREASE_PERCENT_PER_RATING = 10; // 10% за каждый балл
|
||||||
|
|
||||||
|
export const PriceCar = ({ image, rating }) => {
|
||||||
|
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 washPrice = calculateWashPrice(rating);
|
||||||
|
const progressValue = (rating / 10) * 100;
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
alignItems='center'
|
||||||
|
gap={5}
|
||||||
|
width='100%'
|
||||||
|
display='flex'
|
||||||
|
flexDirection='column'
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
maxWidth='600px'
|
||||||
|
objectFit='contain'
|
||||||
|
borderRadius='md'
|
||||||
|
src={image}
|
||||||
|
alt='Car Image'
|
||||||
|
/>
|
||||||
|
{rating ? (
|
||||||
|
<Box width='100%' maxW='600px'>
|
||||||
|
<Text>Рейтинг загрязнения машины:</Text>
|
||||||
|
<Progress value={progressValue} size='sm' colorScheme='red' mt={2} />
|
||||||
|
<Text mt={2}>Стоимость мойки: {washPrice.toFixed(2)} руб.</Text>
|
||||||
|
</Box>
|
||||||
|
) : (
|
||||||
|
<Text>Не удалость определить уровень загрязнения машины</Text>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PriceCar;
|
||||||
1
src/components/PriceCar/index.ts
Normal file
1
src/components/PriceCar/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './PriceCar';
|
||||||
@@ -56,4 +56,5 @@ export type OrderArm = {
|
|||||||
notes: '';
|
notes: '';
|
||||||
allMasters: Master[];
|
allMasters: Master[];
|
||||||
id: string;
|
id: string;
|
||||||
|
currentDate: Date;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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;
|
||||||
},
|
};
|
||||||
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;
|
||||||
@@ -36,10 +37,12 @@ export type View = {
|
|||||||
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;
|
||||||
|
};
|
||||||
|
|||||||
@@ -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}
|
||||||
@@ -81,9 +87,17 @@ const Page: FC = () => {
|
|||||||
location={order.location}
|
location={order.location}
|
||||||
startWashTime={order.startWashTime}
|
startWashTime={order.startWashTime}
|
||||||
endWashTime={order.endWashTime}
|
endWashTime={order.endWashTime}
|
||||||
created={order.created}
|
created={order.created}
|
||||||
/>
|
/>
|
||||||
{FEATURE.carImageUpload.isOn && <CarImageForm orderId={orderId} />}
|
{FEATURE.carImageUpload.isOn && (
|
||||||
|
<CarImageForm orderId={orderId} />
|
||||||
|
)}
|
||||||
|
{FEATURE.carImageUpload.isOn && order.image && (
|
||||||
|
<PriceCar
|
||||||
|
image={order?.image}
|
||||||
|
rating={order?.imageRating}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
13
src/utils/getCoordinates.ts
Normal file
13
src/utils/getCoordinates.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const getCoordinates = (location: string) => {
|
||||||
|
if (!location) return null;
|
||||||
|
|
||||||
|
const [lat, lon] = location
|
||||||
|
.split(',')
|
||||||
|
.map((coord) => parseFloat(coord.trim()));
|
||||||
|
|
||||||
|
if (isNaN(lat) || isNaN(lon)) return null;
|
||||||
|
|
||||||
|
return { lat, lon };
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getCoordinates;
|
||||||
@@ -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.779905316526424,49.12446113769528 Республика Татарстан (Татарстан), Казань, озеро Нижний Кабан",
|
"location": "55.75060416346278,48.746329576898944 Республика Татарстан (Татарстан), Верхнеуслонский район, Иннополис",
|
||||||
"master": [],
|
"master": [],
|
||||||
"notes": ""
|
"notes": ""
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -15,4 +15,4 @@
|
|||||||
"updated": "2025-01-19T14:04:02.987Z",
|
"updated": "2025-01-19T14:04:02.987Z",
|
||||||
"id": "id1"
|
"id": "id1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user