Spaces:
Running
Running
File size: 51,275 Bytes
e457037 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | <!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CalcuLarReformas - Calculadora de Reformas Moderna</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.deepsite-container {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
background-color: #f8fafc;
color: #1e293b;
min-height: 100vh;
padding: 0;
}
.deepsite-card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.deepsite-card:hover {
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.deepsite-tab {
transition: all 0.3s ease;
position: relative;
}
.deepsite-tab.active {
color: #3b82f6;
font-weight: 600;
}
.deepsite-tab.active:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 3px;
background-color: #3b82f6;
border-radius: 3px 3px 0 0;
}
.deepsite-tab.completed {
color: #10b981;
}
.deepsite-primary-btn {
background-color: #3b82f6;
color: white;
transition: all 0.2s ease;
}
.deepsite-primary-btn:hover {
background-color: #2563eb;
transform: translateY(-1px);
}
.deepsite-secondary-btn {
background-color: #f1f5f9;
color: #64748b;
transition: all 0.2s ease;
}
.deepsite-secondary-btn:hover {
background-color: #e2e8f0;
color: #475569;
}
.deepsite-circle-number {
width: 56px;
height: 56px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.deepsite-circle-number:hover {
transform: scale(1.05);
}
.deepsite-circle-number.selected {
background-color: #3b82f6;
color: white;
box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3), 0 2px 4px -1px rgba(59, 130, 246, 0.2);
}
.deepsite-step-circle {
width: 28px;
height: 28px;
border-radius: 50%;
background-color: #3b82f6;
color: white;
display: inline-flex;
justify-content: center;
align-items: center;
margin-right: 12px;
font-size: 14px;
font-weight: 600;
}
.deepsite-service-card {
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
border-left: 4px solid #3b82f6;
}
.deepsite-navbar {
backdrop-filter: blur(10px);
background-color: rgba(255, 255, 255, 0.8);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.deepsite-table th {
background-color: #f8fafc;
font-weight: 600;
color: #64748b;
}
.deepsite-table tr:nth-child(even) {
background-color: #f8fafc;
}
.deepsite-popup {
animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.deepsite-input {
transition: all 0.2s ease;
border: 1px solid #e2e8f0;
}
.deepsite-input:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.deepsite-select {
appearance: none;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
background-position: right 0.5rem center;
background-repeat: no-repeat;
background-size: 1.5em 1.5em;
}
</style>
</head>
<body class="bg-gray-50">
<div id="root"></div>
<script type="text/babel">
const { useState, useEffect } = React;
function CalcuLarReformas() {
// State for the entire app
const [activeTab, setActiveTab] = useState('inicio');
const [completedTabs, setCompletedTabs] = useState([]);
const [quantity, setQuantity] = useState(1);
const [selectedAmbientes, setSelectedAmbientes] = useState([]);
const [selectedServices, setSelectedServices] = useState([]);
const [budgetData, setBudgetData] = useState(null);
const [history, setHistory] = useState([]);
const [showPopup, setShowPopup] = useState(false);
const [popupData, setPopupData] = useState({});
const [ambienteOptions, setAmbienteOptions] = useState([]);
const [serviceOptions, setServiceOptions] = useState([]);
const [serviceMapping, setServiceMapping] = useState({});
const [maxAmbientes, setMaxAmbientes] = useState(12);
// Mock data - in a real app, this would come from postMessage
useEffect(() => {
// Simulate receiving data from backend
const mockAmbienteOptions = [
"Banheiro", "Cozinha", "Sala", "Quarto", "Varanda",
"Lavanderia", "Escritório", "Área de Serviço", "Garagem",
"Quintal", "Jardim", "Hall"
];
const mockServiceOptions = [
{ category: "Construção", services: ["Construção De Parede Em Drywall", "Construção De Parede Em Alvenaria"] },
{ category: "Pintura", services: ["Pintura Interna", "Pintura Externa"] },
{ category: "Piso", services: ["Assentamento de Porcelanato", "Assentamento de Cerâmica"] },
{ category: "Elétrica", services: ["Instalação de Tomadas", "Troca de Fiação"] },
{ category: "Hidráulica", services: ["Troca de Canos", "Instalação de Chuveiro"] }
];
const mockServiceMapping = {
"Construção De Parede Em Drywall": {
levels: {
"Básica": { material: 0, labor: 353, total: 953, duration: 2 },
"Intermediária": { material: 300, labor: 400, total: 1200, duration: 3 },
"Premium": { material: 500, labor: 500, total: 1500, duration: 4 }
}
},
// Add more mappings as needed
};
setAmbienteOptions(mockAmbienteOptions);
setServiceOptions(mockServiceOptions);
setServiceMapping(mockServiceMapping);
// Simulate receiving history data
setHistory([
{ date: "20/04/2025 | 23:13", ambientes: 1, services: 7, total: 8285, days: 19 },
{ date: "18/04/2025 | 14:45", ambientes: 2, services: 5, total: 6500, days: 15 },
{ date: "15/04/2025 | 10:30", ambientes: 3, services: 8, total: 10200, days: 25 }
]);
// Simulate receiving maxAmbientes based on user plan
setMaxAmbientes(12);
}, []);
// Handle postMessage communication with Wix backend
useEffect(() => {
const handleMessage = (event) => {
// In a real implementation, we would handle messages from the Wix backend
console.log('Received message:', event.data);
// Example: if (event.data.action === 'updateData') { ... }
};
window.addEventListener('message', handleMessage);
return () => window.removeEventListener('message', handleMessage);
}, []);
// Navigation functions
const navigateToTab = (tabName) => {
if (!completedTabs.includes(activeTab) && activeTab !== 'resultado') {
setCompletedTabs([...completedTabs, activeTab]);
}
setActiveTab(tabName);
// Send postMessage to Wix backend
const message = { action: 'navigate', payload: tabName };
window.parent.postMessage(message, '*');
};
const handleStartNewSimulation = () => {
navigateToTab('quantidade');
};
const handleQuantitySelect = (qty) => {
if (qty > maxAmbientes) {
setPopupData({
title: "Limite Excedido",
message: `Seu plano atual permite até ${maxAmbientes} ambientes. Faça upgrade para simular mais ambientes.`,
url: "/upgrade"
});
setShowPopup(true);
return;
}
setQuantity(qty);
setSelectedAmbientes(Array(qty).fill(''));
setSelectedServices(Array(qty).fill({ category: '', service: '', level: '' }));
};
const handleAmbienteSelect = (index, value) => {
const newAmbientes = [...selectedAmbientes];
newAmbientes[index] = value;
setSelectedAmbientes(newAmbientes);
// Send postMessage to Wix backend
const message = { action: 'ambienteSelected', payload: { index, value } };
window.parent.postMessage(message, '*');
};
const handleServiceSelect = (index, field, value) => {
const newServices = [...selectedServices];
if (!newServices[index]) newServices[index] = {};
newServices[index][field] = value;
// Reset dependent fields when category changes
if (field === 'category') {
newServices[index].service = '';
newServices[index].level = '';
} else if (field === 'service') {
newServices[index].level = '';
}
setSelectedServices(newServices);
// Send postMessage to Wix backend
const message = { action: 'servicoSelected', payload: {
ambienteIndex: index,
categoria: newServices[index].category,
servico: newServices[index].service,
nivel: newServices[index].level
}};
window.parent.postMessage(message, '*');
};
const handleGenerateBudget = () => {
// In a real app, this would come from the backend via postMessage
const mockBudgetData = {
summary: {
ambientes: selectedAmbientes.filter(a => a).length,
services: selectedServices.filter(s => s && s.service).length,
total: 8285,
days: 19
},
detalhes: selectedAmbientes.map((ambiente, index) => ({
ambiente,
services: selectedServices[index]?.service ? [{
name: selectedServices[index].service,
material: 0,
labor: 353,
total: 953,
duration: 2,
etapa: "Construções de Gesso"
}] : []
}))
};
setBudgetData(mockBudgetData);
// Send postMessage to Wix backend
const message = { action: 'generateBudget', payload: {
ambientes: selectedAmbientes,
services: selectedServices
}};
window.parent.postMessage(message, '*');
navigateToTab('resultado');
};
const handleSavePDF = () => {
// In a real app, this would use jsPDF to generate a PDF
const message = { action: 'savePDF' };
window.parent.postMessage(message, '*');
// Show success message
setPopupData({
title: "PDF Gerado",
message: "O PDF do seu orçamento foi gerado com sucesso!",
url: null
});
setShowPopup(true);
};
const handleClearHistory = () => {
// In a real app, this would check user permissions first
const message = { action: 'clearHistory' };
window.parent.postMessage(message, '*');
setHistory([]);
};
const handleParcelSimulator = () => {
// In a real app, this would check if user has Pro plan
setPopupData({
title: "Funcionalidade Restrita",
message: "Faça upgrade para o plano Pro para acessar o simulador de parcelas!",
url: "/upgrade"
});
setShowPopup(true);
};
const handleUpgradeAccount = () => {
const message = { action: 'navigateToUpgrade' };
window.parent.postMessage(message, '*');
};
const handleRestartSimulation = () => {
setQuantity(1);
setSelectedAmbientes([]);
setSelectedServices([]);
setBudgetData(null);
setCompletedTabs([]);
setActiveTab('inicio');
};
// Check if we can proceed to next step
const canProceedToAmbientes = () => quantity > 0;
const canProceedToServices = () => selectedAmbientes.every(a => a);
const canProceedToResult = () => selectedServices.some(s => s && s.service);
// Tab component
const Tab = ({ name, label, icon, active, completed }) => {
let tabClass = "deepsite-tab flex items-center justify-center px-6 py-4 cursor-pointer text-sm";
if (active) {
tabClass += " active";
} else if (completed) {
tabClass += " completed";
} else {
tabClass += " text-gray-500";
}
return (
<div
className={tabClass}
onClick={() => navigateToTab(name)}
>
<i className={`fas fa-${icon} mr-2`}></i>
{label}
</div>
);
};
// Início Tab
const InicioTab = () => (
<div className="space-y-8">
<div className="text-center">
<h1 className="text-3xl font-bold text-gray-900 mb-2">Bem Vindo(a) ao CalcuLarReformas!</h1>
<p className="text-gray-600">Planeje sua reforma com precisão e facilidade</p>
</div>
<div className="deepsite-card p-6 cursor-pointer hover:shadow-md">
<h3 className="font-semibold text-gray-700 mb-2">Sua Última Simulação:</h3>
{history.length > 0 ? (
<div className="flex items-center justify-between">
<div>
<p className="text-gray-900 font-medium">{history[0].date}</p>
<p className="text-gray-600 text-sm">{history[0].ambientes} Ambientes | {history[0].services} Serviços</p>
</div>
<div className="text-right">
<p className="text-blue-600 font-bold">R$ {history[0].total.toLocaleString('pt-BR')}</p>
<p className="text-gray-600 text-sm">{history[0].days} Dias</p>
</div>
</div>
) : (
<p className="text-gray-500">Nenhuma simulação recente</p>
)}
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<button
className="deepsite-primary-btn px-6 py-4 rounded-lg font-bold flex flex-col items-center"
onClick={handleStartNewSimulation}
id="AppBotaoIniciarSimulacao"
>
<i className="fas fa-plus-circle text-2xl mb-2"></i>
Nova Simulação
</button>
<button
className="deepsite-secondary-btn px-6 py-4 rounded-lg font-bold flex flex-col items-center"
onClick={() => navigateToTab('resultado')}
id="AppBotaoHistorico"
>
<i className="fas fa-history text-2xl mb-2"></i>
Histórico Completo
</button>
<button
className="deepsite-secondary-btn px-6 py-4 rounded-lg font-bold flex flex-col items-center"
onClick={() => {
setPopupData({
title: "Mais Funcionalidades",
message: "Faça upgrade para mais recursos!",
url: "/upgrade"
});
setShowPopup(true);
}}
id="AppBotaoMaisFuncionalidades"
>
<i className="fas fa-cogs text-2xl mb-2"></i>
Mais Funcionalidades
</button>
</div>
<div className="deepsite-card p-6">
<h3 className="text-xl font-semibold text-gray-900 mb-4">Guia Rápido de Uso</h3>
<div className="space-y-4">
<div className="flex items-start">
<span className="deepsite-step-circle">1</span>
<div>
<h4 className="font-medium text-gray-900">Selecione quantos ambientes</h4>
<p className="text-gray-600 text-sm">Escolha entre 1 e 12 ambientes para reformar</p>
</div>
</div>
<div className="flex items-start">
<span className="deepsite-step-circle">2</span>
<div>
<h4 className="font-medium text-gray-900">Defina quais ambientes</h4>
<p className="text-gray-600 text-sm">Selecione o tipo de cada ambiente (banheiro, cozinha, etc.)</p>
</div>
</div>
<div className="flex items-start">
<span className="deepsite-step-circle">3</span>
<div>
<h4 className="font-medium text-gray-900">Escolha os serviços</h4>
<p className="text-gray-600 text-sm">Selecione o que precisa ser feito em cada ambiente</p>
</div>
</div>
<div className="flex items-start">
<span className="deepsite-step-circle">4</span>
<div>
<h4 className="font-medium text-gray-900">Confira seu orçamento</h4>
<p className="text-gray-600 text-sm">Veja o valor total, detalhes por serviço e cronograma</p>
</div>
</div>
</div>
</div>
<div className="text-center text-gray-500 text-sm">
Explore o CalcuLarReformas! Crie múltiplas simulações para planejar sua reforma com precisão e economia.
</div>
</div>
);
// Quantidade Tab
const QuantidadeTab = () => (
<div className="space-y-8">
<div className="text-center">
<h1 className="text-2xl font-bold text-gray-900">Quantos ambientes você precisa reformar?</h1>
<p className="text-gray-600 mt-2">Selecione o número de ambientes para começar</p>
</div>
<div className="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 gap-4 justify-center">
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map(num => (
<div
key={num}
className={`deepsite-circle-number ${quantity === num ? 'selected' : 'bg-white border border-gray-200 text-gray-700 hover:border-blue-300'}`}
onClick={() => handleQuantitySelect(num)}
>
{num}
</div>
))}
</div>
<p className="text-center text-gray-500 text-sm">
Escolha um número menor para testar, depois poderá fazer outras simulações e aperfeiçoar seu planejamento.
</p>
<div className="flex justify-center">
<button
className="deepsite-primary-btn px-8 py-3 rounded-lg font-bold"
onClick={() => navigateToTab('ambientes')}
disabled={!canProceedToAmbientes()}
id="AppBotaoAvancarQuantidade"
>
Avançar <i className="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
);
// Ambientes Tab
const AmbientesTab = () => (
<div className="space-y-8">
<div className="text-center">
<h1 className="text-2xl font-bold text-gray-900 flex items-center justify-center">
<i className="fas fa-layer-group text-blue-500 mr-3"></i> Quais ambientes você precisa reformar?
</h1>
<p className="text-gray-600 mt-2">Defina o tipo de cada ambiente que será reformado</p>
</div>
<div className="space-y-4">
{Array.from({ length: quantity }).map((_, index) => (
<div key={index} className="deepsite-card p-5">
<label className="block font-semibold text-gray-700 mb-3">Ambiente {index + 1}</label>
<select
className="deepsite-select w-full p-3 rounded-lg border border-gray-200 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-200"
value={selectedAmbientes[index] || ''}
onChange={(e) => handleAmbienteSelect(index, e.target.value)}
id={`AppDropdownTipoAmbiente-${index}`}
>
<option value="">Selecione um ambiente</option>
{ambienteOptions.map((option, i) => (
<option key={i} value={option}>{option}</option>
))}
</select>
</div>
))}
</div>
<p className="text-center text-gray-500 text-sm">
Quanto mais informações, mais preciso e real será seu planejamento.
</p>
<div className="flex justify-between">
<button
className="deepsite-secondary-btn px-6 py-3 rounded-lg font-bold"
onClick={() => navigateToTab('quantidade')}
id="AppBotaoVoltarParaAba1"
>
<i className="fas fa-arrow-left mr-2"></i> Voltar
</button>
<button
className="deepsite-secondary-btn px-6 py-3 rounded-lg font-bold"
onClick={handleRestartSimulation}
id="AppBotaoReiniciar-1"
>
<i className="fas fa-redo mr-2"></i> Reiniciar
</button>
<button
className="deepsite-primary-btn px-6 py-3 rounded-lg font-bold"
onClick={() => navigateToTab('servicos')}
disabled={!canProceedToServices()}
id="AppBotaoAvancarPergunta2"
>
Avançar <i className="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
);
// Serviços Tab
const ServicosTab = () => (
<div className="space-y-8">
<div className="text-center">
<h1 className="text-2xl font-bold text-gray-900">O que você precisa reformar neles?</h1>
<p className="text-gray-600 mt-2">Selecione os serviços necessários para cada ambiente</p>
</div>
<div className="space-y-6">
{selectedAmbientes.map((ambiente, index) => (
ambiente && (
<div key={index} className="deepsite-service-card p-5 rounded-lg">
<h3 className="font-bold text-lg mb-4 text-gray-800">{ambiente}</h3>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label className="block font-semibold text-gray-700 mb-2">Categoria</label>
<select
className="deepsite-select w-full p-3 rounded-lg border border-gray-200 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-200"
value={selectedServices[index]?.category || ''}
onChange={(e) => handleServiceSelect(index, 'category', e.target.value)}
id={`AppDropdownCategoriaServico-${index}`}
>
<option value="">Selecione uma categoria</option>
{serviceOptions.map((option, i) => (
<option key={i} value={option.category}>{option.category}</option>
))}
</select>
</div>
<div>
<label className="block font-semibold text-gray-700 mb-2">Serviço</label>
<select
className="deepsite-select w-full p-3 rounded-lg border border-gray-200 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-200"
value={selectedServices[index]?.service || ''}
onChange={(e) => handleServiceSelect(index, 'service', e.target.value)}
disabled={!selectedServices[index]?.category}
id={`AppDropdownTipoConstrucao-${index}`}
>
<option value="">Selecione um serviço</option>
{selectedServices[index]?.category &&
serviceOptions.find(opt => opt.category === selectedServices[index].category)?.services.map((service, i) => (
<option key={i} value={service}>{service}</option>
))
}
</select>
</div>
<div>
<label className="block font-semibold text-gray-700 mb-2">Nível</label>
<select
className="deepsite-select w-full p-3 rounded-lg border border-gray-200 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-200"
value={selectedServices[index]?.level || ''}
onChange={(e) => handleServiceSelect(index, 'level', e.target.value)}
disabled={!selectedServices[index]?.service}
id={`AppDropdownNivelPecas-${index}`}
>
<option value="">Selecione um nível</option>
{selectedServices[index]?.service && serviceMapping[selectedServices[index].service]?.levels &&
Object.keys(serviceMapping[selectedServices[index].service].levels).map((level, i) => (
<option key={i} value={level}>{level}</option>
))
}
</select>
</div>
</div>
</div>
)
))}
</div>
<p className="text-center text-gray-500 text-sm">
Quanto mais informações, mais preciso e real será seu planejamento.
</p>
<div className="flex justify-between">
<button
className="deepsite-secondary-btn px-6 py-3 rounded-lg font-bold"
onClick={() => navigateToTab('ambientes')}
id="AppBotaoVoltarParaAba2"
>
<i className="fas fa-arrow-left mr-2"></i> Voltar
</button>
<button
className="deepsite-secondary-btn px-6 py-3 rounded-lg font-bold"
onClick={handleRestartSimulation}
id="AppBotaoReiniciar-2"
>
<i className="fas fa-redo mr-2"></i> Reiniciar
</button>
<button
className="deepsite-primary-btn px-6 py-3 rounded-lg font-bold"
onClick={handleGenerateBudget}
disabled={!canProceedToResult()}
id="AppBotaoAvancarPergunta3"
>
Gerar Orçamento <i className="fas fa-calculator ml-2"></i>
</button>
</div>
</div>
);
// Resultado Tab
const ResultadoTab = () => (
<div className="space-y-8">
<div className="text-center">
<h1 className="text-2xl font-bold text-gray-900">Parabéns! Confira seu plano de reforma</h1>
<p className="text-gray-600 mt-2">Veja abaixo o resumo completo do seu orçamento</p>
</div>
{budgetData && (
<>
<div className="deepsite-card p-6 text-center">
<h3 className="font-bold text-lg text-blue-600">
{budgetData.summary.ambientes} Ambientes | {budgetData.summary.services} Serviços |
R$ {budgetData.summary.total.toLocaleString('pt-BR')} | {budgetData.summary.days} Dias
</h3>
</div>
<div className="space-y-6">
<h2 className="text-xl font-semibold text-gray-900">Detalhes da Reforma:</h2>
{budgetData.detalhes.map((detail, index) => (
detail.services.length > 0 && (
<div key={index} className="deepsite-card p-6">
<h3 className="font-bold text-lg mb-4 text-gray-800">{detail.ambiente}</h3>
<div className="overflow-x-auto">
<table className="deepsite-table min-w-full rounded-lg overflow-hidden">
<thead>
<tr>
<th className="px-4 py-3 text-left">Serviço</th>
<th className="px-4 py-3 text-right">Peça (R$)</th>
<th className="px-4 py-3 text-right">Material (R$)</th>
<th className="px-4 py-3 text-right">Mão de Obra (R$)</th>
<th className="px-4 py-3 text-right">Total (R$)</th>
<th className="px-4 py-3 text-right">Duração</th>
<th className="px-4 py-3 text-left">Etapa</th>
</tr>
</thead>
<tbody>
{detail.services.map((service, sIndex) => (
<tr key={sIndex} className="border-t border-gray-100">
<td className="px-4 py-3 text-left">{service.name}</td>
<td className="px-4 py-3 text-right">{service.material.toLocaleString('pt-BR')}</td>
<td className="px-4 py-3 text-right">0,00</td>
<td className="px-4 py-3 text-right">{service.labor.toLocaleString('pt-BR')}</td>
<td className="px-4 py-3 text-right font-medium">{service.total.toLocaleString('pt-BR')}</td>
<td className="px-4 py-3 text-right">{service.duration} dias</td>
<td className="px-4 py-3 text-left">{service.etapa}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
)
))}
</div>
<div className="deepsite-card p-6">
<h3 className="font-bold text-lg mb-4 text-gray-800">Total Geral da Obra:</h3>
<div className="grid grid-cols-2 md:grid-cols-5 gap-4">
<div className="bg-blue-50 p-3 rounded-lg">
<p className="text-gray-600">Peças (R$)</p>
<p className="font-bold text-blue-600">0,00</p>
</div>
<div className="bg-blue-50 p-3 rounded-lg">
<p className="text-gray-600">Material (R$)</p>
<p className="font-bold text-blue-600">0,00</p>
</div>
<div className="bg-blue-50 p-3 rounded-lg">
<p className="text-gray-600">Mão de Obra (R$)</p>
<p className="font-bold text-blue-600">2.471,00</p>
</div>
<div className="bg-blue-100 p-3 rounded-lg">
<p className="text-gray-700">Total (R$)</p>
<p className="font-bold text-blue-700">{budgetData.summary.total.toLocaleString('pt-BR')}</p>
</div>
<div className="bg-blue-50 p-3 rounded-lg">
<p className="text-gray-600">Duração</p>
<p className="font-bold text-blue-600">{budgetData.summary.days} dias</p>
</div>
</div>
</div>
<p className="text-center text-gray-500 text-sm">
Inclua mais ambientes no seu cálculo ou combine diferentes tipos de serviço para obter um planejamento mais completo.
</p>
</>
)}
<div className="deepsite-card p-6">
<h2 className="text-xl font-semibold mb-4 text-gray-900">Histórico Completo</h2>
{history.length > 0 ? (
<div className="space-y-3">
{history.map((item, index) => (
<div key={index} className="flex items-center justify-between p-3 hover:bg-gray-50 rounded-lg cursor-pointer">
<div>
<p className="text-gray-900 font-medium">{item.date}</p>
<p className="text-gray-600 text-sm">{item.ambientes} Ambientes | {item.services} Serviços</p>
</div>
<div className="text-right">
<p className="text-blue-600 font-bold">R$ {item.total.toLocaleString('pt-BR')}</p>
<p className="text-gray-600 text-sm">{item.days} Dias</p>
</div>
</div>
))}
</div>
) : (
<p className="text-center text-gray-500">Nenhuma simulação no histórico</p>
)}
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4">
<button
className="deepsite-primary-btn px-4 py-3 rounded-lg font-bold flex items-center justify-center"
onClick={handleSavePDF}
id="AppBotaoBaixarPDF"
>
<i className="fas fa-file-pdf mr-2"></i> PDF
</button>
<button
className="bg-indigo-600 text-white px-4 py-3 rounded-lg font-bold flex items-center justify-center"
onClick={handleParcelSimulator}
id="AppBotaoSimuladorParcelas"
>
<i className="fas fa-calculator mr-2"></i> Parcelas
</button>
<button
className="deepsite-secondary-btn px-4 py-3 rounded-lg font-bold flex items-center justify-center"
onClick={handleClearHistory}
id="AppBotaoLimparHistorico"
>
<i className="fas fa-trash-alt mr-2"></i> Limpar
</button>
<button
className="deepsite-primary-btn px-4 py-3 rounded-lg font-bold flex items-center justify-center"
onClick={handleStartNewSimulation}
id="AppBotaoNovaSimulacao"
>
<i className="fas fa-plus mr-2"></i> Nova
</button>
<button
className="bg-purple-600 text-white px-4 py-3 rounded-lg font-bold flex items-center justify-center"
onClick={handleUpgradeAccount}
id="AppBotaoContaGratuita"
>
<i className="fas fa-crown mr-2"></i> Upgrade
</button>
</div>
</div>
);
// Popup component
const Popup = () => (
showPopup && (
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50">
<div className="deepsite-card bg-white p-6 rounded-xl max-w-md w-full transform transition-all">
<div className="flex justify-between items-center mb-4">
<h3 className="text-xl font-bold text-gray-900">{popupData.title}</h3>
<button
onClick={() => setShowPopup(false)}
className="text-gray-400 hover:text-gray-500"
>
<i className="fas fa-times"></i>
</button>
</div>
<p className="text-gray-600 mb-6">{popupData.message}</p>
<div className="flex justify-end space-x-3">
{popupData.url && (
<a
href={popupData.url}
className="deepsite-primary-btn px-4 py-2 rounded-lg font-medium"
>
Fazer Upgrade
</a>
)}
<button
className="deepsite-secondary-btn px-4 py-2 rounded-lg font-medium"
onClick={() => setShowPopup(false)}
>
Fechar
</button>
</div>
</div>
</div>
)
);
return (
<div className="deepsite-container">
<div className="max-w-6xl mx-auto px-4 py-6">
{/* Navigation Tabs */}
<div className="deepsite-navbar deepsite-card mb-6">
<div className="flex overflow-x-auto">
<Tab
name="inicio"
label="Início"
icon="home"
active={activeTab === 'inicio'}
completed={completedTabs.includes('inicio')}
/>
<Tab
name="quantidade"
label="Quantos Ambientes"
icon="hashtag"
active={activeTab === 'quantidade'}
completed={completedTabs.includes('quantidade')}
/>
<Tab
name="ambientes"
label="Quais Ambientes"
icon="layer-group"
active={activeTab === 'ambientes'}
completed={completedTabs.includes('ambientes')}
/>
<Tab
name="servicos"
label="Necessidades"
icon="tools"
active={activeTab === 'servicos'}
completed={completedTabs.includes('servicos')}
/>
<Tab
name="resultado"
label="Resultado"
icon="file-invoice-dollar"
active={activeTab === 'resultado'}
completed={completedTabs.includes('resultado')}
/>
</div>
</div>
{/* Tab Content */}
<div className="deepsite-card p-6 md:p-8 rounded-xl">
{activeTab === 'inicio' && <InicioTab />}
{activeTab === 'quantidade' && <QuantidadeTab />}
{activeTab === 'ambientes' && <AmbientesTab />}
{activeTab === 'servicos' && <ServicosTab />}
{activeTab === 'resultado' && <ResultadoTab />}
</div>
<Popup />
</div>
</div>
);
}
const root = ReactDOM.createDocument.getElementById('root'));
root.render(<CalcuLarReformas />);
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=larpontualDEV/teste1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |