1(function(document, $) { 2 3 // when dialog gets injected 4 $(document).on("foundation-contentloaded", function(e) { 5 // if there is already an inital value make sure the according target element becomes visible 6 showHide($(".cq-dialog-tab-formcontainer", e.target));//// .cq-dialog-formcontainer 7 }); 8 9 $(document).on("selected", ".cq-dialog-tab-formcontainer", function(e) { 10 showHide($(this)); 11 }); 12 13 $(document).on("change", ".cq-dialog-tab-formcontainer", function(e) { 14 showHide($(this)); 15 }); 16 17 function showHide(el){ 18 el.each(function(i, element) { 19 /* get the selector to find the target elements. its stored as data-.. attribute */ 20 var target = $(element).data("cqDialogTabShowhideTarget"); 21 if ($(element).data("select")) { 22 23 // get the selected value 24 var value = $(element).data("select").getValue(); 25 26 // make sure all unselected target elements are hidden. 27 $(target).not(".hide").addClass("hide"); 28 29 /* show the target element that contains the selected value as data-showhidetargetvalue attribute */ 30 if(value) 31 $(target+'.'+value).removeClass("hide"); 32 } 33 }) 34 } 35 36})(document,$); 37$(document).ready(function () { 38 39 var errorMessage; 40 const generalRegex = /[$&;%@ââ"\<>\(\)+\n\r\\'ââ]/g; 41 const emailDisallowedChars = /[$&;%ââ"<>()+\n\r\\'ââ]/g; 42 // Attach input and paste events to all text inputs in the form 43 $('.inquiry-form-medical input[type="text"], .inquiry-form-medical textarea, .contact-us-form input[type="text"]').on('input paste', function (event) { 44 var $input = $(this); 45 var originalValue = $input.val(); 46 if (event.type === 'paste') { 47 event.preventDefault(); // Prevent the default paste behavior 48 // Get the pasted data from the clipboard 49 var clipboardData = event.originalEvent.clipboardData.getData('text'); 50 // Clean the clipboard data based on the input type (email or general text) 51 var cleanedData = (event.target.id === 'emailAddress') 52 ? clipboardData.replace(emailDisallowedChars, '') // Clean unwanted email chars 53 : clipboardData.replace(generalRegex, ''); // Clean unwanted general chars 54 $input.val(cleanedData); 55 } else { 56 var newValue = (event.target.id === 'emailAddress') 57 ? originalValue.replace(/[^a-zA-Z0-9._@-]/g, '') // Filter out invalid email chars 58 : originalValue.replace(generalRegex, ''); // Filter out unwanted general chars 59 if (originalValue !== newValue) { 60 $input.val(newValue); 61 } 62 } 63 }); 64 65 function formChangeEventListener(selector) { 66 let $form = $(selector); 67 $.each($form.find('input,textarea,select'), function (index, input) { 68 var $input = $(input); 69 $input.on('change keyup', function (event) { 70 var $this = $(this); 71 $form.find("button").attr("disabled", false); 72 removeError({ 73 "field": $this, 74 "class": ".required" 75 }); 76 removeError({ 77 "field": $this, 78 "class": ".pattern" 79 }); 80 }) 81 }); 82 } 83 function submitEventListener(selector) { 84 let $form = $(selector); 85 let isRequiredValidation = requiredValidation($form); 86 let isPatternValidation = patternValidation($form); 87 let isValidCaptcha = validateCaptcha(); 88 let finalFormvalidationState = false; 89 90 removeFormLevelError({ 91 "form": $form, 92 "class": ".form-error" 93 }); 94 console.log($('.form-error:visible').length, $('.error-text:visible').length) 95 if ($('.formcontainer .form-error:visible').length == 0 && $('.formcontainer .error-text:visible').length == 0 && isValidCaptcha) { 96 //if(isRequiredValidation && isPatternValidation && isValidCaptcha){ 97 98 finalFormvalidationState = true; 99 } 100 else { 101 displayFormLevelError({ 102 "form": $form, 103 "class": ".form-error" 104 }); 105 } 106 /** 107 * this code is for analatics purpose 108 */ 109 if (window._satellite && window.dataPageProperties) { 110 if (finalFormvalidationState) { 111 console.log("calling _formSuccess"); 112 113 } 114 else { 115 console.log("calling _formError"); 116 _satellite.track('MedicalForm Error'); 117 } 118 } 119 120 if (finalFormvalidationState) { 121 $form.append('<div class="form-loading"><div class="search-loader-block_img"></div></div>'); 122 123 124 if ($form.hasClass('inquiry-form-medical')) { 125 if (window.GigyaSiteConfigJson && $.cookie('apex__gigyaSession')) { 126 gigya.accounts.getAccountInfo({ 127 callback: function (account) { 128 requestPostMethod($form, account.data.hcp_id ? account.data.hcp_id : ""); 129 } 130 }); 131 } else { 132 requestPostMethod($form, ""); 133 } 134 } 135 else if ($form.hasClass('contact-us-form')) { 136 let captchResp = ''; 137 if ($('.g-recaptcha').length > 0) { 138 if (window.widgetId) { 139 captchResp = grecaptcha.getResponse(window.widgetId); 140 } 141 else { 142 captchResp = grecaptcha.getResponse(); 143 } 144 } 145 146 var selectedValue = $('.occupation-dropdown select').val(); 147 var medicalsublist = $('.medicalsub-list'); 148 var medicalSubject = ""; 149 if (medicalsublist && medicalsublist.length > 0) { 150 medicalsublist.each(function (i, list) { 151 if ($(list).attr('data-profession') === selectedValue) { 152 medicalSubject = $(list).find('select'); 153 } 154 }); 155 } 156 var data = { 157 'firstName': getValueAndLabel('#firstName'), 158 'firstNameLabel': getLabelText('#firstName'), 159 'lastName': getValueAndLabel('#lastName'), 160 'lastNameLabel': getLabelText('#lastName'), 161 'surName': getValueAndLabel('#surname'), 162 'surNameLabel': getLabelText('#surname'), 163 'may': getValueAndLabel('#may'), 164 'mayLabel': getLabelText('#may'), 165 'placeOfWork': getValueAndLabel('#institutionName'), 166 'placeOfWorkLabel': getLabelText('#institutionName'), 167 'emailAddress': getValueAndLabel('#emailAddress'), 168 'emailAddressLabel': getLabelText('#emailAddress'), 169 'telephone': getValueAndLabel('#telephone'), 170 'phoneNumberLabel': getLabelText('#telephone'), 171 'occupation': getValueAndLabel('#occupation'), 172 'occupationLabel': getLabelText('#occupation'), 173 'medicalSubject': getValueAndLabel('#medicalSubject'), 174 'medicalSubjectLabel': getLabelText('#medicalSubject'), 175 'others': getValueAndLabel('#others'), 176 'othersLabel': getLabelText('#others'), 177 'preferredTime': getValueAndLabel('#preferredTime'), 178 'preferredTimeLabel': getLabelText('#preferredTime'), 179 'question': getValueAndLabel('#question'), 180 'messageLabel': getLabelText('#question'), 181 'CaptchaResponse': captchResp || '', 182 'userContactPreference': $('.contact-us-form input[type="checkbox"][name="userContactPreference"]:checked').val() || '', 183 'preferenceLabel': getLabelText('input[type="checkbox"][name="userContactPreference"]'), 184 'secretKey': getValueAndLabel('#secretKey'), 185 'country': $('.contact-us-form').attr('data-country') || '' 186 }; 187 function getValueAndLabel(selector) { 188 var element = $(selector); 189 return element.length ? element.val() || '' : ''; // Return value or empty string if not found 190 } 191 192 function getLabelText(selector) { 193 var element = $(selector); 194 return element.length ? element.parent().find('label').text().trim().replace(/\*/g, '') || '' : ''; // Return label text or empty 195 } 196 197 $.ajax({ 198 type: 'POST', 199 url: $('.contact-us-form').find('.apiUrl').data('api-url'), 200 dataType: 'json', 201 contentType: 'application/json', 202 data: JSON.stringify(data), 203 success: function (response) { 204 console.log('success'); 205 if (response.status == 200) { 206 if (window._satellite) { 207 _satellite.track('Form Success'); 208 } 209 window.location = $('.search-selectorcontact__input.contact-us-form').data('thankyou-page'); 210 } 211 else { 212 if (window._satellite) { 213 _satellite.track('ContactForm Error'); 214 } 215 $('.form-loading').remove(); 216 $('.enquiry__error-modal a').trigger('click'); 217 if ($('.g-recaptcha').length) { 218 grecaptcha.reset(); 219 $('.g-recaptcha').show(); 220 } 221 } 222 }, 223 error: function () { 224 if (window._satellite && window.dataPageProperties) { 225 _satellite.track('ContactForm Error'); 226 } 227 $('.form-loading').remove(); 228 $('.enquiry__error-modal a').trigger('click'); 229 } 230 }); 231 232 } 233 } 234 else { 235 $form.parent().find('.form-loading').remove(); 236 } 237 238 return false;
239 } 240 241 function requestPostMethod($form, accountId) { 242 243 let dateObject, 244 dueDate = $form.find('#dueDate').val(); 245 if ($form.find('#dueDate').data('duedate-format') == "dd/mm/yyyy") { 246 var dateParts = dueDate.split("/"); 247 dateObject = new Date(+dateParts[2], dateParts[1] - 1, +dateParts[0]); 248 } 249 else { 250 dateObject = new Date(dueDate); 251 } 252 253 let captchResp = ''; 254 if ($('.formcontainer .g-recaptcha').length > 0) { 255 if (window.widgetId) { 256 captchResp = grecaptcha.getResponse(window.widgetId); 257 } 258 else { 259 captchResp = grecaptcha.getResponse(); 260 } 261 } 262 let inputPayload = { 263 "AccountID": accountId || "", //will send it blank 264 "Salutation": $form.find('#salutation option:selected').val() || '', //salutation field from Form 265 "FirstName": $form.find('#firstName').val() || '',//first name field from Form 266 "LastName": $form.find('#lastName').val() || '', //last name field from Form 267 "Credentials": "", // will send it blank 268 "RequestorType": $form.find('#describesyou option:selected').val() || '', //Select the option that best describes you field from Form 269 "InstitutionName": $form.find('#institutionName').val() || '', //Institution Name field from Form 270 "AddressLine1": $form.find('.block-show #address-1').val() || '', 271 "AddressLine2": $form.find('.block-show #address-2').val() || '', 272 "City": $form.find('.block-show #city').val() || '', 273 "State": $form.find('.block-show #state').val() || '', 274 "PostalCode": $form.find('.block-show #zipCode').val() || '', 275 "Email": $form.find('#emailAddress').val() || '', 276 "PhoneNumber": $form.find('#telephone').val() || '', 277 "FaxNumber": $form.find('#faxNumber').val() || '', 278 "FederationID": "", // will send it blank 279 "ReferrerCredentials": "", // will send it blank 280 "ReferrerFirstName": "", // will send it blank 281 "ReferrerLastName": "", // will send it blank 282 "ReferrerCompany": "", // will send it blank 283 "ReferrerType": "", // will send it blank 284 "ReferrerPhone": "", // will send it blank 285 "ReferrerEmail": "", // will send it blank 286 "DeliveryMethod": $("input[type='radio'][name='radio-mio-questions']:checked").val() || '', 287 "DeliveryNotes": $form.find('#deliveryNotes').val() || '', // will send it blank 288 "DueDate": $form.find('#dueDate').val() ? dateObject.toISOString() : '', 289 "DueDateReason": $form.find('#duedatereason').val() || '', 290 "PatientOnBMS": $("input[type='radio'][name='radio-mio-product']:checked").val() || '', 291 "Product": $form.find('#product').val() || '', 292 "InquiryText": $form.find('#question').val() || '', 293 "Signature": "", // will send it blank 294 "AEPregnancy": "", // It can be empty field as well 295 "CaptchaResponse": captchResp, //Captcha Field from Form 296 "secretKey": $form.find('#secretKey').val() || ''// if secret key is present then that particular value will be sent else it will be blank 297 }; 298 console.log(inputPayload) 299 $.ajax({ 300 type: 'POST', 301 url: $('.inquiry-form-medical').find('.apiUrl').data('api-url'), 302 dataType: 'json', 303 contentType: 'application/json', 304 data: JSON.stringify(inputPayload), 305 success: function (response) { 306 console.log('success'); 307 if (response.status == 200) { 308 if (window._satellite) { 309 _satellite.track('Form Success'); 310 } 311 let inquiry_id= response.message; 312 window.location = $('.search-selectorcontact__input.inquiry-form-medical').data('thankyou-page') + '?inquiry_id=' + inquiry_id; 313 } 314 else { 315 if (window._satellite) { 316 _satellite.track('InquiryForm Error'); 317 } 318 $('.form-loading').remove(); 319 $('.enquiry__error-modal a').trigger('click'); 320 if ($('.formcontainer .g-recaptcha').length) { 321 grecaptcha.reset(); 322 $('.formcontainer .g-recaptcha').show(); 323 } 324 } 325 }, 326 error: function () { 327 if (window._satellite && window.dataPageProperties) { 328 _satellite.track('InquiryForm Error'); 329 } 330 $('.form-loading').remove(); 331 $('.enquiry__error-modal a').trigger('click'); 332 } 333 }); 334 335 } 336 337 /** 338 * Validation of required fields in form 339 */ 340 341 function requiredValidation($form) { 342 var errorFlag = false;
343 var inputSelector = 'input[required]:visible,textarea[required]:visible,select[required]:visible'; 344 345 346 $.each($form.find(inputSelector), function (index, input) { 347 var $input = $(input); 348 349 /** 350 * if the field value is empty displaing error 351 */ 352 if (!$input.parent().closest('.search-selectorcontact__input').hasClass('.block-hide')) { 353 if (!$input.val()) { 354 errorFlag = true; 355 displayError({ 356 "field": $input, 357 "class": ".required" 358 }); 359 } else { 360 removeError({ 361 "field": $input, 362 "class": ".required" 363 }); 364 } 365 } 366 }) 367 368 var names = $form.find('input[type=checkbox][required]:visible, input[type=radio][required]:visible').map(function () { 369 return $(this).prop('name'); 370 }); 371 372 // Removing duplicate names 373 names = _.uniq(names).filter(function (name) { 374 return typeof name === 'string'; 375 }); 376 377 var errorFlag = false; // Ensure errorFlag is initialized 378 _.each(names, function (name) { 379 var $fields = $form.find('input[type=checkbox][name="' + name + '"]:checked, input[type=radio][name="' + name + '"]:checked'); 380 381 // Check if the checked field is found and display errors accordingly 382 if (!$fields.length) { 383 errorFlag = true; 384 displayError({ 385 "field": $($form.find('input[type=checkbox][name="' + name + '"], input[type=radio][name="' + name + '"]').first()), 386 "class": ".required" 387 }); 388 } else { 389 removeError({ 390 "field": $($form.find('input[type=checkbox][name="' + name + '"], input[type=radio][name="' + name + '"]').first()), 391 "class": ".required" 392 }); 393 } 394 }); 395 396 return errorFlag; 397 398 } 399 400 function displayError(args, $form) { 401 402 args.field.addClass('form-error'); 403 if (args.validationerror == "true") { 404 errorMessage = $(args.field).data('validation-errormessage'); 405 } 406 else { 407 errorMessage = $(args.field).data('required-errormessage'); 408 } 409 args.field.closest('.search-selectorcontact__input__row__label-text').find('.search-selectorcontact__input__row__error-text.error-text').html(errorMessage); 410 args.field.closest('.search-selectorcontact__input__row__label-text').find('.search-selectorcontact__input__row__error-text.error-text').show(); 411 // if(args.field.parents('.type-ahead-select-container')){ 412 // args.field.siblings('.select2 ').addClass('form-error'); 413 // } 414 if (args.field.is("select")) { 415 args.field.parent().find('.search-selectorcontact__input__row__error-text.error-text').html(errorMessage).show(); 416 // args.field.parent().parent().find(args.class).show(); 417 } else if (args.field.is("select")) { 418 //args.field.parent().parent().children('label').children(args.class).show(); 419 } else if (args.field.prop('type') == "checkbox") { 420 args.field.parent().parent().siblings(args.class).show(); 421 } else if (args.field.prop('type') == "radio") { 422 args.field.parent().parent().find('.search-selectorcontact__input__row__error-text.error-text').show(); 423 } else { 424 //args.field.siblings("label").children(args.class).show(); 425 args.field.parent().find('.search-selectorcontact__input__row__error-text.error-text').show(); 426 } 427 } 428 429 function removeError(args, $form) { 430 if (!args.dontRemoveBorder) { 431 args.field.removeClass('form-error'); 432 args.field.parent().find('.search-selectorcontact__input__row__error-text.error-text').hide(); 433 // if(args.field.parents('.type-ahead-select-container')){ 434 // args.field.siblings('.select2 ').removeClass('form-error'); 435 // } 436 } 437 if (args.field.is("select")) { 438 args.field.parent().parent().find(args.class).hide(); 439 } else if (args.field.is("select")) { 440 args.field.parent().parent().children('label').children(args.class).hide(); 441 } else if (args.field.prop('type') == "checkbox") { 442 args.field.parent().parent().siblings(args.class).hide(); 443 } else if (args.field.prop('type') == "radio") { 444 args.field.parent().parent().find('.search-selectorcontact__input__row__error-text.error-text').hide(); 445 446 } else { 447 // args.field.siblings("label").children(args.class).hide(); 448 //$('.search-selectorcontact__input__row__error-text.error-text').hide(); 449 args.field.parent().find('.search-selectorcontact__input__row__error-text.error-text').hide(); 450 } 451 } 452 453 /** 454 * validating google reCaptcha 455 */ 456 function validateCaptcha() { 457 if ($('.formcontainer .g-recaptcha').length > 0) { 458 if (!grecaptcha) return false;
459 let captchaResponse; 460 /** 461 * if reCaptcha is created dynamically then in global.widgetId reCaptcha reference will be set. 462 */ 463 if (window.widgetId) 464 captchaResponse = grecaptcha.getResponse(window.widgetId); 465 else 466 captchaResponse = grecaptcha.getResponse(); 467 468 if (captchaResponse.length == 0) { 469 $('.formcontainer .g-recaptcha').css("border", "2px solid #BE2BBB"); 470 $('.formcontainer .g-recaptcha').addClass("form-error"); 471 return false; 472 } else { 473 $('.formcontainer .g-recaptcha').addClass("form-error"); 474 $('.formcontainer .g-recaptcha').css("border", "0px"); 475 return true; 476 } 477 } else { 478 return true; 479 } 480 } 481 function displayFormLevelError(args) { 482 if (args.form.find('.error-text:visible:first').length) { 483 var top = args.form.find('.error-text:visible:first').closest('.search-selectorcontact__input.row').offset().top - 95; 484 $('html, body').animate({ 485 scrollTop: top 486 }, 600); 487 args.form.find(args.class).show(); 488 } else if ($('.form-error').hasClass('g-recaptcha')) { 489 var top = args.form.find('.g-recaptcha').closest('.search-selectorcontact__input.row').offset().top - 95; 490 $('html, body').animate({ 491 scrollTop: top 492 }, 600); 493 args.form.find(args.class).show(); 494 } 495 if ($(args.form).hasClass('contact-us-form') || $(args.form).hasClass('inquiry-form-medical')) { 496 $(args.form.find(args.class)).closest('.search-selectorcontact__input__row').addClass('input-error'); 497 } 498 499 } 500 function removeFormLevelError(args) { 501 args.form.find(args.class).hide(); 502 503 } 504 function patternValidation($form) { 505 var errorFlag = true; 506 507 $.each($form.find('input[pattern],textarea[pattern]'), function (index, input) { 508 var $input = $(input); 509 if ($input.is(":visible") && $input.val()) { 510 try { 511 var pattern = new RegExp($input.attr('pattern')); 512 /** 513 * if the pattern is wrong displaing error 514 */ 515 if (pattern.test($input.val())) { 516 removeError({ 517 "field": $input, 518 "class": ".pattern" 519 }); 520 521 } else { 522 errorFlag = false; 523 displayError({ 524 "field": $input, 525 "class": ".pattern", 526 "validationerror": "true" 527 }); 528 } 529 } 530 catch (e) { 531 /** 532 * if the given pattern is wrong. 533 */ 534 console.error("in vaild pattren (Regular Expression )", $input.attr('pattern')); 535 console.error(e); 536 } 537 538 539 } 540 }) 541 return errorFlag; 542 } 543 544 function resetForm($form) { 545 // Clear input values 546 $.each($form.find('input:visible, textarea:visible, select:visible'), function (index, input) { 547 var $input = $(input); 548 // Reset input value 549 if ($input.is('input[type="text"], textarea')) { 550 $input.val(''); // Clear the value 551 } // Clear the value for input and textarea 552 $input.prop('selectedIndex', 0); // Reset select dropdowns to the first option (adjust as needed) 553 554 // Remove error messages 555 removeError({ 556 "field": $input, 557 "class": ".required" 558 }); 559 removeError({ 560 "field": $input, 561 "class": ".pattern" 562 }); 563 }); 564 565 // Remove form-level error messages 566 removeFormLevelError({ 567 "form": $form, 568 "class": ".form-level-msg" 569 }); 570 }
571 function init() { 572 $(document).on('click', '.inquiry-form-medical .submit-btn,.contact-us-form .submit-btn', function (event) { 573 //$(event.currentTarget).prop("disabled",true); 574 575 if (!submitEventListener($(event.currentTarget).parents('form'))) { 576 event.preventDefault(); 577 } 578 formChangeEventListener($(event.currentTarget).parents('form')); 579 }); 580 581 $('.search-selectorcontact__input__row__form-control.searchRadiobutton input[name="userContactPreference"][required]').change(function (event) { 582 let errorElem = $(this).parent().parent().children('.error-text'); 583 if (event.target.checked && errorElem) { 584 errorElem.hide(); 585 } else { 586 errorElem.show(); 587 } 588 }); 589 } 590 591 //Onclicking of Backbutton resetting the contact form 592 $(window).on('pageshow', function (event) { 593 var $contactForm = $('.contact-us-form'); 594 if (event.originalEvent.persisted || (window.performance && window.performance.navigation.type === 2)) { 595 if ($contactForm.length) { 596 $('.form-loading').remove(); 597 resetForm($contactForm); 598 } 599 } 600 601 }); 602 var $contactForm = $('.contact-us-form'); 603 if ($contactForm.length) { 604 resetForm($contactForm); 605 } 606 607 var originalLabelText = $('.contact-us-form label[for="telephone"]').text().trim(); 608 609 $('.contact-us-form .flex-mobile input').change(function() { 610 var $input = $(".contact-us-form #telephone"); 611 var $label = $('.contact-us-form label[for="telephone"]'); 612 613 if ($(this).is(':checked')) { 614 $label.html('<span id="telephoneMandatorySymbol">*</span>' + originalLabelText); 615 $input.attr('required', 'required'); 616 } else { 617 $label.html(originalLabelText); // Revert to the original text 618 $input.removeAttr('required'); 619 } 620 }); 621 622 init(); 623 624 /* Start Modal Popup*/ 625 626 $(document).on('click', '#enquiry_error.open-modal', function (e) { 627 var currentTarget = $(e.currentTarget).prop("tagName"); 628 var etarget = $(e.target).prop("tagName"); 629 630 /** 631 * getting data set form clicked element 632 */ 633 var target = e.currentTarget.dataset.target || null, 634 url = e.currentTarget.dataset.url || null, 635 id = e.currentTarget.dataset.id || null, 636 authorUrl = e.currentTarget.dataset.authorurl || '', 637 className = e.currentTarget.dataset.classname || '', 638 targetPage = $(this).attr('target') || '_blank', 639 ariaLabel = $(this).attr('aria-label') || null, 640 modalHeader = e.currentTarget.dataset.modalheader || null, 641 title = $(this).attr('title') || null, 642 bgColor = e.currentTarget.dataset.bgColor || ''; 643 644 /** 645 * for twitter component stoping the modal form opening 2 times when clicked on anchor 646 */ 647 648 649 e.preventDefault(); 650 $(document).trigger('modal:open'); 651 if (target) { 652 var template = `<div id="${target}" class="modal bms-medical fade ${className}" tabindex="-1" role="dialog" aria-labelledby="${ariaLabel}" aria-hidden="true"> 653 <div class="modal-dialog" style="background-color: ${bgColor};">`; 654 if (className.indexOf("disable-close") == -1) { 655 template += `<div class="overlay-bar"> 656 <div class="modal-header"></div> 657 <button class="close" type="button" data-bs-dismiss='modal' aria-label='Close'> 658 <i class="icon icon-close"> 659 <?xml version="1.0" encoding="UTF-8"?> 660 <svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 661 <title></title> 662 <g id="375-px" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 663 <g id="02_BMS_medical_landing_Hamburger_exp
663anded_mobile_375" transform="translate(-319.000000, -76.000000)"> 664 <g id="Group" transform="translate(319.000000, 76.000000)"> 665 <g id="Group-19" fill="#D8D8D8" fill-opacity="0"> 666 <rect id="Rectangle" x="0" y="0" width="32" height="32"></rect> 667 </g> 668 <g id="Group" transform="translate(8.000000, 8.000000)"> 669 <rect id="Rectangle" x="0" y="0" width="16" height="16"></rect> 670 <path d="M15.7396505,0.260349528 C16.0482129,0.568911931 16.0824976,1.04788864 15.8425046,1.39432089 L15.7396505,1.51742825 L9.257,8 L15.7396505,14.4825718 C16.0867832,14.8297045 16.0867832,15.3925178 15.7396505,15.7396505 C15.4310881,16.0482129 14.9521114,16.0824976 14.6056791,15.8425046 L14.4825718,15.7396505 L8,9.257 L1.51742825,15.7396505 C1.17029555,16.0867832 0.607482232,16.0867832 0.260349528,15.7396505 C-0.0482128755,15.4310881 -0.082497587,14.9521114 0.157495393,14.6056791 L0.260349528,14.4825718 L6.743,8 L0.260349528,1.51742825 C-0.0867831759,1.17029555 -0.0867831759,0.607482232 0.260349528,0.260349528 C0.568911931,-0.0482128755 1.04788864,-0.082497587 1.39432089,0.157495393 L1.51742825,0.260349528 L8,6.743 L14.4825718,0.260349528 C14.8297045,-0.0867831759 15.3925178,-0.0867831759 15.7396505,0.260349528 Z" id="Combined-Shape" fill="#595454"></path> 671 </g> 672 </g> 673 </g> 674 </g> 675 </svg> 676 </i> 677 </button> 678 </div>`; 679 } 680 template += `<div class="modal-content"></div> 681 </div> 682 </div>`; 683 target = '#' + target; 684 685 if ($('.modal').length > 0) { 686 $(document).trigger('modal:closed'); 687 document.querySelectorAll('.modal').forEach(function(el) { 688 var modal = bootstrap.Modal.getInstance(el) || new bootstrap.Modal(el); 689 modal.hide(); 690 }); 691 692 } 693 /** 694 * empty modal is opened and modal content is filled by respective component js file 695 */ 696 697 $('body').append(template); 698 699 700 if (className == 'enquiry-modal') { 701 let enquiry_modal_text = $('.enquiry-error-modal .rte').html(); 702 $(target + ' .modal-dialog').find('.modal-content').append(enquiry_modal_text); 703 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 704 $('body').addClass('ios'); 705 $('html').addClass('ios'); 706 } 707 (bootstrap.Modal.getInstance(document.querySelector(target)) || new bootstrap.Modal(document.querySelector(target))).show(); 708 709 $(document).trigger('modal:opened', [e]); 710 } 711 712 713 714 //disabling close on esc key press and outside of modal click 715 if (className.indexOf("disable-close") != -1) { 716 // $(target).modal({ 717 // backdrop: 'static', 718 // keyboard: false 719 // }); 720 721 (bootstrap.Modal.getInstance(document.querySelector(target)) || new bootstrap.Modal(document.querySelector(target), { 722 backdrop: 'static', 723 keyboard: false 724 })).show(); 725 726 } 727 728 729 $(target).on('hidden.bs.modal', function () { 730 /** 731 * removing the modal divsion form page when model is closed 732 */ 733 $(target).next().not("#chat-bot").not("#onetrust-consent-sdk").remove(); 734 $(target).remove(); 735 736 if ($('.modal').length == 0) { 737 $('body').removeClass('ios'); 738 $('html').removeClass('ios'); 739 } 740 else { 741 /** 742 * fixing the modal close bug when more than one modal is opened 743 */ 744 $('body').removeClass('modal-open'); 745 } 746 747 /** 748 * trigger custom event to notify other componet that modal as been closed if they are listing 749 */ 750 $(document).trigger('modal:closed'); 751 }); 752 753 } else { 754 console.log('Please specify an id.'); 755 } 756 }); 757 758 /*End Start Modal Popup */ 759 760 function switchRadioButtons() { 761 $(document).on('click', '.inquiry-form-medical .radio-mio-enquiry-button input[type="radio"]', function () { 762 $(this).parent().parent().find('.radio-btn').removeClass('button-active'); 763 $(this).next('.radio-btn').addClass('button-active'); 764 }); 765 $(document).on('click', '.inquiry-form-medical .radio-mio-button input[type="radio"]', function () { 766 $(this).parent().parent().find('.radio-btn').removeClass('button-active'); 767 $(this).next('.radio-btn').addClass('button-active'); 768 var radioId = $(this).attr("id"); 769 $('.inquiry-form-medical .search-selectorcontact__default-block').removeClass('block-show'); 770 $('.inquiry-form-medical .search-selectorcontact__custom-block').removeClass('block-hide'); 771 $('.inquiry-form-medical .search-selectorcontact__default-block').addClass('block-hide'); 772 $('.inquiry-form-medical .search-selectorcontact__custom-block').addClass('block-show'); 773 /*if (radioId.toLowerCase() == "email" || radioId.toLowerCase() == "telephone" || radioId.toLowerCase() == "fax") { 774 $('.del-mail').hide(); 775 $('#FaxNumber').removeAttr('required'); 776 } 777 else if (radioId.toLowerCase() == "mail") { 778 $('.del-mail').show(); 779 780 } 781 if (radioId.toLowerCase() == "fax") { 782 $('#faxNumber').attr('required', true); 783 $('#faxNumber').prev('label').text('*' + $('#faxNumber').prev('label').text()); 784 } else { 785 $('#faxNumber').removeAttr('required'); 786 $('#faxNumber').prev('label').text($('#faxNumber').prev('label').text().replace('*', '')); 787 }*/ 788 789 }); 790 } 791 792 function triggerDatePicker() { 793 var dateFormat = $('.inquiry-form-medical .enquiry__datepicker').data('duedate-format') != "" ? $('.inquiry-form-medical .enquiry__datepicker').data('duedate-format') : "mm/dd/yyyy"; 794 $('.inquiry-form-medical .enquiry__datepicker').datepicker({ "format": dateFormat, "container": ".datepicker_wrapper", "autoclose": "true", "startDate": "true", "todayHighlight": "true", "orientation": "auto right" }).on('changeDate', dateChanged); 795 796 } 797 function dateChanged(ev) { 798 $('.inquiry-form-medical #duedatereason').attr('required', 'required'); 799 } 800 801
802 var $contactForm = $('.contact-us-form'); 803 if ($contactForm.length) { 804 resetForm($contactForm); 805 } 806 var $inquiryForm = $('.inquiry-form-medical'); 807 if ($inquiryForm.length) { 808 resetForm($inquiryForm); 809 } 810 $(document).on('click', '.inquiry-form-medical .select2', function (e) { 811 812 // if (!$(e.target).hasClass('select2')) 813 // return; 814 console.log(e, "printing e") 815 if ($(e.currentTarget).hasClass('select2-container--open')) { 816 $(e.currentTarget).parents('.dropdown-link').find('select').select2("close"); 817 } 818 else { 819 $(e.currentTarget).parents('.dropdown-link').find('select').select2("open"); 820 } 821 822 }); 823 // $('.mio-select').select2(); 824 if ($.fn.select2 !== undefined){ 825 $('.inquiry-form-medical .mio-select').select2({ 826 minimumResultsForSearch: Infinity, 827 dropdownAutoWidth: 'true', 828 width: 'auto' 829 }); 830 } 831 // init(); 832 switchRadioButtons(); 833 triggerDatePicker(); 834 835 836 function toggleMedinfoFormInputs() { 837 var selectedRadio = $('.medinfo-form .radio-mio-button input[type="radio"]:checked').val(); 838 839 $('.medinfo-form label').each(function() { 840 var label = $(this); 841 var mandatoryToggleValues = label.attr('data-radio-mandatory-toggle'); 842 if (mandatoryToggleValues) { 843 var mandatoryArray = mandatoryToggleValues.split(',').map(function(val) { 844 return val.trim(); 845 }); 846 if (mandatoryArray.includes(selectedRadio)) { 847 var textInput = label.siblings('input[type="text"]'); 848 if (!textInput.attr('required')) { 849 textInput.attr('required', true); 850 } 851 if (!label.text().includes('*')) { 852 label.prepend('*'); 853 } 854 } else { 855 var textInput = label.siblings('input[type="text"]'); 856 if (textInput.attr('required') ) { 857 textInput.removeAttr('required'); 858 } 859 if (label.text().includes('*')) { 860 label.text(label.text().replace('*', '').trim()); 861 } 862 } 863 } 864 }); 865 $('.medinfo-form input[type="text"]').each(function() { 866 var input = $(this); 867 var textfeild = input.parents(".search-selectorcontact__input__row.col-md-6.col-sm-12.col-xs-12"); 868 var hideValues = input.attr('data-hide-radio-selected'); 869 if (hideValues) { 870 var hideArray = hideValues.split(',').map(function(val) { 871 return val.trim(); 872 }); 873 if(hideArray.includes(selectedRadio)) { 874 textfeild.removeClass("d-none"); 875 if (textfeild.is(':first-child')) { 876 textfeild.next().css({"padding-left":"20px","padding-right":"0px"}); 877 } 878 } else { 879 textfeild.addClass("d-none"); 880 if (textfeild.is(':first-child')) { 881 textfeild.next().css({"padding-left":"0px","padding-right":"20px"}); 882 } 883 } 884 } 885 }); 886 } 887 888 $('.medinfo-form .radio-mio-button input[type="radio"]').on('change', function() { 889 toggleMedinfoFormInputs(); 890 }); 891 892 toggleMedinfoFormInputs(); 893 894 if($('.inquiry-form-medical').length > 0) { 895 if (window.GigyaSiteConfigJson && $.cookie('apex__gigyaSession')) { 896 gigya.accounts.getAccountInfo({ 897 extraProfileFields: 'address', 898 callback: function (account) { 899 if (account) { 900 if (account.profile?.firstName !== "Unknown") { 901 $('.inquiry-form-medical #firstName').val(account.profile?.firstName); 902 } 903 if (account.profile?.lastName !== "Unknown") { 904 $('.inquiry-form-medical #lastName').val(account.profile?.lastName); 905 } 906 if (account.profile?.email !== "Unknown") { 907 $('.inquiry-form-medical #emailAddress').val(account.profile?.email); 908 } 909 if (account.profile?.city !== "Unknown") { 910 $('.inquiry-form-medical #city').val(account.profile?.city); 911 } 912 if (account.profile?.zip !== "Unknown") { 913 $('.inquiry-form-medical #zipCode').val(account.profile?.zip); 914 } 915 if (account.profile?.address !== "Unknown") { 916 $('.inquiry-form-medical #address-1').val(account.profile?.address); 917 } 918 if (account.data?.address_line_2 !== "Unknown") { 919 $('.inquiry-form-medical #address-2').val(account.data?.address_line_2); 920 } 921 } 922 } 923 }); 924 } 925 } 926 $('.medinfo-form input[type="text"][data-hide-radio-selected]').each(function() { 927 $(this).closest('.search-selectorcontact__input__row').addClass('d-none'); 928 }); 929 930 });
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.