This commit is contained in:
Андрей Дувакин 2024-10-08 08:26:34 +05:00
parent e0e79b9337
commit 19aa7fdf4d
3 changed files with 18 additions and 9 deletions

View File

@ -34,6 +34,7 @@ const DeliveryOrderDetails = () => {
const [totalCost, setTotalCost] = useState(0); const [totalCost, setTotalCost] = useState(0);
const [truckCount, setTruckCount] = useState(0); const [truckCount, setTruckCount] = useState(0);
const [truckName, setTruckName] = useState(""); const [truckName, setTruckName] = useState("");
const [truckCapacity, setTruckCapacity] = useState("");
const [totalOrder, setTotalOrder] = useState(null); const [totalOrder, setTotalOrder] = useState(null);
const [deliveryOrder, setDeliveryOrder] = useState(null); const [deliveryOrder, setDeliveryOrder] = useState(null);
const navigate = useNavigate(); const navigate = useNavigate();
@ -73,6 +74,7 @@ const DeliveryOrderDetails = () => {
setTotalCost(Math.round(deliveryOrderDetails.price)); setTotalCost(Math.round(deliveryOrderDetails.price));
setTruckCount(deliveryOrderDetails.count_trucks); setTruckCount(deliveryOrderDetails.count_trucks);
setTruckName(deliveryOrderDetails.truck_name); setTruckName(deliveryOrderDetails.truck_name);
setTruckCapacity(deliveryOrderDetails.truck_capacity);
const accessories = await getDeliveryAccessories(deliveryOrderId); const accessories = await getDeliveryAccessories(deliveryOrderId);
setDeliveryAccessories(accessories); setDeliveryAccessories(accessories);
@ -164,7 +166,11 @@ const DeliveryOrderDetails = () => {
<tbody> <tbody>
<tr> <tr>
<td>{totalCost} руб.</td> <td>{totalCost} руб.</td>
<td>{truckName}</td> <td>
{truckName}
<br />
Грузоподъемность: {truckCapacity}кг
</td>
<td>{truckCount}</td> <td>{truckCount}</td>
</tr> </tr>
</tbody> </tbody>
@ -177,8 +183,8 @@ const DeliveryOrderDetails = () => {
<tr> <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>
<th scope="col">Объем</th> <th scope="col">Объем, м^3</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -186,8 +192,12 @@ const DeliveryOrderDetails = () => {
<tr key={accessory.id}> <tr key={accessory.id}>
<td>{accessory.city_name}</td> <td>{accessory.city_name}</td>
<td>{accessory.accessory_name}</td> <td>{accessory.accessory_name}</td>
<td>{(accessory.count)}</td> <td>{accessory.count}</td>
<td>{accessory.volume}</td> <td>
{Math.round(
(accessory.accessory_volume * accessory.count) / 100
)}
</td>
</tr> </tr>
))} ))}
<tr> <tr>

View File

@ -126,8 +126,7 @@ const Home = () => {
<strong>Количество роботов:</strong> {order.count_robots} <strong>Количество роботов:</strong> {order.count_robots}
</p> </p>
<p> <p>
<strong>Количество этапов:</strong>{" "} <strong>Количество этапов:</strong> {deliveryOrdersCount || 0}
{deliveryOrdersCount || 0}
</p> </p>
<DeliveryOrdersList <DeliveryOrdersList

View File

@ -107,13 +107,13 @@ const Trucks = () => {
/> />
</div> </div>
<div className="form-group"> <div className="form-group">
<label htmlFor="truckCapacity">Грузоподъемность, тонны</label> <label htmlFor="truckCapacity">Грузоподъемность, кг</label>
<input <input
type="number" type="number"
className="form-control" className="form-control"
id="truckCapacity" id="truckCapacity"
name="capacity" name="capacity"
placeholder="Введите грузоподъемность в тоннах" placeholder="Введите грузоподъемность в килограммах"
value={newTruck.capacity} value={newTruck.capacity}
onChange={handleInputChange} onChange={handleInputChange}
min={1} min={1}