Commit ae5d3663 by Riku Silvola

foodwave, foodmanager, i18n changes

1 parent 1b858b07
......@@ -5,7 +5,9 @@
package fi.insomnia.bortal.model;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import javax.persistence.Column;
import javax.persistence.Entity;
......@@ -52,6 +54,9 @@ public class FoodWave extends GenericEntity {
@OneToMany(mappedBy = "foodwave")
private List<BillLine> billLines;
@OneToMany(mappedBy = "foodwave")
private List<BillLine> unpaidBills;
@ManyToOne
@JoinColumn(name = "template_id", referencedColumnName = "id", nullable = false)
......@@ -175,4 +180,12 @@ public class FoodWave extends GenericEntity {
this.maximumFoods = maximumFoods;
}
public List<BillLine> getUnpaidBills() {
return unpaidBills;
}
public void setUnpaidBills(List<BillLine> unpaidBills) {
this.unpaidBills = unpaidBills;
}
}
......@@ -25,66 +25,90 @@
</ui:define>
<ui:define name="content">
<h1>
<h:outputLabel id="name" value="${i18n['foodWave.billLines']}" />
</h1>
<p:dataTable
styleClass="bordertable" value="#{foodWaveView.foodWaves.billLines}"
var="foodwave" >
<p:dataTable styleClass="bordertable"
value="#{foodWaveView.unpaidBills}" var="bill_line">
<f:facet name="header">
${i18n['foodWave.billLines']}
</f:facet>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['billLine.name']}" />
<h:outputLabel id="name" value="${i18n['billLine.time']}" />
</f:facet>
<h:link outcome="/foodmanager/listOrders" value="#{foodwave.billLines.name}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
</h:link>
<h:outputText value="#{bill_line.bill.sentDate.getTime()}">
<f:convertDateTime pattern="hh:mm d/M/yy" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['billLine.quantity']}" />
<h:outputLabel id="name" value="${i18n['billLine.quantity']}" />
</f:facet>
<h:link outcome="/foodmanager/listOrders"
value="#{foodwave.billLines.rowCount}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
</h:link>
<h:outputText value="#{bill_line.quantity}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['billLine.unitprice']}" />
<h:outputLabel id="name" value="${i18n['billLine.product']}" />
</f:facet>
<h:link outcome="/foodmanager/listOrders"
value="#{foodwave.currentProduct.price}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
</h:link>
<h:outputText value="#{bill_line.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['foodWave.unconfirmedOrders']}" />
<h:outputLabel id="name" value="${i18n['billLine.eventuser']}" />
</f:facet>
<h:link outcome="/foodmanager/listOrders"
value="#{foodwave.billLines.rowCount}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
<h:link outcome="/useradmin/edit"
value="#{bill_line.bill.user.wholeName}">
<f:param name="userid" value="#{bill_line.bill.user.id}" />
</h:link>
</p:column>
<!--
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['foodWave.totalReserved']}" />
<h:outputLabel id="name" value="${i18n['billLine.price']}" />
</f:facet>
<h:link outcome="/foodmanager/listOrders" value="#{foodWaveView.currentProduct.totalreserved}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
</h:link>
</p:column> -->
<h:outputText value="#{bill_line.linePrice}" />
</p:column>
</p:dataTable>
<br/>
<br/>
<p:dataTable styleClass="bordertable"
value="#{foodWaveView.accountEventLines}" var="acc_lines">
<f:facet name="header">
${i18n['foodWave.accountevents']}
</f:facet>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_lines.time']}" />
</f:facet>
<h:outputText value="#{acc_line.eventTime.getTime()}">
<f:convertDateTime pattern="hh:mm d/M/yy" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['foodWave.time']}" />
<h:outputLabel id="name" value="${i18n['acc_line.quantity']}" />
</f:facet>
<h:link outcome="/foodmanager/listOrders"
value="#{foodwave.billLine}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
<h:outputText value="#{acc_line.quantity}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.product']}" />
</f:facet>
<h:outputText value="#{acc_line.product}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.eventuser']}" />
</f:facet>
<h:link outcome="/useradmin/edit"
value="#{acc_line.user.wholeName}">
<f:param name="userid" value="#{acc_line.user.id}" />
</h:link>
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.price']}" />
</f:facet>
<h:outputText value="#{acc_line.total}" />
</p:column>
</p:dataTable>
......
......@@ -7,7 +7,8 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:foodwave="http://java.sun.com/jsf/composite/cditools/foodwave"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:c="http://java.sun.com/jsp/jstl/core">
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
<h:body>
<ui:composition
template="/layout/#{sessionHandler.layout}/template.xhtml">
......@@ -22,10 +23,10 @@
</ui:define>
<ui:define name="content">
<h:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign"
<p:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign"
styleClass="bordertable" value="#{foodWaveView.foodWaves}"
var="foodwave">
<h:column>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['foodWave.name']}" />
</f:facet>
......@@ -33,33 +34,33 @@
<h:link outcome="/foodwave/listProducts" value="#{foodwave.name}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
</h:link>
</h:column>
<h:column>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['foodWave.templatename']}" />
<h:outputText value="Menu" />
</f:facet>
<h:link outcome="/foodwave/listProducts"
<h:outputText
value="#{foodwave.template.name}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
</h:link>
</h:column>
<h:column>
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['foodWave.description']}" />
</f:facet>
<h:outputText id="description"
value="#{foodwave.template.description}" />
</h:column>
<h:column>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['foodWave.time']}" />
</f:facet>
<h:link outcome="/foodwave/listProducts"
<h:outputText
value="#{foodwave.time.time}">
<f:param name="foodwaveid" value="#{foodwave.id}" />
</h:link>
</h:column>
</h:dataTable>
<f:convertDateTime pattern="hh:mm d/M/yy" />
</h:outputText>
</p:column>
</p:dataTable>
</ui:define>
......
......@@ -11,7 +11,7 @@
</f:metadata>
<ui:define name="title">
<h1>#{i18n['user.shop.title']}</h1>
<h1>#{i18n['user.food.title']}</h1>
</ui:define>
<ui:define name="content">
......
......@@ -7,7 +7,8 @@
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:p="http://primefaces.org/ui">
<composite:interface>
......@@ -24,48 +25,48 @@
<h:form>
<h:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign"
<p:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign"
styleClass="bordertable" value="#{cc.attrs.items}" var="cart">
<!-- h:column>
<!-- p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['product.name']}" />
</f:facet>
<h:commandLink action="#{cc.attrs.selectaction}" value="#{cart.product.name}" />
</h:column>
<h:column>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['product.price']}" />
</f:facet>
<h:commandLink action="#{cc.attrs.selectaction}" id="template_name" value="#{cart.product.price}" />
</h:column>
</p:column>
<h:commandButton action="#{cc.attrs.selectaction}"
id="selectbutton-botton" value="Valitte" /-->
<h:column>
<p:column>
<f:facet name="header">
<h:outputText id="name" value="${i18n['product.name']}" />
</f:facet>
<h:outputText value="#{cart.product.name}" />
</h:column>
<h:column>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['product.price']}" />
</f:facet>
<h:outputText id="price" value="#{cart.product.price.abs()}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['product.totalPrice']}" />
</f:facet>
<h:outputText id="total" value="#{cart.price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</h:column>
<h:column>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText id="count" value="${i18n['product.cart.count']}" />
</f:facet>
......@@ -81,9 +82,9 @@
value="#{i18n['productshop.plusOne']}">
<f:ajax render="@form" />
</h:commandButton>
</h:column>
</p:column>
</h:dataTable>
</p:dataTable>
<h:commandButton action="#{foodWaveFoodView.buyFromCounter}" value="#{i18n['foodshop.buyFromCounter']}" >
......
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:p="http://primefaces.org/ui">
<composite:interface>
......@@ -16,23 +22,31 @@
<h:outputScript library="primefaces" name="jquery/jquery.js" />
<h:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign" styleClass="bordertable" id="billcart" value="#{cc.attrs.items}" var="template">
<h:column>
<p:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign"
styleClass="bordertable" id="billcart" value="#{cc.attrs.items}"
var="template">
<p:column>
<f:facet name="header">
<h:outputText id="name" value="${i18n['foodWave.name']}" />
<h:outputText id="name" value="Menu" />
</f:facet>
<h:link outcome="#{cc.attrs.outcome}" value="#{template.name}">
<f:param name="templateid" value="#{template.id}" />
</h:link>
</h:column>
<h:column>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['foodWave.description']}" />
</f:facet>
<h:outputText id="description" value="#{template.description}" />
</h:column>
</p:column>
<p:column size="20px">
<f:facet name="header">
<h:outputText value="${i18n['foodWave.template.waves']}" />
</f:facet>
<h:outputText id="nowaves" value="#{template.foodwaves.size()}" />
</p:column>
</h:dataTable>
</p:dataTable>
</composite:implementation>
......
......@@ -117,7 +117,7 @@ public class HostnameFilter implements Filter {
{
sessionmgmt.updateSessionUser(httpRequest.getSession().getId(), httpRequest.getUserPrincipal().getName());
}
if (trail.size() == 10) {
while (trail.size() >= 10) {
trail.remove();
}
if (!httpRequest.getRequestURI().matches(".*(resource).*")) {
......
......@@ -136,4 +136,4 @@ resetMail.username = Username
resetmailSent.body = Email has been sent containing a link where you can change the password.
resetmailSent.header = Email sent
user.unauthenticated = Kirjautumaton
user.unauthenticated = Kirjautumaton
......@@ -189,6 +189,7 @@ foodWave.orders = Amount of Orders
foodWave.paid = Paid
foodWave.show = Show
foodWave.template.name = Template
foodWave.templatename = Choose Products
foodWave.time = Time
foodWave.totalReserved = Total
foodWave.unconfirmedOrders = Unconfirmed
......@@ -690,6 +691,8 @@ user.edit = Edit
user.edit.title = My information
user.email = Email
user.firstNames = Firstname
user.food.title = Choose Menu
user.foodwavelist.title = Choose Foodwave
user.hasImage = Image
user.image = Image
user.imagelist = Saved images
......
......@@ -187,6 +187,7 @@ foodWave.orders = Tilausten M\u00E4\u00E4r\u00E4
foodWave.paid = Maksettuja
foodWave.show = N\u00E4yt\u00E4
foodWave.template.name = Template
foodWave.templatename = Valitse tuotteet
foodWave.time = Aika
foodWave.totalReserved = Yhteens\u00E4
foodWave.unconfirmedOrders = Vahvistamattomia
......@@ -673,6 +674,8 @@ user.edit = Muokkaa
user.edit.title = Omat tiedot
user.email = S\u00E4hk\u00F6posti
user.firstNames = Etunimi
user.food.title = Valitse Menu
user.foodwavelist.title = Valitse Ruokatilaus
user.hasImage = Kuva
user.imageUploaded = Kuva l\u00E4hetetty.
user.imagelist = Tallennetut kuvat
......
......@@ -3,6 +3,7 @@ package fi.insomnia.bortal.web.cdiview.shop;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;
......@@ -48,6 +49,7 @@ public class FoodWaveView extends GenericCDIView {
private Product currentProduct;
private ListDataModel<BillLine> billLines;
private List<BillLine> unpaidBills;
private Integer foodWaveId;
private ListDataModel<AccountEvent> accountEventLines;
......@@ -56,7 +58,7 @@ public class FoodWaveView extends GenericCDIView {
public List<Product> getProducts() {
return productbeanlocal.getProducts();
}
public void onEdit() {
this.foodWaveBean.saveTemplate(template);
}
......@@ -80,7 +82,7 @@ public class FoodWaveView extends GenericCDIView {
foodWaveBean.createFoodWave(selectedFoodWave);
initFoodwaveManagerList();
return "/foodmanager/listFoodwaves";
}
......@@ -106,7 +108,7 @@ public class FoodWaveView extends GenericCDIView {
template = foodWaveBean.findTemplate(templateId);
createNewProductSkeleton();
// prepare to make new foodwaves
selectedFoodWave = new FoodWave();
selectedFoodWave.setTemplate(template);
......@@ -165,8 +167,16 @@ public class FoodWaveView extends GenericCDIView {
selectedFoodWave = foodWaveBean.findFoodwave(foodWaveId);
billLines = new ListDataModel<BillLine>(selectedFoodWave.getBillLines());
this.accountEventLines = new ListDataModel<AccountEvent>(selectedFoodWave.getAccountEvents());
this.setAccountEventLines(new ListDataModel<AccountEvent>(selectedFoodWave.getAccountEvents()));
setUnpaidBills(new ArrayList<BillLine>());
Iterator<BillLine> biterator = billLines.iterator();
while (biterator.hasNext()) {
BillLine unpaidBill = biterator.next();
if (unpaidBill.getBill().isPaid())
this.getUnpaidBills().add(unpaidBill);
}
super.beginConversation();
}
......@@ -244,4 +254,20 @@ public class FoodWaveView extends GenericCDIView {
return foodWaves;
}
public ListDataModel<AccountEvent> getAccountEventLines() {
return accountEventLines;
}
public void setAccountEventLines(ListDataModel<AccountEvent> accountEventLines) {
this.accountEventLines = accountEventLines;
}
public List<BillLine> getUnpaidBills() {
return unpaidBills;
}
public void setUnpaidBills(List<BillLine> unpaidBills) {
this.unpaidBills = unpaidBills;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!