Spaces:
Running
Running
Download index.html from larpontualDEV/teste1: direct link, hf CLI and curl.
- Browser
- Download file 51.3 kB
-
https://huggingface.co/spaces/larpontualDEV/teste1/resolve/main/index.html
- Command line
-
hf download hf://spaces/larpontualDEV/teste1/index.html
-
curl -L -o index.html https://huggingface.co/spaces/larpontualDEV/teste1/resolve/main/index.html
51.3 kB
| <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> |