templates/base.html.twig line 1

  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="UTF-8">
  5.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.         <title>{% block title %}Welcome!{% endblock %}</title>
  7.         <!-- Bootstrap 5 cdn -->
  8.         <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  9.         
  10.         <!-- Font Awesome 5 cdn -->
  11.         <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
  12.         <link rel="stylesheet" href="{{ app.request.schemeAndHttpHost }}/css/style.css">
  13.         
  14.         <!-- JQuery 3.3.1 cdn -->
  15.         <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
  16.         <script src="https://getbootstrap.com/docs/5.0/dist/js/bootstrap.bundle.min.js"></script>
  17.         
  18.       
  19.     </head>
  20.     <body>
  21.         {% block body %}{% endblock %}
  22.     </body>
  23.     <script>
  24.         $(document).ready(function() {
  25.             $('.js-decimal-mask').on('input', function() {
  26.                 // Remove caracteres que não são números ou ponto
  27.                 var sanitized = $(this).val().replace(/[^0-9.]/g, '');
  28.         
  29.                 // Se houver mais de um ponto, remova os extras
  30.                 if ((sanitized.match(/\./g) || []).length > 1) {
  31.                     sanitized = sanitized.replace(/\.+$/, "");
  32.                 }
  33.         
  34.                 // Limita a duas casas decimais
  35.                 var decimalCheck = sanitized.split('.');
  36.                 if (decimalCheck[1] && decimalCheck[1].length > 2) {
  37.                     decimalCheck[1] = decimalCheck[1].substring(0, 2);
  38.                     sanitized = decimalCheck.join('.');
  39.                 }
  40.         
  41.                 // Atualiza o valor no campo
  42.                 $(this).val(sanitized);
  43.             });
  44.         });
  45.     </script>
  46. </html>