gutenberg
2 years ago
admin.js
3 years ago
admin.min.js
3 years ago
deactivation-feedback.js
3 years ago
deactivation-feedback.min.js
3 years ago
editor.js
7 years ago
editor.min.js
5 years ago
evf-admin-email.js
2 years ago
evf-admin-email.min.js
2 years ago
evf-clipboard.js
7 years ago
evf-clipboard.min.js
7 years ago
evf-enhanced-select.js
3 years ago
evf-enhanced-select.min.js
3 years ago
evf-file-uploader.js
3 years ago
evf-file-uploader.min.js
3 years ago
evf-setup.js
2 years ago
evf-setup.min.js
2 years ago
extensions.js
2 years ago
extensions.min.js
2 years ago
form-builder.js
2 years ago
form-builder.min.js
2 years ago
form-template-controller.js
3 years ago
form-template-controller.min.js
3 years ago
settings.js
3 years ago
settings.min.js
3 years ago
tools.js
4 years ago
tools.min.js
4 years ago
upgrade.js
2 years ago
upgrade.min.js
2 years ago
deactivation-feedback.js
98 lines
| 1 | /* global evf_plugins_params */ |
| 2 | jQuery(function ($) { |
| 3 | var evf_deactivation_feedback = { |
| 4 | init: function () { |
| 5 | this.event_init(); |
| 6 | }, |
| 7 | event_init: function () { |
| 8 | var _that = this; |
| 9 | |
| 10 | $(document.body).on( |
| 11 | "click", |
| 12 | 'tr[data-plugin="everest-forms/everest-forms.php"] span.deactivate a', |
| 13 | function (e) { |
| 14 | e.preventDefault(); |
| 15 | $("#evf-deactivate-feedback-popup-wrapper").addClass( |
| 16 | "active" |
| 17 | ); |
| 18 | } |
| 19 | ); |
| 20 | |
| 21 | $("#evf-deactivate-feedback-popup-wrapper").click(function (event) { |
| 22 | var $target = $(event.target); |
| 23 | if ( |
| 24 | !$target.closest(".evf-deactivate-feedback-popup-inner") |
| 25 | .length |
| 26 | ) { |
| 27 | $("#evf-deactivate-feedback-popup-wrapper").removeClass( |
| 28 | "active" |
| 29 | ); |
| 30 | } |
| 31 | }); |
| 32 | |
| 33 | $("form.evf-deactivate-feedback-form").on("submit", function (e) { |
| 34 | e.preventDefault(); |
| 35 | _that.send_data($(this)); |
| 36 | }); |
| 37 | |
| 38 | $('#evf-deactivate-feedback-popup-wrapper').on('click', '.close-deactivate-feedback-popup', function(){ |
| 39 | $('#evf-deactivate-feedback-popup-wrapper').removeClass('active'); |
| 40 | }); |
| 41 | |
| 42 | $('input.evf-deactivate-feedback-input').on( 'click', function() { |
| 43 | var $this = $(this); |
| 44 | var inputTextBox = $('input[name="reason_other"]'); |
| 45 | if ( 'other' === $this.val() ) { |
| 46 | inputTextBox.attr('required', 'required') |
| 47 | } else { |
| 48 | inputTextBox.removeAttr('required'); |
| 49 | } |
| 50 | } ); |
| 51 | }, |
| 52 | send_data: function (form) { |
| 53 | var reason_slug = form |
| 54 | .find('input[name="reason_slug"]:checked') |
| 55 | .val(); |
| 56 | |
| 57 | if (reason_slug === undefined) { |
| 58 | alert("Please select at least one option from the list"); |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | if (form.find("button.submit").hasClass("button-disabled")) { |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | var reason_text = ""; |
| 67 | var reason_text_el = form.find( |
| 68 | 'input[name="reason_' + reason_slug + '"]' |
| 69 | ); |
| 70 | |
| 71 | if (reason_text_el.length > 0) { |
| 72 | reason_text = reason_text_el.val(); |
| 73 | } |
| 74 | |
| 75 | var data = { |
| 76 | reason_slug: "everest_forms_deactivation_notice", |
| 77 | }; |
| 78 | |
| 79 | data["reason_" + reason_slug] = reason_text; |
| 80 | |
| 81 | $.ajax({ |
| 82 | url: evf_plugins_params.ajax_url, |
| 83 | data: form.serializeArray(), |
| 84 | type: "post", |
| 85 | beforeSend: function () { |
| 86 | form.find("button.submit").addClass( |
| 87 | "button-disabled button updating-message" |
| 88 | ); |
| 89 | }, |
| 90 | }).done(function () { |
| 91 | window.location = form.find("a.skip").attr("href"); |
| 92 | }); |
| 93 | }, |
| 94 | }; |
| 95 | |
| 96 | evf_deactivation_feedback.init(); |
| 97 | }); |
| 98 |