1$(document).ready(function () { 2 3 /*var calculateTotal = function () { 4 var spanTarget = $('#total-pagos-span'); 5 //var subtotal = parseFloat($('#total-pagos').val(), 10); 6 var total = 0; 7 8 //recorro todos los checkboxes dentro de #pagos 9 $('#pagos').find('input.cuota_seccion').each(function (e) { 10 if ($(this).is(':checked')) { 11 total += parseFloat($(this).data('value'), 10); 12 } 13 }); 14 15 spanTarget.text(total); 16 }*/ 17 18 var tc = function (clear){ 19 20 if (clear) { 21 $('.cuota_seccion').addClass('disabled').prop('checked', false); 22 //$('input[type=hidden][name=cuota_sego]').val(0); 23 $('input[type=hidden][name=cuota_com_aut]').val(0); 24 } else { 25 $('.cuota_seccion').removeClass('disabled'); 26 $('#generic').prop('checked', true).toggleClass('disabled'); 27 $('#cuota-com-aut').prop('checked', true).toggleClass('disabled'); 28 //$('input[type=hidden][name=cuota_sego]').val(1); 29 $('input[type=hidden][name=cuota_com_aut]').val(1); 30 } 31 32 $('#generic').data('value', $('#generic').data('value-fixed')); 33 } 34 35 var toggleChecks = function (obj) { 36 37 tc(obj.is(':checked')); 38 } 39 40 /*var toggleMiembroAsociado = function () { 41 42 var value = $('#generic').data('value-fixed'); 43 44 if ($('#cuota-miembro-asociado').is(':checked')) { 45 $('#generic').data('value', value / 2); 46 $('#generic-span').text(value / 2); 47 } else { 48 $('#generic').data('value', value); 49 $('#generic-span').text(value); 50 } 51 }*/ 52 53 $('#pagos').find('input').on('click', function (e) { 54 if($(e.target).hasClass('disabled')){ 55 e.preventDefault(); 56 return; 57 } 58 }); 59 60 $('#cursa-mir').on('change', function (e) { 61 62 if ($(this).is(':checked')) { 63 $('#cuota-extranjero').addClass('disabled').prop('checked', false); 64 } else { 65 $('#cuota-extranjero').removeClass('disabled'); 66 } 67 68 toggleChecks($(this)); 69 //calculateTotal(); 70 }); 71 72 $(document).on('change', '#ano-mir, #cursa-mir', function (e) { 73 74 var base_r = [1,2,3,4]; 75 var base_r_cond; 76 var abort = false;
77 78 var cleaner = $.each(base_r, function( i, v ){ 79 $(`#r${v}-residentes`).removeClass('disabled').prop('checked', false); 80 }); 81 82 var partial_cleaner = function(remove){ 83 base_r_cond = base_r; 84 base_r_cond = base_r_cond.filter(item => item !== remove); 85 $.each(base_r_cond, function( i, v ){ 86 $(`#r${v}-residentes`).addClass('disabled').prop('checked', false); 87 }); 88 } 89 90 if($('#cursa-mir').is(':checked')) { 91 92 if(e.target.id == 'cursa-mir'){ 93 document.getElementById('ano-mir').valueAsDate = new Date(); 94 } 95 96 var diff = moment().diff($('#ano-mir').val(), 'years'); 97 diff += 1; 98 99 if(diff >= 1 && diff <= 4){ 100 tc(true); 101 partial_cleaner(diff); 102 $(`#r${diff}-residentes`).addClass('disabled').prop('checked', true); 103 }else{ 104 abort = true; 105 } 106 }else{ 107 abort = true; 108 } 109 110 if(abort){ 111 toggleChecks($(this)); 112 } 113 114 //calculateTotal(); 115 }); 116 117 $('#user-address-0-zip, #user-address-0-zip-consulta-privada, #user-address-0-zip-hospital').on('change', function(e) { 118 119 var target = $(this); 120 121 $.ajax({ 122 data: {val: e.target.value}, 123 url: target.data('ajax-url'), 124 type: 'post', 125 success: function (response) { 126 var suffix = target.data('suffix') ? '-' + target.data('suffix') : ''; 127 if(target.data('tarifas')){ 128 $('#tarifa_ccaa').html(response.cuota); 129 $('#nombre_tarifa_ccaa').html(response.nombre_cuota); 130 $('#cuota-com-aut').data('value', response.cuota); 131 } 132 $('#user-address-0-poblacion' + suffix).val(response.provincia); 133 $('#user-address-0-provincia' + suffix).val(response.provincia); 134 $('#user-address-0-pais' + suffix).val(response.pais); 135 //calculateTotal(); 136 }, 137 error: function (e) { 138 console.log('Error', e); 139 }, 140 }); 141 }); 142 143 $('#cuota-extranjero').on('change', function (e) { 144 145 toggleChecks($(this)); 146 //toggleMiembroAsociado(); 147 //calculateTotal(); 148 if(toggleUserId){ 149 toggleUserId($(this)); 150 } 151 }); 152 153 $('#cuota-miembro-asociado').on('change', function (e) { 154 155 //toggleMiembroAsociado(); 156 //calculateTotal(); 157 }); 158 159 $('#pagos').on('change', 'input.cuota_seccion', function (e) { 160 161 //calculateTotal(); 162 }); 163 164});
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.