diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomerOrderController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomerOrderController.java index fdc4275..5adc9e1 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomerOrderController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/CustomerOrderController.java @@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; @@ -25,7 +26,13 @@ public class CustomerOrderController { } @GetMapping("/{id}") - public String internCustomerOrdersId() { + public String internCustomerOrdersId(Model model, + @PathVariable("id") String id + ) { + CustomerOrder order = customerOrderRepository.findById(Long.parseLong(id)).get(); + + model.addAttribute("order", order); + return "intern/customerOrders/id"; } } diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java index 1b20bb2..7321ed9 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java @@ -43,4 +43,9 @@ public class CustomerOrder { public int totalNetCent; public int totalGrossCent; public int totalVatCent; + + public String getEstimatedArrival() { + //TODO: get estimated arrival from api + return "TODO TODO TODO"; + } } diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrderPosition.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrderPosition.java index dbe53f7..2569158 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrderPosition.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrderPosition.java @@ -19,4 +19,8 @@ public class CustomerOrderPosition { public int pricePerUnit; public int quantity; + + public int getSumPrice(){ + return article.getPriceGross() * quantity; + } } diff --git a/prototype/src/main/resources/templates/intern/customerOrders/id.html b/prototype/src/main/resources/templates/intern/customerOrders/id.html index c7e837f..c31c2de 100644 --- a/prototype/src/main/resources/templates/intern/customerOrders/id.html +++ b/prototype/src/main/resources/templates/intern/customerOrders/id.html @@ -15,7 +15,7 @@