PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 1.9.9
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v1.9.9
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / assets / js / admin / evf-admin-email.js
everest-forms / assets / js / admin Last commit date
gutenberg 4 years ago admin.js 4 years ago admin.min.js 4 years ago deactivation-feedback.js 3 years ago deactivation-feedback.min.js 3 years ago editor.js 8 years ago editor.min.js 5 years ago evf-admin-email.js 3 years ago evf-admin-email.min.js 3 years ago evf-clipboard.js 8 years ago evf-clipboard.min.js 8 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 3 years ago evf-setup.min.js 3 years ago extensions.js 4 years ago extensions.min.js 4 years ago form-builder.js 3 years ago form-builder.min.js 3 years ago form-template-controller.js 3 years ago form-template-controller.min.js 3 years ago settings.js 4 years ago settings.min.js 4 years ago tools.js 4 years ago tools.min.js 4 years ago upgrade.js 5 years ago upgrade.min.js 5 years ago
evf-admin-email.js
331 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-show-header-in-attachment-pdf-file input[type="checkbox"]').prop('checked', false);
131 cloned_email.find('.everest-forms-file-email-attachments input[type="checkbox"]').prop('checked', false);
132
133 cloned_email.find('.everest-forms-show-header-in-attachment-pdf-file').hide();
134 cloned_email.find('.everest-forms-show-pdf-file-name').hide();
135 cloned_email.find('.evf-field-conditional-container').hide();
136 cloned_email.find('.evf-field-conditional-wrapper li:not(:first)').remove();
137 cloned_email.find('.conditional_or:not(:first)').remove();
138 cloned_email.find('.everest-forms-email-name input').val(name);
139
140 setTimeout(function() {
141 cloned_email.find('.evf-field-conditional-input').val('');
142 }, 2000);
143
144 cloned_email.find('.evf-content-email-settings-inner').attr('data-connection_id',response.data.connection_id);
145 cloned_email.find('.evf-content-email-settings-inner').removeClass( 'everest-forms-hidden' );
146 //Email toggle options.
147 cloned_email.find( '.evf-toggle-switch input' ).attr( 'name', 'settings[email][' + response.data.connection_id + '][enable_email_notification]' );
148 cloned_email.find( '.evf-toggle-switch input:checkbox' ).attr( 'data-connection-id', response.data.connection_id );
149 cloned_email.find( '.evf-toggle-switch input:checkbox' ).prop( 'checked', true );
150 cloned_email.find( '.evf-toggle-switch input:checkbox' ).val( '1' );
151
152 // Hiding Toggle for Prevous Email Setting.
153 $('.evf-content-email-settings .evf-content-section-title').css( 'display', 'none' );
154 // Removing email-disable-message;
155 $( '.email-disable-message' ).remove();
156 // Removing Cloned email-disable-message;
157 cloned_email.find( '.email-disable-message' ).remove();
158 // Showing Toggle for Current Email Setting.
159 cloned_email.find( '.evf-toggle-switch' ).parents( '.evf-content-section-title' ).css( 'display', 'flex' );
160
161 cloned_email.find('.evf-field-conditional-container').attr('data-connection_id',response.data.connection_id);
162 cloned_email.find('#everest-forms-panel-field-email-connection_1-connection_name').attr('name', 'settings[email]['+response.data.connection_id+'][connection_name]');
163 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_to_email').attr('name', 'settings[email]['+response.data.connection_id+'][evf_to_email]');
164 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_to_email').val( '{admin_email}' );
165 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_carboncopy').attr('name', 'settings[email]['+response.data.connection_id+'][evf_carboncopy]');
166 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_blindcarboncopy').attr('name', 'settings[email]['+response.data.connection_id+'][evf_blindcarboncopy]');
167 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_name').attr('name', 'settings[email]['+response.data.connection_id+'][evf_from_name]');
168 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_name').val( evf_email_params.from_name );
169 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_email').attr('name', 'settings[email]['+response.data.connection_id+'][evf_from_email]');
170 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_from_email').val( '{admin_email}' );
171 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_reply_to').attr('name', 'settings[email]['+response.data.connection_id+'][evf_reply_to]');
172 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_email_subject').attr('name', 'settings[email]['+response.data.connection_id+'][evf_email_subject]');
173 cloned_email.find('#everest-forms-panel-field-email-connection_1-evf_email_subject').val( evf_email_params.email_subject );
174 cloned_email.find('#everest_forms_panel_field_email_connection_1_evf_email_message').attr('name', 'settings[email]['+response.data.connection_id+'][evf_email_message]');
175 cloned_email.find('#everest_forms_panel_field_email_connection_1_evf_email_message').val( '{all_fields}' );
176
177 cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-file-email-attachments').attr('name', 'settings[email]['+response.data.connection_id+'][file-email-attachments]');
178 cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-file-email-attachments').val(1);
179 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');
180 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');
181 cloned_email.find('input[name="settings[email][connection_1][file-email-attachments]"]').remove();
182
183 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]');
184 cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-attach_pdf_to_admin_email').val(1);
185 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');
186 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');
187 cloned_email.find('input[name="settings[email][connection_1][attach_pdf_to_admin_email]"]').remove();
188
189 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]');
190 cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-show_header_in_attachment_pdf_file').val(1);
191 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');
192 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');
193 cloned_email.find('input[name="settings[email][connection_1][show_header_in_attachment_pdf_file]"]').remove();
194
195 cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-pdf_name').attr('name', 'settings[email]['+response.data.connection_id+'][pdf_name]');
196 cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-pdf_name').val(form_title);
197 cloned_email.find('#everest-forms-panel-field-settingsemailconnection_1-pdf_name').attr("id", 'everest-forms-panel-field-settingsemail' + response.data.connection_id + '-pdf_name');
198
199 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');
200 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');
201
202 cloned_email.find('#everest-forms-panel-field-email-connection_1-conditional_logic_status').attr('name', 'settings[email]['+response.data.connection_id+'][conditional_logic_status]');
203 cloned_email.find('.evf_conditional_logic_container input[type="hidden"]').attr('name', 'settings[email]['+response.data.connection_id+'][conditional_logic_status]');
204 cloned_email.find('.evf-field-show-hide').attr('name', 'settings[email]['+response.data.connection_id+'][conditional_option]');
205 cloned_email.find('.evf-field-conditional-field-select').attr('name', 'settings[email]['+response.data.connection_id+'][conditionals][1][1][field]');
206 cloned_email.find('.evf-field-conditional-condition').attr('name', 'settings[email]['+response.data.connection_id+'][conditionals][1][1][operator]');
207 cloned_email.find('.evf-field-conditional-input').attr('name', 'settings[email]['+response.data.connection_id+'][conditionals][1][1][value]');
208 $cloned_email = cloned_email.append('<input type="hidden" name="settings[email]['+response.data.connection_id+'][connection_name]" value="'+name+'">');
209
210 $('.evf-email-settings-wrapper').append(cloned_email);
211 $connections.find('.evf-content-email-settings-inner').last().addClass('active-connection');
212 $this.parent().find('.everest-forms-active-email-connections-list li').removeClass('active-user');
213 $this.closest('.everest-forms-active-email.active').children('.everest-forms-active-email-connections-list').removeClass('empty-list');
214 $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>' );
215 },
216
217 selectActiveAccount: function(el, e) {
218 e.preventDefault();
219
220 var $this = $(el),
221 connection_id = $this.data('connection-id'),
222 active_block = $('.evf-content-email-settings').find('[data-connection_id="' + connection_id + '"]'),
223 lengthOfActiveBlock = $(active_block).length;
224
225 $('.evf-content-email-settings').find('.evf-content-email-settings-inner').removeClass('active-connection');
226
227 // Hiding Email Notificaton Trigger (Previous).
228 $( '.evf-content-section-title' ).has('[data-connection-id=' + $this.siblings('.active-user').attr( 'data-connection-id' ) +']').css( 'display', 'none' );
229 $this.siblings().removeClass('active-user');
230 $this.addClass('active-user');
231
232 if( lengthOfActiveBlock ){
233 $( active_block ).addClass('active-connection');
234 }
235
236 // Removing Email Notification Turn On Message.
237 $('.email-disable-message').remove();
238 if( $( 'input[data-connection-id=' + $this.attr( 'data-connection-id' ) +']:last' ).prop( 'checked' ) == false ) {
239 $( '<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' ) +']') );
240 }
241
242 // Displaying Email Notificaton Trigger (Current).
243 $( '.evf-content-section-title' ).has('[data-connection-id=' + $this.attr( 'data-connection-id' ) +']').css( 'display', 'flex' );
244 },
245
246 removeAccount: function(el, e) {
247 e.preventDefault();
248
249 var $this = $(el),
250 connection_id = $this.parent().parent().data('connection-id'),
251 active_block = $('.evf-content-email-settings').find('[data-connection_id="' + connection_id + '"]'),
252 lengthOfActiveBlock = $(active_block).length;
253 $.confirm({
254 title: false,
255 content: "Are you sure you want to delete this Email?",
256 backgroundDismiss: false,
257 closeIcon: false,
258 icon: 'dashicons dashicons-info',
259 type: 'orange',
260 buttons: {
261 confirm: {
262 text: evf_email_params.i18n_email_ok,
263 btnClass: 'btn-confirm',
264 keys: ['enter'],
265 action: function(){
266 if( lengthOfActiveBlock ){
267 var toBeRemoved = $this.parent().parent();
268 active_block_after = $('.evf-provider-connections').find('[data-connection_id="' + connection_id + '"]'),
269 lengthOfActiveBlockAfter = $(active_block).length;
270 if( toBeRemoved.prev().length ){
271 toBeRemoved.prev('.connection-list').trigger('click');
272 }else {
273 toBeRemoved.next('.connection-list').trigger('click');
274 }
275
276 $( active_block ).parent().remove();
277 toBeRemoved.remove();
278 }
279 }
280 },
281 cancel: {
282 text: evf_email_params.i18n_email_cancel
283 }
284 }
285 });
286 },
287
288 removeDefaultAccount: function( el, e ) {
289 e.preventDefault;
290 $.alert({
291 title: false,
292 content: "Default Email can not be deleted !",
293 icon: 'dashicons dashicons-info',
294 type: 'blue',
295 buttons: {
296 ok: {
297 text: evf_data.i18n_ok,
298 btnClass: 'btn-confirm',
299 keys: [ 'enter' ]
300 }
301 }
302 });
303 },
304
305 focusConnectionName: function( el,e ){
306 var $this = $(el);
307 $this.data('val', $this.val().trim());
308 },
309
310 renameConnection: function( el,e ){
311 e.preventDefault;
312 var $this = $(el);
313 var connection_id = $this.closest('.evf-content-email-settings-inner').data('connection_id');
314 $active_block = $('.everest-forms-active-email-connections-list').find('[data-connection-id="' + connection_id + '"]');
315 $active_block.find('.user-nickname').text($this.val());
316 if ( $this.val().trim().length === 0 ) {
317 $this.parent('.everest-forms-email-name').find('.everest-forms-error').remove();
318 $this.parent('.everest-forms-email-name').append('<p class="everest-forms-error everest-forms-text-danger">Email name cannot be empty.</p>');
319 $this.next('.everest-forms-error').fadeOut(3000);
320 setTimeout(function() {
321 if ( $this.val().length === 0 ){
322 $this.val($this.data('val'));
323 $active_block.find('.user-nickname').text($this.data('val'));
324 }
325 }, 3000);
326 }
327 }
328 }
329 EverestFormsEmail.init();
330 })(jQuery);
331