1;(function ($, w) { 2 'use strict'; 3 if (!w.jQuery) { 4 throw 'Ideasoft: jQuery not found'; 5 } 6 w.IdeaApp[IdeaApp.helpers.getRouteGroup()] = { 7 init: function () { 8 IdeaApp.helpers.initializePage(); 9 }, 10 11 /* Contact Form Page */ 12 contactForm: { 13 init: function () { 14 this.afterInit(); 15 this.validateForm(); 16 this.eventListener(); 17 }, 18 19 afterInit: function () { 20 IdeaApp.helpers.maskPhone([$('input[name="phone"]')]); 21 }, 22 23 validateForm: function () { 24 $('[data-selector="contact-form"]').validate({ 25 errorElement: "div", 26 validClass: 'validate', 27 errorClass: 'validate-error', 28 rules: { 29 fullname: { 30 required: true, 31 minlength: 5, 32 maxlength: 60 33 }, 34 email: { 35 required: true, 36 email: { 37 depends: function () { 38 $(this).val($.trim($(this).val())); 39 return true; 40 } 41 }, 42 maxlength: 60 43 }, 44 phone: { 45 required: true, 46 minlength: 7, 47 maxlength: 20, 48 phoneValid: true 49 }, 50 subject: { 51 required: true, 52 minlength: 5, 53 maxlength: 60 54 }, 55 message: { 56 required: true, 57 minlength: 5, 58 maxlength: 1000 59 }, 60 personalDataAgreement: { 61 required: true 62 }, 63 }, 64 messages: { 65 fullname: { 66 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="fullname"]') + " giriniz.", 67 minlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="fullname"]') + " en az 5 karakter olmalıdır.", 68 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="fullname"]') + " en fazla 60 karakter olmalıdır." 69 }, 70 email: { 71 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="email"]') + " giriniz.", 72 email: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="email"]') + " uygun formatta olmalıdır.", 73 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="email"]') + " en fazla 60 karakter olmalıdır." 74 }, 75 phone: { 76 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="phone"]') + " giriniz.", 77 minlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="phone"]') + " en az 7 karakter olmalıdır.", 78 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="phone"]') + " en fazla 20 karakter olmalıdır.", 79 phoneValid: "Lütfen geçerli bir " + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="phone"]') + " giriniz." 80 }, 81 subject: { 82 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="subject"]') + " giriniz.", 83 minlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="subject"]') + " en az 5 karakter olmalıdır.", 84 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] input[name="subject"]') + " en fazla 60 karakter olmalıdır." 85 }, 86 message: { 87 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] textarea[name="message"]') + " giriniz.", 88 minlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] textarea[name="message"]') + " en az 5 karakter olmalıdır.", 89 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="contact-form"] textarea[name="message"]') + " en fazla 1000 karakter olmalıdır." 90 }, 91 personalDataAgreement: { 92 required: "Lütfen KiÅisel Verilerin Korunması alanını boÅ bırakmayınız." 93 } 94 }, 95 errorPlacement: function (error, element) { 96 if (element.attr("type") == "radio") { 97 element.parents('.radio-custom-groups').after(error) 98 } else if (element.attr("type") == "checkbox") { 99 element.parents('.checkbox-custom-groups').after(error) 100 } else if (element.attr("data-selector") == "birth-date") { 101 element.parents('.input-group').after(error); 102 } else { 103 element.after(error); 104 } 105 }, 106 showErrors: function (errorMap, errorList) { 107 for (var i = 0; i < errorList.length; i++) { 108 var error = errorList[i]; 109 error = IdeaApp.helpers.modifyValidationError(error); 110 } 111 this.defaultShowErrors(); 112 } 113 }); 114 115 $.validator.addMethod('email', function (email) { 116 return IdeaApp.helpers.checkEmail(email); 117 }); 118 119 $.validator.addMethod('phoneValid', function (value) { 120 return IdeaApp.helpers.checkPhone(value); 121 }); 122 }, 123 124 eventListener: function () { 125 $(document).on('click', '[data-selector="contact-form-submit-button"]', function () { 126 IdeaApp.helpers.ajaxRequest({ 127 url: IdeaApp.routing.generate('/recaptcha-visibility'), 128 success: function (response) { 129 if (response.success) {
130 if (response.data === 'invisible') { 131 $("#contact-form").submit(); 132 } else { 133 if (grecaptcha.getResponse()) { 134 reCaptchaContactSubmit(); 135 $("#contact-form").submit(); 136 } else { 137 IdeaApp.plugins.notification(notificationMessages.complete_google_captcha, 'warning'); 138 $(this).removeClass('btn-loading'); 139 } 140 } 141 } else { 142 IdeaApp.plugins.notification(response.errorMessage, 'warning'); 143 IdeaApp.plugins.loadingBar.hide(); 144 } 145 } 146 }); 147 }); 148 $(document).on('focus', '[name="phone"]', function () { 149 IdeaApp.helpers.addPrefix($(this), null); 150 }); 151 152 $(document).on('input', '[name="phone"]', function () { 153 IdeaApp.helpers.addPrefix($(this), null); 154 }); 155 } 156 }, 157 158 /* Support Form Page */ 159 supportForm: { 160 init: function () { 161 this.validateForm(); 162 this.eventListener(); 163 }, 164 validateForm: function () { 165 $('[data-selector="support-form"]').validate({ 166 errorElement: "div", 167 validClass: 'validate', 168 errorClass: 'validate-error', 169 rules: { 170 email: { 171 required: true, 172 email: { 173 depends: function () { 174 $(this).val($.trim($(this).val())); 175 return true; 176 } 177 }, 178 }, 179 refno: { 180 required: true 181 } 182 183 }, 184 messages: { 185 email: { 186 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="support-form"] input[name="email"]') + " giriniz.", 187 email: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="support-form"] input[name="email"]') + " uygun formatta olmalıdır." 188 }, 189 refno: { 190 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="support-form"] input[name="refno"]') + " giriniz." 191 } 192 }, 193 showErrors: function (errorMap, errorList) { 194 for (var i = 0; i < errorList.length; i++) { 195 var error = errorList[i]; 196 error = IdeaApp.helpers.modifyValidationError(error); 197 } 198 this.defaultShowErrors(); 199 } 200 }); 201 }, 202 eventListener: function () { 203 $(document).on('click', '[data-selector="support-form-button"]', function () { 204 var supportForm = $('[data-selector="support-form"]'); 205 if (supportForm.valid()) { 206 $(this).addClass('btn-loading'); 207 } 208 }); 209 } 210 }, 211 /* Fast Comment Form Page */ 212 fastComment: { 213 init: function () { 214 this.reviewStatus(); 215 this.validateForm(); 216 this.getHash(); 217 this.fastSignupFormValidate(); 218 this.eventListener(); 219 }, 220 221 accordion: function (element) { 222 var accordionContent = '[data-selector="fast-review-accordion-content"]'; 223 element.parent().siblings().removeClass('active');
224 $(accordionContent).slideUp(300); 225 if (element.parent().hasClass('active')) { 226 element.parent().removeClass('active'); 227 element.next(accordionContent).slideUp(300); 228 } else { 229 element.parent().addClass('active'); 230 element.next(accordionContent).slideDown(300); 231 } 232 }, 233 234 reviewStatus: function () { 235 var reviewfirstItem = '.fast-review-item:not(".passive"):first'; 236 var accordionContent = '[data-selector="fast-review-accordion-content"]'; 237 $(reviewfirstItem).addClass('active'); 238 $(reviewfirstItem).find(accordionContent).slideDown(300); 239 if (!$('.fast-review-item').hasClass("active")) { 240 $('<div class="alert alert-success">Tüm deÄerlendirmeleriniz alınmıÅtır, vakit ayırdıÄınız için teÅekkür ederiz.</div>').insertBefore('.fast-review-items'); 241 } 242 }, 243 244 togglePanel: function (submitButton) { 245 var fastReviewItem = submitButton.parents('[data-selector="fast-review-item"]'); 246 var accordionContent = '[data-selector="fast-review-accordion-content"]' 247 fastReviewItem.removeClass('active').addClass('passive'); 248 $(fastReviewItem).find(accordionContent).slideUp(300); 249 this.reviewStatus(); 250 }, 251 252 getHash: function () { 253 var path = window.location.pathname; 254 var str = path.split("/"); 255 var hash = str[2]; 256 $('[name="hash"]').val(hash); 257 $('[name="hashShoppingExperience"]').val(hash); 258 }, 259 260 validateForm: function () { 261 var fastReviewForm = $('[data-selector="fast-review-form"]'); 262 fastReviewForm.each(function (index) { 263 $(this).validate({ 264 errorElement: "div", 265 validClass: 'validate', 266 errorClass: 'validate-error', 267 rules: { 268 content: { 269 minlength: 5, 270 maxlength: 1000 271 }, 272 title:{ 273 maxlength:200, 274 } 275 }, 276 messages: { 277 content: { 278 required: "Lütfen yorumunuzu giriniz.", 279 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('#comment-form [name="content"]') + " En fazla 1000 karakter olmalıdır." 280 281 }, 282 title: { 283 required: "Lütfen yorum baÅlıÄı giriniz.", 284 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('#comment-form [name="title"]') + " En fazla 200 karakter olmalıdır." 285 286 } 287 }, 288 showErrors: function (errorMap, errorList) { 289 for (var i = 0; i < errorList.length; i++) { 290 var error = errorList[i]; 291 error = IdeaApp.helpers.modifyValidationError(error); 292 } 293 this.defaultShowErrors(); 294 } 295 }); 296 }) 297 }, 298 299 submitForm: function (submitButton) { 300 $('#fastSignUpDiv').removeClass('blink'); 301 var fastReviewForm = submitButton.parents('form'); 302 var self = this; 303 if (fastReviewForm.valid()) { 304 fastReviewForm.find('[data-selector="fast-review-form-button"]').addClass('btn-loading').attr('disabled', true); 305 306 var formData = new FormData(fastReviewForm[0]); // FormData ile tüm formu gönder 307 308 $.ajax({ 309 url: IdeaApp.routing.generate('/fastCommentSave'), 310 type: 'POST', 311 data: formData, 312 processData: false, // jQuery'nin veriyi iÅlemesine engel ol 313 contentType: false, // Form verisini olduÄu gibi gönder 314 success: function (response) { 315 if (response.success) { 316 IdeaApp.plugins.notification(response.data.message, 'confirmation'); 317 self.togglePanel(submitButton); 318 } else { 319 const errorCode = response.errorMessage.error; 320 fastReviewForm.find('[data-selector="fast-review-form-button"]').removeClass('btn-loading').attr('disabled', false); 321 switch (errorCode) { 322 case '452134': 323 IdeaApp.plugins.notification('Form hatası. Lütfen formdaki alanları istendiÄi formatta doldurunuz', 'warning'); 324 break; 325 case '220624': 326 IdeaApp.plugins.notification('Bu ürüne daha önce yorum yaptınız.', 'warning'); 327 self.togglePanel(submitButton); 328 break; 329 case '200311': 330 IdeaApp.plugins.notification('Bilinmeyen bir hata oluÅtu lütfen iletiÅime geçin', 'warning'); 331 break; 332 case '110320': 333 $('#fastSignUpDiv').css('display', 'block').addClass('blink'); 334 $('html').animate({ scrollTop: $('#fastSignUpDiv').offset().top - 200 },200); 335 break; 336 default: 337 IdeaApp.plugins.notification(response.errorMessage.error, 'warning'); 338 break; 339 } 340 } 341 } 342 }); 343 } 344 }, 345 346 fastSignupFormValidate: function () { 347 $('#fastSignupForm').validate({ 348 errorElement: "div", 349 validClass: 'validate', 350 errorClass: 'validate-error', 351 focusInvalid: false, 352 rules: { 353 password: { 354 required: true, 355 minlength: 6, 356 regex: /^(?=.*[0-9])(?=.*[a-zA-Z])[a-zA-Z0-9!.,?:;@#$%^&*()_\-+={}\[\]|\/~\^%&\-]{6,16}$/, 357 }, 358 memberAgreement: { 359 required: true 360 }, 361 personalDataAgreement: { 362 required: true 363 } 364 }, 365 messages: { 366 password: { 367 required: "Lütfen Åifre belirtiniz.", 368 minlength: "Åifre en az 6 haneli olmalıdır.", 369 regex: "Åifre uzunluÄu en az 6 karakter olmalıdır, bir harf ve rakam içermelidir." 370 }, 371 memberAgreement: { 372 required: "Lütfen üyelik sözleÅmesini kabul edin." 373 }, 374 personalDataAgreement: { 375 required: "Lütfen kiÅisel verileri koruma kanununu kabul edin." 376 } 377 }, 378 errorPlacement: function (error, element) { 379 if ($("div.validate-error").length == 0) {
380 element.parents('.cart-block').eq(0).append(error).addClass('cart-block-error'); 381 } 382 }, 383 showErrors: function (errorMap, errorList) { 384 for (var i = 0; i < errorList.length; i++) { 385 var error = errorList[i]; 386 error = IdeaApp.helpers.modifyValidationError(error); 387 } 388 this.defaultShowErrors(); 389 } 390 }); 391 $.validator.addMethod('regex', function (value, element, regexp) { 392 return IdeaApp.helpers.checkRegex(value, element, regexp) 393 }); 394 }, 395 396 397 submitFastSignupForm: function (submitButton) { 398 var formElement = $("#fastSignupForm"); 399 if (!formElement.valid()) { 400 return; 401 } 402 submitButton.attr('disabled', 'disabled').addClass('btn-loading'); 403 var reviewActiveItem = $('[data-selector="fast-review-item"].active'); 404 IdeaApp.helpers.ajaxRequest({ 405 url: IdeaApp.routing.generate('/hizli-uye-ol?hash=' + formElement.attr('data-order-hash')), 406 data: formElement.serialize(), 407 success: function (response) { 408 if (response.success) { 409 IdeaApp.plugins.notification("Sisteme üyeliÄiniz baÅarıyla tamamlanmıÅtır.", 'confirmation'); 410 $('.order-fast-signup').slideUp(300); 411 $('html').animate({scrollTop: reviewActiveItem.offset().top - $('#fastSignUpDiv').height + 100}, 200); 412 } else { 413 IdeaApp.plugins.notification(response.errorMessage, 'warning'); 414 submitButton.removeAttr('disabled').removeClass('btn-loading'); 415 } 416 } 417 }); 418 }, 419 420 changeMemberPassword: function (element) { 421 $('div.validate-error').remove(); 422 if (element.val().length > 3) { 423 $('[data-selector="fast-signup-checkbox-groups"]').fadeIn().removeClass('d-none'); 424 } else { 425 $('[data-selector="fast-signup-checkbox-groups"]').fadeOut().addClass('d-none'); 426 } 427 }, 428 429 checkFastSignupForm: function () { 430 $('div.validate-error').remove(); 431 if (!$('#fastSignupForm').valid()) { 432 return; 433 } 434 $('.order-fast-signup').removeClass('cart-block-error'); 435 }, 436 437 showPassword: function (element) { 438 if (element.hasClass('fa-eye-slash')) { 439 element.removeClass('fa-eye-slash').addClass('fa-eye'); 440 $('input[name="password"]').attr('type', 'text'); 441 } else { 442 element.removeClass('fa-eye').addClass('fa-eye-slash'); 443 $('input[name="password"]').attr('type', 'password'); 444 } 445 }, 446 447 eventListener: function () { 448 var self = this; 449 $(document).on('click', '[data-selector="fast-review-form-button"]', function (e) { 450 e.preventDefault(); 451 self.submitForm($(this)); 452 }); 453 $(document).on('click', '[data-selector="fast-review-accordion-header"]', function () { 454 self.accordion($(this)); 455 }); 456 $(document).on('click', '[data-selector="submit-signup-form"]', function (e) { 457 e.preventDefault(); 458 self.submitFastSignupForm($(this)); 459 }); 460 461 $('input[name="password"]').keyup(function () { 462 self.changeMemberPassword($(this)); 463 }); 464 465 $(document).on('change', '[name="memberAgreement"], [name="personalDataAgreement"]', function (e) { 466 e.preventDefault(); 467 self.checkFastSignupForm(); 468 }); 469 470 $(document).on('click', '.password-icon', function () { 471 self.showPassword($(this)); 472 }); 473 } 474 }, 475 476 /*Order Tracking Form*/ 477 orderTrackingForm: { 478 init: function () { 479 this.validateForm(); 480 this.eventListener(); 481 }, 482 483 getOrderId: function (element) { 484 return element.attr('data-id'); 485 }, 486 487 remakeOrder: function (element) { 488 if (element.attr('disabled')) { 489 return; 490 } 491 element.addClass('btn-loading').attr('disabled', true); 492 var options = { 493 url: IdeaApp.routing.generate('/hesabim/siparisi-tekrarla'), 494 data: "orderId=" + this.getOrderId(element), 495 success: function (response) { 496 if (response.success) { 497 window.location = response.data.url; 498 } else { 499 IdeaApp.plugins.notification(response.errorMessage, 'warning'); 500 } 501 element.removeClass('btn-loading').removeAttr('disabled'); 502 } 503 }; 504 IdeaApp.helpers.ajaxRequest(options); 505 }, 506 downloadDigitalProduct: function (element) { 507 if (element.attr('disabled')) { 508 return; 509 } 510 element.addClass('btn-loading').attr('disabled', true); 511 const orderId = element.attr('data-order-id'); 512 const productId = element.attr('data-product-id'); 513 const hashKey = element.attr('data-hash-key'); 514 const url = IdeaApp.routing.generate('/product/digital-product-download?order_id=' + orderId + '&product_id=' + productId + '&hash_key=' + hashKey); 515 const options = { 516 url: url, 517 type: 'get', 518 success: function (response) { 519 if (response.success === false) { 520 IdeaApp.plugins.notification(response.errorMessage, 'warning'); 521 } else { 522 window.location=url; 523 } 524 element.removeClass('btn-loading').removeAttr('disabled'); 525 } 526 } 527 IdeaApp.helpers.ajaxRequest(options); 528 }, 529 validateForm: function () { 530 $('[data-selector="order-tracking-form"]').validate({ 531 errorElement: "div", 532 validClass: 'validate', 533 errorClass: 'validate-error', 534 rules: { 535 refno: { 536 required: true 537 }, 538 email: { 539 required: true, 540 email: { 541 depends: function () { 542 $(this).val($.trim($(this).val())); 543 return true; 544 } 545 }, 546 maxlength: 60 547 } 548 }, 549 messages: { 550 refno: { 551 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="order-tracking-form"] input[name="refno"]') + " giriniz." 552 }, 553 email: { 554 required: "Lütfen " + IdeaApp.helpers.getFormValidateMessage('[data-selector="order-tracking-form"] input[name="email"]') + " giriniz.", 555 email: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="order-tracking-form"] input[name="email"]') + " uygun formatta olmalıdır.", 556 maxlength: "" + IdeaApp.helpers.getFormValidateMessage('[data-selector="order-tracking-form"] input[name="email"]') + " en fazla 60 karakter olmalıdır." 557 } 558 }, 559 }); 560 561 $.validator.addMethod('email', function (email) { 562 return IdeaApp.helpers.checkEmail(email); 563 }); 564 }, 565 566 submitForm: function (el) { 567 el.addClass('btn-loading').attr('disabled', true); 568 var orderTrackingForm = $('[data-selector="order-tracking-form"]'); 569 if (orderTrackingForm.valid()) { 570 IdeaApp.helpers.ajaxRequest({ 571 url: IdeaApp.routing.generate('/siparis-sorgu-gonder'), 572 data: orderTrackingForm.serialize(), 573 success: function (response) { 574 if (response.success) { 575 if (response.data.redirect) { 576 let pathname = response.data.redirect 577 window.location.href = window.location.pathname; 578 } 579 el.removeClass('btn-loading').removeAttr('disabled'); 580 $('[data-selector="order-details"]').html(response.data.order_content); 581 orderTrackingForm[0].reset(); 582 } else { 583 orderTrackingForm[0].reset(); 584 IdeaApp.plugins.notification(response.errorMessage, 'warning'); 585 } 586 } 587 }); 588 } 589 }, 590 591 eventListener: function () { 592 var self = this; 593 $(document).on('click', '[data-selector="order-tracking-form-submit-button"]', function () { 594 IdeaApp.helpers.ajaxRequest({ 595 url: IdeaApp.routing.generate('/recaptcha-visibility'), 596 success: function (response) { 597 if (response.success) {
598 if (response.data === 'invisible') { 599 self.submitForm($(this)); 600 } else { 601 if (grecaptcha.getResponse()) { 602 reCaptchaOrderTrackingSubmit(); 603 self.submitForm($(this)); 604 grecaptcha.reset(); 605 } else { 606 IdeaApp.plugins.notification(notificationMessages.complete_google_captcha, 'warning'); 607 $(this).removeClass('btn-loading'); 608 grecaptcha.reset(); 609 } 610 } 611 } else { 612 IdeaApp.plugins.notification(response.errorMessage, 'warning'); 613 IdeaApp.plugins.loadingBar.hide(); 614 } 615 } 616 }); 617 }); 618 $(document).on('click', '[data-selector="print-shipping"], [data-selector="print-order"]', function () { 619 self.print($(this)); 620 }); 621 $(document).on('click', '[data-selector="refund-and-cancel"]', function () { 622 var url = IdeaApp.routing.generate("/hesabim/iade-ve-iptal?orderId=" + $(this).attr("data-order")); 623 if ($(this).attr("data-member") && !isMember && $(this).attr("data-member-status") !== 'suspended') { 624 $('#memberInformation').modal('show'); 625 $('.corfim-modal').on('click', function () { 626 window.location.href = url; 627 }) 628 } else { 629 window.location.href = url; 630 } 631 }); 632 $(document).on('click', '[data-selector="remake-order"]', function () { 633 self.remakeOrder($(this)); 634 }); 635 $(document).on('click', '[data-selector="download-digital-product-file"]', function () { 636 self.downloadDigitalProduct($(this)); 637 }); 638 } 639 } 640 641 } 642 643}(jQuery, window)); 644 645function reCaptchaContactSubmit(token) { 646 $("#contact-form").append("<input name='recaptcha' type='hidden' value='" + token + "'>"); 647} 648 649function reCaptchaOrderTrackingSubmit(token) { 650 $("#order-tracking-form").append("<input name='recaptcha' type='hidden' value='" + token + "'>"); 651}
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.