untested

1 parent 87d8f64c
......@@ -230,4 +230,8 @@ public class AccountEvent extends GenericEntity {
this.deliveredCount = deliveredCount;
}
public boolean isDelivered() {
return (delivered != null);
}
}
......@@ -59,6 +59,15 @@
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="#{i18n['billLine.nick']}" />
</f:facet>
<h:link outcome="/useradmin/edit"
value="#{bill_line.bill.user.nick}">
<f:param name="userid" value="#{bill_line.bill.user.id}" />
</h:link>
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel value="#{i18n['billLine.price']}" />
</f:facet>
<h:outputText value="#{bill_line.linePrice}" />
......@@ -82,9 +91,10 @@
</p:dataTable>
<br />
<br />
<!--
<p:dataTable styleClass="bordertable"
value="#{foodWaveView.accountEventLines}" var="acc_lines">
<h1><h:outputLabel value="#{i18n['foodwave.orders']" /></h1>
<p:dataTable styleClass="bordertable" value="#{foodWaveView.accountEventLines}" var="acc_lines">
<f:facet name="header">
<h:outputLabel value="#{i18n['foodWave.accountevents']}" />
</f:facet>
......@@ -106,7 +116,7 @@
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.product']}" />
</f:facet>
<h:outputText value="#{acc_line.product}" />
<h:outputText value="#{acc_line.product.name}" />
</p:column>
<p:column>
<f:facet name="header">
......@@ -119,15 +129,23 @@
</p:column>
<p:column>
<f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.price']}" />
<h:outputLabel id="name" value="${i18n['acc_line.nick']}" />
</f:facet>
<h:outputText value="#{acc_line.total}" />
<h:link outcome="/useradmin/edit"
value="#{acc_line.user.nick}">
<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['accountEvent.delivered']}" />
</f:facet>
<h:outputText rendered="#{acc_line.delivered}" value="#{i18n['accountEvent.delivered']}" />
<h:commandButton rendered="#{not acc_line.delivered}" value=#{i18n['accountEvent.deliver']} action="#{foodWaveView.deliverAccountEvent}" />
</p:column>
</p:dataTable>
-->
</h:form>
</h:form>
</ui:define>
......
......@@ -12,6 +12,7 @@ import javax.faces.model.ListDataModel;
import javax.inject.Inject;
import javax.inject.Named;
import fi.insomnia.bortal.beans.AccountEventBeanLocal;
import fi.insomnia.bortal.beans.BillBeanLocal;
import fi.insomnia.bortal.beans.EventBeanLocal;
import fi.insomnia.bortal.beans.FoodWaveBeanLocal;
......@@ -47,6 +48,9 @@ public class FoodWaveView extends GenericCDIView {
@EJB
private BillBeanLocal billbean;
@EJB
private AccountEventBeanLocal accountEventBean;
private FoodWave selectedFoodWave = null;
private Date startDate;
......@@ -173,19 +177,20 @@ public class FoodWaveView extends GenericCDIView {
}
return null;
}
public String markBillRemoved() {
if (permbean.hasPermission(BillPermission.WRITE_ALL) && getBillLines().isRowAvailable()) {
Bill b = getBillLines().getRowData().getBill();
}
getBillbean().markPaid(b, Calendar.getInstance());
public String deliverAccountEvent() {
if (getAccountEventLines().isRowAvailable()) {
AccountEvent e = getAccountEventLines().getRowData();
e.setDelivered(Calendar.getInstance());
e = accountEventBean.merge(e);
}
return null;
}
public void initFoodWaveOrderList() {
if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) {
......@@ -196,13 +201,16 @@ public class FoodWaveView extends GenericCDIView {
List<BillLine> tmpLines = new ArrayList<BillLine>();
for (BillLine line : selectedFoodWave.getBillLines()) {
if (line.getBill().isPaid()) {
if (!line.getBill().isPaid()) {
tmpLines.add(line);
}
}
setBillLines(new ListDataModel<BillLine>(tmpLines));
setAccountEventLines(new ListDataModel<AccountEvent>(selectedFoodWave.getAccountEvents()));
super.beginConversation();
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!