Commit 653d2668 by Antti Tönkyrä

reverse-jyräys :)

1 parent 5d97b618
...@@ -67,7 +67,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -67,7 +67,7 @@ public class FoodWaveView extends GenericCDIView {
private Integer foodWaveId; private Integer foodWaveId;
private ListDataModel<AccountEvent> accountEventLines; private ListDataModel<AccountEvent> accountEventLines;
private List<FoodWave> foodWaves; private ListDataModel<FoodWave> foodWaves;
private static final Logger logger = LoggerFactory.getLogger(FoodWaveView.class); private static final Logger logger = LoggerFactory.getLogger(FoodWaveView.class);
public List<Product> getProducts() { public List<Product> getProducts() {
...@@ -79,6 +79,11 @@ public class FoodWaveView extends GenericCDIView { ...@@ -79,6 +79,11 @@ public class FoodWaveView extends GenericCDIView {
public void onEdit() { public void onEdit() {
this.foodWaveBean.saveTemplate(template); this.foodWaveBean.saveTemplate(template);
} }
public void onEditFoodWave() {
FoodWave fw = foodWaves.getRowData();
this.foodWaveBean.merge(fw);
}
public void initTemplateList() { public void initTemplateList() {
super.requirePermissions(ShopPermission.SHOP_FOODWAVE); super.requirePermissions(ShopPermission.SHOP_FOODWAVE);
...@@ -87,7 +92,11 @@ public class FoodWaveView extends GenericCDIView { ...@@ -87,7 +92,11 @@ public class FoodWaveView extends GenericCDIView {
public void initFoodwaveManagerList() { public void initFoodwaveManagerList() {
if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES)) if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES))
{ {
foodWaves = foodWaveBean.getEventFoodWaves(); if(foodWaves == null) {
super.beginConversation();
foodWaves = new ListDataModel<FoodWave>(foodWaveBean.getEventFoodWaves());
}
} }
} }
...@@ -110,9 +119,9 @@ public class FoodWaveView extends GenericCDIView { ...@@ -110,9 +119,9 @@ public class FoodWaveView extends GenericCDIView {
if (templateId != null) if (templateId != null)
{ {
template = foodWaveBean.findTemplate(templateId); template = foodWaveBean.findTemplate(templateId);
foodWaves = template.getFoodwaves(); foodWaves = new ListDataModel<FoodWave>(template.getFoodwaves());
} else { } else {
foodWaves = foodWaveBean.getOpenFoodWaves(); foodWaves = new ListDataModel<FoodWave>(foodWaveBean.getOpenFoodWaves());
} }
super.beginConversation(); super.beginConversation();
} }
...@@ -235,7 +244,8 @@ public class FoodWaveView extends GenericCDIView { ...@@ -235,7 +244,8 @@ public class FoodWaveView extends GenericCDIView {
public String deliverAccountEvent() { public String deliverAccountEvent() {
if (getAccountEventLines().isRowAvailable()) { if (getAccountEventLines().isRowAvailable()) {
AccountEvent e = getAccountEventLines().getRowData(); AccountEvent e = getAccountEventLines().getRowData();
e = accountEventBean.markDelivered(e, Calendar.getInstance()); e.setDelivered(Calendar.getInstance());
e = accountEventBean.merge(e);
foodWaveId = selectedFoodWave.getId(); foodWaveId = selectedFoodWave.getId();
selectedFoodWave = null; selectedFoodWave = null;
...@@ -334,11 +344,11 @@ public class FoodWaveView extends GenericCDIView { ...@@ -334,11 +344,11 @@ public class FoodWaveView extends GenericCDIView {
this.billLines = billLines; this.billLines = billLines;
} }
public void setFoodWaves(List<FoodWave> foodWaves) { public void setFoodWaves(ListDataModel<FoodWave> foodWaves) {
this.foodWaves = foodWaves; this.foodWaves = foodWaves;
} }
public List<FoodWave> getFoodWaves() { public ListDataModel<FoodWave> getFoodWaves() {
return foodWaves; return foodWaves;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!