1(function ($, Drupal) { 2 Drupal.behaviors.customSearchFilter = { 3 attach: function (context, settings) { 4 5 // Attach behavior to the button inside the webform 6 const button = document.querySelector('.claim-webform-submit-data'); 7 8 if (button) { 9 button.addEventListener('click', function (event) { 10 event.preventDefault(); // Prevent default button behavior 11 12 // Dynamically create and inject the modal HTML 13 const modal = document.createElement('div'); 14 modal.className = 'modal claim-popup consent modal-preview modal d-block'; 15 modal.id = 'consent'; 16 modal.innerHTML = ` 17 <div class="modal-dialog modal-dialog-centered"> 18 <div class="modal-content"> 19 <div class="modal-header pb-1"> 20 21 </div> 22 <div class="modal-body pt-2 pb-3"> 23 <div class="claim-popup-consent"> 24 I give consent to DICGC to store my personal information provided in the form for the purpose of claim processing. 25 </div> 26 </div> 27 <div class="modal-footer justify-content-center pb-5"> 28 <button data-drupal-selector="edit-custom-submit" type="submit" id="edit-custom-submit" name="op" value="Yes" class="button js-form-submit form-submit print d-block">Yes</button> 29 <button type="button" class="submit-preview" id="consent_no" data-bs-dismiss="modal">No</button> 30 </div> 31 </div> 32 </div> 33 `; 34 document.body.appendChild(modal); 35 36 // Handle "Yes" button click 37 const yesButton = modal.querySelector('#edit-custom-submit'); 38 yesButton.addEventListener('click', function () { 39 const divWithSubmitInput = button.closest('div.testmodal44'); 40 if (divWithSubmitInput) { 41 const submitInput = divWithSubmitInput.querySelector('input[type="submit"]#edit-actions-submit'); 42 if (submitInput) { 43 submitInput.click(); // Trigger the submit button 44 } else { 45 //alert('Submit input not found in the div!'); 46 } 47 } else { 48 //alert('Div with a submit input not found!'); 49 } 50 modal.remove(); // Remove the modal 51 }); 52 53 // Handle "No" button click 54 const noButton = modal.querySelector('.submit-preview'); 55 noButton.addEventListener('click', function () { 56 //alert('You chose not to proceed.'); 57 modal.remove(); // Remove the modal 58 }); 59 }); 60 } 61 62 } 63 }; 64})(jQuery, Drupal); 65 66 67function goNo() { 68 jQuery('#consent_no').trigger('click'); 69 // console.log('trst'); 70 }
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.