PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 3.0.4
Taskbuilder – Project Management & Task Management Tool With Kanban Board v3.0.4
6.0.5 6.0.2 6.0.3 6.0.4 6.0.1 6.0.0 5.0.8 5.0.9 4.0.9 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 All 57 releases
taskbuilder / asset / js / admin.js

admin.js in Taskbuilder – Project Management & Task Management Tool With Kanban Board 3.0.4, at asset/js/admin.js

1,816 lines 52.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function wppm_add_new_project(){
2 jQuery('#wppm_project_container').show();
3 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
4 var data = {
5 action: 'wppm_add_new_project'
6 };
7 jQuery.post(wppm_admin.ajax_url, data, function(response) {
8 jQuery('#wppm_project_container').html(response);
9 });
10 }
11
12 function wppm_projects(){
13 jQuery('#wppm_project_container').hide();
14 jQuery('#wppm_project_list').show();
15 }
16
17 function wppm_get_users(proj_id){
18 wppm_modal_open('Add Users');
19 var data = {
20 action: 'wppm_get_users',
21 proj_id: proj_id
22 }
23 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
24 var response = JSON.parse(response_str);
25 jQuery('#wppm_popup_body').html(response.body);
26 jQuery('#wppm_popup_footer').html(response.footer);
27 });
28 }
29
30 function wppm_get_general_settings(){
31 jQuery('.wppm_setting_pills li').removeClass('active');
32 jQuery('#wppm_settings_general').addClass('active');
33 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
34 var data = {
35 action: 'wppm_get_general_setings'
36 };
37 jQuery.post(wppm_admin.ajax_url, data, function(response) {
38 jQuery('.wppm_setting_col2').html(response);
39 });
40 }
41
42 /*
43 * Category Settings
44 */
45 function wppm_get_category_settings(){
46 jQuery('.wppm_setting_pills li').removeClass('active');
47 jQuery('#wppm_settings_category').addClass('active');
48 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
49 var data = {
50 action: 'wppm_get_category_settings'
51 };
52 jQuery.post(wppm_admin.ajax_url, data, function(response) {
53 jQuery('.wppm_setting_col2').html(response);
54 });
55 }
56
57 /**
58 * Delete category
59 */
60 function wppm_delete_category(cat_id) {
61
62 const flag = confirm(wppm_admin.confirm);
63 if (!flag) return;
64
65 var data = { action: 'wppm_delete_category',
66 cat_id,
67 _ajax_nonce:jQuery('#wppm_delete_cat_ajax_nonce').val()
68 };
69 jQuery.post(wppm_admin.ajax_url, data, function (res) {
70 wppm_get_category_settings();
71 });
72 }
73
74 function wppm_get_proj_status_settings(){
75 jQuery('.wppm_setting_pills li').removeClass('active');
76 jQuery('#wppm_settings_proj_status').addClass('active');
77 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
78 var data = {
79 action: 'wppm_get_proj_status_settings'
80 };
81 jQuery.post(wppm_admin.ajax_url, data, function(response) {
82 jQuery('.wppm_setting_col2').html(response);
83 });
84 }
85
86 function wppm_get_add_proj_status(){
87 wppm_modal_open(wppm_admin.add_new_status);
88 var data = {
89 action: 'wppm_get_add_proj_status'
90 };
91 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
92 var response = JSON.parse(response_str);
93 jQuery('#wppm_popup_body').html(response.body);
94 jQuery('#wppm_popup_footer').html(response.footer);
95 jQuery('#wppm_proj_status_name').focus();
96 });
97 }
98
99 function wppm_delete_proj_status(status_id){
100 const flag = confirm(wppm_admin.confirm);
101 if (!flag) return;
102
103 var data = { action: 'wppm_delete_status', status_id,
104 _ajax_nonce:jQuery('#wppm_delete_pstatus_ajax_nonce').val()
105 };
106 jQuery.post(wppm_admin.ajax_url, data, function (res) {
107 wppm_get_proj_status_settings();
108 });
109 }
110
111 function wppm_set_project_users(){
112 var dataform = new FormData(jQuery('#frm_get_project_users')[0]);
113 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
114 var proj_id = jQuery('#wppm_proj_id').val();
115 jQuery.ajax({
116 url: wppm_admin.ajax_url,
117 type: 'POST',
118 data: dataform,
119 processData: false,
120 contentType: false
121 })
122 .done(function () {
123 wppm_modal_close();
124 wppm_open_project(proj_id);
125 });
126 }
127
128 function wppm_set_task_users(proj_id){
129 var dataform = new FormData(jQuery('#frm_get_task_users')[0]);
130 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
131 var task_id = jQuery('#wppm_task_id').val();
132 jQuery.ajax({
133 url: wppm_admin.ajax_url,
134 type: 'POST',
135 data: dataform,
136 processData: false,
137 contentType: false
138 })
139 .done(function () {
140 if((proj_id!=0)||(proj_id!="")){
141 wppm_modal_close();
142 wppm_open_project_tasks(task_id,proj_id);
143 }else if((proj_id==0)||(proj_id=="")){
144 wppm_modal_close();
145 wppm_open_task(task_id);
146 }
147 });
148 }
149
150 function wppm_get_project_list(page_no){
151 jQuery('#wppm_project_container').show();
152 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
153 var dataform=new FormData(jQuery('#wppm_project_list_frm')[0]);
154 dataform.append("page_no", page_no);
155 dataform.append("action", 'wppm_get_project_list');
156 jQuery.ajax( {
157 url: wppm_admin.ajax_url,
158 type: 'POST',
159 data: dataform,
160 processData: false,
161 contentType: false
162 })
163 .done(function( response ) {
164 jQuery('#wppm_project_container').html(response);
165 });
166 }
167
168 function wppm_add_new_task(proj_id){
169 jQuery('#wppm_task_container').show();
170 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
171 var data = {
172 action: 'wppm_add_new_task',
173 proj_id:proj_id
174 };
175 jQuery.post(wppm_admin.ajax_url, data, function(response) {
176 jQuery('#wppm_task_container').html(response);
177 });
178 }
179
180 function wppm_get_task_list(page_no){
181 jQuery('#wppm_task_container').show();
182 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
183 var data = {
184 action: 'wppm_get_task_list',
185 page_no:page_no
186 };
187 jQuery.post(wppm_admin.ajax_url, data, function(response) {
188 jQuery('#wppm_task_container').html(response);
189 });
190 }
191
192 function wppm_get_task_prioriy_settings(){
193 jQuery('.wppm_setting_pills li').removeClass('active');
194 jQuery('#wppm_settings_task_priorities').addClass('active');
195 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
196 var data = {
197 action: 'wppm_get_priority_settings'
198 };
199 jQuery.post(wppm_admin.ajax_url, data, function(response) {
200 jQuery('.wppm_setting_col2').html(response);
201 });
202 }
203
204 function wppm_add_task_priority(){
205 wppm_modal_open(wppm_admin.add_new_priority);
206 var data = {
207 action: 'wppm_add_task_priority'
208 };
209 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
210 var response = JSON.parse(response_str);
211 jQuery('#wppm_popup_body').html(response.body);
212 jQuery('#wppm_popup_footer').html(response.footer);
213 jQuery('#wppm_cat_name').focus();
214 });
215 }
216
217 function wppm_delete_task_priority(priority_id){
218 const flag = confirm(wppm_admin.confirm);
219 if (!flag) return;
220
221 var data = { action: 'wppm_delete_task_priority', priority_id,
222 _ajax_nonce:jQuery('#wppm_delete_tprio_ajax_nonce').val()
223 };
224 jQuery.post(wppm_admin.ajax_url, data, function (res) {
225 wppm_get_task_prioriy_settings();
226 });
227 }
228
229 function wppm_get_task_status_settings(){
230 jQuery('.wppm_setting_pills li').removeClass('active');
231 jQuery('#wppm_settings_task_status').addClass('active');
232 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
233 var data = {
234 action: 'wppm_get_task_status_settings'
235 };
236 jQuery.post(wppm_admin.ajax_url, data, function(response) {
237 jQuery('.wppm_setting_col2').html(response);
238 });
239 }
240
241 function wppm_get_add_task_status(){
242 wppm_modal_open(wppm_admin.add_new_status);
243 var data = {
244 action: 'wppm_get_add_task_status'
245 };
246 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
247 var response = JSON.parse(response_str);
248 jQuery('#wppm_popup_body').html(response.body);
249 jQuery('#wppm_popup_footer').html(response.footer);
250 jQuery('#wppm_cat_name').focus();
251 });
252 }
253
254 function wppm_delete_task_status(status_id){
255 const flag = confirm(wppm_admin.confirm);
256 if (!flag) return;
257
258 var data = { action: 'wppm_delete_task_status', status_id,
259 _ajax_nonce: jQuery('#wppm_delete_tstatus_ajax_nonce').val()};
260 jQuery.post(wppm_admin.ajax_url, data, function (res) {
261 wppm_get_task_status_settings();
262 });
263 }
264
265 function wppm_task_search_filter(){
266 var task_search = jQuery("#wppm_task_search_filter").val();
267 jQuery('#wppm_task_container').show();
268 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
269 var data = {
270 action: 'wppm_get_task_list',
271 task_search:task_search
272 };
273 jQuery.post(wppm_admin.ajax_url, data, function(response) {
274 jQuery('#wppm_task_container').html(response);
275 });
276 }
277
278 function wppm_view_task_search_filter(page_no){
279 var task_search = jQuery("#wppm_view_task_search_filter").val();
280 jQuery('#wppm_task_container').show();
281 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
282
283 var data = {
284 action: 'wppm_get_task_list_card_view',
285 task_search:task_search,
286 page_no:page_no
287 };
288 jQuery.post(wppm_admin.ajax_url, data, function(response) {
289 jQuery('#wppm_task_container').html(response);
290 });
291 }
292
293 function wppm_open_task(id){
294 jQuery('#wppm_task_container').show();
295 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
296 var data = {
297 action: 'wppm_open_task',
298 id:id
299 };
300 jQuery.post(wppm_admin.ajax_url, data, function(response) {
301 jQuery('#wppm_task_container').html(response);
302 });
303 }
304
305 function wppm_open_project_tasks(id,proj_id){
306 wppm_modal_open('Open Tasks');
307 jQuery('#wppm_task_container').show();
308 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
309 var data = {
310 action: 'wppm_open_task',
311 id: id,
312 proj_id:proj_id
313 }
314 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
315 jQuery('#wppm_popup_body').html(response_str);
316 //jQuery('#wppm_task_container').html(response_str);
317 });
318 }
319
320 function wppm_add_new_checklist(task_id,proj_id){
321 if(jQuery('#wppm_checklist_label').val()==''){
322 jQuery('#wppm_checklist_label').focus();
323 return false;
324 }
325 var data = {
326 action: 'wppm_add_new_checklist',
327 task_id: task_id,
328 proj_id: proj_id,
329 checklist_name: jQuery('#wppm_checklist_label').val(),
330 _ajax_nonce:jQuery('#wppm_checklist_ajax_nonce').val()
331 };
332 jQuery.post(wppm_admin.ajax_url, data, function(response) {
333 if((proj_id!=0)||(proj_id!="")){
334 //wppm_modal_close();
335 wppm_open_project_tasks(task_id,proj_id);
336 }else if((proj_id==0)||(proj_id=="")){
337 //wppm_modal_close();
338 wppm_open_task(task_id);
339 }
340 });
341 }
342
343 function wppm_add_new_checklist_item(checklist_id,task_id,proj_id){
344 if(jQuery('#wppm_checklist_item_label_'+checklist_id).val()==''){
345 jQuery('#wppm_checklist_item_label_'+checklist_id).focus();
346 return false;
347 }
348 var data = {
349 action: 'wppm_add_new_checklist_item',
350 checklist_id: checklist_id,
351 proj_id:proj_id,
352 label: jQuery('#wppm_checklist_item_label_'+checklist_id).val(),
353 _ajax_nonce:jQuery('#wppm_checklist_item_ajax_nonce').val()
354 };
355 jQuery.post(wppm_admin.ajax_url, data, function(response) {
356 if((proj_id!=0)||(proj_id!="")){
357 wppm_open_project_tasks(task_id,proj_id);
358 }else if((proj_id==0)||(proj_id=="")){
359 wppm_open_task(task_id);
360 }
361 });
362 }
363
364 function wppm_delete_checklist(checklist_id,task_id,proj_id){
365 const flag = confirm(wppm_admin.confirm);
366 if (!flag) return;
367 var data = {
368 action: 'wppm_delete_checklist',
369 checklist_id: checklist_id,
370 _ajax_nonce:jQuery('#wppm_delete_checklist_ajax_nonce').val()
371 };
372 jQuery.post(wppm_admin.ajax_url, data, function(response) {
373 if((proj_id!=0)||(proj_id!="")){
374 wppm_open_project_tasks(task_id,proj_id);
375 }else if((proj_id==0)||(proj_id=="")){
376 wppm_open_task(task_id);
377 }
378 });
379 }
380
381 function wppm_delete_checklist_item(item_id,checklist_id,proj_id,task_id){
382 const flag = confirm(wppm_admin.confirm);
383 if (!flag) return;
384 var data = {
385 action: 'wppm_remove_checklist_item',
386 item_id:item_id,
387 checklist_id: checklist_id,
388 _ajax_nonce:jQuery('#wppm_delete_checklist_item_ajax_nonce').val()
389 };
390 jQuery.post(wppm_admin.ajax_url, data, function(response) {
391 if((proj_id!=0)||(proj_id!="")){
392 wppm_open_project_tasks(task_id,proj_id);
393 }else if((proj_id==0)||(proj_id=="")){
394 wppm_open_task(task_id);
395 }
396 });
397 }
398
399 function wppm_checklist_progress(checklist_id,item_id,task_id){
400 var $checkboxes = jQuery('.wppm_checklist_item_'+checklist_id);
401 var $progress = jQuery('#CheckProgress_'+checklist_id);
402 var total = $checkboxes.length;
403 var checked = jQuery('.wppm_checklist_item_'+checklist_id).filter(':checked').length;
404 var progressWidth = (checked / total) * 100;
405 var checked_item;
406 jQuery('#CheckProgress_'+checklist_id).css('background','#5ba4cf');
407 jQuery('#CheckProgress_'+checklist_id).css('width', progressWidth + '%');
408 if (jQuery("#wppm_checklist_item_"+item_id).prop("checked")==true) {
409 checked_item=1;
410 }else{
411 checked_item=0;
412 }
413 var data = {
414 action: 'wppm_set_checklist_progress',
415 checklist_id: checklist_id,
416 item_id:item_id,
417 checked_item: checked_item,
418 _ajax_nonce:jQuery('#wppm_checklist_progress_ajax_nonce').val()
419 };
420 jQuery.post(wppm_admin.ajax_url, data, function(response) {
421 wppm_open_task(task_id);
422 });
423 }
424
425 function wppm_open_individual_task(id){
426 jQuery('#wppm_project_container').show();
427 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
428 var data = {
429 action: 'wppm_open_task',
430 id:id
431 };
432 jQuery.post(wppm_admin.ajax_url, data, function(response) {
433 jQuery('#wppm_project_container').html(response);
434 });
435 }
436
437 function wppm_display_grid_view(){
438 var task_search = jQuery("#wppm_view_task_search_filter").val();
439 jQuery('#wppm_task_container').show();
440 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
441 var data = {
442 action: 'wppm_get_task_list_card_view',
443 task_search: task_search
444 };
445 jQuery.post(wppm_admin.ajax_url, data, function(response) {
446 jQuery('#wppm_task_container').html(response);
447 });
448 }
449
450 function wppm_remove_filter(id){
451 jQuery('#wppm_user_display_container_'+id).remove();
452 }
453
454 function wppm_remove_user_from_project(id){
455 jQuery('#wppm_user_container_'+id).remove();
456 }
457
458 function wppm_remove_task_user_filter(id){
459 jQuery('#wppm_task_user_display_container_'+id).remove();
460 }
461
462 function wppm_cancel_comment(){
463 tinyMCE. activeEditor. setContent('');
464 tinymce.remove('#wppm_task_comment');
465 jQuery('#wppm_comment_btn').hide();
466 }
467
468 function wppm_cancel_proj_comment(){
469 tinyMCE. activeEditor. setContent('');
470 tinymce.remove('#wppm_proj_comment');
471 jQuery('#wppm_proj_comment_btn').hide();
472 }
473
474 function wppm_submit_task_comment(id,proj_id){
475 var dataform = new FormData(jQuery('#wppm_open_task')[0]);
476 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
477 dataform.append('action','wppm_submit_task_comment');
478 var comment_body = tinyMCE.get('wppm_task_comment').getContent().trim();
479 dataform.append('comment_body',comment_body);
480 dataform.append('task_id',id);
481 jQuery.ajax({
482 url: wppm_admin.ajax_url,
483 type: 'POST',
484 data: dataform,
485 processData: false,
486 contentType: false
487 })
488 .done(function (response_str) {
489 if((proj_id!=0)||(proj_id!="")){
490 wppm_open_project_tasks(id,proj_id);
491 }else if((proj_id==0)||(proj_id=="")){
492 wppm_open_task(id);
493 }
494 });
495 }
496
497 function wppm_submit_proj_comment(proj_id){
498 var dataform = new FormData(jQuery('#wppm_open_project')[0]);
499 jQuery('#wppm_load_individual_project_container').html(wppm_admin.loading_html);
500 dataform.append('action','wppm_submit_proj_comment');
501 var comment_body = tinyMCE.get('wppm_proj_comment').getContent().trim();
502 dataform.append('comment_body',comment_body);
503 dataform.append('proj_id',proj_id);
504 jQuery.ajax({
505 url: wppm_admin.ajax_url,
506 type: 'POST',
507 data: dataform,
508 processData: false,
509 contentType: false
510 })
511 .done(function (response_str) {
512 wppm_open_project(proj_id);
513 });
514 }
515
516 function wppm_attachment_cancel( obj ){
517 jQuery(obj).parent().remove();
518 }
519
520 function wppm_get_en_general_setting(){
521 jQuery('.wppm_setting_pills li').removeClass('active');
522 jQuery('#wppm_en_setting_general').addClass('active');
523 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
524
525 var data = {
526 action: 'wppm_get_en_general_setting',
527 };
528
529 jQuery.post(wppm_admin.ajax_url, data, function(response) {
530 jQuery('.wppm_setting_col2').html(response);
531 });
532 }
533
534 function wppm_set_en_general_settings(){
535 jQuery('.wppm_submit_wait').show();
536 var dataform = new FormData(jQuery('#wppm_en_frm_general_settings')[0]);
537
538 jQuery.ajax({
539 url: wppm_admin.ajax_url,
540 type: 'POST',
541 data: dataform,
542 processData: false,
543 contentType: false
544 })
545 .done(function (response_str) {
546 var response = JSON.parse(response_str);
547 jQuery('.wppm_submit_wait').hide();
548 if (response.sucess_status=='1') {
549 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
550 }
551 jQuery('#wppm_alert_success').slideDown('fast',function(){});
552 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
553 });
554 }
555
556 function wppm_get_en_task_notifications(){
557 jQuery('.wppm_setting_pills li').removeClass('active');
558 jQuery('#wppm_en_ticket_notifications').addClass('active');
559 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
560
561 var data = {
562 action: 'wppm_get_en_task_notifications'
563 };
564
565 jQuery.post(wppm_admin.ajax_url, data, function(response) {
566 jQuery('.wppm_setting_col2').html(response);
567 });
568 }
569
570 function wppm_edit_task_status(id,proj_id){
571 wppm_modal_open('Edit');
572 var data = {
573 action: 'wppm_edit_task_status',
574 task_id: id,
575 proj_id:proj_id
576 }
577 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
578 var response = JSON.parse(response_str);
579 jQuery('#wppm_popup_body').html(response.body);
580 jQuery('#wppm_popup_footer').html(response.footer);
581 });
582 }
583
584 function wppm_edit_task_users(task_id,proj_id){
585 wppm_modal_open('Add Users');
586 var data = {
587 action: 'wppm_get_task_users',
588 task_id: task_id,
589 proj_id:proj_id
590 }
591 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
592 var response = JSON.parse(response_str);
593 jQuery('#wppm_popup_body').html(response.body);
594 jQuery('#wppm_popup_footer').html(response.footer);
595 });
596 }
597
598 function wppm_edit_task_details(id,proj_id){
599 wppm_modal_open('Edit Task Details');
600 var data = {
601 action: 'wppm_edit_task_details',
602 task_id: id,
603 proj_id:proj_id
604 }
605 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
606 var response = JSON.parse(response_str);
607 jQuery('#wppm_popup_body').html(response.body);
608 jQuery('#wppm_popup_footer').html(response.footer);
609 });
610 }
611
612 function wppm_set_change_task_status(task_id,proj_id){
613 var dataform = new FormData(jQuery('#frm_get_task_change_status')[0]);
614 wppm_modal_close();
615 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
616 jQuery.ajax({
617 url: wppm_admin.ajax_url,
618 type: 'POST',
619 data: dataform,
620 processData: false,
621 contentType: false
622 })
623 .done(function (response_str) {
624 if((proj_id!=0)||(proj_id!="")){
625 wppm_open_project_tasks(task_id,proj_id);
626 }else if((proj_id==0)||(proj_id=="")){
627 wppm_open_task(task_id);
628 }
629
630 });
631 }
632
633 function wppm_edit_task_creator(task_id,proj_id){
634 wppm_modal_open('Edit Task Creator');
635 var data = {
636 action: 'wppm_edit_task_creator',
637 task_id: task_id,
638 proj_id: proj_id
639 }
640 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
641 var response = JSON.parse(response_str);
642 jQuery('#wppm_popup_body').html(response.body);
643 jQuery('#wppm_popup_footer').html(response.footer);
644 });
645 }
646
647 function wppm_set_change_raised_by(task_id,proj_id){
648 var dataform = new FormData(jQuery('#frm_get_task_creator')[0]);
649 wppm_modal_close();
650 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
651 jQuery.ajax({
652 url: wppm_admin.ajax_url,
653 type: 'POST',
654 data: dataform,
655 processData: false,
656 contentType: false
657 })
658 .done(function (response_str) {
659 if((proj_id!=0)||(proj_id!="")){
660 wppm_open_project_tasks(task_id,proj_id);
661 }else if((proj_id==0)||(proj_id=="")){
662 wppm_open_task(task_id);
663 }
664 });
665 }
666
667 function wppm_set_change_task_details(task_id,proj_id){
668 var dataform = new FormData(jQuery('#frm_get_edit_task_deatils')[0]);
669 var description = tinyMCE.get('wppm_edit_task_description').getContent().trim();
670 dataform.append('wppm_edit_task_description', description);
671 wppm_modal_close();
672 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
673 jQuery.ajax({
674 url: wppm_admin.ajax_url,
675 type: 'POST',
676 data: dataform,
677 processData: false,
678 contentType: false
679 })
680 .done(function (response_str) {
681 if((proj_id!=0)||(proj_id!="")){
682 wppm_open_project_tasks(task_id,proj_id);
683 }else if((proj_id==0)||(proj_id=="")){
684 wppm_open_task(task_id);
685 }
686 });
687 }
688
689 function wppm_edit_thread(comment_id,task_id,proj_id){
690 wppm_modal_open('Edit Thread');
691 var data = {
692 action: 'wppm_edit_task_thread',
693 comment_id:comment_id,
694 task_id: task_id,
695 proj_id: proj_id
696 }
697 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
698 var response = JSON.parse(response_str);
699 jQuery('#wppm_popup_body').html(response.body);
700 jQuery('#wppm_popup_footer').html(response.footer);
701 });
702 }
703
704 function wppm_edit_proj_thread(comment_id,proj_id){
705 wppm_modal_open('Edit Thread');
706 var data = {
707 action: 'wppm_edit_proj_thread',
708 comment_id:comment_id,
709 proj_id: proj_id
710 }
711 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
712 var response = JSON.parse(response_str);
713 jQuery('#wppm_popup_body').html(response.body);
714 jQuery('#wppm_popup_footer').html(response.footer);
715 });
716 }
717
718 function wppm_set_edit_task_thread(task_id,proj_id){
719 var dataform = new FormData(jQuery('#frm_edit_task_thread')[0]);
720 var comment_body = tinyMCE.get('wppm_edit_task_thread_editor').getContent().trim();
721 dataform.append('wppm_edit_task_thread', comment_body);
722 wppm_modal_close();
723 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
724 jQuery.ajax({
725 url: wppm_admin.ajax_url,
726 type: 'POST',
727 data: dataform,
728 processData: false,
729 contentType: false
730 })
731 .done(function (response_str) {
732 if((proj_id!=0)||(proj_id!="")){
733 wppm_open_project_tasks(task_id,proj_id);
734 }else if((proj_id==0)||(proj_id=="")){
735 wppm_open_task(task_id);
736 }
737 });
738 }
739
740 function wppm_set_edit_proj_thread(proj_id,){
741 var dataform = new FormData(jQuery('#frm_edit_proj_thread')[0]);
742 var comment_body = tinyMCE.get('wppm_edit_proj_thread_editor').getContent().trim();
743 dataform.append('wppm_edit_proj_thread', comment_body);
744 wppm_modal_close();
745 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
746 jQuery.ajax({
747 url: wppm_admin.ajax_url,
748 type: 'POST',
749 data: dataform,
750 processData: false,
751 contentType: false
752 })
753 .done(function (response_str) {
754 wppm_open_project(proj_id);
755 });
756 }
757
758 function wppm_delete_thread(comment_id,task_id,proj_id){
759 wppm_modal_open('Delete Thread');
760 var data = {
761 action: 'wppm_delete_task_thread',
762 comment_id:comment_id,
763 task_id: task_id,
764 proj_id:proj_id
765 }
766 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
767 var response = JSON.parse(response_str);
768 jQuery('#wppm_popup_body').html(response.body);
769 jQuery('#wppm_popup_footer').html(response.footer);
770 });
771 }
772
773 function wppm_delete_proj_thread(comment_id,proj_id){
774 wppm_modal_open('Delete Thread');
775 var data = {
776 action: 'wppm_delete_proj_thread',
777 comment_id:comment_id,
778 proj_id:proj_id
779 }
780 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
781 var response = JSON.parse(response_str);
782 jQuery('#wppm_popup_body').html(response.body);
783 jQuery('#wppm_popup_footer').html(response.footer);
784 });
785 }
786
787 function wppm_set_delete_thread(task_id,proj_id){
788 var dataform = new FormData(jQuery('#frm_delete_task_thread')[0]);
789 wppm_modal_close();
790 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
791 jQuery.ajax({
792 url: wppm_admin.ajax_url,
793 type: 'POST',
794 data: dataform,
795 processData: false,
796 contentType: false
797 })
798 .done(function (response_str) {
799 if((proj_id!=0)||(proj_id!="")){
800 wppm_open_project_tasks(task_id,proj_id);
801 }else if((proj_id==0)||(proj_id=="")){
802 wppm_open_task(task_id);
803 }
804 });
805 }
806
807 function wppm_set_delete_proj_thread(proj_id){
808 var dataform = new FormData(jQuery('#frm_delete_proj_thread')[0]);
809 wppm_modal_close();
810 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
811 jQuery.ajax({
812 url: wppm_admin.ajax_url,
813 type: 'POST',
814 data: dataform,
815 processData: false,
816 contentType: false
817 })
818 .done(function (response_str) {
819 wppm_open_project(proj_id);
820 });
821 }
822
823 function wppm_edit_proj_details(id){
824 wppm_modal_open('Edit Project Details');
825 var data = {
826 action: 'wppm_edit_project_details',
827 id: id
828 }
829 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
830 var response = JSON.parse(response_str);
831 jQuery('#wppm_popup_body').html(response.body);
832 jQuery('#wppm_popup_footer').html(response.footer);
833 });
834 }
835
836 function wppm_set_change_project_details(id){
837 var dataform = new FormData(jQuery('#frm_get_edit_project_deatils')[0]);
838 var description = tinyMCE.get('wppm_edit_project_description').getContent().trim();
839 dataform.append('wppm_edit_project_description', description);
840 wppm_modal_close();
841 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
842 jQuery.ajax({
843 url: wppm_admin.ajax_url,
844 type: 'POST',
845 data: dataform,
846 processData: false,
847 contentType: false
848 })
849 .done(function (response_str) {
850 wppm_open_project(id);
851 });
852 }
853
854 function wppm_edit_project_status(id){
855 wppm_modal_open('Edit Project Status');
856 var data = {
857 action: 'wppm_edit_project_status',
858 id: id
859 }
860 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
861 var response = JSON.parse(response_str);
862 jQuery('#wppm_popup_body').html(response.body);
863 jQuery('#wppm_popup_footer').html(response.footer);
864 });
865 }
866
867 function wppm_set_change_project_status(id){
868 var dataform = new FormData(jQuery('#frm_get_project_change_status')[0]);
869 wppm_modal_close();
870 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
871 jQuery.ajax({
872 url: wppm_admin.ajax_url,
873 type: 'POST',
874 data: dataform,
875 processData: false,
876 contentType: false
877 })
878 .done(function (response_str) {
879 wppm_open_project(id);
880 });
881 }
882
883 function wppm_edit_project_creator(id){
884 wppm_modal_open('Edit Project Creator');
885 var data = {
886 action: 'wppm_edit_project_creator',
887 id: id
888 }
889 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
890 var response = JSON.parse(response_str);
891 jQuery('#wppm_popup_body').html(response.body);
892 jQuery('#wppm_popup_footer').html(response.footer);
893 });
894 }
895
896 function wppm_set_change_project_raised_by(id){
897 var dataform = new FormData(jQuery('#frm_get_project_creator')[0]);
898 wppm_modal_close();
899 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
900 jQuery.ajax({
901 url: wppm_admin.ajax_url,
902 type: 'POST',
903 data: dataform,
904 processData: false,
905 contentType: false
906 })
907 .done(function (response_str) {
908 wppm_open_project(id);
909 });
910 }
911
912 function wppm_edit_project_users(id){
913 wppm_modal_open('Add Users');
914 var data = {
915 action: 'wppm_get_project_users',
916 id: id
917 }
918 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
919 var response = JSON.parse(response_str);
920 jQuery('#wppm_popup_body').html(response.body);
921 jQuery('#wppm_popup_footer').html(response.footer);
922 });
923 }
924
925 function wppm_delete_project(id){
926 wppm_modal_open('Delete Project');
927 var data = {
928 action: 'wppm_get_delete_project',
929 id: id
930 }
931 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
932 var response = JSON.parse(response_str);
933 jQuery('#wppm_popup_body').html(response.body);
934 jQuery('#wppm_popup_footer').html(response.footer);
935 });
936 }
937
938 function wppm_set_delete_project(){
939 var dataform = new FormData(jQuery('#frm_delete_project')[0]);
940 wppm_modal_close();
941 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
942 jQuery.ajax({
943 url: wppm_admin.ajax_url,
944 type: 'POST',
945 data: dataform,
946 processData: false,
947 contentType: false
948 })
949 .done(function (response_str) {
950 wppm_get_project_list();
951 });
952 }
953
954 function wppm_get_delete_task(id){
955 wppm_modal_open('Delete Task');
956 var data = {
957 action: 'wppm_get_delete_task',
958 id: id
959 }
960 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
961 var response = JSON.parse(response_str);
962 jQuery('#wppm_popup_body').html(response.body);
963 jQuery('#wppm_popup_footer').html(response.footer);
964 });
965 }
966
967 function wppm_set_delete_task(){
968 var dataform = new FormData(jQuery('#frm_delete_task')[0]);
969 wppm_modal_close();
970 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
971 jQuery.ajax({
972 url: wppm_admin.ajax_url,
973 type: 'POST',
974 data: dataform,
975 processData: false,
976 contentType: false
977 })
978 .done(function (response_str) {
979 wppm_get_task_list();
980 });
981 }
982
983 function wppm_get_edit_email_notification(id){
984 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
985 var data = {
986 action: 'wppm_get_edit_email_notification',
987 id : id
988 };
989 jQuery.post(wppm_admin.ajax_url, data, function(response) {
990 jQuery('.wppm_setting_col2').html(response);
991 });
992 }
993
994 function wppm_get_tinymce(selector,body_id){
995 jQuery('#visual').addClass('btn btn-primary');
996 jQuery('#text').removeClass('btn btn-primary');
997 jQuery('#text').addClass('btn btn-default');
998 tinymce.init({
999 selector:'#'+selector,
1000 body_id: body_id,
1001 menubar: false,
1002 statusbar: false,
1003 height : '200',
1004 plugins: [
1005 'lists link image directionality'
1006 ],
1007 image_advtab: true,
1008 toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image',
1009 branding: false,
1010 autoresize_bottom_margin: 20,
1011 browser_spellcheck : true,
1012 relative_urls : false,
1013 remove_script_host : false,
1014 convert_urls : true,
1015 setup: function (editor) {
1016 }
1017 });
1018 }
1019
1020 function wppm_get_textarea(){
1021 jQuery('#visual').removeClass('btn btn-primary');
1022 jQuery('#visual').addClass('btn btn-default');
1023 jQuery('#text').addClass('btn btn-primary');
1024 tinymce.remove();
1025 }
1026
1027 function wppm_get_templates(){
1028 wppm_modal_open(wppm_admin.templates);
1029 var data = {
1030 action: 'wppm_get_templates'
1031 };
1032 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1033 var response = JSON.parse(response_str);
1034 jQuery('#wppm_popup_body').html(response.body);
1035 jQuery('#wppm_popup_footer').html(response.footer);
1036 });
1037 }
1038
1039 function wppm_set_edit_email_notification(){
1040 var dataform = new FormData(jQuery('#wppm_edit_email_notification_settings')[0]);
1041 wppm_modal_close();
1042 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1043 jQuery.ajax({
1044 url: wppm_admin.ajax_url,
1045 type: 'POST',
1046 data: dataform,
1047 processData: false,
1048 contentType: false
1049 })
1050 .done(function (response_str) {
1051 var response = JSON.parse(response_str);
1052 if (response.sucess_status=='1') {
1053 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1054 }
1055 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1056 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1057 wppm_get_en_task_notifications();
1058 });
1059 }
1060
1061 function wppm_set_general_settings(){
1062 jQuery('.wppm_submit_wait').show();
1063 var dataform = new FormData(jQuery('#wppm_frm_general_settings')[0]);
1064 jQuery.ajax({
1065 url: wppm_admin.ajax_url,
1066 type: 'POST',
1067 data: dataform,
1068 processData: false,
1069 contentType: false
1070 })
1071 .done(function (response_str) {
1072 var response = JSON.parse(response_str);
1073 jQuery('.wppm_submit_wait').hide();
1074 if (response.sucess_status=='1') {
1075 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1076 }
1077 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1078 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1079 });
1080 }
1081
1082 function wppm_get_project_tasks(id){
1083 wppm_modal_open('Tasks');
1084 var data = {
1085 action: 'wppm_get_project_tasks',
1086 id: id
1087 }
1088 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1089 var response = JSON.parse(response_str);
1090 jQuery('#wppm_popup_body').html(response.body);
1091 jQuery('#wppm_popup_footer').html(response.footer);
1092 });
1093 }
1094
1095 function wppm_create_project_task(id){
1096 wppm_modal_open('Tasks');
1097 var data = {
1098 action: 'wppm_add_new_task',
1099 proj_id: id
1100 }
1101 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1102 jQuery('#wppm_popup_body').html(response_str);
1103 });
1104 }
1105
1106 function wppm_load_prev_page(prev_page_no,page_no,sort_by, order){
1107 if(prev_page_no!=0){
1108 page_no=prev_page_no-1;
1109 wppm_get_project_list(page_no,sort_by,order);
1110 }
1111 }
1112
1113 function wppm_load_next_page(next_page_no,page_no,sort_by,order){
1114 if(next_page_no!=page_no){
1115 page_no = next_page_no;
1116 wppm_get_project_list(page_no,sort_by,order);
1117 }
1118 }
1119
1120 function wppm_load_prev_task_page(prev_page_no,page_no, sort_by, order){
1121 if(prev_page_no!=0){
1122 page_no=prev_page_no-1;
1123 wppm_get_task_list(page_no,sort_by,order);
1124 }
1125 }
1126
1127 function wppm_load_next_task_page(next_page_no,page_no,sort_by,order){
1128 if(next_page_no!=page_no){
1129 page_no = next_page_no;
1130 wppm_get_task_list(page_no,sort_by,order);
1131 }
1132 }
1133
1134 function wppm_load_prev_task_page_card_view(prev_page_no,page_no){
1135 if(prev_page_no!=0){
1136 page_no=prev_page_no-1;
1137 wppm_view_task_search_filter(page_no);
1138 }
1139 }
1140
1141 function wppm_load_next_task_page_card_view(next_page_no,page_no){
1142 if(next_page_no!=page_no){
1143 page_no = next_page_no;
1144 wppm_view_task_search_filter(page_no);
1145 }
1146 }
1147
1148 function wppm_thread_attachment_remove(obj,attachment,comment_id,task_id,proj_id){
1149 if( confirm(wppm_admin.confirm) ){
1150 var data = {
1151 action: 'wppm_remove_thread_attachment',
1152 attachment : attachment,
1153 comment_id : comment_id,
1154 task_id:task_id,
1155 _ajax_nonce : jQuery('#wppm_ajax_nonce').val()
1156 };
1157 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1158 jQuery(obj).parent('td').parent('tr').remove();
1159 if((proj_id!=0)||(proj_id!="")){
1160 wppm_open_project_tasks(task_id,proj_id);
1161 }else if((proj_id==0)||(proj_id=="")){
1162 wppm_open_task(task_id);
1163 }
1164 });
1165 }
1166 }
1167
1168 function wppm_proj_thread_attachment_remove(obj,attachment,comment_id,id){
1169 if( confirm(wppm_admin.confirm) ){
1170 var data = {
1171 action: 'wppm_remove_proj_thread_attachment',
1172 attachment : attachment,
1173 comment_id : comment_id,
1174 proj_id:id,
1175 _ajax_nonce:jQuery('#wppm_proj_thread_attachment_remove').val()
1176 };
1177 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1178 jQuery(obj).parent('td').parent('tr').remove();
1179 wppm_open_project(id);
1180 });
1181 }
1182 }
1183
1184 function wppm_open_project(id){
1185 jQuery('#wppm_project_list').hide();
1186 jQuery('#wppm_project_container').show();
1187 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1188 var data = {
1189 action: 'wppm_open_project',
1190 id:id
1191 };
1192 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1193 jQuery('#wppm_project_container').html(response);
1194 });
1195 }
1196
1197 function wppm_project_search_filter(){
1198 var project_search = jQuery("#wppm_project_search_filter").val();
1199 jQuery('#wppm_project_container').show();
1200 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1201 var data = {
1202 action: 'wppm_get_project_list',
1203 project_search:project_search
1204 };
1205 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1206 jQuery('#wppm_project_container').html(response);
1207 });
1208 }
1209
1210 function wppm_clone_task(id){
1211 wppm_modal_open('Clone Task');
1212 var data = {
1213 action: 'wppm_clone_task',
1214 id: id
1215 }
1216 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1217 var response = JSON.parse(response_str);
1218 jQuery('#wppm_popup_body').html(response.body);
1219 jQuery('#wppm_popup_footer').html(response.footer);
1220 });
1221 }
1222
1223 function wppm_set_clone_task(){
1224 var dataform = new FormData(jQuery('#frm_edit_clone_task_name')[0]);
1225 jQuery.ajax({
1226 url: wppm_admin.ajax_url,
1227 type: 'POST',
1228 data: dataform,
1229 processData: false,
1230 contentType: false
1231 })
1232 .done(function (response_str) {
1233 wppm_modal_close();
1234 wppm_get_task_list();
1235 });
1236 }
1237
1238 function wppm_sort_up_task_list(sort_by,order){
1239 jQuery('#wppm_task_container').show();
1240 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1241 var data = {
1242 action: 'wppm_get_task_list',
1243 sort_by:sort_by,
1244 order:order
1245 };
1246 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1247 jQuery('#wppm_task_container').html(response);
1248 });
1249 }
1250
1251 function wppm_sort_up_project_list(sort_by,order){
1252 jQuery('#wppm_project_container').show();
1253 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1254 var data = {
1255 action: 'wppm_get_project_list',
1256 sort_by:sort_by,
1257 order:order
1258 };
1259 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1260 jQuery('#wppm_project_container').html(response);
1261 });
1262 }
1263
1264 function wppm_get_miscellaneous_settings(){
1265 jQuery('.wppm_setting_pills li').removeClass('active');
1266 jQuery('#wppm_settings_miscellaneous').addClass('active');
1267 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1268 var data = {
1269 action: 'wppm_get_advanced_settings'
1270 };
1271 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1272 jQuery('.wppm_setting_col2').html(response);
1273 });
1274 }
1275
1276 function wppm_get_appearance_settings(){
1277 jQuery('.wppm_setting_pills li').removeClass('active');
1278 jQuery('#wppm_settings_appearance').addClass('active');
1279 var data = {
1280 action: 'wppm_get_appearance_settings'
1281 };
1282 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1283 jQuery('.wppm_setting_col2').html(response);
1284 });
1285 }
1286
1287 function wppm_get_ap_proj_list(current_tab_class) {
1288 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1289 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1290 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1291 var data = { action: 'wppm_get_ap_proj_list' ,
1292 current_tab:current_tab_class
1293 };
1294 jQuery.post(
1295 wppm_admin.ajax_url,
1296 data,
1297 function (response) {
1298 jQuery( '.wppm-setting-section-body' ).html( response );
1299 }
1300 );
1301 }
1302
1303 function wppm_get_ap_modal_popup(current_tab_class){
1304 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1305 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1306 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1307 var data = { action: 'wppm_get_ap_modal_popup' ,
1308 current_tab:current_tab_class };
1309 jQuery.post(
1310 wppm_admin.ajax_url,
1311 data,
1312 function (response) {
1313 jQuery( '.wppm-setting-section-body' ).html( response );
1314 }
1315 );
1316 }
1317
1318 function wppm_get_ap_task_list(current_tab_class){
1319 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1320 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1321 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1322 var data = { action: 'wppm_get_ap_task_list' ,
1323 current_tab:current_tab_class
1324 };
1325 jQuery.post(
1326 wppm_admin.ajax_url,
1327 data,
1328 function (response) {
1329 jQuery( '.wppm-setting-section-body' ).html( response );
1330 }
1331 );
1332 }
1333
1334 function wppm_get_ap_individual_proj(current_tab_class){
1335 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1336 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1337 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1338 var data = { action: 'wppm_get_ap_individual_proj' ,
1339 current_tab:current_tab_class
1340 };
1341 jQuery.post(
1342 wppm_admin.ajax_url,
1343 data,
1344 function (response) {
1345 jQuery( '.wppm-setting-section-body' ).html( response );
1346 }
1347 );
1348 }
1349
1350 function wppm_get_ap_individual_task(current_tab_class){
1351 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1352 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1353 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1354 var data = { action: 'wppm_get_ap_individual_task' ,
1355 current_tab:current_tab_class
1356 };
1357 jQuery.post(
1358 wppm_admin.ajax_url,
1359 data,
1360 function (response) {
1361 jQuery( '.wppm-setting-section-body' ).html( response );
1362 }
1363 );
1364 }
1365
1366 function wppm_get_ap_grid_view(current_tab_class){
1367 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1368 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1369 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1370 var data = { action: 'wppm_get_ap_grid_view' ,
1371 current_tab:current_tab_class
1372 };
1373 jQuery.post(
1374 wppm_admin.ajax_url,
1375 data,
1376 function (response) {
1377 jQuery( '.wppm-setting-section-body' ).html( response );
1378 }
1379 );
1380 }
1381
1382 function wppm_get_ap_settings(current_tab_class){
1383 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1384 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1385 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1386 var data = { action: 'wppm_get_ap_settings' ,
1387 current_tab:current_tab_class
1388 };
1389 jQuery.post(
1390 wppm_admin.ajax_url,
1391 data,
1392 function (response) {
1393 jQuery( '.wppm-setting-section-body' ).html( response );
1394 }
1395 );
1396 }
1397
1398 function wppm_set_ap_settings(){
1399 var form = jQuery( '.wppm-frm-ap-settings' )[0];
1400 var dataform = new FormData( form );
1401 jQuery('.wppm_submit_wait').show();
1402 jQuery.ajax(
1403 {
1404 url: wppm_admin.ajax_url,
1405 type: 'POST',
1406 data: dataform,
1407 processData: false,
1408 contentType: false
1409 }
1410 ).done(
1411 function (response_str) {
1412 var response = JSON.parse(response_str);
1413 jQuery('.wppm_submit_wait').hide();
1414 if (response.sucess_status=='1') {
1415 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1416 }
1417 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1418 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1419 }
1420 );
1421 }
1422
1423 function wppm_set_ap_proj_list() {
1424 var form = jQuery( '.wppm-frm-ap-pl' )[0];
1425 var dataform = new FormData( form );
1426 jQuery('.wppm_submit_wait').show();
1427 jQuery.ajax(
1428 {
1429 url: wppm_admin.ajax_url,
1430 type: 'POST',
1431 data: dataform,
1432 processData: false,
1433 contentType: false
1434 }
1435 ).done(
1436 function (response_str) {
1437 var response = JSON.parse(response_str);
1438 jQuery('.wppm_submit_wait').hide();
1439 if (response.sucess_status=='1') {
1440 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1441 }
1442 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1443 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1444 }
1445 );
1446 }
1447
1448 function wppm_set_ap_task_list(){
1449 var form = jQuery( '.wppm-frm-ap-tl' )[0];
1450 var dataform = new FormData( form );
1451 jQuery('.wppm_submit_wait').show();
1452 jQuery.ajax(
1453 {
1454 url: wppm_admin.ajax_url,
1455 type: 'POST',
1456 data: dataform,
1457 processData: false,
1458 contentType: false
1459 }
1460 ).done(
1461 function (response_str) {
1462 var response = JSON.parse(response_str);
1463 jQuery('.wppm_submit_wait').hide();
1464 if (response.sucess_status=='1') {
1465 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1466 }
1467 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1468 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1469 }
1470 );
1471 }
1472
1473 function wppm_set_ap_individual_proj(){
1474 var form = jQuery( '.wppm-frm-ap-individual_pl' )[0];
1475 var dataform = new FormData( form );
1476 jQuery('.wppm_submit_wait').show();
1477 jQuery.ajax(
1478 {
1479 url: wppm_admin.ajax_url,
1480 type: 'POST',
1481 data: dataform,
1482 processData: false,
1483 contentType: false
1484 }
1485 ).done(
1486 function (response_str) {
1487 var response = JSON.parse(response_str);
1488 jQuery('.wppm_submit_wait').hide();
1489 if (response.sucess_status=='1') {
1490 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1491 }
1492 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1493 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1494 }
1495 );
1496 }
1497
1498 function wppm_set_ap_individual_task(){
1499 var form = jQuery( '.wppm-frm-ap-individual_tl' )[0];
1500 var dataform = new FormData( form );
1501 jQuery('.wppm_submit_wait').show();
1502 jQuery.ajax(
1503 {
1504 url: wppm_admin.ajax_url,
1505 type: 'POST',
1506 data: dataform,
1507 processData: false,
1508 contentType: false
1509 }
1510 ).done(
1511 function (response_str) {
1512 var response = JSON.parse(response_str);
1513 jQuery('.wppm_submit_wait').hide();
1514 if (response.sucess_status=='1') {
1515 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1516 }
1517 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1518 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1519 }
1520 );
1521 }
1522
1523 function wppm_set_ap_modal_popup(){
1524 var form = jQuery( '.wppm-frm-ap-modal_popup' )[0];
1525 var dataform = new FormData( form );
1526 jQuery('.wppm_submit_wait').show();
1527 jQuery.ajax(
1528 {
1529 url: wppm_admin.ajax_url,
1530 type: 'POST',
1531 data: dataform,
1532 processData: false,
1533 contentType: false
1534 }
1535 ).done(
1536 function (response_str) {
1537 var response = JSON.parse(response_str);
1538 jQuery('.wppm_submit_wait').hide();
1539 if (response.sucess_status=='1') {
1540 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1541 }
1542 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1543 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1544 }
1545 );
1546 }
1547
1548 function wppm_set_ap_grid_view(){
1549 var form = jQuery( '.wppm-frm-ap-grid_view' )[0];
1550 var dataform = new FormData( form );
1551 jQuery('.wppm_submit_wait').show();
1552 jQuery.ajax(
1553 {
1554 url: wppm_admin.ajax_url,
1555 type: 'POST',
1556 data: dataform,
1557 processData: false,
1558 contentType: false
1559 }
1560 ).done(
1561 function (response_str) {
1562 var response = JSON.parse(response_str);
1563 jQuery('.wppm_submit_wait').hide();
1564 if (response.sucess_status=='1') {
1565 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1566 }
1567 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1568 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1569 }
1570 );
1571 }
1572
1573 function wppm_set_advanced_settings(){
1574 jQuery('.wppm_submit_wait').show();
1575 var dataform = new FormData(jQuery('#wppm_frm_advanced_settings')[0]);
1576 jQuery.ajax({
1577 url: wppm_admin.ajax_url,
1578 type: 'POST',
1579 data: dataform,
1580 processData: false,
1581 contentType: false
1582 })
1583 .done(function (response_str) {
1584 var response = JSON.parse(response_str);
1585 jQuery('.wppm_submit_wait').hide();
1586 if (response.sucess_status=='1') {
1587 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1588 }
1589 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1590 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1591 });
1592 }
1593
1594 function wppm_get_project_visibility(id){
1595 wppm_modal_open('Change Visibility');
1596 var data = {
1597 action: 'wppm_get_project_visibility',
1598 id: id
1599 }
1600 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1601 var response = JSON.parse(response_str);
1602 jQuery('#wppm_popup_body').html(response.body);
1603 jQuery('#wppm_popup_footer').html(response.footer);
1604 });
1605 }
1606
1607 function wppm_select_project_visibility(proj_id){
1608 if(jQuery('input[name="wppm_project_visibility_option"]').is(':checked')){
1609 var project_visibility = jQuery('input[name="wppm_project_visibility_option"]:checked').val();
1610 }else{
1611 var project_visibility = 0;
1612 }
1613 var data = {
1614 action: 'wppm_change_project_visibility',
1615 project_id:proj_id,
1616 project_visibility:project_visibility,
1617 _ajax_nonce:jQuery('#wppm_proj_visibility_ajax_nonce').val()
1618 };
1619 jQuery.post(wppm_admin.ajax_url, data, function() {
1620 });
1621 }
1622
1623 function wppm_apply_project_filter(){
1624 wppm_project_filter = jQuery('#wppm_project_filter').find(":selected").val();
1625 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1626 var data = {
1627 action: 'wppm_get_project_list',
1628 wppm_project_filter:wppm_project_filter
1629 };
1630 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1631 jQuery('#wppm_project_container').html(response);
1632 });
1633 }
1634
1635 function wppm_apply_task_filter(){
1636 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1637 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1638 var data = {
1639 action: 'wppm_get_task_list',
1640 wppm_task_filter:wppm_task_filter
1641 };
1642 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1643 jQuery('#wppm_task_container').html(response);
1644 });
1645 }
1646
1647 function wppm_tl_reset_filter(){
1648 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1649 var data = {
1650 action: 'wppm_get_task_list',
1651 wppm_task_filter:'all',
1652 task_search:"",
1653 sort_by:"task_name",
1654 order:"ASC",
1655 wppm_proj_filter:0
1656 };
1657 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1658 jQuery('#wppm_task_container').html(response);
1659 });
1660 }
1661
1662 function wppm_apply_task_filter_grid_view(){
1663 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1664 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1665 var data = {
1666 action: 'wppm_view_project_tasks',
1667 wppm_task_filter:wppm_task_filter
1668 };
1669 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1670 jQuery('#wppm_task_container').html(response);
1671 });
1672 }
1673
1674 function wppm_tl_reset_grid_view_filter(){
1675 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1676 var data = {
1677 action: 'wppm_view_project_tasks',
1678 wppm_task_filter:'all',
1679 task_search:"",
1680 sort_by:"task_name",
1681 order:"ASC",
1682 wppm_proj_filter:"0"
1683 };
1684 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1685 jQuery('#wppm_task_container').html(response);
1686 });
1687 }
1688
1689 function wppm_pl_reset_filter(){
1690 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1691 var data = {
1692 action: 'wppm_get_project_list',
1693 wppm_project_filter:'all',
1694 project_search:"",
1695 sort_by:"project_name",
1696 order:"ASC"
1697 };
1698 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1699 jQuery('#wppm_project_container').html(response);
1700 });
1701 }
1702
1703 function wppm_tasks_by_select_project(){
1704 wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val();
1705 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1706 var data = {
1707 action: 'wppm_get_task_list',
1708 wppm_proj_filter:wppm_proj_filter
1709 };
1710 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1711 jQuery('#wppm_task_container').html(response);
1712 });
1713 }
1714
1715 function wppm_tasks_by_select_project_grid_view(){
1716 wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val();
1717 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1718 var data = {
1719 action: 'wppm_view_project_tasks',
1720 wppm_proj_filter:wppm_proj_filter
1721 };
1722 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1723 jQuery('#wppm_task_container').html(response);
1724 });
1725 }
1726
1727 function wppm_reset_ap_proj_list(){
1728 jQuery( "#wppm_reset_ap_proj_list_btn" ).text( wppm_admin.please_wait );
1729 var _ajax_nonce = jQuery("#wppm_reset_ap_proj_list_nonce").val();
1730 var data = { action: 'wppm_reset_ap_proj_list',_ajax_nonce };
1731 jQuery.post(
1732 wppm_admin.ajax_url,
1733 data,
1734 function () {
1735 wppm_get_ap_proj_list('project-list');
1736 }
1737 );
1738 }
1739
1740 function wppm_reset_ap_task_list(){
1741 jQuery( "#wppm_reset_ap_task_list_btn" ).text( wppm_admin.please_wait );
1742 var _ajax_nonce = jQuery("#wppm_reset_ap_task_list_ajax_nonce").val();
1743 var data = { action: 'wppm_reset_ap_task_list',_ajax_nonce };
1744 jQuery.post(
1745 wppm_admin.ajax_url,
1746 data,
1747 function () {
1748 wppm_get_ap_task_list('task-list');
1749 }
1750 );
1751 }
1752
1753 function wppm_reset_ap_individual_proj(){
1754 jQuery( "#wppm_reset_ap_individual_proj_btn" ).text( wppm_admin.please_wait );
1755 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_proj_ajax_nonce").val();
1756 var data = { action: 'wppm_reset_ap_individual_proj',
1757 _ajax_nonce, };
1758 jQuery.post(
1759 wppm_admin.ajax_url,
1760 data,
1761 function () {
1762 wppm_get_ap_individual_proj('individual-project');
1763 }
1764 );
1765 }
1766
1767 function wppm_reset_ap_individual_task(){
1768 jQuery( "#wppm_reset_ap_individual_task_btn" ).text( wppm_admin.please_wait );
1769 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_task_ajax_nonce" ).val();
1770 var data = { action: 'wppm_reset_ap_individual_task',_ajax_nonce };
1771 jQuery.post(
1772 wppm_admin.ajax_url,
1773 data,
1774 function () {
1775 wppm_get_ap_individual_task('individual-task');
1776 }
1777 );
1778 }
1779
1780 function wppm_reset_ap_modal_popup(){
1781 jQuery( "#wppm_reset_ap_modal_popup_btn" ).text( wppm_admin.please_wait );
1782 var _ajax_nonce = jQuery( "#wppm_reset_ap_modal_popup_nonce" ).val();
1783 var data = { action: 'wppm_reset_ap_modal_popup',_ajax_nonce };
1784 jQuery.post(
1785 wppm_admin.ajax_url,
1786 data,
1787 function () {
1788 wppm_get_ap_modal_popup('modal-popup');
1789 }
1790 );
1791 }
1792
1793 function wppm_reset_ap_grid_view(){
1794 jQuery( "#wppm_reset_ap_grid_view_btn" ).text( wppm_admin.please_wait );
1795 var wppm_reset_grid_ajax_nonce = jQuery( "#wppm_reset_ap_grid_view_ajax_nonce" ).val();
1796 var data = {
1797 action: 'wppm_reset_ap_grid_view',
1798 wppm_reset_grid_ajax_nonce:wppm_reset_grid_ajax_nonce
1799 };
1800 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1801 wppm_get_ap_grid_view('grid-view');
1802 });
1803 }
1804
1805 function wppm_reset_ap_settings(){
1806 jQuery( "#wppm_reset_ap_settings_btn" ).text( wppm_admin.please_wait );
1807 var _ajax_nonce = jQuery("#wppm_reset_ap_settings_nonce").val();
1808 var data = { action: 'wppm_reset_ap_settings',_ajax_nonce };
1809 jQuery.post(
1810 wppm_admin.ajax_url,
1811 data,
1812 function () {
1813 wppm_get_ap_settings('settings');
1814 }
1815 );
1816 }