Commit 762068cf by Tuomas Riihimäki

Merge branch 'foodwave_including_status_and_min_price' into 'master'

Foodwave including status and min price

See merge request !434
2 parents 71611071 54d8f244
...@@ -62,7 +62,7 @@ public interface ProductBeanLocal { ...@@ -62,7 +62,7 @@ public interface ProductBeanLocal {
Discount save(Discount discount); Discount save(Discount discount);
BigDecimal calculateTotal(Product product, BigDecimal quantity, Date date, EventUser user); BigDecimal calculateTotal(Product product, BigDecimal quantity, Date date, EventUser user);
HashMap<Integer, BigDecimal> getProductLimit(Map<Integer, BigDecimal> prodCounts, EventUser user); HashMap<Integer, BigDecimal> getProductLimit(Map<Integer, BigDecimal> prodCounts, EventUser user);
...@@ -88,6 +88,10 @@ public interface ProductBeanLocal { ...@@ -88,6 +88,10 @@ public interface ProductBeanLocal {
AccountEvent markUndelivered(AccountEvent e); AccountEvent markUndelivered(AccountEvent e);
AccountEvent markReady(AccountEvent e, Calendar c);
AccountEvent markNotReady(AccountEvent e);
List<AccountEvent> getDeliverableAccountEvents(EventUser user ); List<AccountEvent> getDeliverableAccountEvents(EventUser user );
List<Product> getPlaceProducts(); List<Product> getPlaceProducts();
......
...@@ -651,6 +651,20 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -651,6 +651,20 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"UPDATE event_properties SET long_value = (long_value * 60), key = 'BILL_EXPIRE_MINS' WHERE key = 'BILL_EXPIRE_HOURS'" "UPDATE event_properties SET long_value = (long_value * 60), key = 'BILL_EXPIRE_MINS' WHERE key = 'BILL_EXPIRE_HOURS'"
}); });
dbUpdates.add(new String[] {
"ALTER TABLE account_events ADD COLUMN ready TIMESTAMPTZ"
});
dbUpdates.add(new String[] {
"ALTER TABLE food_wave_templates ADD COLUMN allow_custom_information BOOLEAN"
});
dbUpdates.add(new String[] {
"ALTER TABLE food_wave_templates ADD COLUMN min_price numeric(24,4);",
"ALTER TABLE food_wave_templates DROP COLUMN max_foods;"
});
} }
......
...@@ -584,6 +584,28 @@ public class ProductBean implements ProductBeanLocal { ...@@ -584,6 +584,28 @@ public class ProductBean implements ProductBeanLocal {
} }
@Override @Override
public AccountEvent markReady(AccountEvent e, Calendar c) {
e = accounteventfacade.reload(e);
if (e.getReady() != null)
{
throw new EJBException("AccountEvent " + e + " already marked ready!");
}
e.setReady(c);
return e;
}
@Override
public AccountEvent markNotReady(AccountEvent e) {
e = accounteventfacade.reload(e);
e.setReady(null);
return e;
}
@Override
public List<Product> getPlaceProducts() { public List<Product> getPlaceProducts() {
List<Product> allProducts = productFacade.findAll(); List<Product> allProducts = productFacade.findAll();
......
...@@ -74,6 +74,14 @@ public class AccountEvent extends GenericEntity { ...@@ -74,6 +74,14 @@ public class AccountEvent extends GenericEntity {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar delivered; private Calendar delivered;
/**
* Is the product made already
*/
@Column(name = "ready")
@Temporal(TemporalType.TIMESTAMP)
private Calendar ready;
/** /**
* If this AccountEvent is a product in foodwace, this field is a reference * If this AccountEvent is a product in foodwace, this field is a reference
* to that foodwave. * to that foodwave.
...@@ -156,6 +164,15 @@ public class AccountEvent extends GenericEntity { ...@@ -156,6 +164,15 @@ public class AccountEvent extends GenericEntity {
this.delivered = delivered; this.delivered = delivered;
} }
public Calendar getReady() {
return ready;
}
public void setReady(Calendar ready) {
this.ready = ready;
}
public EventUser getUser() { public EventUser getUser() {
return user; return user;
} }
...@@ -240,4 +257,8 @@ public class AccountEvent extends GenericEntity { ...@@ -240,4 +257,8 @@ public class AccountEvent extends GenericEntity {
return (delivered != null); return (delivered != null);
} }
public boolean isProductReady() {
return (ready != null);
}
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*/ */
package fi.codecrew.moya.model; package fi.codecrew.moya.model;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -64,12 +65,17 @@ public class FoodWaveTemplate extends GenericEntity { ...@@ -64,12 +65,17 @@ public class FoodWaveTemplate extends GenericEntity {
@OrderBy(value = "time") @OrderBy(value = "time")
private List<FoodWave> foodwaves; private List<FoodWave> foodwaves;
@Column(name = "max_foods") @Column(name = "min_price", precision = 24, scale = Bill.BILL_PRICE_SCALE)
private Integer maximumFoods; private BigDecimal minPrice;
@Column(name = "wait_payments_minutes") @Column(name = "wait_payments_minutes")
private Integer waitPaymentsMinutes = 0; private Integer waitPaymentsMinutes = 0;
@Column(name = "allow_custom_information")
private Boolean allowCustomInformation = false;
public FoodWaveTemplate() { public FoodWaveTemplate() {
} }
...@@ -78,6 +84,19 @@ public class FoodWaveTemplate extends GenericEntity { ...@@ -78,6 +84,19 @@ public class FoodWaveTemplate extends GenericEntity {
this.name = templateName; this.name = templateName;
} }
public Boolean getAllowCustomInformation() {
return allowCustomInformation;
}
public Boolean isAllowCustomInformation() {
return allowCustomInformation;
}
public void setAllowCustomInformation(Boolean allowCustomInformation) {
this.allowCustomInformation = allowCustomInformation;
}
public String getName() { public String getName() {
return name; return name;
} }
...@@ -150,4 +169,13 @@ public class FoodWaveTemplate extends GenericEntity { ...@@ -150,4 +169,13 @@ public class FoodWaveTemplate extends GenericEntity {
this.waitPaymentsMinutes = waitPaymentsMinutes; this.waitPaymentsMinutes = waitPaymentsMinutes;
} }
public BigDecimal getMinPrice() {
return minPrice;
}
public void setMinPrice(BigDecimal minPrice) {
this.minPrice = minPrice;
}
} }
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<dependency> <dependency>
<groupId>org.apache.sshd</groupId> <groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId> <artifactId>sshd-core</artifactId>
<version>0.14.0</version> <version>2.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<!-- Java melody dependency --> <!-- Java melody dependency -->
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.5</version> <version>4.5.8</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
...@@ -113,12 +113,12 @@ ...@@ -113,12 +113,12 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.7</version> <version>3.9</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.json</groupId> <groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId> <artifactId>javax.json-api</artifactId>
<version>1.0</version> <version>1.1.4</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -126,6 +126,14 @@ ...@@ -126,6 +126,14 @@
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version> <version>${slf4j.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
...@@ -136,11 +144,15 @@ ...@@ -136,11 +144,15 @@
<artifactId>jerklib</artifactId> <artifactId>jerklib</artifactId>
<version>1.0.4</version> <version>1.0.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.swagger.core.v3</groupId> <groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
<version>${swaggerv3.version}</version> <version>${swaggerv3.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.swagger.core.v3</groupId> <groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId> <artifactId>swagger-jaxrs2</artifactId>
...@@ -151,6 +163,8 @@ ...@@ -151,6 +163,8 @@
<artifactId>swagger-jaxrs2-servlet-initializer</artifactId> <artifactId>swagger-jaxrs2-servlet-initializer</artifactId>
<version>${swaggerv3.version}</version> <version>${swaggerv3.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>fish.payara.extras</groupId> <groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-all</artifactId> <artifactId>payara-embedded-all</artifactId>
...@@ -158,12 +172,16 @@ ...@@ -158,12 +172,16 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- These are required for findbugs annotations--> <!-- These are required for findbugs annotations-->
<dependency> <dependency>
<groupId>com.google.code.findbugs</groupId> <groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
<version>${findbugs.version}</version> <version>${findbugs.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.code.findbugs</groupId> <groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId> <artifactId>jsr305</artifactId>
......
...@@ -16,13 +16,6 @@ ...@@ -16,13 +16,6 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version> <version>3.0.1</version>
......
...@@ -26,10 +26,18 @@ ...@@ -26,10 +26,18 @@
<h:inputText id="desc" value="#{foodWaveView.template.description}" /> <h:inputText id="desc" value="#{foodWaveView.template.description}" />
<h:message for="desc" /> <h:message for="desc" />
<h:outputLabel for="minPrice" value="#{i18n['foodwave.template.minPrice']}" />
<h:inputText id="minPrice" value="#{foodWaveView.template.minPrice}" />
<h:message for="minPrice" />
<h:outputLabel for="overtime" value="#{i18n['foodwave.template.waitPaymentsMinutes']}" /> <h:outputLabel for="overtime" value="#{i18n['foodwave.template.waitPaymentsMinutes']}" />
<p:spinner id="overtime" value="#{foodWaveView.template.waitPaymentsMinutes}" suffix=" #{i18n['suffix.minutes']}" min="0" /> <p:spinner id="overtime" value="#{foodWaveView.template.waitPaymentsMinutes}" suffix=" #{i18n['suffix.minutes']}" min="0" />
<h:message for="overtime" /> <h:message for="overtime" />
<h:outputLabel for="allowAdditionalInfo" value="#{i18n['foodwave.template.allowCustomInformation']}" />
<h:selectBooleanCheckbox id="allowAdditionalInfo" value="#{foodWaveView.template.allowCustomInformation}" />
<h:message for="allowAdditionalInfo" />
<h:outputText value=" " /> <h:outputText value=" " />
<h:commandButton action="#{foodWaveView.saveTemplate()}" value="#{i18n['foodwavetemplate.save']}" /> <h:commandButton action="#{foodWaveView.saveTemplate()}" value="#{i18n['foodwavetemplate.save']}" />
</h:panelGrid> </h:panelGrid>
...@@ -41,16 +49,18 @@ ...@@ -41,16 +49,18 @@
<p:commandButton value="#{i18n['foodwavetemplate.addproduct']}" actionListener="#{foodWaveView.addProductToTemplate}" ajax="false" /> <p:commandButton value="#{i18n['foodwavetemplate.addproduct']}" actionListener="#{foodWaveView.addProductToTemplate}" ajax="false" />
</h:form> </h:form>
<h:form> <h:form>
<h:panelGrid columns="4"> <h:panelGrid columns="5">
<h:outputText value="#{i18n['foodwavetemplate.productname']}" /> <h:outputText value="#{i18n['foodwavetemplate.productname']}" />
<h:outputText value="#{i18n['foodwavetemplate.productdescription']}" /> <h:outputText value="#{i18n['foodwavetemplate.productdescription']}" />
<h:outputText value="#{i18n['foodwavetemplate.price']}" /> <h:outputText value="#{i18n['foodwavetemplate.price']}" />
<h:outputText value="#{i18n['foodwavetemplate.buyInPrice']}" />
<h:outputText value="&nbsp;" /> <h:outputText value="&nbsp;" />
<h:inputText id="productname" value="#{foodWaveView.currentProduct.name}" /> <h:inputText id="productname" value="#{foodWaveView.currentProduct.name}" />
<h:inputText id="productdescription" value="#{foodWaveView.currentProduct.description}" /> <h:inputText id="productdescription" value="#{foodWaveView.currentProduct.description}" />
<h:inputText id="price" value="#{foodWaveView.currentProduct.price}" /> <h:inputText id="price" value="#{foodWaveView.currentProduct.price}" />
<h:inputText id="buyInPrice" value="#{foodWaveView.currentProduct.buyInPrice}" />
<p:commandButton value="#{i18n['foodwavetemplate.addproduct']}" actionListener="#{foodWaveView.addProductToTemplate}" ajax="false" /> <p:commandButton value="#{i18n['foodwavetemplate.addproduct']}" actionListener="#{foodWaveView.addProductToTemplate}" ajax="false" />
...@@ -82,6 +92,8 @@ ...@@ -82,6 +92,8 @@
</f:facet> </f:facet>
</p:cellEditor> </p:cellEditor>
</p:column> </p:column>
<p:column headerText="#{i18n['foodwavetemplate.price']}"> <p:column headerText="#{i18n['foodwavetemplate.price']}">
<p:cellEditor> <p:cellEditor>
<f:facet name="output"> <f:facet name="output">
...@@ -92,6 +104,18 @@ ...@@ -92,6 +104,18 @@
</f:facet> </f:facet>
</p:cellEditor> </p:cellEditor>
</p:column> </p:column>
<p:column headerText="#{i18n['foodwavetemplate.buyInPrice']}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{product.buyInPrice}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{product.buyInPrice}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column style="width:20px"> <p:column style="width:20px">
<p:rowEditor /> <p:rowEditor />
</p:column> </p:column>
......
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
<h1>#{foodWaveView.selectedFoodWave.name}</h1> <h1>#{foodWaveView.selectedFoodWave.name}</h1>
</ui:define> </ui:define>
<ui:define name="content"> <ui:define name="content">
<h:form id="pizzaUpdater">
<p:remoteCommand name="pizzaUpdater" update=":accountEventList :billList :productSummaries :foodwaveSummary" actionListener="#{foodWaveView.updateFoodWaveOrderList}" />
</h:form>
<h:form id="accountEventList"> <h:form id="accountEventList">
<p:dataTable styleClass="bordertable" value="#{foodWaveView.accountEventLines}" var="acc_line" sortBy="#{acc_line.user.nick}" rowStyleClass="#{acc_line.eventDelivered?'success':null}"> <p:dataTable styleClass="bordertable" value="#{foodWaveView.accountEventLines}" var="acc_line" sortBy="#{acc_line.user.nick}" rowStyleClass="#{acc_line.eventDelivered?'success':null}">
<f:facet name="header"> <f:facet name="header">
...@@ -40,6 +45,14 @@ ...@@ -40,6 +45,14 @@
<h:outputText id="foodname" value="#{acc_line.product.name}" /> <h:outputText id="foodname" value="#{acc_line.product.name}" />
<p:tooltip rendered="#{acc_line.product.description != null}" for="foodname" value="#{acc_line.product.description}" showEffect="fade" hideEffect="fade" /> <p:tooltip rendered="#{acc_line.product.description != null}" for="foodname" value="#{acc_line.product.description}" showEffect="fade" hideEffect="fade" />
</p:column> </p:column>
<p:column sortBy="#{acc_line.description}">
<f:facet name="header">
<h:outputLabel value="#{i18n['acc_line.description']}" />
</f:facet>
<h:outputText id="fooddescription" value="#{acc_line.description}" />
</p:column>
<p:column sortBy="#{acc_line.user.wholeName}"> <p:column sortBy="#{acc_line.user.wholeName}">
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="#{i18n['acc_line.eventuser']} (#{i18n['acc_line.nick']})" /> <h:outputLabel value="#{i18n['acc_line.eventuser']} (#{i18n['acc_line.nick']})" />
...@@ -56,6 +69,13 @@ ...@@ -56,6 +69,13 @@
<h:outputText value="#{acc_line.user.firstPlace.name}" /> <h:outputText value="#{acc_line.user.firstPlace.name}" />
</p:column> </p:column>
<p:column sortBy="#{acc_line.productReady}" style="width: 80px;">
<f:facet name="header">
<h:outputLabel value="#{i18n['accountEvent.ready']}" />
</f:facet>
<h:outputText rendered="#{acc_line.productReady}" value="#{i18n['accountEvent.ready']}" />
<p:commandButton rendered="#{not acc_line.productReady}" value="#{i18n['accountEvent.markReady']}" actionListener="#{foodWaveView.markAccounteventProductReady}" update=":billList :accountEventList" />
</p:column>
<p:column sortBy="#{acc_line.eventDelivered}"> <p:column sortBy="#{acc_line.eventDelivered}">
<f:facet name="header"> <f:facet name="header">
...@@ -64,6 +84,8 @@ ...@@ -64,6 +84,8 @@
<h:outputText rendered="#{acc_line.eventDelivered}" value="#{i18n['accountEvent.delivered']}" /> <h:outputText rendered="#{acc_line.eventDelivered}" value="#{i18n['accountEvent.delivered']}" />
<p:commandButton rendered="#{not acc_line.eventDelivered}" value="#{i18n['accountEvent.deliver']}" actionListener="#{foodWaveView.deliverAccountEvent}" update=":billList :accountEventList" /> <p:commandButton rendered="#{not acc_line.eventDelivered}" value="#{i18n['accountEvent.deliver']}" actionListener="#{foodWaveView.deliverAccountEvent}" update=":billList :accountEventList" />
</p:column> </p:column>
</p:dataTable> </p:dataTable>
</h:form> </h:form>
...@@ -157,7 +179,7 @@ ...@@ -157,7 +179,7 @@
<br /> <br />
<br /> <br />
<h2>#{i18n['foodwave.summaryView']}</h2> <h2>#{i18n['foodwave.summaryView']}</h2>
<p:panelGrid columns="2"> <p:panelGrid columns="2" id="foodwaveSummary">
<h:outputLabel value="#{i18n['foodwave.price']}: " /> <h:outputLabel value="#{i18n['foodwave.price']}: " />
<h:outputText value="#{foodWaveView.foodwavePrice}" style="font-weight: bold"> <h:outputText value="#{foodWaveView.foodwavePrice}" style="font-weight: bold">
<f:convertNumber minFractionDigits="0" /> <f:convertNumber minFractionDigits="0" />
...@@ -182,7 +204,7 @@ ...@@ -182,7 +204,7 @@
</p:panelGrid> </p:panelGrid>
<p:dataTable var="summ" value="#{foodWaveView.productSummaries}"> <p:dataTable id="productSummaries" var="summ" value="#{foodWaveView.productSummaries}">
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="#{i18n['product.name']}" /> <h:outputLabel value="#{i18n['product.name']}" />
...@@ -217,6 +239,20 @@ ...@@ -217,6 +239,20 @@
</p:column> </p:column>
</p:dataTable> </p:dataTable>
<script type="text/javascript">
$(document)
.ready(
function() {
setInterval(function() {
pizzaUpdater();
}, 15000);
});
</script>
</ui:define> </ui:define>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<h1>Shop to user: #{userView.selectedUser.user.nick}</h1> <h1>Shop to user: #{userView.selectedUser.user.nick}</h1>
<br /><br /> <br /><br />
<foodwave:listFoods selectaction="#{foodWaveFoodView.buyAndPay}" selectCreditsAction="#{foodWaveFoodView.buyAndPayWithCredits}" items="#{foodWaveFoodView.shoppingcart}" commitValue="foodshop.buyAndPay" commitCreditsValue="foodshop.buyAndPayWithCredits"/> <foodwave:listFoods selectaction="#{foodWaveFoodView.buyAndPay}" selectCreditsAction="#{foodWaveFoodView.buyAndPayWithCredits}" items="#{foodWaveFoodView.shoppingcart}" commitValue="foodshop.buyAndPay" commitCreditsValue="foodshop.buyAndPayWithCredits" ignoreMiniumOrder="#{true}"/>
</ui:define> </ui:define>
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<composite:interface> <composite:interface>
<composite:attribute name="items" required="true" /> <composite:attribute name="items" required="true" />
<!-- <composite:attribute name="selectValue" required="true" /> -->
<composite:attribute name="selectaction" method-signature="java.lang.String action()" required="true" /> <composite:attribute name="selectaction" method-signature="java.lang.String action()" required="true" />
<composite:attribute name="ignoreMiniumOrder" required="false" />
<composite:attribute name="selectCreditsAction" method-signature="java.lang.String action()" /> <composite:attribute name="selectCreditsAction" method-signature="java.lang.String action()" />
</composite:interface> </composite:interface>
...@@ -25,21 +25,7 @@ ...@@ -25,21 +25,7 @@
<h:form styleClass="foodformselector"> <h:form styleClass="foodformselector">
<p:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign" <p:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign"
styleClass="bordertable" value="#{cc.attrs.items}" var="cart"> styleClass="bordertable" value="#{cc.attrs.items}" var="cart">
<!-- 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}" />
</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}" />
</p:column>
<h:commandButton action="#{cc.attrs.selectaction}"
id="selectbutton-botton" value="Valitte" /-->
<p:column> <p:column>
...@@ -64,7 +50,7 @@ ...@@ -64,7 +50,7 @@
<p:tooltip rendered="#{cart.product.name != null}" for="description" value="#{cart.product.name}" showEffect="fade" hideEffect="fade" /> <p:tooltip rendered="#{cart.product.name != null}" for="description" value="#{cart.product.name}" showEffect="fade" hideEffect="fade" />
</p:column> </p:column>
<p:column> <p:column style="width: 120px;">
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['product.price']}" /> <h:outputText value="${i18n['product.price']}" />
</f:facet> </f:facet>
...@@ -72,7 +58,7 @@ ...@@ -72,7 +58,7 @@
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" /> <f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText> </h:outputText>
</p:column> </p:column>
<p:column> <p:column style="width: 80px;">
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['product.totalPrice']}" /> <h:outputText value="${i18n['product.totalPrice']}" />
</f:facet> </f:facet>
...@@ -80,6 +66,15 @@ ...@@ -80,6 +66,15 @@
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" /> <f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText> </h:outputText>
</p:column> </p:column>
<p:column rendered="#{foodWaveFoodView.foodWave.template.allowCustomInformation}">
<f:facet name="header">
<h:outputText value="${i18n['product.additionalInformation']}" />
</f:facet>
<h:inputText style="width: 100%" id="additionalInformation" value="#{cart.additionalInformation}" />
</p:column>
<p:column style="text-align: center;"> <p:column style="text-align: center;">
<f:facet name="header"> <f:facet name="header">
<h:outputText id="count" value="${i18n['product.cart.count']}" /> <h:outputText id="count" value="${i18n['product.cart.count']}" />
...@@ -100,12 +95,17 @@ ...@@ -100,12 +95,17 @@
<h:outputLabel for="total" value="#{i18n['foodshop.total']}: "/> <h:outputLabel for="total" value="#{i18n['foodshop.total']}: "/>
<h:outputText id="total" value="#{foodWaveFoodView.totalPrice}" style="font-weight: bold;" > <h:outputText id="total" value="#{foodWaveFoodView.totalPrice}" style="font-weight: bold;" >
<f:convertNumber minFractionDigits="0" maxFractionDigits="2" /> <f:convertNumber minFractionDigits="0" maxFractionDigits="2" currencySymbol="€" pattern="#,##0.00 ¤" />
</h:outputText> </h:outputText>
</div> </div>
<br /> <br />
<p:commandButton action="#{cc.attrs.selectaction}" value="#{i18n[cc.attrs.commitValue]}" ajax="false" /> <h:outputText rendered="#{not foodWaveFoodView.canBuy and not cc.attrs.ignoreMiniumOrder }" style="color: red;" value="#{i18n['foodwave.notMinPrice']} " />
<h:outputText rendered="#{not foodWaveFoodView.canBuy and not cc.attrs.ignoreMiniumOrder }" value="#{foodWaveFoodView.foodWave.template.minPrice}" style="color: red; font-weight: bold;" >
<f:convertNumber minFractionDigits="0" maxFractionDigits="2" currencySymbol="€" pattern="#,##0.00 ¤" />
</h:outputText>
<br />
<p:commandButton disabled="#{not foodWaveFoodView.canBuy and not cc.attrs.ignoreMiniumOrder }" action="#{cc.attrs.selectaction}" value="#{i18n[cc.attrs.commitValue]}" ajax="false" />
<br /> <br />
<p:commandButton rendered="#{foodWaveFoodView.totalPrice le userView.selectedUser.accountBalance and not empty cc.attrs.selectCreditsAction}" action="#{cc.attrs.selectCreditsAction}" value="#{i18n[cc.attrs.commitCreditsValue]}" ajax="false" /> <p:commandButton rendered="#{foodWaveFoodView.totalPrice le userView.selectedUser.accountBalance and not empty cc.attrs.selectCreditsAction}" action="#{cc.attrs.selectCreditsAction}" value="#{i18n[cc.attrs.commitCreditsValue]}" ajax="false" />
<!-- <h:commandButton action="#{foodWaveFoodView.buyFromInternet}" value="#{i18n['foodshop.buyFromInternet']}" /> --> <!-- <h:commandButton action="#{foodWaveFoodView.buyFromInternet}" value="#{i18n['foodshop.buyFromInternet']}" /> -->
......
...@@ -155,7 +155,7 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -155,7 +155,7 @@ public class FoodWaveFoodView extends GenericCDIView {
for (ProductShopItem shopitem : shoppingcart) { for (ProductShopItem shopitem : shoppingcart) {
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) { if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) {
billBean.addProductToBill(bill, shopitem.getProduct(), shopitem.getCount(), getFoodWave(), null); billBean.addProductToBill(bill, shopitem.getProduct(), shopitem.getCount(), getFoodWave(), shopitem.getAdditionalInformation());
} }
} }
logger.warn("Committing shoppingcart for user {}. Cart prize: {}", userview.getSelectedUser().getWholeName(), bill.getTotalPrice()); logger.warn("Committing shoppingcart for user {}. Cart prize: {}", userview.getSelectedUser().getWholeName(), bill.getTotalPrice());
...@@ -214,6 +214,15 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -214,6 +214,15 @@ public class FoodWaveFoodView extends GenericCDIView {
return null; return null;
} }
public boolean isCanBuy() {
if (getFoodWave().getTemplate().getMinPrice() == null || getFoodWave().getTemplate().getMinPrice().equals(BigDecimal.ZERO)) {
return true;
}
return getFoodWave().getTemplate().getMinPrice().compareTo(getTotalPrice()) <= 0;
}
public void setShoppingcart(ListDataModel<ProductShopItem> shoppingcart) { public void setShoppingcart(ListDataModel<ProductShopItem> shoppingcart) {
this.shoppingcart = shoppingcart; this.shoppingcart = shoppingcart;
} }
......
...@@ -74,8 +74,6 @@ public class FoodWaveView extends GenericCDIView { ...@@ -74,8 +74,6 @@ public class FoodWaveView extends GenericCDIView {
private Date startDate; private Date startDate;
private Product currentProduct; private Product currentProduct;
//private ListDataModel<BillLine> billLines;
// private List<BillLine> unpaidBills;
private Integer foodWaveId; private Integer foodWaveId;
private ListDataModel<AccountEvent> accountEventLines; private ListDataModel<AccountEvent> accountEventLines;
...@@ -314,6 +312,28 @@ public class FoodWaveView extends GenericCDIView { ...@@ -314,6 +312,28 @@ public class FoodWaveView extends GenericCDIView {
return null; return null;
} }
public String markAccounteventProductReady() {
if (accountEventLines != null && accountEventLines.isRowAvailable()) {
AccountEvent e = accountEventLines.getRowData();
e = productbeanlocal.markReady(e, Calendar.getInstance());
foodWaveId = selectedFoodWave.getId();
selectedFoodWave = null;
initFoodWaveOrderList();
}
return null;
}
public void updateFoodWaveOrderList() {
if (selectedFoodWave != null) {
selectedFoodWave = foodWaveBean.findFoodwave(foodWaveId);
}
initFoodWaveOrderList();
}
public void initFoodWaveOrderList() { public void initFoodWaveOrderList() {
if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) { if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) {
......
...@@ -43,6 +43,9 @@ public class ProductShopItem implements Serializable { ...@@ -43,6 +43,9 @@ public class ProductShopItem implements Serializable {
private BigDecimal limit; private BigDecimal limit;
private EventUser user; private EventUser user;
private String additionalInformation;
private ListDataModel<ProductOptionGroup> productOptionGroups = null; private ListDataModel<ProductOptionGroup> productOptionGroups = null;
private Map<ProductOptionGroup, ProductOption> selectedOptions = new HashMap<>(); private Map<ProductOptionGroup, ProductOption> selectedOptions = new HashMap<>();
...@@ -170,6 +173,14 @@ public class ProductShopItem implements Serializable { ...@@ -170,6 +173,14 @@ public class ProductShopItem implements Serializable {
return count; return count;
} }
public String getAdditionalInformation() {
return additionalInformation;
}
public void setAdditionalInformation(String additionalInformation) {
this.additionalInformation = additionalInformation;
}
public void setId(Integer setid) { public void setId(Integer setid) {
logger.info("Setting id {} to cart {}", setid, id); logger.info("Setting id {} to cart {}", setid, id);
if (!id.equals(setid)) { if (!id.equals(setid)) {
......
...@@ -1690,4 +1690,12 @@ user.allroles = ...@@ -1690,4 +1690,12 @@ user.allroles =
voting.create.entrysubmitrole = voting.create.entrysubmitrole =
compo.filetype.name = compo.filetype.name =
compo.filetype.sort = compo.filetype.sort =
compo.filetype.filetype = compo.filetype.filetype =
\ No newline at end of file accountEvent.ready=Cooked
accountEvent.markReady=Cook
foodwave.template.allowCustomInformation=Allow additional product info
product.additionalInformation=Additional info
acc_line.description=Add info
foodwavetemplate.buyInPrice=Buy in Price
foodwave.template.minPrice=Order min price
foodwave.notMinPrice=You must order atleast with amount of:
\ No newline at end of file
...@@ -1951,3 +1951,11 @@ place.assocUser = Associate ...@@ -1951,3 +1951,11 @@ place.assocUser = Associate
place.lockPlace = Lock place place.lockPlace = Lock place
place.releasePlace = Release place place.releasePlace = Release place
userlist.usersWithUnusedPlaceslots=Only users with unused placeslots userlist.usersWithUnusedPlaceslots=Only users with unused placeslots
accountEvent.ready=Cooked
accountEvent.markReady=Cook
foodwave.template.allowCustomInformation=Allow additional product info
product.additionalInformation=Additional info
acc_line.description=Lis\u00E4tietoja
foodwavetemplate.buyInPrice=Buy in Price
foodwave.template.minPrice=Order min price
foodwave.notMinPrice=You must order atleast with amount of:
...@@ -1928,7 +1928,7 @@ role.features = Tapahtuma ...@@ -1928,7 +1928,7 @@ role.features = Tapahtuma
bill.id_str=Laskun ID bill.id_str=Laskun ID
bill.filter_all=Kaikki bill.filter_all=Kaikki
holderize.header = Tulostettujen korttien kansiotus holderize.header = Tulostettujen korttien kansiotus
holderize.pageRows = Rivej sivulla holderize.pageRows = Rivej\u2030 sivulla
holderize.pageColumns = Sarakkeita sivulla holderize.pageColumns = Sarakkeita sivulla
holderize.folderName = Kansion nimi holderize.folderName = Kansion nimi
holderize.page = Sivu holderize.page = Sivu
...@@ -1937,8 +1937,16 @@ holderize.row = Rivi ...@@ -1937,8 +1937,16 @@ holderize.row = Rivi
holderize.barcode = Viivakoodi holderize.barcode = Viivakoodi
holderize.nextCodeHeader = Seuraavan kortin paikka holderize.nextCodeHeader = Seuraavan kortin paikka
holderize.parametersHeader = Kansion asetukset holderize.parametersHeader = Kansion asetukset
foodwave.updateList = Pivit lista foodwave.updateList = P\uFFFDivit\uFFFD lista
place.assocUser = Liitetty kyttj place.assocUser = Liitetty k\uFFFDytt\uFFFDj\uFFFD
place.lockPlace = Lukitse paikka place.lockPlace = Lukitse paikka
place.releasePlace = Vapauta paikka place.releasePlace = Vapauta paikka
userlist.usersWithUnusedPlaceslots=Vain käyttäjät joilla on käyttämättömiä paikkaslotteja userlist.usersWithUnusedPlaceslots=Vain k\u00E4ytt\u00E4j\u00E4t joilla on k\u00E4ytt\u00E4m\u00E4tt\u00F6mi\u00E4 paikkaslotteja
accountEvent.ready=Valmistettu
accountEvent.markReady=Valmis
foodwave.template.allowCustomInformation=Salli lis\u00E4tiedon sy\u00F6tt\u00E4minen
product.additionalInformation=Lis\u00E4tietoja
acc_line.description=Add info
foodwavetemplate.buyInPrice=Sis\u00E4\u00E4nostohinta
foodwave.template.minPrice=Tilauksen v\u00E4himm\u00E4ishinta
foodwave.notMinPrice=Minimitilaus on:
...@@ -25,14 +25,14 @@ ...@@ -25,14 +25,14 @@
<war-plugin-version>3.1.0</war-plugin-version> <war-plugin-version>3.1.0</war-plugin-version>
<ear-plugin-version>2.9</ear-plugin-version> <ear-plugin-version>2.9</ear-plugin-version>
<compiler-plugin-version>3.6.1</compiler-plugin-version> <compiler-plugin-version>3.8.1</compiler-plugin-version>
<!-- dependency versions --> <!-- dependency versions -->
<javaee-api-version>7.0</javaee-api-version> <javaee-api-version>8.0.1</javaee-api-version>
<!-- EJB spec version --> <!-- EJB spec version -->
<ejb-spec-version>3.2</ejb-spec-version> <ejb-spec-version>3.2</ejb-spec-version>
<swagger.version>1.5.20</swagger.version> <swagger.version>1.5.20</swagger.version>
<swaggerv3.version>2.0.2</swaggerv3.version> <swaggerv3.version>2.0.8</swaggerv3.version>
<slf4j.version>1.7.25</slf4j.version> <slf4j.version>1.7.25</slf4j.version>
<logback.version>1.2.3</logback.version> <logback.version>1.2.3</logback.version>
<testng.version>6.14.3</testng.version> <testng.version>6.14.3</testng.version>
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
<version>${compiler-plugin-version}</version> <version>${compiler-plugin-version}</version>
<configuration> <configuration>
<!-- <release>${java-version}</release> -->
<source>${java-version}</source> <source>${java-version}</source>
<target>${java-version}</target> <target>${java-version}</target>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!