Update index.html
Browse files- index.html +51 -18
index.html
CHANGED
|
@@ -7,27 +7,24 @@
|
|
| 7 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 8 |
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;400;500;600;700&display=swap" rel="stylesheet">
|
| 9 |
<style>
|
|
|
|
| 10 |
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 11 |
body { background: linear-gradient(135deg, #f5f7fa 0%, #e9eef5 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: 580px; height: 680px; 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 |
.chat-header { background: linear-gradient(135deg, #075E54, #0b3b32); color: white; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; }
|
| 21 |
.header-buttons { display: flex; gap: 10px; align-items: center; }
|
| 22 |
.header-btn { background: rgba(255,255,255,0.2); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: white; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; }
|
| 23 |
.header-btn:hover { transform: scale(1.05); background: rgba(255,255,255,0.4); }
|
| 24 |
-
|
| 25 |
.chat-invoice-container { display: flex; flex: 1; overflow: hidden; transition: all 0.3s ease; }
|
| 26 |
.chat-column { flex: 1.5; display: flex; flex-direction: column; background: #f0f2f5; transition: all 0.3s ease; }
|
| 27 |
.invoice-column { width: 40%; background: #fff8f0; border-left: 1px solid #ddd; display: flex; flex-direction: column; overflow-y: auto; padding: 12px; gap: 12px; transition: all 0.3s ease; }
|
| 28 |
.invoice-column.hidden { display: none; width: 0; padding: 0; }
|
| 29 |
.chat-column.expanded { flex: 1; }
|
| 30 |
-
|
| 31 |
.invoice-title { font-weight: 700; font-size: 1rem; color: #075E54; border-bottom: 2px solid #25D366; padding-bottom: 6px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
|
| 32 |
.invoice-items { flex: 1; overflow-y: auto; max-height: 280px; }
|
| 33 |
.invoice-item { background: white; border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
|
|
@@ -37,20 +34,19 @@
|
|
| 37 |
.remove-item:hover { transform: scale(1.1); }
|
| 38 |
.invoice-total { border-top: 2px dashed #ccc; padding-top: 10px; margin-top: 8px; font-weight: 700; font-size: 0.9rem; display: flex; justify-content: space-between; }
|
| 39 |
.empty-invoice { color: #888; font-size: 0.75rem; text-align: center; padding: 20px; }
|
| 40 |
-
.final-report-btn { background: #25D366; color: white; border: none; border-radius: 25px; padding: 8px 12px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: 0.2s; width: 100%; margin-top: 8px; }
|
|
|
|
| 41 |
.final-report-btn:hover { background: #128C7E; transform: scale(1.02); }
|
| 42 |
-
|
| 43 |
.chat-messages { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
|
| 44 |
.message { max-width: 85%; padding: 8px 12px; border-radius: 18px; font-size: 0.8rem; line-height: 1.4; white-space: pre-line; animation: fadeIn 0.2s; }
|
| 45 |
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
|
| 46 |
.user-msg { background: #DCF8C6; margin-left: auto; border-bottom-right-radius: 4px; }
|
| 47 |
.bot-msg { background: white; margin-right: auto; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
|
| 48 |
-
|
| 49 |
.bot-message-wrapper { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 85%; margin-right: auto; }
|
| 50 |
.bot-message-wrapper .message { margin: 0; max-width: 100%; }
|
| 51 |
.confirm-btn { background: #25D366; color: white; border: none; border-radius: 20px; padding: 4px 12px; font-size: 0.7rem; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 4px; }
|
| 52 |
.confirm-btn:hover { background: #128C7E; transform: scale(1.02); }
|
| 53 |
-
|
| 54 |
.live-widget { background: white; border-radius: 16px; margin: 8px 8px 0 8px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
|
| 55 |
.widget-header { background: linear-gradient(135deg, #1e2a3a, #0f172a); color: white; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; font-weight: 600; }
|
| 56 |
.widget-controls { display: flex; gap: 10px; }
|
|
@@ -61,11 +57,9 @@
|
|
| 61 |
.widget-content.show { display: block; }
|
| 62 |
.info-row { margin: 4px 0; }
|
| 63 |
.info-label { font-weight: 700; color: #075E54; }
|
| 64 |
-
|
| 65 |
.questions-container { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px; }
|
| 66 |
.question-bubble { background: #e4e6eb; padding: 4px 10px; border-radius: 16px; font-size: 0.7rem; cursor: pointer; transition: 0.2s; }
|
| 67 |
.question-bubble:hover { background: #d1d4db; transform: translateY(-1px); }
|
| 68 |
-
|
| 69 |
.typing-indicator { background: white; padding: 6px 12px; border-radius: 20px; display: inline-flex; gap: 4px; width: fit-content; }
|
| 70 |
.typing-indicator span { width: 6px; height: 6px; background: #888; border-radius: 50%; animation: wave 1.2s infinite; }
|
| 71 |
@keyframes wave { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
|
|
@@ -85,7 +79,6 @@
|
|
| 85 |
</div>
|
| 86 |
</div>
|
| 87 |
<div class="chat-invoice-container" id="chatInvoiceContainer">
|
| 88 |
-
<!-- Chat Column -->
|
| 89 |
<div class="chat-column" id="chatColumn">
|
| 90 |
<div class="chat-messages" id="chatMessages">
|
| 91 |
<div class="message bot-msg">✨ Assalam-o-Alaikum! I can help you with website packages, extra features, and **step-by-step project building**. To start a new project, simply say: **"I want to build a website"** – I'll ask you all the requirements and then generate a proposal, project ID, and total invoice. You can also ask about packages or use the confirm buttons below.</div>
|
|
@@ -110,7 +103,6 @@
|
|
| 110 |
<button id="sendBtn"><i class="fas fa-paper-plane"></i></button>
|
| 111 |
</div>
|
| 112 |
</div>
|
| 113 |
-
<!-- Invoice Column -->
|
| 114 |
<div class="invoice-column" id="invoiceColumn">
|
| 115 |
<div class="invoice-title">
|
| 116 |
<span>🧾 Your Quote</span>
|
|
@@ -123,6 +115,7 @@
|
|
| 123 |
<span id="totalAmount">PKR 0</span>
|
| 124 |
</div>
|
| 125 |
<button class="final-report-btn" id="finalReportBtn"><i class="fas fa-file-alt"></i> Generate Final Report</button>
|
|
|
|
| 126 |
</div>
|
| 127 |
</div>
|
| 128 |
</div>
|
|
@@ -210,6 +203,7 @@
|
|
| 210 |
return true;
|
| 211 |
}
|
| 212 |
|
|
|
|
| 213 |
function generateFinalReport() {
|
| 214 |
if (invoiceItems.length === 0) {
|
| 215 |
addMessageWithConfirm("❌ You haven't added any services yet. Please confirm some packages or features first.", 'bot');
|
|
@@ -238,14 +232,53 @@
|
|
| 238 |
addMessageWithConfirm(report, 'bot');
|
| 239 |
}
|
| 240 |
|
| 241 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
const widgetContent = document.getElementById('widgetContent');
|
| 243 |
const toggleIcon = document.getElementById('toggleIcon');
|
| 244 |
const hideWidgetBtn = document.getElementById('hideWidgetBtn');
|
| 245 |
const unhideWidgetBtn = document.getElementById('unhideWidgetBtn');
|
| 246 |
const liveWidget = document.getElementById('liveWidget');
|
| 247 |
let widgetOpen = false;
|
| 248 |
-
|
| 249 |
toggleIcon.addEventListener('click', (e) => {
|
| 250 |
e.stopPropagation();
|
| 251 |
if (widgetOpen) {
|
|
@@ -259,7 +292,6 @@
|
|
| 259 |
}
|
| 260 |
widgetOpen = !widgetOpen;
|
| 261 |
});
|
| 262 |
-
|
| 263 |
hideWidgetBtn.addEventListener('click', () => {
|
| 264 |
liveWidget.style.display = 'none';
|
| 265 |
hideWidgetBtn.style.display = 'none';
|
|
@@ -270,7 +302,6 @@
|
|
| 270 |
hideWidgetBtn.style.display = 'inline-flex';
|
| 271 |
unhideWidgetBtn.style.display = 'none';
|
| 272 |
});
|
| 273 |
-
|
| 274 |
function updateWidget(data) {
|
| 275 |
const widgetEmptyMsg = document.getElementById('widgetEmptyMsg');
|
| 276 |
const widgetDetailsDiv = document.getElementById('widgetDetails');
|
|
@@ -306,7 +337,7 @@
|
|
| 306 |
widgetDetailsDiv.style.display = 'block';
|
| 307 |
}
|
| 308 |
|
| 309 |
-
// Message with Confirm Button
|
| 310 |
function addMessageWithConfirm(text, sender, widgetData = null) {
|
| 311 |
const chatMessagesDiv = document.getElementById('chatMessages');
|
| 312 |
if (sender === 'user') {
|
|
@@ -360,7 +391,7 @@
|
|
| 360 |
chatMessagesDiv.scrollTop = chatMessagesDiv.scrollHeight;
|
| 361 |
}
|
| 362 |
|
| 363 |
-
//
|
| 364 |
const chatIcon = document.getElementById('chatIcon');
|
| 365 |
const chatModal = document.getElementById('chatModal');
|
| 366 |
const closeChat = document.getElementById('closeChat');
|
|
@@ -369,7 +400,9 @@
|
|
| 369 |
const chatMessagesDiv = document.getElementById('chatMessages');
|
| 370 |
const questionsContainer = document.getElementById('defaultQuestionsContainer');
|
| 371 |
const finalReportBtn = document.getElementById('finalReportBtn');
|
|
|
|
| 372 |
finalReportBtn.addEventListener('click', () => generateFinalReport());
|
|
|
|
| 373 |
|
| 374 |
const invoiceColumn = document.getElementById('invoiceColumn');
|
| 375 |
const chatColumn = document.getElementById('chatColumn');
|
|
|
|
| 7 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 8 |
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;400;500;600;700&display=swap" rel="stylesheet">
|
| 9 |
<style>
|
| 10 |
+
/* (Keep all your existing CSS exactly as before) */
|
| 11 |
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 12 |
body { background: linear-gradient(135deg, #f5f7fa 0%, #e9eef5 100%); font-family: 'Inter', sans-serif; height: 100vh; overflow: hidden; }
|
|
|
|
| 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 |
.chat-modal { position: fixed; bottom: 100px; right: 28px; width: 580px; height: 680px; 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; }
|
| 18 |
@keyframes slideUpFade { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
|
| 19 |
.chat-header { background: linear-gradient(135deg, #075E54, #0b3b32); color: white; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; }
|
| 20 |
.header-buttons { display: flex; gap: 10px; align-items: center; }
|
| 21 |
.header-btn { background: rgba(255,255,255,0.2); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: white; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; }
|
| 22 |
.header-btn:hover { transform: scale(1.05); background: rgba(255,255,255,0.4); }
|
|
|
|
| 23 |
.chat-invoice-container { display: flex; flex: 1; overflow: hidden; transition: all 0.3s ease; }
|
| 24 |
.chat-column { flex: 1.5; display: flex; flex-direction: column; background: #f0f2f5; transition: all 0.3s ease; }
|
| 25 |
.invoice-column { width: 40%; background: #fff8f0; border-left: 1px solid #ddd; display: flex; flex-direction: column; overflow-y: auto; padding: 12px; gap: 12px; transition: all 0.3s ease; }
|
| 26 |
.invoice-column.hidden { display: none; width: 0; padding: 0; }
|
| 27 |
.chat-column.expanded { flex: 1; }
|
|
|
|
| 28 |
.invoice-title { font-weight: 700; font-size: 1rem; color: #075E54; border-bottom: 2px solid #25D366; padding-bottom: 6px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
|
| 29 |
.invoice-items { flex: 1; overflow-y: auto; max-height: 280px; }
|
| 30 |
.invoice-item { background: white; border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
|
|
|
|
| 34 |
.remove-item:hover { transform: scale(1.1); }
|
| 35 |
.invoice-total { border-top: 2px dashed #ccc; padding-top: 10px; margin-top: 8px; font-weight: 700; font-size: 0.9rem; display: flex; justify-content: space-between; }
|
| 36 |
.empty-invoice { color: #888; font-size: 0.75rem; text-align: center; padding: 20px; }
|
| 37 |
+
.final-report-btn, .download-report-btn { background: #25D366; color: white; border: none; border-radius: 25px; padding: 8px 12px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: 0.2s; width: 100%; margin-top: 8px; }
|
| 38 |
+
.download-report-btn { background: #2a6d4c; margin-top: 4px; }
|
| 39 |
.final-report-btn:hover { background: #128C7E; transform: scale(1.02); }
|
| 40 |
+
.download-report-btn:hover { background: #1e5a3e; transform: scale(1.02); }
|
| 41 |
.chat-messages { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
|
| 42 |
.message { max-width: 85%; padding: 8px 12px; border-radius: 18px; font-size: 0.8rem; line-height: 1.4; white-space: pre-line; animation: fadeIn 0.2s; }
|
| 43 |
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
|
| 44 |
.user-msg { background: #DCF8C6; margin-left: auto; border-bottom-right-radius: 4px; }
|
| 45 |
.bot-msg { background: white; margin-right: auto; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
|
|
|
|
| 46 |
.bot-message-wrapper { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 85%; margin-right: auto; }
|
| 47 |
.bot-message-wrapper .message { margin: 0; max-width: 100%; }
|
| 48 |
.confirm-btn { background: #25D366; color: white; border: none; border-radius: 20px; padding: 4px 12px; font-size: 0.7rem; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 4px; }
|
| 49 |
.confirm-btn:hover { background: #128C7E; transform: scale(1.02); }
|
|
|
|
| 50 |
.live-widget { background: white; border-radius: 16px; margin: 8px 8px 0 8px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
|
| 51 |
.widget-header { background: linear-gradient(135deg, #1e2a3a, #0f172a); color: white; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; font-weight: 600; }
|
| 52 |
.widget-controls { display: flex; gap: 10px; }
|
|
|
|
| 57 |
.widget-content.show { display: block; }
|
| 58 |
.info-row { margin: 4px 0; }
|
| 59 |
.info-label { font-weight: 700; color: #075E54; }
|
|
|
|
| 60 |
.questions-container { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px; }
|
| 61 |
.question-bubble { background: #e4e6eb; padding: 4px 10px; border-radius: 16px; font-size: 0.7rem; cursor: pointer; transition: 0.2s; }
|
| 62 |
.question-bubble:hover { background: #d1d4db; transform: translateY(-1px); }
|
|
|
|
| 63 |
.typing-indicator { background: white; padding: 6px 12px; border-radius: 20px; display: inline-flex; gap: 4px; width: fit-content; }
|
| 64 |
.typing-indicator span { width: 6px; height: 6px; background: #888; border-radius: 50%; animation: wave 1.2s infinite; }
|
| 65 |
@keyframes wave { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
|
|
|
|
| 79 |
</div>
|
| 80 |
</div>
|
| 81 |
<div class="chat-invoice-container" id="chatInvoiceContainer">
|
|
|
|
| 82 |
<div class="chat-column" id="chatColumn">
|
| 83 |
<div class="chat-messages" id="chatMessages">
|
| 84 |
<div class="message bot-msg">✨ Assalam-o-Alaikum! I can help you with website packages, extra features, and **step-by-step project building**. To start a new project, simply say: **"I want to build a website"** – I'll ask you all the requirements and then generate a proposal, project ID, and total invoice. You can also ask about packages or use the confirm buttons below.</div>
|
|
|
|
| 103 |
<button id="sendBtn"><i class="fas fa-paper-plane"></i></button>
|
| 104 |
</div>
|
| 105 |
</div>
|
|
|
|
| 106 |
<div class="invoice-column" id="invoiceColumn">
|
| 107 |
<div class="invoice-title">
|
| 108 |
<span>🧾 Your Quote</span>
|
|
|
|
| 115 |
<span id="totalAmount">PKR 0</span>
|
| 116 |
</div>
|
| 117 |
<button class="final-report-btn" id="finalReportBtn"><i class="fas fa-file-alt"></i> Generate Final Report</button>
|
| 118 |
+
<button class="download-report-btn" id="downloadReportBtn"><i class="fas fa-download"></i> Download Report</button>
|
| 119 |
</div>
|
| 120 |
</div>
|
| 121 |
</div>
|
|
|
|
| 203 |
return true;
|
| 204 |
}
|
| 205 |
|
| 206 |
+
// ---------- Generate Final Report (text in chat) ----------
|
| 207 |
function generateFinalReport() {
|
| 208 |
if (invoiceItems.length === 0) {
|
| 209 |
addMessageWithConfirm("❌ You haven't added any services yet. Please confirm some packages or features first.", 'bot');
|
|
|
|
| 232 |
addMessageWithConfirm(report, 'bot');
|
| 233 |
}
|
| 234 |
|
| 235 |
+
// ---------- Download Report (as .txt file) ----------
|
| 236 |
+
function downloadReport() {
|
| 237 |
+
if (invoiceItems.length === 0) {
|
| 238 |
+
alert("No services selected. Please add items to your quote first.");
|
| 239 |
+
return;
|
| 240 |
+
}
|
| 241 |
+
let content = "ELITE VISUALS – QUOTE REPORT\n";
|
| 242 |
+
content += "==========================\n\n";
|
| 243 |
+
content += `Date: ${new Date().toLocaleString()}\n`;
|
| 244 |
+
content += `Session ID: ${sessionId}\n\n`;
|
| 245 |
+
content += "Selected Services:\n";
|
| 246 |
+
content += "-----------------\n";
|
| 247 |
+
let totalPrice = 0;
|
| 248 |
+
let totalDays = 0;
|
| 249 |
+
invoiceItems.forEach(item => {
|
| 250 |
+
const priceNum = parsePrice(item.price);
|
| 251 |
+
totalPrice += priceNum;
|
| 252 |
+
content += `• ${item.name}: ${item.price}\n`;
|
| 253 |
+
if (item.timelineDays) {
|
| 254 |
+
totalDays += item.timelineDays;
|
| 255 |
+
content += ` (est. timeline: ${item.timelineDays} days)\n`;
|
| 256 |
+
}
|
| 257 |
+
});
|
| 258 |
+
content += "\n-----------------\n";
|
| 259 |
+
content += `TOTAL COST: PKR ${totalPrice.toLocaleString()}\n`;
|
| 260 |
+
if (totalDays > 0) content += `CUMULATIVE TIMELINE: ${totalDays} working days\n`;
|
| 261 |
+
content += "\nThis is an estimate. Final quote may vary.\n";
|
| 262 |
+
content += "Contact: hello@elitevisuals.com | +92 300 1234567\n";
|
| 263 |
+
// Create download link
|
| 264 |
+
const blob = new Blob([content], { type: "text/plain" });
|
| 265 |
+
const url = URL.createObjectURL(blob);
|
| 266 |
+
const a = document.createElement("a");
|
| 267 |
+
a.href = url;
|
| 268 |
+
a.download = `quote_${new Date().toISOString().slice(0,19).replace(/:/g, "-")}.txt`;
|
| 269 |
+
document.body.appendChild(a);
|
| 270 |
+
a.click();
|
| 271 |
+
document.body.removeChild(a);
|
| 272 |
+
URL.revokeObjectURL(url);
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
// ---------- Live Widget (same as before) ----------
|
| 276 |
const widgetContent = document.getElementById('widgetContent');
|
| 277 |
const toggleIcon = document.getElementById('toggleIcon');
|
| 278 |
const hideWidgetBtn = document.getElementById('hideWidgetBtn');
|
| 279 |
const unhideWidgetBtn = document.getElementById('unhideWidgetBtn');
|
| 280 |
const liveWidget = document.getElementById('liveWidget');
|
| 281 |
let widgetOpen = false;
|
|
|
|
| 282 |
toggleIcon.addEventListener('click', (e) => {
|
| 283 |
e.stopPropagation();
|
| 284 |
if (widgetOpen) {
|
|
|
|
| 292 |
}
|
| 293 |
widgetOpen = !widgetOpen;
|
| 294 |
});
|
|
|
|
| 295 |
hideWidgetBtn.addEventListener('click', () => {
|
| 296 |
liveWidget.style.display = 'none';
|
| 297 |
hideWidgetBtn.style.display = 'none';
|
|
|
|
| 302 |
hideWidgetBtn.style.display = 'inline-flex';
|
| 303 |
unhideWidgetBtn.style.display = 'none';
|
| 304 |
});
|
|
|
|
| 305 |
function updateWidget(data) {
|
| 306 |
const widgetEmptyMsg = document.getElementById('widgetEmptyMsg');
|
| 307 |
const widgetDetailsDiv = document.getElementById('widgetDetails');
|
|
|
|
| 337 |
widgetDetailsDiv.style.display = 'block';
|
| 338 |
}
|
| 339 |
|
| 340 |
+
// ---------- Message with Confirm Button ----------
|
| 341 |
function addMessageWithConfirm(text, sender, widgetData = null) {
|
| 342 |
const chatMessagesDiv = document.getElementById('chatMessages');
|
| 343 |
if (sender === 'user') {
|
|
|
|
| 391 |
chatMessagesDiv.scrollTop = chatMessagesDiv.scrollHeight;
|
| 392 |
}
|
| 393 |
|
| 394 |
+
// ---------- UI Event Listeners ----------
|
| 395 |
const chatIcon = document.getElementById('chatIcon');
|
| 396 |
const chatModal = document.getElementById('chatModal');
|
| 397 |
const closeChat = document.getElementById('closeChat');
|
|
|
|
| 400 |
const chatMessagesDiv = document.getElementById('chatMessages');
|
| 401 |
const questionsContainer = document.getElementById('defaultQuestionsContainer');
|
| 402 |
const finalReportBtn = document.getElementById('finalReportBtn');
|
| 403 |
+
const downloadReportBtn = document.getElementById('downloadReportBtn');
|
| 404 |
finalReportBtn.addEventListener('click', () => generateFinalReport());
|
| 405 |
+
downloadReportBtn.addEventListener('click', () => downloadReport());
|
| 406 |
|
| 407 |
const invoiceColumn = document.getElementById('invoiceColumn');
|
| 408 |
const chatColumn = document.getElementById('chatColumn');
|