added post form for marking order as delivered
This commit is contained in:
parent
8a4ff4cfa5
commit
bd8b3db7f3
|
@ -0,0 +1,7 @@
|
||||||
|
package org.hso.ecommerce.action.warehouse;
|
||||||
|
|
||||||
|
public class StoreSupplierOrderAction {
|
||||||
|
|
||||||
|
//TODO add delivery date and warehouse booking
|
||||||
|
|
||||||
|
}
|
|
@ -19,7 +19,9 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.servlet.view.RedirectView;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/intern/")
|
@RequestMapping("/intern/")
|
||||||
|
@ -83,6 +85,7 @@ public class SupplierIndexController {
|
||||||
|
|
||||||
return "intern/suppliers/id";
|
return "intern/suppliers/id";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class UImodelSuppliers {
|
public class UImodelSuppliers {
|
||||||
long id;
|
long id;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.hso.ecommerce.entities.supplier.SupplierOrder;
|
import org.hso.ecommerce.entities.supplier.SupplierOrder;
|
||||||
import org.hso.ecommerce.repos.supplier.SupplierOrderRepository;
|
import org.hso.ecommerce.repos.supplier.SupplierOrderRepository;
|
||||||
|
@ -11,7 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.servlet.view.RedirectView;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/intern/")
|
@RequestMapping("/intern/")
|
||||||
|
@ -22,7 +26,7 @@ public class SupplierOrderController {
|
||||||
|
|
||||||
@GetMapping("supplierOrders")
|
@GetMapping("supplierOrders")
|
||||||
public String listSuppliers(Model model) {
|
public String listSuppliers(Model model) {
|
||||||
|
|
||||||
List<UImodelSupplierOrder> totals = new ArrayList<UImodelSupplierOrder>();
|
List<UImodelSupplierOrder> totals = new ArrayList<UImodelSupplierOrder>();
|
||||||
|
|
||||||
for (SupplierOrder orders : supplierOrderRepository.findAll()) {
|
for (SupplierOrder orders : supplierOrderRepository.findAll()) {
|
||||||
|
@ -34,6 +38,23 @@ public class SupplierOrderController {
|
||||||
return "intern/supplierOrders/index";
|
return "intern/supplierOrders/index";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/supplierOrders/store/{id}")
|
||||||
|
public RedirectView storeOrder(@PathVariable(required = true) String id) {
|
||||||
|
|
||||||
|
long supplierOrderID = Long.parseLong(id);
|
||||||
|
|
||||||
|
Optional<SupplierOrder> order = supplierOrderRepository.findById(supplierOrderID);
|
||||||
|
|
||||||
|
if (order.isPresent()) {
|
||||||
|
//TODO call action
|
||||||
|
|
||||||
|
System.out.println("Order is present\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return new RedirectView("../../supplierOrders/");
|
||||||
|
}
|
||||||
|
|
||||||
public class UImodelSupplierOrder {
|
public class UImodelSupplierOrder {
|
||||||
long id;
|
long id;
|
||||||
String dateOrder;
|
String dateOrder;
|
||||||
|
@ -116,7 +137,7 @@ public class SupplierOrderController {
|
||||||
public void setSupplierName(String supplierName) {
|
public void setSupplierName(String supplierName) {
|
||||||
this.supplierName = supplierName;
|
this.supplierName = supplierName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UImodelSupplierOrder(SupplierOrder order) {
|
public UImodelSupplierOrder(SupplierOrder order) {
|
||||||
this.id = order.id;
|
this.id = order.id;
|
||||||
this.supplierName = order.supplier.name;
|
this.supplierName = order.supplier.name;
|
||||||
|
|
|
@ -53,11 +53,14 @@
|
||||||
<td><span th:text="${order.price_total}"></span> €</td>
|
<td><span th:text="${order.price_total}"></span> €</td>
|
||||||
<td>
|
<td>
|
||||||
<div th:if="${order.arrived}">
|
<div th:if="${order.arrived}">
|
||||||
<a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a>
|
Angekommen
|
||||||
</div>
|
</div>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
<div th:unless="${order.arrived}">
|
<div th:unless="${order.arrived}">
|
||||||
Unterwegs
|
Unterwegs <br>
|
||||||
|
<form class="detailgrid" action="#" th:action="@{/intern/supplierOrders/store/{id}(id = ${order.id})}" method="POST">
|
||||||
|
<input class="button smaller" type="submit" value="Eingang verbuchen" />
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -50,11 +50,14 @@
|
||||||
<td><span th:text="${order.price_total}"></span> €</td>
|
<td><span th:text="${order.price_total}"></span> €</td>
|
||||||
<td>
|
<td>
|
||||||
<div th:if="${order.arrived}">
|
<div th:if="${order.arrived}">
|
||||||
<a th:href="@{/intern/warehouse/todo}" class="button smaller">Angekommen</a>
|
Angekommen
|
||||||
</div>
|
</div>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
<div th:unless="${order.arrived}">
|
<div th:unless="${order.arrived}">
|
||||||
Unterwegs
|
Unterwegs <br>
|
||||||
|
<form class="detailgrid" action="#" th:action="@{/intern/supplierOrders/store/{id}(id = ${order.id})}" method="POST">
|
||||||
|
<input class="button smaller" type="submit" value="Eingang verbuchen" />
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Reference in New Issue