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 {
@Override
@RolesAllowed(ShopPermission.S_MANAGE_PRODUCTS)
public void createFoodWave(FoodWave fw) {
foodWaveFacade.create(fw);
}
@Override
@RolesAllowed(ShopPermission.S_MANAGE_PRODUCTS)
public FoodWaveTemplate saveOrCreateTemplate(FoodWaveTemplate template) {
if (template.getId() == null)
{
......
......@@ -27,4 +27,6 @@ public interface FoodWaveBeanLocal {
public FoodWave merge(FoodWave foodWave);
public List<FoodWave> getEventFoodWaves();
public void createFoodWave(FoodWave fw);
}
......@@ -31,7 +31,20 @@
</h:panelGrid>
</p:panel>
<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']}" />
</p:panel>
</h:form>
......
......@@ -15,17 +15,16 @@
</ui:define>
<ui:define name="content">
<h:dataTable var="templ" value="#{foodWaveVie}">
<h:dataTable var="foodwaveTemplate" value="#{foodWaveView.templates}">
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['foodwaveTemplate.name']}" />
</f:facet>
<h:outputText value="#{templ.name}" />
<h:outputText value="#{foodwaveTemplate.name}" />
</h:column>
<h:column>
<h:link value="LOL" outcome="/foodadmin/editTemplate">
<f:param value="#{templ.}" name="id" />
<f:param value="#{foodwaveTemplate.id}" name="id"/>
</h:link>
</h:column>
</h:dataTable>
......
package fi.insomnia.bortal.web.cdiview.shop;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.TreeSet;
import java.util.Vector;
......@@ -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() {
if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && template == null)
{
template = foodWaveBean.findTemplate(templateId);
selectedFoodWave = new FoodWave();
selectedFoodWave.setTemplate(template);
super.beginConversation();
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!