{"id":392,"date":"2025-08-10T20:10:24","date_gmt":"2025-08-10T20:10:24","guid":{"rendered":"https:\/\/primecreditum.com\/?page_id=392"},"modified":"2025-09-02T20:43:13","modified_gmt":"2025-09-02T20:43:13","slug":"simulador-credito-habitacao","status":"publish","type":"page","link":"https:\/\/primecreditum.com\/index.php\/simulador-credito-habitacao\/","title":{"rendered":"Simulador Cr\u00e9dito Habita\u00e7\u00e3o"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"392\" class=\"elementor elementor-392\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-c911010 e-flex e-con-boxed e-con e-parent\" data-id=\"c911010\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ca268a3 elementor-widget__width-auto elementor-widget elementor-widget-html\" data-id=\"ca268a3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<body style=\"background:#0a222f; margin:0; padding:0;\">\n\n<div style=\"max-width: 600px; margin: 40px auto; padding: 30px; background: #a08e84; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); font-family: 'Arial', sans-serif; color:#0a222f;\">\n  <h2 style=\"text-align:center; margin-bottom:25px; font-size:24px; font-weight:700; color:#0a222f;\">\n    Simulador Cr\u00e9dito Habita\u00e7\u00e3o\n  <\/h2>\n\n  <label style=\"font-weight: 600; display:block; margin-bottom:6px;\">Valor do Im\u00f3vel (\u20ac)<\/label>\n  <input type=\"text\" id=\"valor\" inputmode=\"numeric\" placeholder=\"Ex: 200 000\" style=\"width:100%; padding:12px; margin-bottom:18px; border:1px solid #ddd; border-radius:8px; color:#333;\">\n\n  <label style=\"font-weight: 600; display:block; margin-bottom:6px;\">Entrada Inicial (\u20ac)<\/label>\n  <input type=\"text\" id=\"entrada\" inputmode=\"numeric\" placeholder=\"Ex: 20 000\" style=\"width:100%; padding:12px; margin-bottom:18px; border:1px solid #ddd; border-radius:8px; color:#333;\">\n\n  <label style=\"font-weight: 600; display:block; margin-bottom:6px;\">Prazo (anos)<\/label>\n  <input type=\"text\" id=\"prazo\" inputmode=\"numeric\" placeholder=\"Ex: 30\" style=\"width:100%; padding:12px; margin-bottom:18px; border:1px solid #ddd; border-radius:8px; color:#333;\">\n\n  <label style=\"font-weight: 600; display:block; margin-bottom:6px;\">Taxa de Juro Anual (%)<\/label>\n  <input type=\"text\" id=\"taxa\" inputmode=\"decimal\" placeholder=\"Ex: 3,5\" style=\"width:100%; padding:12px; margin-bottom:20px; border:1px solid #ddd; border-radius:8px; color:#333;\">\n\n  <button onclick=\"calcularPrestacao()\" style=\"width:100%; padding:14px; background:#ffffff; color:#0a222f; border:none; border-radius:8px; font-size:16px; font-weight:600; cursor:pointer; transition:0.3s;\">\n    Calcular\n  <\/button>\n\n  <h3 style=\"margin-top:25px; text-align:center; font-size:20px; color:#0a222f;\">\n    Presta\u00e7\u00e3o Mensal: <span id=\"resultado\">\u2014<\/span>\n  <\/h3>\n<\/div>\n\n<script>\n\/\/ Converte texto -> n\u00famero (remove espa\u00e7os, troca v\u00edrgula por ponto)\nfunction parseNum(str) {\n  if (!str) return NaN;\n  return parseFloat(String(str).replace(\/\\s+\/g, '').replace(',', '.'));\n}\n\n\/\/ Formata n\u00famero com espa\u00e7os nos milhares (usa pt-PT e troca NBSP por espa\u00e7o normal)\nfunction formatWithSpaces(num, decimals = 0) {\n  if (isNaN(num)) return '';\n  return num\n    .toLocaleString('pt-PT', { minimumFractionDigits: decimals, maximumFractionDigits: decimals })\n    .replace(\/\\u00A0\/g, ' ');\n}\n\n\/\/ Formata inputs ao sair do campo\nfunction attachFormatOnBlur(id, decimals = 0) {\n  const el = document.getElementById(id);\n  el.addEventListener('blur', () => {\n    const n = parseNum(el.value);\n    if (!isNaN(n)) el.value = formatWithSpaces(n, decimals);\n  });\n}\n\n\/\/ Liga formata\u00e7\u00e3o nos campos\nattachFormatOnBlur('valor', 0);\nattachFormatOnBlur('entrada', 0);\nattachFormatOnBlur('prazo', 0);\nattachFormatOnBlur('taxa', 2);\n\nfunction calcularPrestacao() {\n  const valor   = parseNum(document.getElementById(\"valor\").value);\n  const entrada = parseNum(document.getElementById(\"entrada\").value);\n  const prazo   = parseNum(document.getElementById(\"prazo\").value);\n  const taxa    = parseNum(document.getElementById(\"taxa\").value);\n\n  if (isNaN(valor) || isNaN(entrada) || isNaN(prazo) || isNaN(taxa)) {\n    alert(\"Por favor preencha todos os campos corretamente.\");\n    return;\n  }\n\n  const montante = valor - entrada;\n  const taxaMensal = (taxa \/ 100) \/ 12;\n  const numeroPrestacoes = prazo * 12;\n\n  const prestacao = montante * (taxaMensal * Math.pow(1 + taxaMensal, numeroPrestacoes)) \/\n                    (Math.pow(1 + taxaMensal, numeroPrestacoes) - 1);\n\n  document.getElementById(\"resultado\").innerText = formatWithSpaces(prestacao, 2) + \" \u20ac\";\n}\n<\/script>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Simulador Cr\u00e9dito Habita\u00e7\u00e3o Valor do Im\u00f3vel (\u20ac) Entrada Inicial (\u20ac) Prazo (anos) Taxa de Juro Anual (%) Calcular Presta\u00e7\u00e3o Mensal: \u2014<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-392","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/pages\/392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/comments?post=392"}],"version-history":[{"count":26,"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/pages\/392\/revisions"}],"predecessor-version":[{"id":445,"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/pages\/392\/revisions\/445"}],"wp:attachment":[{"href":"https:\/\/primecreditum.com\/index.php\/wp-json\/wp\/v2\/media?parent=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}