Ahmad140 commited on
Commit
a4e90f5
·
verified ·
1 Parent(s): 622e0f5

Delete admin.html

Browse files
Files changed (1) hide show
  1. admin.html +0 -217
admin.html DELETED
@@ -1,217 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Admin Panel – Elite Visuals</title>
7
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
8
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
- <!-- Firebase SDK -->
10
- <script src="https://www.gstatic.com/firebasejs/9.22.1/firebase-app-compat.js"></script>
11
- <script src="https://www.gstatic.com/firebasejs/9.22.1/firebase-database-compat.js"></script>
12
- <style>
13
- * { margin: 0; padding: 0; box-sizing: border-box; }
14
- body { background: linear-gradient(135deg, #0a0a0f 0%, #12121a 100%); font-family: 'Inter', sans-serif; min-height: 100vh; padding: 30px; }
15
- .container { max-width: 1400px; margin: 0 auto; }
16
- h1 { color: white; margin-bottom: 10px; display: flex; align-items: center; gap: 15px; }
17
- h1 i { color: #25D366; }
18
- .subtitle { color: #8e8e9e; margin-bottom: 30px; }
19
- .stats { display: flex; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
20
- .stat-card { background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); border-radius: 20px; padding: 20px; min-width: 150px; text-align: center; }
21
- .stat-card h3 { color: #8e8e9e; font-size: 0.85rem; margin-bottom: 8px; }
22
- .stat-card .number { font-size: 2rem; font-weight: 700; color: #25D366; }
23
- .projects-table { background: rgba(255,255,255,0.05); border-radius: 20px; overflow-x: auto; backdrop-filter: blur(10px); }
24
- table { width: 100%; border-collapse: collapse; }
25
- th, td { padding: 15px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.1); color: #e0e0e0; }
26
- th { background: rgba(0,0,0,0.3); font-weight: 600; color: #25D366; }
27
- .status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }
28
- .status-pending { background: #ffc107; color: #333; }
29
- .status-progress { background: #17a2b8; color: white; }
30
- .status-completed { background: #28a745; color: white; }
31
- select { background: #1e2a3a; color: white; border: 1px solid #2a2a35; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
32
- button { background: #25D366; border: none; padding: 6px 12px; border-radius: 8px; color: white; cursor: pointer; transition: 0.2s; }
33
- button:hover { background: #128C7E; }
34
- .refresh-btn { background: #2a2a35; margin-bottom: 20px; padding: 10px 20px; }
35
- .refresh-btn:hover { background: #3a3a45; }
36
- .loading { text-align: center; padding: 40px; color: #8e8e9e; }
37
- .project-details { font-size: 0.75rem; color: #aaa; margin-top: 4px; }
38
- .config-section { background: rgba(255,255,255,0.05); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
39
- .config-section h3 { color: #25D366; margin-bottom: 12px; }
40
- .config-section pre { background: #0a0a0f; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 0.7rem; color: #8e8e9e; }
41
- </style>
42
- </head>
43
- <body>
44
- <div class="container">
45
- <h1><i class="fas fa-crown"></i> Elite Visuals – Admin Panel</h1>
46
- <p class="subtitle"><i class="fas fa-chart-line"></i> Manage projects, update status, track everything</p>
47
-
48
- <div class="config-section">
49
- <h3><i class="fas fa-database"></i> Firebase Configuration</h3>
50
- <p style="color: #aaa; font-size: 0.8rem; margin-bottom: 10px;">Copy and paste your Firebase config here (for direct database access):</p>
51
- <textarea id="firebaseConfigInput" rows="5" style="width: 100%; background: #0a0a0f; border: 1px solid #2a2a35; border-radius: 8px; color: #8e8e9e; padding: 12px; font-family: monospace; font-size: 0.7rem;" placeholder='{
52
- "apiKey": "YOUR_API_KEY",
53
- "authDomain": "YOUR_PROJECT.firebaseapp.com",
54
- "databaseURL": "https://YOUR_PROJECT-default-rtdb.firebaseio.com",
55
- "projectId": "YOUR_PROJECT",
56
- "storageBucket": "YOUR_PROJECT.firebasestorage.app",
57
- "appId": "YOUR_APP_ID"
58
- }'></textarea>
59
- <button id="connectFirebaseBtn" style="margin-top: 10px; background: #25D366;"><i class="fas fa-plug"></i> Connect to Firebase</button>
60
- <div id="connectionStatus" style="margin-top: 10px; font-size: 0.8rem;"></div>
61
- </div>
62
-
63
- <div class="stats" id="statsContainer">
64
- <div class="stat-card"><h3>Total Projects</h3><div class="number" id="totalProjects">0</div></div>
65
- <div class="stat-card"><h3>Pending</h3><div class="number" id="pendingCount">0</div></div>
66
- <div class="stat-card"><h3>In Progress</h3><div class="number" id="progressCount">0</div></div>
67
- <div class="stat-card"><h3>Completed</h3><div class="number" id="completedCount">0</div></div>
68
- </div>
69
-
70
- <button class="refresh-btn" id="refreshBtn"><i class="fas fa-sync-alt"></i> Refresh Data</button>
71
-
72
- <div class="projects-table">
73
- <table id="projectsTable">
74
- <thead>
75
- <tr><th>Project ID</th><th>User ID</th><th>Requirements</th><th>Price (PKR)</th><th>Timeline (days)</th><th>Status</th><th>Actions</th></tr>
76
- </thead>
77
- <tbody id="projectsTableBody">
78
- <tr><td colspan="7" class="loading">Loading projects... <i class="fas fa-spinner fa-spin"></i></td></tr>
79
- </tbody>
80
- </table>
81
- </div>
82
- </div>
83
-
84
- <script>
85
- let dbRef = null;
86
- let currentProjects = [];
87
-
88
- function showConnectionStatus(message, isError = false) {
89
- const statusDiv = document.getElementById('connectionStatus');
90
- statusDiv.innerHTML = `<span style="color: ${isError ? '#ff6b6b' : '#25D366'}">${message}</span>`;
91
- }
92
-
93
- document.getElementById('connectFirebaseBtn').addEventListener('click', () => {
94
- try {
95
- const configText = document.getElementById('firebaseConfigInput').value.trim();
96
- if (!configText) {
97
- showConnectionStatus('Please paste Firebase configuration', true);
98
- return;
99
- }
100
- const firebaseConfig = JSON.parse(configText);
101
- // Initialize Firebase
102
- if (firebase.apps.length) {
103
- firebase.apps[0].delete();
104
- }
105
- firebase.initializeApp(firebaseConfig);
106
- const database = firebase.database();
107
- dbRef = database.ref();
108
- showConnectionStatus('✅ Connected to Firebase successfully! Click Refresh to load data.');
109
- loadProjects();
110
- } catch (e) {
111
- showConnectionStatus('❌ Invalid config: ' + e.message, true);
112
- }
113
- });
114
-
115
- async function loadProjects() {
116
- if (!dbRef) {
117
- document.getElementById('projectsTableBody').innerHTML = '<tr><td colspan="7" class="loading">⚠️ Please connect to Firebase first (paste config above)</td></tr>';
118
- return;
119
- }
120
- document.getElementById('projectsTableBody').innerHTML = '<tr><td colspan="7" class="loading">Loading... <i class="fas fa-spinner fa-spin"></i></td></tr>';
121
-
122
- try {
123
- const snapshot = await dbRef.child('projects').once('value');
124
- const data = snapshot.val();
125
- currentProjects = [];
126
- if (data) {
127
- for (let key in data) {
128
- currentProjects.push({ id: key, ...data[key] });
129
- }
130
- }
131
- renderTable();
132
- updateStats();
133
- } catch (e) {
134
- document.getElementById('projectsTableBody').innerHTML = `<tr><td colspan="7" class="loading">❌ Error: ${e.message}</td></tr>`;
135
- }
136
- }
137
-
138
- function renderTable() {
139
- const tbody = document.getElementById('projectsTableBody');
140
- if (currentProjects.length === 0) {
141
- tbody.innerHTML = '<tr><td colspan="7" class="loading">No projects found</td></tr>';
142
- return;
143
- }
144
-
145
- tbody.innerHTML = '';
146
- currentProjects.forEach(proj => {
147
- const req = proj.requirements || {};
148
- const price = req.calculated_price || 0;
149
- const timeline = req.calculated_timeline || 0;
150
- const statusClass = proj.status === 'pending' ? 'status-pending' : (proj.status === 'in-progress' ? 'status-progress' : 'status-completed');
151
- const statusText = proj.status === 'pending' ? '⏳ Pending' : (proj.status === 'in-progress' ? '🔄 In Progress' : '✅ Completed');
152
-
153
- const row = document.createElement('tr');
154
- row.innerHTML = `
155
- <td><code>${proj.project_id || proj.id}</code></td>
156
- <td><small>${(proj.user_id || '').substring(0, 20)}...</small></td>
157
- <td>
158
- <small>📄 Pages: ${req.pages || 5}</small><br>
159
- <small>🛒 E‑com: ${req.ecommerce ? 'Yes' : 'No'}</small><br>
160
- <small>🤖 Chatbot: ${req.chatbot ? 'Yes' : 'No'}</small><br>
161
- <small>🔍 SEO: ${req.seo ? 'Yes' : 'No'}</small>
162
- </td>
163
- <td><strong>PKR ${price.toLocaleString()}</strong></td>
164
- <td>${timeline} days</td>
165
- <td><span class="status-badge ${statusClass}">${statusText}</span></td>
166
- <td>
167
- <select id="status-select-${proj.project_id}" onchange="updateStatus('${proj.project_id}', this.value)">
168
- <option value="pending" ${proj.status === 'pending' ? 'selected' : ''}>⏳ Pending</option>
169
- <option value="in-progress" ${proj.status === 'in-progress' ? 'selected' : ''}>🔄 In Progress</option>
170
- <option value="completed" ${proj.status === 'completed' ? 'selected' : ''}>✅ Completed</option>
171
- </select>
172
- </td>
173
- `;
174
- tbody.appendChild(row);
175
- });
176
- }
177
-
178
- function updateStats() {
179
- const total = currentProjects.length;
180
- const pending = currentProjects.filter(p => p.status === 'pending').length;
181
- const progress = currentProjects.filter(p => p.status === 'in-progress').length;
182
- const completed = currentProjects.filter(p => p.status === 'completed').length;
183
-
184
- document.getElementById('totalProjects').innerText = total;
185
- document.getElementById('pendingCount').innerText = pending;
186
- document.getElementById('progressCount').innerText = progress;
187
- document.getElementById('completedCount').innerText = completed;
188
- }
189
-
190
- window.updateStatus = async (projectId, newStatus) => {
191
- if (!dbRef) return;
192
- try {
193
- await dbRef.child(`projects/${projectId}`).update({ status: newStatus, updated_at: new Date().toISOString() });
194
- showConnectionStatus(`✅ Project ${projectId} updated to ${newStatus}`);
195
- loadProjects(); // refresh
196
- } catch (e) {
197
- showConnectionStatus(`❌ Error: ${e.message}`, true);
198
- }
199
- };
200
-
201
- document.getElementById('refreshBtn').addEventListener('click', () => {
202
- if (dbRef) loadProjects();
203
- else showConnectionStatus('Please connect to Firebase first', true);
204
- });
205
-
206
- // Sample config pre-fill (user will replace with their own)
207
- document.getElementById('firebaseConfigInput').value = `{
208
- "apiKey": "YOUR_API_KEY_HERE",
209
- "authDomain": "your-project.firebaseapp.com",
210
- "databaseURL": "https://your-project-default-rtdb.firebaseio.com",
211
- "projectId": "your-project",
212
- "storageBucket": "your-project.firebasestorage.app",
213
- "appId": "your-app-id"
214
- }`;
215
- </script>
216
- </body>
217
- </html>