templates/front/form/claim.html.twig line 1

Open in your IDE?
  1. {% extends "front/_common/_base.html.twig" %}
  2. {% block linkcanonical %}
  3.     <link rel="canonical" href="{{ absolute_url(path('claim')) }}">
  4. {% endblock %}
  5. {% block cssadicional %}
  6. <style>
  7.     #apoderado-block {
  8.         display: none;
  9.         margin-top: 15px;
  10.         padding: 15px;
  11.         background: #f5f5f5;
  12.         border-radius: 5px;
  13.     }
  14.     #apoderado-block.show {
  15.         display: block;
  16.     }
  17.     #signature-canvas {
  18.         background: #fff;
  19.         cursor: crosshair;
  20.     }
  21.     .libro__acciones small{
  22.             margin-bottom: 20px!important;
  23.     }
  24.     .firma-section .firma-content {
  25.         display: flex;
  26.         align-items: flex-end;
  27.         gap: 10px;
  28.     }
  29.     .firma-section label {
  30.         width: 100%;
  31.     }
  32.     @media (max-width: 768px) {
  33.         .firma-section .firma-content {
  34.             flex-direction: column;
  35.             align-items: stretch;
  36.         }
  37.         .firma-section .firma-content canvas {
  38.             width: 100% !important;
  39.             height: 200px;
  40.         }
  41.     }
  42. </style>
  43. {% if info.captchaShow %}
  44. <script type="text/javascript">
  45.     var onloadCallback = function() {
  46.         grecaptcha.render('html_element', {
  47.             'sitekey' : '{{ info.captchaSite }}'
  48.         });
  49.     };
  50. </script>
  51. {% endif %}
  52. {% endblock %}
  53. {% block classbody %}{% endblock %}
  54. {% block content %}
  55. <section class="libro">
  56.     <article>
  57.         <div class="wancho">
  58.             <div class="general_breadcrumbs">
  59.                 <ul>
  60.                     <li><a href="{{ path('home') }}">INICIO</a></li>
  61.                     <li><a href="{{ path('claim') }}" aria-selected="true">LIBRO DE RECLAMACIONES</a></li>
  62.                 </ul>
  63.             </div>
  64.             <div class="main_title_layout">
  65.                 {% if home.claimPrefix %}
  66.                 <h2>{{ home.claimPrefix }}</h2>
  67.                 {% endif %}
  68.                 {% if home.claimTitle %}
  69.                 <h1 class="general_title">{{ home.claimTitle }}</h1>
  70.                 {% endif %}
  71.             </div>
  72.         </div>
  73.     </article>
  74.     <article class="libro_ctn">
  75.         <div class="wancho">
  76.             <div class="libro__wancho">
  77.                 <div class="libro_bloque1">
  78.                     <p>
  79.                         {{ home.claimDescription }}
  80.                     </p>
  81.                     <ul>
  82.                         {% if home.claimReason %}
  83.                         <li><strong>Razón Social:</strong>{{ home.claimReason }}</li>
  84.                         {% endif %}
  85.                         {% if home.claimRuc %}
  86.                         <li><strong>RUC:</strong>{{ home.claimRuc }}</li>
  87.                         {% endif %}
  88.                         {% if home.claimAddress %}
  89.                         <li><strong>Dirección:</strong>{{ home.claimAddress}}</li>
  90.                         {% endif %}
  91.                     </ul>
  92.                     {% if home.claimDate %}
  93.                     <span>{{ home.claimDate|replace({'%fecha%' : 'now'|date('d / m / Y')}) }}</span>
  94.                     {% endif %}
  95.                 </div>
  96.                 <div class="general_form">
  97.                     {{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}
  98.                     {{ form_widget(form.utmSource, {'attr': {'class': 'form_utmsource'}}) }}
  99.                     {{ form_widget(form.utmMedium, {'attr': {'class': 'form_utmmedium'}}) }}
  100.                     {{ form_widget(form.utmCampaign, {'attr': {'class': 'form_utmcampaign'}}) }}
  101.                     {{ form_widget(form.utmContent, {'attr': {'class': 'form_utmcontent'}}) }}
  102.                     {{ form_widget(form.utmTerm, {'attr': {'class': 'form_utmterm'}}) }}
  103.                     {{ form_widget(form.gclid, {'attr': {'class': 'gclid'}}) }}
  104.                     {{ form_widget(form.firma, {'attr': {'id': 'firma-input'}}) }}
  105.                     {{ form_widget(form.uniq, {'attr': {'id': 'uniq-input'}}) }}
  106.                     <fieldset class="form__block">
  107.                         {% if home.claimP1Title %}
  108.                         <legend>{{ home.claimP1Title }}</legend>
  109.                         {% endif %}
  110.                         <div class="formGroup">
  111.                             <div class="fInput" style="width: 100%!important;">
  112.                                 <label for="nombre">Nombres</label>
  113.                                 {{ form_widget(form.name, {'attr': {'class':'validKeypress', 'data-maxChar':'50', 'data-expression':'text'}}) }}
  114.                             </div>
  115.                            
  116.                         </div>
  117.                         <div class="formGroup">
  118.                              <div class="fInput">
  119.                                 <label for="apellidopaterno">Apellido Paterno</label>
  120.                                 {{ form_widget(form.apellidoPaterno, {'attr': {'class':'validKeypress', 'data-maxChar':'50', 'data-expression':'text'}}) }}
  121.                             </div>
  122.                             <div class="fInput">
  123.                                 <label for="apellidomaterno">Apellido Materno</label>
  124.                                 {{ form_widget(form.apellidoMaterno, {'attr': {'class':'validKeypress', 'data-maxChar':'50', 'data-expression':'text'}}) }}
  125.                             </div>
  126.                         </div>
  127.                         <div class="formGroup">
  128.                             <div class="fInput">
  129.                                 <label for="telefono">Teléfono</label>
  130.                                 {{ form_widget(form.phone, {'attr': {'class':'validKeypress', 'type': 'tel', 'data-maxChar':'15', 'data-expression':'number'}}) }}
  131.                             </div>
  132.                             <div class="fInput">
  133.                                 <label for="correo">Correo Electrónico</label>
  134.                                 {{ form_widget(form.email, {'attr': {'class':'validKeypress', 'type': 'email', 'data-maxChar':'100', 'data-expression':'email'}}) }}
  135.                             </div>
  136.                         </div>
  137.                         <div class="formGroup">
  138.                             <div class="fInput">
  139.                                 <label for="ciudad">Ciudad</label>
  140.                                 {{ form_widget(form.ciudad, {'attr': {'data-maxChar':'100'}}) }}
  141.                             </div>
  142.                                <div class="fInput">
  143.                             <label for="direccion">Dirección</label>
  144.                             {{ form_widget(form.address, {'attr': {'data-maxChar':'255'}}) }}
  145.                         </div>
  146.                         </div>
  147.                       
  148.                         <div class="formGroup">
  149.                             <div class="fInput fSelect">
  150.                                 {{ form_widget(form.documentType, {'attr': {'data-validation-placeholder':'Tipo de documento'}}) }}
  151.                             </div>
  152.                             <div class="fInput">
  153.                                 <label for="numerodocumento">N° de Doc.</label>
  154.                                 {{ form_widget(form.documentNumber, {'attr': {'class':'validKeypress', 'data-maxChar':'20', 'data-expression':'number'}}) }}
  155.                             </div>
  156.                         </div>
  157.                         <div class="fCheckBox" style="margin-top: 15px;">
  158.                             <div class="formCheckbox">
  159.                                 {{ form_widget(form.esmenor, {'attr': {'id': 'esmenor-cb', 'class': 'esmenor-checkbox'}}) }}
  160.                                 <label for="esmenor-cb">Soy menor de edad</label>
  161.                             </div>
  162.                         </div>
  163.                         <div id="apoderado-block">
  164.                             <h4 style="margin-bottom: 10px;">Datos del Apoderado/Tutor</h4>
  165.                             <div class="formGroup">
  166.                                 <div class="fInput" style="width: 100%!important;">
  167.                                     <label for="apoderado_nombre">Nombre*</label>
  168.                                     {{ form_widget(form.apoderadoNombre, {'attr': {'class':'validKeypress', 'data-maxChar':'100'}}) }}
  169.                                 </div>
  170.                             </div>
  171.                             <div class="formGroup">
  172.                                 <div class="fInput">
  173.                                     <label for="apoderado_apellidopaterno">Apellido Paterno*</label>
  174.                                     {{ form_widget(form.apoderadoApellidoPaterno, {'attr': {'class':'validKeypress', 'data-maxChar':'100'}}) }}
  175.                                 </div>
  176.                                 <div class="fInput">
  177.                                     <label for="apoderado_apellidomaterno">Apellido Materno</label>
  178.                                     {{ form_widget(form.apoderadoApellidoMaterno, {'attr': {'class':'validKeypress', 'data-maxChar':'100'}}) }}
  179.                                 </div>
  180.                             </div>
  181.                             <div class="formGroup">
  182.                                 <div class="fInput fSelect">
  183.                                  
  184.                                     {{ form_widget(form.apoderadoTipodocumento, {'attr': {'class':'', 'data-validation-placeholder':'Tipo documento'}}) }}
  185.                                 </div>
  186.                                 <div class="fInput">
  187.                                     <label for="apoderado_numerodocumento">N° Documento</label>
  188.                                     {{ form_widget(form.apoderadoNumerodocumento, {'attr': {'class':'validKeypress', 'data-maxChar':'20'}}) }}
  189.                                 </div>
  190.                             </div>
  191.                             <div class="formGroup">
  192.                                 <div class="fInput">
  193.                                     <label for="apoderado_email">Email</label>
  194.                                     {{ form_widget(form.apoderadoEmail, {'attr': {'type': 'email', 'data-maxChar':'100'}}) }}
  195.                                 </div>
  196.                                 <div class="fInput">
  197.                                     <label for="apoderado_telefono">Teléfono</label>
  198.                                     {{ form_widget(form.apoderadoTelefono, {'attr': {'type': 'tel', 'data-maxChar':'15'}}) }}
  199.                                 </div>
  200.                             </div>
  201.                         </div>
  202.                     </fieldset>
  203.                     <fieldset class="form__block">
  204.                         {% if home.claimP2Title %}
  205.                         <legend>{{ home.claimP2Title }}</legend>
  206.                         {% endif %}
  207.                         <div class="radioGroup">
  208.                             {% for item in home.claimGoods %}
  209.                             <div>
  210.                                 <input type="radio" class="libro_good" id="good-{{loop.index}}" name="good" value="{{ item.title }}" {{ loop.first ? 'checked' : ''}} />
  211.                                 <label for="producto">{{ item.title }}</label>
  212.                             </div>
  213.                             {% endfor %}
  214.                         </div>
  215.                         <div class="formGroup" style="margin-top: 15px;">
  216.                             <div class="fInput fSelect">
  217.                                 <select id="moneda-select" name="moneda" class="" >
  218.                                     <option value="" selected="selected">Seleccione la moneda</option>
  219.                                     {% set monedas = currencies is defined and currencies is not empty ? currencies : home.claimCurrencies %}{% if monedas %}
  220.                                         {% for currency in monedas %}
  221.                                             <option value="{{ loop.index }}">{{ currency.title }}</option>
  222.                                         {% endfor %}
  223.                                     {% endif %}
  224.                                 </select>
  225.                             </div>
  226.                             <div class="fInput" >
  227.                                 <label for="monto">Monto</label>
  228.                                 {{ form_widget(form.monto, {'attr': {'data-maxChar':'20', 'onkeypress':'return event.charCode >= 48 && event.charCode <= 57 || event.charCode == 46'}}) }}
  229.                             </div>
  230.                         </div>
  231.                         <div class="fInput">
  232.                             <label for="descripcion">Descripción</label>
  233.                             {{ form_widget(form.description, {'attr': {'data-maxChar':'5000', 'rows':'3'}}) }}
  234.                         </div>
  235.                     </fieldset>
  236.                     <fieldset class="form__block">
  237.                         {% if home.claimP3Title %}
  238.                         <legend>{{ home.claimP3Title }}</legend>
  239.                         {% endif %}
  240.                         <div class="radioGroup">
  241.                             {% for item in home.claimTypes %}
  242.                             <div>
  243.                                 <input type="radio" class="libro_type" id="type-{{loop.index}}" value="{{ item.title }}" name="type" {{ loop.first ? 'checked' : ''}} />
  244.                                 <label for="reclamo">{{ item.title }}</label>
  245.                             </div>
  246.                             {% endfor %}
  247.                         </div>
  248.                         <div class="libro__def">
  249.                             {% for item in home.claimTypes %}
  250.                             <p>
  251.                                 <strong>* {{ item.title }}:</strong> {{ item.description}}
  252.                             </p>
  253.                             {% endfor %}
  254.                         </div>
  255.                         <div class="fInput">
  256.                             <label for="detalle">Descripción</label>
  257.                             {{ form_widget(form.detail, {'attr': {'data-maxChar':'5000', 'rows':'3'}}) }}
  258.                         </div>
  259.                         <div class="fInput">
  260.                             <label for="pedido">Pedido del consumidor</label>
  261.                             {{ form_widget(form.demand, {'attr': {'data-maxChar':'5000', 'rows':'3'}}) }}
  262.                         </div>
  263.                         <div class="fInput firma-section" style="margin-top: 20px;">
  264.                             <label>Firma del consumidor</label>
  265.                             <div class="firma-content">
  266.                                 <canvas id="signature-canvas" width="500" height="150"></canvas>
  267.                                 <button type="button" id="clear-signature" class="btn btn-secondary">Limpiar</button>
  268.                             </div>
  269.                         </div>
  270.                     </fieldset>
  271.                     <fieldset class="libro__acciones">
  272.                         <div class="fInput">
  273.                             <label>Acciones</label>
  274.                             <textarea class="" readonly="readonly"></textarea>
  275.                         </div>
  276.                         {% if home.claimP4Title %}
  277.                         <legend>{{ home.claimP4Title }}</legend>
  278.                         {% endif %}
  279.                         {% set answer_date = answer_date|day ~ ', ' ~ answer_date|date('d') ~ ' de ' ~ answer_date|month|capitalize ~ ' del ' ~ answer_date|date('Y') %}
  280.                         {{ forms.claimP4Text|replace({'%fecha_respuesta%': answer_date})|raw }}
  281.                         {% for item in home.claimNotes %}
  282.                         <small>
  283.                             {{ item.text|raw }}
  284.                         </small>
  285.                         {% endfor %}
  286.                     </fieldset>
  287.                     <div class="fCheckBox">
  288.                         <div class="formCheckbox">
  289.                             <input type="checkbox" id="1" name="check_terminos" class="" />
  290.                             <label for="1"
  291.                                 >He leído y acepto las
  292.                                 <a href="{{ path('privacy') }}" target="_blank">Políticas de privacidad</a></label
  293.                             >
  294.                         </div>
  295.                     </div>
  296.                     {% if info.captchaShow %}
  297.                     <div style="margin-bottom:10px; position: relative; width: max-content;">
  298.                         <div id="html_element"></div>
  299.                     </div>
  300.                     {% endif %}
  301.                     <div class="formButtonCtn">
  302.                         <button class="f-guardar-contacto-general hidden_button_send" id="btnLibro">Enviar</button>
  303.                         <button class="show_button_send">Enviando... <span class="icon-flecha-derecha"></span></button>
  304.                     </div>
  305.                     {{ form_end(form) }}
  306.                 </div>
  307.             </div>
  308.         </div>
  309.     </article>
  310. </section>
  311. {% endblock %}
  312. {% block jsfinal %}
  313. <script src="{{ STATIC_URL }}js/validationform/jquery.validationEngine.js"></script>
  314. {% include 'front/templates/captcha.html.twig' %}
  315. <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/signature_pad@4.0.0/dist/signature_pad.umd.min.js"></script>
  316. <script type="text/javascript">
  317.     $(() => {
  318.         var signaturePad = null;
  319.         function initSignaturePad() {
  320.             var canvas = document.getElementById('signature-canvas');
  321.             if (canvas && !signaturePad) {
  322.                 signaturePad = new SignaturePad(canvas, {
  323.                     backgroundColor: 'rgb(255, 255, 255)',
  324.                     penColor: 'rgb(0, 0, 0)'
  325.                 });
  326.             }
  327.         }
  328.         initSignaturePad();
  329.         $('#clear-signature').on('click', function(e) {
  330.             e.preventDefault();
  331.             if (signaturePad) {
  332.                 signaturePad.clear();
  333.             }
  334.         });
  335.         $('.esmenor-checkbox[type="checkbox"]').change(function() {
  336.             if ($(this).is(':checked')) {
  337.                 $('#apoderado-block').addClass('show');
  338.             } else {
  339.                 $('#apoderado-block').removeClass('show');
  340.             }
  341.         });
  342.         $('form').validationEngine('attach', {
  343.             promptPosition: 'bottomLeft',
  344.             autoHidePrompt: true,
  345.             autoPositionUpdate: false,
  346.             autoHideDelay: 3000,
  347.             addFailureCssClassToField: 'inputError',
  348.             binded: false,
  349.             scroll: false,
  350.             validateNonVisibleFields: true,
  351.             showOneMessage: false,
  352.         });
  353.         $('#btnLibro').on('click', function(event) {
  354.             event.preventDefault();
  355.             if (signaturePad && !signaturePad.isEmpty()) {
  356.                 var firmaData = signaturePad.toDataURL('image/png');
  357.                 $('input[name="form_claim[firma]"]').val(firmaData);
  358.             }
  359.             var uniqValue = $('#uniq-input').val();
  360.             if (!uniqValue) {
  361.                 $('#uniq-input').val(generateUUID());
  362.             }
  363.             $('#form_claim_good').val($('.libro_good:checked').val());
  364.             $('#form_claim_type').val($('.libro_type:checked').val());
  365.             $('#form_claim_monedaId').val($('#moneda-select').val());
  366.             $(this).attr('disabled', true);
  367.             const form = $(this).closest('form');
  368.             let valid = form.validationEngine('validate');
  369.             if (valid && validarRecaptcha()) {
  370.                 document.querySelector('.general_form').classList.add('submit_form');
  371.                 form.submit();
  372.             } else {
  373.                 $(this).attr('disabled', false);
  374.                 return false;
  375.             }
  376.         });
  377.         function generateUUID() {
  378.             return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
  379.                 var r = Math.random() * 16 | 0,
  380.                     v = c == 'x' ? r : (r & 0x3 | 0x8);
  381.                 return v.toString(16);
  382.             });
  383.         }
  384.     });
  385. </script>
  386. {% endblock %}