PageSourceSearch

https://www.hitsmobile.es/assets/js/front/checkCobertura.js?v=1790921841

js hitsmobile.es collected 2026-10-02 06:28:56 UTC 76,140 bytes, 1,443 lines download raw bytes

1$(document).ready(function () {
2    console.log("checkCobertura.js");
3
4    modalSeleccionVivienda = $('#myModalCheck');
5
6    var resultado_consulta_fulladdress = $('#resultado_consulta_fulladdress').text();
7    if (resultado_consulta_fulladdress == '' || resultado_consulta_fulladdress == null) {
8        var storageAddress = localStorage.getItem("cobertura_install_address");
9        if (storageAddress && storageAddress !== 'undefined') {
10            $('#resultado_consulta_fulladdress').html(storageAddress);
11        }
12    }
13    var storageInstallAddress = localStorage.getItem("cobertura_install_address");
14    console.log(storageInstallAddress);
15    if (storageInstallAddress && storageInstallAddress !== 'undefined') {
16        $('#resultadoConsultaDireccion').html(storageInstallAddress);
17    }
18
19    var coberturaAddress = localStorage.getItem("cobertura_address");
20
21    if(!storageInstallAddress && !coberturaAddress){
22        $.ajax({
23            url: baseUrl + 'hire/clearDataCobertura', method: 'POST', async: false, success: function (data) {
24            }
25        });
26    }
27
28    var titleTarifa = $('#nodetitle').val();
29    if (titleTarifa == '' || titleTarifa == null) {
30        titleTarifa = $('#titleTarifa').val();
31    }
32
33    dirConNumero = false;
34    lastNumber = '';
35
36    var tipoTarifaDetalle = '';
37    if ($('.custom-card').hasClass('--is-variation-fiber')) {
38        tipoTarifaDetalle = 'Internet';
39    }
40    if ($('.custom-card ').hasClass('--is-variation-internet-mobile')) {
41        tipoTarifaDetalle = 'Internet + Móvil';
42    }
43    if ($('.custom-card ').hasClass('--is-variation-internet-tv')) {
44        tipoTarifaDetalle = 'Televisión';
45    }
46    if ($('.custom-card ').hasClass('--is-variation-mobile')) {
47        tipoTarifaDetalle = 'Móvil';
48    }
49    if (tipoTarifaDetalle == '' || tipoTarifaDetalle == null) {
50        tipoTarifaDetalle = $('#rateType').val();
51    }
52
53    $('.buton_detalles').click(function () {
54        $('html, body').animate({scrollTop: 0}, 'slow'); //seleccionamos etiquetas,clase o identificador destino, creamos animación hacia top de la página.
55    });
56
57    $('.submitAvisar').click(function () {
58        var datosOk = 0;
59        $('#contactAvisad').find('input').each(function () {
60            if ($(this).prop('required') && $(this).val() !== '' && $(this).attr('id') === 'email') {
61                if ($(this).val().indexOf('@', 0) == -1 || $(this).val().indexOf('.', 0) == -1) {
62                    datosOk++;
63                }
64            }
65        });
66        if (datosOk !== 0) {
67            $('#error').modal('show');
68        } else {
69            $('#enviando').modal({backdrop: 'static', keyboard: false});
70            $('#enviando').modal('show');
71        }
72
73
74    });
75
76// COMPROBAR EL NÚMERO DE TELÉFONO ES DE 9 DIGITOS Y EMPIEZA POR 6/7/8 O 9
77    $(document).on('change, input', '#telefono', function () {
78        var input = this;
79        var primer = $(this).val().charAt(0);
80        if ($(this).val().length !== 9 || (primer !== '6' && primer !== '7' && primer !== '8' && primer !== '9')) {
81
82            input.setCustomValidity('El número de teléfono no es válido.');
83        } else {
84
85            input.setCustomValidity('');
86        }
87
88    });
89
90    $(document).on('change, input', '#telefonoCheckCobertura', function () {
91        var input = this;
92        var primer = $(this).val().charAt(0);
93        if ($(this).val().length !== 9 || (primer !== '6' && primer !== '7' && primer !== '8' && primer !== '9')) {
94            input.setCustomValidity('El número de teléfono no es válido.');
95        } else {
96            input.setCustomValidity('');
97        }
98    });
99
100    function quitarAcentos(texto) {
101        return $.trim(texto || '')
102            .toLowerCase()
103            .replace(/[áàäâ]/g, 'a')
104            .replace(/[éèëê]/g, 'e')
105            .replace(/[íìïî]/g, 'i')
106            .replace(/[óòöô]/g, 'o')
107            .replace(/[úùüû]/g, 'u')
108        // .replace(/[ñ]/g, 'n');
109    }
110
111
112    var addressSelected = false;
113    var listaDirecciones = [];
114
115    $('#address').on('input', function () {
116
117        if (addressSelected) {
118            addressSelected = false;
119            $('#technicalId').val('');
120            $('#address').removeClass('input-success').addClass('input-error');
121        }
122
123        $("#address").autocomplete({
124            delay: 300,
125            minLength: 3,
126
127            source: function (request, response) {
128
129                var address = quitarAcentos(request.term);
130                var addressEspacion = address.replace(/ /g, '%20');
131                $('ul.ui-autocomplete').css('z-index', '4');
132                $('ul.ui-autocomplete').css('width', '300px!important');
133
134                const $form = $('#codigo-postalCheck').closest('form'); // o donde tengas el hidden CSRF
135                const data = {
136                    address: addressEspacion.toLowerCase(),
137                    cp: $('#codigo-postalCheck').val()
138                };
139
140                const $csrf = $form.find('input[type="hidden"][id="csrf"]');
141                data[$csrf.attr('name')] = $csrf.val();
142
143                $.ajax({
144                    url: baseUrl + 'hire/getAllAddress',
145                    type: "POST",
146                    data: {
147                        address: addressEspacion.toLowerCase(),
148                        cp: $('#codigo-postalCheck').val()
149                    },
150                    success: function (data) {
151                        response($.map(data, function (item) {
152                            return {
153                                label: item.direccion,
154                                value: item.direccion,
155                                data1: item.tecnhicalId,
156                                data: item.postal_code,
157                                dirNum: item.number
158
159                                // value1: item.postal_code
160                            };
161                        }));
162                    }
163                });
164            },
165            select: function (e, ui) {
166                addressSelected = true;
167                lastNumber = ui.item.dirNum;
168
169                $('#number').val(ui.item.dirNum).change();
170                $('#codigo-postalCheck').val(ui.item.data).change();
171                $('#address').blur();
172
173                $('#address').removeClass('input-error');
174                $('#address').addClass('input-success');
175
176                $('#codigo-postalCheck').removeClass('input-error');
177                $('#codigo-postalCheck').addClass('input-success');
178                $('#codigo-postalCheck').closest('.col-cobertura').find('.custom-error').html('');
179
180                setTimeout(function () {
181                    $('#technicalId').val(ui.item.data1);
182                    checkFilledForm('address');
183                    // checkFilledForm('number');
184                }, 150);
185            }
186        });
187
188    });
189
190    $('#address').on('click', function () {
191        var autocompleteWidget = $(this).data("uiAutocomplete");
192        if (autocompleteWidget && !autocompleteWidget.menu.element.is(":visible")) {
193            var val = $(this).val();
194            if (val.length >= 3) {
195                $(this).autocomplete("search", val);
196            }
197        }
198    });
199
200    $(document).on('click', '.buttonCobertura, .buttonResultado', function () {
201        $('.firstPart').css('display', 'block');
202        $('.pResultado').html('');
203        $('.buttonResultado').html('');
204        $('.secondPart').css('display', 'none');
205        $('.addressResult').html('');
206        $('#address').val('');
207        $('#codigo-postalCheck').val('');
208        $('#number').val('');
209        $("#nonumber").prop("checked", false);
210
211        $('.formComprobarCobertura').find('#address').removeClass('input-success');
212        $('.formComprobarCobertura').find('#codigo-postalCheck').removeClass('input-success');
213        $('.formComprobarCobertura').find('#number').removeClass('input-success');
214        $('.formComprobarCobertura').find('#readModal').removeClass('input-success');
215
216        $('.select_bloque').val('');
217        $('.select_puerta').val('');
218        $('.select_escalera').val('');
219        $('.select_planta').val('');
220        $('.select_puerta2').val('');
221        $('.select_det_puerta').val('');
222        $('.select_bis').val('');
223        $('.select_letra').val('');
224        $('.option').each(function () {
225            $(this).removeClass('selected');
226        });
227        $('#noDir').val('N');
228        $('.select_bloque1').find('.current').html('Bloque');
229        $('.select_puerta1').find('.current').html('Puerta');
230        $('.select_escalera1').find('.current').html('Escalera');
231        $('.select_planta1').find('.current').html('Planta');
232        $('.select_puerta21').find('.current').html('Puerta');
233        $('.select_det_puerta1').find('.current').html('Detalles puerta');
234        $('.select_bis1').find('.current').html('Bis/Dup/Km');
235        $('.select_letra1').find('.current').html('Letra');
236
237    });
238
239
240    $("#filterAddressCobertura").keyup(function () {
241        var n = $(this).val().toLowerCase();
242        $(this).parent().find("tr").each(function () {
243            var value = $(this).attr("data-find"); //convert attribute value to lowercase
244            if (typeof value != 'undefined') {
245                value = value.toLowerCase();
246                n = n.toLowerCase();
247                if (value.includes(n)) {
248                    $(this).show();
249                } else {
250                    $(this).hide();
251                }
252            }
253        });
254    });
255
256    $(document).on('click', '.ButonModificar', function () {
257        removeDatosConsultaCobertura();
258
259        $.ajax({
260            url: baseUrl + 'hire/clearDataCobertura', method: 'POST', async: false, success: function (data) {
261            }
262        });
263    });
264
265    getDatosConsultaCobertura();
266
267    $(document).on('click', '#submitCheck', function () {
268        var input = this;
269        var noDir = $('#noDir').val();
270        var address = $('#install_address').val();
271        if (!address) {
272            address = $('#install_address_check').val() || '';
273        }
274        var separar = address.split(',');
275        var dircompletaTotal = separar[0];
276        $('.pResultado').html('');
277        $('.buttonResultado').html('');
278        $('.addressResult').html('');
279
280        var email = $('.formComprobarCobertura').find('#email').val();
281        var phone = $('.formComprobarCobertura').find('#telefonoCheckCobertura').val();
282        var hashNode = $('.hashBonoExtra').val();
283
284        $('#submitCheck').attr('disabled', 'disabled');
285
286        if (noDir == 'N') {
287            if ($(".checkSelected input[type='radio']").is(':checked')) {
288                var idVivienda = $('input:radio[name=verticals-service]:checked').val();
289                var seleccion = $('input:radio[name=verticals-service]:checked').attr('id');
290                var bloque = $('#' + seleccion + '-bloque').text();
291                var puerta = $('#' + seleccion + '-puerta').text();
292                var letra = $('#' + seleccion + '-letra').text();
293                var escalera = $('#' + seleccion + '-escalera').text();
294                // var piso = $('#' + seleccion + '-piso').text();
295                var hand1 = $('#' + seleccion + '-hand1').text();
296                var hand2 = $('#' + seleccion + '-hand2').text();
297
298                if (bloque !== '') {
299                    dircompletaTotal += ' ' + bloque;
300                }
301                if (puerta !== '') {
302                    dircompletaTotal += ' ' + puerta;
303                }
304                if (letra !== '') {
305                    dircompletaTotal += ' ' + letra;
306                }
307                if (escalera !== '') {
308                    dircompletaTotal += ' ' + escalera;
309                }
310                // if (piso !== '') {
311                //     dircompletaTotal += ' ' + piso;
312                // }
313                if (hand1 !== '') {
314                    dircompletaTotal += ' ' + hand1;
315                }
316                if (hand2 !== '') {
317                    dircompletaTotal += ' ' + hand2;
318                }
319                dircompletaTotal += ', ' + separar.splice(1).toString();
320                dircompletaTotal = dircompletaTotal.replace('   ', ' ');
321                $('#install_address').val(dircompletaTotal);
322                $('#contact_email').val(email);
323                $('#contact_tlf').val(phone);
324                $('#id_address').val(idVivienda);
325                // $("#form_address").submit();
326
327                $.ajax({
328                    url: baseUrl + 'hire/checkCobertura',
329                    method: 'POST',
330                    data: {
331                        email: email,
332                        address: address,
333                        hashNode: hashNode,
334                        addressId: $('#id_address').val()
335                    },
336                    success: function (data) {
337                        if (data == true) {
338                            $('#myModalCheck').modal('hide');
339                            $('.firstPart').css('display', 'none');
340                            $('.pResultado').html(ptrueResultado);
341                            $('.buttonResultado').html(buttontrueResultado);
342                            $('.secondPart').css('display', 'block');
343                            $('.addressResult').html(dircompletaTotal);
344                            $('#resultadoConsultaDireccion').html(dircompletaTotal);
345
346                            saveDatosConsultaCobertura();
347
348                            localStorage.setItem("cobertura_resultado", 'Y');
349                            localStorage.setItem("cobertura_install_address", dircompletaTotal);
350                            localStorage.setItem("cobertura_cp", $('#codigo-postalCheck').val() || $('.formComprobarCobertura').find('#codigo-postalCheck').val());
351
352                            $.ajax({
353                                url: baseUrl + 'sendMailCheckCobertura', method: 'POST', data: {
354                                    dircompleta: dircompletaTotal,
355                                    cp: $('#codigo-postalCheck').val() || $('.formComprobarCobertura').find('#codigo-postalCheck').val(),
356                                    phone: phone,
357                                    email: email,
358                                    resultadoComprobacion: 'Si'
359                                }
360                            });
361
362                        } else {
363                            $('#myModalCheck').modal('hide');
364                            $('.firstPart').css('display', 'none');
365                            $('.pResultado').html(pfalseResultado);
366                            $('.buttonResultado').html(buttonfalseResultado);
367                            $('.secondPart').css('display', 'block');
368                            $('.addressResult').html(dircompletaTotal);
369
370                            localStorage.setItem("cobertura_resultado", 'N');
371                            localStorage.setItem("cobertura_install_address", '');
372
373                            $.ajax({
374                                url: baseUrl + 'sendMailCheckCobertura', method: 'POST', data: {
375                                    dircompleta: dircompletaTotal,
376                                    cp: $('#codigo-postalCheck').val() || $('.formComprobarCobertura').find('#codigo-postalCheck').val(),
377                                    phone: phone,
378                                    email: email,
379                                    resultadoComprobacion: 'No'
380                                }
381                            });
382
383                        }
384                    }
385                });
386                $('.mchimp-errmessage1').css('display', 'none');
387            } else {
388
389                // $('.mchimp-errmessage1').html('Selecciona una dirección');
390                // $('.mchimp-errmessage1').css('display', 'block');
391            }
392        } else {
393
394            var select_bloque = $('.select_bloque option:selected').val();
395            var select_puerta = $('.select_puerta option:selected').val();
396            var select_escalera = $('.select_escalera option:selected').val();
397            var select_planta = $('.select_planta option:selected').val();
398            var select_puerta2 = $('.select_puerta2 option:selected').val();
399            var select_det_puerta = $('.select_det_puerta option:selected').val();
400            var select_bis = $('.select_bis option:selected').val();
401            var select_letra = $('.select_letra option:selected').val();
402
403
404            if (select_bloque !== '') {
405                dircompletaTotal += ' ' + select_bloque;
406            }
407            if (select_puerta !== '') {
408                dircompletaTotal += ' ' + select_puerta;
409            }
410            if (select_escalera !== '') {
411                dircompletaTotal += ' ' + select_escalera;
412            }
413            if (select_planta !== '') {
414                dircompletaTotal += ' ' + select_planta;
415            }
416            if (select_puerta2 !== '') {
417                dircompletaTotal += ' ' + select_puerta2;
418            }
419            if (select_det_puerta !== '') {
420                dircompletaTotal += ' ' + select_det_puerta;
421            }
422            if (select_bis !== '') {
423                dircompletaTotal += ' ' + select_bis;
424            }
425            if (select_letra !== '') {
426                dircompletaTotal += ' ' + select_letra;
427            }
428
429            dircompletaTotal += ', ' + separar.splice(1).toString();
430            dircompletaTotal = dircompletaTotal.replace('   ', ' ');
431            $('#install_address').val(dircompletaTotal);
432            $('#contact_email').val(email);
433            $('#contact_tlf').val(phone);
434
435            $.ajax({
436                url: baseUrl + 'hire/checkCobertura',
437                method: 'POST',
438                data: {
439                    email: email,
440                    address: address,
441                    hashNode: hashNode,
442                    addressId: $('#id_address').val()
443                },
444                success: function (data) {
445                    if (data == true) {
446                        $('#myModalCheck').modal('hide');
447                        $('.firstPart').css('display', 'none');
448                        $('.pResultado').html(ptrueResultado);
449                        $('.buttonResultado').html(buttontrueResultado);
450                        $('.secondPart').css('display', 'block');
451                        $('.addressResult').html(dircompletaTotal);
452                        $('#resultadoConsultaDireccion').html(dircompletaTotal);
453
454                        saveDatosConsultaCobertura();
455
456                        localStorage.setItem("cobertura_resultado", 'Y');
457                        localStorage.setItem("cobertura_install_address", dircompletaTotal);
458                        localStorage.setItem("cobertura_cp", $('#codigo-postalCheck').val() || $('.formComprobarCobertura').find('#codigo-postalCheck').val());
459
460                        $.ajax({
461                            url: baseUrl + 'sendMailCheckCobertura', method: 'POST', data: {
462                                dircompleta: dircompletaTotal,
463                                cp: $('#codigo-postalCheck').val() || $('.formComprobarCobertura').find('#codigo-postalCheck').val(),
464                                phone: phone,
465                                email: email,
466                                resultadoComprobacion: 'Si'
467                            }
468                        });
469
470                    } else {
471                        $('#myModalCheck').modal('hide');
472                        $('.firstPart').css('display', 'none');
473                        $('.pResultado').html(pfalseResultado);
474                        $('.buttonResultado').html(buttonfalseResultado);
475                        $('.secondPart').css('display', 'block');
476                        $('.addressResult').html(dircompletaTotal);
477                        $('#resultadoConsultaDireccion').html(dircompletaTotal);
478
479                        localStorage.setItem("cobertura_resultado", 'N');
480                        localStorage.setItem("cobertura_install_address", '');
481
482                        $.ajax({
483                            url: baseUrl + 'sendMailCheckCobertura', method: 'POST', data: {
484                                dircompleta: dircompletaTotal,
485                                cp: $('#codigo-postalCheck').val() || $('.formComprobarCobertura').find('#codigo-postalCheck').val(),
486                                phone: phone,
487                                email: email,
488                                resultadoComprobacion: 'No'
489                            }
490                        });
491
492                    }
493
494                },complete: function (data) {
495                    setTimeout(function () {
496                        $('#submitCheck').removeAttr('disabled');
497                    }, 2000);
498                }
499            });
500            // $("#form_address").submit();
501            // input.setCustomValidity('');
502        }
503    });
504
505    $("#myModalCheck").on("hidden.bs.modal", function () {
506        $("#loaderModal").modal('hide');
507        $("#myModal2").modal('hide');
508        $('html').css('overflow', 'auto');
509    });
510
511    $(document).on('change', '#address, #codigo-postalCheck, #telefonoCheckCobertura, #telefonoCobertura, #email, input[name=nonumber]:checked, #readModal', function () {
512        var campo = $(this).attr('id');
513        setTimeout(function () {
514            var erroresForm = checkFilledForm(campo);
515            if (erroresForm) {
516                // $('.buscar_cp').removeAttr('disabled');
517            } else {
518                // $('.buscar_cp').attr('disabled', 'disabled');
519            }
520        }, 150);
521    });
522
523    $(document).on('change', '#number', function () {
524        var campo = $(this).attr('id');
525        setTimeout(function () {
526            var erroresForm = checkFilledForm(campo);
527        }, 150);
528    });
529
530    $("#popup-check-cobertura").on("hidden.bs.modal", function () {
531        console.log("popup-check-cobertura hidden");
532        $('html').css('overflow', 'auto');
533    });
534
535    $('#table_direcciones').slimScroll({
536        size: '7px',
537        width: '100%',
538        height: '200px',
539        color: '#c64050',
540        allowPageScroll: false,
541        alwaysVisible: true
542    });
543
544    $('.buscar_cp').click(function () {
545
546        var erroresForm = checkAllFilledForm('all', true);
547        if (erroresForm) {
548            var formulario = $(this).closest('form');
549            var autocompletado = $(formulario).find('#autocompletado').val();
550            var address = $(formulario).find('#address').val();
551            var email = $(formulario).find('#email').val();
552            var technicalId = $(formulario).find('#technicalId').val();
553            var number = $(formulario).find('#number').val();
554            var cp = $(formulario).find('#codigo-postalCheck').val();
555            var phone = $(formulario).find('#telefonoCheckCobertura').val();
556            var sn = $(formulario).find('input[name=nonumber]:checked').val();
557            var checkPolitica = $(this).closest('form').find('#readModal');
558            var primer = phone.charAt(0);
559
560            var idDireccion = $('#idDireccion').val();
561
562
563            /////////////////////   GET /street (search)
564
565            const regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; //Email
566
567            if (phone.length === 0 || (email.length === 0 && $(formulario).find('#email').prop('required')) || address.length === 0 || cp.length === 0 || (number.length === 0 && sn === undefined)) {
568            } else if (phone.isNumeric == false || phone.length < 9) {
569            } else if (primer !== '6' && primer !== '7') {
570            } else if (!checkPolitica.is(':checked')) {
571            } else if (!regex.test(email) && email.length > 0) {
572            } else {
573                if (technicalId != '') {
574                    $(this).attr('disabled', 'disabled');
575                    $(this).val('Cargando...');
576
577                    // $('.mchimp-errmessage').html('');
578                    // $('.mchimp-errmessage').css('display', 'none');
579
580                    $('#loaderModal').modal({backdrop: 'static', keyboard: false});
581                    $('#loaderModal').modal('show');
582
583                    var separar = address.split(',');
584                    var dircompleta = '';
585                    var restoDireccion = separar.slice(1).join(',').trim();
586                    if (sn == 'on') {
587                        // dircompleta = separar[0] + ' S/N, ' + cp + '' + separar.splice(1).toString().replace(',', '');
588                        dircompleta = separar[0].toString().replace(lastNumber, '').trim();
589                        dircompleta = dircompleta.replace('S/N', '').trim() + ' S/N, ' + (restoDireccion ? ' ' + restoDireccion : '');
590                    } else {
591                        dircompleta = separar[0].toString().replace(lastNumber, '').trim();
592                        if (dircompleta.indexOf(number) === -1) {
593                            dircompleta += ' ' + number;
594                        }
595                        dircompleta += ', ' + (restoDireccion ? ' ' + restoDireccion : '');
596                    }
597                    // console.log("1." + dircompleta);
598                    // console.log("1." + technicalId);
599                    var resNumber;
600                    if (sn === 'on') {
601                        resNumber = 'S/N';
602                    } else {
603                        resNumber = number;
604                    }
605                    ///////////////////// ENVIAR CORREO CON LOS DATOS A CADA FRANQUICIA
606                    // console.log("2." + resNumber);
607                    $.ajax({
608                        url: baseUrl + 'hire/getBuilding', method: 'POST', data: {
609                            technicalId: technicalId, dircompleta: dircompleta, number: resNumber, sn: sn
610                        },
611                        success: function (data) {
612                            setTimeout(function () {
613                                $('#loaderModal').modal('hide');
614                            }, 500);
615                            $('body').css('padding-right', '0px');
616                            $('html').css('overflow', 'hidden');
617                            setTimeout(function () {
618                                if (data != "") {
619
620                                    if (data.nodir == 'Y') {
621                                        $('#myModal2').modal("show");
622                                        $('#myModal2').find('.direccionResultadoNoDir').html(dircompleta);
623
624                                        window.dataLayer = window.dataLayer || [];
625                                        window.dataLayer.push({
626                                            'event': 'ContactoOK',
627                                            'tarifa': titleTarifa,
628                                            'producto': tipoTarifaDetalle,
629                                            'form_name': 'Comprobar cobertura - No encuentra dirección',
630                                        });
631                                        // console.log("Comprobar cobertura Analytics KO 6");
632                                        localStorage.setItem("cobertura_resultado", 'N');
633                                        localStorage.setItem("cobertura_install_address", '');
634                                    } else if (data.nounits == 'Y') {
635                                        $('#myModal2').modal("show");
636                                        $('#myModal2').find('.direccionResultadoNoDir').html(dircompleta);
637                                        window.dataLayer = window.dataLayer || [];
638                                        window.dataLayer.push({
639                                            'event': 'ContactoOK',
640                                            'tarifa': titleTarifa,
641                                            'producto': tipoTarifaDetalle,
642                                            'form_name': 'Comprobar cobertura - No hay unidades disponibles',
643                                        });
644                                        // console.log("Comprobar cobertura Analytics KO No Units");
645                                        localStorage.setItem("cobertura_resultado", 'N');
646                                        localStorage.setItem("cobertura_install_address", '');
647                                    } else {
648
649                                        // $.ajax({
650                                        //     url: baseUrl + 'sendMailCheckCobertura', method: 'POST', data: {
651                                        //         dircompleta: dircompleta,
652                                        //         cp: cp,
653                                        //         phone: phone,
654                                        //         email: email,
655                                        //         resultadoComprobacion: 'Si'
656                                        //     }
657                                        // });
658
659                                        $(modalSeleccionVivienda).modal("show");
660
661                                        // $('html').css('overflow', 'hidden');
662                                        var p = $('.addressConfirm');
663                                        var c = p.children();
664                                        p.text(dircompleta);
665                                        p.append(c);
666                                        $('#install_address').val(dircompleta);
667                                        $('#contact_email').val(email);
668                                        $('#contact_tlf').val(phone);
669                                        $('#cp').val(cp);
670                                        $('.tablaDirecciones').remove();
671
672                                        var cont = 0;
673                                        var contBloque = 0;
674                                        var contPuerta = 0;
675                                        var contLetra = 0;
676                                        var contEscalera = 0;
677                                        var contPiso = 0;
678                                        var conthand1 = 0;
679                                        var conthand2 = 0;
680
681                                        $.each(data, function (i, item) {
682                                            if (item.contBloque > 0) {
683                                                contBloque++;
684                                            }
685                                            if (item.contPuerta > 0) {
686                                                contPuerta++;
687                                            }
688                                            if (item.contLetra > 0) {
689                                                contLetra++;
690                                            }
691                                            if (item.contEscalera > 0) {
692                                                contEscalera++;
693                                            }
694                                            if (item.contPiso > 0) {
695                                                contPiso++;
696                                            }
697                                            if (item.conthand1 > 0) {
698                                                conthand1++;
699                                            }
700                                            if (item.conthand2 > 0) {
701                                                conthand2++;
702                                            }
703                                            $('#id_address').val(item.id);
704
705                                        });
706                                        var print = "" + "<table class='_fade tablaDirecciones' id='dialogDescModal' style='overflow-y:scroll; height: 100px;' cellpadding='1' >" + "<thead>";
707
708                                        print += "<th class=''></th>";
709
710                                        if (contPiso > 0) {
711                                            print += "<th class=''>" + piso + "</th>";
712                                        }
713                                        if (contEscalera > 0) {
714                                            print += "<th class=''>" + escalera + "</th>";
715                                        }
716                                        if (contBloque > 0) {
717                                            print += "<th class=''>" + bloque + "</th>";
718                                        }
719                                        if (contPuerta > 0) {
720                                            print += "<th class=''>" + puerta + "</th>";
721                                        }
722                                        if (contLetra > 0) {
723                                            print += "<th class=''>" + letra + "</th>";
724                                        }
725                                        // if (conthand1 > 0) {
726                                        //     print += "<th class=''>" + puerta + "</th>";
727                                        // }
728                                        // if (conthand2 > 0) {
729                                        //     print += "<th class=''></th>";
730                                        // }
731
732                                        print += // "<th class=''>" + seleccion + "</th>" +
733                                            "</thead>" + "<tbody>";
734
735                                        $.each(data, function (i, item) {
736
737                                            var toFilter = item.Bloque + " " + item.Puerta + " " + item.Puerta + " " + item.Escalera + " " + item.Piso + " " + item.hand1 + " " + item.hand2;
738                                            print += "<tr id='verticals-service-container verticals-service-" + cont + "' data-find='" + toFilter + "'>";
739
740                                            print += "<td class='radio-options'>" + // "<div class='form-group'>" +
741                                                "<label class='verticals-service'>" + "<input type='radio' name='verticals-service' class='verticals-service' id='select-" + cont + "' value='" + item.id + "'>" + "</label>" + // "</div>" +
742                                                "</td>";
743
744                                            if (item.Piso !== "" && contPiso > 0) {
745                                                var pisoStr = item.Piso;
746                                                if (item.hand1 !== "" && conthand1 > 0) {
747                                                    pisoStr += ' ' + item.hand1;
748                                                }
749                                                if (item.hand2 !== "" && conthand2 > 0) {
750                                                    pisoStr += ' ' + item.hand2;
751                                                }
752                                                print += "<td class='' id='select-" + cont + "-piso'>" + pisoStr + "</td>";
753                                            } else if (item.Piso === "" && contPiso > 0) {
754                                                print += "<td class='' id='select-" + cont + "-bloque'> </td>";
755                                            }
756
757                                            if (item.Escalera !== "" && contEscalera > 0) {
758                                                print += "<td class='' id='select-" + cont + "-escalera'>" + item.Escalera + "</td>";
759                                            } else if (item.Escalera === "" && contEscalera > 0) {
760                                                print += "<td class='' id='select-" + cont + "-bloque'> </td>";
761                                            }
762
763                                            if (item.Bloque !== "" && contBloque > 0) {
764                                                print += "<td class='' id='select-" + cont + "-bloque'>" + item.Bloque + "</td>";
765                                            } else if (item.Bloque === "" && contBloque > 0) {
766                                                print += "<td class='' id='select-" + cont + "-bloque'> </td>";
767                                            }
768
769
770                                            if (item.Puerta !== "" && contPuerta > 0) {
771                                                print += "<td class='' id='select-" + cont + "-puerta'>" + item.Puerta + "</td>";
772                                            } else if (item.Puerta === "" && contPuerta > 0) {
773                                                print += "<td class='' id='select-" + cont + "-bloque'> </td>";
774                                            }
775
776
777                                            if (item.Letra !== "" && contLetra > 0) {
778                                                print += "<td class='' id='select-" + cont + "-letra'>" + item.Letra + "</td>";
779                                            } else if (item.Letra === "" && contLetra > 0) {
780                                                print += "<td class='' id='select-" + cont + "-bloque'> </td>";
781                                            }
782
783                                            // if (item.hand1 !== "" && conthand1 > 0) {
784                                            //     print += "<td class='' id='select-" + cont + "-hand1'>
784" + item.hand1 + "</td>";
785                                            // } else if (item.hand1 === "" && conthand1 > 0) {
786                                            //     print += "<td class='' id='select-" + cont + "-bloque'> </td>";
787                                            // }
788                                            //
789                                            // if (item.hand2 !== "" && conthand2 > 0) {
790                                            //     print += "<td class='' id='select-" + cont + "-hand2'>" + item.hand2 + "</td>";
791                                            // } else if (item.hand2 === "" && conthand2 > 0) {
792                                            //     print += "<td class='' id='select-" + cont + "-bloque'> </td>";
793                                            // }
794
795                                            print += "</tr>";
796
797                                            cont++;
798                                        });
799                                        print += "</tbody>" + "<form>" + "<tbody>" + "</tbody>" + "</form>" + "</table>";
800                                        // setInterval(function(){
801                                        // update slimscroll every time content changes
802                                        $('#table_direcciones').append(print);
803
804                                        $('#table_direcciones').slimscroll();
805
806                                        // }, 500);
807                                        $('#table_direcciones').slimScroll({
808                                            size: '7px',
809                                            width: '100%',
810                                            height: '200px',
811                                            color: '#c64050',
812                                            allowPageScroll: false,
813                                            alwaysVisible: true,
814                                            railVisible: true,
815                                            disableFadeOut: true
816                                        });
817                                    }
818                                } else {
819
820                                    $.ajax({
821                                        url: baseUrl + 'sendMailCheckCobertura', method: 'POST', data: {
822                                            dircompleta: dircompleta,
823                                            cp: cp,
824                                            phone: phone,
825                                            email: email,
826                                            resultadoComprobacion: 'No'
827                                        }
828                                    });
829                                    window.dataLayer = window.dataLayer || [];
830                                    window.dataLayer.push({
831                                        'event': 'ContactoOK',
832                                        'tarifa': titleTarifa,
833                                        'producto': tipoTarifaDetalle,
834                                        'form_name': 'Comprobar cobertura - No tiene cobertura',
835                                    });
836                                    localStorage.setItem("cobertura_resultado", 'N');
837                                    localStorage.setItem("cobertura_install_address", '');
838                                    $('#myModal2Manual').modal('show');
839
840                                    $('body').css('padding-right', '0px');
841                                }
842                            }, 500);
843                            $('.bottonConsultarCobertura').val('Consultar cobertura');
844                        },
845                        error: function (data) {
846                        },
847                        complete: function (data) {
848                            setTimeout(function () {
849                                $('.bottonConsultarCobertura').removeAttr('disabled');
850                            }, 1000);
851                        }
852                    });
853                } else {
854                    // $('.mchimp-errmessage').html(aviosSeleccionarDireccion);
855                    // $('.mchimp-errmessage').css('display', 'block');
856                    $(this).removeClass('sin-margin');
857                }
858
859            }
860        }
861    });
862
863    function checkFilledForm(campo, printErrors = true) {
864
865        if ($('.formComprobarCobertura').length) {
866            // console.log("checkFilledForm(" + campo + ")");
867            var autocompletado = $('#autocompletado').val();
868            var address = $('.formComprobarCobertura').find('#address').val();
869            var technicalId = $('.formComprobarCobertura').find('#technicalId').val();
870            var number = $('.formComprobarCobertura').find('#number').val();
871            var cp = $('.formComprobarCobertura').find('#codigo-postalCheck').val();
872            var sn = $('.formComprobarCobertura').find('input[name=nonumber]:checked').val();
873            var phone = $('.formComprobarCobertura').find('#telefonoCheckCobertura').val();
874            var checkPolitica = $('.formComprobarCobertura').find('#readModal');
875            var email = $('.formComprobarCobertura').find('#email').val();
876            var primer = phone.charAt(0);
877
878            const regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; //Email
879
880            var separar = address.split(',');
881            var dircompleta = '';
882            var restoDireccion = separar.slice(1).join(',').trim();
883            if (sn == 'on') {
884                dircompleta = separar[0].toString().replace(lastNumber, '').trim();
885                dircompleta = dircompleta.replace('S/N', '').trim() + ' S/N, ' + (restoDireccion ? ' ' + restoDireccion : '');
886            } else {
887                dircompleta = separar[0].toString().replace(lastNumber, '').trim();
888                if (dircompleta.indexOf(number) === -1) {
889                    dircompleta += ' ' + number;
890                }
891                dircompleta += ', ' + (restoDireccion ? ' ' + restoDireccion : '');
892            }
893
894            $('#myModal2Manual').find('.direccionResultadoNoDir').html(dircompleta);
895
896            if (campo == 'email' || campo == 'all') {
897
898                if ($('.formComprobarCobertura').find('#email').prop('required')) {
899                    if (email.length === 0) {
900                        if (printErrors) {
901                            $('.formComprobarCobertura').find('#email').addClass('input-error');
902                            $('.formComprobarCobertura').find('#email').removeClass('input-success');
903                            $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html(rellenar);
904                        }
905                        return false;
906                    } else if (!regex.test(email)) {
907                        if (printErrors) {
908                            $('.formComprobarCobertura').find('#email').addClass('input-error');
909                            $('.formComprobarCobertura').find('#email').removeClass('input-success');
910                            $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html(emailnovalido);
911                        }
912                        return false;
913                    } else {
914                        $('.formComprobarCobertura').find('#email').removeClass('input-error');
915                        $('.formComprobarCobertura').find('#email').addClass('input-success');
916                        $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html('');
917                        if (campo !== 'all') {
918                            return true;
919                        }
920                    }
921                } else {
922                    if (email.length > 0 && !regex.test(email)) {
923                        if (printErrors) {
924                            $('.formComprobarCobertura').find('#email').addClass('input-error');
925                            $('.formComprobarCobertura').find('#email').removeClass('input-success');
926                            $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html(emailnovalido);
927                        }
928                        return false;
929                    }
930                    $('.formComprobarCobertura').find('#email').removeClass('input-error');
931                    $('.formComprobarCobertura').find('#email').addClass('input-success');
932                    $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html('');
933                    if (campo !== 'all') {
934                        return true;
935                    }
936                }
937            }
938            if (campo == 'telefonoCheckCobertura' || campo == 'all') {
939                if (phone.length === 0 || phone.isNumeric == false) {
940                    if (printErrors) {
941                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-error');
942                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-success');
943                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html(rellenar);
944                    }
945                    return false;
946                } else if (phone.length < 9) {
947                    if (printErrors) {
948                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-error');
949                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-success');
950                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html(numero);
951                    }
952                    return false;
953                } else if (primer !== '6' && primer !== '7') {
954                    if (printErrors) {
955                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-error');
956                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-success');
957                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html(numeronovalido);
958                    }
959                    return false;
960                } else {
961                    $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-error');
962                    $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-success');
963                    $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html('');
964                    if (campo !== 'all') {
965                        return true;
966                    }
967                }
968            }
969            if (campo == 'address' || campo == 'all') {
970                if (address.length === 0) {
971                    if (printErrors) {
972                        $('.formComprobarCobertura').find('#address').addClass('input-error');
973                        $('.formComprobarCobertura').find('#address').removeClass('input-success');
974                        $('.formComprobarCobertura').find('#address').closest('.col-cobertura').find('.custom-error').html(rellenar);
975                    }
976                    return false;
977                } else {
978
979                    if (technicalId != '') {
980                        $('.formComprobarCobertura').find('#address').removeClass('input-error');
981                        $('.formComprobarCobertura').find('#address').addClass('input-success');
982                        $('.formComprobarCobertura').find('#address').closest('.col-cobertura').find('.custom-error').html('');
983                        if (campo !== 'all') {
984                            return true;
985                        }
986                    } else {
987                        if (printErrors) {
988                            $('.formComprobarCobertura').find('#address').addClass('input-error');
989                            $('.formComprobarCobertura').find('#address').removeClass('input-success');
990                            $('.formComprobarCobertura').find('#address').closest('.col-cobertura').find('.custom-error').html(aviosSeleccionarDireccion);
991                        }
992                        return false;
993                    }
994                }
995            }
996
997
998            if (campo == 'codigo-postalCheck' || campo == 'all') {
999                if (cp.length === 0 || cp.length < 5) {
1000                    if (printErrors) {
1001                        $('.formComprobarCobertura').find('#codigo-postalCheck').addClass('input-error');
1002                        $('.formComprobarCobertura').find('#codigo-postalCheck').removeClass('input-success');
1003                        $('.formComprobarCobertura').find('#codigo-postalCheck').closest('.col-cobertura').find('.custom-error').html(rellenar);
1004                    }
1005                    return false;
1006                } else {
1007                    $('.formComprobarCobertura').find('#codigo-postalCheck').removeClass('input-error');
1008                    $('.formComprobarCobertura').find('#codigo-postalCheck').addClass('input-success');
1009                    $('.formComprobarCobertura').find('#codigo-postalCheck').closest('.col-cobertura').find('.custom-error').html('');
1010                    if (campo !== 'all') {
1011                        return true;
1012                    }
1013                }
1014            }
1015            if (campo == 'number' || campo == 'nonumber' || campo == 'all') {
1016                if (number.length === 0 && sn === undefined) {
1017                    if (printErrors) {
1018                        $('.formComprobarCobertura').find('#number').addClass('input-error');
1019                        $('.formComprobarCobertura').find('#number').removeClass('input-success');
1020                        $('.formComprobarCobertura').find('#number').closest('.col-cobertura').find('.custom-error').html(rellenar);
1021                    }
1022                    return false;
1023                } else {
1024                    $('.formComprobarCobertura').find('#number').removeClass('input-error');
1025                    $('.formComprobarCobertura').find('#number').closest('.col-cobertura').find('.custom-error').html('');
1026                    if (campo == 'nonumber') {
1027                        $('.formComprobarCobertura').find('#number').removeClass('input-success');
1028                    } else {
1029                        $('.formComprobarCobertura').find('#number').addClass('input-success');
1030                    }
1031                    if (campo !== 'all') {
1032                        return true;
1033                    }
1034                }
1035            }
1036            if (campo == 'readModal' || campo == 'all') {
1037                if (!checkPolitica.is(':checked')) {
1038                    if (printErrors) {
1039                        $('.formComprobarCobertura').find('#readModal').addClass('input-error');
1040                        $('.formComprobarCobertura').find('#readModal').removeClass('input-success');
1041                        $('.formComprobarCobertura').find('#readModal').closest('.col-cobertura').find('.custom-error').html(aceptarTer);
1042                    }
1043                    return false;
1044                } else {
1045                    $('.formComprobarCobertura').find('#readModal').removeClass('input-error');
1046                    $('.formComprobarCobertura').find('#readModal').addClass('input-success');
1047                    $('.formComprobarCobertura').find('#readModal').closest('.col-cobertura').find('.custom-error').html('');
1048                    if (campo !== 'all') {
1049                        return true;
1050                    }
1051                }
1052            }
1053
1054            if ((email.length === 0 && $('.formComprobarCobertura').find('#email').prop('required')) || phone.length === 0 || address.length === 0 || cp.length === 0 || (number.length === 0 && sn === undefined)) {
1055                return false;
1056            } else if (!checkPolitica.is(':checked')) {
1057                return false;
1058            } else {
1059                if (technicalId != '') {
1060                } else {
1061                    return false;
1062                }
1063            }
1064        }
1065        return true;
1066
1067    }
1068
1069    function checkAllFilledForm(campo, printErrors = true) {
1070
1071        var resultado1 = true;
1072        if ($('.formComprobarCobertura').length) {
1073
1074            var autocompletado = $('#autocompletado').val();
1075            var address = $('.formComprobarCobertura').find('#address').val();
1076            var technicalId = $('.formComprobarCobertura').find('#technicalId').val();
1077            var number = $('.formComprobarCobertura').find('#number').val();
1078            var cp = $('.formComprobarCobertura').find('#codigo-postalCheck').val();
1079            var sn = $('.formComprobarCobertura').find('input[name=nonumber]:checked').val();
1080            var phone = $('.formComprobarCobertura').find('#telefonoCheckCobertura').val();
1081            var checkPolitica = $('.formComprobarCobertura').find('#readModal');
1082            var email = $('.formComprobarCobertura').find('#email').val();
1083            var primer = phone.charAt(0);
1084
1085            const regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; //Email
1086
1087            var separar = address.split(',');
1088            // console.log(separar);
1089            var dircompleta = '';
1090            var restoDireccion = separar.slice(1).join(',').trim();
1091            if (sn == 'on') {
1092                // dircompleta = separar[0] + ' S/N, ' + cp + '' + separar.splice(1).toString().replace(',', '');
1093                dircompleta = separar[0].toString().replace(lastNumber, '').trim();
1094                dircompleta = dircompleta.replace('S/N', '').trim() + ' S/N, ' + (restoDireccion ? ' ' + restoDireccion : '');
1095            } else {
1096                dircompleta = separar[0].toString().replace(lastNumber, '').trim();
1097                if (dircompleta.indexOf(number) === -1) {
1098                    dircompleta += ' ' + number;
1099                }
1100                dircompleta += ', ' + (restoDireccion ? ' ' + restoDireccion : '');
1101            }
1102
1103            $('#myModal2Manual').find('.direccionResultadoNoDir').html(dircompleta);
1104
1105            if (campo == 'email' || campo == 'all') {
1106
1107                if ($('.formComprobarCobertura').find('#email').prop('required')) {
1108                    if (email.length === 0) {
1109                        if (printErrors) {
1110                            $('.formComprobarCobertura').find('#email').addClass('input-error');
1111                            $('.formComprobarCobertura').find('#email').removeClass('input-success');
1112                            $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html(rellenar);
1113                        }
1114                        resultado = false;
1115                    } else if (!regex.test(email)) {
1116                        if (printErrors) {
1117                            $('.formComprobarCobertura').find('#email').addClass('input-error');
1118                            $('.formComprobarCobertura').find('#email').removeClass('input-success');
1119                            $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html(emailnovalido);
1120                        }
1121                        resultado = false;
1122                    } else {
1123                        $('.formComprobarCobertura').find('#email').removeClass('input-error');
1124                        $('.formComprobarCobertura').find('#email').addClass('input-success');
1125                        $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html('');
1126                    }
1127                } else {
1128                    if (email.length > 0 && !regex.test(email)) {
1129                        if (printErrors) {
1130                            $('.formComprobarCobertura').find('#email').addClass('input-error');
1131                            $('.formComprobarCobertura').find('#email').removeClass('input-success');
1132                            $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html(emailnovalido);
1133                        }
1134                        resultado1 = false;
1135                    }
1136                    $('.formComprobarCobertura').find('#email').removeClass('input-error');
1137                    $('.formComprobarCobertura').find('#email').addClass('input-success');
1138                    $('.formComprobarCobertura').find('#email').closest('.col-cobertura').find('.custom-error').html('');
1139                }
1140            }
1141            if (campo == 'telefonoCheckCobertura' || campo == 'all') {
1142                if (phone.length === 0 || phone.isNumeric == false) {
1143                    if (printErrors) {
1144                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-error');
1145                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-success');
1146                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html(rellenar);
1147                    }
1148                    resultado1 = false;
1149                } else if (phone.length < 9) {
1150                    if (printErrors) {
1151                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-error');
1152                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-success');
1153                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html(numero);
1154                    }
1155                    resultado1 = false;
1156                } else if (primer !== '6' && primer !== '7') {
1157                    if (printErrors) {
1158                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-error');
1159                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-success');
1160                        $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html(numeronovalido);
1161                    }
1162                    resultado1 = false;
1163                } else {
1164                    $('.formComprobarCobertura').find('#telefonoCheckCobertura').removeClass('input-error');
1165                    $('.formComprobarCobertura').find('#telefonoCheckCobertura').addClass('input-success');
1166                    $('.formComprobarCobertura').find('#telefonoCheckCobertura').closest('.col-cobertura').find('.custom-error').html('');
1167                }
1168            }
1169            if (campo == 'address' || campo == 'all') {
1170                if (address.length === 0) {
1171                    if (printErrors) {
1172                        $('.formComprobarCobertura').find('#address').addClass('input-error');
1173                        $('.formComprobarCobertura').find('#address').removeClass('input-success');
1174                        $('.formComprobarCobertura').find('#address').closest('.col-cobertura').find('.custom-error').html(rellenar);
1175                    }
1176                    resultado1 = false;
1177                } else {
1178                    if (technicalId != '') {
1179                        $('.formComprobarCobertura').find('#address').removeClass('input-error');
1180                        $('.formComprobarCobertura').find('#address').addClass('input-success');
1181                        $('.formComprobarCobertura').find('#address').closest('.col-cobertura').find('.custom-error').html('');
1182                    } else {
1183                        if (printErrors) {
1184                            $('.formComprobarCobertura').find('#address').addClass('input-error');
1185                            $('.formComprobarCobertura').find('#address').removeClass('input-success');
1186                            $('.formComprobarCobertura').find('#address').closest('.col-cobertura').find('.custom-error').html(aviosSeleccionarDireccion);
1187                        }
1188                        resultado1 = false;
1189                    }
1190                }
1191            }
1192            if (campo == 'codigo-postalCheck' || campo == 'all') {
1193                if (cp.length === 0 || cp.length < 5) {
1194                    if (printErrors) {
1195                        $('.formComprobarCobertura').find('#codigo-postalCheck').addClass('input-error');
1196                        $('.formComprobarCobertura').find('#codigo-postalCheck').removeClass('input-success');
1197                        $('.formComprobarCobertura').find('#codigo-postalCheck').closest('.col-cobertura').find('.custom-error').html(rellenar);
1198                    }
1199                    resultado1 = false;
1200                } else {
1201                    $('.formComprobarCobertura').find('#codigo-postalCheck').removeClass('input-error');
1202                    $('.formComprobarCobertura').find('#codigo-postalCheck').addClass('input-success');
1203                    $('.formComprobarCobertura').find('#codigo-postalCheck').closest('.col-cobertura').find('.custom-error').html('');
1204                }
1205            }
1206            if (campo == 'number' || campo == 'nonumber' || campo == 'all') {
1207                if (number.length === 0 && sn === undefined) {
1208                    if (printErrors) {
1209                        $('.formComprobarCobertura').find('#number').addClass('input-error');
1210                        $('.formComprobarCobertura').find('#number').removeClass('input-success');
1211                        $('.formComprobarCobertura').find('#number').closest('.col-cobertura').find('.custom-error').html(rellenar);
1212                    }
1213                    resultado1 = false;
1214                } else {
1215                    $('.formComprobarCobertura').find('#number').removeClass('input-error');
1216                    $('.formComprobarCobertura').find('#number').closest('.col-cobertura').find('.custom-error').html('');
1217                    if (campo == 'nonumber') {
1218                        $('.formComprobarCobertura').find('#number').removeClass('input-success');
1219                    } else {
1220                        $('.formComprobarCobertura').find('#number').addClass('input-success');
1221                    }
1222                }
1223            }
1224            if (campo == 'readModal' || campo == 'all') {
1225                if (!checkPolitica.is(':checked')) {
1226                    if (printErrors) {
1227                        $('.formComprobarCobertura').find('#readModal').addClass('input-error');
1228                        $('.formComprobarCobertura').find('#readModal').removeClass('input-success');
1229                        $('.formComprobarCobertura').find('#readModal').closest('.col-cobertura').find('.custom-error').html(aceptarTer);
1230                    }
1231                    resultado1 = false;
1232                } else {
1233                    $('.formComprobarCobertura').find('#readModal').removeClass('input-error');
1234                    $('.formComprobarCobertura').find('#readModal').addClass('input-success');
1235                    $('.formComprobarCobertura').find('#readModal').closest('.col-cobertura').find('.custom-error').html('');
1236                }
1237            }
1238
1239            if ((email.length === 0 && $('.formComprobarCobertura').find('#email').prop('required')) || phone.length === 0 || address.length === 0 || cp.length === 0 || (number.length === 0 && sn === undefined)) {
1240                resultado1 = false;
1241            } else if (!checkPolitica.is(':checked')) {
1242                resultado1 = false;
1243            } else {
1244                if (technicalId != '') {
1245                } else {
1246                    resultado1 = false;
1247                }
1248            }
1249        }
1250        return resultado1;
1251
1252    }
1253
1254    function saveDatosConsultaCobertura() {
1255
1256        var address1 = $('.formComprobarCobertura').find('#address').val();
1257        var technicalId = $('.formComprobarCobertura').find('#technicalId').val();
1258        var number = $('.formComprobarCobertura').find('#number').val();
1259        var cp = $('.formComprobarCobertura').find('#codigo-postalCheck').val();
1260        var sn = $('.formComprobarCobertura').find('input[name=nonumber]:checked').val();
1261        var phone = $('.formComprobarCobertura').find('#telefonoCheckCobertura').val();
1262        var checkPolitica = $('.formComprobarCobertura').find('#readModal');
1263        var email1 = $('.formComprobarCobertura').find('#email').val();
1264
1265        localStorage.setItem('cobertura_address', address1);
1266        localStorage.setItem('cobertura_number', number);
1267        localStorage.setItem('cobertura_cp', cp);
1268        localStorage.setItem('cobertura_sn', sn);
1269        localStorage.setItem('cobertura_phone', phone);
1270        localStorage.setItem('cobertura_checkPolitica', checkPolitica.is(':checked'));
1271        localStorage.setItem('cobertura_technicalId', technicalId);
1272        localStorage.setItem('cobertura_email1', email1);
1273
1274        var select_bloque = $('.select_bloque option:selected').val();
1275        var select_puerta = $('.select_puerta option:selected').val();
1276        var select_escalera = $('.select_escalera option:selected').val();
1277        var select_planta = $('.select_planta option:selected').val();
1278        var select_puerta2 = $('.select_puerta2 option:selected').val();
1279        var select_det_puerta = $('.select_det_puerta option:selected').val();
1280        var select_bis = $('.select_bis option:selected').val();
1281        var select_letra = $('.select_letra option:selected').val();
1282
1283        if (select_bloque !== '') {
1284            localStorage.setItem('cobertura_select_bloque', select_bloque);
1285        }
1286        if (select_puerta !== '') {
1287            localStorage.setItem('cobertura_select_puerta', select_puerta);
1288        }
1289        if (select_escalera !== '') {
1290            localStorage.setItem('cobertura_select_escalera', select_escalera);
1291        }
1292        if (select_planta !== '') {
1293            localStorage.setItem('cobertura_select_planta', select_planta);
1294        }
1295        if (select_puerta2 !== '') {
1296            localStorage.setItem('cobertura_select_puerta2', select_puerta2);
1297        }
1298        if (select_det_puerta !== '') {
1299            localStorage.setItem('cobertura_select_det_puerta', select_det_puerta);
1300        }
1301        if (select_bis !== '') {
1302            localStorage.setItem('cobertura_select_bis', select_bis);
1303        }
1304        if (select_letra !== '') {
1305            localStorage.setItem('cobertura_select_letra', select_letra);
1306        }
1307
1308        var address = $('#install_address').val();
1309        localStorage.setItem('cobertura_final_address', address);
1310    }
1311
1312    function removeDatosConsultaCobertura() {
1313        localStorage.removeItem("cobertura_resultado");
1314        localStorage.removeItem("cobertura_final_address");
1315        localStorage.removeItem("cobertura_install_address");
1316        localStorage.removeItem("cobertura_address");
1317        localStorage.removeItem("cobertura_number");
1318        localStorage.removeItem("cobertura_cp");
1319        localStorage.removeItem("cobertura_sn");
1320        localStorage.removeItem("cobertura_phone");
1321        localStorage.removeItem("cobertura_technicalId");
1322        localStorage.removeItem("cobertura_email1");
1323        localStorage.removeItem("cobertura_checkPolitica");
1324        localStorage.removeItem("cobertura_select_bloque");
1325        localStorage.removeItem("cobertura_select_puerta");
1326        localStorage.removeItem("cobertura_select_escalera");
1327        localStorage.removeItem("cobertura_select_planta");
1328        localStorage.removeItem("cobertura_select_puerta2");
1329        localStorage.removeItem("cobertura_select_det_puerta");
1330        localStorage.removeItem("cobertura_select_bis");
1331        localStorage.removeItem("cobertura_select_letra");
1332    }
1333
1334    function getDatosConsultaCobertura() {
1335
1336        var cobertura_address = localStorage.getItem('cobertura_address');
1337        var cobertura_number = localStorage.getItem('cobertura_number');
1338        var cobertura_cp = localStorage.getItem('cobertura_cp');
1339        var cobertura_sn = localStorage.getItem('cobertura_sn');
1340        var cobertura_checkPolitica = localStorage.getItem('cobertura_checkPolitica');
1341        var cobertura_technicalId = localStorage.getItem('cobertura_technicalId');
1342        var cobertura_phone = localStorage.getItem('cobertura_phone');
1343        var cobertura_email1 = localStorage.getItem('cobertura_email1');
1344
1345        $('.formComprobarCobertura').find('#address').val(cobertura_address);
1346        $('.formComprobarCobertura').find('#number').val(cobertura_number);
1347        $('.formComprobarCobertura').find('#codigo-postalCheck').val(cobertura_cp);
1348        $('.formComprobarCobertura').find('input[name=nonumber]:checked').val(cobertura_sn);
1349        $('.formComprobarCobertura').find('#readModal').prop('checked', cobertura_checkPolitica);
1350        $('.formComprobarCobertura').find('#technicalId').val(cobertura_technicalId);
1351        $('.formComprobarCobertura').find('#telefonoCheckCobertura').val(cobertura_phone);
1352        $('.formComprobarCobertura').find('#email').val(cobertura_email1);
1353        if (cobertura_address != '' && cobertura_address != null) {
1354            checkFilledForm('address');
1355        }
1356        if (cobertura_number != '' && cobertu
1356ra_number != null) {
1357            checkFilledForm('number');
1358        }
1359        if (cobertura_cp != '' && cobertura_cp != null) {
1360            checkFilledForm('codigo-postalCheck');
1361        }
1362        if (cobertura_phone != '' && cobertura_phone != null) {
1363            checkFilledForm('telefonoCheckCobertura');
1364        }
1365        if (cobertura_email1 != '' && cobertura_email1 != null) {
1366            checkFilledForm('email');
1367        }
1368
1369        var cobertura_select_bloque = '';
1370        var cobertura_select_puerta = '';
1371        var cobertura_select_escalera = '';
1372        var cobertura_select_planta = '';
1373        var cobertura_select_puerta2 = '';
1374        var cobertura_select_det_puerta = '';
1375        var cobertura_select_bis = '';
1376        var cobertura_select_letra = '';
1377
1378        cobertura_select_bloque = localStorage.getItem('cobertura_select_bloque');
1379        cobertura_select_puerta = localStorage.getItem('cobertura_select_puerta');
1380        cobertura_select_escalera = localStorage.getItem('cobertura_select_escalera');
1381        cobertura_select_planta = localStorage.getItem('cobertura_select_planta');
1382        cobertura_select_puerta2 = localStorage.getItem('cobertura_select_puerta2');
1383        cobertura_select_det_puerta = localStorage.getItem('cobertura_select_det_puerta');
1384        cobertura_select_bis = localStorage.getItem('cobertura_select_bis');
1385        cobertura_select_letra = localStorage.getItem('cobertura_select_letra');
1386
1387        $('.select_bloque option:selected').val(cobertura_select_bloque);
1388        $('.select_puerta option:selected').val(cobertura_select_puerta);
1389        $('.select_escalera option:selected').val(cobertura_select_escalera);
1390        $('.select_planta option:selected').val(cobertura_select_planta);
1391        $('.select_puerta2 option:selected').val(cobertura_select_puerta2);
1392        $('.select_det_puerta option:selected').val(cobertura_select_det_puerta);
1393        $('.select_bis option:selected').val(cobertura_select_bis);
1394        $('.select_letra option:selected').val(cobertura_select_letra);
1395
1396        var resultado = localStorage.getItem('cobertura_resultado');
1397        if (resultado == 'Y') {
1398
1399            var dirFinal = localStorage.getItem('cobertura_final_address');
1400            var dirInstall = localStorage.getItem('cobertura_install_address');
1401
1402            var validDirFinal = (dirFinal && dirFinal !== 'undefined' && dirFinal !== 'null') ? dirFinal : null;
1403            var validDirInstall = (dirInstall && dirInstall !== 'undefined' && dirInstall !== 'null') ? dirInstall : null;
1404            var finalAddress = validDirFinal || validDirInstall || '';
1405
1406            if (finalAddress) {
1407                $('#resultadoConsultaDireccion').html(finalAddress);
1408                $('#install_address').html(finalAddress);
1409                $('.addressResult').html(finalAddress);
1410            }
1411            $('#resultadoConsultaCookie').show();
1412        } else {
1413            $('#resultadoConsultaCookie').hide();
1414            $('#resultadoConsultaDireccion').html('');
1415        }
1416
1417    }
1418
1419    $('#emailSwipe').on('change', function () {
1420
1421        let message = '';
1422        const valor = $(this).val().trim();
1423
1424        // this.setCustomValidity("");
1425
1426        $(this).removeClass('is-invalid');
1427        $(this).next('.invalid-feedback').remove();
1428
1429        if (valor.indexOf('@') === -1 || valor.indexOf('.') === -1) {
1430            message = emailnovalido;
1431        }
1432
1433        if (message) {
1434            $(this).addClass('is-invalid');
1435            $(this).after('<div class="invalid-feedback">' + message + '</div>');
1436            // this.setCustomValidity(message);
1437            // this.reportValidity();
1438        } else {
1439            $(this).removeClass('is-invalid');
1440            $(this).next('.invalid-feedback').remove();
1441        }
1442    });
1443});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.