This commit is contained in:
Андрей Дувакин 2024-10-08 10:22:47 +05:00
parent 644653c08d
commit 047eb73f23
2 changed files with 15 additions and 9 deletions

View File

@ -6,7 +6,7 @@
}
.content-container {
max-width: 800px;
max-width: 900px;
width: 100%;
text-align: left;
}

View File

@ -43,7 +43,6 @@ const DeliveryOrderDetails = () => {
useEffect(() => {
fetchDeliveryOrder();
fetchDeliveryAccessories();
fetchTotalOrder();
}, [deliveryOrderId]);
const formatDuration = (minutes) => {
@ -62,14 +61,17 @@ const DeliveryOrderDetails = () => {
try {
const order = await getDeliveryOrder(deliveryOrderId);
setDeliveryOrder(order);
if (order) {
fetchTotalOrder(order.total_order_id);
}
} catch (error) {
console.error("Ошибка при загрузке deliveryOrder:", error);
}
};
const fetchTotalOrder = async () => {
const fetchTotalOrder = async (orderId) => {
try {
const order = await getTotalOrder(deliveryOrder.id);
const order = await getTotalOrder(orderId);
setTotalOrder(order);
} catch (error) {
if (error.response && error.response.status === 401) {
@ -90,6 +92,7 @@ const DeliveryOrderDetails = () => {
setTruckCapacity(deliveryOrderDetails.truck_capacity);
const accessories = await getDeliveryAccessories(deliveryOrderId);
console.log(accessories);
setDeliveryAccessories(accessories);
const coords = await Promise.all(
@ -201,7 +204,6 @@ const DeliveryOrderDetails = () => {
<td>
{truckName}
<br />
<br />
Грузоподъемность: {truckCapacity}кг
</td>
<td>{truckCount}</td>
@ -225,13 +227,13 @@ const DeliveryOrderDetails = () => {
<h2 style={{ textAlign: "center" }}>Маршрут</h2>
<table className="table table-bordered mb-5">
<table className="table table-bordered table-striped mb-5">
<thead>
<tr>
<th scope="col">Город</th>
<th scope="col">Комплектующие</th>
<th scope="col">Количество, шт.</th>
<th scope="col">Объем, куб. м</th>
<th scope="col">Объем, шт.</th>
<th scope="col">Вес, кг</th>
</tr>
</thead>
<tbody>
@ -239,12 +241,16 @@ const DeliveryOrderDetails = () => {
<tr key={accessory.id}>
<td>{accessory.city_name}</td>
<td>{accessory.accessory_name}</td>
<td>{accessory.count}</td>
<td>
{Math.round(
(accessory.accessory_volume * accessory.count) / 100
)}
</td>
<td>
{Math.round(
(accessory.accessory_weight * accessory.count) / 100
)}
</td>
</tr>
))}
<tr>