._.
This commit is contained in:
parent
e7c0164313
commit
2380c63f6a
@ -46,6 +46,18 @@ const DeliveryOrderDetails = () => {
|
|||||||
fetchTotalOrder();
|
fetchTotalOrder();
|
||||||
}, [deliveryOrderId]);
|
}, [deliveryOrderId]);
|
||||||
|
|
||||||
|
const formatDuration = (minutes) => {
|
||||||
|
const days = Math.floor(minutes / (24 * 60));
|
||||||
|
const hours = Math.floor((minutes % (24 * 60)) / 60);
|
||||||
|
const remainingMinutes = Math.floor(minutes % 60);
|
||||||
|
|
||||||
|
return {
|
||||||
|
days,
|
||||||
|
hours,
|
||||||
|
minutes: remainingMinutes,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const fetchDeliveryOrder = async () => {
|
const fetchDeliveryOrder = async () => {
|
||||||
try {
|
try {
|
||||||
const order = await getDeliveryOrder(deliveryOrderId);
|
const order = await getDeliveryOrder(deliveryOrderId);
|
||||||
@ -177,8 +189,16 @@ const DeliveryOrderDetails = () => {
|
|||||||
</td>
|
</td>
|
||||||
<td>{truckCount}</td>
|
<td>{truckCount}</td>
|
||||||
<td>
|
<td>
|
||||||
{Math.round(deliveryOrder?.estimated_route_time_in_minutes)}{" "}
|
{deliveryOrder?.estimated_route_time_in_minutes && (
|
||||||
мин.
|
<>
|
||||||
|
{(() => {
|
||||||
|
const { days, hours, minutes } = formatDuration(
|
||||||
|
deliveryOrder?.estimated_route_time_in_minutes
|
||||||
|
);
|
||||||
|
return `${days} дн. ${hours} ч.`;
|
||||||
|
})()}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user