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
evf-admin-email.js
352 lines
| 1 | /** |
| 2 | * EverestFormsEmail JS |
| 3 | * global evf_email_params |
| 4 | */ |
| 5 | ;(function($) { |
| 6 | var s; |
| 7 | var EverestFormsEmail = { |
| 8 | |
| 9 | settings: { |
| 10 | form : $('#everest-forms-builder-form'), |
| 11 | spinner: '<i class="evf-loading evf-loading-active" />' |
| 12 | }, |
| 13 | /** |
| 14 | * Start the engine. |
| 15 | * |
| 16 | */ |
| 17 | init: function() { |
| 18 | s = this.settings; |
| 19 | |
| 20 | $('.everest-forms-active-email-connections-list li').first().addClass('active-user'); |
| 21 | $('.evf-content-email-settings-inner').first().addClass('active-connection'); |
| 22 | |
| 23 | EverestFormsEmail.bindUIActions(); |
| 24 | }, |
| 25 | |
| 26 | ready: function() { |
| 27 | |
| 28 | s.formID = $('#everest-forms-builder-form').data('id'); |
| 29 | }, |
| 30 | |
| 31 | /** |
| 32 | * Element bindings. |
| 33 | * |
| 34 | */ |
| 35 | bindUIActions: function() { |
| 36 | $(document).on('click', '.everest-forms-email-add', function(e) { |
| 37 | EverestFormsEmail.connectionAdd(this, e); |
| 38 | }); |
| 39 | $(document).on('click', '.everest-forms-active-email-connections-list li', function(e) { |
| 40 | EverestFormsEmail.selectActiveAccount(this, e); |
| 41 | }); |
| 42 | $(document).on('click', '.email-remove', function(e) { |
| 43 | EverestFormsEmail.removeAccount(this, e); |
| 44 | }); |
| 45 | $(document).on('click', '.email-default-remove', function(e) { |
| 46 | EverestFormsEmail.removeDefaultAccount(this, e); |
| 47 | }); |
| 48 | $(document).on('input', '.everest-forms-email-name input', function(e) { |
| 49 | EverestFormsEmail.renameConnection(this, e); |
| 50 | }); |
| 51 | $(document).on('focusin', '.everest-forms-email-name input', function(e) { |
| 52 | EverestFormsEmail.focusConnectionName(this, e); |
| 53 | }); |
| 54 | $(document).on('createEmailConnection', '.everest-forms-email-add', function(e, data){ |
| 55 | EverestFormsEmail.addNewEmailConnection($(this), data); |
| 56 | }); |
| 57 | }, |
| 58 | connectionAdd: function(el, e) { |
| 59 | e.preventDefault(); |
| 60 | |
| 61 | var $this = $(el), |
| 62 | source = 'email', |
| 63 | type = $this.data('type'), |
| 64 | namePrompt = evf_email_params.i18n_email_connection, |
| 65 | nameField = '<input autofocus="" type="text" id="provider-connection-name" placeholder="'+evf_email_params.i18n_email_placeholder+'">', |
| 66 | nameError = '<p class="error">'+evf_email_params.i18n_email_error_name+'</p>', |
| 67 | modalContent = namePrompt+nameField+nameError; |
| 68 | |
| 69 | modalContent = modalContent.replace(/%type%/g,type); |
| 70 | $.confirm({ |
| 71 | title: false, |
| 72 | content: modalContent, |
| 73 | icon: 'dashicons dashicons-info', |
| 74 | type: 'blue', |
| 75 | backgroundDismiss: false, |
| 76 | closeIcon: false, |
| 77 | buttons: { |
| 78 | confirm: { |
| 79 | text: evf_email_params.i18n_email_ok, |
| 80 | btnClass: 'btn-confirm', |
| 81 | keys: ['enter'], |
| 82 | action: function() { |
| 83 | var input = this.$content.find('input#provider-connection-name'); |
| 84 | var error = this.$content.find('.error'); |
| 85 | var value = input.val().trim(); |
| 86 | if ( value.length === 0 ) { |
| 87 | error.show(); |
| 88 | return false; |
| 89 | } else { |
| 90 | var name = value; |
| 91 | |
| 92 | // Fire AJAX |
| 93 | var data = { |
| 94 | action : 'everest_forms_new_email_add', |
| 95 | source : source, |
| 96 | name : name, |
| 97 | id : s.form.data('id'), |
| 98 | security: evf_email_params.ajax_email_nonce |
| 99 | } |
| 100 | $.ajax({ |
| 101 | url: evf_email_params.ajax_url, |
| 102 | data: data, |
| 103 | type: 'POST', |
| 104 | success: function(response) { |
| 105 | EverestFormsEmail.addNewEmailConnection($this, {response:response, name:name}); |
| 106 | } |
| 107 | }); |
| 108 | } |
| 109 | } |
| 110 | }, |
| 111 | cancel: { |
| 112 | text: evf_email_params.i18n_email_cancel |
| 113 | } |
| 114 | } |
| 115 | }); |
| 116 | }, |
| 117 | |
| 118 | addNewEmailConnection: function( el, data ){ |
| 119 | var $this= el; |
| 120 | var response = data.response; |
| 121 | var name = data.name; |
| 122 | var $connections = $this.closest('.everest-forms-panel-sidebar-content'); |
| 123 | var form_title = $('#everest-forms-panel-field-settings-form_title:first').val() + '-' + Date.now(); |
| 124 | var cloned_email = $('.evf-content-email-settings').first().clone(); |
| 125 | $('.evf-content-email-settings-inner').removeClass('active-connection'); |
| 126 | cloned_email.find('input:not(#qt_everest_forms_panel_field_email_connection_1_evf_email_message_toolbar input[type="button"], .evf_conditional_logic_container input)').val(''); |
| 127 | |
| 128 | cloned_email.find('.evf_conditional_logic_container input[type="checkbox"]').prop('checked', false); |
| 129 | cloned_email.find('.everest-forms-attach-pdf-to-admin-email input[type="checkbox"]').prop('checked', false); |
| 130 | cloned_email.find('.everest-forms-csv-file-email-attachments input[type="checkbox"]').prop('checked', false); |
| 131 | cloned_email.find('.everest-forms-show-header-in-attachment-pdf-file input[type="checkbox"]').prop('checked', false); |
| 132 | cloned_email.find('.everest-forms-file-email-attachments input[type="checkbox"]').prop('checked', false); |
| 133 | cloned_email.find('.everest-forms-enable-email-prompt input[type="checkbox"]').prop('checked', false); |
| 134 | cloned_email.find('.evf-email-message-prompt textarea').val(''); |
| 135 | cloned_email.find('.everest-forms-email-name input').val(name); |
| 136 | |
| 137 | cloned_email.find('.everest-forms-show-header-in-attachment-pdf-file').hide(); |
| 138 | cloned_email.find('.evf-email-message-prompt').hide(); |
| 139 | cloned_email.find('.everest-forms-show-pdf-file-name').hide(); |
| 140 | cloned_email.find('.evf-field-conditional-container').hide(); |
| 141 | cloned_email.find('.evf-field-conditional-wrapper li:not(:first)').remove(); |
| 142 | cloned_email.find('.conditional_or:not(:first)').remove(); |
| 143 | cloned_email.find('.everest-forms-email-name input').val(name); |
| 144 | |
| 145 | setTimeout(function() { |
| 146 | cloned_email.find('.evf-field-conditional-input').val(''); |
| 147 | }, 2000); |
| 148 | |
| 149 | cloned_email.find('.evf-content-email-settings-inner').attr('data-connection_id',response.data.connection_id); |
| 150 | cloned_email.find('.evf-content-email-settings-inner').removeClass( 'everest-forms-hidden' ); |
| 151 | //Email toggle options. |
| 152 | cloned_email.find( '.evf-toggle-switch input' ).attr( 'name', 'settings[email][' + response.data.connection_id + '][enable_email_notification]' ); |
| 153 | cloned_email.find( '.evf-toggle-switch input:checkbox' ).attr( 'data-connection-id', response.data.connection_id ); |
| 154 | cloned_email.find( '.evf-toggle-switch input:checkbox' ).prop( 'checked', true ); |
| 155 | cloned_email.find( '.evf-toggle-switch input:checkbox' ).val( '1' ); |
| 156 | |
| 157 | // Hiding Toggle for Prevous Email Setting. |
| 158 | $('.evf-content-email-settings .evf-content-section-title').css( 'display', 'none' ); |
| 159 | // Removing email-disable-message; |
| 160 | $( '.email-disable-message' ).remove(); |
| 161 | // Removing Cloned email-disable-message; |
| 162 | cloned_email.find( '.email-disable-message' ).remove(); |
| 163 | // Showing Toggle for Current Email Setting. |
| 164 | cloned_email.find( '.evf-toggle-switch' ).parents( '.evf-content-section-title' ).css( 'display', 'flex' ); |
| 165 | |
| 166 | cloned_email.find('.evf-field-conditional-container').attr('data-connection_id',response.data.connection_id); |
| 167 | cloned_email.find('#everest-forms-panel-field-email-connection_1-connection_name').attr('name', 'settings[email]['+response.data.connection_id+'][connection_name]'); |
| 168 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_to_email').attr('name', 'settings[email]['+response.data.connection_id+'][evf_to_email]'); |
| 169 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_to_email').val( '{admin_email}' ); |
| 170 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_carboncopy').attr('name', 'settings[email]['+response.data.connection_id+'][evf_carboncopy]'); |
| 171 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_blindcarboncopy').attr('name', 'settings[email]['+response.data.connection_id+'][evf_blindcarboncopy]'); |
| 172 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_name').attr('name', 'settings[email]['+response.data.connection_id+'][evf_from_name]'); |
| 173 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_name').val( evf_email_params.from_name ); |
| 174 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_email').attr('name', 'settings[email]['+response.data.connection_id+'][evf_from_email]'); |
| 175 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_email').val( '{admin_email}' ); |
| 176 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_reply_to').attr('name', 'settings[email]['+response.data.connection_id+'][evf_reply_to]'); |
| 177 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_email_subject').attr('name', 'settings[email]['+response.data.connection_id+'][evf_email_subject]'); |
| 178 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_email_subject').val( evf_email_params.email_subject ); |
| 179 | cloned_email.find('#everest_forms_panel_field_email_connection_1_evf_email_message').attr('name', 'settings[email]['+response.data.connection_id+'][evf_email_message]'); |
| 180 | cloned_email.find('#everest_forms_panel_field_email_connection_1_evf_email_message').val( '{all_fields}' ); |
| 181 | |
| 182 | |
| 183 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-file-email-attachments').attr('name', 'settings[email]['+response.data.connection_id+'][file-email-attachments]'); |
| 184 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-file-email-attachments').val(1); |
| 185 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-file-email-attachments').attr('id', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-file-email-attachments'); |
| 186 | cloned_email.find('label[for="everest-forms-panel-field-settingsemailconnection_1-file-email-attachments"]').attr('for', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-file-email-attachments'); |
| 187 | cloned_email.find('input[name="settings[email][connection_1][file-email-attachments]"]').remove(); |
| 188 | |
| 189 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-attach_pdf_to_admin_email').attr('name', 'settings[email]['+response.data.connection_id+'][attach_pdf_to_admin_email]'); |
| 190 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-attach_pdf_to_admin_email').val(1); |
| 191 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-attach_pdf_to_admin_email').attr('id', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-attach_pdf_to_admin_email'); |
| 192 | cloned_email.find('label[for="everest-forms-panel-field-settingsemailconnection_1-attach_pdf_to_admin_email"]').attr('for', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-attach_pdf_to_admin_email'); |
| 193 | cloned_email.find('input[name="settings[email][connection_1][attach_pdf_to_admin_email]"]').remove(); |
| 194 | |
| 195 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-csv-file-email-attachments').attr('name', 'settings[email]['+response.data.connection_id+'][csv-file-email-attachments]'); |
| 196 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-csv-file-email-attachments').val(1); |
| 197 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-csv-file-email-attachments').attr('id', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-csv-file-email-attachments'); |
| 198 | cloned_email.find('label[for="everest-forms-panel-field-settingsemailconnection_1-csv-file-email-attachments"]').attr('for', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-csv-file-email-attachments'); |
| 199 | cloned_email.find('input[name="settings[email][connection_1][csv-file-email-attachments]"]').remove(); |
| 200 | |
| 201 | cloned_email.find('#everest-forms-panel-field-email-connection_1-enable_ai_email_prompt').attr('name', 'settings[email]['+response.data.connection_id+'][enable_ai_email_prompt]'); |
| 202 | cloned_email.find('#everest-forms-panel-field-email-connection_1-enable_ai_email_prompt').val(1); |
| 203 | cloned_email.find('#everest-forms-panel-field-email-connection_1-enable_ai_email_prompt').attr('id', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-enable_ai_email_prompt'); |
| 204 | cloned_email.find('label[for="everest-forms-panel-field-email-connection_1-enable_ai_email_prompt"]').attr('for', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-enable_ai_email_prompt'); |
| 205 | cloned_email.find('input[name="settings[email][connection_1][enable_ai_email_prompt]"]').remove(); |
| 206 | |
| 207 | cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_email_message_prompt').attr('name', 'settings[email]['+response.data.connection_id+'][evf_email_message_prompt]'); |
| 208 | |
| 209 | |
| 210 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-show_header_in_attachment_pdf_file').attr('name', 'settings[email]['+response.data.connection_id+'][show_header_in_attachment_pdf_file]'); |
| 211 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-show_header_in_attachment_pdf_file').val(1); |
| 212 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-show_header_in_attachment_pdf_file').attr('id', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-show_header_in_attachment_pdf_file'); |
| 213 | cloned_email.find('label[for="everest-forms-panel-field-settingsemailconnection_1-show_header_in_attachment_pdf_file"]').attr('for', 'everest-forms-panel-field-settingsemail'+response.data.connection_id+'-show_header_in_attachment_pdf_file'); |
| 214 | cloned_email.find('input[name="settings[email][connection_1][show_header_in_attachment_pdf_file]"]').remove(); |
| 215 | |
| 216 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-pdf_name').attr('name', 'settings[email]['+response.data.connection_id+'][pdf_name]'); |
| 217 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-pdf_name').val(form_title); |
| 218 | cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-pdf_name').attr("id", 'everest-forms-panel-field-settingsemail' + response.data.connection_id + '-pdf_name'); |
| 219 | |
| 220 | cloned_email.find('.everest-forms-attach-pdf-to-admin-email').attr('id', 'everest-forms-panel-field-settingsemailconnection_' + response.data.connection_id + '-attach_pdf_to_admin_email-wrap'); |
| 221 | cloned_email.find('.everest-forms-show-header-in-attachment-pdf-file ').attr('id', 'everest-forms-panel-field-settingsemailconnection_' + response.data.connection_id + '-show_header_in_attachment_pdf_file-wrap'); |
| 222 | |
| 223 | cloned_email.find('#everest-forms-panel-field-email-connection_1-conditional_logic_status').attr('name', 'settings[email]['+response.data.connection_id+'][conditional_logic_status]'); |
| 224 | cloned_email.find('.evf_conditional_logic_container input[type="hidden"]').attr('name', 'settings[email]['+response.data.connection_id+'][conditional_logic_status]'); |
| 225 | cloned_email.find('.evf-field-show-hide').attr('name', 'settings[email]['+response.data.connection_id+'][conditional_option]'); |
| 226 | cloned_email.find('.evf-field-conditional-field-select').attr('name', 'settings[email]['+response.data.connection_id+'][conditionals][1][1][field]'); |
| 227 | cloned_email.find('.evf-field-conditional-condition').attr('name', 'settings[email]['+response.data.connection_id+'][conditionals][1][1][operator]'); |
| 228 | cloned_email.find('.evf-field-conditional-input').attr('name', 'settings[email]['+response.data.connection_id+'][conditionals][1][1][value]'); |
| 229 | $cloned_email = cloned_email.append('<input type="hidden" name="settings[email]['+response.data.connection_id+'][connection_name]" value="'+name+'">'); |
| 230 | |
| 231 | $('.evf-email-settings-wrapper').append(cloned_email); |
| 232 | $connections.find('.evf-content-email-settings-inner').last().addClass('active-connection'); |
| 233 | $this.parent().find('.everest-forms-active-email-connections-list li').removeClass('active-user'); |
| 234 | $this.closest('.everest-forms-active-email.active').children('.everest-forms-active-email-connections-list').removeClass('empty-list'); |
| 235 | $this.parent().find('.everest-forms-active-email-connections-list ').append( '<li class="connection-list active-user" data-connection-id= "'+response.data.connection_id+'"><a class="user-nickname" href="#">'+name+'</a><a href="#"><span class="email-remove">Remove</span></a></li>' ); |
| 236 | }, |
| 237 | |
| 238 | selectActiveAccount: function(el, e) { |
| 239 | e.preventDefault(); |
| 240 | |
| 241 | var $this = $(el), |
| 242 | connection_id = $this.data('connection-id'), |
| 243 | active_block = $('.evf-content-email-settings').find('[data-connection_id="' + connection_id + '"]'), |
| 244 | lengthOfActiveBlock = $(active_block).length; |
| 245 | |
| 246 | $('.evf-content-email-settings').find('.evf-content-email-settings-inner').removeClass('active-connection'); |
| 247 | |
| 248 | // Hiding Email Notificaton Trigger (Previous). |
| 249 | $( '.evf-content-section-title' ).has('[data-connection-id=' + $this.siblings('.active-user').attr( 'data-connection-id' ) +']').css( 'display', 'none' ); |
| 250 | $this.siblings().removeClass('active-user'); |
| 251 | $this.addClass('active-user'); |
| 252 | |
| 253 | if( lengthOfActiveBlock ){ |
| 254 | $( active_block ).addClass('active-connection'); |
| 255 | } |
| 256 | |
| 257 | // Removing Email Notification Turn On Message. |
| 258 | $('.email-disable-message').remove(); |
| 259 | if( $( 'input[data-connection-id=' + $this.attr( 'data-connection-id' ) +']:last' ).prop( 'checked' ) == false ) { |
| 260 | $( '<p class="email-disable-message everest-forms-notice everest-forms-notice-info">' + evf_data.i18n_email_disable_message + '</p>' ).insertAfter( $( '.evf-content-section-title' ).has('[data-connection-id=' + $this.attr( 'data-connection-id' ) +']') ); |
| 261 | } |
| 262 | |
| 263 | // Displaying Email Notificaton Trigger (Current). |
| 264 | $( '.evf-content-section-title' ).has('[data-connection-id=' + $this.attr( 'data-connection-id' ) +']').css( 'display', 'flex' ); |
| 265 | }, |
| 266 | |
| 267 | removeAccount: function(el, e) { |
| 268 | e.preventDefault(); |
| 269 | |
| 270 | var $this = $(el), |
| 271 | connection_id = $this.parent().parent().data('connection-id'), |
| 272 | active_block = $('.evf-content-email-settings').find('[data-connection_id="' + connection_id + '"]'), |
| 273 | lengthOfActiveBlock = $(active_block).length; |
| 274 | $.confirm({ |
| 275 | title: false, |
| 276 | content: "Are you sure you want to delete this Email?", |
| 277 | backgroundDismiss: false, |
| 278 | closeIcon: false, |
| 279 | icon: 'dashicons dashicons-info', |
| 280 | type: 'orange', |
| 281 | buttons: { |
| 282 | confirm: { |
| 283 | text: evf_email_params.i18n_email_ok, |
| 284 | btnClass: 'btn-confirm', |
| 285 | keys: ['enter'], |
| 286 | action: function(){ |
| 287 | if( lengthOfActiveBlock ){ |
| 288 | var toBeRemoved = $this.parent().parent(); |
| 289 | active_block_after = $('.evf-provider-connections').find('[data-connection_id="' + connection_id + '"]'), |
| 290 | lengthOfActiveBlockAfter = $(active_block).length; |
| 291 | if( toBeRemoved.prev().length ){ |
| 292 | toBeRemoved.prev('.connection-list').trigger('click'); |
| 293 | }else { |
| 294 | toBeRemoved.next('.connection-list').trigger('click'); |
| 295 | } |
| 296 | |
| 297 | $( active_block ).parent().remove(); |
| 298 | toBeRemoved.remove(); |
| 299 | } |
| 300 | } |
| 301 | }, |
| 302 | cancel: { |
| 303 | text: evf_email_params.i18n_email_cancel |
| 304 | } |
| 305 | } |
| 306 | }); |
| 307 | }, |
| 308 | |
| 309 | removeDefaultAccount: function( el, e ) { |
| 310 | e.preventDefault; |
| 311 | $.alert({ |
| 312 | title: false, |
| 313 | content: "Default Email can not be deleted !", |
| 314 | icon: 'dashicons dashicons-info', |
| 315 | type: 'blue', |
| 316 | buttons: { |
| 317 | ok: { |
| 318 | text: evf_data.i18n_ok, |
| 319 | btnClass: 'btn-confirm', |
| 320 | keys: [ 'enter' ] |
| 321 | } |
| 322 | } |
| 323 | }); |
| 324 | }, |
| 325 | |
| 326 | focusConnectionName: function( el,e ){ |
| 327 | var $this = $(el); |
| 328 | $this.data('val', $this.val().trim()); |
| 329 | }, |
| 330 | |
| 331 | renameConnection: function( el,e ){ |
| 332 | e.preventDefault; |
| 333 | var $this = $(el); |
| 334 | var connection_id = $this.closest('.evf-content-email-settings-inner').data('connection_id'); |
| 335 | $active_block = $('.everest-forms-active-email-connections-list').find('[data-connection-id="' + connection_id + '"]'); |
| 336 | $active_block.find('.user-nickname').text($this.val()); |
| 337 | if ( $this.val().trim().length === 0 ) { |
| 338 | $this.parent('.everest-forms-email-name').find('.everest-forms-error').remove(); |
| 339 | $this.parent('.everest-forms-email-name').append('<p class="everest-forms-error everest-forms-text-danger">Email name cannot be empty.</p>'); |
| 340 | $this.next('.everest-forms-error').fadeOut(3000); |
| 341 | setTimeout(function() { |
| 342 | if ( $this.val().length === 0 ){ |
| 343 | $this.val($this.data('val')); |
| 344 | $active_block.find('.user-nickname').text($this.data('val')); |
| 345 | } |
| 346 | }, 3000); |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | EverestFormsEmail.init(); |
| 351 | })(jQuery); |
| 352 |