implement getCustomerOrderDetail
This commit is contained in:
		@ -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";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -19,4 +19,8 @@ public class CustomerOrderPosition {
 | 
			
		||||
 | 
			
		||||
    public int pricePerUnit;
 | 
			
		||||
    public int quantity;
 | 
			
		||||
 | 
			
		||||
    public int getSumPrice(){
 | 
			
		||||
        return article.getPriceGross() * quantity;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,7 @@
 | 
			
		||||
<div class="sidebar-layout content-width">
 | 
			
		||||
    <nav></nav>
 | 
			
		||||
    <div>
 | 
			
		||||
        <h1>Bestellung 1010</h1>
 | 
			
		||||
        <h1 th:text="|Bestellung ${order.id}|"></h1>
 | 
			
		||||
 | 
			
		||||
        <script th:src="@{/js/back.js}"></script>
 | 
			
		||||
        <div class="back" data-group="intern" data-insert="true"></div>
 | 
			
		||||
@ -25,33 +25,25 @@
 | 
			
		||||
    <nav th:replace="fragments/intern :: sidebar"></nav>
 | 
			
		||||
    <div class="content-width">
 | 
			
		||||
        <div>
 | 
			
		||||
            <h2 id="20202701"> Bestellung vom 27.01.2020 </h2>
 | 
			
		||||
            <h2 th:text="| Bestellung vom ${order.created.toString().substring(0,10)}"></h2>
 | 
			
		||||
            <div>
 | 
			
		||||
                <table class="key-value">
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>Nutzer</th>
 | 
			
		||||
                        <td><a th:href="@{/intern/customers/498}">K-4850</a></td>
 | 
			
		||||
                        <td><a th:href="@{/intern/customers/{id}(id=${order.customer.id})}" th:text="${order.customer.id}"></a></td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>Lieferstatus</th>
 | 
			
		||||
                        <td><b>Unterwegs</b> <br/> Vorraussichtliche Ankunft: 29.01.2020</td>
 | 
			
		||||
                        <td  th:if="${order.deliveredAt == null}"><b>Unterwegs</b> <br/> Vorraussichtliche Ankunft: <span th:text="${order.getEstimatedArrival()}" /></td>
 | 
			
		||||
                        <td  th:if="${order.deliveredAt != null}"><b>Angekommen</b> <br/> Ankunft: <span th:text="${order.deliveredAt.toString().substring(0,10)}" /></td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>Sendeverfolgungsnummer</th>
 | 
			
		||||
                        <td>XE51451436DE</td>
 | 
			
		||||
                        <td th:text="${order.trackingId}"></td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th></th>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            Hans Maier <br/>
 | 
			
		||||
                            Hauptstraße 12<br/>
 | 
			
		||||
                            74880 Musterstadt<br/>
 | 
			
		||||
                            Deutschland <br/>
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th>Eingelösste Bonuspunkte</th>
 | 
			
		||||
                        <td>10</td>
 | 
			
		||||
                        <td th:text="${order.destination.toString()}"></td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                </table>
 | 
			
		||||
            </div>
 | 
			
		||||
@ -62,17 +54,11 @@
 | 
			
		||||
                    <th>Menge</th>
 | 
			
		||||
                    <th>Preis (Brutto)</th>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-1.jpg}" class="s"/><a></td>
 | 
			
		||||
                    <td><a th:href="@{/shop/articles/4151}">Kamera<a/></td>
 | 
			
		||||
                    <td> 1</td>
 | 
			
		||||
                    <td>100,50 EUR</td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td><a th:href="@{/shop/articles/4151}"><img th:src="@{/img/product-2.jpg}" class="s"/><a/></td>
 | 
			
		||||
                    <td><a th:href="@{/shop/articles/4151}">Earbuds<a/></td>
 | 
			
		||||
                    <td> 3</td>
 | 
			
		||||
                    <td>63,95 EUR</td>
 | 
			
		||||
                <tr th:each="position: ${order.positions}">
 | 
			
		||||
                    <td><a th:href="@{/shop/articles/{id}(id = ${position.article.id})}"><img th:src="@{/shop/articles/{id}/image.jpg(id=${position.article.id})}" class="s"/></a></td>
 | 
			
		||||
                    <td><a th:href="@{/shop/articles/{id}(id = ${position.article.id})}" th:text="${position.article.title}" class="s"></a></td>
 | 
			
		||||
                    <td th:text="${position.quantity}" />
 | 
			
		||||
                    <td th:text="${#numbers.formatDecimal(position.getSumPrice() * 0.01, 1, 'POINT', 2, 'COMMA')}" />
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <th></th>
 | 
			
		||||
@ -84,28 +70,22 @@
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td>Artikel (Netto)</td>
 | 
			
		||||
                    <td> 120,00 EUR</td>
 | 
			
		||||
                    <td th:text="${#numbers.formatDecimal(order.totalNetCent * 0.01, 1, 'POINT', 2, 'COMMA')}" />
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td>Bonuspunkte</td>
 | 
			
		||||
                    <td> 5,00 EUR</td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td>Umsatzsteuer (19%)</td>
 | 
			
		||||
                    <td> 42,00 EUR</td>
 | 
			
		||||
                    <td>Umsatzsteuer</td>
 | 
			
		||||
                    <td th:text="${#numbers.formatDecimal(order.totalVatCent * 0.01, 1, 'POINT', 2, 'COMMA')}" />
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td></td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <h3>Gesammtpreis</h3>
 | 
			
		||||
                        <h3>Gesamtpreis</h3>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <h3>240,79 EUR</h3>
 | 
			
		||||
                        <h3 th:text="${#numbers.formatDecimal(order.totalGrossCent * 0.01, 1, 'POINT', 2, 'COMMA')}"/>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
            </table>
 | 
			
		||||
 | 
			
		||||
@ -41,10 +41,10 @@
 | 
			
		||||
                <th></th>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr th:each="order: ${orders}">
 | 
			
		||||
                <td><a th:href="@{/intern/customers/48584}" th:text="${order.customer.id}">101</a></td>
 | 
			
		||||
                <td><a th:href="@{/intern/customers/{id}(id=${order.customer.id})}" th:text="${order.customer.id}">101</a></td>
 | 
			
		||||
                <td th:text="${order.id}"></td>
 | 
			
		||||
                <td th:text="${order.created.toString().substring(0, 10)}"></td>
 | 
			
		||||
                <td th:text="${#numbers.formatDecimal(order.totalGrossCent, 1, 'POINT', 2, 'COMMA')}"></td>
 | 
			
		||||
                <td th:text="${#numbers.formatDecimal(order.totalGrossCent * 0.01, 1, 'POINT', 2, 'COMMA')}"></td>
 | 
			
		||||
                <td th:if="${order.deliveredAt == null}">In Zustellung</td>
 | 
			
		||||
                <td th:if="${order.deliveredAt != null}">Zugestellt</td>
 | 
			
		||||
                <td><a th:href="@{/intern/customerOrders/{id}(id=${order.id})}" class="button smaller">Details</a></td>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user