-
Notifications
You must be signed in to change notification settings - Fork 106
/
index.hbs
128 lines (126 loc) · 3.62 KB
/
index.hbs
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<div class="mui-container dashboard">
<div class="mui-row">
<div class="mui-col-lg-4 mui-col-md-6">
<div class="mui-panel dashboard-panel">
<h3 class='mui-panel__title'>🏁 Employee Leaderboard</h3>
<table class='mui-table leaderboard-table'>
<thead>
<th>Name</th>
<th>Amount</th>
</thead>
<tbody>
{{#each employeeLeaderboard as |e|}}
<tr>
<td>{{e.name}}</td>
<td>{{format-money e.amount}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
<div class="mui-col-lg-4 mui-col-md-6">
<div class="mui-panel dashboard-panel">
<h3 class='mui-panel__title'>🛒 Customer Leaderboard</h3>
<table class='mui-table leaderboard-table'>
<thead>
<th>Name</th>
<th>Amount</th>
</thead>
<tbody>
{{#each customerLeaderboard as |c|}}
<tr>
<td>{{c.name}}</td>
<td>{{format-money c.amount}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
<div class="mui-col-lg-4 mui-col-md-6">
<div class="mui-panel dashboard-panel">
<h3 class='mui-panel__title'>🌮 Product Leaderboard</h3>
<table class='mui-table leaderboard-table'>
<thead>
<th>Name</th>
<th>Amount</th>
</thead>
<tbody>
{{#each productLeaderboard as |p|}}
<tr>
<td>{{p.name}}</td>
<td>{{format-money p.amount}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
<div class="mui-col-lg-4 mui-col-md-6">
<div class="mui-panel dashboard-panel">
<h3 class='mui-panel__title'>⏱ Recent Orders</h3>
<table class='mui-table '>
<thead>
<th>Customer</th>
<th>Employee</th>
<th>Amount</th>
</thead>
<tbody>
{{#each recentOrders as |o|}}
<tr>
<td>{{o.customer}}</td>
<td>{{o.employee}}</td>
<td>{{format-money o.subtotal}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
<div class="mui-col-lg-4 mui-col-md-6">
<div class="mui-panel dashboard-panel">
<h3 class='mui-panel__title'>📦 Reorder List</h3>
<table class="mui-table">
<thead>
<th>Name</th>
<th>Quantity In Stock</th>
</thead>
<tbody>
{{#each reorderList as |p|}}
<tr>
<td>{{p.name}}</td>
<td>
{{p.unitsinstock}}
{{#if p.unitsonorder}}
(+ {{p.unitsonorder}} on order)
{{/if}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type='text/javascript'>
var HOST = location.origin.replace(/^http/, 'ws');
var ws = new WebSocket(HOST);
// event emmited when connected
ws.onopen = function () {
console.log('websocket is connected on ' + HOST + ' ...')
// sending a send event to websocket server
ws.send('connected')
}
// event emmited when receiving message
ws.onmessage = function (ev) {
if (ev.data === 'refresh') {
setTimeout(() => {
window.location.href = window.location.href;
}, 100);
} else {
console.log(ev);
}
}
</script>