1 2; /* Start:"a:4:{s:4:"full";s:77:"/local/components/tickets/setrificat/templates/blue/script.js?177254376614168";s:6:"source";s:61:"/local/components/tickets/setrificat/templates/blue/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3$(document).ready(function(){ 4 $('.sertificates').on('click', '.plus', function(){ 5 let value = $(this).closest('.foot-numeric').find('input'); 6 value.val(value.val()*1 + 1); 7 sertificatMagic(); 8 }); 9 $('.sertificates').on('click', '.minus', function(){ 10 let value = $(this).closest('.foot-numeric').find('input'); 11 if(value.val() != 0){ 12 value.val(value.val()*1 - 1); 13 } 14 15 if($('.omg').val() < 1000){ 16 $('.omg').val(1000); 17 } 18 19 sertificatMagic(); 20 }); 21 $('.sertificates').on('input','[name=sertificat_price]', function(){ 22 sertificatMagic(); 23 }); 24 $('.sertificates').on('change','#formCheck', function(){ 25 if($(this).prop('checked')){ 26 $('.send-form button').prop('disabled',false); 27 }else{ 28 $('.send-form button').prop('disabled',true); 29 } 30 }); 31 $('.sertificates').on('change','#sertByPodarok', function(){ 32 if($(this).prop('checked')){ 33 $('[name="email_podarok"]').prop('disabled',false); 34 }else{ 35 $('[name="email_podarok"]').prop('disabled',true); 36 } 37 }); 38 $('#sertificat-zakaz').on('submit',function(e){ 39 e.preventDefault(); 40 41 var $form = $(this); 42 43 $form.find('.error.text').removeClass('hidden'); 44 $('.sertificates').find('.error').removeClass('error'); 45 46 const validateEmail = (email) => { 47 return email.match( 48 /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 49 ); 50 }; 51 52 var errors = false; 53 54 if(!$('[name="fio"]').val()){ 55 errors = true; 56 $('[name="fio"]').closest('.field-data').addClass('error'); 57 } 58 59 if(!$('[name="email"]').val()){ 60 errors = true; 61 $('[name="email"]').closest('.field-data').addClass('error'); 62 } 63 64 if($('[name="email"]').val() && !validateEmail($('[name="email"]').val())){ 65 errors = true; 66 $form.find('.error.text').removeClass('hidden').text('ÐÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²Ð¾Ð´Ð° E-mail'); 67 } 68 69 if($('#sertByPodarok').is(':checked') && !$('[name="email_podarok"]').val()){ 70 errors = true; 71 $('[name="email_podarok"]').closest('.field-data').addClass('error'); 72 } 73 74 if($('#sertByPodarok').is(':checked') && $('[name="email_podarok"]').val() && !validateEmail($('[name="email_podarok"]').val())){ 75 errors = true; 76 $('[name="email_podarok"]').closest('.field-data').addClass('error'); 77 $form.find('.error.text').removeClass('hidden').text('ÐÑовеÑÑÑе пÑавилÑноÑÑÑ Ð²Ð²Ð¾Ð´Ð° подаÑоÑного E-mail'); 78 } 79 80 if($form.attr('data-count') == 0){ 81 $form.find('.error.text').removeClass('hidden').text('ÐÑбеÑиÑе ÑеÑÑиÑикаÑÑ'); 82 }else{ 83 if(!errors){ 84 // ÐÑовеÑÑем капÑÑ Ð¸ оÑпÑавлÑем ÑоÑÐ¼Ñ 85 submitFormWithCaptcha($form, function() { 86 $.ajax({
87 url: '/ajax/sertificat.php', 88 method: 'post', 89 dataType: 'json', 90 data: $form.serialize(), 91 success: function(data){ 92 $('#message').html(data); 93 if(data.status == 'success'){ 94 location.href = '/sertificat/?sertificat=' + data.sertificat; 95 } else { 96 onSubmitError($form); 97 } 98 }, 99 error: function (XMLHttpRequest, textStatus, errorThrown) { 100 onSubmitError($form); 101 } 102 }); 103 }); 104 } 105 } 106 107 return false; 108 }); 109 110 $('.sertificat-podarok').on('change','#sertByPodarok', function(){ 111 if($(this).prop('checked')){ 112 $('.sertificat-podarok').addClass('active'); 113 }else{ 114 $('.sertificat-podarok').removeClass('active'); 115 } 116 }); 117 118 $('.omg').on('change', function(){ 119 120 const isWhole = num => num % 1 === 0; 121 122 let val = $(this).val(); 123 let ceil = val / 500; 124 125 if(!isWhole(ceil)){ 126 ceil = Math.round (ceil); 127 val = ceil * 500; 128 } 129 130 if(val < 1000){ 131 val = 1000; 132 } 133 134 $(this).val(val); 135 sertificatMagic(); 136 }); 137 138 $('body').on('change','#formCheck', function(){ 139 sertificatMagic(); 140 }); 141 142 $('body').on('click','.sertificat-btn', function(){ 143 var $form = $('#sertificat-zakaz'); 144 145 // ÐÑовеÑÑем капÑÑ Ð¸ оÑпÑавлÑем ÑоÑÐ¼Ñ 146 submitFormWithCaptcha($form, function() { 147 $.ajax({ 148 url: '/ajax/sertificat.php', 149 method: 'post', 150 dataType: 'json', 151 data: $form.serialize(), 152 success: function(data){ 153 if(data.status == 'success'){ 154 location.href = '/sertificat/?sertificat=' + data.sertificat; 155 } else { 156 onSubmitError($form); 157 } 158 }, 159 error: function (XMLHttpRequest, textStatus, errorThrown) { 160 onSubmitError($form); 161 } 162 }); 163 }); 164 }); 165 166 $('.sertificat .head-price').on('click','.minus',function(){ 167 val = $('.sertificat .head-price input'); 168 if(val.val() <= 1000){ 169 val.val(''); 170 }else{ 171 value = val.val()*1 - 500; 172 val.val(value); 173 } 174 }); 175 176 $('.sertificat .head-price').on('click','.plus',function(){ 177 val = $('.sertificat .head-price input'); 178 value = val.val()*1 + 500; 179 if(value == 500){ 180 value = 1000; 181 } 182 val.val(value); 183 }); 184 185 $('body').on('click','form .btn', function(){ 186 $('.sertificat-podarok').find('.error').removeClass('error'); 187 if(!$('[name="fio"]').val()){ 188 $('[name="fio"]').closest('.field-data').addClass('error'); 189 } 190 if(!$('[name="email"]').val()){ 191 $('[name="email"]').closest('.field-data').addClass('error'); 192 } 193 }); 194 195 $('[name="admin_price"]').on('input',function(){ 196 let val = $(this).val(); 197 if(val > 0){ 198 $('.sertificat:first-child [name="serificat_col2"]').val(1); 199 $('[name="fio"]').val('Test'); 200 $('[name="email"]').val('[email protected]'); 201 $('#formCheck').prop('checked',true); 202 $('.send-form button').prop('disabled',false); 203 $('#sertificat-zakaz [type="submit"]').prop('disabled',false).removeClass('disabled-class'); 204 }else{ 205 $('.sertificat:first-child [name="serificat_col2"]').val(0); 206 $('[name="fio"]').val(''); 207 $('[name="email"]').val(''); 208 $('#formCheck').prop('checked',false); 209 $('.send-form button').prop('disabled',true); 210 $('#sertificat-zakaz [type="submit"]').prop('disabled',true).addClass('disabled-class'); 211 } 212 sertificatMagic(); 213 }); 214 215 function sertificatMagic() 216 { 217 var sert = ''; 218 var price_all = 0; 219 var count_all = 0; 220 $('.sertificat').each(function( index ) { 221 let count = $(this).find('.foot-numeric input[type="text"]').val(); 222 let num = index+1*1; 223 if(count > 0){ 224 $('#sertificat'+index).val(count); 225 if($(this).find('.head-price input').val()){ 226 price = $(this).find('.head-price input').val(); 227 $('#sertificatPrice'+index).val(price); 228 }else{ 229 price = $(this).find('.head-price').text().replace(/[^+\d]/g, ''); 230 $('#sertificatPrice'+index).val(price); 231 } 232 233 if(price){ 234 count_all += count*1; 235 price_all += price*count; 236 } 237 } 238 239 }); 240 241 if(price_all > 0){ 242 let podpis = ' ÑеÑÑиÑикаÑ'; 243 if(count_all > 1){ 244 podpis = ' ÑеÑÑиÑикаÑов'; 245 } 246 sert = makeMoney(price_all) + ' / ' + count_all + podpis; 247 $('#sertificat-zakaz').attr('data-count',count_all); 248 $('.send-form .col-text .zakaz-text').text(sert); 249 if($('#formCheck').prop('checked')){ 250 $('.send-form button').prop('disabled',false); 251 } 252 }else{ 253 $('#sertificat-zakaz').attr('data-count',0); 254 $('.send-form .col-text .zakaz-text').text('ÐÑбеÑиÑе ÑеÑÑиÑикаÑÑ'); 255 $('.send-form button').prop('disabled',true); 256 } 257 $('#sertificat-zakaz').find('.error.text').addClass('hidden'); 258 } 259 260 function makeMoney(n) { 261 return parseFloat(n).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1 ").slice(0, -3)+' â½'; 262 } 263}); 264 265/** 266 * ÐÑпомогаÑелÑÐ½Ð°Ñ ÑÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¾ÑпÑавки ÑоÑÐ¼Ñ Ñ ÐºÐ°Ð¿Ñей 267 * @param {jQuery} $form - jQuery обÑÐµÐºÑ ÑоÑÐ¼Ñ 268 * @param {Function} sendCallback - ÑÑнкÑÐ¸Ñ Ð¾ÑпÑавки AJAX 269 */ 270function submitFormWithCaptcha($form, sendCallback) {
271 // ÐÑовеÑÑем, еÑÑÑ Ð»Ð¸ капÑа и нÑжен ли Ñокен 272 if ($form[0].captchaAPI && !$form[0].captchaAPI.isExecuted()) { 273 // Токена Ð½ÐµÑ â запÑÑкаем капÑÑ Ð¸ ждÑм 274 $form[0].captchaAPI.execute(function () { 275 sendCallback(); 276 }); 277 } else { 278 // Токен Ñже еÑÑÑ Ð¸Ð»Ð¸ капÑи неÑ, оÑпÑавлÑем ÑÑÐ°Ð·Ñ 279 sendCallback(); 280 } 281} 282 283function createSertificatCloudPayment(props,needReload = false) { 284 pay = function () { 285 var widget = new cp.CloudPayments(); 286 287 var receipt = { 288 "Items": [ 289 { 290 "label": "ÐплаÑа ÑеÑÑиÑикаÑа â" + props.SERTIFICAT_ID, 291 "price": parseInt(props.SUM), 292 "quantity": 1, 293 "amount": parseInt(props.SUM), 294 "vat": props.VAT, 295 "method": 4, 296 "object": 1, 297 "measurementUnit": "ÑÑ" 298 }, 299 300 ], 301 "calculationPlace": props.SITE, 302 "taxationSystem": 1, 303 "email": props.EMAIL, 304 "phone": props.PHONE, 305 "customerInfo": props.NAME, 306 "customerInn": "", 307 "isBso": false, 308 "amounts": { 309 "electronic": parseInt(props.SUM), 310 "advancePayment": 0.00, 311 "credit": 0.00, 312 "provision": 0.00 313 } 314 } 315 316 var data = { 317 "cloudPayments": { 318 "customerReceipt": receipt, 319 } 320 } 321 322 widget.charge({ // options 323 publicId: props.PUBLIC_ID, 324 description: "ÐплаÑа ÑеÑÑиÑикаÑа â" + props.SERTIFICAT_ID, 325 amount: parseInt(props.SUM), 326 currency: 'RUB', //валÑÑа 327 invoiceId: props.SERTIFICAT_ID, 328 accountId: props.EMAIL, 329 email: props.EMAIL, 330 skin: "mini", 331 data: data 332 }, 333 function (options) { // success 334 location.href = '/sertificat/?payment=success&sertificat=' + props.SERTIFICAT_HASH; 335 }, 336 function (reason, options) { // fail 337 $('input[type="submit"]').attr("disabled", false); 338 if (reason === 'User has cancelled') { // закÑÑл окоÑко виджеÑа 339 if (needReload){ 340 location.href = '/sertificat/?payment=fail&sertificat=' + props.SERTIFICAT_HASH; 341 } 342 console.log('fail!', reason, options) 343 } else { 344 location.href = '/sertificat/?payment=fail&sertificat=' + props.SERTIFICAT_HASH; 345 } 346 }); 347 }; 348 pay(); 349} 350 351function createSertificatPaySelection(props) { 352 var widget = new pw.PayWidget(); 353 var siteData = { 354 // serviceId - ÐденÑиÑикаÑÐ¾Ñ Ð¢Ð¡Ð 355 serviceId: props.PS_SITE_ID, 356 // key - public key из лиÑного кабинеÑа меÑÑанÑа 357 key: props.PUBLIC_ID, 358 // logger - Ð´Ð»Ñ Ð²ÐºÐ»ÑÑÐµÐ½Ð¸Ñ ÑаÑÑиÑенного логиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¿Ñи оÑладке 359 logger: true, 360 }; 361 362 // BEGIN ->ÐÐÐÐÐÐ ÐÐЯ Ð ÐСЧÐТРÐÐÐÐÐÐ 363 var tax = parseInt(props.SUM) / 100 * props.VAT, 364 taxData = { type: "none", sum: 0 }; 365 if( props.VAT != null && props.VAT != 0 ) 366 taxData = { 367 type: 'vat' + props.VAT, 368 sum: Number(tax.toFixed(2)) 369 } 370 // END ->ÐÐÐÐÐÐ ÐÐЯ Ð ÐСЧÐТРÐÐÐÐÐÐ 371 372 var itemName = "ÐплаÑа ÑеÑÑиÑикаÑа â" + props.SERTIFICAT_ID.substr(0, 100); 373 374 const today = new Date(); 375 const yyyy = today.getFullYear(); 376 let mm = today.getMonth() + 1; // Months start at 0! 377 let dd = today.getDate(); 378 let HH = today.getHours(); 379 let min = today.getMinutes(); 380 let ss = today.getSeconds(); 381 382 if (dd < 10) dd = '0' + dd; 383 if (mm < 10) mm = '0' + mm; 384 385 const formattedToday = dd + '.' + mm + '.' + yyyy + ' ' + HH + ':' + min + ':' + ss; 386 // ÐапÑÐ¾Ñ Ñ Ð¼Ð¸Ð½Ð¸Ð¼Ð°Ð»ÑнÑм колиÑеÑÑвом паÑамеÑÑов 387 var paymentData = { 388 MetaData: { 389 PaymentType: "Pay",//меÑод одноÑÑадийной оплаÑÑ 390 }, 391 PaymentRequest: { 392 OrderId: "" + props.SERTIFICAT_ID,//иденÑиÑикаÑÐ¾Ñ Ð·Ð°ÐºÐ°Ð·Ð° 393 Amount: props.SUM,//ÑÑмма плаÑежа 394 Currency: "RUB",//валÑÑа 395 Description: "ÐплаÑа ÑеÑÑиÑикаÑа â" + props.SERTIFICAT_ID,//назнаÑение плаÑежа 396 ExtraData: { 397 ReturnUrl: '/sertificat/?payment=success&sertificat=' + props.SERTIFICAT_HASH, 398 } 399 }, 400 ReceiptData: { 401 timestamp: formattedToday, 402 receipt: { 403 client: { 404 name: props.NAME, 405 email: props.EMAIL, 406 }, 407 company: { 408 sno: "usn_income", 409 inn: "237000013046", 410 payment_address: props.SITE 411 }, 412 items: [ 413 { 414 name: "ÐплаÑа ÑеÑÑиÑикаÑа â" + props.SERTIFICAT_ID, 415 price: parseInt(props.SUM), 416 quantity: 1, 417 sum: parseInt(props.SUM), 418 measurement_unit: "0", 419 payment_method: "full_prepayment", 420 payment_object: "service", 421 vat: taxData, 422 } 423 ], 424 payments: [ 425 { 426 type: 1, 427 sum: parseInt(props.SUM) 428 } 429 ], 430 vats: [ 431 taxData 432 ], 433 total: parseInt(props.SUM) 434 435 } 436 }, 437 CustomerInfo: { 438 Email: props.EMAIL, 439 //Phone: props.PHONE, 440 }, 441 }; 442 console.log("ReceiptData",paymentData.ReceiptData) 443 var callback = { 444 // ÐаÑианÑÑ ÑобÑÑий, коÑоÑÑе могÑÑ Ð¿ÑÐ¸Ñ Ð¾Ð´Ð¸ÑÑ Ð¿Ð¾ колбекам (ÑведомлениÑм): 445 onSuccess: function (res) { 446 location.href = '/sertificat/?payment=success&sertificat=' + props.SERTIFICAT_HASH; 447 console.log("onSuccess from shop", res); 448 },// Ð´Ð»Ñ onSuccess -> PAY_WIDGET:TRANSACTION_SUCCESS, 449 450 451 onError: function (res) { 452 // location.href = '/cart-success/?order=fail&id=' + props.SERTIFICAT_HASH; 453 console.log("onFail from shop", res); 454 },// Ð´Ð»Ñ onError -> PAY_WIDGET:TRANSACTION_FAIL, 455 456 onClose: function (res) { 457 if (res.code === "PAY_WIDGET:CLOSE_AFTER_FAIL"){ 458 location.href = '/sertificat/?payment=fail&sertificat=' + props.SERTIFICAT_HASH; 459 } 460 $('input[type="submit"]').attr("disabled", false);
461 console.log("onClose from shop", res); 462 },// Ð´Ð»Ñ onClose -> PAY_WIDGET:CLOSE_BEFORE_PAY 463 }; 464 widget.pay(siteData, paymentData, callback, {only2Level: true}) 465}; 466 467function onSubmitError($form){ 468 $.fancybox.open({ src: '#error-popup', type: 'inline' }); 469 470 if ($form[0].captchaAPI) { 471 $form[0].captchaAPI.reset(); 472 } 473} 474/* End */ 475;; /* /local/components/tickets/setrificat/templates/blue/script.js?177254376614168*/
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.