Spaces:
Paused
Paused
Update index.html
Browse files- index.html +89 -3
index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 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
|
| 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; }
|
|
@@ -203,6 +203,91 @@
|
|
| 203 |
return true;
|
| 204 |
}
|
| 205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
// ---------- Generate Final Report (text in chat) ----------
|
| 207 |
function generateFinalReport() {
|
| 208 |
if (invoiceItems.length === 0) {
|
|
@@ -232,7 +317,6 @@
|
|
| 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.");
|
|
@@ -260,7 +344,6 @@
|
|
| 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");
|
|
@@ -355,6 +438,9 @@
|
|
| 355 |
msgDiv.innerText = text;
|
| 356 |
wrapper.appendChild(msgDiv);
|
| 357 |
|
|
|
|
|
|
|
|
|
|
| 358 |
let serviceName = null, servicePrice = null, serviceKey = null, timelineStr = null;
|
| 359 |
if (widgetData) {
|
| 360 |
if (widgetData.package) {
|
|
|
|
| 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 your existing CSS exactly as before – unchanged) */
|
| 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; }
|
|
|
|
| 203 |
return true;
|
| 204 |
}
|
| 205 |
|
| 206 |
+
// ---------- Auto-add services from bot messages ----------
|
| 207 |
+
// Map of keywords to service details (name, price, key)
|
| 208 |
+
const serviceMap = {
|
| 209 |
+
"domain": { name: "Domain Registration", price: "PKR 5,000", key: "domain" },
|
| 210 |
+
"e-commerce": { name: "E‑commerce Functionality", price: "PKR 50,000", key: "ecommerce" },
|
| 211 |
+
"chatbot": { name: "AI Chatbot", price: "PKR 30,000", key: "chatbot" },
|
| 212 |
+
"seo": { name: "SEO Optimization", price: "PKR 25,000", key: "seo" },
|
| 213 |
+
"inventory management": { name: "Inventory Management", price: "PKR 30,000", key: "inventory" },
|
| 214 |
+
"database integration": { name: "Database Integration", price: "PKR 40,000", key: "database" },
|
| 215 |
+
"live chat": { name: "Live Chat", price: "PKR 20,000", key: "live_chat" },
|
| 216 |
+
"booking system": { name: "Booking System", price: "PKR 35,000", key: "booking_system" },
|
| 217 |
+
"multi-language": { name: "Multi-Language", price: "PKR 25,000", key: "multi_language" },
|
| 218 |
+
"custom backend": { name: "Custom Backend", price: "PKR 100,000", key: "custom_backend" }
|
| 219 |
+
};
|
| 220 |
+
|
| 221 |
+
// Extra pages price: base 5 pages included, each extra PKR 5,000
|
| 222 |
+
let currentPages = 5;
|
| 223 |
+
|
| 224 |
+
function autoAddFromBotMessage(text) {
|
| 225 |
+
const lower = text.toLowerCase();
|
| 226 |
+
// Domain
|
| 227 |
+
if (lower.includes("domain: yes") || (lower.includes("need a domain") && lower.includes("yes"))) {
|
| 228 |
+
addInvoiceItem("Domain Registration", "PKR 5,000", "domain");
|
| 229 |
+
}
|
| 230 |
+
// Pages (detect after user enters number)
|
| 231 |
+
const pagesMatch = lower.match(/pages:\s*(\d+)/);
|
| 232 |
+
if (pagesMatch) {
|
| 233 |
+
const pages = parseInt(pagesMatch[1]);
|
| 234 |
+
if (pages !== currentPages) {
|
| 235 |
+
currentPages = pages;
|
| 236 |
+
// Remove existing pages item if any
|
| 237 |
+
invoiceItems = invoiceItems.filter(item => item.serviceKey !== "pages");
|
| 238 |
+
const extraPages = Math.max(0, pages - 5);
|
| 239 |
+
if (extraPages > 0) {
|
| 240 |
+
const extraCost = extraPages * 5000;
|
| 241 |
+
addInvoiceItem(`${extraPages} extra page(s)`, `PKR ${extraCost.toLocaleString()}`, "pages");
|
| 242 |
+
} else {
|
| 243 |
+
// base 5 pages included, no extra cost
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
// E-commerce
|
| 248 |
+
if (lower.includes("e‑commerce: yes") || (lower.includes("need e‑commerce") && lower.includes("yes"))) {
|
| 249 |
+
addInvoiceItem("E‑commerce Functionality", "PKR 50,000", "ecommerce");
|
| 250 |
+
}
|
| 251 |
+
// Chatbot
|
| 252 |
+
if (lower.includes("chatbot: yes") || (lower.includes("ai chatbot") && lower.includes("yes"))) {
|
| 253 |
+
addInvoiceItem("AI Chatbot", "PKR 30,000", "chatbot");
|
| 254 |
+
}
|
| 255 |
+
// SEO
|
| 256 |
+
if (lower.includes("seo: yes") || (lower.includes("seo optimization") && lower.includes("yes"))) {
|
| 257 |
+
addInvoiceItem("SEO Optimization", "PKR 25,000", "seo");
|
| 258 |
+
}
|
| 259 |
+
// Inventory management
|
| 260 |
+
if (lower.includes("inventory management: yes") || (lower.includes("inventory management") && lower.includes("yes"))) {
|
| 261 |
+
addInvoiceItem("Inventory Management", "PKR 30,000", "inventory");
|
| 262 |
+
}
|
| 263 |
+
// Database integration
|
| 264 |
+
if (lower.includes("database integration: yes") || (lower.includes("database integration") && lower.includes("yes"))) {
|
| 265 |
+
addInvoiceItem("Database Integration", "PKR 40,000", "database");
|
| 266 |
+
}
|
| 267 |
+
// Extra features from "✅ Added **something**" pattern
|
| 268 |
+
const addedMatch = text.match(/✅ Added \*\*([^*]+)\*\*/i);
|
| 269 |
+
if (addedMatch) {
|
| 270 |
+
const feature = addedMatch[1].toLowerCase();
|
| 271 |
+
for (const [key, svc] of Object.entries(serviceMap)) {
|
| 272 |
+
if (feature.includes(key) || key.includes(feature)) {
|
| 273 |
+
addInvoiceItem(svc.name, svc.price, svc.key);
|
| 274 |
+
break;
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
}
|
| 278 |
+
// Also handle "✅ Added **multi-language**" from the bot's response
|
| 279 |
+
const genericAdded = text.match(/✅ Added (.+?)\./i);
|
| 280 |
+
if (genericAdded && !addedMatch) {
|
| 281 |
+
const feature = genericAdded[1].toLowerCase();
|
| 282 |
+
for (const [key, svc] of Object.entries(serviceMap)) {
|
| 283 |
+
if (feature.includes(key) || key.includes(feature)) {
|
| 284 |
+
addInvoiceItem(svc.name, svc.price, svc.key);
|
| 285 |
+
break;
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
// ---------- Generate Final Report (text in chat) ----------
|
| 292 |
function generateFinalReport() {
|
| 293 |
if (invoiceItems.length === 0) {
|
|
|
|
| 317 |
addMessageWithConfirm(report, 'bot');
|
| 318 |
}
|
| 319 |
|
|
|
|
| 320 |
function downloadReport() {
|
| 321 |
if (invoiceItems.length === 0) {
|
| 322 |
alert("No services selected. Please add items to your quote first.");
|
|
|
|
| 344 |
if (totalDays > 0) content += `CUMULATIVE TIMELINE: ${totalDays} working days\n`;
|
| 345 |
content += "\nThis is an estimate. Final quote may vary.\n";
|
| 346 |
content += "Contact: hello@elitevisuals.com | +92 300 1234567\n";
|
|
|
|
| 347 |
const blob = new Blob([content], { type: "text/plain" });
|
| 348 |
const url = URL.createObjectURL(blob);
|
| 349 |
const a = document.createElement("a");
|
|
|
|
| 438 |
msgDiv.innerText = text;
|
| 439 |
wrapper.appendChild(msgDiv);
|
| 440 |
|
| 441 |
+
// Auto-add services from bot message
|
| 442 |
+
autoAddFromBotMessage(text);
|
| 443 |
+
|
| 444 |
let serviceName = null, servicePrice = null, serviceKey = null, timelineStr = null;
|
| 445 |
if (widgetData) {
|
| 446 |
if (widgetData.package) {
|