// Commercial Proposal Interactive Features function init() { // Initialize ROI Calculator initializeROICalculator(); // Initialize PDF Download initializePDFDownload(); } function initializeROICalculator() { // Property type revenue estimates (monthly EUR) const revenueEstimates = { 'Apartamento T1 (1-2 pessoas)': { 'Funchal Centro': 2800, 'Funchal Zona Velha': 2600, 'Machico/Santa Cruz': 2200, 'Câmara de Lobos': 2100, 'Ponta do Sol': 2400, 'Calheta': 2000 }, 'Apartamento T2 (3-4 pessoas)': { 'Funchal Centro': 3800, 'Funchal Zona Velha': 3600, 'Machico/Santa Cruz': 3200, 'Câmara de Lobos': 3000, 'Ponta do Sol': 3400, 'Calheta': 2900 }, 'Casa T3 (5-6 pessoas)': { 'Funchal Centro': 5200, 'Funchal Zona Velha': 4800, 'Machico/Santa Cruz': 4200, 'Câmara de Lobos': 3900, 'Ponta do Sol': 4500, 'Calheta': 3800 }, 'Villa T4+ (7+ pessoas)': { 'Funchal Centro': 7500, 'Funchal Zona Velha': 7000, 'Machico/Santa Cruz': 6200, 'Câmara de Lobos': 5800, 'Ponta do Sol': 6800, 'Calheta': 5500 } }; // Make calculateROI globally available window.calculateROI = function() { const propertyType = document.getElementById('propertyType')?.value; const location = document.getElementById('location')?.value; const currentRevenue = document.getElementById('currentRevenue')?.value; if (!propertyType || !location) { alert('Por favor, selecione o tipo de propriedade e localização'); return; } // Get estimated revenue const estimatedRevenue = revenueEstimates[propertyType][location]; const commission = Math.round(estimatedRevenue * 0.18); const netIncome = estimatedRevenue - commission; // Calculate improvement vs self-management (typically 20-30% less) const selfManagedRevenue = currentRevenue ? parseInt(currentRevenue) : Math.round(estimatedRevenue * 0.75); const extraGain = netIncome - selfManagedRevenue; // Update display document.getElementById('projectedRevenue').textContent = `€${estimatedRevenue.toLocaleString()}/mês`; document.getElementById('commission').textContent = `€${commission.toLocaleString()}/mês`; document.getElementById('netIncome').textContent = `€${netIncome.toLocaleString()}/mês`; document.getElementById('extraGain').textContent = extraGain > 0 ? `+€${extraGain.toLocaleString()}/mês` : `€${Math.abs(extraGain).toLocaleString()}/mês menos`; // Update color based on result const extraGainElement = document.getElementById('extraGain'); if (extraGain > 0) { extraGainElement.className = 'text-xl font-bold text-green-700'; } else { extraGainElement.className = 'text-xl font-bold text-red-700'; } // Add animation document.getElementById('calculatorResults').classList.add('animate-pulse'); setTimeout(() => { document.getElementById('calculatorResults').classList.remove('animate-pulse'); }, 1000); }; } function initializePDFDownload() { window.downloadPDF = function() { // Create a temporary message while "generating" PDF const button = event.target.closest('button'); const originalText = button.innerHTML; button.innerHTML = 'Gerando PDF...'; button.disabled = true; setTimeout(() => { // Simulate PDF generation const pdfContent = generatePDFContent(); // Create downloadable content const blob = new Blob([pdfContent], { type: 'text/html;charset=utf-8' }); const url = URL.createObjectURL(blob); // Create download link const link = document.createElement('a'); link.href = url; link.download = 'Proposta-Comercial-Vacancy-Island-2025.html'; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(url); // Reset button button.innerHTML = originalText; button.disabled = false; // Show success message showDownloadSuccess(); }, 2000); }; } function generatePDFContent() { return `
Gestão Profissional de Alojamento Local • Madeira
Data: Agosto 2025 | Versão: 2.0
Sem custos ocultos • Sem mensalidades • Só paga quando ganha
Tipo Propriedade | Receita Mensal | Comissão VI (18%) | Recebe Líquido | vs. Autogestão |
---|---|---|---|---|
T1 Funchal Centro | €2.800 | €504 | €2.296 | +€520 |
T3 Machico Vista Mar | €4.200 | €756 | €3.444 | +€780 |
Villa Premium | €7.500 | €1.350 | €6.150 | +€1.200 |
PDF Descarregado!
Proposta guardada com sucesso