File size: 4,703 Bytes
67c8122
bc25456
94e6b77
bc25456
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0147f30
 
bc25456
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c0592b0
bc25456
 
c0592b0
bc25456
 
 
 
 
 
 
 
 
 
 
 
c0592b0
 
 
bc25456
 
 
 
 
3a050ea
bc25456
 
 
 
3a050ea
c0592b0
bc25456
 
 
 
94e6b77
 
bc25456
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
<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8" />
    <title>Simulador de Investimentos</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
    <style>
        body {
            margin: 20px;
            background: #f9f9f9;
        }
        .container {
            max-width: 900px;
            background: white;
            padding: 20px 30px;
            border-radius: 8px;
            box-shadow: 0 0 15px #ddd;
        }
        h1 {
            margin-bottom: 25px;
            color: #2E7D32;
        }
        .btn-pdf {
            background-color: #2E7D32;
            color: white;
        }
        .btn-pdf:hover {
            background-color: #1B4D24;
            color: white;
        }
        footer {
            margin-top: 40px;
            font-size: 0.9em;
            color: #666;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>Simulador de Investimentos Imobiliários</h1>
    <form method="POST" action="/">
        <div class="row g-3">
            <div class="col-md-6">
                <label for="capital" class="form-label">Capital Inicial (R$):</label>
                <input type="number" class="form-control" id="capital" name="capital" required step="0.01" min="1" value="{{ capital or 100000 }}" />
            </div>
            <div class="col-md-6">
                <label for="studio_ret" class="form-label">Retorno Mensal Studio (%):</label>
                <input type="number" class="form-control" id="studio_ret" name="studio_ret" required step="0.01" value="{{ studio_ret or 1.0 }}" />
            </div>
            <div class="col-md-6">
                <label for="valorizacao" class="form-label">Valorização Anual Studio (%):</label>
                <input type="number" class="form-control" id="valorizacao" name="valorizacao" required step="0.01" value="{{ valorizacao or 5.0 }}" />
            </div>
            <div class="col-md-6">
                <label for="franquia_ret" class="form-label">Retorno Anual Franquia (R$):</label>
                <input type="number" class="form-control" id="franquia_ret" name="franquia_ret" required step="0.01" value="{{ franquia_ret or 5000 }}" />
            </div>
            <div class="col-md-6">
                <label for="acoes_ret" class="form-label">Retorno Anual Ações (%):</label>
                <input type="number" class="form-control" id="acoes_ret" name="acoes_ret" required step="0.01" value="{{ acoes_ret or 8.0 }}" />
            </div>
            <div class="col-md-6">
                <label for="renda_fixa" class="form-label">Retorno Anual Renda Fixa (%):</label>
                <input type="number" class="form-control" id="renda_fixa" name="renda_fixa" required step="0.01" value="{{ renda_fixa or 6.0 }}" />
            </div>
            <div class="col-md-6">
                <label for="inflacao" class="form-label">Inflação Anual Estimada (%):</label>
                <input type="number" class="form-control" id="inflacao" name="inflacao" required step="0.01" value="{{ inflacao or 4.0 }}" />
            </div>
        </div>
        <div class="mt-4 d-flex gap-3">
            <button type="submit" class="btn btn-success">Calcular</button>

            {% if capital %}
            <form method="POST" action="/download_pdf" style="display:inline;">
                <input type="hidden" name="capital" value="{{ capital }}">
                <input type="hidden" name="studio_ret" value="{{ studio_ret }}">
                <input type="hidden" name="valorizacao" value="{{ valorizacao }}">
                <input type="hidden" name="franquia_ret" value="{{ franquia_ret }}">
                <input type="hidden" name="acoes_ret" value="{{ acoes_ret }}">
                <input type="hidden" name="renda_fixa" value="{{ renda_fixa }}">
                <input type="hidden" name="inflacao" value="{{ inflacao }}">
                <button type="submit" class="btn btn-pdf">Gerar PDF</button>
            </form>
            {% endif %}
        </div>
    </form>

    {% if tabela %}
    <hr class="my-4" />
    <h3>Evolução dos Investimentos - 5 anos</h3>
    <div class="table-responsive">
        {{ tabela | safe }}
    </div>
    <div class="mt-4">
        <h4>Análise Final:</h4>
        <p>{{ analise_final | safe }}</p>
        <p><strong>Investimento com maior retorno:</strong> {{ investimento_mais_valorizado }} ({{ valor_mais_alto | round(2) | string | replace(".", ",") }})</p>
    </div>
    {% endif %}
</div>
<footer>
    Desenvolvido por Rafael Persano - Simulador Financeiro
</footer>
</body>
</html>