finished show orders based on supplier

This commit is contained in:
Hendrik Schutter 2020-05-30 21:13:25 +02:00
parent 657d315850
commit 67c101ebea
2 changed files with 30 additions and 27 deletions

View File

@ -1,12 +1,10 @@
package org.hso.ecommerce.controller.intern.suppliers;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hso.ecommerce.entities.supplier.ArticleOffer;
import org.hso.ecommerce.entities.supplier.Supplier;
import org.hso.ecommerce.entities.supplier.SupplierOrder;
import org.hso.ecommerce.repos.supplier.SupplierOrderRepository;
@ -53,10 +51,8 @@ public class SupplierIndexController {
orders.add(new UImodelSupplierDetailOrders(supplierOrder));
}
UImodelSupplierDetail total = new UImodelSupplierDetail(
supplierRepository.findSupplierById(supplierId).name,
"42€",
orders);
UImodelSupplierDetail total = new UImodelSupplierDetail(supplierRepository.findSupplierById(supplierId).name,
"42€", orders);
model.addAttribute("SupplierDetail", total);
@ -136,7 +132,7 @@ public class SupplierIndexController {
String priceNetto;
String quantity;
String price_total;
String dateArrival;
boolean arrived;
public long getId() {
return id;
@ -186,14 +182,6 @@ public class SupplierIndexController {
this.price_total = price_total;
}
public String getDateArrival() {
return dateArrival;
}
public void setDateArrival(String dateArrival) {
this.dateArrival = dateArrival;
}
public long getArticleId() {
return articleId;
}
@ -202,9 +190,15 @@ public class SupplierIndexController {
this.articleId = articleId;
}
public UImodelSupplierDetailOrders(SupplierOrder order)
{
public boolean isArrived() {
return arrived;
}
public void setArrived(boolean arrived) {
this.arrived = arrived;
}
public UImodelSupplierDetailOrders(SupplierOrder order) {
this.id = order.id;
this.articleName = order.ordered.title;
this.articleId = order.ordered.id;
@ -215,10 +209,12 @@ public class SupplierIndexController {
Date date = new Date();
date.setTime(order.created.getTime());
this.dateOrder = new SimpleDateFormat("dd.MM.yyyy").format(date);
date.setTime(order.delivered.getTime());
this.dateArrival = new SimpleDateFormat("dd.MM.yyyy").format(date);
}
if (order.delivered != null) {
arrived = true;
} else {
arrived = false;
}
}
}
}

View File

@ -49,8 +49,15 @@
<td><span th:text="${order.priceNetto}"></span></td>
<td><span th:text="${order.quantity}"></span></td>
<td><span th:text="${order.price_total}"></span></td>
<td><span th:text="${order.dateArrival}"></span></td>
<!-- <td>Unterwegs <br/><a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a></td> -->
<td>
<div th:if="${order.arrived}">
<a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a>
</div>
<!-- ELSE -->
<div th:unless="${order.arrived}">
Unterwegs
</div>
</td>
</tr>
</tbody>
</table>