-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
382 lines (350 loc) · 22.1 KB
/
Copy pathindex.html
File metadata and controls
382 lines (350 loc) · 22.1 KB
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
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simulador de Crédito - Cabo Verde</title>
<!-- Open Graph Meta Tags (Facebook, LinkedIn, etc.) -->
<meta property="og:title" content="Simulador de Crédito - Cabo Verde">
<meta property="og:description" content="Simule e calcule empréstimos em Cabo Verde. Visualize prestações mensais, TAEG, juros totais e cronograma de amortização com ferramentas interativas.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://marovski.github.io/simuladorcreditoCV/">
<meta property="og:image" content="https://marovski.github.io/simuladorcreditoCV/og-image.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:type" content="image/png">
<meta property="og:image:alt" content="Simulador de Crédito - Ferramenta de Cálculo de Empréstimos">
<meta property="og:site_name" content="Simulador de Crédito Cabo Verde">
<meta property="og:locale" content="pt_CV">
<meta property="og:locale:alternate" content="pt_PT">
<meta property="og:locale:alternate" content="en_US">
<!-- Twitter Card Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Simulador de Crédito - Cabo Verde">
<meta name="twitter:description" content="Simule e calcule empréstimos em Cabo Verde com TAEG, juros e cronograma de amortização.">
<meta name="twitter:image" content="https://marovski.github.io/simuladorcreditoCV/og-image.png">
<meta name="twitter:image:alt" content="Simulador de Crédito - Ferramenta de Cálculo de Empréstimos">
<!-- Standard Meta Tags -->
<meta name="description" content="Simule e calcule empréstimos em Cabo Verde. Visualize prestações mensais, TAEG, juros totais e cronograma de amortização com ferramentas interativas.">
<meta name="keywords" content="simulador de crédito, empréstimo, Cabo Verde, calculadora, TAEG, amortização, taxa de juros">
<meta name="author" content="Mário Cardoso">
<meta name="theme-color" content="#7c3aed">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="styles.css">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FXVK50RCR0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-FXVK50RCR0');
</script>
</head>
<body data-lang="pt">
<div class="container">
<div class="card">
<!-- Header -->
<div class="header">
<div class="icon-box">
<img src="favicon.svg" width="48" height="48" alt="SimulaCV">
</div>
<div>
<h1 data-i18n="app.title">Simulador de Crédito</h1>
<p class="subtitle" data-i18n="app.subtitle">Cabo Verde</p>
</div>
<div class="header-controls">
<button type="button" class="dark-mode-toggle" id="darkModeToggle" onclick="toggleDarkMode()" title="Alternar Modo Escuro">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" id="darkModeIcon">
<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
</button>
<button type="button" class="language-toggle" id="languageToggle" onclick="toggleLanguage()" title="Toggle Language">
<span id="langCode">EN</span>
</button>
</div>
</div>
<!-- Form -->
<div class="form-container">
<!-- Montante -->
<div class="form-group">
<div class="label-row">
<label>
💰 <span data-i18n="form.amount.label">Quanto dinheiro quer pedir emprestado?</span>
<button type="button" class="info-btn" onclick="showInfo('amount')">ℹ️</button>
</label>
<span class="slider-value" id="amountDisplay">100,000</span>
</div>
<p class="helper-text" data-i18n="form.amount.helper">Para carro, casa ou outro fim. Mínimo 10.000 CVE, máximo 50.000.000 CVE.</p>
<input type="range" id="amountSlider" min="10000" max="50000000" value="100000" step="10000" class="slider">
<div class="input-wrapper">
<input type="number" id="amount" value="100000" placeholder="0" class="number-input">
<span class="input-suffix">CVE</span>
</div>
<span class="validation-error" id="amountError" style="display: none;"></span>
</div>
<!-- Período -->
<div class="form-group">
<div class="label-row">
<label>
📅 <span data-i18n="form.period.label">Em quantos meses pretende pagar?</span>
<button type="button" class="info-btn" onclick="showInfo('period')">ℹ️</button>
</label>
<span class="slider-value" id="periodDisplay">12 meses</span>
</div>
<p class="helper-text" data-i18n="form.period.helper">Períodos maiores = prestações menores, mas mais juros no total.</p>
<input type="range" id="periodSlider" min="6" max="360" value="12" step="1" class="slider">
<div class="input-wrapper period-picker">
<input type="number" id="periodValue" value="12" placeholder="0" class="number-input">
<select id="periodUnit">
<option value="meses" data-i18n="form.period.months">Meses</option>
<option value="anos" data-i18n="form.period.years">Anos</option>
</select>
</div>
<span class="validation-error" id="periodError" style="display: none;"></span>
</div>
<!-- Taxa Nominal -->
<div class="form-group">
<div class="label-row">
<label>
📊 <span data-i18n="form.rate.label">Taxa de juro anual do banco (%)</span>
<button type="button" class="info-btn" onclick="showInfo('nominalRate')">ℹ️</button>
</label>
<span class="slider-value" id="rateDisplay">12.0%</span>
</div>
<p class="helper-text" data-i18n="form.rate.helper">Peça este valor ao seu banco. Afeta quanto vai pagar de juros.</p>
<input type="range" id="rateSlider" min="1" max="30" value="12" step="0.5" class="slider">
<div class="input-wrapper">
<input type="number" id="nominalRate" value="12" step="0.1" placeholder="0" class="number-input">
<span class="input-suffix">%</span>
</div>
<span class="validation-error" id="rateError" style="display: none;"></span>
</div>
<!-- Divisor OU -->
<div class="divider">
<div class="divider-line"></div>
<span class="divider-text" data-i18n="form.divider.or">OU</span>
<div class="divider-line"></div>
</div>
<!-- TAEG do Banco -->
<div class="form-group">
<div class="checkbox-wrapper">
<input type="checkbox" id="useTaeg">
<label for="useTaeg">
⚙️ <span data-i18n="form.taeg.label">Usar TAEG fornecida pelo banco</span>
<button type="button" class="info-btn" onclick="showInfo('taegInput')">ℹ️</button>
</label>
</div>
<div class="input-wrapper">
<input type="number" id="taegInput" step="0.1" placeholder="Ex: 15.5" disabled class="number-input">
<span class="input-suffix">%</span>
</div>
<p class="hint" id="taegHint" style="display: none;" data-i18n="form.taeg.hint">
💡 Com TAEG: Total a Pagar e Juros incluem todos os custos reais (comissões, seguros, etc.)
</p>
<span class="validation-error" id="taegError" style="display: none;"></span>
</div>
<!-- Action Buttons -->
<div class="form-actions">
<button type="button" class="btn btn-primary" onclick="calculate()" data-i18n="form.buttons.calculate">🔢 Calcular</button>
<button type="button" class="btn btn-secondary" onclick="resetForm()" data-i18n="form.buttons.reset">🔄 Limpar Tudo</button>
<button type="button" class="btn btn-tertiary" onclick="copyResults()" id="copyBtn" style="display: none;" data-i18n="form.buttons.copy">📋 Copiar Resultados</button>
</div>
</div>
<!-- Results -->
<div id="results" style="display: none;">
<div class="results-header">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>
</svg>
<h2 data-i18n="results.title">Resultados</h2>
</div>
<div class="results-grid">
<!-- Prestação Mensal -->
<div class="result-card blue">
<div class="result-header">
<span data-i18n="results.monthlyPayment.label">Prestação Mensal</span>
<button type="button" class="info-btn" onclick="showInfo('monthlyPayment')">ℹ️</button>
</div>
<p class="result-value" id="monthlyPayment">0 CVE</p>
</div>
<!-- TAEG -->
<div class="result-card green">
<div class="result-header">
<span data-i18n="results.taeg.label">TAEG (Taxa Anual Efetiva)</span>
<button type="button" class="info-btn" onclick="showInfo('taeg')">ℹ️</button>
</div>
<p class="result-value" id="taeg">0%</p>
</div>
<!-- Total a Pagar -->
<div class="result-card purple">
<div class="result-header">
<span data-i18n="results.totalPayment.label">Total a Pagar</span>
<button type="button" class="info-btn" onclick="showInfo('totalPayment')">ℹ️</button>
</div>
<p class="result-value" id="totalPayment">0 CVE</p>
</div>
<!-- Total de Juros -->
<div class="result-card orange">
<div class="result-header">
<span data-i18n="results.totalInterest.label">Total de Juros</span>
<button type="button" class="info-btn" onclick="showInfo('totalInterest')">ℹ️</button>
</div>
<p class="result-value" id="totalInterest">0 CVE</p>
</div>
</div>
<!-- Method Used -->
<div class="method-badge" id="methodBadge" style="display: none;">
<span id="methodText"></span>
</div>
<!-- Summary -->
<div class="summary">
<h3 data-i18n="results.summary.title">📋 Resumo</h3>
<div id="summaryContent"></div>
</div>
<!-- Imposto de Selo -->
<div class="fiscal-section" id="fiscalSection" style="display:none">
<div class="section-header">
<h3>🏛️ Regime Fiscal — Imposto de Selo</h3>
<span id="fiscalBadge" class="fiscal-badge" style="display:none"></span>
<button type="button" class="info-btn" onclick="showInfo('impostoSelo')" style="font-size:1rem">ℹ️</button>
</div>
<!-- Shown when bank TAEG is provided (IS already included) -->
<div id="fiscalIncluded" style="display:none">
<p class="fiscal-included-msg" id="fiscalIncludedMsg"></p>
</div>
<!-- Shown when only TAN is provided (IS estimated separately) -->
<div id="fiscalGrid" class="fiscal-grid">
<div class="fiscal-row">
<span id="labelIsJuros">IS sobre Juros (3,5%)</span>
<strong id="isJuros">0 CVE</strong>
</div>
<div class="fiscal-row">
<span id="labelIsCapital">IS sobre Capital (0,5%)</span>
<strong id="isCapital">0 CVE</strong>
</div>
<div class="fiscal-row fiscal-row--total">
<span id="labelIsTotal">Total Imposto de Selo</span>
<strong id="isTotal">0 CVE</strong>
</div>
<div class="fiscal-row fiscal-row--grand">
<span id="labelCustoTotal">Custo Total Estimado c/ IS</span>
<strong id="custoTotalComIS">0 CVE</strong>
</div>
</div>
<p class="fiscal-note" id="fiscalNote"></p>
</div>
<!-- Affordability Check -->
<div class="affordability-section">
<div class="section-header">
<h3 data-i18n="results.affordability.title">💼 Pode pagar?</h3>
</div>
<p class="section-helper" data-i18n="results.affordability.helper">Indique seu rendimento mensal para saber se a prestação é acessível</p>
<div class="affordability-content">
<div class="input-wrapper">
<input type="number" id="incomeInput" placeholder="0" class="number-input">
<span class="input-suffix">CVE</span>
</div>
<div id="affordabilityIndicator" style="display: none; margin-top: 1rem;">
<div class="affordability-bar" id="affordabilityBar"></div>
<p class="affordability-text" id="affordabilityText"></p>
</div>
</div>
</div>
<!-- Amortization Schedule -->
<div class="amortization-section">
<div class="section-header">
<h3 data-i18n="results.amortization.title">📅 Como vai pagar?</h3>
<button type="button" class="toggle-btn" onclick="toggleAmortization()">▼</button>
</div>
<p class="section-helper" data-i18n="results.amortization.subtitle">Primeiras 12 prestações (cronograma completo disponível)</p>
<div id="amortizationContent" class="schedule-table" style="display: none;">
<p class="loading-text">Loading...</p>
</div>
</div>
<!-- Transparency Section -->
<div class="transparency-section">
<div class="section-header">
<h3 data-i18n="results.transparency.title">🔓 Transparência</h3>
</div>
<div class="transparency-content">
<p><strong data-i18n="results.transparency.disclaimer">Este simulador é apenas educativo. Os valores são estimativas com base no mercado de Cabo Verde e podem variar conforme o banco.</strong></p>
<p><span data-i18n="results.transparency.privacy">🔒 Privacidade: Não guardamos nenhum dado seu. Tudo funciona no seu browser.</span></p>
<p><span data-i18n="results.transparency.contact">Contactar banco: Confirme sempre os valores com sua instituição financeira antes de assinar qualquer contrato.</span></p>
</div>
</div>
<!-- Comparison Mode -->
<div class="comparison-section">
<div class="section-header">
<h3 data-i18n="results.comparison.title">🔀 Modo Comparação</h3>
<button type="button" class="toggle-btn" onclick="toggleComparison()">▼</button>
</div>
<div id="comparisonContent" style="display: none;">
<p class="info-text" data-i18n="results.comparison.info">Use os controles acima para ajustar os valores. Clique no botão abaixo para comparar a situação anterior com a atual.</p>
<button type="button" class="btn btn-secondary" onclick="captureComparison()" style="width: 100%;" data-i18n="results.comparison.button">📸 Capturar para Comparação</button>
<div id="comparisonResults" style="display: none; margin-top: 1rem;"></div>
</div>
</div>
</div>
</div>
<p class="footer-text" data-i18n="footer.disclaimer">Simulação indicativa com base no mercado de Cabo Verde (CV) - Consulte a instituição financeira para valores exatos.</p>
<p class="footer-text">© 2026<a href="https://marovski.github.io/" target="_blank">Mário Cardoso</a> <span data-i18n="footer.credit">Simulador de Crédito Cabo Verde</span></p>
<p class="footer-text">🔗 <a href="https://github.com/marovski/simuladorcreditoCV" target="_blank">GitHub Repository</a></p>
</div>
<!-- Info Popup -->
<div id="infoPopup" class="popup-overlay" style="display: none;">
<div class="popup-content">
<button class="popup-close" onclick="closeInfo()">✕</button>
<div class="popup-header">
<div class="popup-icon">ℹ️</div>
<h3 id="popupTitle"></h3>
</div>
<p id="popupDescription"></p>
<div class="popup-formula" id="popupFormula" style="display: none;">
<p class="formula-title" data-i18n="popup.formula">📐 Fórmula utilizada:</p>
<pre id="formulaContent"></pre>
</div>
<button class="popup-button" onclick="closeInfo()" data-i18n="popup.button">Entendi</button>
</div>
</div>
<!-- Android / Desktop PWA Install Banner -->
<div id="androidInstallBanner" class="ios-install-banner" style="display:none" role="complementary" aria-label="Install app">
<div class="ios-install-banner__content">
<img src="favicon.svg" alt="App icon" class="ios-install-banner__icon">
<div class="ios-install-banner__text">
<strong id="androidBannerTitle">Instalar aplicação</strong>
<span id="androidBannerDesc">Adicione ao ecrã inicial para acesso rápido e uso offline.</span>
</div>
</div>
<div class="ios-install-banner__actions">
<button class="ios-install-banner__install" id="androidInstallBtn" onclick="triggerAndroidInstall()">Instalar</button>
<button class="ios-install-banner__close" onclick="dismissAndroidBanner()" aria-label="Fechar">✕</button>
</div>
</div>
<!-- iOS PWA Install Banner -->
<div id="iosInstallBanner" class="ios-install-banner" style="display:none" role="complementary" aria-label="Install app">
<div class="ios-install-banner__content">
<img src="favicon.svg" alt="App icon" class="ios-install-banner__icon">
<div class="ios-install-banner__text">
<strong id="iosBannerTitle">Instalar aplicação</strong>
<span id="iosBannerDesc">Toque em <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="vertical-align:middle"><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/><polyline points="16 6 12 2 8 6"/><line x1="12" y1="2" x2="12" y2="15"/></svg> e depois "Adicionar ao ecrã inicial"</span>
</div>
</div>
<button class="ios-install-banner__close" onclick="dismissIOSBanner()" aria-label="Fechar">✕</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="script.js"></script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/simuladorcreditoCV/sw.js')
.catch(() => {});
});
}
</script>
</body>
</html>