nodebb-plugin-sso-biogrenci 1.0.0 → 1.0.2

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.
@@ -13,71 +13,4 @@
13
13
  </div>
14
14
  </div>
15
15
 
16
- <script>
17
- (function () {
18
- 'use strict';
19
-
20
- function loadStatus() {
21
- fetch(config.relative_path + '/api/biogrenci/status')
22
- .then(function (r) { return r.json(); })
23
- .then(function (data) {
24
- var el = document.getElementById('biogrenci-status');
25
- if (data.linked) {
26
- el.innerHTML =
27
- '<div class="biogrenci-linked">' +
28
- '<div class="biogrenci-linked-badge">' +
29
- '<i class="fa fa-check-circle"></i> Hesap Bağlı' +
30
- '</div>' +
31
- (data.verified
32
- ? '<div class="biogrenci-verified-badge"><i class="fa fa-shield"></i> Doğrulanmış Öğrenci</div>'
33
- : '') +
34
- (data.education
35
- ? '<div class="biogrenci-education"><i class="fa fa-university"></i> ' + data.education + '</div>'
36
- : '') +
37
- '<hr/>' +
38
- '<button id="biogrenci-unlink" class="btn btn-danger btn-sm">' +
39
- '<i class="fa fa-unlink"></i> Bağlantıyı Kaldır' +
40
- '</button>' +
41
- '</div>';
42
-
43
- document.getElementById('biogrenci-unlink').addEventListener('click', unlinkAccount);
44
- } else {
45
- el.innerHTML =
46
- '<div class="biogrenci-not-linked">' +
47
- '<p>bi\'öğrenci hesabınız henüz bağlı değil.</p>' +
48
- '<p class="text-muted">Hesabınızı bağlayarak öğrenci doğrulaması yapabilir ve öğrenci fırsatlarından yararlanabilirsiniz.</p>' +
49
- '<a href="' + config.relative_path + '/auth/biogrenci" class="btn btn-primary">' +
50
- '<i class="fa fa-graduation-cap"></i> bi\'öğrenci Hesabını Bağla' +
51
- '</a>' +
52
- '</div>';
53
- }
54
- });
55
- }
56
-
57
- function unlinkAccount() {
58
- if (!confirm("bi'öğrenci hesap bağlantısını kaldırmak istediğinize emin misiniz?")) {
59
- return;
60
- }
61
- fetch(config.relative_path + '/api/biogrenci/unlink', {
62
- method: 'POST',
63
- headers: {
64
- 'x-csrf-token': config.csrf_token,
65
- 'Content-Type': 'application/json',
66
- },
67
- })
68
- .then(function (r) { return r.json(); })
69
- .then(function (res) {
70
- if (res.success) {
71
- app.alertSuccess('bi\'öğrenci bağlantısı kaldırıldı');
72
- loadStatus();
73
- } else {
74
- app.alertError(res.error || 'Bir hata oluştu');
75
- }
76
- });
77
- }
78
-
79
- loadStatus();
80
- })();
81
- </script>
82
-
83
16
  <!-- IMPORT partials/account/footer.tpl -->
@@ -1,22 +1,32 @@
1
1
  <div class="acp-page-container">
2
2
  <div class="col-lg-9">
3
3
  <div class="panel panel-default">
4
- <div class="panel-heading">bi'öğrenci SSO Ayarları</div>
4
+ <div class="panel-heading"><i class="fa fa-graduation-cap"></i> bi'öğrenci SSO Ayarları</div>
5
5
  <div class="panel-body">
6
- <form id="sso-biogrenci-settings" role="form">
6
+ <form class="sso-biogrenci-settings" role="form">
7
7
  <div class="form-group">
8
8
  <label for="clientId">Client ID</label>
9
- <input type="text" id="clientId" name="clientId" class="form-control" placeholder="bi'öğrenci Client ID">
9
+ <input type="text" id="clientId" name="clientId" class="form-control" placeholder="bi'öğrenci OAuth Client ID">
10
+ <p class="help-block">bi'öğrenci partner panelinden aldığınız Client ID</p>
10
11
  </div>
11
12
  <div class="form-group">
12
13
  <label for="clientSecret">Client Secret</label>
