Commit 0ffb1686 by Petri Jarvisalo

uusi kauppanäkymä valmis

1 parent bbdc6a79
/* 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;
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 {
float: left;
width: 72px;
height: 72px;
background: burlywood;
border: 1px solid black;
margin: 2px;
}
a.shopItem {
color: black !important;
}
a.shopItem 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 {
background: darkgoldenrod;
}
a.shopItem:active {
background: red;
}
\ No newline at end of file
......@@ -36,7 +36,10 @@
<f:ajax render="@form" />
<div>
#{cart.product.name}<br /> #{cart.product.price}
#{cart.product.name}<br />
<h:outputText value="#{cart.product.price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>eur
</div>
</h:commandLink>
</ui:repeat>
......@@ -45,99 +48,81 @@
</h:panelGroup>
<h:panelGroup>
<h:outputLabel value="#{i18n['shop.barcode']}" />
<h:inputText id="barcode" value="#{productShopView.barcode}" />
<h:commandButton action="#{productShopView.readBarcode}"
onclick="blip(); return true;"
value="#{i18n['shop.readBarcode']}">
<f:ajax render="@form" onevent="barcodeReadEvent" execute="@form" />
</h:commandButton>
<br />
<p:dataTable id="prods" value="#{productShopView.boughtItems}"
var="prods">
<p:column>
<f:facet name="header">
<h:link value="#{i18n['user.nick']}" includeViewParams="true">
</h:link>
<h:outputText value="#{i18n['shop.count']}" />
</f:facet>
<h:outputText value="#{prods.count}" />
</p:column>
<p:column>
<f:facet name="header">
<h:link value="#{i18n['user.nick']}" includeViewParams="true">
</h:link>
<h:outputText value="#{i18n['shop.product']}" />
</f:facet>
<h:outputText value="#{prods.getProduct().name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:link value="#{i18n['user.nick']}" includeViewParams="true">
</h:link>
<h:outputText value="#{i18n['shop.price']}" />
</f:facet>
<h:outputText value="#{prods.getProduct().price}" />
<h:outputText value="#{prods.getProduct().price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</p:column>
<p:column>
<f:facet name="header">
<h:link value="#{i18n['user.nick']}" includeViewParams="true">
</h:link>
<h:outputText value="#{i18n['shop.actions']}" />
</f:facet>
<h:commandButton action="#{productShopView.removeBought()}" value="Poista"/>
<h:commandButton action="#{productShopView.removeBought()}"
value="Poista" />
</p:column>
</p:dataTable>
<h:outputLabel value="#{i18n['shop.readBarcode']}" />
<h:inputText id="barcode" value="#{productShopView.barcode}" />
<h:commandButton action="#{productShopView.readBarcode}"
onclick="blip(); return true;"
value="#{i18n['productShopView.readBarcode']}">
<f:ajax render="@form" onevent="barcodeReadEvent" execute="@form" />
</h:commandButton>
<h:outputLabel value="#{i18n['shop.accountBalance']}" />
<h:outputText value="#{productShopView.accountBalance}">
<f:convertNumber />
</h:outputText>
<h:outputLabel value="#{i18n['shop.totalPrice']}" />
<h:outputText value="#{productShopView.totalPrice}">
<f:convertNumber />
</h:outputText>
<div style="font-weight: bold;">
<h:outputText value="#{i18n['shop.totalPrice']}" />
<span class="shoptotal"> <h:outputText value="#{productShopView.totalPrice}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText></span>
</div>
<br />
<br />
<h:outputLabel value="#{i18n['shop.cash']}" />
<h:inputText value="#{productShopView.cash}">
<f:ajax render="@form" event="valueChange" />
<f:convertNumber />
</h:inputText>
<!-- <h:inputText styleClass="inputval" size="5" onblur="calc()" value="#{productShopView.cash}">
<f:ajax render="@form" event="valueChange" />
</h:inputText> -->
<input type="text" class="inputval" value="" size="5" onblur="calc()" />
<br />
<h:outputLabel value="#{i18n['shop.cashback']}" /><input id="returnval" type="text" size="5" value="0" />
<input type="button" value="#{i18n['shop.calcsubtotal']}" onclick="calc()" />
<br />
<h:outputLabel value="#{i18n['shop.accountBalance']}" />
<h:outputText value=" #{productShopView.accountCredits}">
<f:convertNumber />
</h:outputText>
<br/>
<h:commandButton action="#{productShopView.buyCash()}" value="#{i18n['shop.buyCash']}" />
<h:commandButton action="#{productShopView.buyCredit()}" onclick="return confirm('#{i18n['shop.confirmCreditBuy']}');" value="#{i18n['shop.buyCredit']}" />
</h:panelGroup>
</h:panelGrid>
<h:outputText value="#{i18n['product.shopInstant']}" />
<h:selectBooleanCheckbox value="#{productShopView.payInstant}">
<f:ajax render="@form" execute="@form" />
</h:selectBooleanCheckbox>
<h:outputScript library="primefaces" name="jquery/jquery.js" />
<div style="margin-top: 5px;">
<h:commandButton action="#{cc.attrs.commitaction}"
id="commitbutton-top" value="#{cc.attrs.commitValue}" />
</div>
<div>
<h:outputText value="#{i18n['productshop.total']} " />
<h:outputText value="#{productShopView.totalPrice}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</div>
<h:commandButton action="#{cc.attrs.commitaction}"
id="commitbutton-botton" value="#{cc.attrs.commitValue}" />
</h:form>
<script>
......@@ -148,11 +133,15 @@
$("#shoppingcartform\\:barcode").focus();
});
function blip() {
blipSnd.play();
}
function calc() {
$("#returnval").val($(".inputval").val() - $(".shoptotal").text().replace(",","."));
}
function barcodeReadEvent(data) {
if (data.status == "success") {
$("#shoppingcartform\\:barcode").focus();
......
......@@ -64,7 +64,7 @@ public class SessionHandler {
public String getLayout() {
// TODO: layout selection code missing!!
template = "template1";
template = "insomnia2";
return template;
/*
......
......@@ -75,9 +75,9 @@ placegroupview.toptext = \
poll.edit = edit
product.providedRole = Tuote tarjoaa roolin
product.returnProductEdit = Palaa tuotteeseen:
product.saved = Tuote tallennettu
product.providedRole = Tuote tarjoaa roolin
product.returnProductEdit = Palaa tuotteeseen:
product.saved = Tuote tallennettu
productshop.minusOne = -1
productshop.minusTen = -10
......
......@@ -392,28 +392,30 @@ poll.end = Close poll
poll.name = Poll name
poll.save = Send answers
product.barcode = Barcode
product.billed = Billed
product.boughtTotal = Products billed
product.cart.count = To shoppingcart
product.cashed = Cashpaid
product.color = Color in UI
product.create = Create product
product.createDiscount = Add volumediscount
product.edit = edit
product.name = Name of product
product.paid = Paid
product.prepaid = Prepaid
product.prepaidInstant = Created when prepaid is paid
product.price = Price of product
product.save = Save
product.shopInstant = Create automatic cashpayment
product.sort = Sort nr
product.totalPrice = Total
product.unitName = Unit name
product.vat = VAT
products.save = Save
product.barcode = Barcode
product.billed = Billed
product.boughtTotal = Products billed
product.cart.count = To shoppingcart
product.cashed = Cashpaid
product.color = Color in UI
product.create = Create product
product.createDiscount = Add volumediscount
product.edit = edit
product.name = Name of product
product.paid = Paid
product.prepaid = Prepaid
product.prepaidInstant = Created when prepaid is paid
product.price = Price of product
product.save = Save
product.shopInstant = Create automatic cashpayment
product.sort = Sort nr
product.totalPrice = Total
product.unitName = Unit name
product.vat = VAT
products.save = Save
productsShopView.readBarcode = Read
productshop.billCreated = Bill created
productshop.commit = Buy
......@@ -459,10 +461,21 @@ role.write = (W)
sendPicture.header = S
shop.accountBalance = Account balance
shop.cash = Cash deposit
shop.totalPrice = Price of products
shop.user = Selling to
shop.accountBalance = Credits
shop.actions = Actions
shop.barcode = Barcode
shop.buyCash = Buy by Cash
shop.buyCredit = Buy Credit
shop.calcsubtotal = Calc Subtotal
shop.cash = Cash
shop.cashback = Cashback
shop.confirmCreditBuy = Are You sure ?
shop.count = Q
shop.price = price
shop.product = Product
shop.readBarcode = Read
shop.totalPrice = Total
shop.user = Selling to
sidebar.bill.list = My bills
sidebar.bill.listAll = All bills
......
......@@ -381,28 +381,30 @@ poll.end = Sulje kysely
poll.name = Kyselyn nimi
poll.save = L\u00E4het\u00E4 vastauksesi
product.barcode = Viivakoodi
product.billed = Laskutettu
product.boughtTotal = Tuotteita laskutettu
product.cart.count = Ostoskoriin
product.cashed = Ostettu k\u00E4teisell\u00E4
product.color = V\u00E4ri k\u00E4ytt\u00F6liittym\u00E4ss\u00E4
product.create = Luo tuote
product.createDiscount = Lis\u00E4\u00E4 m\u00E4\u00E4r\u00E4alennus
product.edit = Muokkaa
product.name = Tuotteen nimi
product.paid = Maksettu
product.prepaid = Prepaid
product.prepaidInstant = Luodaan kun prepaid maksetaan
product.price = Tuotteen hinta
product.save = Tallenna
product.shopInstant = Luo k\u00E4teismaksu tuotteille
product.sort = J\u00E4rjestys luku
product.totalPrice = Summa
product.unitName = Tuoteyksikk\u00F6
product.vat = ALV
products.save = Tallenna
product.barcode = Viivakoodi
product.billed = Laskutettu
product.boughtTotal = Tuotteita laskutettu
product.cart.count = Ostoskoriin
product.cashed = Ostettu k\u00E4teisell\u00E4
product.color = V\u00E4ri k\u00E4ytt\u00F6liittym\u00E4ss\u00E4
product.create = Luo tuote
product.createDiscount = Lis\u00E4\u00E4 m\u00E4\u00E4r\u00E4alennus
product.edit = Muokkaa
product.name = Tuotteen nimi
product.paid = Maksettu
product.prepaid = Prepaid
product.prepaidInstant = Luodaan kun prepaid maksetaan
product.price = Tuotteen hinta
product.save = Tallenna
product.shopInstant = Luo k\u00E4teismaksu tuotteille
product.sort = J\u00E4rjestys luku
product.totalPrice = Summa
product.unitName = Tuoteyksikk\u00F6
product.vat = ALV
products.save = Tallenna
productsShopView.readBarcode = Lue
productshop.billCreated = Lasku luotu
productshop.commit = Osta
......@@ -445,10 +447,21 @@ role.savePermissions = Tallenna oikeudet
sendPicture.header = L\u00E4het\u00E4 kuva
shop.accountBalance = Tilin saldo
shop.cash = K\u00E4teispano
shop.totalPrice = Tuotteiden hinta
shop.user = Myyd\u00E4\u00E4n
shop.accountBalance = Credits
shop.actions = Hallinta
shop.barcode = Viivakoodi
shop.buyCash = K\u00E4teismaksu
shop.buyCredit = Credit
shop.calcsubtotal = Laske v\u00E4lisumma
shop.cash = K\u00E4teinen
shop.cashback = Takaisin
shop.confirmCreditBuy = Varmastikko ?
shop.count = Lkm
shop.price = Hinta
shop.product = Tuote
shop.readBarcode = Lue
shop.totalPrice = Yhteens\u00E4
shop.user = Myyd\u00E4\u00E4n
sidebar.bill.list = Omat laskut
sidebar.bill.listAll = Kaikki laskut
......
......@@ -189,6 +189,15 @@ public class ProductShopView extends GenericCDIView {
getTotalPrice(), ret });
return ret;
}
public BigDecimal getAccountCredits() {
BigDecimal ret = user.getAccountBalance();
ret = ret.add(getCash());
logger.info("User accountbalance {}, cash{}, total {}. retBalance {}",
new Object[] { user.getAccountBalance(), getCash(),
getTotalPrice(), ret });
return ret;
}
public BigDecimal getTotalPrice() {
BigDecimal ret = BigDecimal.ZERO;
......@@ -225,6 +234,21 @@ public class ProductShopView extends GenericCDIView {
}
public String buyCash() {
cash = getTotalPrice();
logger.info("buying cash {}", cash);
commitShoppingCart();
return null;
}
public String buyCredit() {
setCash(BigDecimal.ZERO);
commitShoppingCart();
return null;
}
public String commitShoppingCart() {
EventUser retuser = null;
for (ProductShopItem shopitem : shoppingcart) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!