Commit 9db5cdc0 by Tuukka Kivilahti Committed by Tuukka Kivilahti

infoviilausta, kauppa infoon

1 parent 3cb7ca22
......@@ -292,6 +292,7 @@ public class MenuBean implements MenuBeanLocal {
infonavi.setKey("subnavi.info");
infonavi.addPage(menuitemfacade.findOrCreate("/info/index"), TerminalPermission.INFO);
infonavi.addPage(menuitemfacade.findOrCreate("/info/incoming"), TerminalPermission.INFO);
infonavi.addPage(menuitemfacade.findOrCreate("/info/shop"), TerminalPermission.INFO);
navifacade.create(adminmenu);
......
......@@ -2,7 +2,7 @@
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:p="http://primefaces.org/ui" xmlns:shop="http://java.sun.com/jsf/composite/cditools/shop" xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:user="http://java.sun.com/jsf/composite/cditools/user">
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:user="http://java.sun.com/jsf/composite/cditools/user" xmlns:infoview="http://java.sun.com/jsf/composite/cditools/infoview">
<h:body>
<ui:composition template="/resources/templates/#{sessionHandler.fullscreen}/template.xhtml">
......@@ -11,6 +11,7 @@
<f:event type="preRenderView" listener="#{incomingView.initPrintCardView}" />
</f:metadata>
<ui:define name="content">
<!-- HEAD -->
<h1>#{i18n['incomingflow.search']}</h1>
<h:form>
<h:panelGrid columns="2" >
......@@ -27,8 +28,19 @@
</h:panelGrid>
</h:form>
<!-- yhtäsuurimerkit -->
<reader:backendReader selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{incomingView.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="#{incomingView.changeUser}" />
</p:autoComplete>
</h:form>
<!-- infoviilausta, kauppa infoon -->
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<h1>#{i18n['incomingflow.userdetails']}</h1>
<h:panelGrid id="cropper" columns="3">
<h:panelGroup>
<user:edit id="usereditor" commitaction="#{incomingView.saveUser()}" commitvalue="#{i18n['user.save']}" camAlwaysOn="true" />
......@@ -52,6 +64,7 @@
</h:panelGrid>
<h:outputText rendered="#{empty incomingView.groupMemberships}" value="#{i18n['placegroupview.noMemberships']}" />
......@@ -95,8 +108,6 @@
</p:dataTable>
</h:form>
</ui:define>
<ui:define name="sidebar">
......
......@@ -26,18 +26,14 @@
<ui:define name="headercontent">
<infoview:userselector />
</ui:define>
<ui:define name="content">
<h:form>
<h:commandButton action="#{incomingView.changeToIncomingView}" value="#{i18n['incoming.changetoview']}" />
</h:form>
<infoview:userselector />
<br />
<br />
<reader:codefield selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{incomingView.selectUser}" />
<reader:backendReader selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{incomingView.selectUser}" />
<!-- reader:backendReader selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{infoView.selectUser}" / -->
......
<!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:p="http://primefaces.org/ui" xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:user="http://java.sun.com/jsf/composite/cditools/user"
xmlns:infoview="http://java.sun.com/jsf/composite/cditools/infoview"
xmlns:shop="http://java.sun.com/jsf/composite/cditools/shop"
>
<h:body>
<ui:composition template="/resources/templates/#{sessionHandler.fullscreen}/template.xhtml">
<f:metadata>
<f:viewParam name="userid" value="#{flowShopView.userId}" />
<f:event type="preRenderView" listener="#{flowShopView.initView}" />
</f:metadata>
<ui:define name="content">
<reader:backendReader selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{incomingView.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="#{flowShopView.changeUser}" />
</p:autoComplete>
</h:form>
<h:form rendered="#{!userView.user.anonymous}">
<h1>Shop to user: #{userView.user.user.nick}</h1>
</h:form>
<h:form rendered="#{userView.user.anonymous}">
<h1>Infon kauppa</h1>
</h:form>
<shop:shoppingcart />
</ui:define>
<ui:define name="sidebar">
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -17,7 +17,8 @@
</composite:interface>
<composite:implementation>
<reader:backendReader />
<reader:backendReader selectvalue="#{i18n['barcodeReader.readBarcode']}" selectaction="#{incomingView.selectUser}" />
</composite:implementation>
......
......@@ -18,19 +18,20 @@ xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
<composite:attribute name="showEditReader" required="false" />
</composite:interface>
<composite:implementation>
<h:form id="reader_autopoll" rendered="#{readerView.pollingMode}">
<p:poll interval="1" listener="#{cc.attrs.selectaction}" onerror="location.reload();" />
</h:form>
<h:form id="autopoller">
<h:panelGroup id="reader_autopoll">
<p:poll rendered="#{readerView.pollingMode}" interval="1" listener="#{cc.attrs.selectaction}" onerror="location.reload();" />
</h:panelGroup>
<h:form rendered="#{empty readerNameContainer.readerId}">
<p:dataTable border="1" id="reader" value="#{readerListDataView.readers}" var="rr">
<p:column>
<p:dataTable rendered="#{empty readerNameContainer.readerId}" border="1" id="reader" value="#{readerListDataView.readers}" var="rr">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['reader.name']}" />
</f:facet>
......@@ -39,23 +40,25 @@ xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
<p:column>
<p:commandButton actionListener="#{readerListDataView.selectReader}" value="#{i18n['reader.select']}" update="@all" />
</p:column>
<p:column rendered="#{cc.attrs.showEditReader}" >
<p:column rendered="#{cc.attrs.showEditReader}">
<h:link outcome="/shop/editReader" value="#{i18n['reader.edit']}">
<f:param value="#{rr.id}" name="readerId" />
</h:link>
</p:column>
</p:dataTable>
</h:form>
<h:form>
<p:outputLabel value="#{i18n['reader.autopoll']}" /><p:selectBooleanButton offLabel="#{i18n['off']}" onLabel="#{i18n['on']}" value="#{readerView.pollingMode}" immediate="true" update="reader_autopoll" />
</h:form>
<reader:readerevents rendered="#{!empty readerNameContainer.readerId}" showAssociateToUser="#{cc.attrs.showAssociateToUser}" selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" linkvalue="#{cc.attrs.linkvalue}" linkoutcome="#{cc.attrs.linkoutcome}" />
<p:outputLabel value="#{i18n['reader.autopoll']}" />
<p:selectBooleanButton offLabel="#{i18n['off']}" onLabel="#{i18n['on']}" value="#{readerView.pollingMode}" immediate="true">
<p:ajax update="reader_autopoll,readerevents" />
</p:selectBooleanButton>
<p:commandLink actionListener="#{readerView.changeReader}" value="#{i18n['incomingflow.changereader']}" update="@all" />
<h:panelGroup id="readerevents">
<reader:readerevents rendered="#{!empty readerNameContainer.readerId and !readerView.pollingMode}" showAssociateToUser="#{cc.attrs.showAssociateToUser}" selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" linkvalue="#{cc.attrs.linkvalue}" linkoutcome="#{cc.attrs.linkoutcome}" />
</h:panelGroup>
</h:form>
</composite:implementation>
</html>
\ No newline at end of file
......@@ -14,11 +14,11 @@
</composite:interface>
<composite:implementation>
<h:form>
<p:poll interval="3" onerror="location.reload();" update="eventlist" />
<p:commandLink actionListener="#{readerView.changeReader}" value="#{i18n['incomingflow.changereader']}" update="@all" />
<p:dataTable border="1" id="eventlist" value="#{readerView.readerEvents}" var="event">
<f:facet name="header">
<p:outputLabel value="#{readerView.currentReader.identification}" />
......@@ -68,7 +68,7 @@
</p:column>
</p:dataTable>
</h:form>
</composite:implementation>
......
/* General css, use for non-layout purposes for general elements */
/* userlistview popup */
.userdata_popup {
position: absolute;
border: 1px solid black;
background: white;
border-radius: 3px;
display: none;
width: 300px;
height: 150px;
}
/* general class for hoverable usage */
.hoverable {
}
.hidden {
display: none;
}
#webcamcontainer {
}
#shopItems {
}
.ui-panel-title {
text-overflow: clip;
}
.shopItem, .touchItem {
float: left;
width: 72px;
height: 72px;
background: #40BDE8;
border: 1px solid black;
margin: 2px;
}
a.shopItem, a.touchItem {
color: black !important;
}
a.shopItem div, a.touchItem div {
position: absolute;
height: 72px;
width: 72px;
text-align: center;
/* Firefox */
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-pack: center;
-moz-box-align: center;
/* Safari and Chrome */
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;
/* W3C */
display: box;
box-orient: horizontal;
box-pack: center;
box-align: center;
clip: rect(0, 72px, 72px, 0);
}
}
a.shopItem:hover, a.touchItem:hover {
background: rgba(255,255,255,0.4);
}
a.shopItem:active, a.touchItem:active {
background: red;
}
\ No newline at end of file
* {
padding: 0;
margin: 0;
}
body {
margin: 0em;
font-size: 62.5%;
background-color: #fff;
font-family: verdana, arial, sans-serif;
} /*Font-size: 1.0em = 10px when browser default size is 16px*/
#page-container {
width: 900px;
margin: 0 auto;
border: 1px solid #bbb;
margin-top: 10px;
background: white;
border-radius: 12px;
background: rgb(255, 255, 255) url("../img/bg_main_nav.jpg");
}
#page-header {
height: 80px;
background: rgb(240, 240, 240) url("../img/bg_head_top.jpg");
overflow: visible !important /*Firefox*/;
overflow: hidden /*IE6*/;
border-radius: 12px 12px 0 0;
}
#login {
margin-top: 10px;
margin-right: 10px;
float: right;
text-align: right;
}
#login a,#login a:visited {
text-decoration: none;
color: black;
font-weight: bold;
}
#login a:hover {
color: red;
}
#top-menu {
position: relative;
z-index: 0;
top: 2em;
}
#top-menu ul {
float: left;
width: 100%;
padding-left: 25px;
border: 1px solid rgba(200, 200, 200, 0);
background: rgba(200, 200, 200, 0);
border-radius: 16px 16px 0 0;
}
#top-menu li {
display: inline;
list-style: none;
}
#top-menu li a {
display: block;
line-height: 1.7em;
float: left;
padding: 2px 5px 2px 5px;
color: rgb(125, 125, 125);
text-decoration: none;
font-size: 120%;
background-color: rgba(100, 100, 100, 0.1);
color: rgba(0, 0, 0, 0.3);
border-radius: 12px 12px 0 0;
border: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: none;
}
#top-menu a:hover {
text-decoration: none;
color: rgb(50, 50, 50);
}
#top-menu li .active {
font-weight: bold;
background-color: rgba(250, 250, 250, 0.4);
color: rgba(0, 0, 0, 1);
border-radius: 12px 12px 0 0;
border: 1px solid black;
border-bottom: none
}
#pageheader {
background: red;
}
#main {
clear: both;
}
#main-nav {
float: left;
width: 100%;
border-top: 1px solid #bbb;
border-bottom: 1px solid #bbb;
background: rgb(220, 220, 220) url("../img/bg_head_bottom_nav.jpg")
repeat-x;
color: rgb(75, 75, 75);
font-size: 130%;
}
#main-nav ul {
list-style-type: none;
}
#main-nav ul li {
float: left;
position: relative;
z-index: auto !important /*Non-IE6*/;
z-index: 1000 /*IE6*/;
}
#main-nav ul li a {
float: none !important /*Non-IE6*/;
float: left /*IE-6*/;
display: block;
height: 3.1em;
line-height: 3.1em;
padding: 0 16px 0 16px;
text-decoration: none;
font-weight: bold;
color: rgb(100, 100, 100);
}
#main-nav ul li ul {
display: none;
border: none;
}
#main-nav ul li .active {
font-weight: bold;
background-color: rgba(0, 150, 250, 0.35);
color: rgba(255, 255, 250, 0.8);
}
#main-nav ul li:hover a {
background-color: rgba(0, 150, 250, 0.1);
text-decoration: none;
} /*Color main cells hovering mode*/
#main-nav ul li:hover ul {
display: block;
width: 10.0em;
position: absolute;
z-index: 999;
top: 3.0em;
margin-top: 0.1em;
left: 0;
}
#main-nav ul li:hover ul li a {
display: block;
width: 10.0em;
height: auto;
line-height: 1.3em;
margin-left: -1px;
padding: 4px 16px 4px 16px;
border-left: solid 1px rgb(175, 175, 175);
border-bottom: solid 1px rgb(175, 175, 175);
background-color: rgb(237, 237, 237);
font-weight: normal;
color: rgb(50, 50, 50);
} /*Color subcells normal mode*/
#main-nav ul li:hover ul li a:hover {
background-color: rgb(210, 210, 210);
text-decoration: none;
} /*Color subcells hovering mode*/
.container.top,.container.bottom {
clear: both;
text-align: center;
margin-bottom: 2em;
margin-top: 1em;
padding-left: 2em;
}
.container.top a,.container.bottom a {
font-size: 90%;
color: #aaa;
text-decoration: none;
}
#right {
display: inline /*Fix IE floating margin bug*/;
float: right;
overflow: visible !important /*Firefox*/;
overflow: hidden /*IE6*/;
}
#right {
width: 400px;
float-left: 1px solid black;
}
#left {
display: inline; /*Fix IE floating margin bug*/;
float: left;
width: 660px;
margin: 0 20px;
overflow: visible !important /*Firefox*/;
overflow: hidden /*IE6*/;
}
#left h1 {
margin-bottom: 1em;
}
#left a {
text-decoration: none;
color: blue;
}
#left:a visited {
color: blue;
}
#left h1,#left h2,#left p {
margin-bottom: 1.5em;
}
.container.bottom {
clear: both;
}
table {
border: none;
border-spacing: 0;
width: 100%;
text-align: left;
margin-bottom: 1.5em;
}
table thead th {
border: none;
font-size: 120%;
}
table thead th {
border-bottom: 1px solid black;
padding: 5px;
padding-left: 1em;
}
table tbody td {
border: none;
padding: 5px;
padding-left: 1em;
vertical-align: top;
}
label {
}
.expired {
color: #c0c0c0;
}
.bgColor1 {
background-color: #68A3C2;
}
#header {
clear: both;
float: left;
width: 100%;
border-bottom: 4px solid #333;
}
#header a {
color: white;
text-decoration: none;
}
#header_left {
float: left;
width: 400px;
}
#header_center {
float: left;
widows: 300px;
}
#header_right {
text-align: right;
float: right;
width: 400px;
}
.success {
color: #006600;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html" locale="#{sessionHandler.locale}">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><h:outputText value="#{layoutView.getHeader()}" /></title>
<meta name="description" content="Lippukauppa" />
<meta name="author" content="CodeCrew ry" />
<meta http-equiv="Content-Language" content="fi" />
<link rel="icon" href="#{request.contextPath}/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/blipview/css/style.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/blipview/css/general.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/custom_components.css" />
<ui:insert name="headerdata" />
</h:head>
<h:body>
<div id="header" class="bgColor1">
<div id="header_left">
<h:link outcome="/index">
<c:choose>
<c:when test="#{sessionHandler.isInDevelopmentMode()}">
<img src="#{request.contextPath}/resources/templates/insomnia2/img/devel_logo.png" />
</c:when>
<c:otherwise>
<p:graphicImage rendered="#{!empty layoutView.headerimage}" value="#{layoutView.headerimage}" />
<ui:fragment rendered="#{empty layoutView.headerimage}">
<h1>
<h:outputText value="#{layoutView.headertext}" />
</h1>
</ui:fragment>
</c:otherwise>
</c:choose>
</h:link>
<div class="topmenu">
<h:form>
<p:menubar rendered="#{primeMenuView.hasSecondaryMenu}" model="#{primeMenuView.secondaryMenuModel}" />
</h:form>
</div>
</div>
<div id="header_center">
<ui:insert name="headercontent" />
</div>
<div id="header_right">
<img src="#{request.contextPath}/resources/templates/template1/img/moya_logo.png" />
</div>
</div>
<div class="container top">
<ui:insert name="topbar" />
<p:messages showDetail="false" autoUpdate="true" />
</div>
<div class="clearfix"></div>
<div>
<ui:insert name="content" />
</div>
</h:body>
</f:view>
</html>
\ No newline at end of file
......@@ -72,6 +72,11 @@ public class SessionHandler {
template = "blipview";
return template;
}
public String getInfoscreen() {
template = "infoview";
return template;
}
public String getAdduserfullscreen() {
template = "adduser";
......
......@@ -12,6 +12,7 @@ public class ReaderNameContainer implements Serializable {
private static final long serialVersionUID = 571747919767505523L;
private Integer readerId;
private boolean autopoll = false;
public Integer getReaderId() {
return readerId;
......@@ -21,4 +22,12 @@ public class ReaderNameContainer implements Serializable {
this.readerId = readerId;
}
public boolean isAutopoll() {
return autopoll;
}
public void setAutopoll(boolean autopoll) {
this.autopoll = autopoll;
}
}
......@@ -38,7 +38,6 @@ public class ReaderView extends GenericCDIView {
private static final long serialVersionUID = 802344850073689859L;
private boolean pollingMode = false;
private ReaderEvent lastReadEvent = null;
private transient ListDataModel<UserCardWrapper> userlist;
......@@ -233,7 +232,7 @@ public class ReaderView extends GenericCDIView {
public ReaderEvent getReaderEvent() {
if(pollingMode && isNewCodes()) {
if(namecontainer.isAutopoll() && isNewCodes()) {
pollingCodeHandled();
return readerbean.getLastReaderEvent(namecontainer.getReaderId());
}
......@@ -251,7 +250,7 @@ public class ReaderView extends GenericCDIView {
public void initializeForPolling() {
// on polling mode, we do not use list, we use database and remember last readerEvent
this.pollingMode = true;
namecontainer.setAutopoll(true);
lastReadEvent = readerbean.getLastReaderEvent(namecontainer.getReaderId());
}
......@@ -267,7 +266,7 @@ public class ReaderView extends GenericCDIView {
}
public boolean isNewCodes() {
if (!pollingMode)
if (!namecontainer.isAutopoll())
return false;
return (!readerbean.getLastReaderEvent(namecontainer.getReaderId()).equals(lastReadEvent));
......@@ -284,17 +283,17 @@ public class ReaderView extends GenericCDIView {
public boolean isPollingMode() {
return pollingMode;
return namecontainer.isAutopoll();
}
public void setPollingMode(boolean pollingMode) {
if(!this.pollingMode && pollingMode) {
if(!namecontainer.isAutopoll() && pollingMode) {
this.initializeForPolling();
}
this.pollingMode = pollingMode;
namecontainer.setAutopoll(pollingMode);
}
......
......@@ -60,10 +60,6 @@ public class ProductShopView extends GenericCDIView {
payInstant = false;
}
@Inject
@SelectedUser
private EventUser user;
private boolean payInstant = true;
private BigDecimal cash = BigDecimal.ZERO;
......@@ -108,7 +104,7 @@ public class ProductShopView extends GenericCDIView {
public void initBillView() {
if (requirePermissions(ShopPermission.LIST_USERPRODUCTS)
&& shoppingcart == null) {
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productList(productBean.listUserShoppableProducts(), user));
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productList(productBean.listUserShoppableProducts(), userView.getSelectedUser()));
updateCartLimits(null);
logger.debug("Initialized billing shoppingcart to {}", shoppingcart);
this.beginConversation();
......@@ -151,7 +147,7 @@ public class ProductShopView extends GenericCDIView {
public void initShopView() {
if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) {
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(productBean.findForStaffshop(), user));
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(productBean.findForStaffshop(), userView.getSelectedUser()));
updateCartLimits(null);
LanEventProperty cashdefault = eventbean.getProperty(LanEventPropertyKey.SHOP_DEFAULT_CASH);
......@@ -220,7 +216,7 @@ public class ProductShopView extends GenericCDIView {
prodCounts.put(sc.getProduct().getId(), sc.getCount());
}
HashMap<Integer, BigDecimal> limits = productBean.getProductLimit(prodCounts, user);
HashMap<Integer, BigDecimal> limits = productBean.getProductLimit(prodCounts, userView.getSelectedUser());
// Update the updated cart first
if (item != null) {
......@@ -278,17 +274,17 @@ public class ProductShopView extends GenericCDIView {
}
public BigDecimal getBalanceAfterTransaction() {
BigDecimal ret = user.getAccountBalance();
BigDecimal ret = userView.getSelectedUser().getAccountBalance();
ret = ret.add(getCash());
ret = ret.subtract(getCartPrice());
logger.info("User accountbalance {}, cash{}, total {}. retBalance {}",
new Object[] { user.getAccountBalance(), getCash(),
new Object[] { userView.getSelectedUser().getAccountBalance(), getCash(),
getCartPrice(), ret });
return ret;
}
public BigDecimal getAccountCredits() {
BigDecimal ret = user.getAccountBalance();
BigDecimal ret = userView.getSelectedUser().getAccountBalance();
return ret;
}
......@@ -309,7 +305,7 @@ public class ProductShopView extends GenericCDIView {
return null;
}
Bill bill = new Bill(eventbean.getCurrentEvent(), user, eventbean.getPropertyLong(LanEventPropertyKey.BILL_EXPIRE_HOURS));
Bill bill = new Bill(eventbean.getCurrentEvent(), userView.getSelectedUser(), eventbean.getPropertyLong(LanEventPropertyKey.BILL_EXPIRE_HOURS));
bill.setNotes(otherInfo);
bill.setOurReference(eventbean.getCurrentEvent().getName());
......@@ -349,15 +345,15 @@ public class ProductShopView extends GenericCDIView {
EventUser retuser = null;
for (ProductShopItem shopitem : shoppingcart) {
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) {
retuser = productBean.createAccountEvent(shopitem.getProduct(), shopitem.getCount(), user).getUser();
retuser = productBean.createAccountEvent(shopitem.getProduct(), shopitem.getCount(), userView.getSelectedUser()).getUser();
}
}
if (cash != null && cash.compareTo(BigDecimal.ZERO) != 0) {
Product credProd = productBean.findCreditProduct();
retuser = productBean.createAccountEvent(credProd, cash, user).getUser();
retuser = productBean.createAccountEvent(credProd, cash, userView.getSelectedUser()).getUser();
}
if (retuser != null) {
user = retuser;
userView.setUserid(retuser.getId());
}
shoppingcart = null;
boughtItems = null;
......@@ -368,11 +364,11 @@ public class ProductShopView extends GenericCDIView {
}
public void setUser(EventUser user) {
this.user = user;
userView.setUserid(user.getId());
}
public EventUser getUser() {
return user;
return userView.getSelectedUser();
}
public void setShoppingcart(ListDataModel<ProductShopItem> shoppingcart) {
......@@ -449,7 +445,7 @@ public class ProductShopView extends GenericCDIView {
if (event.getPrintedCard() != null) {
if (event.getPrintedCard().getUser() != null) {
userView.setUser(event.getPrintedCard().getUser());
this.user = event.getPrintedCard().getUser();
userView.setUserid(event.getPrintedCard().getUser().getId());
initShopView();
return null;
}
......
......@@ -40,15 +40,19 @@ public class IncomingView extends GenericCDIView {
private static final long serialVersionUID = 802344850073689859L;
private static final Logger logger = LoggerFactory.getLogger(IncomingView.class);
/*
@Inject
@SelectedUser
private transient EventUser user;
*/
@Inject
private UserView userview;
@Inject
private ReaderView readerView;
@Inject
private InfoView infoView;
@Inject
private ReaderNameContainer namecontainer;
......@@ -71,16 +75,16 @@ public class IncomingView extends GenericCDIView {
@EJB
private transient PlaceGroupBeanLocal placegroupBean;
private String searchBarcode = "";
//private String searchBarcode = "";
private EventUser searchMulti = null;
private ListDataModel<GroupMembership> memberlist = null;
public void initView() {
super.beginConversation();
}
/*
public String getSearchBarcode() {
return searchBarcode;
}
......@@ -99,25 +103,13 @@ public class IncomingView extends GenericCDIView {
return arl;
}
public List<EventUser> matchMulti(String what) {
UserSearchQuery usq = new UserSearchQuery();
usq.setSearch(what);
SearchResult<EventUser> sr = userbean.getThisEventsUsers(usq);
return sr.getResults();
}
*/
public void changeUser(SelectEvent event) {
if (!searchBarcode.equals("")) {
// TODO: if user barcode is place code thingy, do this, otherwise do other..
GroupMembership gm = placeBean.findGroupMembershipsByToken(this.searchBarcode);
if (gm != null) {
super.navihandler.redirectNavigation("printCard.jsf?userid=" + gm.getUser().getUser().getId());
}
} else if (searchMulti != null) {
super.navihandler.redirectNavigation("printCard.jsf?userid=" + searchMulti.getUser().getId());
searchMulti = null;
if (infoView.getMultiSearchUser() != null) {
super.navihandler.redirectNavigation("incoming.jsf?userid=" + infoView.getMultiSearchUser().getUser().getId());
infoView.setMultiSearchUser(null);
}
}
......@@ -147,13 +139,6 @@ public class IncomingView extends GenericCDIView {
return null;
}
public String changeToIncomingView() {
//super.navihandler.redirectNavigation("printCard.jsf?userid="+user.getUser().getId());
return "printCard.jsf?userid=" + user.getUser().getId();
}
public void polledRead() {
ReaderEvent event = readerView.getReaderEvent();
......@@ -170,7 +155,7 @@ public class IncomingView extends GenericCDIView {
userview.setUser(user);
// userview.prepareCardDownload();
// PURKKAAA, sori tästä, koitan refaktoroida kauniiksi ku kerkiän -TKwtf
super.navihandler.redirectNavigation("printCard.jsf?userid=" + user.getUser().getId());
super.navihandler.redirectNavigation("incoming.jsf?userid=" + user.getUser().getId());
}
} else {
......@@ -183,6 +168,7 @@ public class IncomingView extends GenericCDIView {
}
/*
public String selectUser() {
ReaderEvent event = readerView.getReaderEvent();
......@@ -202,11 +188,11 @@ public class IncomingView extends GenericCDIView {
userview.setUser(user);
//userview.prepareCardDownload();
return "printCard";
}
return "incoming";
} */
public CardState getPrintedStatus() {
PrintedCard card = cardBean.checkPrintedCard(user);
PrintedCard card = cardBean.checkPrintedCard(userview.getUser());
CardState ret = null;
if (card != null) {
ret = card.getCardState();
......@@ -215,19 +201,12 @@ public class IncomingView extends GenericCDIView {
}
public String printCard() {
PrintedCard card = cardBean.checkPrintedCard(user);
PrintedCard card = cardBean.checkPrintedCard(userview.getUser());
card.setCardState(CardState.VALIDATED);
cardBean.saveCard(card);
return null;
}
public EventUser getSearchMulti() {
return searchMulti;
}
public void setSearchMulti(EventUser searchMulti) {
this.searchMulti = searchMulti;
}
public ListDataModel<GroupMembership> getGroupMemberships() {
memberlist = new ListDataModel<GroupMembership>(
......@@ -253,6 +232,7 @@ public class IncomingView extends GenericCDIView {
return null;
}
......
package fi.codecrew.moya.web.flow;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.inject.Named;
......@@ -7,9 +10,11 @@ import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.web.annotations.SelectedUser;
import fi.codecrew.moya.util.UserSearchQuery;
import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.reader.ReaderView;
import fi.codecrew.moya.web.cdiview.user.UserView;
......@@ -19,11 +24,10 @@ import fi.codecrew.moya.web.cdiview.user.UserView;
public class InfoView extends GenericCDIView {
private static final long serialVersionUID = 802344850073689859L;
private EventUser multiSearchUser = null;
private static final Logger logger = LoggerFactory.getLogger(InfoView.class);
@Inject
@SelectedUser
private transient EventUser user;
@Inject
private UserView userview;
......@@ -31,6 +35,9 @@ public class InfoView extends GenericCDIView {
@Inject
private ReaderView readerView;
@EJB
private UserBeanLocal userbean;
public void initView() {
super.beginConversation();
}
......@@ -41,6 +48,7 @@ public class InfoView extends GenericCDIView {
return null;
}
public String selectUser() {
ReaderEvent event = readerView.getReaderEvent();
......@@ -58,6 +66,24 @@ public class InfoView extends GenericCDIView {
return "general";
}
public List<EventUser> matchMulti(String what) {
UserSearchQuery usq = new UserSearchQuery();
usq.setSearch(what);
SearchResult<EventUser> sr = userbean.getThisEventsUsers(usq);
return sr.getResults();
}
public EventUser getMultiSearchUser() {
return multiSearchUser;
}
public void setMultiSearchUser(EventUser multiSearchUser) {
this.multiSearchUser = multiSearchUser;
}
}
package fi.codecrew.moya.web.flow;
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.model.User;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.shop.ProductShopView;
import fi.codecrew.moya.web.cdiview.user.UserView;
@Named
@ConversationScoped
public class flowShopView 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;
@Inject
private ProductShopView productShopView;
@Inject
private UserView userView;
@Inject
private InfoView infoView;
public void initView() {
if(userId == null || userId == 0) {
userView.setUserid(1);
} else {
userView.setUserid(userId);
}
productShopView.initShopView();
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public void changeUser(SelectEvent event) {
if (infoView.getMultiSearchUser() != null) {
super.navihandler.redirectNavigation("shop.jsf?userid=" + infoView.getMultiSearchUser().getUser().getId());
infoView.setMultiSearchUser(null);
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!