-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
291 lines (291 loc) · 13.6 KB
/
index.html
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.4.3/css/bulma.min.css">
<script src="https://www.gstatic.com/firebasejs/4.1.3/firebase.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.1/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuefire/1.4.3/vuefire.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-router/2.7.0/vue-router.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/javascript-canvas-to-blob/3.9.0/js/canvas-to-blob.min.js"></script>
<link rel="stylesheet" href="css/style.css">
<script src="db/firebase.js"></script>
<script src="js/components/main.js"></script>
<script src="js/components/login.js"></script>
<script src="js/components/bonds.js"></script>
<title>Check in bounds</title>
</head>
<body>
<div class="container" id="app">
<router-view></router-view>
</div>
<template id="viewMain">
<div class="section has-text-centered">
<div class="block">
<h1 class="title">Hello!</h1>
</div>
<transition name="fade">
<div class="block main-functions" v-if="start">
<div class="field" v-if="isAdmin">
<router-link class="button" :to="{name: 'bonds', query: {mode: 'pvt'}}">查票卷</router-link>
</div>
<div class="field">
<router-link class="button" v-if="auth.currentUser" to="/bonds">測試區</router-link>
<router-link class="button" v-else to="/login">登入</router-link>
</div>
</div>
</transition>
</div>
</template>
<template id="viewLogin">
<div class="section">
<div class="columns">
<div class="column"></div>
<div class="column has-text-centered">
<h2 class="title">請登入</h2>
<div class="field">
<div class="control has-icons-left has-icons-right">
<input class="input is-medium" type="email" placeholder="email" v-model="user.email"><span class="icon is-left"><i class="fa fa-envelope"></i></span>
</div>
</div>
<div class="field">
<div class="control has-icons-left has-icons-right">
<input class="input is-medium" type="password" placeholder="password" v-model="user.password"><span class="icon is-left"><i class="fa fa-lock"></i></span>
</div>
</div>
<div class="field"><a class="button is-primary" @click="signIn">登入</a></div>
<transition name="expand">
<div class="notification" v-if="message">
<button class="delete" @click="message=''"></button><span>{{message}}</span>
</div>
</transition>
</div>
<div class="column"></div>
</div>
</div>
</template>
<template id="indexBonds">
<div class="section">
<div class="block">
<h2 class="title is-pulled-left">
<router-link class="icon back" to="/"><i class="fa fa-university"></i></router-link><span>票卷列表</span>
</h2>
<transition name="fade"><a class="button is-primary is-small add-bond" v-if="start" @click="adding"><i class="fa fa-plus"></i></a></transition>
<transition name="fade">
<router-link class="button is-pulled-right" v-if="start" to="/logout">登出</router-link>
</transition>
</div>
<div class="block table-wrapper" @click="pickedBond = {}">
<table class="table" :class="{slim : slim}">
<thead>
<tr>
<th @click="slim = !slim"><i class="fa fa-caret-square-o-left"></i></th>
<th></th>
<th>姓名</th>
<template v-if="!slim">
<th>資訊</th>
<th>email</th>
<th>電話</th>
<th>匯款號碼</th>
<th>匯款時間</th>
<th>備註</th>
</template>
<th>已付款</th>
<th>報到</th>
<th></th>
<template v-if="!slim">
<th></th>
</template>
</tr>
</thead>
<tbody>
<tr v-for="(bond, idx) in bonds" :class="{'is-selected' : bonds.length > 1 && pickedBond == bond}" @click.stop="pickedBond = bond">
<td>{{idx + 1}}</td>
<td><a @click="producing(bond)"><i class="fa fa-qrcode"></i></a></td>
<td>
<router-link :to="{ name: 'check-bond', params: { id: bond['.key'] }, query: {mode: $route.query.mode}}">{{bond.name}}</router-link>
</td>
<template v-if="!slim">
<td>{{bond.info}}</td>
<td><a :href="getMailTo(bond)">{{bond.email}}</a></td>
<td>{{bond.phone}}</td>
<td>{{bond.code}}</td>
<td>{{bond.commitTime}}</td>
<td>{{bond.memo}}</td>
</template>
<td><i class="fa fa-check" v-if="bond.checked"></i></td>
<td><i class="fa fa-check" v-if="bond.checkIn" :title="bond.checkInTime"></i></td>
<td><a @click="editing(bond)"><i class="fa fa-pencil"></i></a></td>
<template v-if="!slim">
<td><a @click="deleting(bond)"><i class="fa fa-trash"></i></a></td>
</template>
</tr>
</tbody>
</table>
</div>
<transition name="fade">
<div class="block" v-if="bonds.length > 0"><a class="button is-small download-all" @click="producingAll"><i class="fa fa-download"></i><span>下載全部 QRcode</span></a></div>
</transition>
<edit-bond-modal :bond="pickedBond" ref="edit-bond-modal"></edit-bond-modal>
<delete-bond-modal :bond="pickedBond" ref="delete-bond-modal"></delete-bond-modal>
<qr-view-modal :bond="pickedBond" ref="qr-view-modal"></qr-view-modal>
</div>
</template>
<template id="checkBond">
<div class="section">
<div class="columns">
<div class="column"></div>
<div class="column has-text-centered" v-if="isAuthed">
<div class="block">
<router-link class="icon back" :to="{name: 'bonds', query: {mode: $route.query.mode}}"><i class="fa fa-list"></i></router-link>
</div>
<template v-if="bond.name">
<div class="block">
<div class="field">
<h3 class="title">{{bond.name}}</h3>
</div>
<div class="field"><span>{{bond.info}}</span></div>
</div>
<transition name="fade">
<div class="block" v-if="bond.checked"><a class="button is-large is-primary" v-if="!bond.checkIn" @click="checkIn"><span>報到</span></a><a class="button is-large is-info" v-else-if="isClicked"><i class="fa fa-check"></i><span>完成</span></a><a class="button is-large is-warning" v-else><i class="fa fa-check-circle"></i><span>已報到</span></a>
<div class="check-in-time" v-if="bond.checkInTime">{{bond.checkInTime}}</div>
</div>
<div class="block" v-else><a class="button" @click="commit">未付款</a></div>
</transition>
</template>
<template v-else-if="bond.hasOwnProperty('.value')">
<h3 class="invalid-info">找不到資料</h3><i class="fa fa-exclamation-triangle"></i>
</template>
<template v-else>
<div class="block">
<div class="spinner"></div>
</div>
</template>
<transition name="expand">
<div class="notification" v-if="message">
<button class="delete" @click="message=''"></button><span>{{message}}</span>
</div>
</transition>
</div>
<div class="column has-text-centered" v-else>
<div class="blick">
<h3 class="title">請先登入</h3>
<router-link class="button" to="/login">登入</router-link>
</div>
</div>
<div class="column"></div>
</div>
</div>
</template>
<template id="editBondModal">
<div class="modal" :class="{'is-active' : isOpen}">
<div class="modal-background"></div>
<div class="modal-card has-text-centered">
<div class="box has-text-centered">
<div class="block">
<h3 class="modal-card-title">{{isNew ? '新增票卷' : '編輯票卷'}}</h3>
</div>
<div class="columns">
<div class="column">
<div class="control has-icons-left">
<input class="input" type="text" placeholder="姓名" v-model="bondData.name"><span class="icon is-left"><i class="fa fa-user"></i></span>
</div>
</div>
<div class="column">
<div class="control has-icons-left">
<input class="input" type="text" placeholder="資訊" v-model="bondData.info"><span class="icon is-left"><i class="fa fa-info-circle"></i></span>
</div>
</div>
</div>
<div class="columns">
<div class="column">
<div class="control has-icons-left">
<input class="input" type="text" placeholder="email" v-model="bondData.email"><span class="icon is-left"><i class="fa fa-envelope"></i></span>
</div>
</div>
<div class="column">
<div class="control has-icons-left">
<input class="input" type="text" placeholder="電話" v-model="bondData.phone"><span class="icon is-left"><i class="fa fa-phone"></i></span>
</div>
</div>
</div>
<div class="columns">
<div class="column">
<div class="control has-icons-left">
<input class="input" type="text" placeholder="帳號末五碼" v-model="bondData.code"><span class="icon is-left"><i class="fa fa-credit-card"></i></span>
</div>
</div>
<div class="column">
<div class="control has-icons-left">
<input class="input" type="text" placeholder="匯款時間" v-model="bondData.commitTime"><span class="icon is-left"><i class="fa fa-clock-o"></i></span>
</div>
</div>
</div>
<div class="field">
<div class="control">
<textarea class="textarea" placeholder="備註" v-model="bondData.memo" @keydown="autosize"></textarea>
</div>
</div>
<div class="columns">
<div class="column"><span>付款</span>
<label class="switch">
<input type="checkbox" v-model="bondData.checked">
<div class="slider"></div>
</label>
</div>
<div class="column"><span>報到</span>
<label class="switch">
<input type="checkbox" v-model="bondData.checkIn">
<div class="slider"></div>
</label>
</div>
<div class="column box-foot"><a class="button is-primary" v-if="isNew" @click="create">新增</a><a class="button is-primary" v-else @click="update">儲存</a><a class="button" @click="isOpen = false">取消</a></div>
</div>
<transition name="expand">
<div class="notification" v-if="message">
<button class="delete" @click="message=''"></button><span>{{message}}</span>
</div>
</transition>
</div>
</div>
</div>
</template>
<template id="deleteBondModal">
<div class="modal" :class="{'is-active' : isOpen}">
<div class="modal-background"></div>
<div class="modal-card narrow">
<div class="box has-text-centered">
<div class="block">
<h3 class="modal-card-title">確認刪除?</h3>
</div>
<div class="block">
<div class="field">
<h3 class="title">{{bond.name}}</h3>
</div>
<div class="field"><span>{{bond.info}}</span></div>
</div>
<div class="box-foot"><a class="button is-danger" @click="destroy">刪除</a><a class="button" @click="isOpen = false">取消</a></div>
</div>
</div>
</div>
</template>
<template id="qrViewModal">
<div class="modal" :class="{'is-active' : isOpen}">
<div class="modal-background"></div>
<div class="modal-card qr-wrapper">
<div class="box">
<div class="block qr-code">
<canvas id="qrCode"></canvas>
</div>
<div class="box-foot"><a class="button is-primary" @click="download"><i class="fa fa-download"></i><span>儲存</span></a><a class="button" @click="isOpen = false">取消</a></div>
</div>
</div>
</div>
</template>
<script src="js/router.js"></script>
<script src="js/index.js"></script>
</body>
</html>