PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 3.0.8
Taskbuilder – Project Management & Task Management Tool With Kanban Board v3.0.8
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.8, at asset/js/admin.js

2,140 lines 62.2 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_coworker_permission_settings(){
1288 jQuery('.wppm_setting_pills li').removeClass('active');
1289 jQuery('#wppm_settings_coworker').addClass('active');
1290 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1291 var data = {
1292 action: 'wppm_get_coworker_permission_settings'
1293 };
1294 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1295 jQuery('.wppm_setting_col2').html(response);
1296 });
1297 }
1298
1299 function wppm_set_coworkers_permission_settings(){
1300 jQuery('.wppm_submit_wait').show();
1301 var dataform = new FormData(jQuery('#wppm_frm_coworkers_permission_settings')[0]);
1302 jQuery.ajax({
1303 url: wppm_admin.ajax_url,
1304 type: 'POST',
1305 data: dataform,
1306 processData: false,
1307 contentType: false
1308 })
1309 .done(function (response_str) {
1310 var response = JSON.parse(response_str);
1311 jQuery('.wppm_submit_wait').hide();
1312 if (response.sucess_status=='1') {
1313 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1314 }
1315 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1316 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1317 });
1318 }
1319
1320 function wppm_get_ap_proj_list(current_tab_class) {
1321 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1322 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1323 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1324 var data = { action: 'wppm_get_ap_proj_list' ,
1325 current_tab:current_tab_class
1326 };
1327 jQuery.post(
1328 wppm_admin.ajax_url,
1329 data,
1330 function (response) {
1331 jQuery( '.wppm-setting-section-body' ).html( response );
1332 }
1333 );
1334 }
1335
1336 function wppm_get_ap_modal_popup(current_tab_class){
1337 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1338 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1339 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1340 var data = { action: 'wppm_get_ap_modal_popup' ,
1341 current_tab:current_tab_class };
1342 jQuery.post(
1343 wppm_admin.ajax_url,
1344 data,
1345 function (response) {
1346 jQuery( '.wppm-setting-section-body' ).html( response );
1347 }
1348 );
1349 }
1350
1351 function wppm_get_ap_task_list(current_tab_class){
1352 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1353 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1354 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1355 var data = { action: 'wppm_get_ap_task_list' ,
1356 current_tab:current_tab_class
1357 };
1358 jQuery.post(
1359 wppm_admin.ajax_url,
1360 data,
1361 function (response) {
1362 jQuery( '.wppm-setting-section-body' ).html( response );
1363 }
1364 );
1365 }
1366
1367 function wppm_get_ap_individual_proj(current_tab_class){
1368 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1369 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1370 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1371 var data = { action: 'wppm_get_ap_individual_proj' ,
1372 current_tab:current_tab_class
1373 };
1374 jQuery.post(
1375 wppm_admin.ajax_url,
1376 data,
1377 function (response) {
1378 jQuery( '.wppm-setting-section-body' ).html( response );
1379 }
1380 );
1381 }
1382
1383 function wppm_get_ap_individual_task(current_tab_class){
1384 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1385 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1386 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1387 var data = { action: 'wppm_get_ap_individual_task' ,
1388 current_tab:current_tab_class
1389 };
1390 jQuery.post(
1391 wppm_admin.ajax_url,
1392 data,
1393 function (response) {
1394 jQuery( '.wppm-setting-section-body' ).html( response );
1395 }
1396 );
1397 }
1398
1399 function wppm_get_ap_grid_view(current_tab_class){
1400 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1401 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1402 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1403 var data = { action: 'wppm_get_ap_grid_view' ,
1404 current_tab:current_tab_class
1405 };
1406 jQuery.post(
1407 wppm_admin.ajax_url,
1408 data,
1409 function (response) {
1410 jQuery( '.wppm-setting-section-body' ).html( response );
1411 }
1412 );
1413 }
1414
1415 function wppm_get_ap_settings(current_tab_class){
1416 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1417 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1418 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1419 var data = { action: 'wppm_get_ap_settings' ,
1420 current_tab:current_tab_class
1421 };
1422 jQuery.post(
1423 wppm_admin.ajax_url,
1424 data,
1425 function (response) {
1426 jQuery( '.wppm-setting-section-body' ).html( response );
1427 }
1428 );
1429 }
1430
1431 function wppm_set_ap_settings(){
1432 var form = jQuery( '.wppm-frm-ap-settings' )[0];
1433 var dataform = new FormData( form );
1434 jQuery('.wppm_submit_wait').show();
1435 jQuery.ajax(
1436 {
1437 url: wppm_admin.ajax_url,
1438 type: 'POST',
1439 data: dataform,
1440 processData: false,
1441 contentType: false
1442 }
1443 ).done(
1444 function (response_str) {
1445 var response = JSON.parse(response_str);
1446 jQuery('.wppm_submit_wait').hide();
1447 if (response.sucess_status=='1') {
1448 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1449 }
1450 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1451 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1452 }
1453 );
1454 }
1455
1456 function wppm_set_ap_proj_list() {
1457 var form = jQuery( '.wppm-frm-ap-pl' )[0];
1458 var dataform = new FormData( form );
1459 jQuery('.wppm_submit_wait').show();
1460 jQuery.ajax(
1461 {
1462 url: wppm_admin.ajax_url,
1463 type: 'POST',
1464 data: dataform,
1465 processData: false,
1466 contentType: false
1467 }
1468 ).done(
1469 function (response_str) {
1470 var response = JSON.parse(response_str);
1471 jQuery('.wppm_submit_wait').hide();
1472 if (response.sucess_status=='1') {
1473 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1474 }
1475 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1476 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1477 }
1478 );
1479 }
1480
1481 function wppm_set_ap_task_list(){
1482 var form = jQuery( '.wppm-frm-ap-tl' )[0];
1483 var dataform = new FormData( form );
1484 jQuery('.wppm_submit_wait').show();
1485 jQuery.ajax(
1486 {
1487 url: wppm_admin.ajax_url,
1488 type: 'POST',
1489 data: dataform,
1490 processData: false,
1491 contentType: false
1492 }
1493 ).done(
1494 function (response_str) {
1495 var response = JSON.parse(response_str);
1496 jQuery('.wppm_submit_wait').hide();
1497 if (response.sucess_status=='1') {
1498 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1499 }
1500 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1501 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1502 }
1503 );
1504 }
1505
1506 function wppm_set_ap_individual_proj(){
1507 var form = jQuery( '.wppm-frm-ap-individual_pl' )[0];
1508 var dataform = new FormData( form );
1509 jQuery('.wppm_submit_wait').show();
1510 jQuery.ajax(
1511 {
1512 url: wppm_admin.ajax_url,
1513 type: 'POST',
1514 data: dataform,
1515 processData: false,
1516 contentType: false
1517 }
1518 ).done(
1519 function (response_str) {
1520 var response = JSON.parse(response_str);
1521 jQuery('.wppm_submit_wait').hide();
1522 if (response.sucess_status=='1') {
1523 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1524 }
1525 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1526 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1527 }
1528 );
1529 }
1530
1531 function wppm_set_ap_individual_task(){
1532 var form = jQuery( '.wppm-frm-ap-individual_tl' )[0];
1533 var dataform = new FormData( form );
1534 jQuery('.wppm_submit_wait').show();
1535 jQuery.ajax(
1536 {
1537 url: wppm_admin.ajax_url,
1538 type: 'POST',
1539 data: dataform,
1540 processData: false,
1541 contentType: false
1542 }
1543 ).done(
1544 function (response_str) {
1545 var response = JSON.parse(response_str);
1546 jQuery('.wppm_submit_wait').hide();
1547 if (response.sucess_status=='1') {
1548 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1549 }
1550 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1551 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1552 }
1553 );
1554 }
1555
1556 function wppm_set_ap_modal_popup(){
1557 var form = jQuery( '.wppm-frm-ap-modal_popup' )[0];
1558 var dataform = new FormData( form );
1559 jQuery('.wppm_submit_wait').show();
1560 jQuery.ajax(
1561 {
1562 url: wppm_admin.ajax_url,
1563 type: 'POST',
1564 data: dataform,
1565 processData: false,
1566 contentType: false
1567 }
1568 ).done(
1569 function (response_str) {
1570 var response = JSON.parse(response_str);
1571 jQuery('.wppm_submit_wait').hide();
1572 if (response.sucess_status=='1') {
1573 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1574 }
1575 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1576 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1577 }
1578 );
1579 }
1580
1581 function wppm_set_ap_grid_view(){
1582 var form = jQuery( '.wppm-frm-ap-grid_view' )[0];
1583 var dataform = new FormData( form );
1584 jQuery('.wppm_submit_wait').show();
1585 jQuery.ajax(
1586 {
1587 url: wppm_admin.ajax_url,
1588 type: 'POST',
1589 data: dataform,
1590 processData: false,
1591 contentType: false
1592 }
1593 ).done(
1594 function (response_str) {
1595 var response = JSON.parse(response_str);
1596 jQuery('.wppm_submit_wait').hide();
1597 if (response.sucess_status=='1') {
1598 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1599 }
1600 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1601 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1602 }
1603 );
1604 }
1605
1606 function wppm_set_advanced_settings(){
1607 jQuery('.wppm_submit_wait').show();
1608 var dataform = new FormData(jQuery('#wppm_frm_advanced_settings')[0]);
1609 jQuery.ajax({
1610 url: wppm_admin.ajax_url,
1611 type: 'POST',
1612 data: dataform,
1613 processData: false,
1614 contentType: false
1615 })
1616 .done(function (response_str) {
1617 var response = JSON.parse(response_str);
1618 jQuery('.wppm_submit_wait').hide();
1619 if (response.sucess_status=='1') {
1620 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1621 }
1622 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1623 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1624 });
1625 }
1626
1627 function wppm_get_project_visibility(id){
1628 wppm_modal_open('Change Visibility');
1629 var data = {
1630 action: 'wppm_get_project_visibility',
1631 id: id
1632 }
1633 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1634 var response = JSON.parse(response_str);
1635 jQuery('#wppm_popup_body').html(response.body);
1636 jQuery('#wppm_popup_footer').html(response.footer);
1637 });
1638 }
1639
1640 function wppm_select_project_visibility(proj_id){
1641 if(jQuery('input[name="wppm_project_visibility_option"]').is(':checked')){
1642 var project_visibility = jQuery('input[name="wppm_project_visibility_option"]:checked').val();
1643 }else{
1644 var project_visibility = 0;
1645 }
1646 var data = {
1647 action: 'wppm_change_project_visibility',
1648 project_id:proj_id,
1649 project_visibility:project_visibility,
1650 _ajax_nonce:jQuery('#wppm_proj_visibility_ajax_nonce').val()
1651 };
1652 jQuery.post(wppm_admin.ajax_url, data, function() {
1653 });
1654 }
1655
1656 function wppm_apply_project_filter(){
1657 wppm_project_filter = jQuery('#wppm_project_filter').find(":selected").val();
1658 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1659 var data = {
1660 action: 'wppm_get_project_list',
1661 wppm_project_filter:wppm_project_filter
1662 };
1663 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1664 jQuery('#wppm_project_container').html(response);
1665 });
1666 }
1667
1668 function wppm_apply_task_filter(){
1669 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1670 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1671 var data = {
1672 action: 'wppm_get_task_list',
1673 wppm_task_filter:wppm_task_filter
1674 };
1675 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1676 jQuery('#wppm_task_container').html(response);
1677 });
1678 }
1679
1680 function wppm_tl_reset_filter(){
1681 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1682 var data = {
1683 action: 'wppm_get_task_list',
1684 wppm_task_filter:'all',
1685 task_search:"",
1686 sort_by:"task_name",
1687 order:"ASC",
1688 wppm_proj_filter:0
1689 };
1690 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1691 jQuery('#wppm_task_container').html(response);
1692 });
1693 }
1694
1695 function wppm_apply_task_filter_grid_view(){
1696 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1697 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1698 var data = {
1699 action: 'wppm_view_project_tasks',
1700 wppm_task_filter:wppm_task_filter
1701 };
1702 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1703 jQuery('#wppm_task_container').html(response);
1704 });
1705 }
1706
1707 function wppm_tl_reset_grid_view_filter(){
1708 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1709 var data = {
1710 action: 'wppm_view_project_tasks',
1711 wppm_task_filter:'all',
1712 task_search:"",
1713 sort_by:"task_name",
1714 order:"ASC",
1715 wppm_proj_filter:"0"
1716 };
1717 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1718 jQuery('#wppm_task_container').html(response);
1719 });
1720 }
1721
1722 function wppm_pl_reset_filter(){
1723 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1724 var data = {
1725 action: 'wppm_get_project_list',
1726 wppm_project_filter:'all',
1727 project_search:"",
1728 sort_by:"project_name",
1729 order:"ASC"
1730 };
1731 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1732 jQuery('#wppm_project_container').html(response);
1733 });
1734 }
1735
1736 function wppm_tasks_by_select_project(){
1737 wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val();
1738 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1739 var data = {
1740 action: 'wppm_get_task_list',
1741 wppm_proj_filter:wppm_proj_filter
1742 };
1743 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1744 jQuery('#wppm_task_container').html(response);
1745 });
1746 }
1747
1748 function wppm_tasks_by_select_project_grid_view(){
1749 wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val();
1750 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1751 var data = {
1752 action: 'wppm_view_project_tasks',
1753 wppm_proj_filter:wppm_proj_filter
1754 };
1755 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1756 jQuery('#wppm_task_container').html(response);
1757 });
1758 }
1759
1760 function wppm_reset_ap_proj_list(){
1761 jQuery( "#wppm_reset_ap_proj_list_btn" ).text( wppm_admin.please_wait );
1762 var _ajax_nonce = jQuery("#wppm_reset_ap_proj_list_nonce").val();
1763 var data = { action: 'wppm_reset_ap_proj_list',_ajax_nonce };
1764 jQuery.post(
1765 wppm_admin.ajax_url,
1766 data,
1767 function () {
1768 wppm_get_ap_proj_list('project-list');
1769 }
1770 );
1771 }
1772
1773 function wppm_reset_ap_task_list(){
1774 jQuery( "#wppm_reset_ap_task_list_btn" ).text( wppm_admin.please_wait );
1775 var _ajax_nonce = jQuery("#wppm_reset_ap_task_list_ajax_nonce").val();
1776 var data = { action: 'wppm_reset_ap_task_list',_ajax_nonce };
1777 jQuery.post(
1778 wppm_admin.ajax_url,
1779 data,
1780 function () {
1781 wppm_get_ap_task_list('task-list');
1782 }
1783 );
1784 }
1785
1786 function wppm_reset_ap_individual_proj(){
1787 jQuery( "#wppm_reset_ap_individual_proj_btn" ).text( wppm_admin.please_wait );
1788 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_proj_ajax_nonce").val();
1789 var data = { action: 'wppm_reset_ap_individual_proj',
1790 _ajax_nonce, };
1791 jQuery.post(
1792 wppm_admin.ajax_url,
1793 data,
1794 function () {
1795 wppm_get_ap_individual_proj('individual-project');
1796 }
1797 );
1798 }
1799
1800 function wppm_reset_ap_individual_task(){
1801 jQuery( "#wppm_reset_ap_individual_task_btn" ).text( wppm_admin.please_wait );
1802 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_task_ajax_nonce" ).val();
1803 var data = { action: 'wppm_reset_ap_individual_task',_ajax_nonce };
1804 jQuery.post(
1805 wppm_admin.ajax_url,
1806 data,
1807 function () {
1808 wppm_get_ap_individual_task('individual-task');
1809 }
1810 );
1811 }
1812
1813 function wppm_reset_ap_modal_popup(){
1814 jQuery( "#wppm_reset_ap_modal_popup_btn" ).text( wppm_admin.please_wait );
1815 var _ajax_nonce = jQuery( "#wppm_reset_ap_modal_popup_nonce" ).val();
1816 var data = { action: 'wppm_reset_ap_modal_popup',_ajax_nonce };
1817 jQuery.post(
1818 wppm_admin.ajax_url,
1819 data,
1820 function () {
1821 wppm_get_ap_modal_popup('modal-popup');
1822 }
1823 );
1824 }
1825
1826 function wppm_reset_ap_grid_view(){
1827 jQuery( "#wppm_reset_ap_grid_view_btn" ).text( wppm_admin.please_wait );
1828 var wppm_reset_grid_ajax_nonce = jQuery( "#wppm_reset_ap_grid_view_ajax_nonce" ).val();
1829 var data = {
1830 action: 'wppm_reset_ap_grid_view',
1831 wppm_reset_grid_ajax_nonce:wppm_reset_grid_ajax_nonce
1832 };
1833 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1834 wppm_get_ap_grid_view('grid-view');
1835 });
1836 }
1837
1838 function wppm_reset_ap_settings(){
1839 jQuery( "#wppm_reset_ap_settings_btn" ).text( wppm_admin.please_wait );
1840 var _ajax_nonce = jQuery("#wppm_reset_ap_settings_nonce").val();
1841 var data = { action: 'wppm_reset_ap_settings',_ajax_nonce };
1842 jQuery.post(
1843 wppm_admin.ajax_url,
1844 data,
1845 function () {
1846 wppm_get_ap_settings('settings');
1847 }
1848 );
1849 }
1850 /**
1851 * Bulk selector change
1852 */
1853 function wppm_bulk_select_change() {
1854 jQuery("#wppm-bulk-actions-btn").show();
1855 var checked = jQuery(".wppm-bulk-selector").is(":checked");
1856 jQuery(".wppm-bulk-select").prop("checked", checked);
1857 if(!checked){
1858 jQuery("#wppm-bulk-actions-btn").hide();
1859 }
1860 }
1861
1862 function wppm_bulk_change_status(nonce){
1863 var items = jQuery(".wppm-bulk-select:checked");
1864 var checked = items.length === 0 ? false : true;
1865 jQuery(".wppm-bulk-selector").prop("checked", checked);
1866 if (items.length != 0) {
1867 var proj_ids = jQuery(".wppm-bulk-select:checked")
1868 .map(function () {
1869 return this.value;
1870 })
1871 .get();
1872 wppm_modal_open('Change Status');
1873 var data = {
1874 action: "wppm_get_bulk_change_proj_status",
1875 proj_ids,
1876 _ajax_nonce: nonce,
1877 };
1878 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1879 var response = JSON.parse(response_str);
1880 jQuery('#wppm_popup_body').html(response.body);
1881 jQuery('#wppm_popup_footer').html(response.footer);
1882 });
1883 }
1884 }
1885
1886 function wppm_set_bulk_change_project_status(){
1887 var dataform = new FormData(jQuery('#frm_get_bulk_project_change_status')[0]);
1888 wppm_modal_close();
1889 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1890 jQuery.ajax({
1891 url: wppm_admin.ajax_url,
1892 type: 'POST',
1893 data: dataform,
1894 processData: false,
1895 contentType: false
1896 })
1897 .done(function (response_str) {
1898 wppm_get_project_list();
1899 });
1900 }
1901
1902 function wppm_bulk_change_category(nonce){
1903 var items = jQuery(".wppm-bulk-select:checked");
1904 var checked = items.length === 0 ? false : true;
1905 jQuery(".wppm-bulk-selector").prop("checked", checked);
1906 if (items.length != 0) {
1907 var proj_ids = jQuery(".wppm-bulk-select:checked")
1908 .map(function () {
1909 return this.value;
1910 })
1911 .get();
1912 wppm_modal_open('Change Category');
1913 var data = {
1914 action: "wppm_get_bulk_change_proj_cat",
1915 proj_ids,
1916 _ajax_nonce: nonce,
1917 };
1918 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1919 var response = JSON.parse(response_str);
1920 jQuery('#wppm_popup_body').html(response.body);
1921 jQuery('#wppm_popup_footer').html(response.footer);
1922 });
1923 }
1924 }
1925
1926 function wppm_set_bulk_change_project_category(){
1927 var dataform = new FormData(jQuery('#frm_get_bulk_project_change_category')[0]);
1928 wppm_modal_close();
1929 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1930 jQuery.ajax({
1931 url: wppm_admin.ajax_url,
1932 type: 'POST',
1933 data: dataform,
1934 processData: false,
1935 contentType: false
1936 })
1937 .done(function (response_str) {
1938 wppm_get_project_list();
1939 });
1940 }
1941
1942 function wppm_bulk_assign_users(nonce){
1943 var items = jQuery(".wppm-bulk-select:checked");
1944 var checked = items.length === 0 ? false : true;
1945 jQuery(".wppm-bulk-selector").prop("checked", checked);
1946 if (items.length != 0) {
1947 var proj_ids = jQuery(".wppm-bulk-select:checked")
1948 .map(function () {
1949 return this.value;
1950 })
1951 .get();
1952 wppm_modal_open('Assign Co-workers');
1953 var data = {
1954 action: "wppm_get_bulk_assign_users",
1955 proj_ids,
1956 _ajax_nonce: nonce,
1957 };
1958 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1959 var response = JSON.parse(response_str);
1960 jQuery('#wppm_popup_body').html(response.body);
1961 jQuery('#wppm_popup_footer').html(response.footer);
1962 });
1963 }
1964 }
1965
1966 function wppm_set_bulk_project_users(){
1967 var dataform = new FormData(jQuery('#frm_get_bulk_project_users')[0]);
1968 wppm_modal_close();
1969 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1970 jQuery.ajax({
1971 url: wppm_admin.ajax_url,
1972 type: 'POST',
1973 data: dataform,
1974 processData: false,
1975 contentType: false
1976 })
1977 .done(function (response_str) {
1978 wppm_get_project_list();
1979 });
1980 }
1981
1982 function wppm_bulk_delete_project(nonce){
1983 var items = jQuery(".wppm-bulk-select:checked");
1984 var checked = items.length === 0 ? false : true;
1985 jQuery(".wppm-bulk-selector").prop("checked", checked);
1986 if (items.length != 0) {
1987 var proj_ids = jQuery(".wppm-bulk-select:checked")
1988 .map(function () {
1989 return this.value;
1990 })
1991 .get();
1992 wppm_modal_open('Delete Project');
1993 var data = {
1994 action: "wppm_get_bulk_delete_project",
1995 proj_ids,
1996 _ajax_nonce: nonce,
1997 };
1998 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1999 var response = JSON.parse(response_str);
2000 jQuery('#wppm_popup_body').html(response.body);
2001 jQuery('#wppm_popup_footer').html(response.footer);
2002 });
2003 }
2004 }
2005
2006 function wppm_set_delete_bulk_projects(){
2007 var dataform = new FormData(jQuery('#frm_delete_bulk_project')[0]);
2008 wppm_modal_close();
2009 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2010 jQuery.ajax({
2011 url: wppm_admin.ajax_url,
2012 type: 'POST',
2013 data: dataform,
2014 processData: false,
2015 contentType: false
2016 })
2017 .done(function (response_str) {
2018 wppm_get_project_list();
2019 });
2020 }
2021
2022 function wppm_bulk_change_task_status(nonce){
2023 var items = jQuery(".wppm-bulk-select:checked");
2024 var checked = items.length === 0 ? false : true;
2025 jQuery(".wppm-bulk-selector").prop("checked", checked);
2026 if (items.length != 0) {
2027 var task_ids = jQuery(".wppm-bulk-select:checked")
2028 .map(function () {
2029 return this.value;
2030 })
2031 .get();
2032 wppm_modal_open('Change Task Status');
2033 var data = {
2034 action: "wppm_get_bulk_change_task_status",
2035 task_ids,
2036 _ajax_nonce: nonce,
2037 };
2038 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2039 var response = JSON.parse(response_str);
2040 jQuery('#wppm_popup_body').html(response.body);
2041 jQuery('#wppm_popup_footer').html(response.footer);
2042 });
2043 }
2044 }
2045
2046 function wppm_set_bulk_change_task_priority(){
2047 var dataform = new FormData(jQuery('#frm_get_bulk_task_change_priority')[0]);
2048 wppm_modal_close();
2049 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2050 jQuery.ajax({
2051 url: wppm_admin.ajax_url,
2052 type: 'POST',
2053 data: dataform,
2054 processData: false,
2055 contentType: false
2056 })
2057 .done(function (response_str) {
2058 wppm_get_task_list();
2059 });
2060 }
2061
2062 function wppm_set_bulk_change_task_status(){
2063 var dataform = new FormData(jQuery('#frm_get_bulk_task_change_status')[0]);
2064 wppm_modal_close();
2065 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2066 jQuery.ajax({
2067 url: wppm_admin.ajax_url,
2068 type: 'POST',
2069 data: dataform,
2070 processData: false,
2071 contentType: false
2072 })
2073 .done(function (response_str) {
2074 wppm_get_task_list();
2075 });
2076 }
2077
2078 function wppm_bulk_change_task_priority(nonce){
2079 var items = jQuery(".wppm-bulk-select:checked");
2080 var checked = items.length === 0 ? false : true;
2081 jQuery(".wppm-bulk-selector").prop("checked", checked);
2082 if (items.length != 0) {
2083 var task_ids = jQuery(".wppm-bulk-select:checked")
2084 .map(function () {
2085 return this.value;
2086 })
2087 .get();
2088 wppm_modal_open('Change Task Priority');
2089 var data = {
2090 action: "wppm_get_bulk_change_task_priority",
2091 task_ids,
2092 _ajax_nonce: nonce
2093 };
2094 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2095 var response = JSON.parse(response_str);
2096 jQuery('#wppm_popup_body').html(response.body);
2097 jQuery('#wppm_popup_footer').html(response.footer);
2098 });
2099 }
2100 }
2101
2102 function wppm_bulk_delete_task(nonce){
2103 var items = jQuery(".wppm-bulk-select:checked");
2104 var checked = items.length === 0 ? false : true;
2105 jQuery(".wppm-bulk-selector").prop("checked", checked);
2106 if (items.length != 0) {
2107 var task_ids = jQuery(".wppm-bulk-select:checked")
2108 .map(function () {
2109 return this.value;
2110 })
2111 .get();
2112 wppm_modal_open('Delete Task');
2113 var data = {
2114 action: "wppm_get_bulk_delete_task",
2115 task_ids,
2116 _ajax_nonce: nonce,
2117 };
2118 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2119 var response = JSON.parse(response_str);
2120 jQuery('#wppm_popup_body').html(response.body);
2121 jQuery('#wppm_popup_footer').html(response.footer);
2122 });
2123 }
2124 }
2125
2126 function wppm_set_delete_bulk_tasks(){
2127 var dataform = new FormData(jQuery('#frm_delete_bulk_tasks')[0]);
2128 wppm_modal_close();
2129 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2130 jQuery.ajax({
2131 url: wppm_admin.ajax_url,
2132 type: 'POST',
2133 data: dataform,
2134 processData: false,
2135 contentType: false
2136 })
2137 .done(function (response_str) {
2138 wppm_get_task_list();
2139 });
2140 }