nodebb-plugin-niki-loyalty 1.3.16 → 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/niki-admin.txt ADDED
@@ -0,0 +1,1309 @@
1
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script>
2
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/locale/tr.min.js"></script>
3
+
4
+ <div class="niki-dashboard">
5
+ <!-- Yükleniyor -->
6
+ <div id="niki-loader" class="niki-loader">
7
+ <div class="spinner"></div>
8
+ <div class="loading-text">Veriler Yükleniyor...</div>
9
+ </div>
10
+
11
+ <!-- Ana İçerik -->
12
+ <div id="niki-content" style="display:none;">
13
+
14
+ <!-- Header -->
15
+ <div class="nk-header">
16
+ <div class="nk-header-icon"><i class="fa fa-shield"></i></div>
17
+ <div class="nk-header-text">
18
+ <h1>Yönetici Paneli</h1>
19
+ <p>Niki Loyalty Puan & Kullanıcı Yönetimi</p>
20
+ </div>
21
+ <div class="nk-header-refresh">
22
+ <button id="btn-refresh" onclick="location.reload()" title="Yenile"><i
23
+ class="fa fa-refresh"></i></button>
24
+ </div>
25
+ </div>
26
+
27
+ <!-- İstatistik Kartları -->
28
+ <div class="nk-stats">
29
+ <div class="nk-card">
30
+ <div class="nk-card-val" id="val-users">0</div>
31
+ <div class="nk-card-lbl">KULLANICI SAYISI</div>
32
+ </div>
33
+ <div class="nk-card primary">
34
+ <div class="nk-card-val" id="val-points">0</div>
35
+ <div class="nk-card-lbl">DAĞITILAN PUAN</div>
36
+ </div>
37
+ <div class="nk-card">
38
+ <div class="nk-card-val" id="val-avg">0</div>
39
+ <div class="nk-card-lbl">ORTALAMA PUAN</div>
40
+ </div>
41
+ <div class="nk-card accent">
42
+ <div class="nk-card-val" id="val-redeemed">0</div>
43
+ <div class="nk-card-lbl">HARCANAN PUAN</div>
44
+ </div>
45
+ <div class="nk-card">
46
+ <div class="nk-card-val" id="val-transactions">0</div>
47
+ <div class="nk-card-lbl">TOPLAM İŞLEM</div>
48
+ </div>
49
+ <div class="nk-card highlight">
50
+ <div class="nk-card-val" id="val-today">0</div>
51
+ <div class="nk-card-lbl">BUGÜN İŞLEM</div>
52
+ </div>
53
+ </div>
54
+
55
+ <!-- Liste Bölümü -->
56
+ <div class="nk-list-container">
57
+ <div class="nk-toolbar">
58
+ <div class="nk-tb-title">Kullanıcı Sıralaması</div>
59
+ <div class="nk-search-wrapper">
60
+ <i class="fa fa-search"></i>
61
+ <input type="text" id="nk-search-input" placeholder="Kullanıcı ara...">
62
+ </div>
63
+ </div>
64
+
65
+ <div class="nk-table-header">
66
+ <div style="width: 50px; text-align: center;">#</div>
67
+ <div style="flex:1; padding-left: 15px;">KULLANICI</div>
68
+ <div style="width: 120px; text-align: right; padding-right:10px;">PUAN</div>
69
+ <div style="width: 100px; text-align: center;">İŞLEMLER</div>
70
+ </div>
71
+
72
+ <div id="nk-list-body" class="nk-list-body"></div>
73
+ </div>
74
+ </div>
75
+
76
+ <!-- PUAN YÖNETİM MODALI -->
77
+ <div id="modal-manage" class="nk-modal-overlay" style="display:none;">
78
+ <div class="nk-modal">
79
+ <div class="nk-modal-head">
80
+ <h3>Puan Yönetimi</h3>
81
+ <button class="nk-close" onclick="closeManageModal()"><i class="fa fa-times"></i></button>
82
+ </div>
83
+ <div class="nk-modal-body">
84
+ <div class="nk-user-preview">
85
+ <span id="manage-uname" style="font-weight:700; color:#C5A065;">Kullanıcı</span> düzenleniyor
86
+ </div>
87
+
88
+ <label class="nk-label">İşlem Türü</label>
89
+ <div class="nk-switch-group">
90
+ <label class="nk-radio-box">
91
+ <input type="radio" name="manage_action" value="add" checked>
92
+ <span class="nk-radio-tile"><i class="fa fa-plus-circle"></i> EKLE</span>
93
+ </label>
94
+ <label class="nk-radio-box">
95
+ <input type="radio" name="manage_action" value="remove">
96
+ <span class="nk-radio-tile remove"><i class="fa fa-minus-circle"></i> ÇIKAR</span>
97
+ </label>
98
+ </div>
99
+
100
+ <label class="nk-label">Miktar</label>
101
+ <input type="number" id="manage-amount" class="nk-input" placeholder="0">
102
+
103
+ <label class="nk-label">Sebep (Loglama İçin)</label>
104
+ <input type="text" id="manage-reason" class="nk-input"
105
+ placeholder="Örn: Manuel Telafi, Yarışma Ödülü...">
106
+
107
+ <div id="manage-error" style="color:#e53935; font-size:13px; margin-top:10px; display:none;"></div>
108
+
109
+ <button class="nk-btn-save" onclick="submitManagePoints()">KAYDET VE UYGULA</button>
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ <!-- KULLANICI DETAY MODALI -->
115
+ <div id="modal-detail" class="nk-modal-overlay" style="display:none;">
116
+ <div class="nk-modal nk-modal-large">
117
+ <div class="nk-modal-head">
118
+ <h3><i class="fa fa-user-circle"></i> Kullanıcı Detayı</h3>
119
+ <button class="nk-close" onclick="closeDetailModal()"><i class="fa fa-times"></i></button>
120
+ </div>
121
+ <div class="nk-modal-body" id="detail-body">
122
+ <div class="niki-loader" style="padding:40px;">
123
+ <div class="spinner"></div>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </div>
129
+
130
+ <style>
131
+ /* --- DARK PREMIUM THEME (POS STİLİ) --- */
132
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');
133
+
134
+ /* Scope */
135
+ .niki-dashboard {
136
+ font-family: 'Poppins', sans-serif;
137
+ color: #fff;
138
+ background: #111;
139
+ min-height: 600px;
140
+ padding: 30px;
141
+ border-radius: 20px;
142
+ box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
143
+ max-width: 1200px;
144
+ margin: 20px auto;
145
+ position: relative;
146
+ }
147
+
148
+ .niki-dashboard * {
149
+ box-sizing: border-box;
150
+ }
151
+
152
+ /* Loader */
153
+ .niki-loader {
154
+ text-align: center;
155
+ padding: 100px 0;
156
+ }
157
+
158
+ .niki-loader .spinner {
159
+ width: 50px;
160
+ height: 50px;
161
+ border: 4px solid #333;
162
+ border-top: 4px solid #C5A065;
163
+ border-radius: 50%;
164
+ margin: 0 auto 20px;
165
+ animation: spin 1s linear infinite;
166
+ }
167
+
168
+ @keyframes spin {
169
+ 0% {
170
+ transform: rotate(0deg);
171
+ }
172
+
173
+ 100% {
174
+ transform: rotate(360deg);
175
+ }
176
+ }
177
+
178
+ .loading-text {
179
+ color: #888;
180
+ font-size: 14px;
181
+ letter-spacing: 1px;
182
+ }
183
+
184
+ /* Header */
185
+ .nk-header {
186
+ display: flex;
187
+ align-items: center;
188
+ margin-bottom: 35px;
189
+ padding-bottom: 25px;
190
+ border-bottom: 1px solid #222;
191
+ }
192
+
193
+ .nk-header-icon {
194
+ width: 60px;
195
+ height: 60px;
196
+ background: linear-gradient(135deg, #C5A065, #8D6E63);
197
+ color: #000;
198
+ border-radius: 16px;
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: center;
202
+ font-size: 28px;
203
+ box-shadow: 0 5px 20px rgba(197, 160, 101, 0.3);
204
+ margin-right: 20px;
205
+ }
206
+
207
+ .nk-header-text h1 {
208
+ margin: 0;
209
+ font-size: 24px;
210
+ font-weight: 700;
211
+ color: #fff;
212
+ }
213
+
214
+ .nk-header-text p {
215
+ margin: 5px 0 0;
216
+ font-size: 13px;
217
+ color: #888;
218
+ }
219
+
220
+ .nk-header-refresh {
221
+ margin-left: auto;
222
+ }
223
+
224
+ #btn-refresh {
225
+ background: #222;
226
+ border: 1px solid #333;
227
+ color: #fff;
228
+ width: 40px;
229
+ height: 40px;
230
+ border-radius: 10px;
231
+ cursor: pointer;
232
+ transition: 0.2s;
233
+ }
234
+
235
+ #btn-refresh:hover {
236
+ background: #333;
237
+ color: #C5A065;
238
+ }
239
+
240
+ /* İstatistikler */
241
+ .nk-stats {
242
+ display: grid;
243
+ grid-template-columns: repeat(6, 1fr);
244
+ gap: 15px;
245
+ margin-bottom: 35px;
246
+ }
247
+
248
+ .nk-card {
249
+ background: #1a1a1a;
250
+ border: 1px solid #2a2a2a;
251
+ padding: 20px 15px;
252
+ border-radius: 16px;
253
+ text-align: center;
254
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
255
+ transition: transform 0.2s, border-color 0.2s;
256
+ }
257
+
258
+ .nk-card:hover {
259
+ transform: translateY(-3px);
260
+ border-color: #333;
261
+ }
262
+
263
+ .nk-card.primary {
264
+ background: linear-gradient(135deg, #2a2a2a, #1f1f1f);
265
+ border-color: #C5A065;
266
+ }
267
+
268
+ .nk-card.accent {
269
+ background: linear-gradient(135deg, rgba(198, 40, 40, 0.15), #1a1a1a);
270
+ border-color: rgba(198, 40, 40, 0.4);
271
+ }
272
+
273
+ .nk-card.highlight {
274
+ background: linear-gradient(135deg, rgba(46, 125, 50, 0.15), #1a1a1a);
275
+ border-color: rgba(46, 125, 50, 0.4);
276
+ }
277
+
278
+ .nk-card-val {
279
+ font-size: 26px;
280
+ font-weight: 700;
281
+ color: #fff;
282
+ margin-bottom: 5px;
283
+ }
284
+
285
+ .nk-card.primary .nk-card-val {
286
+ color: #C5A065;
287
+ }
288
+
289
+ .nk-card.accent .nk-card-val {
290
+ color: #ef5350;
291
+ }
292
+
293
+ .nk-card.highlight .nk-card-val {
294
+ color: #66bb6a;
295
+ }
296
+
297
+ .nk-card-lbl {
298
+ font-size: 10px;
299
+ font-weight: 600;
300
+ color: #666;
301
+ letter-spacing: 0.8px;
302
+ text-transform: uppercase;
303
+ }
304
+
305
+ /* Liste Alanı */
306
+ .nk-list-container {
307
+ background: #1a1a1a;
308
+ border-radius: 20px;
309
+ overflow: hidden;
310
+ border: 1px solid #2a2a2a;
311
+ }
312
+
313
+ .nk-toolbar {
314
+ padding: 20px;
315
+ border-bottom: 1px solid #2a2a2a;
316
+ display: flex;
317
+ justify-content: space-between;
318
+ align-items: center;
319
+ }
320
+
321
+ .nk-tb-title {
322
+ font-size: 16px;
323
+ font-weight: 600;
324
+ color: #eee;
325
+ }
326
+
327
+ .nk-search-wrapper {
328
+ position: relative;
329
+ }
330
+
331
+ .nk-search-wrapper i {
332
+ position: absolute;
333
+ left: 12px;
334
+ top: 50%;
335
+ transform: translateY(-50%);
336
+ color: #666;
337
+ font-size: 14px;
338
+ }
339
+
340
+ #nk-search-input {
341
+ background: #111;
342
+ border: 1px solid #333;
343
+ color: #fff;
344
+ padding: 10px 15px 10px 35px;
345
+ border-radius: 10px;
346
+ font-size: 13px;
347
+ width: 240px;
348
+ outline: none;
349
+ transition: 0.2s;
350
+ }
351
+
352
+ #nk-search-input:focus {
353
+ border-color: #C5A065;
354
+ }
355
+
356
+ /* Tablo Başlık */
357
+ .nk-table-header {
358
+ display: flex;
359
+ padding: 15px 20px;
360
+ background: #151515;
361
+ font-size: 12px;
362
+ font-weight: 700;
363
+ color: #555;
364
+ text-transform: uppercase;
365
+ letter-spacing: 0.5px;
366
+ }
367
+
368
+ /* Liste Gövde */
369
+ .nk-list-body {
370
+ max-height: 500px;
371
+ overflow-y: auto;
372
+ padding-bottom: 10px;
373
+ }
374
+
375
+ /* Liste Satırı */
376
+ .nk-row {
377
+ display: flex;
378
+ align-items: center;
379
+ padding: 15px 20px;
380
+ border-bottom: 1px solid #222;
381
+ transition: 0.2s;
382
+ }
383
+
384
+ .nk-row:hover {
385
+ background: #222;
386
+ }
387
+
388
+ .nk-idx {
389
+ width: 50px;
390
+ text-align: center;
391
+ color: #444;
392
+ font-weight: 700;
393
+ font-size: 14px;
394
+ }
395
+
396
+ .nk-user-info {
397
+ flex: 1;
398
+ display: flex;
399
+ align-items: center;
400
+ padding-left: 15px;
401
+ }
402
+
403
+ .nk-avatar {
404
+ width: 40px;
405
+ height: 40px;
406
+ border-radius: 50%;
407
+ object-fit: cover;
408
+ margin-right: 15px;
409
+ border: 2px solid #333;
410
+ }
411
+
412
+ .nk-letter-avatar {
413
+ width: 40px;
414
+ height: 40px;
415
+ border-radius: 50%;
416
+ display: flex;
417
+ align-items: center;
418
+ justify-content: center;
419
+ font-weight: 700;
420
+ color: #fff;
421
+ margin-right: 15px;
422
+ font-size: 16px;
423
+ border: 2px solid #333;
424
+ }
425
+
426
+ .nk-username {
427
+ font-weight: 600;
428
+ color: #ddd;
429
+ font-size: 14px;
430
+ text-decoration: none;
431
+ }
432
+
433
+ .nk-username:hover {
434
+ text-decoration: underline;
435
+ color: #C5A065;
436
+ }
437
+
438
+ .nk-points {
439
+ width: 120px;
440
+ text-align: right;
441
+ padding-right: 10px;
442
+ font-size: 16px;
443
+ font-weight: 700;
444
+ color: #C5A065;
445
+ }
446
+
447
+ .nk-actions {
448
+ width: 100px;
449
+ text-align: center;
450
+ display: flex;
451
+ justify-content: center;
452
+ gap: 6px;
453
+ }
454
+
455
+ .nk-btn-action {
456
+ background: #2a2a2a;
457
+ border: 1px solid #333;
458
+ color: #888;
459
+ width: 32px;
460
+ height: 32px;
461
+ border-radius: 8px;
462
+ cursor: pointer;
463
+ transition: 0.2s;
464
+ }
465
+
466
+ .nk-btn-action:hover {
467
+ background: #C5A065;
468
+ color: #000;
469
+ border-color: #C5A065;
470
+ }
471
+
472
+ .nk-btn-action.info:hover {
473
+ background: #1976D2;
474
+ border-color: #1976D2;
475
+ color: #fff;
476
+ }
477
+
478
+ /* Scrollbar */
479
+ .nk-list-body::-webkit-scrollbar {
480
+ width: 6px;
481
+ }
482
+
483
+ .nk-list-body::-webkit-scrollbar-track {
484
+ background: #111;
485
+ }
486
+
487
+ .nk-list-body::-webkit-scrollbar-thumb {
488
+ background: #333;
489
+ border-radius: 3px;
490
+ }
491
+
492
+ .nk-list-body::-webkit-scrollbar-thumb:hover {
493
+ background: #555;
494
+ }
495
+
496
+ /* MODAL */
497
+ .nk-modal-overlay {
498
+ position: fixed;
499
+ top: 0;
500
+ left: 0;
501
+ width: 100%;
502
+ height: 100%;
503
+ background: rgba(0, 0, 0, 0.85);
504
+ backdrop-filter: blur(8px);
505
+ z-index: 9999;
506
+ display: flex;
507
+ align-items: center;
508
+ justify-content: center;
509
+ padding: 20px;
510
+ }
511
+
512
+ .nk-modal {
513
+ background: #1a1a1a;
514
+ width: 380px;
515
+ max-width: 100%;
516
+ border-radius: 20px;
517
+ border: 1px solid #333;
518
+ box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
519
+ overflow: hidden;
520
+ max-height: 90vh;
521
+ display: flex;
522
+ flex-direction: column;
523
+ }
524
+
525
+ .nk-modal-large {
526
+ width: 700px;
527
+ }
528
+
529
+ .nk-modal-head {
530
+ background: #222;
531
+ padding: 16px 20px;
532
+ border-bottom: 1px solid #333;
533
+ display: flex;
534
+ justify-content: space-between;
535
+ align-items: center;
536
+ flex-shrink: 0;
537
+ }
538
+
539
+ .nk-modal-head h3 {
540
+ margin: 0;
541
+ font-size: 16px;
542
+ color: #fff;
543
+ display: flex;
544
+ align-items: center;
545
+ gap: 10px;
546
+ }
547
+
548
+ .nk-close {
549
+ background: none;
550
+ border: none;
551
+ color: #666;
552
+ font-size: 18px;
553
+ cursor: pointer;
554
+ padding: 5px;
555
+ }
556
+
557
+ .nk-close:hover {
558
+ color: #fff;
559
+ }
560
+
561
+ .nk-modal-body {
562
+ padding: 25px;
563
+ overflow-y: auto;
564
+ flex: 1;
565
+ }
566
+
567
+ .nk-user-preview {
568
+ background: #222;
569
+ padding: 12px 16px;
570
+ border-radius: 10px;
571
+ margin-bottom: 20px;
572
+ font-size: 14px;
573
+ color: #888;
574
+ }
575
+
576
+ .nk-label {
577
+ display: block;
578
+ font-size: 11px;
579
+ color: #888;
580
+ text-transform: uppercase;
581
+ margin-bottom: 8px;
582
+ font-weight: 600;
583
+ letter-spacing: 0.5px;
584
+ }
585
+
586
+ .nk-input {
587
+ width: 100%;
588
+ background: #111;
589
+ border: 1px solid #333;
590
+ padding: 12px;
591
+ border-radius: 10px;
592
+ color: #fff;
593
+ margin-bottom: 20px;
594
+ font-size: 14px;
595
+ }
596
+
597
+ .nk-input:focus {
598
+ outline: none;
599
+ border-color: #C5A065;
600
+ }
601
+
602
+ .nk-switch-group {
603
+ display: flex;
604
+ gap: 10px;
605
+ margin-bottom: 20px;
606
+ }
607
+
608
+ .nk-radio-box {
609
+ flex: 1;
610
+ cursor: pointer;
611
+ }
612
+
613
+ .nk-radio-box input {
614
+ display: none;
615
+ }
616
+
617
+ .nk-radio-tile {
618
+ display: flex;
619
+ flex-direction: column;
620
+ align-items: center;
621
+ justify-content: center;
622
+ gap: 5px;
623
+ height: 60px;
624
+ background: #222;
625
+ border: 2px solid #333;
626
+ border-radius: 10px;
627
+ color: #666;
628
+ font-size: 11px;
629
+ font-weight: 700;
630
+ }
631
+
632
+ .nk-radio-box input:checked+.nk-radio-tile {
633
+ background: rgba(46, 125, 50, 0.2);
634
+ border-color: #2E7D32;
635
+ color: #2E7D32;
636
+ }
637
+
638
+ .nk-radio-box input:checked+.nk-radio-tile.remove {
639
+ background: rgba(198, 40, 40, 0.2);
640
+ border-color: #C62828;
641
+ color: #C62828;
642
+ }
643
+
644
+ .nk-btn-save {
645
+ width: 100%;
646
+ background: #C5A065;
647
+ color: #000;
648
+ border: none;
649
+ padding: 15px;
650
+ border-radius: 12px;
651
+ font-weight: 700;
652
+ font-size: 14px;
653
+ cursor: pointer;
654
+ transition: 0.2s;
655
+ }
656
+
657
+ .nk-btn-save:hover {
658
+ background: #d4ac6e;
659
+ transform: translateY(-2px);
660
+ }
661
+
662
+ /* DETAY MODAL İÇERİĞİ */
663
+ .detail-header {
664
+ display: flex;
665
+ align-items: center;
666
+ gap: 20px;
667
+ margin-bottom: 25px;
668
+ padding-bottom: 20px;
669
+ border-bottom: 1px solid #2a2a2a;
670
+ }
671
+
672
+ .detail-avatar {
673
+ width: 70px;
674
+ height: 70px;
675
+ border-radius: 50%;
676
+ border: 3px solid #C5A065;
677
+ object-fit: cover;
678
+ }
679
+
680
+ .detail-letter-avatar {
681
+ width: 70px;
682
+ height: 70px;
683
+ border-radius: 50%;
684
+ display: flex;
685
+ align-items: center;
686
+ justify-content: center;
687
+ font-size: 28px;
688
+ font-weight: 700;
689
+ color: #fff;
690
+ border: 3px solid #C5A065;
691
+ }
692
+
693
+ .detail-info h2 {
694
+ margin: 0 0 5px;
695
+ font-size: 20px;
696
+ color: #fff;
697
+ }
698
+
699
+ .detail-info p {
700
+ margin: 0;
701
+ font-size: 13px;
702
+ color: #888;
703
+ }
704
+
705
+ .detail-points-badge {
706
+ margin-left: auto;
707
+ background: linear-gradient(135deg, #C5A065, #8D6E63);
708
+ padding: 15px 25px;
709
+ border-radius: 14px;
710
+ text-align: center;
711
+ }
712
+
713
+ .detail-points-val {
714
+ font-size: 28px;
715
+ font-weight: 700;
716
+ color: #000;
717
+ }
718
+
719
+ .detail-points-lbl {
720
+ font-size: 10px;
721
+ color: rgba(0, 0, 0, 0.6);
722
+ text-transform: uppercase;
723
+ letter-spacing: 0.5px;
724
+ }
725
+
726
+ .detail-stats {
727
+ display: grid;
728
+ grid-template-columns: repeat(4, 1fr);
729
+ gap: 12px;
730
+ margin-bottom: 25px;
731
+ }
732
+
733
+ .detail-stat {
734
+ background: #222;
735
+ border-radius: 12px;
736
+ padding: 15px;
737
+ text-align: center;
738
+ border: 1px solid #2a2a2a;
739
+ }
740
+
741
+ .detail-stat-val {
742
+ font-size: 20px;
743
+ font-weight: 700;
744
+ color: #fff;
745
+ }
746
+
747
+ .detail-stat-val.green {
748
+ color: #66bb6a;
749
+ }
750
+
751
+ .detail-stat-val.red {
752
+ color: #ef5350;
753
+ }
754
+
755
+ .detail-stat-lbl {
756
+ font-size: 10px;
757
+ color: #666;
758
+ text-transform: uppercase;
759
+ margin-top: 4px;
760
+ }
761
+
762
+ .detail-section {
763
+ margin-bottom: 25px;
764
+ }
765
+
766
+ .detail-section-title {
767
+ font-size: 13px;
768
+ font-weight: 700;
769
+ color: #888;
770
+ text-transform: uppercase;
771
+ letter-spacing: 0.5px;
772
+ margin-bottom: 12px;
773
+ display: flex;
774
+ align-items: center;
775
+ gap: 8px;
776
+ }
777
+
778
+ .detail-section-title i {
779
+ color: #C5A065;
780
+ }
781
+
782
+ .detail-tabs {
783
+ display: flex;
784
+ gap: 8px;
785
+ margin-bottom: 15px;
786
+ }
787
+
788
+ .detail-tab {
789
+ background: #222;
790
+ border: 1px solid #333;
791
+ padding: 10px 16px;
792
+ border-radius: 10px;
793
+ font-size: 12px;
794
+ font-weight: 600;
795
+ color: #888;
796
+ cursor: pointer;
797
+ transition: 0.2s;
798
+ }
799
+
800
+ .detail-tab:hover {
801
+ border-color: #444;
802
+ color: #fff;
803
+ }
804
+
805
+ .detail-tab.active {
806
+ background: #C5A065;
807
+ border-color: #C5A065;
808
+ color: #000;
809
+ }
810
+
811
+ .detail-history {
812
+ max-height: 250px;
813
+ overflow-y: auto;
814
+ background: #151515;
815
+ border-radius: 12px;
816
+ border: 1px solid #2a2a2a;
817
+ }
818
+
819
+ .detail-history-item {
820
+ display: flex;
821
+ align-items: center;
822
+ padding: 12px 15px;
823
+ border-bottom: 1px solid #222;
824
+ }
825
+
826
+ .detail-history-item:last-child {
827
+ border-bottom: none;
828
+ }
829
+
830
+ .detail-history-icon {
831
+ width: 32px;
832
+ height: 32px;
833
+ border-radius: 8px;
834
+ display: flex;
835
+ align-items: center;
836
+ justify-content: center;
837
+ margin-right: 12px;
838
+ font-size: 14px;
839
+ }
840
+
841
+ .detail-history-icon.earn {
842
+ background: rgba(46, 125, 50, 0.2);
843
+ color: #66bb6a;
844
+ }
845
+
846
+ .detail-history-icon.spend {
847
+ background: rgba(198, 40, 40, 0.2);
848
+ color: #ef5350;
849
+ }
850
+
851
+ .detail-history-text {
852
+ flex: 1;
853
+ }
854
+
855
+ .detail-history-desc {
856
+ font-size: 13px;
857
+ color: #ddd;
858
+ }
859
+
860
+ .detail-history-time {
861
+ font-size: 11px;
862
+ color: #666;
863
+ margin-top: 2px;
864
+ }
865
+
866
+ .detail-history-val {
867
+ font-weight: 700;
868
+ font-size: 14px;
869
+ }
870
+
871
+ .detail-history-val.earn {
872
+ color: #66bb6a;
873
+ }
874
+
875
+ .detail-history-val.spend {
876
+ color: #ef5350;
877
+ }
878
+
879
+ .detail-empty {
880
+ text-align: center;
881
+ padding: 30px;
882
+ color: #555;
883
+ font-size: 13px;
884
+ }
885
+
886
+ .detail-empty i {
887
+ font-size: 32px;
888
+ display: block;
889
+ margin-bottom: 10px;
890
+ opacity: 0.5;
891
+ }
892
+
893
+ /* Günlük Limit Çubuğu */
894
+ .daily-progress {
895
+ margin-top: 10px;
896
+ }
897
+
898
+ .daily-progress-bar {
899
+ height: 8px;
900
+ background: #333;
901
+ border-radius: 4px;
902
+ overflow: hidden;
903
+ }
904
+
905
+ .daily-progress-fill {
906
+ height: 100%;
907
+ background: linear-gradient(90deg, #C5A065, #8D6E63);
908
+ border-radius: 4px;
909
+ transition: width 0.3s;
910
+ }
911
+
912
+ .daily-progress-label {
913
+ display: flex;
914
+ justify-content: space-between;
915
+ font-size: 11px;
916
+ color: #666;
917
+ margin-top: 5px;
918
+ }
919
+
920
+ @media(max-width: 900px) {
921
+ .nk-stats {
922
+ grid-template-columns: repeat(3, 1fr);
923
+ }
924
+
925
+ .detail-stats {
926
+ grid-template-columns: repeat(2, 1fr);
927
+ }
928
+ }
929
+
930
+ @media(max-width: 600px) {
931
+ .niki-dashboard {
932
+ padding: 15px;
933
+ }
934
+
935
+ .nk-stats {
936
+ grid-template-columns: repeat(2, 1fr);
937
+ }
938
+
939
+ .nk-toolbar {
940
+ flex-direction: column;
941
+ gap: 15px;
942
+ align-items: stretch;
943
+ }
944
+
945
+ #nk-search-input {
946
+ width: 100%;
947
+ }
948
+
949
+ .nk-modal-large {
950
+ width: 100%;
951
+ }
952
+
953
+ .detail-header {
954
+ flex-direction: column;
955
+ text-align: center;
956
+ }
957
+
958
+ .detail-points-badge {
959
+ margin-left: 0;
960
+ margin-top: 15px;
961
+ }
962
+
963
+ .detail-stats {
964
+ grid-template-columns: repeat(2, 1fr);
965
+ }
966
+ }
967
+ </style>
968
+
969
+ <script>
970
+ (function () {
971
+ let g_users = [];
972
+ let g_targetUid = 0;
973
+ moment.locale('tr');
974
+
975
+ // JSON parse helper - string ise parse et, değilse aynen döndür
976
+ function safeParseMaybeJson(item) {
977
+ if (!item) return null;
978
+ if (typeof item === 'object') return item;
979
+ try {
980
+ return JSON.parse(item);
981
+ } catch (e) {
982
+ return null;
983
+ }
984
+ }
985
+
986
+ // Global functions
987
+ window.closeManageModal = function () { $('#modal-manage').fadeOut(200); };
988
+ window.closeDetailModal = function () { $('#modal-detail').fadeOut(200); };
989
+
990
+ window.openManageModal = function (uid, uname) {
991
+ g_targetUid = uid;
992
+ $('#manage-uname').text(uname);
993
+ $('#manage-amount').val('');
994
+ $('#manage-reason').val('');
995
+ $('#manage-error').hide();
996
+ $('#modal-manage').fadeIn(200).css('display', 'flex');
997
+ };
998
+
999
+ window.openDetailModal = function (uid) {
1000
+ $('#modal-detail').fadeIn(200).css('display', 'flex');
1001
+ $('#detail-body').html('<div class="niki-loader" style="padding:40px;"><div class="spinner"></div></div>');
1002
+
1003
+ socket.emit('plugins.niki.getUserDetail', { uid: uid }, function (err, data) {
1004
+ console.log('[Niki-Admin] getUserDetail response:', err, data);
1005
+ if (err) {
1006
+ $('#detail-body').html('<div class="detail-empty"><i class="fa fa-exclamation-circle"></i>Hata: ' + (err.message || 'Bilinmeyen hata') + '</div>');
1007
+ return;
1008
+ }
1009
+ // Data string olarak gelebilir, parse et
1010
+ var parsedData = safeParseMaybeJson(data);
1011
+ if (!parsedData) {
1012
+ $('#detail-body').html('<div class="detail-empty"><i class="fa fa-exclamation-circle"></i>Veri parse edilemedi</div>');
1013
+ return;
1014
+ }
1015
+ renderDetailModal(parsedData);
1016
+ });
1017
+ };
1018
+
1019
+ function renderDetailModal(data) {
1020
+ console.log('[Niki-Admin] renderDetailModal data:', data);
1021
+
1022
+ // user ve stats da string olarak gelebilir
1023
+ var u = safeParseMaybeJson(data.user) || data.user || {};
1024
+ var stats = safeParseMaybeJson(data.stats) || data.stats || {};
1025
+ var rp = (typeof config !== 'undefined' && config.relative_path) ? config.relative_path : '';
1026
+
1027
+ console.log('[Niki-Admin] Parsed user:', u);
1028
+ console.log('[Niki-Admin] Parsed stats:', stats);
1029
+
1030
+ let avatarHtml = '';
1031
+ if (u.picture) {
1032
+ avatarHtml = '<img src="' + u.picture + '" class="detail-avatar">';
1033
+ } else {
1034
+ const letter = u.username ? u.username[0].toUpperCase() : '?';
1035
+ avatarHtml = '<div class="detail-letter-avatar" style="background:' + (u.iconBg || '#555') + '">' + letter + '</div>';
1036
+ }
1037
+
1038
+ const dailyCap = stats.dailyCap || 35;
1039
+ const dailyPercent = Math.min(100, ((stats.todayScore || 0) / dailyCap) * 100);
1040
+
1041
+ var kasaLength = (data.kasaHistory && Array.isArray(data.kasaHistory)) ? data.kasaHistory.length : 0;
1042
+ var todayScoreVal = stats.todayScore || 0;
1043
+ var totalEarnedVal = Math.floor(stats.totalEarned || 0).toLocaleString('tr-TR');
1044
+ var totalSpentVal = Math.floor(stats.totalSpent || 0).toLocaleString('tr-TR');
1045
+ var pointsVal = Math.floor(u.points || 0).toLocaleString('tr-TR');
1046
+ var usernameVal = escapeHtml(u.username || 'Bilinmeyen');
1047
+ var emailVal = escapeHtml(u.email) || 'E-posta yok';
1048
+ var lastOnlineVal = u.lastonline ? moment(u.lastonline).fromNow() : 'Bilinmiyor';
1049
+ var dailyPercentFixed = dailyPercent.toFixed(0);
1050
+
1051
+ var html = '<div class="detail-header">' +
1052
+ avatarHtml +
1053
+ '<div class="detail-info">' +
1054
+ '<h2>' + usernameVal + '</h2>' +
1055
+ '<p><i class="fa fa-envelope"></i> ' + emailVal + '</p>' +
1056
+ '<p><i class="fa fa-clock-o"></i> Son görülme: ' + lastOnlineVal + '</p>' +
1057
+ '</div>' +
1058
+ '<div class="detail-points-badge">' +
1059
+ '<div class="detail-points-val">' + pointsVal + '</div>' +
1060
+ '<div class="detail-points-lbl">Mevcut Puan</div>' +
1061
+ '</div>' +
1062
+ '</div>' +
1063
+
1064
+ '<div class="detail-stats">' +
1065
+ '<div class="detail-stat">' +
1066
+ '<div class="detail-stat-val green">+' + totalEarnedVal + '</div>' +
1067
+ '<div class="detail-stat-lbl">Kazanılan</div>' +
1068
+ '</div>' +
1069
+ '<div class="detail-stat">' +
1070
+ '<div class="detail-stat-val red">-' + totalSpentVal + '</div>' +
1071
+ '<div class="detail-stat-lbl">Harcanan</div>' +
1072
+ '</div>' +
1073
+ '<div class="detail-stat">' +
1074
+ '<div class="detail-stat-val">' + todayScoreVal + '</div>' +
1075
+ '<div class="detail-stat-lbl">Bugün</div>' +
1076
+ '</div>' +
1077
+ '<div class="detail-stat">' +
1078
+ '<div class="detail-stat-val">' + kasaLength + '</div>' +
1079
+ '<div class="detail-stat-lbl">Ödül Kullanımı</div>' +
1080
+ '</div>' +
1081
+ '</div>' +
1082
+
1083
+ '<div class="detail-section">' +
1084
+ '<div class="detail-section-title"><i class="fa fa-line-chart"></i> Günlük İlerleme</div>' +
1085
+ '<div class="daily-progress">' +
1086
+ '<div class="daily-progress-bar">' +
1087
+ '<div class="daily-progress-fill" style="width: ' + dailyPercent + '%"></div>' +
1088
+ '</div>' +
1089
+ '<div class="daily-progress-label">' +
1090
+ '<span>' + todayScoreVal + ' / ' + dailyCap + ' puan</span>' +
1091
+ '<span>' + dailyPercentFixed + '%</span>' +
1092
+ '</div>' +
1093
+ '</div>' +
1094
+ '</div>' +
1095
+
1096
+ '<div class="detail-section">' +
1097
+ '<div class="detail-section-title"><i class="fa fa-history"></i> Aktivite Geçmişi</div>' +
1098
+ '<div class="detail-tabs">' +
1099
+ '<div class="detail-tab active" onclick="switchHistoryTab(\'earn\', this)">Kazanılan</div>' +
1100
+ '<div class="detail-tab" onclick="switchHistoryTab(\'spend\', this)">Harcanan</div>' +
1101
+ '<div class="detail-tab" onclick="switchHistoryTab(\'kasa\', this)">Ödül Kullanımı</div>' +
1102
+ '</div>' +
1103
+ '<div class="detail-history" id="history-container"></div>' +
1104
+ '</div>';
1105
+
1106
+ $('#detail-body').html(html);
1107
+
1108
+ // İlk sekmeyi göster
1109
+ window.currentDetailData = data;
1110
+ switchHistoryTab('earn');
1111
+ }
1112
+
1113
+ window.switchHistoryTab = function (type, el) {
1114
+ $('.detail-tab').removeClass('active');
1115
+ if (el) $(el).addClass('active');
1116
+ else $('.detail-tab').first().addClass('active');
1117
+
1118
+ const data = window.currentDetailData;
1119
+ if (!data) return;
1120
+
1121
+ const container = $('#history-container');
1122
+ let items = [];
1123
+
1124
+ if (type === 'earn') {
1125
+ items = (data.earnHistory || []).map(safeParseMaybeJson).filter(Boolean);
1126
+ } else if (type === 'spend') {
1127
+ items = (data.spendHistory || []).map(safeParseMaybeJson).filter(Boolean);
1128
+ } else if (type === 'kasa') {
1129
+ items = (data.kasaHistory || []).map(safeParseMaybeJson).filter(Boolean).map(function (k) {
1130
+ return {
1131
+ type: 'spend',
1132
+ ts: k.ts,
1133
+ amt: k.amt,
1134
+ txt: k.reward || 'Ödül Kullanımı'
1135
+ };
1136
+ });
1137
+ }
1138
+
1139
+ if (items.length === 0) {
1140
+ container.html('<div class="detail-empty"><i class="fa fa-inbox"></i>Kayıt bulunamadı</div>');
1141
+ return;
1142
+ }
1143
+
1144
+ var html = '';
1145
+ items.forEach(function (item) {
1146
+ var isEarn = item.type === 'earn' || (item.type === 'admin_adjust' && item.amt >= 0);
1147
+ var iconClass = isEarn ? 'earn' : 'spend';
1148
+ var icon = isEarn ? 'fa-arrow-up' : 'fa-arrow-down';
1149
+ var valClass = isEarn ? 'earn' : 'spend';
1150
+ var sign = isEarn ? '+' : '-';
1151
+ var descText = escapeHtml(item.txt || 'İşlem');
1152
+ var timeText = moment(item.ts).format('DD MMM YYYY, HH:mm');
1153
+ var amtVal = item.amt || 0;
1154
+
1155
+ html += '<div class="detail-history-item">' +
1156
+ '<div class="detail-history-icon ' + iconClass + '"><i class="fa ' + icon + '"></i></div>' +
1157
+ '<div class="detail-history-text">' +
1158
+ '<div class="detail-history-desc">' + descText + '</div>' +
1159
+ '<div class="detail-history-time">' + timeText + '</div>' +
1160
+ '</div>' +
1161
+ '<div class="detail-history-val ' + valClass + '">' + sign + amtVal + '</div>' +
1162
+ '</div>';
1163
+ });
1164
+
1165
+ container.html(html);
1166
+ };
1167
+
1168
+ window.submitManagePoints = function () {
1169
+ const amt = parseFloat($('#manage-amount').val());
1170
+ const reason = $('#manage-reason').val().trim();
1171
+ const action = $('input[name="manage_action"]:checked').val();
1172
+ const $err = $('#manage-error');
1173
+
1174
+ if (!amt || amt <= 0) { $err.text('Geçerli bir miktar giriniz.').show(); return; }
1175
+ if (!reason) { $err.text('Sebep girmek zorunludur.').show(); return; }
1176
+
1177
+ socket.emit('plugins.niki.managePoints', {
1178
+ targetUid: g_targetUid,
1179
+ amount: amt,
1180
+ action: action,
1181
+ reason: reason
1182
+ }, function (err, result) {
1183
+ if (err) {
1184
+ $err.text(err.message || 'Hata oluştu.').show();
1185
+ } else {
1186
+ closeManageModal();
1187
+ app.alert({ type: 'success', title: 'Başarılı', message: 'İşlem Başarılı! Yeni Puan: ' + result.newPoints, timeout: 3000 });
1188
+ initNikiAdmin();
1189
+ }
1190
+ });
1191
+ };
1192
+
1193
+ var _initRetries = 0;
1194
+ function initNikiAdmin() {
1195
+ if (typeof socket === 'undefined' || typeof app === 'undefined' || typeof app.user === 'undefined') {
1196
+ _initRetries++;
1197
+ if (_initRetries > 25) {
1198
+ console.error('[Niki-Admin] Socket/app 5 saniye içinde hazır olmadı, yükleme iptal.');
1199
+ $('#niki-loader').hide();
1200
+ $('.niki-dashboard').append('<div style="text-align:center; padding:40px; color:#ef5350;">Bağlantı kurulamadı. Sayfayı yenileyin.</div>');
1201
+ return;
1202
+ }
1203
+ setTimeout(initNikiAdmin, 200);
1204
+ return;
1205
+ }
1206
+ _initRetries = 0;
1207
+
1208
+ const $loader = $('#niki-loader');
1209
+ const $content = $('#niki-content');
1210
+ $loader.show(); $content.hide();
1211
+
1212
+ // Önce istatistikleri al
1213
+ console.log('[Niki-Admin] getStats emit ediliyor...');
1214
+ socket.emit('plugins.niki.getStats', {}, function (err, stats) {
1215
+ console.log('[Niki-Admin] getStats sonuç:', err, stats);
1216
+ if (!err && stats) {
1217
+ $('#val-users').text(stats.usersWithPoints || 0);
1218
+ $('#val-points').text(Number(stats.totalPoints || 0).toLocaleString('tr-TR'));
1219
+ $('#val-avg').text(Number(stats.avgPoints || 0).toLocaleString('tr-TR'));
1220
+ $('#val-redeemed').text(Number(stats.totalRedeemed || 0).toLocaleString('tr-TR'));
1221
+ $('#val-transactions').text(stats.totalTransactions || 0);
1222
+ $('#val-today').text(stats.todayTransactions || 0);
1223
+ }
1224
+ });
1225
+
1226
+ console.log('[Niki-Admin] getUsers emit ediliyor...');
1227
+ socket.emit('plugins.niki.getUsers', {}, function (err, users) {
1228
+ console.log('[Niki-Admin] getUsers sonuç:', err, users);
1229
+ $loader.hide();
1230
+ if (err) {
1231
+ console.error('[Niki-Admin] getUsers HATA:', err);
1232
+ $('.niki-dashboard').html('<div style="color:#d32f2f; text-align:center; padding:40px;">HATA: ' + (err.message || 'Yetkisiz') + '</div>');
1233
+ return;
1234
+ }
1235
+ if (!users) users = [];
1236
+ console.log('[Niki-Admin] ✅ ' + users.length + ' kullanıcı yüklendi');
1237
+ g_users = users;
1238
+ $content.fadeIn(300);
1239
+ renderList(users);
1240
+
1241
+ $('#nk-search-input').off('keyup').on('keyup', function () {
1242
+ const val = $(this).val().toLowerCase();
1243
+ const filtered = users.filter(function (u) {
1244
+ return u.username.toLowerCase().indexOf(val) > -1;
1245
+ });
1246
+ renderList(filtered);
1247
+ });
1248
+ });
1249
+ }
1250
+
1251
+ function renderList(list) {
1252
+ const $container = $('#nk-list-body');
1253
+ $container.empty();
1254
+ if (list.length === 0) {
1255
+ $container.html('<div style="text-align:center; padding:30px; color:#444;">Sonuç bulunamadı.</div>'); return;
1256
+ }
1257
+ const rp = config.relative_path || '';
1258
+
1259
+ $.each(list, function (i, u) {
1260
+ const row = $('<div class="nk-row"></div>');
1261
+ row.append('<div class="nk-idx">' + (i + 1) + '</div>');
1262
+
1263
+ const info = $('<div class="nk-user-info"></div>');
1264
+ if (u.picture) { info.append('<img src="' + u.picture + '" class="nk-avatar">'); }
1265
+ else {
1266
+ const letter = (u.username && u.username[0]) ? u.username[0].toUpperCase() : '?';
1267
+ const bg = u.iconBg || '#555';
1268
+ info.append('<div class="nk-letter-avatar" style="background:' + bg + '">' + letter + '</div>');
1269
+ }
1270
+ const link = $('<a class="nk-username" target="_blank"></a>').attr('href', rp + '/user/' + u.userslug).text(u.username);
1271
+ info.append(link);
1272
+ row.append(info);
1273
+
1274
+ const pText = Math.floor(u.points || 0).toLocaleString('tr-TR');
1275
+ row.append('<div class="nk-points">' + pText + '</div>');
1276
+
1277
+ // Butonlar
1278
+ const btnCol = $('<div class="nk-actions"></div>');
1279
+
1280
+ // Detay Butonu
1281
+ const btnDetail = $('<button class="nk-btn-action info" title="Detay"><i class="fa fa-eye"></i></button>');
1282
+ btnDetail.click(function () { openDetailModal(u.uid); });
1283
+ btnCol.append(btnDetail);
1284
+
1285
+ // Düzenle Butonu
1286
+ const btnManage = $('<button class="nk-btn-action" title="Puan Düzenle"><i class="fa fa-cog"></i></button>');
1287
+ btnManage.click(function () { openManageModal(u.uid, u.username); });
1288
+ btnCol.append(btnManage);
1289
+
1290
+ row.append(btnCol);
1291
+ $container.append(row);
1292
+ });
1293
+ }
1294
+
1295
+ function escapeHtml(text) {
1296
+ if (!text) return '';
1297
+ const div = document.createElement('div');
1298
+ div.textContent = text;
1299
+ return div.innerHTML;
1300
+ }
1301
+
1302
+ // Bu script widget HTML'i içinde olduğundan, çalıştığında DOM zaten hazır.
1303
+ // action:ajaxify.end widget'lardan ÖNCE tetiklendiği için kullanılmamalı.
1304
+ // Ayrıca her widget yüklemesinde yeni listener eklenmesi sorun yaratır.
1305
+ if ($('.niki-dashboard').length) {
1306
+ initNikiAdmin();
1307
+ }
1308
+ })();
1309
+ </script>