nodebb-plugin-niki-loyalty 1.3.15 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +7 -0
- package/library.js +124 -24
- package/niki-admin.txt +1309 -0
- package/niki-kasa.txt +1006 -0
- package/niki-wallet.txt +0 -0
- package/package.json +1 -1
- package/plugin.json +2 -5
- package/static/lib/client.js +73 -93
- package/static/samplefile.html +1 -1
- package/static/templates/niki-kasa.tpl +13 -0
package/niki-kasa.txt
ADDED
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
<script src="https://unpkg.com/html5-qrcode" type="text/javascript"></script>
|
|
2
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
|
|
3
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/locale/tr.min.js"></script>
|
|
4
|
+
|
|
5
|
+
<style>
|
|
6
|
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
|
|
7
|
+
|
|
8
|
+
body.niki-pos-lock {
|
|
9
|
+
overflow: hidden !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#niki-pos-root {
|
|
13
|
+
font-family: 'Poppins', sans-serif;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#niki-pos-root .start-view {
|
|
18
|
+
position: fixed;
|
|
19
|
+
inset: 0;
|
|
20
|
+
z-index: 100;
|
|
21
|
+
color: #fff;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
background: radial-gradient(1200px 700px at 50% 10%, rgba(197, 160, 101, 0.18), transparent 60%),
|
|
27
|
+
linear-gradient(180deg, #0b0b0b, #111 55%, #0b0b0b);
|
|
28
|
+
padding-top: env(safe-area-inset-top);
|
|
29
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#niki-pos-root .logo-box {
|
|
33
|
+
width: 96px;
|
|
34
|
+
height: 96px;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
border: 2px solid #C5A065;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
margin-bottom: 30px;
|
|
41
|
+
background: #000;
|
|
42
|
+
box-shadow: 0 0 0 1px rgba(197, 160, 101, 0.18), 0 18px 50px rgba(0, 0, 0, 0.55);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#niki-pos-root .btn-group {
|
|
46
|
+
display: grid;
|
|
47
|
+
gap: 12px;
|
|
48
|
+
width: min(320px, 88vw);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#niki-pos-root .btn-start,
|
|
52
|
+
#niki-pos-root .btn-hist {
|
|
53
|
+
-webkit-tap-highlight-color: transparent;
|
|
54
|
+
user-select: none;
|
|
55
|
+
width: 100%;
|
|
56
|
+
padding: 18px 18px;
|
|
57
|
+
border-radius: 16px;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
gap: 10px;
|
|
63
|
+
border: none;
|
|
64
|
+
font-family: 'Poppins', sans-serif;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
#niki-pos-root .btn-start {
|
|
68
|
+
background: #C5A065;
|
|
69
|
+
color: #000;
|
|
70
|
+
font-weight: 700;
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
box-shadow: 0 5px 15px rgba(197, 160, 101, 0.3);
|
|
73
|
+
transition: transform 120ms ease, filter 180ms ease;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#niki-pos-root .btn-start:active {
|
|
77
|
+
transform: scale(0.98);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#niki-pos-root .btn-start:hover {
|
|
81
|
+
filter: brightness(1.03);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#niki-pos-root .btn-hist {
|
|
85
|
+
background: #222;
|
|
86
|
+
color: #fff;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
border: 1px solid #333;
|
|
90
|
+
transition: transform 120ms ease, background 180ms ease, border-color 180ms ease;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#niki-pos-root .btn-hist:active {
|
|
94
|
+
transform: scale(0.98);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#niki-pos-root .btn-hist:hover {
|
|
98
|
+
background: #262626;
|
|
99
|
+
border-color: #3b3b3b;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (min-width: 900px) {
|
|
103
|
+
#niki-pos-root .start-view {
|
|
104
|
+
position: relative;
|
|
105
|
+
inset: auto;
|
|
106
|
+
min-height: 560px;
|
|
107
|
+
margin: 34px auto;
|
|
108
|
+
width: min(520px, 92vw);
|
|
109
|
+
border-radius: 28px;
|
|
110
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
111
|
+
box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
#niki-pos-root .camera-ui {
|
|
117
|
+
position: fixed;
|
|
118
|
+
inset: 0;
|
|
119
|
+
background: #000;
|
|
120
|
+
display: none;
|
|
121
|
+
z-index: 200;
|
|
122
|
+
padding-top: env(safe-area-inset-top);
|
|
123
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#niki-pos-root #reader {
|
|
127
|
+
width: 100% !important;
|
|
128
|
+
height: 100% !important;
|
|
129
|
+
border: none !important;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#niki-pos-root #reader video {
|
|
133
|
+
object-fit: cover !important;
|
|
134
|
+
width: 100% !important;
|
|
135
|
+
height: 100% !important;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#niki-pos-root .session-bar-bg {
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 0;
|
|
141
|
+
left: 0;
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 6px;
|
|
144
|
+
background: rgba(255, 255, 255, 0.14);
|
|
145
|
+
z-index: 220;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
#niki-pos-root .session-bar-fill {
|
|
149
|
+
height: 100%;
|
|
150
|
+
background: #C5A065;
|
|
151
|
+
width: 100%;
|
|
152
|
+
transition: width 1s linear;
|
|
153
|
+
border-radius: 0 8px 8px 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
#niki-pos-root .top-ctrl {
|
|
157
|
+
position: absolute;
|
|
158
|
+
top: calc(14px + env(safe-area-inset-top));
|
|
159
|
+
left: 0;
|
|
160
|
+
width: 100%;
|
|
161
|
+
padding: 0 16px;
|
|
162
|
+
display: flex;
|
|
163
|
+
justify-content: space-between;
|
|
164
|
+
z-index: 230;
|
|
165
|
+
box-sizing: border-box;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#niki-pos-root .badge-live {
|
|
169
|
+
background: rgba(0, 0, 0, 0.55);
|
|
170
|
+
color: #C5A065;
|
|
171
|
+
padding: 7px 12px;
|
|
172
|
+
border-radius: 20px;
|
|
173
|
+
font-size: 12px;
|
|
174
|
+
font-weight: 700;
|
|
175
|
+
border: 1px solid rgba(197, 160, 101, 0.4);
|
|
176
|
+
backdrop-filter: blur(4px);
|
|
177
|
+
letter-spacing: 0.6px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
#niki-pos-root .btn-x {
|
|
181
|
+
width: 42px;
|
|
182
|
+
height: 42px;
|
|
183
|
+
border-radius: 50%;
|
|
184
|
+
border: 1px solid rgba(255, 255, 255, 0.10);
|
|
185
|
+
background: rgba(255, 255, 255, 0.16);
|
|
186
|
+
color: #fff;
|
|
187
|
+
cursor: pointer;
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
justify-content: center;
|
|
191
|
+
backdrop-filter: blur(4px);
|
|
192
|
+
transition: transform 120ms ease, background 180ms ease;
|
|
193
|
+
-webkit-tap-highlight-color: transparent;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
#niki-pos-root .btn-x:hover {
|
|
197
|
+
background: rgba(255, 255, 255, 0.22);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#niki-pos-root .btn-x:active {
|
|
201
|
+
transform: scale(0.96);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#niki-pos-root .scan-guide {
|
|
205
|
+
position: absolute;
|
|
206
|
+
top: 50%;
|
|
207
|
+
left: 50%;
|
|
208
|
+
transform: translate(-50%, -50%);
|
|
209
|
+
width: min(76vw, 360px);
|
|
210
|
+
height: min(76vw, 360px);
|
|
211
|
+
border-radius: 22px;
|
|
212
|
+
border: 1px solid rgba(255, 255, 255, 0.25);
|
|
213
|
+
box-shadow: 0 0 0 5000px rgba(0, 0, 0, 0.78);
|
|
214
|
+
pointer-events: none;
|
|
215
|
+
z-index: 210;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
#niki-pos-root .scan-guide::before {
|
|
219
|
+
content: '';
|
|
220
|
+
position: absolute;
|
|
221
|
+
top: -2px;
|
|
222
|
+
left: -2px;
|
|
223
|
+
width: 36px;
|
|
224
|
+
height: 36px;
|
|
225
|
+
border-top: 5px solid #C5A065;
|
|
226
|
+
border-left: 5px solid #C5A065;
|
|
227
|
+
border-radius: 20px 0 0 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
#niki-pos-root .scan-guide::after {
|
|
231
|
+
content: '';
|
|
232
|
+
position: absolute;
|
|
233
|
+
bottom: -2px;
|
|
234
|
+
right: -2px;
|
|
235
|
+
width: 36px;
|
|
236
|
+
height: 36px;
|
|
237
|
+
border-bottom: 5px solid #C5A065;
|
|
238
|
+
border-right: 5px solid #C5A065;
|
|
239
|
+
border-radius: 0 0 20px 0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
#niki-pos-root .laser {
|
|
243
|
+
width: 100%;
|
|
244
|
+
height: 2px;
|
|
245
|
+
background: #C5A065;
|
|
246
|
+
position: absolute;
|
|
247
|
+
top: 50%;
|
|
248
|
+
opacity: 0.95;
|
|
249
|
+
filter: drop-shadow(0 0 10px rgba(197, 160, 101, 0.6));
|
|
250
|
+
animation: scanAnim 2s infinite ease-in-out;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@keyframes scanAnim {
|
|
254
|
+
0% {
|
|
255
|
+
top: 10%;
|
|
256
|
+
opacity: 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
50% {
|
|
260
|
+
opacity: 1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
100% {
|
|
264
|
+
top: 90%;
|
|
265
|
+
opacity: 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#niki-pos-root .scan-hint {
|
|
270
|
+
position: absolute;
|
|
271
|
+
bottom: calc(56px + env(safe-area-inset-bottom));
|
|
272
|
+
width: 100%;
|
|
273
|
+
text-align: center;
|
|
274
|
+
color: #fff;
|
|
275
|
+
font-size: 13px;
|
|
276
|
+
opacity: 0.85;
|
|
277
|
+
z-index: 220;
|
|
278
|
+
letter-spacing: 0.5px;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
#niki-pos-root .res-modal {
|
|
282
|
+
position: fixed;
|
|
283
|
+
bottom: 0;
|
|
284
|
+
left: 0;
|
|
285
|
+
width: 100%;
|
|
286
|
+
transform: translateY(110%);
|
|
287
|
+
transition: transform 0.3s;
|
|
288
|
+
z-index: 600;
|
|
289
|
+
box-sizing: border-box;
|
|
290
|
+
background: linear-gradient(180deg, rgba(28, 28, 28, 0.98), rgba(18, 18, 18, 0.98));
|
|
291
|
+
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
292
|
+
padding: 26px 18px calc(18px + env(safe-area-inset-bottom));
|
|
293
|
+
border-radius: 26px 26px 0 0;
|
|
294
|
+
box-shadow: 0 -22px 60px rgba(0, 0, 0, 0.55);
|
|
295
|
+
text-align: center;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
#niki-pos-root .res-modal.active {
|
|
299
|
+
transform: translateY(0);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
#niki-pos-root .res-modal::before {
|
|
303
|
+
content: "";
|
|
304
|
+
display: block;
|
|
305
|
+
width: 42px;
|
|
306
|
+
height: 5px;
|
|
307
|
+
border-radius: 999px;
|
|
308
|
+
background: rgba(255, 255, 255, 0.16);
|
|
309
|
+
margin: -8px auto 16px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
#niki-pos-root .res-close {
|
|
313
|
+
position: absolute;
|
|
314
|
+
top: 14px;
|
|
315
|
+
right: 14px;
|
|
316
|
+
width: 42px;
|
|
317
|
+
height: 42px;
|
|
318
|
+
border-radius: 50%;
|
|
319
|
+
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
320
|
+
background: rgba(255, 255, 255, 0.10);
|
|
321
|
+
color: #fff;
|
|
322
|
+
display: flex;
|
|
323
|
+
align-items: center;
|
|
324
|
+
justify-content: center;
|
|
325
|
+
cursor: pointer;
|
|
326
|
+
-webkit-tap-highlight-color: transparent;
|
|
327
|
+
backdrop-filter: blur(6px);
|
|
328
|
+
z-index: 10;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
#niki-pos-root .res-close:active {
|
|
332
|
+
transform: scale(0.96);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
#niki-pos-root .icon-big {
|
|
336
|
+
font-size: 60px;
|
|
337
|
+
margin-bottom: 15px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
#niki-pos-root .res-reward-name {
|
|
341
|
+
color: #C5A065;
|
|
342
|
+
font-size: 13px;
|
|
343
|
+
font-weight: 700;
|
|
344
|
+
text-transform: uppercase;
|
|
345
|
+
letter-spacing: 1px;
|
|
346
|
+
margin-bottom: 5px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
#niki-pos-root .res-title {
|
|
350
|
+
color: #fff;
|
|
351
|
+
font-size: 22px;
|
|
352
|
+
font-weight: 700;
|
|
353
|
+
margin-bottom: 10px;
|
|
354
|
+
line-height: 1.2;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
#niki-pos-root .res-msg {
|
|
358
|
+
color: #aaa;
|
|
359
|
+
font-size: 15px;
|
|
360
|
+
margin: 0 auto 22px;
|
|
361
|
+
line-height: 1.45;
|
|
362
|
+
max-width: 520px;
|
|
363
|
+
overflow-wrap: anywhere;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
#niki-pos-root .btn-new {
|
|
367
|
+
background: #fff;
|
|
368
|
+
color: #000;
|
|
369
|
+
width: 100%;
|
|
370
|
+
padding: 18px;
|
|
371
|
+
border-radius: 16px;
|
|
372
|
+
font-size: 16px;
|
|
373
|
+
font-weight: 700;
|
|
374
|
+
border: none;
|
|
375
|
+
cursor: pointer;
|
|
376
|
+
transition: transform 120ms ease, filter 180ms ease;
|
|
377
|
+
-webkit-tap-highlight-color: transparent;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
#niki-pos-root .btn-new:active {
|
|
381
|
+
transform: scale(0.99);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
#niki-pos-root .hist-modal {
|
|
385
|
+
position: fixed;
|
|
386
|
+
inset: 0;
|
|
387
|
+
z-index: 700;
|
|
388
|
+
display: none;
|
|
389
|
+
flex-direction: column;
|
|
390
|
+
font-family: 'Poppins', sans-serif;
|
|
391
|
+
background: #f3f3f3;
|
|
392
|
+
padding-top: env(safe-area-inset-top);
|
|
393
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
#niki-pos-root .hist-head {
|
|
397
|
+
position: sticky;
|
|
398
|
+
top: 0;
|
|
399
|
+
z-index: 10;
|
|
400
|
+
padding: 18px 16px;
|
|
401
|
+
background: linear-gradient(180deg, #151515, #1a1a1a);
|
|
402
|
+
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
|
|
403
|
+
color: #fff;
|
|
404
|
+
display: flex;
|
|
405
|
+
justify-content: space-between;
|
|
406
|
+
align-items: center;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* FİLTRE */
|
|
410
|
+
#niki-pos-root .hist-filters {
|
|
411
|
+
padding: 10px 12px;
|
|
412
|
+
background: #222;
|
|
413
|
+
display: flex;
|
|
414
|
+
gap: 6px;
|
|
415
|
+
flex-wrap: wrap;
|
|
416
|
+
align-items: center;
|
|
417
|
+
justify-content: center;
|
|
418
|
+
border-bottom: 1px solid #333;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
#niki-pos-root .hist-filters input {
|
|
422
|
+
background: #333;
|
|
423
|
+
border: 1px solid #444;
|
|
424
|
+
border-radius: 6px;
|
|
425
|
+
padding: 6px 8px;
|
|
426
|
+
color: #fff;
|
|
427
|
+
font-size: 11px;
|
|
428
|
+
width: 100px;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
#niki-pos-root .hist-filters input[type="text"] {
|
|
432
|
+
flex: 1;
|
|
433
|
+
min-width: 70px;
|
|
434
|
+
max-width: 120px;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
#niki-pos-root .hist-filters input:focus {
|
|
438
|
+
outline: none;
|
|
439
|
+
border-color: #C5A065;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
#niki-pos-root .hist-filters button {
|
|
443
|
+
padding: 6px 10px;
|
|
444
|
+
border-radius: 6px;
|
|
445
|
+
border: none;
|
|
446
|
+
cursor: pointer;
|
|
447
|
+
font-size: 11px;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
#niki-pos-root .btn-filter {
|
|
451
|
+
background: #C5A065;
|
|
452
|
+
color: #000;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
#niki-pos-root .btn-reset {
|
|
456
|
+
background: #444;
|
|
457
|
+
color: #aaa;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
#niki-pos-root .btn-csv {
|
|
461
|
+
background: #2e7d32;
|
|
462
|
+
color: #fff;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
#niki-pos-root .hist-body {
|
|
466
|
+
flex: 1;
|
|
467
|
+
overflow-y: auto;
|
|
468
|
+
padding: 10px 10px calc(16px + env(safe-area-inset-bottom));
|
|
469
|
+
margin: 0;
|
|
470
|
+
list-style: none;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
@media (min-width: 900px) {
|
|
474
|
+
#niki-pos-root .hist-body {
|
|
475
|
+
max-width: 720px;
|
|
476
|
+
width: calc(100% - 24px);
|
|
477
|
+
margin: 0 auto;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
#niki-pos-root .hist-head {
|
|
481
|
+
padding-left: 22px;
|
|
482
|
+
padding-right: 22px;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
#niki-pos-root .hist-row {
|
|
487
|
+
margin: 10px 2px;
|
|
488
|
+
border-radius: 16px;
|
|
489
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
490
|
+
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
|
|
491
|
+
background: #fff;
|
|
492
|
+
overflow: hidden;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
#niki-pos-root .hist-row-link {
|
|
496
|
+
display: flex;
|
|
497
|
+
align-items: center;
|
|
498
|
+
width: 100%;
|
|
499
|
+
padding: 15px 16px;
|
|
500
|
+
text-decoration: none;
|
|
501
|
+
color: inherit;
|
|
502
|
+
-webkit-tap-highlight-color: transparent;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
#niki-pos-root .hist-u-img {
|
|
506
|
+
width: 46px;
|
|
507
|
+
height: 46px;
|
|
508
|
+
border-radius: 50%;
|
|
509
|
+
margin-right: 15px;
|
|
510
|
+
border: 1px solid rgba(0, 0, 0, 0.10);
|
|
511
|
+
object-fit: cover;
|
|
512
|
+
flex: 0 0 auto;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
#niki-pos-root .hist-u-name {
|
|
516
|
+
display: block;
|
|
517
|
+
font-weight: 700;
|
|
518
|
+
font-size: 14px;
|
|
519
|
+
color: #1c1c1c;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
#niki-pos-root .hist-reward-txt {
|
|
523
|
+
display: block;
|
|
524
|
+
margin-top: 2px;
|
|
525
|
+
font-size: 11px;
|
|
526
|
+
color: #C5A065;
|
|
527
|
+
font-weight: 600;
|
|
528
|
+
text-transform: uppercase;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
#niki-pos-root .hist-time {
|
|
532
|
+
display: block;
|
|
533
|
+
margin-top: 2px;
|
|
534
|
+
font-size: 12px;
|
|
535
|
+
color: #7a7a7a;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
#niki-pos-root .hist-val {
|
|
539
|
+
margin-left: auto;
|
|
540
|
+
background: rgba(198, 40, 40, 0.08);
|
|
541
|
+
border: 1px solid rgba(198, 40, 40, 0.18);
|
|
542
|
+
color: #C62828;
|
|
543
|
+
padding: 8px 10px;
|
|
544
|
+
border-radius: 999px;
|
|
545
|
+
font-size: 13px;
|
|
546
|
+
font-weight: 700;
|
|
547
|
+
min-width: 64px;
|
|
548
|
+
text-align: center;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
#niki-pos-root .hist-row-link .avatar.avatar-rounded {
|
|
552
|
+
border-radius: 999px;
|
|
553
|
+
display: inline-flex;
|
|
554
|
+
align-items: center;
|
|
555
|
+
justify-content: center;
|
|
556
|
+
font-weight: 700;
|
|
557
|
+
color: #fff;
|
|
558
|
+
flex: 0 0 auto;
|
|
559
|
+
margin-right: 15px;
|
|
560
|
+
border: 1px solid rgba(0, 0, 0, 0.10);
|
|
561
|
+
box-sizing: border-box;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
@media (prefers-reduced-motion: reduce) {
|
|
565
|
+
#niki-pos-root .laser {
|
|
566
|
+
animation: none !important;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
#niki-pos-root .btn-start,
|
|
570
|
+
#niki-pos-root .btn-hist,
|
|
571
|
+
#niki-pos-root .btn-new,
|
|
572
|
+
#niki-pos-root .btn-x {
|
|
573
|
+
transition: none !important;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
#niki-pos-root .res-modal {
|
|
577
|
+
transition: none !important;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
</style>
|
|
581
|
+
|
|
582
|
+
<div id="niki-pos-root">
|
|
583
|
+
<div id="start-view" class="start-view">
|
|
584
|
+
<div class="logo-box"><i class="fa fa-qrcode" style="font-size:45px; color:#C5A065;"></i></div>
|
|
585
|
+
<h2 style="margin:0 0 5px; font-size:24px;">NIKI POS</h2>
|
|
586
|
+
<p style="color:#888; font-size:13px; margin:0 0 40px;">Yetkili Personel Terminali</p>
|
|
587
|
+
<div class="btn-group">
|
|
588
|
+
<button class="btn-start" id="btn-start-session" onclick="niki_initSession()"><i class="fa fa-camera"></i>
|
|
589
|
+
OTURUMU BAŞLAT</button>
|
|
590
|
+
<button class="btn-hist" id="btn-open-history" onclick="niki_openHistory()"><i class="fa fa-history"></i>
|
|
591
|
+
İŞLEM GEÇMİŞİ</button>
|
|
592
|
+
</div>
|
|
593
|
+
<p style="color:#666; font-size:20px; margin-top:20px;">Eğer butonlar çalışmazsa sayfayı yenileyiniz.</p>
|
|
594
|
+
</div>
|
|
595
|
+
|
|
596
|
+
<div id="camera-ui" class="camera-ui">
|
|
597
|
+
<div class="session-bar-bg">
|
|
598
|
+
<div class="session-bar-fill" id="timer-bar"></div>
|
|
599
|
+
</div>
|
|
600
|
+
<div class="top-ctrl">
|
|
601
|
+
<div class="badge-live">● CANLI</div>
|
|
602
|
+
<button class="btn-x" id="btn-stop-session" onclick="niki_stopSession()"><i
|
|
603
|
+
class="fa fa-times"></i></button>
|
|
604
|
+
</div>
|
|
605
|
+
<div id="reader"></div>
|
|
606
|
+
<div class="scan-guide">
|
|
607
|
+
<div class="laser"></div>
|
|
608
|
+
</div>
|
|
609
|
+
<div class="scan-hint">QR Kodu karenin içine tutun</div>
|
|
610
|
+
</div>
|
|
611
|
+
|
|
612
|
+
<div id="res-view" class="res-modal">
|
|
613
|
+
<button class="res-close" id="btn-close-result" aria-label="Kapat" onclick="niki_stopSession()">
|
|
614
|
+
<i class="fa fa-times"></i>
|
|
615
|
+
</button>
|
|
616
|
+
<div id="res-icon" class="icon-big"></div>
|
|
617
|
+
<div id="res-reward-name" class="res-reward-name"></div>
|
|
618
|
+
<div id="res-title" class="res-title">...</div>
|
|
619
|
+
<div id="res-msg" class="res-msg">...</div>
|
|
620
|
+
<button class="btn-new" id="btn-resume-scan" onclick="niki_resumeScan()">YENİ İŞLEM</button>
|
|
621
|
+
</div>
|
|
622
|
+
|
|
623
|
+
<div id="hist-view" class="hist-modal">
|
|
624
|
+
<div class="hist-head">
|
|
625
|
+
<span style="font-weight:700; letter-spacing:1px;">SON İŞLEMLER</span>
|
|
626
|
+
<button id="btn-close-history" onclick="niki_closeHistory()"
|
|
627
|
+
style="background:none; border:none; color:#fff; font-size:20px; cursor:pointer;">
|
|
628
|
+
<i class="fa fa-times"></i>
|
|
629
|
+
</button>
|
|
630
|
+
</div>
|
|
631
|
+
<div class="hist-filters">
|
|
632
|
+
<input type="date" id="hist-f-start">
|
|
633
|
+
<input type="date" id="hist-f-end">
|
|
634
|
+
<input type="text" id="hist-f-search" placeholder="Ara...">
|
|
635
|
+
<button class="btn-filter" id="btn-apply-filter" onclick="niki_applyHistFilter()"><i
|
|
636
|
+
class="fa fa-search"></i></button>
|
|
637
|
+
<button class="btn-reset" id="btn-reset-filter" onclick="niki_resetHistFilter()"><i
|
|
638
|
+
class="fa fa-refresh"></i></button>
|
|
639
|
+
<button class="btn-csv" id="btn-export-csv" onclick="niki_exportHistCSV()"><i class="fa fa-download"></i>
|
|
640
|
+
CSV</button>
|
|
641
|
+
</div>
|
|
642
|
+
<ul id="hist-list" class="hist-body"></ul>
|
|
643
|
+
</div>
|
|
644
|
+
</div>
|
|
645
|
+
|
|
646
|
+
<script>
|
|
647
|
+
(function () {
|
|
648
|
+
'use strict';
|
|
649
|
+
|
|
650
|
+
// NOT: Sayfa ilk açıldığında zorla yenileme (reload) mantığı KALDIRILDI.
|
|
651
|
+
// Kullanıcı geri bildirimine göre bu durum butonların çalışmamasına yol açıyordu.
|
|
652
|
+
|
|
653
|
+
// niki-kasa'ya SPA geçişini engelleyip tam yükleme (hard redirect) yapma mantığını da
|
|
654
|
+
// kullanıcı "sonra hamburgerden basınca düzeliyor" dediği için şimdilik devre dışı bırakıyorum
|
|
655
|
+
// veya sadece bu blok kalsın ama otomatik window.reload() olmasın.
|
|
656
|
+
|
|
657
|
+
// Eğer SPA geçişlerinde sorun olursa burası tekrar açılabilir:
|
|
658
|
+
/*
|
|
659
|
+
$(window).on('action:ajaxify.start', function (e, data) {
|
|
660
|
+
if (data.url === 'niki-kasa') {
|
|
661
|
+
// Gerekirse buraya hard redirect eklenebilir
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
*/
|
|
665
|
+
|
|
666
|
+
var html5QrCode = null;
|
|
667
|
+
var isProcessing = false;
|
|
668
|
+
var sessionTimer = null;
|
|
669
|
+
var allHistoryData = [];
|
|
670
|
+
moment.locale('tr');
|
|
671
|
+
|
|
672
|
+
// ------------------------------------------------------------------
|
|
673
|
+
// GLOBAL FONKSİYONLAR (Inline OnClick için)
|
|
674
|
+
// ------------------------------------------------------------------
|
|
675
|
+
window.niki_initSession = initSession;
|
|
676
|
+
window.niki_stopSession = stopSession;
|
|
677
|
+
window.niki_resumeScan = resumeScan;
|
|
678
|
+
window.niki_openHistory = openHistory;
|
|
679
|
+
window.niki_closeHistory = closeHistory;
|
|
680
|
+
window.niki_applyHistFilter = applyHistFilter;
|
|
681
|
+
window.niki_resetHistFilter = resetHistFilter;
|
|
682
|
+
window.niki_exportHistCSV = exportHistCSV;
|
|
683
|
+
|
|
684
|
+
function lockBody() { document.body.classList.add('niki-pos-lock'); }
|
|
685
|
+
function unlockBody() { document.body.classList.remove('niki-pos-lock'); }
|
|
686
|
+
|
|
687
|
+
function escapeHtml(str) {
|
|
688
|
+
return String(str ?? '')
|
|
689
|
+
.replace(/&/g, '&')
|
|
690
|
+
.replace(/</g, '<')
|
|
691
|
+
.replace(/>/g, '>')
|
|
692
|
+
.replace(/"/g, '"')
|
|
693
|
+
.replace(/'/g, ''');
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
function rpJoin(path) {
|
|
697
|
+
const rp = (config && typeof config.relative_path === 'string') ? config.relative_path : '';
|
|
698
|
+
if (!rp || rp === '/') return path.startsWith('/') ? path : ('/' + path);
|
|
699
|
+
if (!path.startsWith('/')) path = '/' + path;
|
|
700
|
+
return rp + path;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function avatarColorFromUid(uid) {
|
|
704
|
+
const colors = [
|
|
705
|
+
'#f44336', '#e91e63', '#9c27b0', '#673ab7',
|
|
706
|
+
'#3f51b5', '#2196f3', '#03a9f4', '#00bcd4',
|
|
707
|
+
'#009688', '#4caf50', '#8bc34a', '#cddc39',
|
|
708
|
+
'#ffc107', '#ff9800', '#ff5722', '#795548'
|
|
709
|
+
];
|
|
710
|
+
const n = parseInt(uid, 10);
|
|
711
|
+
if (isNaN(n)) return '#9e9e9e';
|
|
712
|
+
return colors[n % colors.length];
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
function buildAvatar(item, sizePx) {
|
|
716
|
+
const size = sizePx || 46;
|
|
717
|
+
const name = (item.cust || '').trim();
|
|
718
|
+
const letter = name ? name.charAt(0).toUpperCase() : '?';
|
|
719
|
+
const uid = item.cuid || 0;
|
|
720
|
+
|
|
721
|
+
if (item.picture && typeof item.picture === 'string') {
|
|
722
|
+
return '<img src="' + item.picture + '" class="hist-u-img" style="width:' + size + 'px;height:' + size + 'px" onerror="this.onerror=null;this.remove()">';
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
return '<span title="' + escapeHtml(name) + '" data-uid="' + uid + '" class="avatar avatar-rounded" component="avatar/icon" style="--avatar-size:' + size + 'px; background-color:' + avatarColorFromUid(uid) + '; width:' + size + 'px; height:' + size + 'px; font-size:' + Math.floor(size * 0.5) + 'px; line-height:' + size + 'px;">' + escapeHtml(letter) + '</span>';
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// updateSidebarWidget hatasını önlemek için dummy tanımlama
|
|
729
|
+
if (typeof window.updateSidebarWidget !== 'function') {
|
|
730
|
+
window.updateSidebarWidget = function () { console.log('updateSidebarWidget henüz hazır değil.'); };
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
$(document).ready(function () {
|
|
734
|
+
if (typeof app !== 'undefined' && !app.user.isAdmin && !app.user.isGlobalMod) {
|
|
735
|
+
$('#niki-pos-root').html('<div style="text-align:center; padding:50px; color:#fff; background:#000; border-radius:18px;"><h3>⛔ Yetkisiz Giriş</h3></div>');
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
async function initSession() {
|
|
741
|
+
lockBody();
|
|
742
|
+
$('#start-view').fadeOut(200);
|
|
743
|
+
$('#camera-ui').fadeIn(300);
|
|
744
|
+
startTimer(600);
|
|
745
|
+
|
|
746
|
+
html5QrCode = new Html5Qrcode("reader");
|
|
747
|
+
|
|
748
|
+
try {
|
|
749
|
+
const devices = await Html5Qrcode.getCameras();
|
|
750
|
+
if (devices && devices.length) {
|
|
751
|
+
let cameraId = devices[devices.length - 1].id;
|
|
752
|
+
for (let i = 0; i < devices.length; i++) {
|
|
753
|
+
const label = (devices[i].label || '').toLowerCase();
|
|
754
|
+
if (label.includes("back") || label.includes("arka") || label.includes("environment")) {
|
|
755
|
+
cameraId = devices[i].id;
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
await html5QrCode.start(cameraId, { fps: 15, aspectRatio: window.innerWidth / window.innerHeight }, onScanSuccess);
|
|
760
|
+
} else {
|
|
761
|
+
alert("Kamera bulunamadı!");
|
|
762
|
+
stopSession();
|
|
763
|
+
}
|
|
764
|
+
} catch (err) {
|
|
765
|
+
alert("Kamera Başlatılamadı: " + err);
|
|
766
|
+
stopSession();
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
function startTimer(duration) {
|
|
771
|
+
let timeLeft = duration;
|
|
772
|
+
$('#timer-bar').css('width', '100%');
|
|
773
|
+
clearInterval(sessionTimer);
|
|
774
|
+
sessionTimer = setInterval(() => {
|
|
775
|
+
timeLeft--;
|
|
776
|
+
$('#timer-bar').css('width', (timeLeft / duration * 100) + '%');
|
|
777
|
+
if (timeLeft <= 0) { alert("Oturum doldu."); stopSession(); }
|
|
778
|
+
}, 1000);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function onScanSuccess(decodedText) {
|
|
782
|
+
if (isProcessing) return;
|
|
783
|
+
isProcessing = true;
|
|
784
|
+
|
|
785
|
+
const okAudio = new Audio('https://freesound.org/data/previews/171/171671_2437358-lq.mp3');
|
|
786
|
+
okAudio.play().catch(() => { });
|
|
787
|
+
if (navigator.vibrate) navigator.vibrate(200);
|
|
788
|
+
|
|
789
|
+
try { html5QrCode && html5QrCode.pause(); } catch (e) { }
|
|
790
|
+
|
|
791
|
+
$.post('/api/niki-loyalty/scan-qr', { token: decodedText, _csrf: config.csrf_token }, function (res) {
|
|
792
|
+
if (res && res.success) {
|
|
793
|
+
$('#res-icon').html('<i class="fa fa-check-circle" style="color:#2E7D32"></i>');
|
|
794
|
+
$('#res-title').text('ÖDEME ALINDI');
|
|
795
|
+
$('#res-reward-name').text(res.rewardName || 'ÖDÜL');
|
|
796
|
+
|
|
797
|
+
const pic = (res.customer && res.customer.picture) ? res.customer.picture : '';
|
|
798
|
+
const uname = (res.customer && res.customer.username) ? res.customer.username : 'Müşteri';
|
|
799
|
+
|
|
800
|
+
let msgHtml = '';
|
|
801
|
+
if (pic) {
|
|
802
|
+
msgHtml += '<img src="' + pic + '" style="width:60px; height:60px; border-radius:50%; border:2px solid #fff; margin-bottom:10px;"><br>';
|
|
803
|
+
}
|
|
804
|
+
msgHtml += '<b>' + escapeHtml(uname) + '</b><br>' + res.cost + ' Puan Düşüldü.';
|
|
805
|
+
$('#res-msg').html(msgHtml);
|
|
806
|
+
} else {
|
|
807
|
+
const badAudio = new Audio('https://freesound.org/data/previews/142/142608_1840739-lq.mp3');
|
|
808
|
+
badAudio.play().catch(() => { });
|
|
809
|
+
if (navigator.vibrate) navigator.vibrate([100, 50, 100]);
|
|
810
|
+
|
|
811
|
+
$('#res-icon').html('<i class="fa fa-times-circle" style="color:#C62828"></i>');
|
|
812
|
+
$('#res-reward-name').text("");
|
|
813
|
+
$('#res-title').text('HATA');
|
|
814
|
+
$('#res-msg').text((res && res.message) ? res.message : 'Bilinmeyen hata');
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
$('#res-view').addClass('active');
|
|
818
|
+
lockBody();
|
|
819
|
+
}).fail(function () {
|
|
820
|
+
alert("Sunucu Hatası!");
|
|
821
|
+
resumeScan();
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
function resumeScan() {
|
|
826
|
+
$('#res-view').removeClass('active');
|
|
827
|
+
setTimeout(() => {
|
|
828
|
+
isProcessing = false;
|
|
829
|
+
try { html5QrCode && html5QrCode.resume(); } catch (e) { }
|
|
830
|
+
}, 300);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
function stopSession() {
|
|
834
|
+
clearInterval(sessionTimer);
|
|
835
|
+
sessionTimer = null;
|
|
836
|
+
|
|
837
|
+
if (html5QrCode) {
|
|
838
|
+
try {
|
|
839
|
+
html5QrCode.stop()
|
|
840
|
+
.then(() => html5QrCode.clear())
|
|
841
|
+
.catch(() => { })
|
|
842
|
+
.finally(() => { html5QrCode = null; });
|
|
843
|
+
} catch (e) {
|
|
844
|
+
html5QrCode = null;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
$('#camera-ui').hide();
|
|
849
|
+
$('#start-view').fadeIn(200);
|
|
850
|
+
isProcessing = false;
|
|
851
|
+
$('#res-view').removeClass('active');
|
|
852
|
+
|
|
853
|
+
if (!$('#hist-view').is(':visible')) unlockBody();
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
function openHistory() {
|
|
857
|
+
lockBody();
|
|
858
|
+
$('#hist-view').fadeIn().css('display', 'flex');
|
|
859
|
+
|
|
860
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
861
|
+
const monthAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
862
|
+
$('#hist-f-end').val(today);
|
|
863
|
+
$('#hist-f-start').val(monthAgo);
|
|
864
|
+
|
|
865
|
+
$.get('/api/niki-loyalty/kasa-history', function (data) {
|
|
866
|
+
console.log('[NIKI POS] /api/niki-loyalty/kasa-history response:', data);
|
|
867
|
+
|
|
868
|
+
allHistoryData = Array.isArray(data) ? data : (data.data || []);
|
|
869
|
+
applyHistFilter();
|
|
870
|
+
}).fail(function () {
|
|
871
|
+
$('#hist-list').html('<li style="padding:40px; text-align:center; color:#999;">Geçmiş yüklenemedi.</li>');
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
function closeHistory() {
|
|
876
|
+
$('#hist-view').fadeOut();
|
|
877
|
+
if (!$('#camera-ui').is(':visible')) unlockBody();
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
function applyHistFilter() {
|
|
881
|
+
const startDate = $('#hist-f-start').val();
|
|
882
|
+
const endDate = $('#hist-f-end').val();
|
|
883
|
+
const search = $('#hist-f-search').val().toLowerCase().trim();
|
|
884
|
+
|
|
885
|
+
const filtered = allHistoryData.filter(item => {
|
|
886
|
+
const itemDate = new Date(item.ts).toISOString().slice(0, 10);
|
|
887
|
+
if (startDate && itemDate < startDate) return false;
|
|
888
|
+
if (endDate && itemDate > endDate) return false;
|
|
889
|
+
if (search && item.cust && item.cust.toLowerCase().indexOf(search) === -1) return false;
|
|
890
|
+
return true;
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
renderHistList(filtered);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
function resetHistFilter() {
|
|
897
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
898
|
+
const monthAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
899
|
+
$('#hist-f-end').val(today);
|
|
900
|
+
$('#hist-f-start').val(monthAgo);
|
|
901
|
+
$('#hist-f-search').val('');
|
|
902
|
+
applyHistFilter();
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
function exportHistCSV() {
|
|
906
|
+
const startDate = $('#hist-f-start').val();
|
|
907
|
+
const endDate = $('#hist-f-end').val();
|
|
908
|
+
const search = $('#hist-f-search').val().toLowerCase().trim();
|
|
909
|
+
|
|
910
|
+
const filtered = allHistoryData.filter(item => {
|
|
911
|
+
const itemDate = new Date(item.ts).toISOString().slice(0, 10);
|
|
912
|
+
if (startDate && itemDate < startDate) return false;
|
|
913
|
+
if (endDate && itemDate > endDate) return false;
|
|
914
|
+
if (search && item.cust && item.cust.toLowerCase().indexOf(search) === -1) return false;
|
|
915
|
+
return true;
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
if (!filtered.length) { alert('İndirilecek veri yok'); return; }
|
|
919
|
+
|
|
920
|
+
const rows = ['Tarih,Saat,Müşteri,Ödül,Puan'];
|
|
921
|
+
filtered.forEach(item => {
|
|
922
|
+
const m = moment(item.ts);
|
|
923
|
+
const dateStr = m.format('DD/MM/YYYY');
|
|
924
|
+
const timeStr = m.format('HH:mm');
|
|
925
|
+
const custStr = (item.cust || '').replace(/"/g, '""');
|
|
926
|
+
const rewardStr = (item.reward || '').replace(/"/g, '""');
|
|
927
|
+
rows.push('"' + dateStr + '","' + timeStr + '","' + custStr + '","' + rewardStr + '",' + (item.amt || 0));
|
|
928
|
+
});
|
|
929
|
+
|
|
930
|
+
const csv = '\uFEFF' + rows.join('\n');
|
|
931
|
+
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
|
932
|
+
const a = document.createElement('a');
|
|
933
|
+
a.href = URL.createObjectURL(blob);
|
|
934
|
+
a.download = 'niki-kasa-' + moment().format('YYYYMMDD') + '.csv';
|
|
935
|
+
a.click();
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function renderHistList(data) {
|
|
939
|
+
const list = $('#hist-list');
|
|
940
|
+
list.empty();
|
|
941
|
+
|
|
942
|
+
if (!data || data.length === 0) {
|
|
943
|
+
list.html('<li style="padding:40px; text-align:center; color:#999;">İşlem yok.</li>');
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
data.forEach(item => {
|
|
948
|
+
if (!item || typeof item !== 'object') return;
|
|
949
|
+
|
|
950
|
+
const cust = item.cust || 'Bilinmeyen';
|
|
951
|
+
const ts = item.ts ? moment(item.ts).fromNow() : '—';
|
|
952
|
+
const uid = item.cuid;
|
|
953
|
+
const reward = item.reward || 'İşlem';
|
|
954
|
+
|
|
955
|
+
const url = item.profileUrl || (uid ? rpJoin('/uid/' + uid) : '#');
|
|
956
|
+
const avatarHtml = buildAvatar(item, 46);
|
|
957
|
+
|
|
958
|
+
const amtVal = (typeof item.amt === 'number' || typeof item.amt === 'string') ? item.amt : 250;
|
|
959
|
+
|
|
960
|
+
const html =
|
|
961
|
+
'<li class="hist-row">' +
|
|
962
|
+
'<a href="' + url + '" class="hist-row-link" data-url="' + url + '">' +
|
|
963
|
+
avatarHtml +
|
|
964
|
+
'<div style="flex:1; min-width:0;">' +
|
|
965
|
+
'<span class="hist-u-name" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">' + escapeHtml(cust) + '</span>' +
|
|
966
|
+
'<span class="hist-reward-txt">' + escapeHtml(reward) + '</span>' +
|
|
967
|
+
'<span class="hist-time">' + escapeHtml(ts) + '</span>' +
|
|
968
|
+
'</div>' +
|
|
969
|
+
'<div class="hist-val">-' + escapeHtml(amtVal) + '</div>' +
|
|
970
|
+
'</a>' +
|
|
971
|
+
'</li>';
|
|
972
|
+
|
|
973
|
+
list.append(html);
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
if (list.children().length === 0) {
|
|
977
|
+
list.html('<li style="padding:40px; text-align:center; color:#999;">İşlem yok.</li>');
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
$(document).off('click.nikiHist', '#hist-list .hist-row-link');
|
|
982
|
+
$(document).on('click.nikiHist', '#hist-list .hist-row-link', function (e) {
|
|
983
|
+
e.preventDefault();
|
|
984
|
+
e.stopPropagation();
|
|
985
|
+
|
|
986
|
+
const url = $(this).data('url') || $(this).attr('href');
|
|
987
|
+
if (!url || url === '#') return;
|
|
988
|
+
|
|
989
|
+
try {
|
|
990
|
+
if (typeof ajaxify !== 'undefined' && ajaxify.go) {
|
|
991
|
+
ajaxify.go(url);
|
|
992
|
+
} else {
|
|
993
|
+
window.location.href = url;
|
|
994
|
+
}
|
|
995
|
+
} catch (err) {
|
|
996
|
+
window.location.href = url;
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
$(window).off('action:ajaxify.start.nikiKasa').on('action:ajaxify.start.nikiKasa', function () {
|
|
1001
|
+
stopSession();
|
|
1002
|
+
closeHistory();
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
})();
|
|
1006
|
+
</script>
|