Commit d7548936 by Tuomas Riihimäki

Merge branch 'insomnia_2014' of gitlab.codecrew.fi:codecrew/moya into ins16

2 parents d46efe97 6ebe8612
Showing with 582 additions and 21 deletions
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.beans;
import java.util.Map;
import javax.ejb.Local;
@Local
public interface StatisticsBeanLocal {
public Long getGroupMembershipsEnteredEvent();
public Long getCardDeliveredCount();
public Long getGroupMembershipsTotalCount();
public Map<Long, Long> getHourlyIncomingStatistics(long startingFromMillis, int hourCount);
}
...@@ -74,7 +74,7 @@ public class CheckoutBank { ...@@ -74,7 +74,7 @@ public class CheckoutBank {
logger.info("Added param for {} name {} value {}", new Object[] { key, paramName, paramValue }); logger.info("Added param for {} name {} value {}", new Object[] { key, paramName, paramValue });
} }
} }
System.out.println(); // System.out.println();
} }
......
...@@ -399,7 +399,7 @@ public class CardTemplateBean implements CardTemplateBeanLocal { ...@@ -399,7 +399,7 @@ public class CardTemplateBean implements CardTemplateBeanLocal {
card.setCardState(CardState.DELIVERED); card.setCardState(CardState.DELIVERED);
} else { } else {
logger.info("Not marking card to delivered: " + card.getCardState() + " : " + card.getId()); logger.info("Not marking card to delivered: " + card.getCardState() + " : " + card.getId());
} }
if (markUserPlacesDelivered) { if (markUserPlacesDelivered) {
for (GroupMembership membership : gmFacade.findMemberships(user)) { for (GroupMembership membership : gmFacade.findMemberships(user)) {
......
...@@ -302,6 +302,10 @@ public class MenuBean implements MenuBeanLocal { ...@@ -302,6 +302,10 @@ public class MenuBean implements MenuBeanLocal {
adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/editEvent"), EventPermission.MANAGE_PROPERTIES); adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/editEvent"), EventPermission.MANAGE_PROPERTIES);
adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/edit"), EventPermission.MANAGE_PROPERTIES).setVisible(false); adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/edit"), EventPermission.MANAGE_PROPERTIES).setVisible(false);
adminevent.addPage(menuitemfacade.findOrCreate("/reports/basicStatistics"), EventPermission.VIEW_STATISTICS);
MenuNavigation tournamentsadm = adminmenu.addPage(null, null); MenuNavigation tournamentsadm = adminmenu.addPage(null, null);
tournamentsadm.setKey("tournaments.menutitle"); tournamentsadm.setKey("tournaments.menutitle");
...@@ -332,6 +336,8 @@ public class MenuBean implements MenuBeanLocal { ...@@ -332,6 +336,8 @@ public class MenuBean implements MenuBeanLocal {
infonavi.addPage(menuitemfacade.findOrCreate("/info/index"), TerminalPermission.INFO); infonavi.addPage(menuitemfacade.findOrCreate("/info/index"), TerminalPermission.INFO);
infonavi.addPage(menuitemfacade.findOrCreate("/info/incoming"), TerminalPermission.INFO); infonavi.addPage(menuitemfacade.findOrCreate("/info/incoming"), TerminalPermission.INFO);
infonavi.addPage(menuitemfacade.findOrCreate("/info/shop"), TerminalPermission.INFO); infonavi.addPage(menuitemfacade.findOrCreate("/info/shop"), TerminalPermission.INFO);
infonavi.addPage(menuitemfacade.findOrCreate("/info/foodwave/foodwaveshop"), TerminalPermission.INFO);
infonavi.addPage(menuitemfacade.findOrCreate("/info/foodwave/foodwaveProducts"), TerminalPermission.INFO).setVisible(false);
navifacade.create(adminmenu); navifacade.create(adminmenu);
......
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.beans;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.enums.apps.EventPermission;
import fi.codecrew.moya.facade.GroupMembershipFacade;
import fi.codecrew.moya.facade.PrintedCardFacade;
import fi.codecrew.moya.model.GroupMembership;
/**
* Session Bean implementation class FoodWaveBean
*/
@Stateless
@DeclareRoles({ EventPermission.S_VIEW_STATISTICS })
public class StatisticsBean implements StatisticsBeanLocal {
private static final Logger logger = LoggerFactory.getLogger(StatisticsBean.class);
@EJB
GroupMembershipFacade groupMembershipFacade;
@EJB
PrintedCardFacade printedCardFacade;
@Override
@RolesAllowed(EventPermission.S_VIEW_STATISTICS)
public Long getGroupMembershipsEnteredEvent() {
return groupMembershipFacade.findGroupMembershipsEnteredCount();
}
@Override
@RolesAllowed(EventPermission.S_VIEW_STATISTICS)
public Long getCardDeliveredCount() {
return printedCardFacade.findDeliveredCardCount();
}
@Override
@RolesAllowed(EventPermission.S_VIEW_STATISTICS)
public Long getGroupMembershipsTotalCount() {
return groupMembershipFacade.findGroupMembershipsCount();
}
@Override
public Map<Long, Long> getHourlyIncomingStatistics(long startingFromMillis, int hourCount) {
List<GroupMembership> groupMemberships = groupMembershipFacade.findAllEnteredBetween(startingFromMillis, (startingFromMillis + ((long) hourCount)*60l*60l*1000l));
HashMap<Long, Long> retMap = new HashMap<Long, Long>();
long currentTimestamp = startingFromMillis;
long hour = (60l*60l*1000l);
long hourEntered = 0;
for(GroupMembership gm : groupMemberships) {
// find the hour this one belongs to (sometime we need to skip empty hours)
while(gm.getEnteredEvent().getTimeInMillis() > currentTimestamp+hour) {
retMap.put(currentTimestamp, hourEntered);
hourEntered = 0;
currentTimestamp += hour;
}
hourEntered++;
}
return retMap;
}
}
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
*/ */
package fi.codecrew.moya.facade; package fi.codecrew.moya.facade;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
...@@ -167,5 +169,72 @@ public class GroupMembershipFacade extends IntegerPkGenericFacade<GroupMembershi ...@@ -167,5 +169,72 @@ public class GroupMembershipFacade extends IntegerPkGenericFacade<GroupMembershi
return super.getSingleNullableResult(getEm().createQuery(cq)); return super.getSingleNullableResult(getEm().createQuery(cq));
} }
public Long findGroupMembershipsCount() {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<GroupMembership> root = cq.from(GroupMembership.class);
Path<PlaceGroup> pg = root.get(GroupMembership_.placeGroup);
cq.select(cb.count(root));
cq.where(cb.equal(pg.get(PlaceGroup_.event), eventbean.getCurrentEvent()));
return super.getSingleNullableResult(getEm().createQuery(cq));
}
public Long findGroupMembershipsEnteredCount() {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<GroupMembership> root = cq.from(GroupMembership.class);
Path<PlaceGroup> pg = root.get(GroupMembership_.placeGroup);
cq.select(cb.count(root));
cq.where(cb.not(cb.isNull(root.get(GroupMembership_.enteredEvent))),
cb.equal(pg.get(PlaceGroup_.event), eventbean.getCurrentEvent())
);
return super.getSingleNullableResult(getEm().createQuery(cq));
}
public List<GroupMembership> findAllEnteredBetween(long startTimestamp, long endTimestamp) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<GroupMembership> cq = cb.createQuery(GroupMembership.class);
Root<GroupMembership> root = cq.from(GroupMembership.class);
Path<PlaceGroup> pg = root.get(GroupMembership_.placeGroup);
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.setTimeInMillis(startTimestamp);
c2.setTimeInMillis(endTimestamp);
cq.where(cb.between(root.get(GroupMembership_.enteredEvent), c1, c2),
cb.equal(pg.get(PlaceGroup_.event), eventbean.getCurrentEvent()));
return getEm().createQuery(cq).getResultList();
}
} }
...@@ -38,6 +38,8 @@ import fi.codecrew.moya.model.CardCode; ...@@ -38,6 +38,8 @@ import fi.codecrew.moya.model.CardCode;
import fi.codecrew.moya.model.CardCode_; import fi.codecrew.moya.model.CardCode_;
import fi.codecrew.moya.model.CardTemplate_; import fi.codecrew.moya.model.CardTemplate_;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.GroupMembership;
import fi.codecrew.moya.model.GroupMembership_;
import fi.codecrew.moya.model.LanEvent; import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.PrintedCard_; import fi.codecrew.moya.model.PrintedCard_;
...@@ -137,4 +139,26 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> { ...@@ -137,4 +139,26 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> {
return new ArrayList<PrintedCard>(pch.values()); return new ArrayList<PrintedCard>(pch.values());
} }
public Long findDeliveredCardCount() {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<PrintedCard> root = cq.from(PrintedCard.class);
cq.select(cb.count(root));
cq.where(cb.equal(root.get(PrintedCard_.cardState), CardState.DELIVERED),
cb.equal(root.get(PrintedCard_.event), eventbean.getCurrentEvent()));
return super.getSingleNullableResult(getEm().createQuery(cq));
}
} }
...@@ -130,7 +130,7 @@ public class Bill extends GenericEntity { ...@@ -130,7 +130,7 @@ public class Bill extends GenericEntity {
@OrderBy("id") @OrderBy("id")
// @PrivateOwned // @PrivateOwned
@OneToMany(mappedBy = "bill", cascade = CascadeType.ALL) @OneToMany(mappedBy = "bill", cascade = CascadeType.ALL)
private List<BillLine> billLines; private List<BillLine> billLines = new ArrayList<BillLine>();
public boolean isPaid() public boolean isPaid()
{ {
......
...@@ -24,13 +24,15 @@ public enum EventPermission implements IAppPermission { ...@@ -24,13 +24,15 @@ public enum EventPermission implements IAppPermission {
MANAGE_PROPERTIES, MANAGE_PROPERTIES,
MANAGE_PRIVATE_PROPERTIES, MANAGE_PRIVATE_PROPERTIES,
MANAGE_EVENT MANAGE_EVENT,
VIEW_STATISTICS
; ;
public static final String S_MANAGE_PROPERTIES = "EVENT/MANAGE_PROPERTIES"; public static final String S_MANAGE_PROPERTIES = "EVENT/MANAGE_PROPERTIES";
public static final String S_MANAGE_PRIVATE_PROPERTIES = "EVENT/MANAGE_PRIVATE_PROPERTIES"; public static final String S_MANAGE_PRIVATE_PROPERTIES = "EVENT/MANAGE_PRIVATE_PROPERTIES";
public static final String S_MANAGE_EVENT = "EVENT/MANAGE_EVENT"; public static final String S_MANAGE_EVENT = "EVENT/MANAGE_EVENT";
public static final String S_VIEW_STATISTICS = "EVENT/VIEW_STATISTICS";
private final String fullName; private final String fullName;
private final String key; private final String key;
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:foodwave="http://java.sun.com/jsf/composite/cditools/foodwave" xmlns:products="http://java.sun.com/jsf/composite/cditools/products" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
>
<h:body>
<ui:composition template="/resources/templates/#{sessionHandler.infoscreen}/template.xhtml">
<f:metadata>
<f:viewParam name="foodwaveid" value="#{foodWaveFoodView.foodwaveid}" />
<f:viewParam name="userid" value="#{flowFoodwaveView.userId}" />
<f:event type="preRenderView" listener="#{flowFoodwaveView.initFoodsView}" />
</f:metadata>
<ui:define name="content">
<reader:backendReader selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{flowFoodwaveView.polledRead}" />
<h:form>
<p:autoComplete id="acsb" value="#{infoView.multiSearchUser}" completeMethod="#{infoView.matchMulti}" converter="#{eventUserConverter}" var="usrx" itemLabel="#{usrx.shortUserDescriptor}" itemValue="#{usrx}">
<p:ajax event="itemSelect" listener="#{flowFoodwaveView.changeUser}" />
</p:autoComplete>
</h:form>
<br /><br />
<h1>Shop to user: #{userView.selectedUser.user.nick}</h1>
<br /><br />
<foodwave:listFoods selectaction="#{foodWaveFoodView.buyAndPay}" items="#{foodWaveFoodView.shoppingcart}" commitValue="foodshop.buyAndPay" />
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:foodwave="http://java.sun.com/jsf/composite/cditools/foodwave"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
xmlns:p="http://primefaces.org/ui">
<h:body>
<ui:composition
template="/resources/templates/#{sessionHandler.infoscreen}/template.xhtml">
<f:metadata>
<f:viewParam name="userid" value="#{flowFoodwaveView.userId}" />
<f:viewParam name="templateid" value="#{foodWaveView.templateId}" />
<f:event type="preRenderView" listener="#{flowFoodwaveView.initView}" />
</f:metadata>
<ui:define name="content">
<reader:backendReader selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{flowFoodwaveView.polledRead}" />
<h:form>
<p:autoComplete id="acsb" value="#{infoView.multiSearchUser}" completeMethod="#{infoView.matchMulti}" converter="#{eventUserConverter}" var="usrx" itemLabel="#{usrx.shortUserDescriptor}" itemValue="#{usrx}">
<p:ajax event="itemSelect" listener="#{flowFoodwaveView.changeUser}" />
</p:autoComplete>
</h:form>
<br /><br />
<h1>Shop to user: #{userView.selectedUser.user.nick}</h1>
<br /><br />
<foodwave:list outcome="/info/foodwave/foodwaveProducts"/>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:products="http://java.sun.com/jsf/composite/tools/products"
xmlns:foodwave="http://java.sun.com/jsf/composite/tools"
xmlns:p="http://primefaces.org/ui"
>
<h:body>
<ui:composition template="#{sessionHandler.template}">
<ui:define name="content">
Sisällä: <p:outputLabel value="#{basicStatisticsView.groupMembershipsEnteredCount} / #{basicStatisticsView.groupMembershipsTotalCount}" /><br />
Korttei: <p:outputLabel value="#{basicStatisticsView.cardDeliveredCount}" />
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<h:link rendered="#{not foodwave.isFull()}" outcome="#{cc.attrs.outcome}" value="#{foodwave.name}"> <h:link rendered="#{not foodwave.isFull()}" outcome="#{cc.attrs.outcome}" value="#{foodwave.name}">
<f:param name="foodwaveid" value="#{foodwave.id}" /> <f:param name="foodwaveid" value="#{foodwave.id}" />
<f:param name="userid" value="#{userView.getCurrentUser().user.id}" /> <f:param name="userid" value="#{userView.selectedUser.user.id}" />
</h:link> </h:link>
<h:outputText rendered="#{foodwave.isFull()}" value="#{foodwave.name}" /> <h:outputText rendered="#{foodwave.isFull()}" value="#{foodwave.name}" />
......
...@@ -64,6 +64,8 @@ body { ...@@ -64,6 +64,8 @@ body {
list-style: none; list-style: none;
} }
#top-menu li a { #top-menu li a {
display: block; display: block;
line-height: 1.7em; line-height: 1.7em;
...@@ -270,18 +272,14 @@ label { ...@@ -270,18 +272,14 @@ label {
.bgColor1 { .bgColor1 {
background-color: #68A3C2; background-color: #68A3C2;
} }
/*
#header { #header {
clear: both; clear: both;
float: left; float: left;
width: 100%; width: 100%;
border-bottom: 4px solid #333; border-bottom: 4px solid #333;
} }*/
#header a {
color: white;
text-decoration: none;
}
#header_left { #header_left {
float: left; float: left;
......
...@@ -174,7 +174,7 @@ a.shopItem:active { ...@@ -174,7 +174,7 @@ a.shopItem:active {
color: #666600; color: #666600;
} }
.expired { .expired, .closed {
color: #c0c0c0; color: #c0c0c0;
} }
...@@ -223,4 +223,7 @@ a.shopItem:active { ...@@ -223,4 +223,7 @@ a.shopItem:active {
padding-left: 40px !important; padding-left: 40px !important;
} }
.hidden {
display: none !important;
visibility: hidden;
}
...@@ -278,10 +278,7 @@ label { ...@@ -278,10 +278,7 @@ label {
border-bottom: 4px solid #333; border-bottom: 4px solid #333;
} }
#header a {
color: white;
text-decoration: none;
}
#header_left { #header_left {
float: left; float: left;
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
<artifactId>javamelody-core</artifactId> <artifactId>javamelody-core</artifactId>
<version>1.52.0</version> <version>1.52.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.primefaces</groupId> <groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId> <artifactId>primefaces</artifactId>
<version>5.0</version> <version>5.1</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -347,12 +347,14 @@ submenu.NotImplementedYet = Not implemented ...@@ -347,12 +347,14 @@ submenu.NotImplementedYet = Not implemented
submenu.admin.adduser = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys submenu.admin.adduser = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys
submenu.admin.adduser.index = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys submenu.admin.adduser.index = K\u00E4ytt\u00E4j\u00E4nlis\u00E4ys
submenu.frontpage = Frontpage submenu.frontpage = Frontpage
submenu.info.foodwave.foodwaveshop = Ruokakauppa
submenu.info.incoming = Sis\u00E4\u00E4ntulo submenu.info.incoming = Sis\u00E4\u00E4ntulo
submenu.info.index = Infon\u00E4kym\u00E4 submenu.info.index = Infon\u00E4kym\u00E4
submenu.info.shop = Kauppa submenu.info.shop = Kauppa
submenu.lectureadmin.lectureParticipants = Tarkastele osallistujia submenu.lectureadmin.lectureParticipants = Tarkastele osallistujia
submenu.lectureadmin.manageLectureGroups = Hallinnoi submenu.lectureadmin.manageLectureGroups = Hallinnoi
submenu.lectures.viewLectures = Ilmoittaudu submenu.lectures.viewLectures = Ilmoittaudu
submenu.reports.basicStatistics = Tilastoja
subnavi.cards = \u0009\u0009 subnavi.cards = \u0009\u0009
subnavi.info = Info subnavi.info = Info
......
...@@ -1170,6 +1170,7 @@ submenu.foodmanager.listFoodwaves = List active foodwaves ...@@ -1170,6 +1170,7 @@ submenu.foodmanager.listFoodwaves = List active foodwaves
submenu.foodwave.list = Foodwaves submenu.foodwave.list = Foodwaves
submenu.foodwave.listTemplates = Food provides submenu.foodwave.listTemplates = Food provides
submenu.index = Frontpage submenu.index = Frontpage
submenu.info.foodwave.foodwaveshop = Foodshop
submenu.info.incoming = Incomingview submenu.info.incoming = Incomingview
submenu.info.index = Infoview submenu.info.index = Infoview
submenu.info.shop = Shop submenu.info.shop = Shop
...@@ -1194,6 +1195,7 @@ submenu.place.placemap = Placemap ...@@ -1194,6 +1195,7 @@ submenu.place.placemap = Placemap
submenu.poll.index = Polls submenu.poll.index = Polls
submenu.product.create = Create product submenu.product.create = Create product
submenu.product.list = List products submenu.product.list = List products
submenu.reports.basicStatistics = Statistics
submenu.role.create = Create role submenu.role.create = Create role
submenu.role.list = Show Roles submenu.role.list = Show Roles
submenu.shop.createBill = Purchase submenu.shop.createBill = Purchase
......
...@@ -1150,6 +1150,7 @@ submenu.foodmanager.listFoodwaves = Aktiiviset ruokatilaukset ...@@ -1150,6 +1150,7 @@ submenu.foodmanager.listFoodwaves = Aktiiviset ruokatilaukset
submenu.foodwave.list = Ruokatilaukset submenu.foodwave.list = Ruokatilaukset
submenu.frontpage = Etusivu submenu.frontpage = Etusivu
submenu.index = Etusivu submenu.index = Etusivu
submenu.info.foodwave.foodwaveshop = Ruokakauppa
submenu.info.incoming = Sis\u00E4\u00E4ntulo submenu.info.incoming = Sis\u00E4\u00E4ntulo
submenu.info.index = Infon\u00E4kym\u00E4 submenu.info.index = Infon\u00E4kym\u00E4
submenu.info.shop = Kauppa submenu.info.shop = Kauppa
...@@ -1174,6 +1175,7 @@ submenu.place.placemap = Paikkakartta ...@@ -1174,6 +1175,7 @@ submenu.place.placemap = Paikkakartta
submenu.poll.index = Kyselyt submenu.poll.index = Kyselyt
submenu.product.create = Uusi tuote submenu.product.create = Uusi tuote
submenu.product.list = Listaa tuotteet submenu.product.list = Listaa tuotteet
submenu.reports.basicStatistics = Tilastoja
submenu.role.create = Luo rooli submenu.role.create = Luo rooli
submenu.role.list = N\u00E4yt\u00E4 roolit submenu.role.list = N\u00E4yt\u00E4 roolit
submenu.shop.createBill = Osta tuotteita submenu.shop.createBill = Osta tuotteita
......
...@@ -198,6 +198,9 @@ public class UserView extends GenericCDIView { ...@@ -198,6 +198,9 @@ public class UserView extends GenericCDIView {
return user; return user;
} }
public String saveRoles() public String saveRoles()
{ {
rolebean.saveRoles(user, usersRoles); rolebean.saveRoles(user, usersRoles);
...@@ -418,8 +421,9 @@ public class UserView extends GenericCDIView { ...@@ -418,8 +421,9 @@ public class UserView extends GenericCDIView {
// still there, we can get real card and update it's barcodes // still there, we can get real card and update it's barcodes
card = cardBean.checkPrintedCard(user); card = cardBean.checkPrintedCard(user);
readerbean.assocCodeToCard(event, card); event = readerbean.assocCodeToCard(event, card);
user = event.getUser();
return null; return null;
} }
......
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.web.flow;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.primefaces.event.SelectEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.reader.ReaderView;
import fi.codecrew.moya.web.cdiview.shop.FoodWaveFoodView;
import fi.codecrew.moya.web.cdiview.shop.FoodWaveView;
import fi.codecrew.moya.web.cdiview.shop.ProductShopView;
import fi.codecrew.moya.web.cdiview.user.UserView;
@Named
@ConversationScoped
public class FlowFoodwaveView extends GenericCDIView {
private static final long serialVersionUID = 802344850073689859L;
private static final Logger logger = LoggerFactory.getLogger(IncomingView.class);
// shop userid, we need this so we can tell when to show anonymous and when real user.
private Integer userId;
@EJB
PermissionBeanLocal permBean;
@Inject
private FoodWaveView foodwaveView;
@Inject
private FoodWaveFoodView foodWaveFoodView;
@Inject
private UserView userView;
@Inject
private InfoView infoView;
@Inject
private ReaderView readerView;
@Inject
private FlowUserContainer flowUserContainer;
public void initView() {
if(userId == null || userId == 0) {
userView.setUserid(null);
} else {
userView.setUserid(userId);
}
foodwaveView.initListFoodwaves();
}
public void initFoodsView() {
if(userId == null || userId == 0) {
userView.setUserid(null);
} else {
userView.setUserid(userId);
}
foodWaveFoodView.initFoodWaveFoods();
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public void changeUser(SelectEvent event) {
if (infoView.getMultiSearchUser() != null) {
flowUserContainer.setUserId(infoView.getMultiSearchUser().getUser().getId());
// TODO: kauneista nää
super.navihandler.redirectNavigation("/MoyaWeb/info/foodwave/foodwaveshop.jsf?userid=" + infoView.getMultiSearchUser().getUser().getId());
}
}
public void polledRead() {
ReaderEvent event = readerView.getReaderEvent();
if(event == null) {
return;
}
EventUser user = event.getUser();
if (user != null) {
if (!user.equals(userView.getUser())) {
logger.info("found user {}, redirecting", user.getNick());
userView.setUser(user);
flowUserContainer.setUserId(user.getUser().getId());
super.navihandler.redirectNavigation("/MoyaWeb/info/foodwave/foodwaveshop.jsf?userid=" + user.getUser().getId());
}
}
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.web.reports;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.model.ListDataModel;
import javax.inject.Named;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.LectureBeanLocal;
import fi.codecrew.moya.beans.StatisticsBeanLocal;
import fi.codecrew.moya.enums.apps.LecturePermission;
import fi.codecrew.moya.model.Lecture;
import fi.codecrew.moya.model.LectureGroup;
import fi.codecrew.moya.utilities.I18n;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
@RequestScoped
public class BasicStatisticsView extends GenericCDIView {
private static final long serialVersionUID = 1L;
@EJB
private StatisticsBeanLocal statisticsBean;
public Long getGroupMembershipsEnteredCount() {
return statisticsBean.getGroupMembershipsEnteredEvent();
}
public Long getCardDeliveredCount() {
return statisticsBean.getCardDeliveredCount();
}
public Long getGroupMembershipsTotalCount() {
return statisticsBean.getGroupMembershipsTotalCount();
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!