django-cfg 1.2.25__py3-none-any.whl → 1.2.29__py3-none-any.whl

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.
Files changed (37) hide show
  1. django_cfg/__init__.py +1 -1
  2. django_cfg/apps/payments/config/providers.py +6 -16
  3. django_cfg/apps/payments/services/providers/cryptomus.py +2 -1
  4. django_cfg/apps/payments/static/payments/css/payments.css +340 -0
  5. django_cfg/apps/payments/static/payments/js/notifications.js +202 -0
  6. django_cfg/apps/payments/static/payments/js/payment-utils.js +318 -0
  7. django_cfg/apps/payments/static/payments/js/theme.js +86 -0
  8. django_cfg/apps/payments/templates/payments/base.html +182 -0
  9. django_cfg/apps/payments/templates/payments/components/payment_card.html +201 -0
  10. django_cfg/apps/payments/templates/payments/components/payment_qr_code.html +109 -0
  11. django_cfg/apps/payments/templates/payments/components/progress_bar.html +36 -0
  12. django_cfg/apps/payments/templates/payments/components/provider_stats.html +40 -0
  13. django_cfg/apps/payments/templates/payments/components/status_badge.html +27 -0
  14. django_cfg/apps/payments/templates/payments/components/status_overview.html +144 -0
  15. django_cfg/apps/payments/templates/payments/dashboard.html +346 -0
  16. django_cfg/apps/payments/templatetags/__init__.py +1 -0
  17. django_cfg/apps/payments/templatetags/payments_tags.py +315 -0
  18. django_cfg/apps/payments/urls_templates.py +52 -0
  19. django_cfg/apps/payments/views/templates/__init__.py +25 -0
  20. django_cfg/apps/payments/views/templates/ajax.py +312 -0
  21. django_cfg/apps/payments/views/templates/base.py +204 -0
  22. django_cfg/apps/payments/views/templates/dashboard.py +60 -0
  23. django_cfg/apps/payments/views/templates/payment_detail.py +102 -0
  24. django_cfg/apps/payments/views/templates/payment_management.py +164 -0
  25. django_cfg/apps/payments/views/templates/qr_code.py +174 -0
  26. django_cfg/apps/payments/views/templates/stats.py +240 -0
  27. django_cfg/apps/payments/views/templates/utils.py +181 -0
  28. django_cfg/apps/urls.py +3 -0
  29. django_cfg/models/payments.py +1 -0
  30. django_cfg/registry/core.py +1 -0
  31. django_cfg/template_archive/.gitignore +1 -0
  32. django_cfg/template_archive/django_sample.zip +0 -0
  33. {django_cfg-1.2.25.dist-info → django_cfg-1.2.29.dist-info}/METADATA +12 -15
  34. {django_cfg-1.2.25.dist-info → django_cfg-1.2.29.dist-info}/RECORD +37 -12
  35. {django_cfg-1.2.25.dist-info → django_cfg-1.2.29.dist-info}/WHEEL +0 -0
  36. {django_cfg-1.2.25.dist-info → django_cfg-1.2.29.dist-info}/entry_points.txt +0 -0
  37. {django_cfg-1.2.25.dist-info → django_cfg-1.2.29.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,318 @@
1
+ /**
2
+ * Payment Utility Functions
3
+ * Common utilities for payment dashboard functionality
4
+ */
5
+
6
+ class PaymentUtils {
7
+ constructor() {
8
+ this.formatters = {
9
+ currency: new Intl.NumberFormat('en-US', {
10
+ style: 'currency',
11
+ currency: 'USD',
12
+ minimumFractionDigits: 2,
13
+ maximumFractionDigits: 8
14
+ }),
15
+ number: new Intl.NumberFormat('en-US'),
16
+ date: new Intl.DateTimeFormat('en-US', {
17
+ year: 'numeric',
18
+ month: 'short',
19
+ day: 'numeric',
20
+ hour: '2-digit',
21
+ minute: '2-digit'
22
+ })
23
+ };
24
+ }
25
+
26
+ // Format currency with proper decimals based on currency type
27
+ formatCurrency(amount, currencyCode = 'USD') {
28
+ const numAmount = parseFloat(amount) || 0;
29
+
30
+ // Crypto currencies need more decimal places
31
+ const cryptoDecimals = {
32
+ 'BTC': 8,
33
+ 'ETH': 6,
34
+ 'LTC': 8,
35
+ 'USDT': 6,
36
+ 'USDC': 6
37
+ };
38
+
39
+ if (cryptoDecimals[currencyCode]) {
40
+ return `${numAmount.toFixed(cryptoDecimals[currencyCode])} ${currencyCode}`;
41
+ }
42
+
43
+ // Fiat currencies
44
+ if (currencyCode === 'USD') {
45
+ return this.formatters.currency.format(numAmount);
46
+ }
47
+
48
+ return `${numAmount.toFixed(2)} ${currencyCode}`;
49
+ }
50
+
51
+ // Format payment status with proper display text
52
+ formatStatus(status) {
53
+ const statusMap = {
54
+ 'pending': 'Pending',
55
+ 'confirming': 'Confirming',
56
+ 'confirmed': 'Confirmed',
57
+ 'completed': 'Completed',
58
+ 'failed': 'Failed',
59
+ 'expired': 'Expired',
60
+ 'cancelled': 'Cancelled',
61
+ 'refunded': 'Refunded'
62
+ };
63
+ return statusMap[status] || status;
64
+ }
65
+
66
+ // Get status color class
67
+ getStatusColor(status) {
68
+ const colorMap = {
69
+ 'pending': 'yellow',
70
+ 'confirming': 'blue',
71
+ 'confirmed': 'green',
72
+ 'completed': 'green',
73
+ 'failed': 'red',
74
+ 'expired': 'gray',
75
+ 'cancelled': 'gray',
76
+ 'refunded': 'purple'
77
+ };
78
+ return colorMap[status] || 'gray';
79
+ }
80
+
81
+ // Get provider display name
82
+ getProviderName(provider) {
83
+ const providerMap = {
84
+ 'nowpayments': 'NowPayments',
85
+ 'cryptapi': 'CryptAPI',
86
+ 'cryptomus': 'Cryptomus',
87
+ 'stripe': 'Stripe',
88
+ 'internal': 'Internal'
89
+ };
90
+ return providerMap[provider] || provider;
91
+ }
92
+
93
+ // Get provider icon
94
+ getProviderIcon(provider) {
95
+ const iconMap = {
96
+ 'nowpayments': 'currency_bitcoin',
97
+ 'cryptapi': 'currency_bitcoin',
98
+ 'cryptomus': 'currency_bitcoin',
99
+ 'stripe': 'credit_card',
100
+ 'internal': 'account_balance'
101
+ };
102
+ return iconMap[provider] || 'payment';
103
+ }
104
+
105
+ // Calculate time ago
106
+ timeAgo(dateString) {
107
+ const date = new Date(dateString);
108
+ const now = new Date();
109
+ const diffMs = now - date;
110
+ const diffSecs = Math.floor(diffMs / 1000);
111
+ const diffMins = Math.floor(diffSecs / 60);
112
+ const diffHours = Math.floor(diffMins / 60);
113
+ const diffDays = Math.floor(diffHours / 24);
114
+
115
+ if (diffSecs < 60) {
116
+ return 'Just now';
117
+ } else if (diffMins < 60) {
118
+ return `${diffMins}m ago`;
119
+ } else if (diffHours < 24) {
120
+ return `${diffHours}h ago`;
121
+ } else if (diffDays < 7) {
122
+ return `${diffDays}d ago`;
123
+ } else {
124
+ return this.formatters.date.format(date);
125
+ }
126
+ }
127
+
128
+ // Validate payment ID format
129
+ isValidPaymentId(id) {
130
+ // UUID v4 format
131
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
132
+ return uuidRegex.test(id);
133
+ }
134
+
135
+ // Copy text to clipboard
136
+ async copyToClipboard(text) {
137
+ try {
138
+ await navigator.clipboard.writeText(text);
139
+ if (window.notificationManager) {
140
+ window.notificationManager.success('Copied to clipboard');
141
+ }
142
+ return true;
143
+ } catch (err) {
144
+ console.error('Failed to copy to clipboard:', err);
145
+ if (window.notificationManager) {
146
+ window.notificationManager.error('Failed to copy to clipboard');
147
+ }
148
+ return false;
149
+ }
150
+ }
151
+
152
+ // Generate QR code data URL (placeholder - requires QR library)
153
+ generateQRCodeDataUrl(data, size = 128) {
154
+ // This would integrate with a QR code library like qrcode.js
155
+ // For now, return a placeholder
156
+ return `data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}"><rect width="100%" height="100%" fill="%23f3f4f6"/><text x="50%" y="50%" text-anchor="middle" dy="0.3em" font-family="sans-serif" font-size="12" fill="%236b7280">QR Code</text></svg>`;
157
+ }
158
+
159
+ // Debounce function for search/filter inputs
160
+ debounce(func, wait) {
161
+ let timeout;
162
+ return function executedFunction(...args) {
163
+ const later = () => {
164
+ clearTimeout(timeout);
165
+ func(...args);
166
+ };
167
+ clearTimeout(timeout);
168
+ timeout = setTimeout(later, wait);
169
+ };
170
+ }
171
+
172
+ // Throttle function for scroll events
173
+ throttle(func, limit) {
174
+ let inThrottle;
175
+ return function() {
176
+ const args = arguments;
177
+ const context = this;
178
+ if (!inThrottle) {
179
+ func.apply(context, args);
180
+ inThrottle = true;
181
+ setTimeout(() => inThrottle = false, limit);
182
+ }
183
+ };
184
+ }
185
+
186
+ // Update URL parameters without page reload
187
+ updateUrlParams(params) {
188
+ const url = new URL(window.location);
189
+ Object.keys(params).forEach(key => {
190
+ if (params[key] !== null && params[key] !== '') {
191
+ url.searchParams.set(key, params[key]);
192
+ } else {
193
+ url.searchParams.delete(key);
194
+ }
195
+ });
196
+ window.history.replaceState({}, '', url);
197
+ }
198
+
199
+ // Get URL parameter value
200
+ getUrlParam(param) {
201
+ const urlParams = new URLSearchParams(window.location.search);
202
+ return urlParams.get(param);
203
+ }
204
+
205
+ // Format large numbers (e.g., 1000000 -> 1M)
206
+ formatLargeNumber(num) {
207
+ const numValue = parseFloat(num) || 0;
208
+ if (numValue >= 1000000000) {
209
+ return (numValue / 1000000000).toFixed(1) + 'B';
210
+ } else if (numValue >= 1000000) {
211
+ return (numValue / 1000000).toFixed(1) + 'M';
212
+ } else if (numValue >= 1000) {
213
+ return (numValue / 1000).toFixed(1) + 'K';
214
+ }
215
+ return this.formatters.number.format(numValue);
216
+ }
217
+
218
+ // Show confirmation dialog
219
+ showConfirmDialog(message, onConfirm, onCancel = null) {
220
+ const modal = document.createElement('div');
221
+ modal.className = 'modal-overlay';
222
+ modal.innerHTML = `
223
+ <div class="modal-content">
224
+ <div class="modal-header">
225
+ <h3 class="text-lg font-medium text-gray-900 dark:text-white">Confirm Action</h3>
226
+ </div>
227
+ <div class="modal-body">
228
+ <p class="text-sm text-gray-500 dark:text-gray-400">${this.escapeHtml(message)}</p>
229
+ </div>
230
+ <div class="modal-footer">
231
+ <button class="btn btn-outline" id="cancel-btn">Cancel</button>
232
+ <button class="btn btn-danger" id="confirm-btn">Confirm</button>
233
+ </div>
234
+ </div>
235
+ `;
236
+
237
+ document.body.appendChild(modal);
238
+
239
+ const confirmBtn = modal.querySelector('#confirm-btn');
240
+ const cancelBtn = modal.querySelector('#cancel-btn');
241
+
242
+ const cleanup = () => {
243
+ if (modal.parentNode) {
244
+ modal.parentNode.removeChild(modal);
245
+ }
246
+ };
247
+
248
+ confirmBtn.addEventListener('click', () => {
249
+ cleanup();
250
+ if (onConfirm) onConfirm();
251
+ });
252
+
253
+ cancelBtn.addEventListener('click', () => {
254
+ cleanup();
255
+ if (onCancel) onCancel();
256
+ });
257
+
258
+ modal.addEventListener('click', (e) => {
259
+ if (e.target === modal) {
260
+ cleanup();
261
+ if (onCancel) onCancel();
262
+ }
263
+ });
264
+ }
265
+
266
+ // Escape HTML to prevent XSS
267
+ escapeHtml(text) {
268
+ const map = {
269
+ '&': '&amp;',
270
+ '<': '&lt;',
271
+ '>': '&gt;',
272
+ '"': '&quot;',
273
+ "'": '&#039;'
274
+ };
275
+ return text.replace(/[&<>"']/g, (m) => map[m]);
276
+ }
277
+
278
+ // Local storage helpers with error handling
279
+ setStorage(key, value) {
280
+ try {
281
+ localStorage.setItem(key, JSON.stringify(value));
282
+ return true;
283
+ } catch (e) {
284
+ console.error('Failed to save to localStorage:', e);
285
+ return false;
286
+ }
287
+ }
288
+
289
+ getStorage(key, defaultValue = null) {
290
+ try {
291
+ const item = localStorage.getItem(key);
292
+ return item ? JSON.parse(item) : defaultValue;
293
+ } catch (e) {
294
+ console.error('Failed to read from localStorage:', e);
295
+ return defaultValue;
296
+ }
297
+ }
298
+
299
+ removeStorage(key) {
300
+ try {
301
+ localStorage.removeItem(key);
302
+ return true;
303
+ } catch (e) {
304
+ console.error('Failed to remove from localStorage:', e);
305
+ return false;
306
+ }
307
+ }
308
+ }
309
+
310
+ // Initialize utils when DOM is loaded
311
+ document.addEventListener('DOMContentLoaded', () => {
312
+ window.paymentUtils = new PaymentUtils();
313
+ });
314
+
315
+ // Export for use in other modules
316
+ if (typeof module !== 'undefined' && module.exports) {
317
+ module.exports = PaymentUtils;
318
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Theme Management for Payment Dashboard
3
+ * Handles light/dark mode switching with persistence
4
+ */
5
+
6
+ class ThemeManager {
7
+ constructor() {
8
+ this.initTheme();
9
+ this.bindEvents();
10
+ }
11
+
12
+ initTheme() {
13
+ // Check for saved theme preference or default to system preference
14
+ const savedTheme = localStorage.getItem('theme');
15
+ const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
16
+
17
+ if (savedTheme) {
18
+ this.setTheme(savedTheme);
19
+ } else if (systemPrefersDark) {
20
+ this.setTheme('dark');
21
+ } else {
22
+ this.setTheme('light');
23
+ }
24
+ }
25
+
26
+ setTheme(theme) {
27
+ const html = document.documentElement;
28
+ const toggleBtn = document.getElementById('theme-toggle');
29
+ const icon = toggleBtn?.querySelector('.material-icons');
30
+
31
+ if (theme === 'dark') {
32
+ html.classList.add('dark');
33
+ localStorage.setItem('theme', 'dark');
34
+ if (icon) {
35
+ icon.textContent = 'dark_mode';
36
+ icon.classList.add('text-yellow-400');
37
+ icon.classList.remove('text-gray-600');
38
+ }
39
+ } else {
40
+ html.classList.remove('dark');
41
+ localStorage.setItem('theme', 'light');
42
+ if (icon) {
43
+ icon.textContent = 'light_mode';
44
+ icon.classList.add('text-gray-600');
45
+ icon.classList.remove('text-yellow-400');
46
+ }
47
+ }
48
+
49
+ // Dispatch theme change event
50
+ window.dispatchEvent(new CustomEvent('themeChanged', { detail: { theme } }));
51
+ }
52
+
53
+ toggle() {
54
+ const currentTheme = localStorage.getItem('theme') || 'light';
55
+ const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
56
+ this.setTheme(newTheme);
57
+ }
58
+
59
+ bindEvents() {
60
+ const toggleBtn = document.getElementById('theme-toggle');
61
+ if (toggleBtn) {
62
+ toggleBtn.addEventListener('click', () => this.toggle());
63
+ }
64
+
65
+ // Listen for system theme changes
66
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
67
+ if (!localStorage.getItem('theme')) {
68
+ this.setTheme(e.matches ? 'dark' : 'light');
69
+ }
70
+ });
71
+ }
72
+
73
+ getCurrentTheme() {
74
+ return localStorage.getItem('theme') || 'light';
75
+ }
76
+ }
77
+
78
+ // Initialize theme manager when DOM is loaded
79
+ document.addEventListener('DOMContentLoaded', () => {
80
+ window.themeManager = new ThemeManager();
81
+ });
82
+
83
+ // Export for use in other modules
84
+ if (typeof module !== 'undefined' && module.exports) {
85
+ module.exports = ThemeManager;
86
+ }
@@ -0,0 +1,182 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="h-full">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{% block title %}Payment Dashboard{% endblock %}</title>
7
+
8
+ <!-- Tailwind CSS -->
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script>
11
+ tailwind.config = {
12
+ darkMode: 'class',
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ primary: {
17
+ 50: '#eff6ff',
18
+ 100: '#dbeafe',
19
+ 200: '#bfdbfe',
20
+ 300: '#93c5fd',
21
+ 400: '#60a5fa',
22
+ 500: '#3b82f6',
23
+ 600: '#2563eb',
24
+ 700: '#1d4ed8',
25
+ 800: '#1e40af',
26
+ 900: '#1e3a8a',
27
+ },
28
+ success: {
29
+ 50: '#f0fdf4',
30
+ 100: '#dcfce7',
31
+ 500: '#22c55e',
32
+ 600: '#16a34a',
33
+ },
34
+ warning: {
35
+ 50: '#fffbeb',
36
+ 100: '#fef3c7',
37
+ 500: '#f59e0b',
38
+ 600: '#d97706',
39
+ },
40
+ danger: {
41
+ 50: '#fef2f2',
42
+ 100: '#fee2e2',
43
+ 500: '#ef4444',
44
+ 600: '#dc2626',
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ </script>
51
+
52
+ <!-- Material Icons -->
53
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
54
+
55
+ <!-- Custom CSS -->
56
+ {% load static %}
57
+ <link rel="stylesheet" href="{% static 'payments/css/payments.css' %}">
58
+
59
+ {% block extra_head %}{% endblock %}
60
+ </head>
61
+ <body class="h-full bg-gray-50 dark:bg-gray-900">
62
+ <div class="min-h-full">
63
+ <!-- Header -->
64
+ <header class="bg-white dark:bg-gray-800 shadow-sm border-b border-gray-200 dark:border-gray-700">
65
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
66
+ <div class="flex items-center justify-between h-16">
67
+ <div class="flex items-center space-x-3">
68
+ <div class="flex-shrink-0">
69
+ <span class="material-icons text-primary-600 dark:text-primary-400 text-3xl">payments</span>
70
+ </div>
71
+ <div>
72
+ <h1 class="text-xl font-bold text-gray-900 dark:text-white">
73
+ {% block header_title %}Payment Dashboard{% endblock %}
74
+ </h1>
75
+ <p class="text-sm text-gray-500 dark:text-gray-400">
76
+ {% block header_subtitle %}Monitor and manage payment transactions{% endblock %}
77
+ </p>
78
+ </div>
79
+ </div>
80
+ <div class="flex items-center space-x-3">
81
+ {% block header_actions %}
82
+ <a href="{% url 'payments_dashboard:list' %}"
83
+ class="inline-flex items-center px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors duration-200">
84
+ <span class="material-icons text-sm mr-2">history</span>
85
+ Payment History
86
+ </a>
87
+ <a href="{% url 'payments_dashboard:create' %}"
88
+ class="inline-flex items-center px-3 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-md text-sm font-medium transition-colors duration-200">
89
+ <span class="material-icons text-sm mr-2">add</span>
90
+ New Payment
91
+ </a>
92
+ <button id="theme-toggle"
93
+ class="group inline-flex items-center justify-center px-3 py-2 rounded-md bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2">
94
+ <span class="material-icons text-gray-600 dark:text-yellow-400 group-hover:text-primary-600 dark:group-hover:text-yellow-300 transition-colors duration-200">light_mode</span>
95
+ </button>
96
+ {% endblock %}
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </header>
101
+
102
+ <!-- Live Status Indicator -->
103
+ <div id="live-status" class="bg-success-50 border-b border-success-200 px-4 py-2 hidden">
104
+ <div class="max-w-7xl mx-auto">
105
+ <div class="flex items-center justify-center">
106
+ <div class="flex items-center">
107
+ <div class="w-2 h-2 bg-success-500 rounded-full mr-2 animate-pulse"></div>
108
+ <span class="text-sm text-success-700 font-medium">Real-time updates active</span>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ <!-- Main content -->
115
+ <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
116
+ {% block content %}{% endblock %}
117
+ </main>
118
+
119
+ <!-- Footer -->
120
+ <footer class="bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 mt-12">
121
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
122
+ <div class="flex items-center justify-between">
123
+ <div class="text-sm text-gray-500 dark:text-gray-400">
124
+ {% block footer_text %}
125
+ Django-CFG Payment System •
126
+ <span id="connection-status" class="text-success-600">Connected</span>
127
+ {% endblock %}
128
+ </div>
129
+ <div class="flex items-center space-x-4 text-sm text-gray-500 dark:text-gray-400">
130
+ <span>Last update: <span id="last-update">{% now "H:i:s" %}</span></span>
131
+ <span class="material-icons text-sm">schedule</span>
132
+ </div>
133
+ </div>
134
+ </div>
135
+ </footer>
136
+ </div>
137
+
138
+ <!-- Notification Container -->
139
+ <div id="notification-container" class="fixed top-4 left-1/2 transform -translate-x-1/2 z-50 space-y-2"></div>
140
+
141
+ <!-- Modal Container -->
142
+ <div id="modal-container"></div>
143
+
144
+ <!-- JavaScript -->
145
+ <script src="{% static 'payments/js/theme.js' %}"></script>
146
+ <script src="{% static 'payments/js/notifications.js' %}"></script>
147
+ <script src="{% static 'payments/js/payment-utils.js' %}"></script>
148
+ {% block extra_js %}{% endblock %}
149
+
150
+ <!-- Real-time updates -->
151
+ <script>
152
+ // Global payment system initialization
153
+ document.addEventListener('DOMContentLoaded', function() {
154
+ // Update connection status
155
+ const updateConnectionStatus = () => {
156
+ const statusEl = document.getElementById('connection-status');
157
+ const lastUpdateEl = document.getElementById('last-update');
158
+ const liveStatusEl = document.getElementById('live-status');
159
+
160
+ if (statusEl) {
161
+ statusEl.textContent = 'Connected';
162
+ statusEl.className = 'text-success-600';
163
+ }
164
+
165
+ if (lastUpdateEl) {
166
+ lastUpdateEl.textContent = new Date().toLocaleTimeString();
167
+ }
168
+
169
+ if (liveStatusEl) {
170
+ liveStatusEl.classList.remove('hidden');
171
+ }
172
+ };
173
+
174
+ // Initial status update
175
+ updateConnectionStatus();
176
+
177
+ // Periodic status update
178
+ setInterval(updateConnectionStatus, 30000); // Every 30 seconds
179
+ });
180
+ </script>
181
+ </body>
182
+ </html>