1jQuery(function ($) { 2 let currentStep = 1; 3 const $steps = $('.step'); 4 const totalSteps = $steps.length; 5 6 const $nextBtn = $('.footer__button--next'); 7 const $backBtn = $('.footer__button--back'); 8 const $submitBtn = $('.footer__button--submit'); 9 const $stepNumber = $('.status__number'); 10 const $footer = $('.footer__checkout'); 11 const flow = 12 $('input[name="logic_q"]').val() || 13 document.body.getAttribute('data-ed-flow') || 14 ''; 15 16 17 //steps gtm// 18 function pushEdAppStep(step, totalSteps, logic) { 19 window.dataLayer = window.dataLayer || []; 20 window.dataLayer.push({ 21 event: 'ed_app_step', 22 ed_app_step: currentStep, 23 ed_app_total_steps: totalSteps, 24 ed_app_flow: flow // pal | eea 25 }); 26 } 27 28 29 function stepAnswered(step) { 30 const $inputs = $('.step--' + step).find( 31 'input[type=radio], input[type=checkbox]' 32 ); 33 return $inputs.is(':checked'); 34 } 35 36 jQuery(function ($) { 37 let currentStep = 1; 38 const $steps = $('.step'); 39 const totalSteps = $steps.length; 40 41 const $nextBtn = $('.footer__button--next'); 42 const $backBtn = $('.footer__button--back'); 43 const $submitBtn = $('.footer__button--submit'); 44 45 const $fill = $('.status__fill'); 46 const $thumb = $('.status__thumb'); 47 const $stepNumber = $('.status__number'); 48 const $stepTotal = $('.status__total'); 49 50 function updateProgress(step) { 51 // legacy-style math: step 1 = 0%, last step = 100% 52 const percent = 53 totalSteps > 1 54 ? ((step - 1) / (totalSteps - 1)) * 100 55 : 100; 56 57 $fill.css('width', percent + '%'); 58 $thumb.css('left', percent + '%'); 59 $stepNumber.text(step); 60 $stepTotal.text(totalSteps); 61 } 62 63 function stepAnswered(step) { 64 const $inputs = $('.step--' + step).find( 65 'input[type=radio], input[type=checkbox]' 66 ); 67 return $inputs.length ? $inputs.is(':checked') : true; 68 } 69 70 function showStep(step) { 71 $steps.hide(); 72 $('.step--' + step).show(); 73 74 updateProgress(step); 75 76 // Back button 77 $backBtn.toggle(step > 1); 78 79 // Next vs Submit 80 if (step >= totalSteps) { 81 $nextBtn.hide(); 82 $submitBtn.show().prop('disabled', false); 83 } else { 84 $nextBtn.show().prop('disabled', !stepAnswered(step)); 85 $submitBtn.hide().prop('disabled', true); 86 } 87 } 88 89 90 91 // INIT 92 updateProgress(currentStep); 93 showStep(currentStep); 94window.dataLayer = window.dataLayer || []; 95window.dataLayer.push({ 96 event: 'ed_app_step', 97 ed_app_step: currentStep, 98 ed_app_total_steps: totalSteps, 99 ed_app_flow: flow 100}); 101 102 $submitBtn.hide(); 103 104 // PUSH STEP 1 VIEW (this was missing) 105 pushEdAppStep(currentStep, totalSteps); 106 107 // Enable Next when answered 108 $(document).on('change', '.step input', function () { 109 if (stepAnswered(currentStep)) { 110 $nextBtn.prop('disabled', false); 111 } 112 }); 113 114 // Next 115 $nextBtn.on('click', function (e) { 116 e.preventDefault(); 117 if (!stepAnswered(currentStep)) return; 118 119 if (currentStep < totalSteps) { 120 currentStep++; 121 showStep(currentStep); 122 123 // GTM STEP TRACKING (after step changes) 124 window.dataLayer = window.dataLayer || []; 125 window.dataLayer.push({ 126 event: 'ed_app_step', 127 ed_app_step: currentStep, 128 ed_app_total_steps: totalSteps, 129 ed_app_flow: flow 130 }); 131 } 132 }); 133 134 135 // Back 136 $backBtn.on('click', function (e) { 137 e.preventDefault(); 138 if (currentStep > 1) { 139 currentStep--; 140 showStep(currentStep); 141 142 // PUSH BACK STEP 143 pushEdAppStep(currentStep, totalSteps); 144 } 145 }); 146 147 }); 148 149 150 151 152 // Block-form logic (Bootstrap modal â jQuery-safe) 153 $(document).on('change', '.step__check.block-form', function () { 154 if (this.checked) { 155 $('#edEmergencyModal').modal('show'); 156 } 157 }); 158 159 160 161 // Cleaner-item logic 162 $(document).on('change', '.step__check.cleaner-item', function () { 163 const $group = $(this).closest('fieldset'); 164 if ($(this).is(':checked')) { 165 $group 166 .find('.step__check') 167 .not(this) 168 .prop('checked', false) 169 .prop('disabled', true); 170 } else { 171 $group.find('.step__check').prop('disabled', false); 172 } 173 }); 174});
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.