forked from cor3000/zk-wizard-example
-
Notifications
You must be signed in to change notification settings - Fork 2
/
basket.zul
80 lines (74 loc) · 3.22 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
76
77
78
79
80
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
<zk xmlns:sh="shadow" xmlns:x="xhtml" xmlns:n="native" xmlns:ca="client/attribute" xmlns:z="zk">
<x:div viewModel="@id('basketVM') @init('zk.example.order.BasketViewModel', basket=order.basket)">
<x:div class="alert alert-info" role="alert" textContent="${i18n:nls('order.basket.hint')}"/>
<n:table class="table table-striped">
<n:colgroup>
<n:col width="50px"/>
<n:col/>
<n:col width="60px"/>
<n:col width="100px"/>
</n:colgroup>
<n:thead>
<n:tr>
<n:th style="padding: 6px 8px;"><n:i sclass="z-icon-shopping-cart" style="font-size: 22px"/></n:th>
<n:th>${i18n:nls('order.basket.itemDescription')}</n:th>
<n:th>${i18n:nls('order.basket.quantity')}</n:th>
<n:th class="text-right">${i18n:nls('order.basket.price')}</n:th>
</n:tr>
</n:thead>
<x:tbody>
<sh:forEach items="@load(basketVM.itemsModel)" var="item">
<x:tr>
<n:td>
<span zclass=" " status="@ref(item.status)" sclass="@load(i18n:nlsSub(status, 'style'))"
ca:data-toggle="tooltip" ca:data-placement="top" tooltiptext="@load(i18n:nls(status))">
<x:i sclass="@load(i18n:nlsSub(status, 'icon'))" textContent=" "/>
</span>
</n:td>
<n:td>
<sh:apply template="basketItemLabel" item="@init(each)"/>
<button zclass="close" iconSclass="z-icon-times" onClick="@command('removeItem', basketItem=item)"
ca:data-toggle="tooltip" ca:data-placement="right" ca:data-title="${i18n:nls('order.basket.remove')}"/>
</n:td>
<x:td class="text-center" style="padding: 6px;">
<spinner constraint="min 0" value="@bind(item.quantity)" width="50px" onChange="@command('updateQuantity', basketItem=item)" instant="true"/>
</x:td>
<x:td class="text-right" textContent="@load(item.itemPrice) @converter(basketVM.priceFormatter)"/>
</x:tr>
</sh:forEach>
</x:tbody>
<n:tfoot>
<n:tr>
<n:td/>
<n:td><n:strong>${i18n:nls('order.basket.total')}</n:strong></n:td>
<n:td/>
<n:td class="text-right">
<x:strong textContent="@load(order.basket.totalPrice) @converter(basketVM.priceFormatter)"/>
</n:td>
</n:tr>
</n:tfoot>
</n:table>
<sh:if test="@load(basketVM.hasRecommendations)">
<x:div class="alert alert-info" role="alert" textContent="${i18n:nls('order.basket.recommendation')}"/>
<x:div class="row">
<sh:forEach items="@init(basketVM.recommendedItemsModel)">
<x:div class="col-lg-4 col-sm-6">
<x:div class="well well-sm">
<sh:apply template="basketItemLabel" item="@init(each)"/>
<button zclass="btn btn-info btn-xs pull-right" iconSclass="z-icon-shopping-cart" onClick="@command('addRecommendedItem', item=each)"
ca:data-toggle="tooltip" ca:data-placement="right" ca:data-title="${i18n:nls('order.basket.add')}"/>
</x:div>
</x:div>
</sh:forEach>
</x:div>
</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">
<x:strong textContent="@load((item.label))"/>
<x:text value="@load(item.unitPrice) @converter(basketVM.priceFormatterParentheses)"/>
</template>
</x:div>
</zk>