13
- <input type="password" id="clientSecret" name="clientSecret" class="form-control" placeholder="bi'öğrenci Client Secret">
14
+ <div class="input-group">
15
+ <input type="password" id="clientSecret" name="clientSecret" class="form-control" placeholder="bi'öğrenci OAuth Client Secret">
16
+ <span class="input-group-btn">
17
+ <button id="toggleSecret" class="btn btn-default" type="button">
18
+ <i class="fa fa-eye"></i>
19
+ </button>
20
+ </span>
21
+ </div>
22
+ <p class="help-block">bi'öğrenci partner panelinden aldığınız Client Secret</p>
14
23
  </div>
15
24
  <hr/>
16
- <p class="help-block">
17
- Redirect URI olarak şunu bi'öğrenci paneline ekleyin:<br>
18
- <code>{callbackURL}</code>
19
- </p>
25
+ <div class="alert alert-info">
26
+ <strong><i class="fa fa-info-circle"></i> Redirect URI</strong><br>
27
+ Aşağıdaki adresi bi'öğrenci partner panelinde Redirect URI olarak ekleyin:<br>
28
+ <code id="callbackURL">{callbackURL}</code>
29
+ </div>
20
30
  </form>
21
31
  </div>
22
32
  </div>
@@ -26,14 +36,3 @@
26
36
  <button id="save" class="floating-button mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
27
37
  <i class="material-icons">save</i>
28
38
  </button>
29
-
30
- <script>
31
- require(['settings'], function (Settings) {
32
- Settings.load('sso-biogrenci', $('.acp-page-container form'));
33
- $('#save').on('click', function () {
34
- Settings.save('sso-biogrenci', $('.acp-page-container form'), function () {
35
- app.alertSuccess('Ayarlar kaydedildi');
36
- });
37
- });
38
- });
39
- </script>
@@ -1,21 +1,26 @@
1
1
  <!-- IMPORT partials/breadcrumbs.tpl -->
2
2
 
3
3
  <div id="biogrenci-firsatlar" class="biogrenci-page">
4
- <div class="biogrenci-header">
5
- <img src="https://biogrenci.com/favicon.ico" alt="bi'öğrenci" class="biogrenci-logo">
6
- <h2>Öğrenci Fırsatları</h2>
7
- <p class="biogrenci-subtitle">bi'öğrenci ile sunulan öğrenci indirim ve fırsatları</p>
4
+ <div class="biogrenci-hero">
5
+ <div class="biogrenci-hero-content">
6
+ <div class="biogrenci-hero-icon">
7
+ <i class="fa fa-graduation-cap"></i>
8
+ </div>
9
+ <h2>Öğrenci Fırsatları</h2>
10
+ <p class="biogrenci-subtitle">bi'öğrenci ile sunulan öğrenci indirim ve fırsatları</p>
11
+ </div>
8
12
  </div>
9
13
 
10
- <div class="biogrenci-filters">
14
+ <div class="biogrenci-toolbar">
11
15
  <div class="biogrenci-search">
16
+ <i class="fa fa-search"></i>
12
17
  <input type="text" id="biogrenci-search" class="form-control" placeholder="Fırsat ara...">
13
18
  </div>
14
19
  <div class="biogrenci-filter-buttons">
15
- <button class="btn btn-outline biogrenci-filter active" data-type="">Tümü</button>
16
- <button class="btn btn-outline biogrenci-filter" data-type="kupon">Kuponlar</button>
17
- <button class="btn btn-outline biogrenci-filter" data-type="qr">QR Kod</button>
18
- <button class="btn btn-outline biogrenci-filter" data-type="affiliate">Linkler</button>
20
+ <button class="btn biogrenci-filter active" data-type="">Tümü</button>
21
+ <button class="btn biogrenci-filter" data-type="kupon"><i class="fa fa-ticket"></i> Kuponlar</button>
22
+ <button class="btn biogrenci-filter" data-type="qr"><i class="fa fa-qrcode"></i> QR Kod</button>
23
+ <button class="btn biogrenci-filter" data-type="affiliate"><i class="fa fa-link"></i> Linkler</button>
19
24
  </div>
20
25
  <select id="biogrenci-sort" class="form-control">
