Commit 995edcbc authored by Darrick Yong's avatar Darrick Yong

fix itemPrice type and add order detail table

parent 1e617d45
...@@ -128,30 +128,48 @@ ...@@ -128,30 +128,48 @@
overflow: hidden; overflow: hidden;
padding: 20px 50px; padding: 20px 50px;
box-sizing: border-box; box-sizing: border-box;
overflow: scroll;
/* background: white; */ /* background: white; */
} }
.animate { .animate {
transition: max-height 1s ease-out; transition: max-height 0.75s ease-in-out;
max-height: 200px; max-height: 400px;
} }
.order-details-header { .order-details-header {
padding: 4px 0; padding: 4px 0;
font-size: 20px; font-size: 20px;
font-weight: 700; font-weight: 700;
border-bottom: 1px solid red; border-bottom: 2px solid black;
} }
.order-detail-table { .order-detail-table {
/* margin: 20px; */ margin: 15px;
/* border-spacing: 30px; */
} }
.order-detail-table thead {
.order-details thead {
font-weight: 700; font-weight: 700;
border-bottom: 1px solid black;
}
.order-detail-table th,
.order-detail-table td {
padding: 5px 20px;
} }
.item-detail ~ .item-detail { .item-detail ~ .item-detail {
border-top: 1px solid red; /* border-top: 1px solid red; */
} }
.item-sku, .item-qty {
text-align: center;
}
.item-price {
text-align: end;
}
.order-detail-table th ~ th,
.order-detail-table td ~ td {
border-left: 1px solid black;
}
\ No newline at end of file
...@@ -4,15 +4,15 @@ const ItemDetails = ({ item }) => { ...@@ -4,15 +4,15 @@ const ItemDetails = ({ item }) => {
return ( return (
<tr className="item-detail"> <tr className="item-detail">
<th>{itemSku}</th> <td className="item-sku">{itemSku}</td>
<th>{itemName}</th> <td className="item-name">{itemName}</td>
<th>{`$${itemPrice}`}</th> <td className="item-qty">{itemQuantity}</td>
<th>{itemQuantity}</th> <td className="item-price">{`$${itemPrice.toFixed(2)}`}</td>
</tr> </tr>
// <li className="item-detail"> // <li className="item-detail">
// {`${itemName} -- x ${itemQuantity} bought at ${itemPrice}/ea.`} // {`${itemName} -- x ${itemQuantity} bought at ${itemPrice}/ea.`}
// </li> // </li>
) );
} }
export default ItemDetails; export default ItemDetails;
\ No newline at end of file
...@@ -5,18 +5,14 @@ const OrderDetails = ({ order, showDetails }) => { ...@@ -5,18 +5,14 @@ const OrderDetails = ({ order, showDetails }) => {
return ( return (
<div className={`order-details ${showDetails ? "animate" : ""}`}> <div className={`order-details ${showDetails ? "animate" : ""}`}>
<div className="order-details-container"> <div className="order-details-container">
{`Warehouse Order #: ${order.id}`} <div className="order-details-header">Order Details:</div>
<div className="order-details-header">
Order Details
</div>
<table className="order-detail-table"> <table className="order-detail-table">
<thead> <thead>
<tr> <tr>
<th>SKU #</th> <th>SKU #</th>
<th>Name</th> <th>Name</th>
<th>Price</th>
<th>Quantity</th> <th>Quantity</th>
<th>Price</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -25,6 +21,7 @@ const OrderDetails = ({ order, showDetails }) => { ...@@ -25,6 +21,7 @@ const OrderDetails = ({ order, showDetails }) => {
))} ))}
</tbody> </tbody>
</table> </table>
{`Warehouse Order #: ${order.id}`}
</div> </div>
</div> </div>
); );
......
...@@ -5,6 +5,7 @@ import com.ascendfinalproject.warehouse.models.WarehouseOrder; ...@@ -5,6 +5,7 @@ import com.ascendfinalproject.warehouse.models.WarehouseOrder;
import com.ascendfinalproject.warehouse.services.WarehouseOrderService; import com.ascendfinalproject.warehouse.services.WarehouseOrderService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
...@@ -16,12 +17,6 @@ public class WarehouseController { ...@@ -16,12 +17,6 @@ public class WarehouseController {
@Autowired @Autowired
WarehouseOrderService orderService; WarehouseOrderService orderService;
// @CrossOrigin
// @GetMapping(value = "/orders")
// public Mono<OrderResponse> getOrders() throws InterruptedException {
// return orderService.getOrders();
// }
//
@CrossOrigin @CrossOrigin
@GetMapping(value = "/orders") @GetMapping(value = "/orders")
public Flux<WarehouseOrder> getOrders() { public Flux<WarehouseOrder> getOrders() {
......
...@@ -12,10 +12,10 @@ public class Item { ...@@ -12,10 +12,10 @@ public class Item {
private String itemId; private String itemId;
private String itemName; private String itemName;
private int itemQuantity; private int itemQuantity;
private int itemPrice; private double itemPrice;
private int itemSku; private int itemSku;
public Item(String itemId, String itemName, int itemQuantity, int itemPrice, int itemSku) { public Item(String itemId, String itemName, int itemQuantity, double itemPrice, int itemSku) {
this.itemId = itemId; this.itemId = itemId;
this.itemName = itemName; this.itemName = itemName;
this.itemQuantity = itemQuantity; this.itemQuantity = itemQuantity;
......
...@@ -25,26 +25,6 @@ public class WarehouseOrderService { ...@@ -25,26 +25,6 @@ public class WarehouseOrderService {
return orderRepository.findById(id); return orderRepository.findById(id);
} }
// public Mono<OrderResponse> getOrders() throws InterruptedException {
// add ResponseEntity
// return orderRepository.findAll();
// OrderResponse res = new OrderResponse();
// Flux<WarehouseOrder> warehouseOrderFlux = orderRepository.findAll().log().map(order -> {
// res.addOrder(order);
// res.appendId(order.getId());
// return order;
// });
// Mono<ResponseEntity<OrderResponse>>
// return warehouseOrderFlux.doOnComplete(() -> Mono.just(res));
// return warehouseOrderFlux.next().map(wareHouse -> res)
// .doOnSuccess(subscription -> Mono.just(res));
//
//
// System.out.println("-----");
// System.out.println(res);
// Thread.sleep(2000);
// return Mono.just(res);
// }
public Flux<WarehouseOrder> getOrders() { public Flux<WarehouseOrder> getOrders() {
return orderRepository.findAll(); return orderRepository.findAll();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment