._.
This commit is contained in:
parent
2931de97ef
commit
479ae99384
35
src/pages/DeliveryOrderDetails.css
Normal file
35
src/pages/DeliveryOrderDetails.css
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
.delivery-order-details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-container {
|
||||||
|
max-width: 800px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-list {
|
||||||
|
list-style-type: decimal;
|
||||||
|
padding: 0;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-item {
|
||||||
|
margin: 10px 0;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.city-info {
|
||||||
|
display: block;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ import {
|
|||||||
Polyline,
|
Polyline,
|
||||||
} from "react-leaflet";
|
} from "react-leaflet";
|
||||||
import polyline from "@mapbox/polyline";
|
import polyline from "@mapbox/polyline";
|
||||||
|
import "./DeliveryOrderDetails.css";
|
||||||
|
|
||||||
const DeliveryOrderDetails = () => {
|
const DeliveryOrderDetails = () => {
|
||||||
const { id: deliveryOrderId } = useParams();
|
const { id: deliveryOrderId } = useParams();
|
||||||
@ -58,31 +59,34 @@ const DeliveryOrderDetails = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className="delivery-order-details">
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="spinner-border" role="status">
|
<div className="spinner-border" role="status">
|
||||||
<span className="visually-hidden">Загрузка доставок...</span>
|
<span className="visually-hidden">Загрузка...</span>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div className="content-container">
|
||||||
<ul>
|
<ol className="city-list">
|
||||||
{deliveryAccessories.map((accessory) => {
|
{deliveryAccessories.map((accessory) => {
|
||||||
const coord = coordinates.find(
|
const coord = coordinates.find(
|
||||||
(c) => c.city === accessory.city_name
|
(c) => c.city === accessory.city_name
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<li key={accessory.id}>
|
<li key={accessory.id} className="city-item">
|
||||||
Доставка: {accessory.name} (Город: {accessory.city_name},
|
<strong>Доставка:</strong> {accessory.name}
|
||||||
Координаты:{" "}
|
<span className="city-info">
|
||||||
|
(Город: {accessory.city_name}, Координаты:{" "}
|
||||||
{coord
|
{coord
|
||||||
? `${coord.latitude}, ${coord.longitude}`
|
? `${coord.latitude}, ${coord.longitude}`
|
||||||
: "Не найдены"}
|
: "Не найдены"}
|
||||||
)
|
)
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ol>
|
||||||
{coordinates.length > 0 && (
|
{coordinates.length > 0 && (
|
||||||
|
<div className="map-container">
|
||||||
<MapContainer
|
<MapContainer
|
||||||
center={[coordinates[0].latitude, coordinates[0].longitude]}
|
center={[coordinates[0].latitude, coordinates[0].longitude]}
|
||||||
zoom={5}
|
zoom={5}
|
||||||
@ -100,8 +104,11 @@ const DeliveryOrderDetails = () => {
|
|||||||
<Popup>{coord.city}</Popup>
|
<Popup>{coord.city}</Popup>
|
||||||
</Marker>
|
</Marker>
|
||||||
))}
|
))}
|
||||||
{route.length > 0 && <Polyline positions={route} color="blue" />}
|
{route.length > 0 && (
|
||||||
|
<Polyline positions={route} color="blue" />
|
||||||
|
)}
|
||||||
</MapContainer>
|
</MapContainer>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user