21
26
  <option value="featured">Öne Çıkan</option>
@@ -27,172 +32,14 @@
27
32
 
28
33
  <div id="biogrenci-list" class="biogrenci-grid">
29
34
  <div class="biogrenci-loading">
30
- <i class="fa fa-spinner fa-spin"></i> Fırsatlar yükleniyor...
35
+ <div class="biogrenci-spinner"></div>
36
+ <p>Fırsatlar yükleniyor...</p>
31
37
  </div>
32
38
  </div>
33
39
 
34
40
  <div id="biogrenci-pagination" class="biogrenci-pagination" style="display:none;">
35
- <button id="biogrenci-prev" class="btn btn-default" disabled>← Önceki</button>
41
+ <button id="biogrenci-prev" class="btn biogrenci-page-btn" disabled><i class="fa fa-chevron-left"></i> Önceki</button>
36
42
  <span id="biogrenci-page-info"></span>
37
- <button id="biogrenci-next" class="btn btn-default">Sonraki →</button>
43
+ <button id="biogrenci-next" class="btn biogrenci-page-btn">Sonraki <i class="fa fa-chevron-right"></i></button>
38
44
  </div>
39
45
  </div>
40
-
41
- <script>
42
- (function () {
43
- 'use strict';
44
-
45
- let currentPage = 1;
46
- let currentType = '';
47
- let currentSort = 'featured';
48
- let currentSearch = '';
49
- let searchTimeout = null;
50
-
51
- function loadOpportunities() {
52
- const list = document.getElementById('biogrenci-list');
53
- list.innerHTML = '<div class="biogrenci-loading"><i class="fa fa-spinner fa-spin"></i> Fırsatlar yükleniyor...</div>';
54
-
55
- const params = new URLSearchParams({
56
- page: currentPage,
57
- per_page: 20,
58
- sort: currentSort,
59
- });
60
- if (currentType) params.set('type', currentType);
61
- if (currentSearch) params.set('search', currentSearch);
62
-
63
- fetch(config.relative_path + '/api/biogrenci/firsatlar?' + params.toString())
64
- .then(function (r) { return r.json(); })
65
- .then(function (res) {
66
- if (!res.data || !res.data.length) {
67
- list.innerHTML = '<div class="biogrenci-empty">Fırsat bulunamadı</div>';
68
- document.getElementById('biogrenci-pagination').style.display = 'none';
69
- return;
70
- }
71
- renderOpportunities(res.data);
72
- renderPagination(res.meta || {});
73
- })
74
- .catch(function (err) {
75
- list.innerHTML = '<div class="biogrenci-empty">Fırsatlar yüklenirken hata oluştu</div>';
76
- });
77
- }
78
-
79
- function renderOpportunities(items) {
80
- const list = document.getElementById('biogrenci-list');
81
- list.innerHTML = items.map(function (item) {
82
- var typeLabel = item.type === 'kupon' ? 'Kupon' : item.type === 'qr' ? 'QR Kod' : 'Link';
83
- var typeBadge = item.type === 'kupon' ? 'badge-kupon' : item.type === 'qr' ? 'badge-qr' : 'badge-affiliate';
84
- return '<div class="biogrenci-card">' +
85
- (item.image ? '<div class="biogrenci-card-img"><img src="' + item.image + '" alt="' + (item.brand_name || '') + '"></div>' : '') +
86
- '<div class="biogrenci-card-body">' +
87
- '<div class="biogrenci-card-top">' +
88
- '<span class="biogrenci-badge ' + typeBadge + '">' + typeLabel + '</span>' +
89
- (item.brand_name ? '<span class="biogrenci-brand">' + item.brand_name + '</span>' : '') +
90
- '</div>' +
91
- '<h3 class="biogrenci-card-title">' + item.title + '</h3>' +
92
- (item.description ? '<p class="biogrenci-card-desc">' + item.description + '</p>' : '') +
93
- '<button class="btn btn-primary biogrenci-claim-btn" data-id="' + item.id + '">Fırsatı Al</button>' +
94
- '</div>' +
95
- '</div>';
96
- }).join('');
97
-
98
- // Bind claim buttons
99
- list.querySelectorAll('.biogrenci-claim-btn').forEach(function (btn) {
100
- btn.addEventListener('click', function () { claimOpportunity(this); });
101
- });
102
- }
103
-
104
- function renderPagination(meta) {
105
- var el = document.getElementById('biogrenci-pagination');
106
- if (!meta.total || meta.total <= 20) {
107
- el.style.display = 'none';
108
- return;
109
- }
110
- el.style.display = 'flex';
111
- var totalPages = Math.ceil(meta.total / 20);
112
- document.getElementById('biogrenci-page-info').textContent = currentPage + ' / ' + totalPages;
113
- document.getElementById('biogrenci-prev').disabled = currentPage <= 1;
114
- document.getElementById('biogrenci-next').disabled = currentPage >= totalPages;
115
- }
116
-
117
- function claimOpportunity(btn) {
118
- var id = btn.getAttribute('data-id');
119
- btn.disabled = true;
120
- btn.textContent = 'Alınıyor...';
121
-
122
- fetch(config.relative_path + '/api/biogrenci/firsatlar/' + id + '/claim', {
123
- method: 'POST',
124
- headers: {
125
- 'x-csrf-token': config.csrf_token,
126
- 'Content-Type': 'application/json',
127
- },
128
- })
129
- .then(function (r) { return r.json(); })
130
- .then(function (res) {
131
- if (res.error) {
132
- app.alertError(res.error);
133
- btn.disabled = false;
134
- btn.textContent = 'Fırsatı Al';
135
- return;
136
- }
137
- if (res.data && res.data.coupon_code) {
138
- btn.outerHTML = '<div class="biogrenci-coupon-result">' +
139
- '<span class="biogrenci-coupon-code">' + res.data.coupon_code + '</span>' +
140
- '<button class="btn btn-sm btn-default biogrenci-copy-btn" onclick="navigator.clipboard.writeText(\'' + res.data.coupon_code + '\');app.alertSuccess(\'Kopyalandı!\')">Kopyala</button>' +
141
- (res.data.redirect_url ? '<a href="' + res.data.redirect_url + '" target="_blank" class="btn btn-sm btn-link">Siteye Git →</a>' : '') +
142
- '</div>';
143
- } else if (res.data && res.data.qr_code) {
144
- btn.outerHTML = '<div class="biogrenci-qr-result">' + res.data.qr_code + '</div>';
145
- } else if (res.data && res.data.redirect_url) {
146
- window.open(res.data.redirect_url, '_blank');
147
- btn.textContent = 'Açıldı ✓';
148
- }
149
- })
150
- .catch(function () {
151
- app.alertError('Bir hata oluştu');
152
- btn.disabled = false;
153
- btn.textContent = 'Fırsatı Al';
154
- });
155
- }
156
-
157
- // Filter buttons
158
- document.querySelectorAll('.biogrenci-filter').forEach(function (btn) {
159
- btn.addEventListener('click', function () {
160
- document.querySelectorAll('.biogrenci-filter').forEach(function (b) { b.classList.remove('active'); });
161
- this.classList.add('active');
162
- currentType = this.getAttribute('data-type');
163
- currentPage = 1;
164
- loadOpportunities();
165
- });
166
- });
167
-
168
- // Sort
169
- document.getElementById('biogrenci-sort').addEventListener('change', function () {
170
- currentSort = this.value;
171
- currentPage = 1;
172
- loadOpportunities();
173
- });
174
-
175
- // Search
176
- document.getElementById('biogrenci-search').addEventListener('input', function () {
177
- clearTimeout(searchTimeout);
178
- var val = this.value;
179
- searchTimeout = setTimeout(function () {
180
- currentSearch = val;
181
- currentPage = 1;
182
- loadOpportunities();
183
- }, 400);
184
- });
185
-
186
- // Pagination
187
- document.getElementById('biogrenci-prev').addEventListener('click', function () {
188
- if (currentPage > 1) { currentPage--; loadOpportunities(); }
189
- });
190
- document.getElementById('biogrenci-next').addEventListener('click', function () {
191
- currentPage++;
192
- loadOpportunities();
193
- });
194
-
195
- // Initial load
196
- loadOpportunities();
197
- })();
198
- </script>