1$(".btn-scheda").click(function () { 2 loadAddonTc(); 3}); 4 5$(".addon-radio .theAddOffer").click(function () { 6 num = $(this).attr('data-num'); 7 wttitle = $(this).attr('data-title'); 8 addtype = $("#btn_smart_" + num).attr('data-addtype'); 9 if ($(this).hasClass("active")) { 10 setTimeout('$(".addon-radio #label_smart_' + num + '").removeClass("active")', 50); 11 resetSmartAddon(); 12 ticket = 'add'; 13 } 14 if (!$(this).hasClass("active")) { 15 resetSmartAddon(); 16 setTimeout('$(".addon-radio #label_smart_' + num + '").addClass("active")', 50); 17 $("#select_smart_" + num).prop('disabled', false); 18 $("#btn_smart_" + num).removeClass("add").addClass("rem"); 19 $("#btn_smart_" + num).text("Rimuovi"); 20 $("#btn_smart_" + num).attr('data-addact', 'add'); 21 ticket = 'rem'; 22 } 23 if (template === 'sp') { 24 setAddonSession(); 25 updateTicket('addon'); 26 } 27}); 28 29$(".num-smart-device").change(function () { 30 num = $(this).attr('data-num'); 31 val = $(this).val(); 32 addtype = $("#btn_smart_" + num).attr('data-addtype'); 33 $("#btn_smart_" + num).attr('data-addamount', val); 34 if (template === 'sp') 35 setAddonSession(); 36 updateTicket('addon'); 37}); 38 39$(".btn-addon").click(function () { 40 num = $(this).attr('data-num'); 41 addtype = $(this).attr('data-addtype'); 42 addcode = $(this).attr('data-addcode'); 43 addamount = $(this).attr('data-addamount'); 44 addact = $(this).attr('data-addact'); 45 wttitle = $(this).attr('data-title'); 46 wtact = (addact === 'add') ? 'Rem' : 'Add'; 47 if (addtype === 'full' && template === 'sp') { 48 if ($(this).hasClass("add")) { 49 changeProductConf('full'); 50 wtact = 'Add'; 51 } else { 52 changeProductConf('open'); 53 wtact = 'Rem'; 54 } 55 } else if(addtype === 'new_conf'){ 56 if ($(this).hasClass("add")) { 57 loadCatalogNew(addcode, tec_id, lna, beha = false, promo_code, promo_code !== null); 58 wtact = 'Add'; 59 $(this).removeClass("add").addClass("rem"); 60 $(this).text("Rimuovi"); 61 addaction = 'add'; 62 }else{ 63 loadCatalogNew(short_code, tec_id, lna, beha = false, promo_code, promo_code !== null); 64 wtact = 'Rem'; 65 $(this).removeClass("rem").addClass("add"); 66 $(this).text("Aggiungi"); 67 addaction = 'rem'; 68 } 69 $(this).attr('data-addact', addaction); 70 } else { 71 if ($(this).hasClass("add")) { 72 if ($(this).hasClass("smart-addon")) { 73 resetSmartAddon(); 74 } 75 setTimeout('$(".addon-radio #label_smart_' + num + '").addClass("active")', 50); 76 $("#select_smart_" + num).prop('disabled', false); 77 $(this).removeClass("add").addClass("rem"); 78 $(this).text("Rimuovi"); 79 addaction = 'add'; 80 } else { 81 if ($(this).hasClass("smart-addon")) { 82 resetSmartAddon(); 83 } 84 $(this).removeClass("rem").addClass("add"); 85 $(this).text("Aggiungi"); 86 addaction = 'rem'; 87 } 88 $(this).attr('data-addact', addaction); 89 if (template === 'sp') 90 updateTicket('addon'); 91 } 92 if (template === 'sp') { 93 setAddonSession(); 94 } 95 trackingAddon(wttitle, wtact); 96}); 97 98function setAddonSession() { 99 addonlist = loadAddonTc(true); 100 console.log(addonlist); 101 dataObj = { 102 "addonlist": addonlist 103 }; 104 $.ajax({
105 type: "GET", 106 url: "/static/addon/addon.php", 107 data: dataObj, 108 dataType: "text" 109 }); 110} 111 112function updateTicket(act) { 113 params = loadAddonTicket(); 114 if (params.mandatory !== '' || params.ticketid !== '' || params.addpid !== '') { 115 get_ticket(act, params); 116 } else { 117 get_ticket(act); 118 } 119 120} 121 122function changeProductConf(prod) { 123 if (appl != 'selfcare_moving_b2c') 124 mode = '/acquisto/'; 125 else 126 mode = '/move/'; 127 url = window.location.pathname.split('/'); 128 tec = url[2]; 129 pro = url[3]; 130 if (prod === 'full') { 131 new_url = mode + tec + '/' + pro + '_full/'; 132 } else { 133 new_pro = pro.replace('_full', ''); 134 new_url = mode + tec + '/' + new_pro + '/'; 135 } 136 window.location.href = new_url; 137} 138 139function resetSmartAddon() { 140 setTimeout('$(".addon-radio .theAddOffer").removeClass("active")', 50); 141 $(".btn-addon").attr('data-addamount', ''); 142 $(".num-smart-device").prop('selectedIndex', 0); 143 $(".num-smart-device").prop('disabled', true); 144 $(".smart-addon").removeClass("rem").addClass("add"); 145 $(".smart-addon").text("Aggiungi"); 146 $(".smart-addon").attr('data-addact', 'rem'); 147} 148 149function loadAddonTicket() { 150 mandatory = $("#Mandatory_ProductID").val(); 151 let params = {mandatory: '', addpid: '', ticketid: '', typeadd: ''}; 152 $(".btn-addon").each(function () { 153 addcode = $(this).attr('data-addcode'); 154 addtype = $(this).attr('data-addtype'); 155 addamount = $(this).attr('data-addamount'); 156 addact = $(this).attr('data-addact'); 157 if(addtype !== 'new_conf') { 158 if (addact === 'add') { 159 if (addtype === 'lamp' || addtype === 'webcam') { 160 smart = loadSmartAddon(addcode, addamount, true); 161 params.mandatory = mandatory; 162 params.addpid += smart; 163 } else if (addtype === 'modem') { 164 modem = changeModemConf(addcode, true); 165 params.mandatory = modem.mandatory; 166 params.ticketid = modem.ticketid; 167 } else { 168 simple = loadSimpleAddon(addcode, addtype, true); 169 params.mandatory = mandatory; 170 params.addpid += simple; 171 } 172 } 173 } 174 }); 175 return params; 176} 177 178function loadAddonSp() { 179 $(".btn-addon").each(function () { 180 addcode = $(this).attr('data-addcode'); 181 addtype = $(this).attr('data-addtype'); 182 addamount = $(this).attr('data-addamount'); 183 addact = $(this).attr('data-addact'); 184 if(addtype !== 'new_conf'){ 185 if (addact === 'add') { 186 if (addtype === 'lamp' || addtype === 'webcam') { 187 loadSmartAddon(addcode, addamount); 188 } else if (addtype === 'modem') { 189 changeModemConf(addcode); 190 } else { 191 loadSimpleAddon(addcode, addtype) 192 } 193 } 194 } 195 }); 196} 197 198function loadAddonTc(result = false) { 199 var addonlist = ''; 200 $(".btn-addon").each(function () { 201 addtype = $(this).attr('data-addtype'); 202 addamount = $(this).attr('data-addamount'); 203 addact = $(this).attr('data-addact'); 204 if (addact === 'add') { 205 if (addamount === "") { 206 addonlist += addtype + '|'; 207 } else { 208 addonlist += addtype + ':' + addamount + '|'; 209 } 210 } 211 }); 212 clear_addonlist = addonlist.slice(0, -1); 213 if (result) { 214 return clear_addonlist; 215 } else { 216 if (clear_addonlist !== '') { 217 $("#addon_list").val(clear_addonlist); 218 } 219} 220} 221 222function loadSimpleAddon(addcode, addtype, ticket = false) { 223 add = '|' + addcode; 224 if (ticket) { 225 if (addtype === 'chi_e') { 226 return add + ',,chi_e'; 227 } 228 else if (addtype === 'ip_statico'){ 229 return add + ',,ip_statico'; 230 } 231 else { 232 return add; 233 } 234 } else { 235 newMandatory = $("#Mandatory_ProductID").val() + add; 236 $("#Mandatory_ProductID").val(newMandatory); 237} 238} 239 240function loadSmartAddon(addcode, addamount, ticket = false) { 241 codes = addcode.split('|'); 242 addcode_free = codes[0]; 243 addcode_pay = codes[1]; 244 ticket_pay = ''; 245 if (addamount === "") { 246 add = '|' + addcode_free; 247 } else { 248 if (ticket) { 249 ticket_pay = ',pay'; 250 } 251 addcode_pay_num = addcode_pay + ',' + addamount; 252 add = '|' + addcode_free + '|' + addcode_pay_num + ticket_pay; 253 } 254 if (ticket) { 255 return add; 256 } else { 257 newMandatory = $("#Mandatory_ProductID").val() + add; 258 $("#Mandatory_ProductID").val(newMandatory); 259} 260} 261 262function changeModemConf(addcode, ticket = false) { 263 let modem = {mandatory: '', ticketid: ''}; 264 newConf = addcode.split('\\'); 265 m_pid = $("#Mandatory_ProductID").val().split('|'); 266 m_bak = $("#Mandatory_ProductID_bak").val().split('|'); 267 if (m_bak.length < m_pid.length) { 268 var other_addon = ''; 269 diff = m_bak - m_pid; 270 for (i = (m_bak.length); i < m_pid.length; i++) { 271 other_addon += "|" + m_pid[i]; 272 } 273 } 274 jQuery.each(newConf, function (i, val) { 275 param = val.split(':'); 276 param_name = param[0]; 277 param_value = param[1]; 278 if (ticket) { 279 if (param_name === 'Mandatory_ProductID') { 280 modem.mandatory = param_value; 281 } else if (param_name === 'ticketId') { 282 modem.ticketid = param_value; 283 } 284 } else { 285 if (param_name === 'Mandatory_ProductID') { 286 param_value = param[1] + other_addon; 287 } else { 288 param_value = param[1]; 289 } 290 $("#" + param_name).val(param_value); 291 } 292 });
293 if (ticket) { 294 return modem; 295} 296} 297 298function trackingAddon(title, addact) { 299 msg = title + ' - ' + addact; 300 try { 301 wt.sendinfo({linkId: msg}); 302 } catch (err) { 303 } 304}
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.