Ahmad140 commited on
Commit
622e0f5
Β·
verified Β·
1 Parent(s): 81ab12e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +102 -102
index.html CHANGED
@@ -3,131 +3,131 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Elite Visuals AI – Website Builder</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
  <style>
10
  * { margin: 0; padding: 0; box-sizing: border-box; }
11
- body { background: linear-gradient(135deg, #0a0a0f 0%, #12121a 100%); font-family: 'Inter', sans-serif; height: 100vh; overflow: hidden; }
12
-
13
- .chat-icon { position: fixed; bottom: 28px; right: 28px; width: 64px; height: 64px; background: linear-gradient(145deg, #25D366, #128C7E); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: pulse 1.8s infinite; z-index: 1000; }
14
- @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(37,211,102,0.5); } 70% { box-shadow: 0 0 0 15px rgba(37,211,102,0); } 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); } }
15
- .chat-icon:hover { transform: scale(1.08); background: #20b859; }
16
- .chat-icon i { font-size: 32px; color: white; }
17
-
18
- .chat-modal { position: fixed; bottom: 100px; right: 28px; width: 420px; height: 620px; background: rgba(255,255,255,0.98); border-radius: 28px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35); display: none; flex-direction: column; overflow: hidden; z-index: 1001; animation: slideUpFade 0.3s ease-out; }
19
- @keyframes slideUpFade { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
20
-
21
- .chat-header { background: linear-gradient(135deg, #075E54, #0b3b32); color: white; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; }
22
- .close-btn { background: rgba(255,255,255,0.2); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: white; transition: 0.2s; }
23
- .close-btn:hover { transform: rotate(90deg); background: rgba(255,255,255,0.4); }
24
-
25
- .chat-messages { flex: 1; padding: 16px; overflow-y: auto; background: #f0f2f5; display: flex; flex-direction: column; gap: 12px; }
26
- .message { max-width: 85%; padding: 10px 14px; border-radius: 22px; font-size: 0.85rem; line-height: 1.45; white-space: pre-line; animation: fadeIn 0.25s; }
27
- @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
28
- .user-msg { background: #DCF8C6; margin-left: auto; border-bottom-right-radius: 6px; }
29
- .bot-msg { background: white; margin-right: auto; border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
30
-
31
- .status-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.7rem; margin-left: 8px; }
32
  .status-pending { background: #ffc107; color: #333; }
33
  .status-progress { background: #17a2b8; color: white; }
34
  .status-completed { background: #28a745; color: white; }
35
-
36
- .input-container { padding: 12px; background: white; border-top: 1px solid #ddd; }
37
- .input-box { display: flex; gap: 8px; align-items: center; background: #f0f2f5; border-radius: 40px; padding: 5px 15px; }
38
- .input-box input { flex: 1; background: transparent; border: none; padding: 12px 8px; font-size: 0.9rem; outline: none; }
39
- .input-box button { background: #25D366; border: none; width: 42px; height: 42px; border-radius: 50%; color: white; cursor: pointer; transition: 0.2s; }
40
- .input-box button:hover { background: #128C7E; transform: scale(1.02); }
41
-
42
- .typing { display: flex; gap: 6px; padding: 5px 0; }
43
- .typing span { width: 8px; height: 8px; background: #aaa; border-radius: 50%; animation: wave 1.2s infinite; }
44
- @keyframes wave { 0%,60%,100% { opacity: 0.3; } 30% { opacity: 1; transform: translateY(-3px); } }
45
-
46
- .project-id { background: #1e2a3a; color: #ffd700; padding: 2px 6px; border-radius: 6px; font-family: monospace; }
47
-
48
- /* Project status panel */
49
- .status-panel { background: white; border-radius: 16px; padding: 12px; margin: 8px 0; border-left: 4px solid #25D366; }
50
  </style>
51
  </head>
52
  <body>
53
- <div class="chat-icon" id="chatIcon"><i class="fas fa-comment-dots"></i></div>
54
- <div class="chat-modal" id="chatModal">
55
- <div class="chat-header">
56
- <h3><i class="fas fa-robot"></i> Elite Visuals AI</h3>
57
- <button class="close-btn" id="closeChat"><i class="fas fa-times"></i></button>
58
- </div>
59
- <div class="chat-messages" id="chatMessages">
60
- <div class="message bot-msg">πŸ‘‹ Assalam-o-Alaikum! I'm Elite Visuals AI. I can help you plan your website project step by step. Type <strong>"I want to build a website"</strong> to start.</div>
 
61
  </div>
62
- <div class="input-container">
63
- <div class="input-box">
64
- <input type="text" id="userInput" placeholder="Type your message...">
65
- <button id="sendBtn"><i class="fas fa-arrow-right"></i></button>
66
- </div>
 
 
 
 
 
 
 
67
  </div>
68
  </div>
69
 
70
  <script>
71
- let userId = localStorage.getItem('chat_user_id');
72
- if (!userId) {
73
- userId = 'user_' + Date.now() + '_' + Math.random().toString(36).substr(2, 8);
74
- localStorage.setItem('chat_user_id', userId);
75
- }
76
-
77
- const chatIcon = document.getElementById('chatIcon');
78
- const chatModal = document.getElementById('chatModal');
79
- const closeChat = document.getElementById('closeChat');
80
- const sendBtn = document.getElementById('sendBtn');
81
- const userInput = document.getElementById('userInput');
82
- const chatMessages = document.getElementById('chatMessages');
83
-
84
- chatIcon.onclick = () => chatModal.style.display = 'flex';
85
- closeChat.onclick = () => chatModal.style.display = 'none';
86
-
87
- function addMessage(text, sender) {
88
- const div = document.createElement('div');
89
- div.className = `message ${sender === 'user' ? 'user-msg' : 'bot-msg'}`;
90
- div.innerHTML = text.replace(/\n/g, '<br>');
91
- chatMessages.appendChild(div);
92
- chatMessages.scrollTop = chatMessages.scrollHeight;
93
- }
94
-
95
- let typingDiv = null;
96
- function showTyping() {
97
- if (typingDiv) return;
98
- typingDiv = document.createElement('div');
99
- typingDiv.className = 'message bot-msg typing';
100
- typingDiv.innerHTML = '<span></span><span></span><span></span>';
101
- chatMessages.appendChild(typingDiv);
102
- chatMessages.scrollTop = chatMessages.scrollHeight;
103
- }
104
- function hideTyping() {
105
- if (typingDiv) { typingDiv.remove(); typingDiv = null; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
107
 
108
- async function sendMessage() {
109
- const msg = userInput.value.trim();
110
- if (!msg) return;
111
- addMessage(msg, 'user');
112
- userInput.value = '';
113
- showTyping();
114
  try {
115
- const res = await fetch('/api/chat', {
116
- method: 'POST',
117
  headers: { 'Content-Type': 'application/json' },
118
- body: JSON.stringify({ user_id: userId, message: msg })
119
  });
120
- const data = await res.json();
121
- hideTyping();
122
- addMessage(data.reply, 'bot');
123
  } catch (err) {
124
- hideTyping();
125
- addMessage("❌ Server error. Please try again.", 'bot');
126
  }
127
- }
128
 
129
- sendBtn.onclick = sendMessage;
130
- userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') sendMessage(); });
131
  </script>
132
  </body>
133
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Elite Visuals – Admin Panel</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
  <style>
10
  * { margin: 0; padding: 0; box-sizing: border-box; }
11
+ body { background: linear-gradient(135deg, #0a0a0f 0%, #12121a 100%); font-family: 'Inter', sans-serif; min-height: 100vh; padding: 30px; }
12
+ .container { max-width: 1400px; margin: 0 auto; }
13
+ h1 { color: white; margin-bottom: 10px; display: flex; align-items: center; gap: 15px; }
14
+ h1 i { color: #25D366; }
15
+ .subtitle { color: #8e8e9e; margin-bottom: 30px; }
16
+ .stats { display: flex; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
17
+ .stat-card { background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); border-radius: 20px; padding: 20px; min-width: 150px; text-align: center; }
18
+ .stat-card h3 { color: #8e8e9e; font-size: 0.85rem; margin-bottom: 8px; }
19
+ .stat-card .number { font-size: 2rem; font-weight: 700; color: #25D366; }
20
+ .projects-table { background: rgba(255,255,255,0.05); border-radius: 20px; overflow-x: auto; }
21
+ table { width: 100%; border-collapse: collapse; }
22
+ th, td { padding: 15px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.1); color: #e0e0e0; }
23
+ th { background: rgba(0,0,0,0.3); font-weight: 600; color: #25D366; }
24
+ .status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }
 
 
 
 
 
 
 
25
  .status-pending { background: #ffc107; color: #333; }
26
  .status-progress { background: #17a2b8; color: white; }
27
  .status-completed { background: #28a745; color: white; }
28
+ select { background: #1e2a3a; color: white; border: 1px solid #2a2a35; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
29
+ .refresh-btn { background: #25D366; border: none; padding: 10px 20px; border-radius: 12px; color: white; cursor: pointer; margin-bottom: 20px; }
30
+ .refresh-btn:hover { background: #128C7E; }
31
+ .loading { text-align: center; padding: 40px; color: #8e8e9e; }
 
 
 
 
 
 
 
 
 
 
 
32
  </style>
33
  </head>
34
  <body>
35
+ <div class="container">
36
+ <h1><i class="fas fa-crown"></i> Elite Visuals – Admin Panel</h1>
37
+ <p class="subtitle"><i class="fas fa-chart-line"></i> Manage all client projects, update status, track everything</p>
38
+
39
+ <div class="stats">
40
+ <div class="stat-card"><h3>Total Projects</h3><div class="number" id="totalProjects">0</div></div>
41
+ <div class="stat-card"><h3>Pending</h3><div class="number" id="pendingCount">0</div></div>
42
+ <div class="stat-card"><h3>In Progress</h3><div class="number" id="progressCount">0</div></div>
43
+ <div class="stat-card"><h3>Completed</h3><div class="number" id="completedCount">0</div></div>
44
  </div>
45
+
46
+ <button class="refresh-btn" id="refreshBtn"><i class="fas fa-sync-alt"></i> Refresh Data</button>
47
+
48
+ <div class="projects-table">
49
+ <table>
50
+ <thead>
51
+ <tr><th>Project ID</th><th>Domain</th><th>Pages</th><th>E-com</th><th>Chatbot</th><th>SEO</th><th>Price (PKR)</th><th>Timeline</th><th>Status</th><th>Action</th></tr>
52
+ </thead>
53
+ <tbody id="projectsTableBody">
54
+ <tr><td colspan="10" class="loading">Loading projects... <i class="fas fa-spinner fa-spin"></i></td></tr>
55
+ </tbody>
56
+ </table>
57
  </div>
58
  </div>
59
 
60
  <script>
61
+ async function loadProjects() {
62
+ try {
63
+ const res = await fetch('/api/projects');
64
+ const data = await res.json();
65
+ const projects = data.projects || [];
66
+
67
+ const total = projects.length;
68
+ const pending = projects.filter(p => p.status === 'pending').length;
69
+ const progress = projects.filter(p => p.status === 'in-progress').length;
70
+ const completed = projects.filter(p => p.status === 'completed').length;
71
+
72
+ document.getElementById('totalProjects').innerText = total;
73
+ document.getElementById('pendingCount').innerText = pending;
74
+ document.getElementById('progressCount').innerText = progress;
75
+ document.getElementById('completedCount').innerText = completed;
76
+
77
+ const tbody = document.getElementById('projectsTableBody');
78
+ if (projects.length === 0) {
79
+ tbody.innerHTML = '<tr><td colspan="10" class="loading">No projects found</td></tr>';
80
+ return;
81
+ }
82
+
83
+ tbody.innerHTML = '';
84
+ projects.forEach(proj => {
85
+ const req = proj.requirements || {};
86
+ const statusClass = proj.status === 'pending' ? 'status-pending' : (proj.status === 'in-progress' ? 'status-progress' : 'status-completed');
87
+ const statusText = proj.status === 'pending' ? '⏳ Pending' : (proj.status === 'in-progress' ? 'πŸ”„ In Progress' : 'βœ… Completed');
88
+
89
+ const row = document.createElement('tr');
90
+ row.innerHTML = `
91
+ <td><code>${proj.project_id}</code></td>
92
+ <td>${req.domain ? 'βœ… Yes' : '❌ No'}</td>
93
+ <td>${req.pages || 5}</td>
94
+ <td>${req.ecommerce ? 'βœ…' : '❌'}</td>
95
+ <td>${req.chatbot ? 'βœ…' : '❌'}</td>
96
+ <td>${req.seo ? 'βœ…' : '❌'}</td>
97
+ <td><strong>PKR ${(proj.calculated_price || 0).toLocaleString()}</strong></td>
98
+ <td>${proj.calculated_timeline || 0} days</td>
99
+ <td><span class="status-badge ${statusClass}">${statusText}</span></td>
100
+ <td>
101
+ <select onchange="updateStatus('${proj.project_id}', this.value)">
102
+ <option value="pending" ${proj.status === 'pending' ? 'selected' : ''}>⏳ Pending</option>
103
+ <option value="in-progress" ${proj.status === 'in-progress' ? 'selected' : ''}>πŸ”„ In Progress</option>
104
+ <option value="completed" ${proj.status === 'completed' ? 'selected' : ''}>βœ… Completed</option>
105
+ </select>
106
+ </td>
107
+ `;
108
+ tbody.appendChild(row);
109
+ });
110
+ } catch (err) {
111
+ console.error(err);
112
+ document.getElementById('projectsTableBody').innerHTML = '<tr><td colspan="10" class="loading">Error loading projects</td></tr>';
113
+ }
114
  }
115
 
116
+ window.updateStatus = async (projectId, newStatus) => {
 
 
 
 
 
117
  try {
118
+ await fetch(`/api/project/${projectId}/status`, {
119
+ method: 'PUT',
120
  headers: { 'Content-Type': 'application/json' },
121
+ body: JSON.stringify({ status: newStatus })
122
  });
123
+ loadProjects(); // refresh
 
 
124
  } catch (err) {
125
+ alert('Error updating status');
 
126
  }
127
+ };
128
 
129
+ document.getElementById('refreshBtn').addEventListener('click', loadProjects);
130
+ loadProjects();
131
  </script>
132
  </body>
133
  </html>