Exemplo n.º 1
0
  @RequestMapping(value = "/waiter/orders/{orderId}", method = RequestMethod.GET)
  public String showOrderInWaiter(
      @PathVariable("orderId") String orderId, Model uiModel, Locale locale) {

    // warmup stuff
    Order order = warmupRestaurantByOrder(orderId, uiModel);
    Restaurant resto = order.getBill().getDiningTable().getRestaurant();

    List<Order> allPreparedOrders = orderService.findPreparedOrdersForRestaurant(resto);
    uiModel.addAttribute("allPreparedOrders", allPreparedOrders);

    List<Bill> allSubmittedBills = billService.findSubmittedBillsForRestaurant(resto);
    uiModel.addAttribute("allSubmittedBills", allSubmittedBills);

    String orderContent = "";
    for (OrderItem orderItem : order.getOrderItems()) {
      orderContent +=
          orderItem.getMenuItem().getId() + " (" + orderItem.getQuantity() + "x)" + "; ";
    }

    uiModel.addAttribute(
        "message",
        new Message(
            "info",
            messageSource.getMessage("label_order_content", new Object[] {}, locale)
                + ": "
                + orderContent));

    return "hartigehap/waiter";
  }
Exemplo n.º 2
0
  @RequestMapping(value = "/waiter/bills/{billId}", method = RequestMethod.GET)
  public String showBillInWaiter(
      @PathVariable("billId") String billId, Model uiModel, Locale locale) {

    // warmup stuff
    Bill bill = warmupRestaurant(billId, uiModel);
    Restaurant resto = bill.getDiningTable().getRestaurant();

    List<Order> allPreparedOrders = orderService.findPreparedOrdersForRestaurant(resto);
    uiModel.addAttribute("allPreparedOrders", allPreparedOrders);

    List<Bill> allSubmittedBills = billService.findSubmittedBillsForRestaurant(resto);
    uiModel.addAttribute("allSubmittedBills", allSubmittedBills);

    uiModel.addAttribute(
        "message",
        new Message(
            "info",
            messageSource.getMessage("label_bill_amount", new Object[] {}, locale)
                + ": "
                + bill.getPriceAllOrders()
                + " "
                + messageSource.getMessage("label_currency", new Object[] {}, locale)));

    return "hartigehap/waiter";
  }
Exemplo n.º 3
0
  @RequestMapping(value = "/restaurants/{restaurantName}/waiter", method = RequestMethod.GET)
  public String showWaiter(@PathVariable("restaurantName") String restaurantName, Model uiModel) {

    // warmup stuff
    Collection<Restaurant> restaurants = restaurantService.findAll();
    uiModel.addAttribute("restaurants", restaurants);
    Restaurant restaurant = restaurantService.fetchWarmedUp(restaurantName);
    uiModel.addAttribute("restaurant", restaurant);

    List<Order> allPreparedOrders = orderService.findPreparedOrdersForRestaurant(restaurant);
    uiModel.addAttribute("allPreparedOrders", allPreparedOrders);

    List<Bill> allSubmittedBills = billService.findSubmittedBillsForRestaurant(restaurant);
    uiModel.addAttribute("allSubmittedBills", allSubmittedBills);

    return "hartigehap/waiter";
  }