This commit is contained in:
Андрей Дувакин 2024-10-08 10:31:02 +05:00
parent 4a3ff92504
commit 2e6a760e40
3 changed files with 10 additions and 2 deletions

View File

@ -52,6 +52,13 @@ const DeliveryOrdersList = ({
return (minutes / 60).toFixed(2) + " час."; return (minutes / 60).toFixed(2) + " час.";
}; };
const formatPrice = (price) => {
if (!price) {
return "не указана";
}
return `${Math.round(price)}`;
};
const calculateRoutes = async () => { const calculateRoutes = async () => {
const ordersToCalculate = deliveryOrders.filter( const ordersToCalculate = deliveryOrders.filter(
(order) => !order.estimated_route_time_in_minutes (order) => !order.estimated_route_time_in_minutes
@ -161,6 +168,7 @@ const DeliveryOrdersList = ({
Прогнозируемое время этапа:{" "} Прогнозируемое время этапа:{" "}
{formatTimeInHours(order.estimated_route_time_in_minutes)} {formatTimeInHours(order.estimated_route_time_in_minutes)}
</p> </p>
<p>Стоимость: {formatPrice(order.price)} </p>
{calculatingRoutes.includes(order.id) && ( {calculatingRoutes.includes(order.id) && (
<div className="spinner-border" role="status"> <div className="spinner-border" role="status">
<span className="visually-hidden"></span> <span className="visually-hidden"></span>

View File

@ -207,7 +207,7 @@ const DeliveryOrderDetails = () => {
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{totalCost} руб.</td> <td>{totalCost} </td>
<td> <td>
{truckName} {truckName}
<br /> <br />

View File

@ -132,7 +132,7 @@ const Home = () => {
<td>{order.status_name || "Неизвестный статус"}</td> <td>{order.status_name || "Неизвестный статус"}</td>
<td>{order.count_robots}</td> <td>{order.count_robots}</td>
<td>{deliveryOrdersCount || 0}</td> <td>{deliveryOrdersCount || 0}</td>
<td>{order.price || 0} руб.</td> <td>{order.price || 0} </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>