untested

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