Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3dee93f4
authored
Oct 25, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ruokatilauskorjauksia pukkaa
1 parent
117cd4c8
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
243 additions
and
155 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/SecurityLogType.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BillBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
code/moya-database/src/main/java/fi/codecrew/moya/model/Bill.java
code/moya-database/src/main/java/fi/codecrew/moya/model/FoodWave.java
code/moya-database/src/main/java/fi/codecrew/moya/model/FoodWaveTemplate.java
code/moya-web/WebContent/foodadmin/editTemplate.xhtml
code/moya-web/WebContent/foodmanager/listFoodwaves.xhtml
code/moya-web/WebContent/foodmanager/listOrders.xhtml
code/moya-web/src/main/java/fi/codecrew/moya/resources/i18n.properties
code/moya-web/src/main/java/fi/codecrew/moya/resources/i18n_en.properties
code/moya-web/src/main/java/fi/codecrew/moya/resources/i18n_fi.properties
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/shop/FoodWaveView.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/SecurityLogType.java
View file @
3dee93f
...
...
@@ -24,5 +24,6 @@ public enum SecurityLogType {
genericMessage
,
accountEvent
,
verkkomaksu
,
bill
,
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BillBean.java
View file @
3dee93f
...
...
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
import
fi.codecrew.moya.beanutil.PdfPrinter
;
import
fi.codecrew.moya.bortal.views.BillSummary
;
import
fi.codecrew.moya.enums.apps.BillPermission
;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
import
fi.codecrew.moya.enums.apps.SpecialPermission
;
import
fi.codecrew.moya.facade.BillFacade
;
import
fi.codecrew.moya.facade.BillLineFacade
;
...
...
@@ -94,6 +95,9 @@ public class BillBean implements BillBeanLocal {
@EJB
private
DiscountBean
discountBean
;
@EJB
private
LoggingBeanLocal
logbean
;
/**
* Default constructor.
*/
...
...
@@ -228,16 +232,21 @@ public class BillBean implements BillBeanLocal {
SpecialPermission
.
S_VERKKOMAKSU_CHECK
})
public
Bill
markPaid
(
Bill
bill
,
Calendar
when
)
{
bill
=
billFacade
.
reload
(
bill
);
if
(
bill
.
getAccountEvent
()
!=
null
||
bill
.
getPaidDate
()
!=
null
)
{
logbean
.
logMessage
(
SecurityLogType
.
bill
,
permbean
.
getCurrentUser
(),
"Trying to doublemark bill paid"
);
throw
new
EJBException
(
"Bill already marked paid!"
);
}
if
(
bill
.
isFoowavePaymentOver
())
if
(
bill
.
isFoowavePaymentOver
()
&&
!
permbean
.
hasPermission
(
ShopPermission
.
MANAGE_FOODWAVES
)
)
{
logbean
.
logMessage
(
SecurityLogType
.
bill
,
permbean
.
getCurrentUser
(),
"FoodwaveClosed and marking bill for it paid"
);
throw
new
EJBException
(
"Trying to mark paid a closed or left foodwave"
);
}
bill
=
billFacade
.
reload
(
bill
);
Product
creditproduct
=
productBean
.
findCreditProduct
();
EventUser
user
=
bill
.
getUser
();
...
...
@@ -271,6 +280,8 @@ public class BillBean implements BillBeanLocal {
}
}
/*
MailMessage msg = new MailMessage();
String subject = MessageFormat.format(eventbean.getPropertyString(LanEventPropertyKey.BILL_PAID_MAIL_SUBJECT), user.getEvent().getName());
...
...
@@ -280,7 +291,10 @@ public class BillBean implements BillBeanLocal {
msg.setMessage(content);
msg.setTo(bill.getUser().getUser());
utilbean.sendMail(msg);
*/
eventUserFacade
.
flush
();
logbean
.
logMessage
(
SecurityLogType
.
bill
,
permbean
.
getCurrentUser
(),
"Marking bill paid, for user: "
,
bill
.
getUser
().
getId
(),
"BillId: "
,
bill
.
getId
());
eventUserFacade
.
evict
(
bill
.
getUser
());
return
bill
;
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
View file @
3dee93f
...
...
@@ -238,9 +238,14 @@ public class BootstrapBean implements BootstrapBeanLocal {
// tai saadaan poikkeuksia nyrkillä kurkusta .
dbUpdates
.
add
(
new
String
[]
{
"DELETE FROM product_productflags where productflags = 'PREPAID_INSTANT_CREATE'"
});
dbUpdates
.
add
(
new
String
[]
{
"ALTER TABLE food_wave_templates ADD COLUMN wait_payments_minutes integer DEFAULT null;"
,
});
}
// start_time timestamp without time zone,
@EJB
...
...
code/moya-database/src/main/java/fi/codecrew/moya/model/Bill.java
View file @
3dee93f
...
...
@@ -36,6 +36,7 @@ import javax.persistence.OrderBy;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.Transient
;
import
javax.persistence.UniqueConstraint
;
import
org.slf4j.Logger
;
...
...
@@ -226,12 +227,12 @@ public class Bill extends GenericEntity {
public
Bill
(
LanEvent
event
,
EventUser
user
,
long
expireTimeHours
)
{
this
(
event
,
user
,
Calendar
.
getInstance
());
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
(
expireTimeHours
*
60
*
60
*
1000
)));
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
(
expireTimeHours
*
60
*
60
*
1000
)));
}
public
Bill
(
LanEvent
event
,
long
expireTimeHours
)
{
this
(
event
,
Calendar
.
getInstance
());
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
(
expireTimeHours
*
60
*
60
*
1000
)));
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
(
expireTimeHours
*
60
*
60
*
1000
)));
}
public
Bill
()
{
...
...
@@ -390,7 +391,7 @@ public class Bill extends GenericEntity {
}
public
void
setPaidDate
(
Date
paidDate
)
{
if
(
paidDate
!=
null
)
if
(
paidDate
!=
null
)
expires
=
null
;
this
.
paidDate
=
paidDate
;
...
...
@@ -429,16 +430,17 @@ public class Bill extends GenericEntity {
}
public
boolean
isFoowavePaymentOver
()
{
boolean
ret
=
false
;
for
(
BillLine
bl
:
billLines
)
{
if
(
bl
.
getFoodwave
()
!=
null
&&
(
bl
.
getFoodwave
().
getClosed
()
||
bl
.
getFoodwave
().
getTime
().
before
(
new
Date
())))
if
(
bl
.
getFoodwave
()
!=
null
)
{
if
(
bl
.
getFoodwave
().
isPaymentOver
())
{
ret
=
true
;
break
;
return
true
;
}
}
return
ret
;
}
return
false
;
}
public
Calendar
getExpires
()
{
...
...
@@ -450,23 +452,50 @@ public class Bill extends GenericEntity {
}
public
boolean
isExpired
()
{
if
(
expires
==
null
)
if
(
expires
==
null
)
return
false
;
return
Calendar
.
getInstance
().
after
(
expires
);
}
public
void
markExpired
()
{
if
(
isExpired
()
||
isPaid
())
if
(
isExpired
()
||
isPaid
())
return
;
expires
=
Calendar
.
getInstance
();
}
}
@Transient
public
BigDecimal
getTotalQuantity
()
{
BigDecimal
total
=
BigDecimal
.
ZERO
;
for
(
BillLine
l
:
getBillLines
())
{
if
(
l
==
null
||
l
.
getQuantity
()
==
null
)
continue
;
total
.
add
(
l
.
getQuantity
());
}
return
total
;
}
@Transient
public
String
getProductSummary
()
{
String
summary
=
""
;
for
(
BillLine
l
:
getBillLines
())
{
if
(
l
==
null
||
l
.
getQuantity
()
==
null
)
continue
;
if
(!
summary
.
isEmpty
())
{
summary
+=
", "
;
}
summary
+=
l
.
getName
();
}
return
summary
;
}
}
...
...
code/moya-database/src/main/java/fi/codecrew/moya/model/FoodWave.java
View file @
3dee93f
...
...
@@ -36,6 +36,7 @@ import javax.persistence.OneToMany;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.Transient
;
/**
*
...
...
@@ -140,11 +141,11 @@ public class FoodWave extends GenericEntity {
}
public
boolean
isFull
()
{
if
(
getMaximumFoods
()
<=
0
)
{
if
(
getMaximumFoods
()
<=
0
)
{
return
false
;
}
if
(
getReservedCount
()
>=
getMaximumFoods
())
{
if
(
getReservedCount
()
>=
getMaximumFoods
())
{
return
true
;
}
...
...
@@ -197,8 +198,7 @@ public class FoodWave extends GenericEntity {
public
Integer
getMaximumFoods
()
{
if
(
maximumFoods
==
null
)
{
if
(
maximumFoods
==
null
)
{
return
0
;
}
...
...
@@ -237,7 +237,7 @@ public class FoodWave extends GenericEntity {
Integer
ret
=
0
;
if
(
getAccountEvents
()
!=
null
)
{
for
(
AccountEvent
ae
:
getAccountEvents
())
{
for
(
AccountEvent
ae
:
getAccountEvents
())
{
ret
+=
ae
.
getQuantity
().
intValue
();
}
}
...
...
@@ -245,19 +245,46 @@ public class FoodWave extends GenericEntity {
return
ret
;
}
public
boolean
isDelivered
()
{
public
Integer
getDeliveredCount
()
{
Integer
delCount
=
new
Integer
(
0
);
if
(
getAccountEvents
()
!=
null
&&
getReservedCount
()
!=
0
)
{
for
(
AccountEvent
ae
:
getAccountEvents
())
{
for
(
AccountEvent
ae
:
getAccountEvents
())
{
if
(
ae
.
isEventDelivered
())
{
return
true
;
delCount
++
;
}
}
}
return
delCount
;
}
public
boolean
isDelivered
()
{
if
(
getAccountEvents
()
!=
null
&&
getReservedCount
()
!=
0
)
{
for
(
AccountEvent
ae
:
getAccountEvents
())
{
if
(!
ae
.
isEventDelivered
())
{
return
false
;
}
}
}
return
true
;
}
}
@Transient
public
Date
getLastPaymentTime
()
{
return
new
Date
(
getTime
().
getTime
()
+
(
getTemplate
().
getWaitPaymentsMinutes
().
longValue
()
*
60
l
*
1000
l
));
}
public
boolean
isPaymentOver
()
{
// add this magical "wait payments this amount of minutes" to foodwave
Date
endDate
=
new
Date
(
getTime
().
getTime
()
+
(
getTemplate
().
getWaitPaymentsMinutes
().
longValue
()
*
60
l
*
1000
l
));
if
(
isClosed
()
||
endDate
.
before
(
new
Date
()))
{
return
true
;
}
return
false
;
}
}
code/moya-database/src/main/java/fi/codecrew/moya/model/FoodWaveTemplate.java
View file @
3dee93f
...
...
@@ -67,6 +67,9 @@ public class FoodWaveTemplate extends GenericEntity {
@Column
(
name
=
"max_foods"
)
private
Integer
maximumFoods
;
@Column
(
name
=
"wait_payments_minutes"
)
private
Integer
waitPaymentsMinutes
=
0
;
public
FoodWaveTemplate
()
{
}
...
...
@@ -135,4 +138,16 @@ public class FoodWaveTemplate extends GenericEntity {
return
returnList
;
}
public
Integer
getWaitPaymentsMinutes
()
{
if
(
waitPaymentsMinutes
==
null
)
waitPaymentsMinutes
=
0
;
return
waitPaymentsMinutes
;
}
public
void
setWaitPaymentsMinutes
(
Integer
waitPaymentsMinutes
)
{
this
.
waitPaymentsMinutes
=
waitPaymentsMinutes
;
}
}
code/moya-web/WebContent/foodadmin/editTemplate.xhtml
View file @
3dee93f
<!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:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:p=
"http://primefaces.org/ui"
>
<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:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"#{sessionHandler.template}"
>
<ui:composition
template=
"#{sessionHandler.template}"
>
<f:metadata>
<f:viewParam
name=
"id"
value=
"#{foodWaveView.templateId}"
/>
<f:event
type=
"preRenderView"
listener=
"#{foodWaveView.initEditTemplate()}"
/>
<f:event
type=
"preRenderView"
listener=
"#{foodWaveView.initEditTemplate()}"
/>
</f:metadata>
<ui:define
name=
"title"
>
...
...
@@ -27,58 +18,46 @@
<p:panel
header=
"#{i18n['foodwavetemplate.edit']}"
>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
for=
"name"
value=
"#{i18n['foodwave.template.name']}"
/>
<h:outputLabel
for=
"name"
value=
"#{i18n['foodwave.template.name']}"
/>
<h:inputText
id=
"name"
value=
"#{foodWaveView.template.name}"
/>
<h:message
for=
"name"
/>
<h:outputLabel
for=
"desc"
value=
"#{i18n['foodwave.template.description']}"
/>
<h:inputText
id=
"desc"
value=
"#{foodWaveView.template.description}"
/>
<h:outputLabel
for=
"desc"
value=
"#{i18n['foodwave.template.description']}"
/>
<h:inputText
id=
"desc"
value=
"#{foodWaveView.template.description}"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
for=
"overtime"
value=
"#{i18n['foodwave.template.waitPaymentsMinutes']}"
/>
<p:spinner
id=
"overtime"
value=
"#{foodWaveView.template.waitPaymentsMinutes}"
suffix=
"#{i18n['suffix.minutes']}"
min=
"0"
/>
<h:message
for=
"overtime"
/>
<h:outputText
value=
" "
/>
<h:commandButton
action=
"#{foodWaveView.saveTemplate()}"
value=
"#{i18n['foodwavetemplate.save']}"
/>
<h:commandButton
action=
"#{foodWaveView.saveTemplate()}"
value=
"#{i18n['foodwavetemplate.save']}"
/>
</h:panelGrid>
</h:form>
<h:form>
<h:selectOneMenu
value=
"#{foodWaveView.currentProduct}"
converter=
"#{productConverter}"
>
<f:selectItems
value=
"#{foodWaveView.products}"
var=
"product"
itemLabel=
"#{product.name}"
></f:selectItems>
<h:selectOneMenu
value=
"#{foodWaveView.currentProduct}"
converter=
"#{productConverter}"
>
<f:selectItems
value=
"#{foodWaveView.products}"
var=
"product"
itemLabel=
"#{product.name}"
></f:selectItems>
</h:selectOneMenu>
<p:commandButton
value=
"#{i18n['foodwavetemplate.addproduct']}"
actionListener=
"#{foodWaveView.addProductToTemplate}"
ajax=
"false"
/>
<p:commandButton
value=
"#{i18n['foodwavetemplate.addproduct']}"
actionListener=
"#{foodWaveView.addProductToTemplate}"
ajax=
"false"
/>
</h:form>
<h:form>
<h:panelGrid
columns=
"4"
>
<h:outputText
value=
"#{i18n['foodwavetemplate.productname']}"
/>
<h:outputText
value=
"#{i18n['foodwavetemplate.productdescription']}"
/>
<h:outputText
value=
"#{i18n['foodwavetemplate.productdescription']}"
/>
<h:outputText
value=
"#{i18n['foodwavetemplate.price']}"
/>
<h:outputText
value=
" "
/>
<h:inputText
id=
"productname"
value=
"#{foodWaveView.currentProduct.name}"
/>
<h:inputText
id=
"productdescription"
value=
"#{foodWaveView.currentProduct.description}"
/>
<h:inputText
id=
"price"
value=
"#{foodWaveView.currentProduct.price}"
/>
<h:inputText
id=
"productname"
value=
"#{foodWaveView.currentProduct.name}"
/>
<h:inputText
id=
"productdescription"
value=
"#{foodWaveView.currentProduct.description}"
/>
<h:inputText
id=
"price"
value=
"#{foodWaveView.currentProduct.price}"
/>
<p:commandButton
value=
"#{i18n['foodwavetemplate.addproduct']}"
actionListener=
"#{foodWaveView.addProductToTemplate}"
ajax=
"false"
/>
<p:commandButton
value=
"#{i18n['foodwavetemplate.addproduct']}"
actionListener=
"#{foodWaveView.addProductToTemplate}"
ajax=
"false"
/>
</h:panelGrid>
</h:form>
<h:form>
<p:dataTable
name=
"productTable"
id=
"productTable"
value=
"#{foodWaveView.template.products}"
var=
"product"
editable=
"true"
>
<p:dataTable
name=
"productTable"
id=
"productTable"
value=
"#{foodWaveView.template.products}"
var=
"product"
editable=
"true"
>
<p:ajax
event=
"rowEdit"
listener=
"#{foodWaveView.onEdit}"
/>
...
...
@@ -89,20 +68,17 @@
<h:outputText
value=
"#{product.name}"
/>
</f:facet>
<f:facet
name=
"input"
>
<p:inputText
value=
"#{product.name}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Name required"
/>
<p:inputText
value=
"#{product.name}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Name required"
/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column
headerText=
"#{i18n['foodwavetemplate.productdescription']}"
>
<p:column
headerText=
"#{i18n['foodwavetemplate.productdescription']}"
>
<p:cellEditor>
<f:facet
name=
"output"
>
<h:outputText
value=
"#{product.description}"
/>
</f:facet>
<f:facet
name=
"input"
>
<p:inputText
value=
"#{product.description}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Description required"
/>
<p:inputText
value=
"#{product.description}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Description required"
/>
</f:facet>
</p:cellEditor>
</p:column>
...
...
@@ -112,52 +88,38 @@
<h:outputText
value=
"#{product.price}"
/>
</f:facet>
<f:facet
name=
"input"
>
<p:inputText
value=
"#{product.price}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Price required"
/>
<p:inputText
value=
"#{product.price}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Price required"
/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column
headerText=
"#{i18n['foodwavetemplate.editRow']}"
style=
"width:20px"
>
<p:column
style=
"width:20px"
>
<p:rowEditor
/>
</p:column>
<p:column
headerText=
"#{i18n['foodwavetemplate.actions']}"
style=
"width:20px;"
>
<p:commandButton
value=
"#{i18n['foodwavetemplate.removeFromList']}"
action=
"#{foodWaveView.removeProductFromList(product)}"
update=
"productTable"
/>
<p:column
style=
"width:70px"
>
<p:commandButton
value=
"#{i18n['foodwavetemplate.removeFromList']}"
action=
"#{foodWaveView.removeProductFromList(product)}"
update=
"productTable"
/>
</p:column>
</p:dataTable>
<h:commandButton
action=
"#{foodWaveView.saveTemplate()}"
value=
"#{i18n['foodwavetemplate.savetemplate']}"
/>
<h:commandButton
action=
"#{foodWaveView.saveTemplate()}"
value=
"#{i18n['foodwavetemplate.savetemplate']}"
/>
<!-- -->
</h:form>
</p:panel>
<h:form>
<p:panel
header=
"#{i18n['foodwavetemplate.createwave']}"
>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
for=
"waveName"
value=
"#{i18n['foodwavetemplate.waveName']}"
/>
<h:inputText
id=
"waveName"
value=
"#{foodWaveView.selectedFoodWave.name}"
/>
<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: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: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>
</h:form>
</ui:define>
...
...
code/moya-web/WebContent/foodmanager/listFoodwaves.xhtml
View file @
3dee93f
...
...
@@ -64,6 +64,13 @@
</f:facet>
<h:outputText
value=
"#{foodwave.unpaidCount}"
/>
</p:column>
<p:column
styleClass=
"text-center"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.deliveredCount']}"
/>
</f:facet>
<h:outputText
value=
"#{foodwave.deliveredCount}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.totalReserved']}"
/>
...
...
code/moya-web/WebContent/foodmanager/listOrders.xhtml
View file @
3dee93f
...
...
@@ -12,8 +12,8 @@
<h1>
#{foodWaveView.selectedFoodWave.name}
</h1>
</ui:define>
<ui:define
name=
"content"
>
<h:form>
<p:dataTable
styleClass=
"bordertable"
value=
"#{foodWaveView.accountEventLines}"
var=
"acc_line"
sortBy=
"#{acc_line.user.nick}"
>
<h:form
id=
"accountEventList"
>
<p:dataTable
styleClass=
"bordertable"
value=
"#{foodWaveView.accountEventLines}"
var=
"acc_line"
sortBy=
"#{acc_line.user.nick}"
rowStyleClass=
"#{acc_line.eventDelivered?'success':null}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['foodWave.accountevents']}"
/>
</f:facet>
...
...
@@ -43,9 +43,7 @@
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['acc_line.eventuser']}"
/>
</f:facet>
<h:link
outcome=
"/useradmin/edit"
value=
"#{acc_line.user.wholeName}"
>
<f:param
name=
"userid"
value=
"#{acc_line.user.id}"
/>
</h:link>
<h:outputText
outcome=
"/useradmin/edit"
value=
"#{acc_line.user.wholeName}"
/>
</p:column>
<p:column
sortBy=
"#{acc_line.user.nick}"
>
<f:facet
name=
"header"
>
...
...
@@ -60,7 +58,7 @@
<h:outputLabel
value=
"#{i18n['accountEvent.delivered']}"
/>
</f:facet>
<h:outputText
rendered=
"#{acc_line.eventDelivered}"
value=
"#{i18n['accountEvent.delivered']}"
/>
<
h:commandButton
rendered=
"#{not acc_line.eventDelivered}"
value=
"#{i18n['accountEvent.deliver']}"
action=
"#{foodWaveView.deliverAccountEvent}
"
/>
<
p:commandButton
rendered=
"#{not acc_line.eventDelivered}"
value=
"#{i18n['accountEvent.deliver']}"
actionListener=
"#{foodWaveView.deliverAccountEvent}"
update=
":billList :accountEventList
"
/>
</p:column>
</p:dataTable>
...
...
@@ -68,69 +66,60 @@
<br></br>
<br></br>
<h:form>
<p:dataTable
styleClass=
"bordertable"
value=
"#{foodWaveView.bill
Lines}"
var=
"bill_line"
sortBy=
"#{bill_line.
bill.user.nick}"
>
<h:form
id=
"billList"
>
<p:dataTable
styleClass=
"bordertable"
value=
"#{foodWaveView.bill
s}"
var=
"bill"
sortBy=
"#{
bill.user.nick}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['foodWave.billLines']}"
/>
</f:facet>
<p:column
sortBy=
"#{bill
_line.bill
.sentDate.getTime()}"
>
<p:column
sortBy=
"#{bill.sentDate.getTime()}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['billLine.time']}"
/>
</f:facet>
<h:outputText
value=
"#{bill
_line.bill
.sentDate.getTime()}"
>
<h:outputText
value=
"#{bill.sentDate.getTime()}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
/>
</h:outputText>
</p:column>
<p:column
sortBy=
"#{bill
_line.q
uantity}"
>
<p:column
sortBy=
"#{bill
.totalQ
uantity}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['billLine.quantity']}"
/>
</f:facet>
<h:outputText
style=
"text-align: center;"
value=
"#{bill
_line.q
uantity}"
>
<h:outputText
style=
"text-align: center;"
value=
"#{bill
.totalQ
uantity}"
>
<f:convertNumber
minFractionDigits=
"2"
maxFractionDigits=
"2"
/>
</h:outputText>
</p:column>
<p:column
sortBy=
"#{bill
_line.name
}"
>
<p:column
sortBy=
"#{bill
Line.eventuser
}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['bill
Line.product
']}"
/>
<h:outputLabel
value=
"#{i18n['bill
.products
']}"
/>
</f:facet>
<h:outputText
value=
"#{bill
_line.name
}"
/>
<h:outputText
value=
"#{bill
.productSummary
}"
/>
</p:column>
<p:column
sortBy=
"#{bill
_line.bill
.user.wholeName}"
>
<p:column
sortBy=
"#{bill.user.wholeName}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['billLine.eventuser']}"
/>
</f:facet>
<h:link
outcome=
"/useradmin/edit"
value=
"#{bill
_line.bill
.user.wholeName}"
>
<f:param
name=
"userid"
value=
"#{bill
_line.bill
.user.user.id}"
/>
<h:link
outcome=
"/useradmin/edit"
value=
"#{bill.user.wholeName}"
>
<f:param
name=
"userid"
value=
"#{bill.user.user.id}"
/>
</h:link>
</p:column>
<p:column
sortBy=
"#{bill
_line.bill.user.nick
}"
>
<p:column
sortBy=
"#{bill
.user.user.id
}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['billLine.nick']}"
/>
</f:facet>
<h:link
outcome=
"/useradmin/edit"
value=
"#{bill
_line.bill
.user.nick}"
>
<f:param
name=
"userid"
value=
"#{bill
_line.bill
.user.user.id}"
/>
<h:link
outcome=
"/useradmin/edit"
value=
"#{bill.user.nick}"
>
<f:param
name=
"userid"
value=
"#{bill.user.user.id}"
/>
</h:link>
</p:column>
<p:column
sortBy=
"#{bill_line.linePrice}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['billLine.price']}"
/>
</f:facet>
<h:outputText
style=
"text-align: center;"
value=
"#{bill_line.linePrice}"
>
<f:convertNumber
minFractionDigits=
"2"
maxFractionDigits=
"2"
/>
</h:outputText>
</p:column>
<p:column
sortBy=
"#{bill_line.bill.totalPrice}"
>
<p:column
sortBy=
"#{bill.totalPrice}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['bill.totalprice']}"
/>
</f:facet>
<h:outputText
style=
"text-align: center;"
value=
"#{bill
_line.bill
.totalPrice}"
>
<h:outputText
style=
"text-align: center;"
value=
"#{bill.totalPrice}"
>
<f:convertNumber
minFractionDigits=
"2"
maxFractionDigits=
"2"
/>
</h:outputText>
</p:column>
<p:column>
<
h:commandButton
value=
"#{i18n['bill.markPaid']}"
action=
"#{foodWaveView.markBillPaid}
"
/>
<
p:commandButton
value=
"#{i18n['bill.markPaid']}"
actionListener=
"#{foodWaveView.markBillPaid}"
update=
":billList :accountEventList
"
/>
</p:column>
<!--
<p:column>
...
...
@@ -155,6 +144,21 @@
</h:outputText>
</div>
<div>
<h:outputLabel
value=
"#{i18n['foodwave.ordersBefore']}: "
/>
<h:outputText
value=
"#{foodWaveView.selectedFoodWave.time}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
/>
</h:outputText>
</div>
<div>
<h:outputLabel
value=
"#{i18n['foodwave.foodwaveLastBillPayTime']}: "
/>
<h:outputText
value=
"#{foodWaveView.selectedFoodWave.lastPaymentTime}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
/>
</h:outputText>
</div>
<p:dataTable
var=
"summ"
value=
"#{foodWaveView.productSummaries}"
>
<p:column>
<f:facet
name=
"header"
>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/resources/i18n.properties
View file @
3dee93f
...
...
@@ -33,6 +33,7 @@ bill.expires = Expires
bill.isExpired
=
Bill is expired
bill.markPaid.show
=
Show Mark paid -buttons
bill.notes.title
=
Lis
\u
00E4tietoja
bill.products
=
Tuotteet
bill.save
=
Save
bill.showPayButtons
=
Show pay buttons
...
...
@@ -159,8 +160,13 @@ eventorg.create = Create
eventorg.title
=
Tapahtuman tiedot
foodWave.closeNow
=
Close now
foodWave.deliveredCount
=
Luovutetut
foodWave.openNow
=
Open now
foodwave.foodwaveLastBillPayTime
=
Maksut viimeist
\u
00E4
\u
00E4n
foodwave.ordersBefore
=
Tilaukset ennen
foodwave.template.waitPaymentsMinutes
=
Verkkomaksujen odotusaika
game.active
=
Aktiivinen
game.codecount
=
Avattuja
game.codes.available
=
Lisenssikoodit
...
...
@@ -361,6 +367,8 @@ subnavi.info = Info
success
=
Onnistui
suffix.minutes
=
min
topnavi.adminlectures
=
Kurssit ja luennot
topnavi.license
=
Lisenssikoodit
topnavi.userlectures
=
Kurssit ja luennot
...
...
code/moya-web/src/main/java/fi/codecrew/moya/resources/i18n_en.properties
View file @
3dee93f
...
...
@@ -88,6 +88,7 @@ bill.payer = Payer
bill.paymentTime
=
Payment time
bill.paymentTime.now
=
Now
bill.printBill
=
Print bill
bill.products
=
Products
bill.receiverAddress
=
Receiver address
bill.referenceNumberBase
=
Reference number base
bill.referencenumber
=
Reference nr.
...
...
@@ -405,8 +406,9 @@ food = Food
foodWave.accountevents
=
Accountevents
foodWave.activeFoodWaves
=
Active Foodwaves
foodWave.billLines
=
Pending
Online
Payments
foodWave.billLines
=
Pending Payments
foodWave.closeNow
=
Close now
foodWave.deliveredCount
=
Delivered
foodWave.deliveredFoodWaves
=
Delivered Foodwaves
foodWave.description
=
Foodwave description
foodWave.list
=
Active Foodwaves
...
...
@@ -431,8 +433,10 @@ foodshop.total = Total
foodwave.buyInPrice
=
Buy In Price
foodwave.foodwaveBuyInPrice
=
Total buy in price
foodwave.foodwaveLastBillPayTime
=
Last payments time
foodwave.markPaid
=
Foodwave marked paid
foodwave.orders
=
Foodwave Orders
foodwave.ordersBefore
=
Orders before
foodwave.price
=
Foodwave price
foodwave.summaryView
=
Foodwave Summary
foodwave.template.basicinfo
=
Template Information
...
...
@@ -441,6 +445,7 @@ foodwave.template.edit.title = Foodwave Template Editor
foodwave.template.list.title
=
Foodwave Templates
foodwave.template.name
=
Name
foodwave.template.selectproducts
=
Products
foodwave.template.waitPaymentsMinutes
=
Webpayments waittime
foodwave.totalCount
=
Amount
foodwave.totalPrice
=
Customer Price
...
...
@@ -1244,6 +1249,8 @@ subnavi.roles = Roles
success
=
Success
suffix.minutes
=
min
supernavi.admin
=
Adminview
supernavi.user
=
Userview
...
...
code/moya-web/src/main/java/fi/codecrew/moya/resources/i18n_fi.properties
View file @
3dee93f
...
...
@@ -88,6 +88,7 @@ bill.payer = Maksaja
bill.paymentTime
=
Maksuehdot
bill.paymentTime.now
=
Heti
bill.printBill
=
Tulosta lasku
bill.products
=
Tuotteet
bill.receiverAddress
=
Kauppiaan osoite
bill.referenceNumberBase
=
Viitenumeropohja
bill.referencenumber
=
Viitenumero
...
...
@@ -406,8 +407,9 @@ food = Ruoka
foodWave.accountevents
=
Maksetut tilaukset
foodWave.activeFoodWaves
=
Aktiiviset Ruokatilaukset
foodWave.billLines
=
Maksamattomat
Verkko
maksut
foodWave.billLines
=
Maksamattomat maksut
foodWave.closeNow
=
Sulje nyt
foodWave.deliveredCount
=
Toimitetut
foodWave.deliveredFoodWaves
=
Toimitetut Ruokatilaukset
foodWave.description
=
Ruokatilauksen kuvaus
foodWave.list
=
Ruokatilaukset
...
...
@@ -432,8 +434,10 @@ foodshop.total = Yhteens\u00E4
foodwave.buyInPrice
=
Sis
\u
00E4
\u
00E4nostohinta
foodwave.foodwaveBuyInPrice
=
Sis
\u
00E4
\u
00E4nostohinta
foodwave.foodwaveLastBillPayTime
=
Maksut viimeist
\u
00E4
\u
00E4n
foodwave.markPaid
=
Merkitty maksetuksi
foodwave.orders
=
Maksetut Tilaukset
foodwave.ordersBefore
=
Tilaukset ennen
foodwave.price
=
Tilausten kokonaishinta
foodwave.summaryView
=
Ruokatilauksen Yhteenveto
foodwave.template.basicinfo
=
Template Infot
...
...
@@ -442,6 +446,7 @@ foodwave.template.edit.title = Foodwave Template Editori
foodwave.template.list.title
=
Ruokatilaus Templatet
foodwave.template.name
=
Nimi
foodwave.template.selectproducts
=
Tuotteet
foodwave.template.waitPaymentsMinutes
=
Verkkomaksujen odotusaika
foodwave.totalCount
=
M
\u
00E4
\u
00E4r
\u
00E4
foodwave.totalPrice
=
Asiakkaan Hinta
...
...
@@ -1227,6 +1232,8 @@ subnavi.roles = Roolit
success
=
Onnistui
suffix.minutes
=
min
supernavi.admin
=
Yll
\u
00E4piton
\u
00E4kym
\u
00E4
supernavi.user
=
K
\u
00E4ytt
\u
00E4j
\u
00E4n
\u
00E4kym
\u
00E4
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/shop/FoodWaveView.java
View file @
3dee93f
...
...
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.TreeSet
;
...
...
@@ -76,12 +77,13 @@ public class FoodWaveView extends GenericCDIView {
private
Date
startDate
;
private
Product
currentProduct
;
private
ListDataModel
<
BillLine
>
billLines
;
//
private ListDataModel<BillLine> billLines;
// private List<BillLine> unpaidBills;
private
Integer
foodWaveId
;
private
ListDataModel
<
AccountEvent
>
accountEventLines
;
private
ListDataModel
<
FoodWave
>
foodWaves
;
private
ListDataModel
<
Bill
>
bills
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
FoodWaveView
.
class
);
public
List
<
Product
>
getProducts
()
{
...
...
@@ -175,7 +177,7 @@ public class FoodWaveView extends GenericCDIView {
public
List
<
FoodwaveProductSummary
>
getProductSummaries
()
{
System
.
out
.
println
(
"..asdfasdf"
);
HashMap
<
Product
,
FoodwaveProductSummary
>
pmap
=
new
HashMap
<
Product
,
FoodwaveProductSummary
>();
for
(
AccountEvent
ae
:
getSelectedFoodWave
().
getAccountEvents
())
{
...
...
@@ -222,6 +224,10 @@ public class FoodWaveView extends GenericCDIView {
return
ret
.
negate
();
}
public
BigDecimal
getFoodwaveBuyInPrice
()
{
BigDecimal
ret
=
BigDecimal
.
ZERO
;
...
...
@@ -246,12 +252,14 @@ public class FoodWaveView extends GenericCDIView {
// }
public
String
markBillPaid
()
{
if
(
permbean
.
hasPermission
(
BillPermission
.
WRITE_ALL
)
&&
getBillLines
()
.
isRowAvailable
())
{
Bill
b
=
getBillLines
().
getRowData
().
getBill
();
if
(
permbean
.
hasPermission
(
BillPermission
.
WRITE_ALL
)
&&
bills
!=
null
&&
bills
.
isRowAvailable
())
{
Bill
b
=
bills
.
getRowData
();
b
=
billbean
.
markPaid
(
b
,
Calendar
.
getInstance
());
foodWaveId
=
selectedFoodWave
.
getId
();
selectedFoodWave
=
null
;
bills
=
null
;
initFoodWaveOrderList
();
}
...
...
@@ -259,8 +267,8 @@ public class FoodWaveView extends GenericCDIView {
}
public
String
deliverAccountEvent
()
{
if
(
getAccountEventLines
()
.
isRowAvailable
())
{
AccountEvent
e
=
getAccountEventLines
()
.
getRowData
();
if
(
accountEventLines
!=
null
&&
accountEventLines
.
isRowAvailable
())
{
AccountEvent
e
=
accountEventLines
.
getRowData
();
e
=
productbeanlocal
.
markDelivered
(
e
,
Calendar
.
getInstance
());
foodWaveId
=
selectedFoodWave
.
getId
();
selectedFoodWave
=
null
;
...
...
@@ -271,26 +279,27 @@ public class FoodWaveView extends GenericCDIView {
}
public
void
initFoodWaveOrderList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_FOODWAVES
)
&&
selectedFoodWave
==
null
)
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_FOODWAVES
)
&&
selectedFoodWave
==
null
)
{
selectedFoodWave
=
foodWaveBean
.
findFoodwave
(
foodWaveId
);
logger
.
debug
(
"Got foodwave {} with id {}"
,
selectedFoodWave
,
foodWaveId
);
this
.
setAccountEventLines
(
new
ListDataModel
<
AccountEvent
>(
selectedFoodWave
.
getAccountEvents
()));
super
.
beginConversation
();
}
List
<
BillLine
>
tmpLines
=
new
ArrayList
<
BillLine
>();
for
(
BillLine
line
:
selectedFoodWave
.
getBillLines
())
{
HashSet
<
Bill
>
billList
=
new
HashSet
<
Bill
>();
for
(
BillLine
line
:
getSelectedFoodWave
().
getBillLines
())
{
if
(!
line
.
getBill
().
isPaid
())
{
tmpLines
.
add
(
line
);
billList
.
add
(
line
.
getBill
()
);
}
}
setBillLines
(
new
ListDataModel
<
BillLine
>(
tmpLines
));
bills
=
new
ListDataModel
<
Bill
>(
new
ArrayList
<
Bill
>(
billList
));
setAccountEventLines
(
new
ListDataModel
<
AccountEvent
>(
selectedFoodWave
.
getAccountEvents
()));
super
.
beginConversation
();
}
accountEventLines
=
new
ListDataModel
<
AccountEvent
>(
getSelectedFoodWave
().
getAccountEvents
());
}
...
...
@@ -315,7 +324,6 @@ public class FoodWaveView extends GenericCDIView {
}
public
FoodWave
getSelectedFoodWave
()
{
// System.out.println("APOFKASFASFASFASFASFASFASFASFASFKJIOJIO");
return
selectedFoodWave
;
}
...
...
@@ -351,13 +359,10 @@ public class FoodWaveView extends GenericCDIView {
this
.
foodWaveId
=
foodWaveId
;
}
public
ListDataModel
<
Bill
Line
>
getBillLine
s
()
{
return
bill
Line
s
;
public
ListDataModel
<
Bill
>
getBill
s
()
{
return
bills
;
}
public
void
setBillLines
(
ListDataModel
<
BillLine
>
billLines
)
{
this
.
billLines
=
billLines
;
}
public
void
setFoodWaves
(
ListDataModel
<
FoodWave
>
foodWaves
)
{
this
.
foodWaves
=
foodWaves
;
...
...
@@ -371,9 +376,6 @@ public class FoodWaveView extends GenericCDIView {
return
accountEventLines
;
}
public
void
setAccountEventLines
(
ListDataModel
<
AccountEvent
>
accountEventLines
)
{
this
.
accountEventLines
=
accountEventLines
;
}
/*
* public List<BillLine> getUnpaidBills() { return unpaidBills; }
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment