Commit 3fab346e by Antti Tönkyrä

Merge branch 'master' of codecrew.fi:bortal

Conflicts:
	code/LanBortalWeb/WebContent/foodadmin/listTemplates.xhtml
2 parents f22003ba a985f63e
...@@ -35,6 +35,12 @@ public class FoodWaveBean implements FoodWaveBeanLocal { ...@@ -35,6 +35,12 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
@Override @Override
@RolesAllowed(ShopPermission.S_MANAGE_PRODUCTS) @RolesAllowed(ShopPermission.S_MANAGE_PRODUCTS)
public void createFoodWave(FoodWave fw) {
foodWaveFacade.create(fw);
}
@Override
@RolesAllowed(ShopPermission.S_MANAGE_PRODUCTS)
public FoodWaveTemplate saveOrCreateTemplate(FoodWaveTemplate template) { public FoodWaveTemplate saveOrCreateTemplate(FoodWaveTemplate template) {
if (template.getId() == null) if (template.getId() == null)
{ {
......
...@@ -27,4 +27,6 @@ public interface FoodWaveBeanLocal { ...@@ -27,4 +27,6 @@ public interface FoodWaveBeanLocal {
public FoodWave merge(FoodWave foodWave); public FoodWave merge(FoodWave foodWave);
public List<FoodWave> getEventFoodWaves(); public List<FoodWave> getEventFoodWaves();
public void createFoodWave(FoodWave fw);
} }
...@@ -31,7 +31,20 @@ ...@@ -31,7 +31,20 @@
</h:panelGrid> </h:panelGrid>
</p:panel> </p:panel>
<p:panel header="#{i18n['foodwavetemplate.createwave']}"> <p:panel header="#{i18n['foodwavetemplate.createwave']}">
<p:calendar value="#{foodWaveView.startDate}" pattern="dd.MM.yyyy HH:mm" /> <h:panelGrid columns="3">
<h:outputLabel for="waveName" value="#{i18n['foodwavetemplate.waveName']}" />
<h:inputText id="waveName" value="#{foodWaveView.selectedFoodWave.name}" />
<h:message for="waveName" />
<h:outputLabel for="waveMaxFoods" value="#{i18n['foodwavetemplate.maxfoods']}" />
<h:inputText id="waveMaxFoods" value="#{foodWaveView.selectedFoodWave.maximumFoods}" />
<h:message for="waveMaxFoods" />
<h:outputLabel for="startTime" value="#{i18n['foodwavetemplate.startTime']}"/>
<p:calendar id="startTime" value="#{foodWaveView.startDate}" pattern="dd.MM.yyyy HH:mm" />
<h:message for="startTime" />
</h:panelGrid>
<h:commandButton action="#{foodWaveView.createFoodwave()}" value="#{i18n['foodwavetemplate.createFoodwave']}" /> <h:commandButton action="#{foodWaveView.createFoodwave()}" value="#{i18n['foodwavetemplate.createFoodwave']}" />
</p:panel> </p:panel>
</h:form> </h:form>
......
...@@ -15,17 +15,16 @@ ...@@ -15,17 +15,16 @@
</ui:define> </ui:define>
<ui:define name="content"> <ui:define name="content">
<h:dataTable var="foodwaveTemplate" value="#{foodWaveView.templates}">
<h:dataTable var="templ" value="#{foodWaveVie}">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['foodwaveTemplate.name']}" /> <h:outputText value="#{i18n['foodwaveTemplate.name']}" />
</f:facet> </f:facet>
<h:outputText value="#{templ.name}" /> <h:outputText value="#{foodwaveTemplate.name}" />
</h:column> </h:column>
<h:column> <h:column>
<h:link value="LOL" outcome="/foodadmin/editTemplate"> <h:link value="LOL" outcome="/foodadmin/editTemplate">
<f:param value="#{templ.}" name="id" /> <f:param value="#{foodwaveTemplate.id}" name="id"/>
</h:link> </h:link>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
......
package fi.insomnia.bortal.web.cdiview.shop; package fi.insomnia.bortal.web.cdiview.shop;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.Vector; import java.util.Vector;
...@@ -55,12 +56,24 @@ public class FoodWaveView extends GenericCDIView { ...@@ -55,12 +56,24 @@ public class FoodWaveView extends GenericCDIView {
} }
public String createFoodwave() {
Calendar c = Calendar.getInstance();
c.setTime(startDate);
selectedFoodWave.setTime(c);
foodWaveBean.createFoodWave(selectedFoodWave);
return "/foodadmin/listTemplates";
}
public void initEditTemplate() { public void initEditTemplate() {
if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && template == null) if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && template == null)
{ {
template = foodWaveBean.findTemplate(templateId); template = foodWaveBean.findTemplate(templateId);
selectedFoodWave = new FoodWave();
selectedFoodWave.setTemplate(template);
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!