-
Notifications
You must be signed in to change notification settings - Fork 4
/
basket.zul
75 lines (71 loc) · 2.57 KB
/
basket.zul
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
<zk xmlns:sh="shadow" xmlns:x="xhtml" >
<div viewModel="@id('basketVM') @init('zk.example.order.BasketViewModel', basket=order.basket)">
<style>
.green {
color: #00CC00;
}
.yellow {
color: #FFDD00;
}
.red {
color: #EE0000;
}
.recommendation {
display: inline-block;
padding: 3px 7px;
background-color: #EEEEEE;
border-radius: 4px;
cursor: pointer;
}
</style>
${i18n:nls('order.basket.hint')}
<grid model="@init(basketVM.itemsModel)">
<columns>
<column width="40px">
<x:i sclass="z-icon-shopping-cart" style="font-size: 22px"/>
</column>
<column hflex="1" label="${i18n:nls('order.basket.itemDescription')}"/>
<column width="60px" label="${i18n:nls('order.basket.quantity')}"/>
<column width="70px" label="${i18n:nls('order.basket.price')}" align="right"/>
</columns>
<template name="model" var="item">
<row>
<div status="@ref(item.status)" tooltiptext="@load(i18n:nls(status))" sclass="@load(i18n:nlsSub(status, 'style'))">
<x:i sclass="@load(i18n:nlsSub(status, 'icon'))" textContent=" "/>
</div>
<div>
<sh:apply template="basketItemLabel" item="@init(item)"/>
<a iconSclass="z-icon-times" sclass="red" onClick="@command('removeItem', basketItem=item)" tooltiptext="remove"/>
</div>
<spinner constraint="min 1" value="@bind(item.quantity)" width="50px" onChange="@command('updateQuantity', basketItem=item)" instant="true"/>
<label value="@load(item.itemPrice) @converter(basketVM.priceFormatter)"/>
</row>
</template>
<foot>
<footer/>
<footer label="${i18n:nls('order.basket.total')}"/>
<footer/>
<footer label="@load(order.basket.totalPrice) @converter(basketVM.priceFormatter)"/>
</foot>
</grid>
<sh:if test="@load(basketVM.hasRecommendations)">
<vlayout>
${i18n:nls('order.basket.recommendation')}
<sh:forEach items="@init(basketVM.recommendedItemsModel)">
<div sclass="recommendation" onClick="@command('addRecommendedItem', item=each)" tooltiptext="add to basket">
<sh:apply template="basketItemLabel" item="@init(each)"/>
<a iconSclass="z-icon-plus green" href="#" />
</div>
</sh:forEach>
</vlayout>
</sh:if>
<sh:if test="@load(!empty vmsgs['p_basket.items'])">
<label style="color: red" value="@load(vmsgs['p_basket.items'])"/>
</sh:if>
<template name="basketItemLabel">
<label value="@load(item.label)"/>
<label value="@load(item.unitPrice) @converter(basketVM.priceFormatterParentheses)"/>
</template>
</div>
</zk>