templates/base.html.twig line 1
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Welcome!{% endblock %}</title>
<!-- Bootstrap 5 cdn -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- Font Awesome 5 cdn -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<link rel="stylesheet" href="{{ app.request.schemeAndHttpHost }}/css/style.css">
<!-- JQuery 3.3.1 cdn -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://getbootstrap.com/docs/5.0/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
{% block body %}{% endblock %}
</body>
<script>
$(document).ready(function() {
$('.js-decimal-mask').on('input', function() {
// Remove caracteres que não são números ou ponto
var sanitized = $(this).val().replace(/[^0-9.]/g, '');
// Se houver mais de um ponto, remova os extras
if ((sanitized.match(/\./g) || []).length > 1) {
sanitized = sanitized.replace(/\.+$/, "");
}
// Limita a duas casas decimais
var decimalCheck = sanitized.split('.');
if (decimalCheck[1] && decimalCheck[1].length > 2) {
decimalCheck[1] = decimalCheck[1].substring(0, 2);
sanitized = decimalCheck.join('.');
}
// Atualiza o valor no campo
$(this).val(sanitized);
});
});
</script>
</html>