PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 2.3.1
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v2.3.1
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
supportcandy / asset / js / admin.js

admin.js in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at asset/js/admin.js

1,416 lines 42.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 /*
3 * General Settings
4 */
5 function wpsc_get_general_settings(){
6
7 jQuery('.wpsc_setting_pills li').removeClass('active');
8 jQuery('#wpsc_settings_general').addClass('active');
9 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
10
11 var data = {
12 action: 'wpsc_settings',
13 setting_action : 'get_general_settings'
14 };
15
16 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
17 jQuery('.wpsc_setting_col2').html(response);
18 });
19
20 }
21
22 function wpsc_set_general_settings(){
23
24 jQuery('.wpsc_submit_wait').show();
25 var dataform = new FormData(jQuery('#wpsc_frm_general_settings')[0]);
26
27 jQuery.ajax({
28 url: wpsc_admin.ajax_url,
29 type: 'POST',
30 data: dataform,
31 processData: false,
32 contentType: false
33 })
34 .done(function (response_str) {
35 var response = JSON.parse(response_str);
36 jQuery('.wpsc_submit_wait').hide();
37 if (response.sucess_status=='1') {
38 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
39 }
40 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
41 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
42 });
43
44 }
45
46 function wpsc_set_terms_and_condition_settings(){
47
48 jQuery('.wpsc_submit_wait').show();
49 var dataform = new FormData(jQuery('#wpsc_terms_and_cond_settings')[0]);
50 jQuery.ajax({
51 url: wpsc_admin.ajax_url,
52 type: 'POST',
53 data: dataform,
54 processData: false,
55 contentType: false
56 })
57 .done(function (response_str) {
58 var response = JSON.parse(response_str);
59 jQuery('.wpsc_submit_wait').hide();
60 if (response.sucess_status=='1') {
61 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
62 }
63 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
64 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
65 });
66
67 }
68
69 /*
70 * Category Settings
71 */
72 function wpsc_get_category_settings(){
73
74 jQuery('.wpsc_setting_pills li').removeClass('active');
75 jQuery('#wpsc_settings_category').addClass('active');
76 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
77
78 var data = {
79 action: 'wpsc_settings',
80 setting_action : 'get_category_settings'
81 };
82
83 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
84 jQuery('.wpsc_setting_col2').html(response);
85 });
86
87 }
88
89 /*
90 * Status Settings
91 */
92 function wpsc_get_status_settings(){
93
94 jQuery('.wpsc_setting_pills li').removeClass('active');
95 jQuery('#wpsc_settings_status').addClass('active');
96 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
97
98 var data = {
99 action: 'wpsc_settings',
100 setting_action : 'get_status_settings'
101 };
102
103 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
104 jQuery('.wpsc_setting_col2').html(response);
105 });
106
107 }
108
109 function wpsc_get_priority_settings(){
110
111 jQuery('.wpsc_setting_pills li').removeClass('active');
112 jQuery('#wpsc_settings_priority').addClass('active');
113 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
114
115 var data = {
116 action: 'wpsc_settings',
117 setting_action : 'get_priority_settings'
118 };
119
120 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
121 jQuery('.wpsc_setting_col2').html(response);
122 });
123
124 }
125
126 function wpsc_get_ticket_widget_settings() {
127 jQuery('.wpsc_setting_pills li').removeClass('active');
128 jQuery('#wpsc_settings_ticket_widget').addClass('active');
129 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
130
131 var data={
132 action: 'wpsc_settings',
133 setting_action:'get_ticket_widget_settings'
134 };
135 jQuery.post(wpsc_admin.ajax_url,data,function(response) {
136 jQuery('.wpsc_setting_col2').html(response);
137 });
138
139 }
140
141 function wpsc_get_thank_you_settings(){
142
143 jQuery('.wpsc_setting_pills li').removeClass('active');
144 jQuery('#wpsc_settings_thank_you').addClass('active');
145 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
146
147 var data = {
148 action: 'wpsc_settings',
149 setting_action : 'get_thankyou_settings'
150 };
151
152 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
153 jQuery('.wpsc_setting_col2').html(response);
154 });
155
156 }
157
158 function wpsc_get_agent_roles(){
159 jQuery('.wpsc_setting_pills li').removeClass('active');
160 jQuery('#wpsc_settings_agent_roles').addClass('active');
161 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
162
163 var data = {
164 action: 'wpsc_settings',
165 setting_action : 'get_agent_roles'
166 };
167
168 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
169 jQuery('.wpsc_setting_col2').html(response);
170 });
171 }
172
173 function wpsc_get_templates(){
174
175 wpsc_modal_open(wpsc_admin.templates);
176 var data = {
177 action: 'wpsc_settings',
178 setting_action : 'get_templates'
179 };
180 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
181 jQuery('#wpsc_popup_body').html(response.body);
182 jQuery('#wpsc_popup_footer').html(response.footer);
183 jQuery('#wpsc_cat_name').focus();
184 });
185
186 }
187
188 function wpsc_set_thankyou_settings(){
189
190 jQuery('.wpsc_submit_wait').show();
191 var dataform = new FormData(jQuery('#wpsc_frm_thankyou_settings')[0]);
192
193 jQuery.ajax({
194 url: wpsc_admin.ajax_url,
195 type: 'POST',
196 data: dataform,
197 processData: false,
198 contentType: false
199 })
200 .done(function (response_str) {
201 var response = JSON.parse(response_str);
202 jQuery('.wpsc_submit_wait').hide();
203 if (response.sucess_status=='1') {
204 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
205 }
206 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
207 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
208 });
209
210 }
211
212 function wpsc_insert_editor_text( text_to_insert ){
213 var is_tinymce = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden();
214 if (is_tinymce) {
215 tinymce.activeEditor.execCommand('mceInsertContent', false, text_to_insert);
216 } else {
217
218 var $txt = jQuery(".wpsc_textarea");
219 var caretPos = $txt[0].selectionStart;
220 var textAreaTxt = $txt.val();
221 $txt.val(textAreaTxt.substring(0, caretPos) + text_to_insert + textAreaTxt.substring(caretPos) );
222 }
223 wpsc_modal_close();
224 }
225
226 function wpsc_get_ticket_form_fields(){
227 jQuery('.wpsc_setting_pills li').removeClass('active');
228 jQuery('#wpsc_ticket_custom_fields').addClass('active');
229 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
230
231 var data = {
232 action: 'wpsc_custom_fields',
233 setting_action : 'get_ticket_form_fields'
234 };
235
236 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
237 jQuery('.wpsc_setting_col2').html(response);
238 });
239 }
240
241 function wpsc_add_field_condition(){
242 var wpsc_tf_vcf = jQuery('#wpsc_tf_vcf').val().trim();
243 if (!wpsc_tf_vcf) {
244 jQuery('#wpsc_tf_vcf').focus();
245 return;
246 }
247 var wpsc_tf_vco = jQuery('#wpsc_tf_vco').val().trim();
248 if (!wpsc_tf_vco) {
249 jQuery('#wpsc_tf_vco').focus();
250 return;
251 }
252
253 var flag = true;
254 jQuery('#wpsc_tf_condition_container').find('input').each(function(){
255 var current_condition = ''+wpsc_tf_vcf+'--'+wpsc_tf_vco+'';
256 if(jQuery(this).val() == current_condition ){
257 flag = false;
258 }
259 });
260
261 if(flag){
262 var selected_field_label = jQuery('#wpsc_tf_vcf option:selected').text();
263 var selected_option_label = jQuery('#wpsc_tf_vco option:selected').text();
264 var str_html = ''
265 +'<li class="wpsp_filter_display_element">'
266 +'<div class="flex-container">'
267 +'<div class="wpsp_filter_display_text">'
268 +selected_field_label+': '+selected_option_label
269 +'<input type="hidden" name="wpsp_tf_condition[]" value="'+wpsc_tf_vcf+'--'+wpsc_tf_vco+'" />'
270 +'</div>'
271 +'<div class="wpsp_filter_display_remove" onclick="wpsc_remove_filter(this);"><i class="fa fa-times"></i></div>'
272 +'</div>'
273 +'</li>';
274
275 jQuery('#wpsc_tf_condition_container').append(str_html);
276 }
277
278 jQuery('#wpsc_tf_vcf').val('');
279 jQuery('#wpsc_tf_vco').html('');
280
281 }
282
283 function wpsc_remove_filter(e){
284 jQuery(e).parent().parent().remove();
285 }
286
287 function wpsc_get_agentonly_fields(){
288 jQuery('.wpsc_setting_pills li').removeClass('active');
289 jQuery('#wpsc_agentonly_fields').addClass('active');
290 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
291
292 var data = {
293 action: 'wpsc_custom_fields',
294 setting_action : 'get_agentonly_fields'
295 };
296
297 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
298 jQuery('.wpsc_setting_col2').html(response);
299 });
300 }
301
302 function wpsc_get_agent_ticket_list(){
303 jQuery('.wpsc_setting_pills li').removeClass('active');
304 jQuery('#wpsc_agent_ticket_list').addClass('active');
305 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
306
307 var data = {
308 action: 'wpsc_ticket_list',
309 setting_action : 'get_agent_ticket_list'
310 };
311
312 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
313 jQuery('.wpsc_setting_col2').html(response);
314 });
315 }
316
317 function wpsc_get_customer_ticket_list(){
318 jQuery('.wpsc_setting_pills li').removeClass('active');
319 jQuery('#wpsc_customer_ticket_list').addClass('active');
320 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
321
322 var data = {
323 action: 'wpsc_ticket_list',
324 setting_action : 'get_customer_ticket_list'
325 };
326
327 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
328 jQuery('.wpsc_setting_col2').html(response);
329 });
330 }
331
332 function wpsc_get_agent_ticket_filters(){
333 jQuery('.wpsc_setting_pills li').removeClass('active');
334 jQuery('#wpsc_agent_ticket_filters').addClass('active');
335 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
336
337 var data = {
338 action: 'wpsc_ticket_list',
339 setting_action : 'get_agent_ticket_filters'
340 };
341
342 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
343 jQuery('.wpsc_setting_col2').html(response);
344 });
345 }
346
347 function wpsc_get_customer_ticket_filters(){
348 jQuery('.wpsc_setting_pills li').removeClass('active');
349 jQuery('#wpsc_customer_ticket_filters').addClass('active');
350 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
351
352 var data = {
353 action: 'wpsc_ticket_list',
354 setting_action : 'get_customer_ticket_filters'
355 };
356
357 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
358 jQuery('.wpsc_setting_col2').html(response);
359 });
360 }
361
362 function wpsc_get_ticket_list_additional_settings(){
363 jQuery('.wpsc_setting_pills li').removeClass('active');
364 jQuery('#wpsc_ticket_list_additional_settings').addClass('active');
365 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
366
367 var data = {
368 action: 'wpsc_ticket_list',
369 setting_action : 'get_ticket_list_additional_settings'
370 };
371
372 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
373 jQuery('.wpsc_setting_col2').html(response);
374 });
375 }
376
377 function set_ticket_list_additional_settings(){
378 var check = false;
379 jQuery('#wpsc_agent_unresolved_statuses').find('input:checked').each(function(){
380 check=true;
381 });
382
383 if(!check){
384 alert(wpsc_admin.unresolve_agent);
385 return;
386 }
387
388 var check=false;
389 jQuery('#wpsc_customer_unresolved_statuses').find('input:checked').each(function(){
390 check=true;
391 });
392
393 if(!check){
394 alert(wpsc_admin.unresolve_customer);
395 return;
396 }
397 jQuery('.wpsc_submit_wait').show();
398 var dataform = new FormData(jQuery('#wpsc_frm_general_settings')[0]);
399
400 jQuery.ajax({
401 url: wpsc_admin.ajax_url,
402 type: 'POST',
403 data: dataform,
404 processData: false,
405 contentType: false
406 })
407 .done(function (response_str) {
408 var response = JSON.parse(response_str);
409 jQuery('.wpsc_submit_wait').hide();
410 if (response.sucess_status=='1') {
411 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
412 }
413 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
414 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
415 });
416
417 }
418
419 function wpsc_get_support_agents(){
420 jQuery('.wpsc_setting_pills li').removeClass('active');
421 jQuery('#wpsc_support_agents').addClass('active');
422 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
423
424 var data = {
425 action: 'wpsc_support_agents',
426 setting_action : 'get_support_agents'
427 };
428
429 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
430 jQuery('.wpsc_setting_col2').html(response);
431 });
432 }
433
434 function wpsc_get_en_general_setting(){
435 jQuery('.wpsc_setting_pills li').removeClass('active');
436 jQuery('#wpsc_en_setting_general').addClass('active');
437 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
438
439 var data = {
440 action: 'wpsc_email_notifications',
441 setting_action : 'get_en_general_setting'
442 };
443
444 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
445 jQuery('.wpsc_setting_col2').html(response);
446 });
447 }
448
449 function wpsc_set_en_general_settings(){
450 jQuery('.wpsc_submit_wait').show();
451 var dataform = new FormData(jQuery('#wpsc_frm_general_settings')[0]);
452
453 jQuery.ajax({
454 url: wpsc_admin.ajax_url,
455 type: 'POST',
456 data: dataform,
457 processData: false,
458 contentType: false
459 })
460 .done(function (response_str) {
461 var response = JSON.parse(response_str);
462 jQuery('.wpsc_submit_wait').hide();
463 if (response.sucess_status=='1') {
464 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
465 }
466 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
467 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
468 });
469 }
470
471 function wpsc_get_en_ticket_notifications(){
472 jQuery('.wpsc_setting_pills li').removeClass('active');
473 jQuery('#wpsc_en_ticket_notifications').addClass('active');
474 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
475
476 var data = {
477 action: 'wpsc_email_notifications',
478 setting_action : 'get_en_ticket_notifications'
479 };
480
481 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
482 jQuery('.wpsc_setting_col2').html(response);
483 });
484 }
485
486 function wpsc_get_add_ticket_notification(){
487 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
488 var data = {
489 action: 'wpsc_email_notifications',
490 setting_action : 'get_add_ticket_notification'
491 };
492 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
493 jQuery('.wpsc_setting_col2').html(response);
494 });
495 }
496
497 function wpsc_set_add_ticket_notification(){
498
499 var conditions = wpsc_condition_parse('wpsc_add_en_conditions');
500 if(!wpsc_condition_validate(conditions)) {
501 alert('Incorrect Conditions');
502 return;
503 }
504
505 jQuery('.wpsc_submit_wait').show();
506 var dataform = new FormData(jQuery('#wpsc_frm_general_settings')[0]);
507
508 dataform.append('conditions',JSON.stringify(conditions));
509
510 jQuery.ajax({
511 url: wpsc_admin.ajax_url,
512 type: 'POST',
513 data: dataform,
514 processData: false,
515 contentType: false
516 })
517 .done(function (response_str) {
518 var response = JSON.parse(response_str);
519 if (response.sucess_status=='1') {
520 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
521 } else {
522 jQuery('#wpsc_alert_error .wpsc_alert_text').text(response.messege);
523 }
524 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
525 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
526 wpsc_get_en_ticket_notifications();
527 });
528 }
529
530 function wpsc_get_edit_ticket_notification(term_id){
531 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
532 var data = {
533 action: 'wpsc_email_notifications',
534 setting_action : 'get_edit_ticket_notification',
535 term_id : term_id
536 };
537 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
538 jQuery('.wpsc_setting_col2').html(response);
539 });
540 }
541
542 function wpsc_set_edit_ticket_notification(){
543
544 var conditions = wpsc_condition_parse('wpsc_edit_en_conditions');
545 if(!wpsc_condition_validate(conditions)) {
546 alert('Incorrect Conditions');
547 return;
548 }
549
550 jQuery('.wpsc_submit_wait').show();
551 var dataform = new FormData(jQuery('#wpsc_frm_general_settings')[0]);
552
553 dataform.append('conditions',JSON.stringify(conditions));
554
555 jQuery.ajax({
556 url: wpsc_admin.ajax_url,
557 type: 'POST',
558 data: dataform,
559 processData: false,
560 contentType: false
561 })
562 .done(function (response_str) {
563 var response = JSON.parse(response_str);
564 if (response.sucess_status=='1') {
565 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
566 }
567 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
568 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
569 wpsc_get_en_ticket_notifications();
570 });
571 }
572
573 function wpsc_clone_ticket_notification(term_id, nonce){
574 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
575 var data = {
576 action: 'wpsc_email_notifications',
577 setting_action : 'clone_ticket_notification',
578 term_id : term_id,
579 _ajax_nonce: nonce
580 };
581 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
582 var response = JSON.parse(response_str);
583 if (response.sucess_status=='1') {
584 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
585 } else {
586 jQuery('#wpsc_alert_error .wpsc_alert_text').text(response.messege);
587 }
588 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
589 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
590 wpsc_get_en_ticket_notifications();
591 });
592 }
593
594 function wpsc_delete_ticket_notification(term_id, nonce){
595 if(confirm(wpsc_admin.are_you_sure)){
596 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
597 var data = {
598 action: 'wpsc_email_notifications',
599 setting_action : 'delete_ticket_notification',
600 term_id : term_id,
601 _ajax_nonce: nonce
602 };
603 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
604 var response = JSON.parse(response_str);
605 if (response.sucess_status=='1') {
606 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
607 } else {
608 jQuery('#wpsc_alert_error .wpsc_alert_text').text(response.messege);
609 }
610 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
611 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
612 wpsc_get_en_ticket_notifications();
613 });
614 }
615 }
616
617 /*
618 * Appearance General Settings
619 */
620 function wpsc_get_appearance_general_settings(){
621
622 jQuery('.wpsc_setting_pills li').removeClass('active');
623 jQuery('#wpsc_appearance_general').addClass('active');
624 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
625
626 var data = {
627 action: 'wpsc_appearance_settings',
628 setting_action : 'get_appearance_general_settings'
629 };
630
631 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
632 jQuery('.wpsc_setting_col2').html(response);
633 });
634
635 }
636
637 function wpsc_set_appearance_general_settings(){
638
639 jQuery('.wpsc_submit_wait').show();
640 var dataform = new FormData(jQuery('#wpsc_frm_appearance_general_settings')[0]);
641
642 jQuery.ajax({
643 url: wpsc_admin.ajax_url,
644 type: 'POST',
645 data: dataform,
646 processData: false,
647 contentType: false
648 })
649 .done(function (response_str) {
650 var response = JSON.parse(response_str);
651 jQuery('.wpsc_submit_wait').hide();
652 if (response.sucess_status=='1') {
653 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
654 }
655 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
656 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
657 });
658
659 }
660
661 /*
662 * Appearance General reset Settings
663 */
664 function wpsc_reset_default_general_settings(nonce) {
665
666 var data = {
667 action: 'wpsc_appearance_settings',
668 setting_action : 'get_reset_default_general_settings',
669 _ajax_nonce: nonce
670 };
671
672 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
673 var response = JSON.parse(response_str);
674 if (response.sucess_status=='1') {
675 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
676 }
677 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
678 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
679 wpsc_get_appearance_general_settings()
680 });
681 }
682
683 /*
684 * Appearance Ticket List Settings
685 */
686 function wpsc_get_appearance_ticket_list(){
687
688 jQuery('.wpsc_setting_pills li').removeClass('active');
689 jQuery('#wpsc_appearance_ticket_list').addClass('active');
690 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
691
692 var data = {
693 action: 'wpsc_appearance_settings',
694 setting_action : 'get_appearance_ticket_list'
695 };
696
697 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
698 jQuery('.wpsc_setting_col2').html(response);
699 });
700
701 }
702
703 function wpsc_set_appearance_ticket_list_settings(){
704
705 jQuery('.wpsc_submit_wait').show();
706 var dataform = new FormData(jQuery('#wpsc_frm_appearance_ticket_list_settings')[0]);
707
708 jQuery.ajax({
709 url: wpsc_admin.ajax_url,
710 type: 'POST',
711 data: dataform,
712 processData: false,
713 contentType: false
714 })
715 .done(function (response_str) {
716 var response = JSON.parse(response_str);
717 jQuery('.wpsc_submit_wait').hide();
718 if (response.sucess_status=='1') {
719 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
720 }
721 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
722 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
723 });
724 }
725
726 /*
727 * Appearance Ticket List reset Settings
728 */
729 function wpsc_reset_default_ticket_list_settings(nonce) {
730
731 var data = {
732 action: 'wpsc_appearance_settings',
733 setting_action : 'get_reset_default_ticket_list_settings',
734 _ajax_nonce: nonce
735 };
736
737 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
738 var response = JSON.parse(response_str);
739 if (response.sucess_status=='1') {
740 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
741 }
742 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
743 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
744 wpsc_get_appearance_ticket_list()
745 });
746 }
747
748 /*
749 * Appearance individual Ticket Page Settings
750 */
751 function wpsc_get_appearance_individual_ticket(){
752
753 jQuery('.wpsc_setting_pills li').removeClass('active');
754 jQuery('#wpsc_appearance_individual_ticket').addClass('active');
755 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
756
757 var data = {
758 action: 'wpsc_appearance_settings',
759 setting_action : 'get_appearance_individual_ticket_page'
760 };
761
762 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
763 jQuery('.wpsc_setting_col2').html(response);
764 });
765 }
766
767 function wpsc_set_appearance_individual_ticket_settings(){
768
769 jQuery('.wpsc_submit_wait').show();
770 var dataform = new FormData(jQuery('#wpsc_frm_appearance_individual_ticket_settings')[0]);
771
772 jQuery.ajax({
773 url: wpsc_admin.ajax_url,
774 type: 'POST',
775 data: dataform,
776 processData: false,
777 contentType: false
778 })
779 .done(function (response_str) {
780 var response = JSON.parse(response_str);
781 jQuery('.wpsc_submit_wait').hide();
782 if (response.sucess_status=='1') {
783 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
784 }
785 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
786 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
787 });
788 }
789
790 /*
791 * Appearance individual Ticket reset Settings
792 */
793 function wpsc_reset_default_individual_ticket_settings(nonce) {
794
795 var data = {
796 action: 'wpsc_appearance_settings',
797 setting_action : 'get_reset_default_individual_ticket_settings',
798 _ajax_nonce: nonce
799 };
800
801 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
802 var response = JSON.parse(response_str);
803 if (response.sucess_status=='1') {
804 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
805 }
806 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
807 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
808 wpsc_get_appearance_individual_ticket()
809 });
810 }
811
812
813 /*
814 * Appearance Create Ticket Page Settings
815 */
816 function wpsc_get_appearance_create_ticket(){
817
818 jQuery('.wpsc_setting_pills li').removeClass('active');
819 jQuery('#wpsc_appearance_create_ticket').addClass('active');
820 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
821
822 var data = {
823 action: 'wpsc_appearance_settings',
824 setting_action : 'get_appearance_create_ticket'
825 };
826
827 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
828 jQuery('.wpsc_setting_col2').html(response);
829 });
830 }
831
832
833 function wpsc_set_appearance_create_ticket_settings(){
834
835 jQuery('.wpsc_submit_wait').show();
836 var dataform = new FormData(jQuery('#wpsc_frm_appearance_create_ticket_settings')[0]);
837
838 jQuery.ajax({
839 url: wpsc_admin.ajax_url,
840 type: 'POST',
841 data: dataform,
842 processData: false,
843 contentType: false
844 })
845 .done(function (response_str) {
846 var response = JSON.parse(response_str);
847 jQuery('.wpsc_submit_wait').hide();
848 if (response.sucess_status=='1') {
849 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
850 }
851 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
852 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
853 });
854 }
855
856 function wpsc_get_appearance_login_form(){
857 jQuery('.wpsc_setting_pills li').removeClass('active');
858 jQuery('#wpsc_appearance_login_form').addClass('active');
859 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
860
861 var data = {
862 action: 'wpsc_appearance_settings',
863 setting_action : 'get_appearance_login_form'
864 };
865
866 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
867 jQuery('.wpsc_setting_col2').html(response);
868 });
869 }
870
871 function wpsc_set_appearance_login_form(){
872 jQuery('.wpsc_submit_wait').show();
873 var dataform = new FormData(jQuery('#wpsc_frm_appearance_login_form')[0]);
874
875 jQuery.ajax({
876 url: wpsc_admin.ajax_url,
877 type: 'POST',
878 data: dataform,
879 processData: false,
880 contentType: false
881 })
882 .done(function (response_str) {
883 var response = JSON.parse(response_str);
884 jQuery('.wpsc_submit_wait').hide();
885 if (response.sucess_status=='1') {
886 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
887 }
888 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
889 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
890 });
891 }
892 /*
893 * Appearance Create Ticket reset Settings
894 */
895 function wpsc_reset_default_create_ticket_settings(nonce) {
896
897 var data = {
898 action: 'wpsc_appearance_settings',
899 setting_action : 'get_reset_default_create_ticket_settings',
900 _ajax_nonce: nonce
901 };
902
903 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
904 var response = JSON.parse(response_str);
905 if (response.sucess_status=='1') {
906 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
907 }
908 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
909 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
910 wpsc_get_appearance_create_ticket()
911 });
912 }
913 /*
914 * Appearance Madal Window Settings
915 */
916 function wpsc_get_appearance_madal_window(){
917
918 jQuery('.wpsc_setting_pills li').removeClass('active');
919 jQuery('#wpsc_appearance_modal_window').addClass('active');
920 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
921
922 var data = {
923 action: 'wpsc_appearance_settings',
924 setting_action : 'get_appearance_modal_window'
925 };
926
927 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
928 jQuery('.wpsc_setting_col2').html(response);
929 });
930 }
931
932 function wpsc_set_appearance_modal_window_settings(){
933
934 jQuery('.wpsc_submit_wait').show();
935 var dataform = new FormData(jQuery('#wpsc_frm_appearance_modal_window_settings')[0]);
936
937 jQuery.ajax({
938 url: wpsc_admin.ajax_url,
939 type: 'POST',
940 data: dataform,
941 processData: false,
942 contentType: false
943 })
944 .done(function (response_str) {
945 var response = JSON.parse(response_str);
946 jQuery('.wpsc_submit_wait').hide();
947 if (response.sucess_status=='1') {
948 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
949 }
950 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
951 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
952 });
953 }
954
955 function wpsc_get_appearance_signup(){
956 jQuery('.wpsc_setting_pills li').removeClass('active');
957 jQuery('#wpsc_appearance_signup_form').addClass('active');
958 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
959
960 var data = {
961 action: 'wpsc_appearance_settings',
962 setting_action : 'get_appearance_signup'
963 };
964
965 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
966 jQuery('.wpsc_setting_col2').html(response);
967 });
968 }
969
970 function wpsc_set_appearance_sign_up(){
971 jQuery('.wpsc_submit_wait').show();
972 var dataform = new FormData(jQuery('#wpsc_frm_appearnce_signup_settings')[0]);
973
974 jQuery.ajax({
975 url: wpsc_admin.ajax_url,
976 type: 'POST',
977 data: dataform,
978 processData: false,
979 contentType: false
980 })
981
982 .done(function (response_str)
983 {
984 var response = JSON.parse(response_str);
985 jQuery('.wpsc_submit_wait').hide();
986 if (response.sucess_status=='1') {
987 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
988 }
989 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
990 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
991 });
992 }
993 /*
994 * Appearance Modal Window reset Settings
995 */
996 function wpsc_reset_default_modal_window_settings(nonce) {
997
998 var data = {
999 action: 'wpsc_appearance_settings',
1000 setting_action : 'get_reset_default_modal_window_settings',
1001 _ajax_nonce: nonce
1002 };
1003
1004 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
1005 var response = JSON.parse(response_str);
1006 if (response.sucess_status=='1') {
1007 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1008 }
1009 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1010 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1011 wpsc_get_appearance_madal_window()
1012 });
1013 }
1014
1015 function wpsc_get_terms_and_condition_settings(){
1016
1017 jQuery('.wpsc_setting_pills li').removeClass('active');
1018 jQuery('#wpsc_settings_term_and_conditions').addClass('active');
1019 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
1020
1021 var data = {
1022 action: 'wpsc_settings',
1023 setting_action : 'get_terms_and_condition_settings'
1024 };
1025
1026 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1027 jQuery('.wpsc_setting_col2').html(response);
1028 });
1029
1030 }
1031
1032 function wpsc_reset_appearance_signup_form(nonce){
1033
1034 var data = {
1035 action: 'wpsc_appearance_settings',
1036 setting_action : 'get_reset_default_signup_settings',
1037 _ajax_nonce: nonce
1038 };
1039
1040 jQuery.post(wpsc_admin.ajax_url, data, function(response_str) {
1041 var response = JSON.parse(response_str);
1042 if (response.sucess_status=='1')
1043 {
1044 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1045 }
1046 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1047 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1048 wpsc_get_appearance_signup();
1049 });
1050 }
1051
1052 function wpsc_get_advanced_settings(){
1053 jQuery('.wpsc_setting_pills li').removeClass('active');
1054 jQuery('#wpsc_advanced_settings').addClass('active');
1055 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
1056 var data = {
1057 action: 'wpsc_settings',
1058 setting_action : 'get_advanced_settings'
1059 };
1060 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1061 jQuery('.wpsc_setting_col2').html(response);
1062 });
1063 }
1064
1065 function wpsc_set_advanced_settings(){
1066 jQuery('.wpsc_submit_wait').show();
1067 var dataform = new FormData(jQuery('#wpsc_frm_advanced_settings')[0]);
1068 jQuery.ajax({
1069 url: wpsc_admin.ajax_url,
1070 type: 'POST',
1071 data: dataform,
1072 processData: false,
1073 contentType: false
1074 })
1075 .done(function (response_str) {
1076 var response = JSON.parse(response_str);
1077 jQuery('.wpsc_submit_wait').hide();
1078 if (response.sucess_status=='1') {
1079 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1080 }else {
1081 jQuery('#wpsc_alert_error .wpsc_alert_text').text(response.messege);
1082 jQuery('#wpsc_alert_error').slideDown('fast',function(){});
1083 setTimeout(function(){ jQuery('#wpsc_alert_error').slideUp('fast',function(){}); }, 3000);
1084 }
1085 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1086 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1087 });
1088 }
1089
1090 function wpsc_get_captcha_settings(){
1091 jQuery('.wpsc_setting_pills li').removeClass('active');
1092 jQuery('#wpsc_captcha_settings').addClass('active');
1093 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
1094 var data = {
1095 action: 'wpsc_settings',
1096 setting_action : 'get_captcha_settings'
1097 };
1098 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1099 jQuery('.wpsc_setting_col2').html(response);
1100 });
1101 }
1102
1103 function wpsc_set_captcha_settings(){
1104 jQuery('.wpsc_submit_wait').show();
1105 var dataform = new FormData(jQuery('#wpsc_frm_captcha_settings')[0]);
1106 jQuery.ajax({
1107 url: wpsc_admin.ajax_url,
1108 type: 'POST',
1109 data: dataform,
1110 processData: false,
1111 contentType: false
1112 })
1113 .done(function (response_str) {
1114 var response = JSON.parse(response_str);
1115 jQuery('.wpsc_submit_wait').hide();
1116 if (response.sucess_status=='1') {
1117 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1118 }
1119 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1120 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1121 });
1122 }
1123
1124 function wpsc_get_rest_api_settings(){
1125 jQuery('.wpsc_setting_pills li').removeClass('active');
1126 jQuery('#wpsc_rest_settings').addClass('active');
1127 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
1128 var data = {
1129 action: 'wpsc_settings',
1130 setting_action : 'get_rest_api_settings'
1131 };
1132 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1133 jQuery('.wpsc_setting_col2').html(response);
1134 });
1135 }
1136
1137 function wpsc_set_rest_api_settings(){
1138 jQuery('.wpsc_submit_wait').show();
1139 var dataform = new FormData(jQuery('#wpsc_frm_rest_api_settings')[0]);
1140 jQuery.ajax({
1141 url: wpsc_admin.ajax_url,
1142 type: 'POST',
1143 data: dataform,
1144 processData: false,
1145 contentType: false
1146 })
1147 .done(function (response_str) {
1148 var response = JSON.parse(response_str);
1149 jQuery('.wpsc_submit_wait').hide();
1150 if (response.sucess_status=='1') {
1151 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1152 }
1153 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1154 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1155 });
1156 }
1157
1158 function wpsc_custom_ticket_number(nonce){
1159 jQuery('.wpsc_submit_wait_1').show();
1160 var new_count = document.getElementById("wpsc_custom_ticket_count").value;
1161 var data = {
1162 action: 'wpsc_settings',
1163 setting_action : 'custom_start_ticket_number',
1164 new_count : new_count,
1165 _ajax_nonce: nonce
1166 };
1167 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1168 var response = JSON.parse(response);
1169 jQuery('.wpsc_submit_wait_1').hide();
1170 if (response.sucess_status=='1') {
1171 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1172 } else {
1173 alert(response.msg);
1174 return;
1175 }
1176 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1177 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1178 });
1179 }
1180
1181 /**
1182 * Adds new condition element.
1183 */
1184 function wpsc_add_new_condition(id) {
1185 jQuery('#'+ id +' .wpsc_conditions_container').append(jQuery('.wpsc_condition_template').html());
1186 }
1187
1188 /**
1189 * Remove condition element.
1190 */
1191 function wpsc_remove_condition(obj){
1192 jQuery(obj).parent().parent().remove();
1193 }
1194
1195 /**
1196 * Change condition option.
1197 */
1198 function wpsc_condition_change(obj){
1199
1200 jQuery(obj).parent().parent().find('.wpsc_condition_compare_container').first().html('');
1201 jQuery(obj).parent().parent().find('.wpsc_condition_value_container').first().html('');
1202
1203 var key = jQuery(obj).val();
1204 var has_options = jQuery(obj).find(':selected').first().data('hasoptions');
1205
1206 if( has_options == 1 ){
1207
1208 var data = {
1209 action: 'wpsc_custom_fields',
1210 setting_action : 'get_conditional_options',
1211 key : key
1212 };
1213 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1214
1215 jQuery(obj).parent().parent().find('.wpsc_condition_compare_container').first().html(jQuery('.wpsc_cond_compare_dd_template').html());
1216 jQuery(obj).parent().parent().find('.wpsc_condition_value_container').first().html(jQuery('.wpsc_cond_val_dd_template').html());
1217 jQuery(obj).parent().parent().find('.wpsc_condition_value').first().html(response);
1218
1219 });
1220
1221 } else {
1222
1223 jQuery(obj).parent().parent().find('.wpsc_condition_compare_container').first().html(jQuery('.wpsc_cond_compare_tf_template').html());
1224 jQuery(obj).parent().parent().find('.wpsc_condition_value_container').first().html(jQuery('.wpsc_cond_val_tf_template').html());
1225
1226 }
1227
1228 }
1229
1230 /**
1231 * Return array of conditions found for condition element of given id
1232 * @param {String} id Condition element id
1233 * @return {Array} conditions parsed in an array
1234 */
1235 function wpsc_condition_parse(id){
1236
1237 var conditions = new Array();
1238
1239 jQuery('#'+id).find('.wpsc_condition_element').each(function(){
1240
1241 var field = jQuery(this).find('.wpsc_condition_field').first().val().trim();
1242 var compare = '';
1243 var cond_val = '';
1244
1245 if( field != '' ){
1246 compare = jQuery(this).find('.wpsc_condition_compare').first().val().trim();
1247 cond_val = jQuery(this).find('.wpsc_condition_value').first().val().trim();
1248 }
1249
1250 conditions.push( { field: field, compare: compare, cond_val: cond_val } );
1251
1252 });
1253
1254 return conditions;
1255
1256 }
1257
1258 /**
1259 * Validate whether conditions are entered correctly or not
1260 * @param {Array} conditions Array contains condition objects
1261 * @return {Boolean} True or False
1262 */
1263 function wpsc_condition_validate(conditions){
1264
1265 var is_correct = true;
1266 if( conditions.length > 0 ){
1267 jQuery.each( conditions, function( key, condition ){
1268 if( condition.field =='' || condition.cond_val =='' ){
1269 is_correct = false;
1270 return;
1271 }
1272 });
1273 }
1274
1275 return is_correct;
1276
1277 }
1278
1279 function wpsc_get_conditional_options(e){
1280 jQuery('#wpsc_tf_vco').html('');
1281 var field_id = jQuery(e).val();
1282 var data = {
1283 action: 'wpsc_custom_fields',
1284 setting_action : 'get_conditional_options_fields',
1285 field_id : field_id
1286 };
1287 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1288 jQuery('#wpsc_tf_vco').html(response);
1289 });
1290 }
1291
1292 function wpsc_get_ticket_list_advanced_settings(){
1293 jQuery('.wpsc_setting_pills li').removeClass('active');
1294 jQuery('#wpsc_ticket_list_advanced_settings').addClass('active');
1295 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
1296
1297 var data = {
1298 action: 'wpsc_ticket_list',
1299 setting_action : 'get_ticket_list_advanced_settings'
1300 };
1301
1302 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1303 jQuery('.wpsc_setting_col2').html(response);
1304 });
1305 }
1306
1307 function set_ticket_list_advanced_settings(){
1308 var check = false;
1309
1310 jQuery('#wpsc_agent_close_statuses').find('input:checked').each(function () {
1311 check = true;
1312 });
1313
1314 if(!check){
1315 alert(wpsc_admin.agent_close_statuses);
1316 return;
1317 }
1318
1319 jQuery('.wpsc_submit_wait').show();
1320 var dataform = new FormData(jQuery('#wpsc_frm_ticket_list_advanced_settings')[0]);
1321
1322 jQuery.ajax({
1323 url: wpsc_admin.ajax_url,
1324 type: 'POST',
1325 data: dataform,
1326 processData: false,
1327 contentType: false
1328 })
1329 .done(function (response_str) {
1330 var response = JSON.parse(response_str);
1331 jQuery('.wpsc_submit_wait').hide();
1332 if (response.sucess_status=='1') {
1333 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1334 }
1335 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1336 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1337 });
1338
1339 }
1340
1341 function wpsc_get_attachment_settings(){
1342
1343 jQuery('.wpsc_setting_pills li').removeClass('active');
1344 jQuery('#wpsc_settings_attachment').addClass('active');
1345 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
1346
1347 var data = {
1348 action: 'wpsc_settings',
1349 setting_action : 'get_attachment_settings'
1350 };
1351
1352 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1353 jQuery('.wpsc_setting_col2').html(response);
1354 });
1355 }
1356
1357 function wpsc_set_attachment_settings(){
1358
1359 jQuery('.wpsc_submit_wait').show();
1360 var dataform = new FormData(jQuery('#wpsc_frm_attachment_settings')[0]);
1361 jQuery.ajax({
1362 url: wpsc_admin.ajax_url,
1363 type: 'POST',
1364 data: dataform,
1365 processData: false,
1366 contentType: false
1367 })
1368 .done(function (response_str) {
1369 var response = JSON.parse(response_str);
1370 jQuery('.wpsc_submit_wait').hide();
1371 if (response.sucess_status=='1') {
1372 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1373 }
1374 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1375 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1376 });
1377
1378 }
1379
1380 function wpsc_get_tinymce_settings(){
1381 jQuery('.wpsc_setting_pills li').removeClass('active');
1382 jQuery('#wpsc_tinymce_settings').addClass('active');
1383 jQuery('.wpsc_setting_col2').html(wpsc_admin.loading_html);
1384
1385 var data = {
1386 action: 'wpsc_settings',
1387 setting_action : 'get_tinymce_settings'
1388 };
1389
1390 jQuery.post(wpsc_admin.ajax_url, data, function(response) {
1391 jQuery('.wpsc_setting_col2').html(response);
1392 });
1393 }
1394
1395 function wpsc_set_tinymce_settings(){
1396
1397 jQuery('.wpsc_submit_wait').show();
1398 var dataform = new FormData(jQuery('#wpsc_get_tinymce_settings')[0]);
1399
1400 jQuery.ajax({
1401 url: wpsc_admin.ajax_url,
1402 type: 'POST',
1403 data: dataform,
1404 processData: false,
1405 contentType: false
1406 })
1407 .done(function (response_str) {
1408 var response = JSON.parse(response_str);
1409 jQuery('.wpsc_submit_wait').hide();
1410 if (response.sucess_status=='1') {
1411 jQuery('#wpsc_alert_success .wpsc_alert_text').text(response.messege);
1412 }
1413 jQuery('#wpsc_alert_success').slideDown('fast',function(){});
1414 setTimeout(function(){ jQuery('#wpsc_alert_success').slideUp('fast',function(){}); }, 3000);
1415 });
1416 }