PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 6.0.0
Taskbuilder – Project Management & Task Management Tool With Kanban Board v6.0.0
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 6.0.0, at asset/js/admin.js

2,532 lines 76.0 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 function wppm_get_page_settings(){
43 jQuery('.wppm_setting_pills li').removeClass('active');
44 jQuery('#wppm_settings_page').addClass('active');
45 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
46 var data = {
47 action: 'wppm_get_page_setings'
48 };
49 jQuery.post(wppm_admin.ajax_url, data, function(response) {
50 jQuery('.wppm_setting_col2').html(response);
51 });
52 }
53
54 function wppm_set_page_settings(){
55 jQuery('.wppm_submit_wait').show();
56 var dataform = new FormData(jQuery('#wppm-frm-ps')[0]);
57 jQuery.ajax({
58 url: wppm_admin.ajax_url,
59 type: 'POST',
60 data: dataform,
61 processData: false,
62 contentType: false
63 })
64 .done(function (response_str) {
65 var response = JSON.parse(response_str);
66 jQuery('.wppm_submit_wait').hide();
67 if (response.sucess_status=='1') {
68 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
69 }
70 jQuery('#wppm_alert_success').slideDown('fast',function(){});
71 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
72 });
73 }
74
75 /*
76 * Category Settings
77 */
78 function wppm_get_category_settings(){
79 jQuery('.wppm_setting_pills li').removeClass('active');
80 jQuery('#wppm_settings_category').addClass('active');
81 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
82 var data = {
83 action: 'wppm_get_category_settings'
84 };
85 jQuery.post(wppm_admin.ajax_url, data, function(response) {
86 jQuery('.wppm_setting_col2').html(response);
87 });
88 }
89
90 /**
91 * Delete category
92 */
93 function wppm_delete_category(cat_id) {
94
95 const flag = confirm(wppm_admin.confirm);
96 if (!flag) return;
97
98 var data = { action: 'wppm_delete_category',
99 cat_id,
100 _ajax_nonce:jQuery('#wppm_delete_cat_ajax_nonce').val()
101 };
102 jQuery.post(wppm_admin.ajax_url, data, function (res) {
103 wppm_get_category_settings();
104 });
105 }
106
107 function wppm_get_proj_status_settings(){
108 jQuery('.wppm_setting_pills li').removeClass('active');
109 jQuery('#wppm_settings_proj_status').addClass('active');
110 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
111 var data = {
112 action: 'wppm_get_proj_status_settings'
113 };
114 jQuery.post(wppm_admin.ajax_url, data, function(response) {
115 jQuery('.wppm_setting_col2').html(response);
116 });
117 }
118
119 function wppm_get_add_proj_status(){
120 wppm_modal_open(wppm_admin.add_new_status);
121 var data = {
122 action: 'wppm_get_add_proj_status'
123 };
124 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
125 var response = JSON.parse(response_str);
126 jQuery('#wppm_popup_body').html(response.body);
127 jQuery('#wppm_popup_footer').html(response.footer);
128 jQuery('#wppm_proj_status_name').focus();
129 });
130 }
131
132 function wppm_delete_proj_status(status_id){
133 const flag = confirm(wppm_admin.confirm);
134 if (!flag) return;
135
136 var data = { action: 'wppm_delete_status', status_id,
137 _ajax_nonce:jQuery('#wppm_delete_pstatus_ajax_nonce').val()
138 };
139 jQuery.post(wppm_admin.ajax_url, data, function (res) {
140 wppm_get_proj_status_settings();
141 });
142 }
143
144 function wppm_set_project_users(){
145 var dataform = new FormData(jQuery('#frm_get_project_users')[0]);
146 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
147 var proj_id = jQuery('#wppm_proj_id').val();
148 jQuery.ajax({
149 url: wppm_admin.ajax_url,
150 type: 'POST',
151 data: dataform,
152 processData: false,
153 contentType: false
154 })
155 .done(function () {
156 wppm_modal_close();
157 wppm_open_project(proj_id);
158 });
159 }
160
161 function wppm_set_task_users(proj_id,project_id){
162 var dataform = new FormData(jQuery('#frm_get_task_users')[0]);
163 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
164 var task_id = jQuery('#wppm_task_id').val();
165 jQuery.ajax({
166 url: wppm_admin.ajax_url,
167 type: 'POST',
168 data: dataform,
169 processData: false,
170 contentType: false
171 })
172 .done(function () {
173 if((proj_id!=0)||(proj_id!="")){
174 wppm_task_modal_close();
175 wppm_open_project_tasks(task_id,proj_id);
176 }else if((proj_id==0)||(proj_id=="")){
177 wppm_task_modal_close();
178 wppm_open_task(task_id,project_id);
179 }
180 });
181 }
182
183 function wppm_get_project_list(page_no){
184 jQuery('#wppm_project_container').show();
185 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
186 var dataform=new FormData(jQuery('#wppm_project_list_frm')[0]);
187 dataform.append("page_no", page_no);
188 dataform.append("action", 'wppm_get_project_list');
189 dataform.append("page", wppm_admin.page);
190 jQuery.ajax( {
191 url: wppm_admin.ajax_url,
192 type: 'POST',
193 data: dataform,
194 processData: false,
195 contentType: false
196 })
197 .done(function( response ) {
198 jQuery('#wppm_project_container').html(response);
199 });
200 }
201
202 function wppm_add_new_task(proj_id,project_id){
203 jQuery('#wppm_task_container').show();
204 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
205 var data = {
206 action: 'wppm_add_new_task',
207 proj_id:proj_id,
208 project_id:project_id
209 };
210 jQuery.post(wppm_admin.ajax_url, data, function(response) {
211 jQuery('#wppm_task_container').html(response);
212 });
213 }
214
215 function wppm_get_task_list(page_no,id){
216 jQuery('#wppm_task_container').show();
217 // window.history.replaceState( {}, null, 'admin.php?page=wppm-tasks&section=task-list' );
218 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
219 var data = {
220 action: 'wppm_get_task_list',
221 page_no:page_no,
222 page:wppm_admin.page,
223 project_id:id
224 };
225 jQuery.post(wppm_admin.ajax_url, data, function(response) {
226 jQuery('#wppm_task_container').html(response);
227 });
228 }
229
230 function wppm_get_task_prioriy_settings(){
231 jQuery('.wppm_setting_pills li').removeClass('active');
232 jQuery('#wppm_settings_task_priorities').addClass('active');
233 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
234 var data = {
235 action: 'wppm_get_priority_settings'
236 };
237 jQuery.post(wppm_admin.ajax_url, data, function(response) {
238 jQuery('.wppm_setting_col2').html(response);
239 });
240 }
241
242 function wppm_add_task_priority(){
243 wppm_modal_open(wppm_admin.add_new_priority);
244 var data = {
245 action: 'wppm_add_task_priority'
246 };
247 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
248 var response = JSON.parse(response_str);
249 jQuery('#wppm_popup_body').html(response.body);
250 jQuery('#wppm_popup_footer').html(response.footer);
251 jQuery('#wppm_cat_name').focus();
252 });
253 }
254
255 function wppm_delete_task_priority(priority_id){
256 const flag = confirm(wppm_admin.confirm);
257 if (!flag) return;
258
259 var data = { action: 'wppm_delete_task_priority', priority_id,
260 _ajax_nonce:jQuery('#wppm_delete_tprio_ajax_nonce').val()
261 };
262 jQuery.post(wppm_admin.ajax_url, data, function (res) {
263 wppm_get_task_prioriy_settings();
264 });
265 }
266
267 function wppm_get_task_status_settings(){
268 jQuery('.wppm_setting_pills li').removeClass('active');
269 jQuery('#wppm_settings_task_status').addClass('active');
270 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
271 var data = {
272 action: 'wppm_get_task_status_settings'
273 };
274 jQuery.post(wppm_admin.ajax_url, data, function(response) {
275 jQuery('.wppm_setting_col2').html(response);
276 });
277 }
278
279 function wppm_get_add_task_status(){
280 wppm_modal_open(wppm_admin.add_new_status);
281 var data = {
282 action: 'wppm_get_add_task_status'
283 };
284 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
285 var response = JSON.parse(response_str);
286 jQuery('#wppm_popup_body').html(response.body);
287 jQuery('#wppm_popup_footer').html(response.footer);
288 jQuery('#wppm_cat_name').focus();
289 });
290 }
291
292 function wppm_delete_task_status(status_id){
293 const flag = confirm(wppm_admin.confirm);
294 if (!flag) return;
295
296 var data = { action: 'wppm_delete_task_status', status_id,
297 _ajax_nonce: jQuery('#wppm_delete_tstatus_ajax_nonce').val()};
298 jQuery.post(wppm_admin.ajax_url, data, function (res) {
299 wppm_get_task_status_settings();
300 });
301 }
302
303 function wppm_task_search_filter(page){
304 var task_search = jQuery("#wppm_task_search_filter").val();
305 jQuery('#wppm_task_container').show();
306 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
307 var data = {
308 action: 'wppm_get_task_list',
309 task_search:task_search,
310 page:page
311 };
312 jQuery.post(wppm_admin.ajax_url, data, function(response) {
313 jQuery('#wppm_task_container').html(response);
314 });
315 }
316
317 function wppm_view_task_search_filter(page_no,page,proj_id){
318 var task_search = jQuery("#wppm_view_task_search_filter").val() || '';
319 jQuery('#wppm_task_container').show();
320 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
321
322 var data = {
323 action: 'wppm_get_task_list_card_view',
324 task_search:task_search,
325 page_no:page_no,
326 page:page,
327 project_id:proj_id
328 };
329 jQuery.post(wppm_admin.ajax_url, data, function(response) {
330 jQuery('#wppm_task_container').html(response);
331 });
332 }
333
334 function wppm_open_task(id,proj_id){
335 jQuery('#wppm_task_container').show();
336 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
337 var data = {
338 action: 'wppm_open_task',
339 id:id,
340 auth_code: wppm_admin.auth_code,
341 page:wppm_admin.page,
342 project_id:proj_id
343 };
344 jQuery.post(wppm_admin.ajax_url, data, function(response) {
345 jQuery('#wppm_task_container').html(response);
346 });
347 }
348
349 function wppm_open_dashboard_task(id){
350 window.location.href = 'admin.php?page=wppm-tasks&task_id=' + id;
351 }
352
353 function wppm_open_project_tasks(id,proj_id){
354 wppm_modal_open('Open Tasks');
355 jQuery('#wppm_task_container').show();
356 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
357 var data = {
358 action: 'wppm_open_task',
359 id: id,
360 proj_id:proj_id
361 }
362 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
363 jQuery('#wppm_popup_body').html(response_str);
364 //jQuery('#wppm_task_container').html(response_str);
365 });
366 }
367
368 function wppm_add_new_checklist(task_id,proj_id){
369 if(jQuery('#wppm_checklist_label').val()==''){
370 jQuery('#wppm_checklist_label').focus();
371 return false;
372 }
373 var data = {
374 action: 'wppm_add_new_checklist',
375 task_id: task_id,
376 proj_id: proj_id,
377 checklist_name: jQuery('#wppm_checklist_label').val(),
378 _ajax_nonce:jQuery('#wppm_checklist_ajax_nonce').val()
379 };
380 jQuery.post(wppm_admin.ajax_url, data, function(response) {
381 if((proj_id!=0)||(proj_id!="")){
382 //wppm_modal_close();
383 wppm_open_project_tasks(task_id,proj_id);
384 }else if((proj_id==0)||(proj_id=="")){
385 //wppm_modal_close();
386 wppm_open_task(task_id);
387 }
388 });
389 }
390
391 function wppm_add_new_checklist_item(checklist_id,task_id,proj_id){
392 if(jQuery('#wppm_checklist_item_label_'+checklist_id).val()==''){
393 jQuery('#wppm_checklist_item_label_'+checklist_id).focus();
394 return false;
395 }
396 var data = {
397 action: 'wppm_add_new_checklist_item',
398 checklist_id: checklist_id,
399 proj_id:proj_id,
400 label: jQuery('#wppm_checklist_item_label_'+checklist_id).val(),
401 _ajax_nonce:jQuery('#wppm_checklist_item_ajax_nonce').val()
402 };
403 jQuery.post(wppm_admin.ajax_url, data, function(response) {
404 if((proj_id!=0)||(proj_id!="")){
405 wppm_open_project_tasks(task_id,proj_id);
406 }else if((proj_id==0)||(proj_id=="")){
407 wppm_open_task(task_id);
408 }
409 });
410 }
411
412 function wppm_delete_checklist(checklist_id,task_id,proj_id){
413 const flag = confirm(wppm_admin.confirm);
414 if (!flag) return;
415 var data = {
416 action: 'wppm_delete_checklist',
417 checklist_id: checklist_id,
418 task_id:task_id,
419 proj_id:proj_id,
420 _ajax_nonce:jQuery('#wppm_delete_checklist_ajax_nonce').val()
421 };
422 jQuery.post(wppm_admin.ajax_url, data, function(response) {
423 if((proj_id!=0)||(proj_id!="")){
424 wppm_open_project_tasks(task_id,proj_id);
425 }else if((proj_id==0)||(proj_id=="")){
426 wppm_open_task(task_id);
427 }
428 });
429 }
430
431 function wppm_delete_checklist_item(item_id,checklist_id,proj_id,task_id){
432 const flag = confirm(wppm_admin.confirm);
433 if (!flag) return;
434 var data = {
435 action: 'wppm_remove_checklist_item',
436 item_id:item_id,
437 checklist_id: checklist_id,
438 proj_id:proj_id,
439 task_id:task_id,
440 _ajax_nonce:jQuery('#wppm_delete_checklist_item_ajax_nonce').val()
441 };
442 jQuery.post(wppm_admin.ajax_url, data, function(response) {
443 if((proj_id!=0)||(proj_id!="")){
444 wppm_open_project_tasks(task_id,proj_id);
445 }else if((proj_id==0)||(proj_id=="")){
446 wppm_open_task(task_id);
447 }
448 });
449 }
450
451 function wppm_checklist_progress(checklist_id,item_id,task_id){
452 var $checkboxes = jQuery('.wppm_checklist_item_'+checklist_id);
453 var $progress = jQuery('#CheckProgress_'+checklist_id);
454 var total = $checkboxes.length;
455 var checked = jQuery('.wppm_checklist_item_'+checklist_id).filter(':checked').length;
456 var progressWidth = (checked / total) * 100;
457 var checked_item;
458 jQuery('#CheckProgress_'+checklist_id).css('background','#5ba4cf');
459 jQuery('#CheckProgress_'+checklist_id).css('width', progressWidth + '%');
460 if (jQuery("#wppm_checklist_item_"+item_id).prop("checked")==true) {
461 checked_item=1;
462 }else{
463 checked_item=0;
464 }
465 var data = {
466 action: 'wppm_set_checklist_progress',
467 checklist_id: checklist_id,
468 item_id:item_id,
469 checked_item: checked_item,
470 _ajax_nonce:jQuery('#wppm_checklist_progress_ajax_nonce').val()
471 };
472 jQuery.post(wppm_admin.ajax_url, data, function(response) {
473 wppm_open_task(task_id);
474 });
475 }
476
477 function wppm_open_individual_task(id){
478 jQuery('#wppm_project_container').show();
479 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
480 var data = {
481 action: 'wppm_open_task',
482 id:id
483 };
484 jQuery.post(wppm_admin.ajax_url, data, function(response) {
485 jQuery('#wppm_project_container').html(response);
486 });
487 }
488
489
490 function wppm_display_grid_view(page,id){
491 var task_search = jQuery("#wppm_view_task_search_filter").val() || '';
492 jQuery('#wppm_task_container').show();
493 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
494 var data = {
495 action: 'wppm_get_task_list_card_view',
496 task_search: task_search,
497 page:page,
498 id:id
499 };
500 jQuery.post(wppm_admin.ajax_url, data, function(response) {
501 jQuery('#wppm_task_container').html(response);
502 });
503 }
504
505 function wppm_remove_filter(id){
506 jQuery('#wppm_user_display_container_'+id).remove();
507 }
508
509 function wppm_remove_user_from_project(id){
510 jQuery('#wppm_user_container_'+id).remove();
511 }
512
513 function wppm_remove_task_user_filter(id){
514 jQuery('#wppm_task_user_display_container_'+id).remove();
515 }
516
517 function wppm_attachment_cancel( obj ){
518 jQuery(obj).parent().remove();
519 }
520
521 function wppm_get_en_general_setting(){
522 jQuery('.wppm_setting_pills li').removeClass('active');
523 jQuery('#wppm_en_setting_general').addClass('active');
524 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
525
526 var data = {
527 action: 'wppm_get_en_general_setting',
528 };
529
530 jQuery.post(wppm_admin.ajax_url, data, function(response) {
531 jQuery('.wppm_setting_col2').html(response);
532 });
533 }
534
535 function wppm_set_en_general_settings(){
536 jQuery('.wppm_submit_wait').show();
537 var dataform = new FormData(jQuery('#wppm_en_frm_general_settings')[0]);
538
539 jQuery.ajax({
540 url: wppm_admin.ajax_url,
541 type: 'POST',
542 data: dataform,
543 processData: false,
544 contentType: false
545 })
546 .done(function (response_str) {
547 var response = JSON.parse(response_str);
548 jQuery('.wppm_submit_wait').hide();
549 if (response.sucess_status=='1') {
550 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
551 }
552 jQuery('#wppm_alert_success').slideDown('fast',function(){});
553 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
554 });
555 }
556
557 function wppm_get_en_task_notifications(){
558 jQuery('.wppm_setting_pills li').removeClass('active');
559 jQuery('#wppm_en_ticket_notifications').addClass('active');
560 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
561
562 var data = {
563 action: 'wppm_get_en_task_notifications'
564 };
565
566 jQuery.post(wppm_admin.ajax_url, data, function(response) {
567 jQuery('.wppm_setting_col2').html(response);
568 });
569 }
570
571 function wppm_edit_task_status(id,proj_id,project_id){
572 if(proj_id==0){
573 wppm_task_modal_open('Edit');
574 }else{
575 wppm_modal_open('Edit');
576 }
577 var data = {
578 action: 'wppm_edit_task_status',
579 task_id: id,
580 proj_id:proj_id,
581 project_id:project_id
582 }
583 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
584 var response = JSON.parse(response_str);
585 if(proj_id==0){
586 jQuery('#wppm_task_popup_body').html(response.body);
587 jQuery('#wppm_task_popup_footer').html(response.footer);
588 }else{
589 jQuery('#wppm_popup_body').html(response.body);
590 jQuery('#wppm_popup_footer').html(response.footer);
591 }
592 });
593 }
594
595 function wppm_edit_task_users(task_id,proj_id,project_id){
596 if(proj_id==0){
597 wppm_task_modal_open('Add Users');
598 }else{
599 wppm_modal_open('Add Users');
600 }
601 var data = {
602 action: 'wppm_get_task_users',
603 task_id: task_id,
604 proj_id:proj_id,
605 project_id:project_id
606 }
607 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
608 var response = JSON.parse(response_str);
609 if(proj_id==0){
610 jQuery('#wppm_task_popup_body').html(response.body);
611 jQuery('#wppm_task_popup_footer').html(response.footer);
612 }else{
613 jQuery('#wppm_popup_body').html(response.body);
614 jQuery('#wppm_popup_footer').html(response.footer);
615 }
616 });
617 }
618
619 function wppm_edit_task_details(id,proj_id,project_id){
620 if(proj_id==0){
621 wppm_task_modal_open('Edit Task Details');
622 }else{
623 wppm_modal_open('Edit Task Details');
624 }
625 var data = {
626 action: 'wppm_edit_task_details',
627 task_id: id,
628 proj_id:proj_id,
629 project_id:project_id
630 }
631 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
632 var response = JSON.parse(response_str);
633 if(proj_id==0){
634 jQuery('#wppm_task_popup_body').html(response.body);
635 jQuery('#wppm_task_popup_footer').html(response.footer);
636 }else{
637 jQuery('#wppm_popup_body').html(response.body);
638 jQuery('#wppm_popup_footer').html(response.footer);
639 }
640 });
641 }
642
643 function wppm_set_change_task_status(task_id,proj_id,project_id){
644 var dataform = new FormData(jQuery('#frm_get_task_change_status')[0]);
645 if(proj_id == 0){
646 wppm_task_modal_close();
647 }else{
648 wppm_modal_close();
649 }
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,project_id);
663 }
664
665 });
666 }
667
668 function wppm_edit_task_creator(task_id,proj_id,project_id){
669 if(proj_id==0){
670 wppm_task_modal_open('Edit Task Creator');
671 }else{
672 wppm_modal_open('Edit Task Creator');
673 }
674 var data = {
675 action: 'wppm_edit_task_creator',
676 task_id: task_id,
677 proj_id: proj_id,
678 project_id: project_id
679 }
680 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
681 var response = JSON.parse(response_str);
682 if(proj_id==0){
683 jQuery('#wppm_task_popup_body').html(response.body);
684 jQuery('#wppm_task_popup_footer').html(response.footer);
685 }else{
686 jQuery('#wppm_popup_body').html(response.body);
687 jQuery('#wppm_popup_footer').html(response.footer);
688 }
689 });
690 }
691
692 function wppm_set_change_raised_by(task_id,proj_id,project_id){
693 var dataform = new FormData(jQuery('#frm_get_task_creator')[0]);
694 if(proj_id==0){
695 wppm_task_modal_close();
696 }else{
697 wppm_modal_close();
698 }
699 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
700 jQuery.ajax({
701 url: wppm_admin.ajax_url,
702 type: 'POST',
703 data: dataform,
704 processData: false,
705 contentType: false
706 })
707 .done(function (response_str) {
708 if((proj_id!=0)||(proj_id!="")){
709 wppm_open_project_tasks(task_id,proj_id);
710 }else if((proj_id==0)||(proj_id=="")){
711 wppm_open_task(task_id,project_id);
712 }
713 });
714 }
715
716 function wppm_set_change_task_details(task_id, proj_id, project_id) {
717 var dataform = new FormData(jQuery('#frm_get_edit_task_deatils')[0]);
718 var editor = tinyMCE.get('wppm_edit_task_description');
719 var description = '';
720 if (editor) {
721 description = editor.getContent().trim();
722 } else {
723 description = jQuery('#wppm_edit_task_description').val().trim();
724 }
725 dataform.append('wppm_edit_task_description', description);
726 if (proj_id == 0) {
727 wppm_task_modal_close();
728 } else {
729 wppm_modal_close();
730 }
731 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
732 jQuery.ajax({
733 url: wppm_admin.ajax_url,
734 type: 'POST',
735 data: dataform,
736 processData: false,
737 contentType: false
738 }).done(function(response_str) {
739 if (proj_id != 0 && proj_id != "") {
740 wppm_open_project_tasks(task_id, proj_id);
741 } else {
742 wppm_open_task(task_id, project_id);
743 }
744 });
745 }
746
747 function wppm_edit_thread(comment_id,task_id,proj_id){
748 if(proj_id==0){
749 wppm_task_modal_open('Edit Thread');
750 }else{
751 wppm_modal_open('Edit Thread');
752 }
753 var data = {
754 action: 'wppm_edit_task_thread',
755 comment_id:comment_id,
756 task_id: task_id,
757 proj_id: proj_id
758 }
759 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
760 var response = JSON.parse(response_str);
761 if(proj_id==0){
762 jQuery('#wppm_task_popup_body').html(response.body);
763 jQuery('#wppm_task_popup_footer').html(response.footer);
764 }else{
765 jQuery('#wppm_popup_body').html(response.body);
766 jQuery('#wppm_popup_footer').html(response.footer);
767 }
768 });
769 }
770
771 function wppm_edit_proj_thread(comment_id,proj_id){
772 wppm_modal_open('Edit Thread');
773 var data = {
774 action: 'wppm_edit_proj_thread',
775 comment_id:comment_id,
776 proj_id: proj_id
777 }
778 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
779 var response = JSON.parse(response_str);
780 jQuery('#wppm_popup_body').html(response.body);
781 jQuery('#wppm_popup_footer').html(response.footer);
782 });
783 }
784
785 function wppm_set_edit_task_thread(task_id,proj_id){
786 var dataform = new FormData(jQuery('#frm_edit_task_thread')[0]);
787 if(wppm_admin.rich_text_editor == 1){
788 var comment_body = tinyMCE.get('wppm_edit_task_thread_editor').getContent().trim();
789 }else{
790 var comment_body = jQuery('#wppm_edit_task_thread_editor').val().trim();
791 }
792 dataform.append('wppm_edit_task_thread', comment_body);
793 if(proj_id==0){
794 wppm_task_modal_close();
795 }else{
796 wppm_modal_close();
797 }
798 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
799 jQuery.ajax({
800 url: wppm_admin.ajax_url,
801 type: 'POST',
802 data: dataform,
803 processData: false,
804 contentType: false
805 })
806 .done(function (response_str) {
807 if((proj_id!=0)||(proj_id!="")){
808 wppm_open_project_tasks(task_id,proj_id);
809 }else if((proj_id==0)||(proj_id=="")){
810 wppm_open_task(task_id);
811 }
812 });
813 }
814
815 function wppm_set_edit_proj_thread(proj_id){
816 var dataform = new FormData(jQuery('#frm_edit_proj_thread')[0]);
817 if(wppm_admin.rich_text_editor == 1){
818 var comment_body = tinyMCE.get('wppm_edit_proj_thread_editor').getContent().trim();
819 }else{
820 var comment_body = jQuery('#wppm_edit_proj_thread_editor').val().trim();
821 }
822 dataform.append('wppm_edit_proj_thread', comment_body);
823 wppm_modal_close();
824 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
825 jQuery.ajax({
826 url: wppm_admin.ajax_url,
827 type: 'POST',
828 data: dataform,
829 processData: false,
830 contentType: false
831 })
832 .done(function (response_str) {
833 wppm_open_project(proj_id);
834 });
835 }
836
837 function wppm_delete_thread(comment_id,task_id,proj_id){
838 if(proj_id==0){
839 wppm_task_modal_open('Delete Thread');
840 }else{
841 wppm_modal_open('Delete Thread');
842 }
843 var data = {
844 action: 'wppm_delete_task_thread',
845 comment_id:comment_id,
846 task_id: task_id,
847 proj_id:proj_id
848 }
849 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
850 var response = JSON.parse(response_str);
851 if(proj_id==0){
852 jQuery('#wppm_task_popup_body').html(response.body);
853 jQuery('#wppm_task_popup_footer').html(response.footer);
854 }else{
855 jQuery('#wppm_popup_body').html(response.body);
856 jQuery('#wppm_popup_footer').html(response.footer);
857 }
858 });
859 }
860
861 function wppm_delete_proj_thread(comment_id,proj_id){
862 wppm_modal_open('Delete Thread');
863 var data = {
864 action: 'wppm_delete_proj_thread',
865 comment_id:comment_id,
866 proj_id:proj_id
867 }
868 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
869 var response = JSON.parse(response_str);
870 jQuery('#wppm_popup_body').html(response.body);
871 jQuery('#wppm_popup_footer').html(response.footer);
872 });
873 }
874
875 function wppm_set_delete_thread(task_id,proj_id){
876 var dataform = new FormData(jQuery('#frm_delete_task_thread')[0]);
877 if(proj_id==0){
878 wppm_task_modal_close();
879 }else{
880 wppm_modal_close();
881 }
882 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
883 jQuery.ajax({
884 url: wppm_admin.ajax_url,
885 type: 'POST',
886 data: dataform,
887 processData: false,
888 contentType: false
889 })
890 .done(function (response_str) {
891 if((proj_id!=0)||(proj_id!="")){
892 wppm_open_project_tasks(task_id,proj_id);
893 }else if((proj_id==0)||(proj_id=="")){
894 wppm_open_task(task_id);
895 }
896 });
897 }
898
899 function wppm_set_delete_proj_thread(proj_id){
900 var dataform = new FormData(jQuery('#frm_delete_proj_thread')[0]);
901 wppm_modal_close();
902 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
903 jQuery.ajax({
904 url: wppm_admin.ajax_url,
905 type: 'POST',
906 data: dataform,
907 processData: false,
908 contentType: false
909 })
910 .done(function (response_str) {
911 wppm_open_project(proj_id);
912 });
913 }
914
915 function wppm_edit_proj_details(id){
916 wppm_modal_open('Edit Project Details');
917 var data = {
918 action: 'wppm_edit_project_details',
919 id: id
920 }
921 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
922 var response = JSON.parse(response_str);
923 jQuery('#wppm_popup_body').html(response.body);
924 jQuery('#wppm_popup_footer').html(response.footer);
925 });
926 }
927
928 function wppm_set_change_project_details(id){
929 var dataform = new FormData(jQuery('#frm_get_edit_project_deatils')[0]);
930 var description = tinyMCE.get('wppm_edit_project_description').getContent().trim();
931 dataform.append('wppm_edit_project_description', description);
932 wppm_modal_close();
933 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
934 jQuery.ajax({
935 url: wppm_admin.ajax_url,
936 type: 'POST',
937 data: dataform,
938 processData: false,
939 contentType: false
940 })
941 .done(function (response_str) {
942 wppm_open_project(id);
943 });
944 }
945
946 function wppm_edit_project_status(id){
947 wppm_modal_open('Edit Project Status');
948 var data = {
949 action: 'wppm_edit_project_status',
950 id: id
951 }
952 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
953 var response = JSON.parse(response_str);
954 jQuery('#wppm_popup_body').html(response.body);
955 jQuery('#wppm_popup_footer').html(response.footer);
956 });
957 }
958
959 function wppm_set_change_project_status(id){
960 var dataform = new FormData(jQuery('#frm_get_project_change_status')[0]);
961 wppm_modal_close();
962 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
963 jQuery.ajax({
964 url: wppm_admin.ajax_url,
965 type: 'POST',
966 data: dataform,
967 processData: false,
968 contentType: false
969 })
970 .done(function (response_str) {
971 wppm_open_project(id);
972 });
973 }
974
975 function wppm_edit_project_creator(id){
976 wppm_modal_open('Edit Project Creator');
977 var data = {
978 action: 'wppm_edit_project_creator',
979 id: id
980 }
981 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
982 var response = JSON.parse(response_str);
983 jQuery('#wppm_popup_body').html(response.body);
984 jQuery('#wppm_popup_footer').html(response.footer);
985 });
986 }
987
988 function wppm_set_change_project_raised_by(id){
989 var dataform = new FormData(jQuery('#frm_get_project_creator')[0]);
990 wppm_modal_close();
991 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
992 jQuery.ajax({
993 url: wppm_admin.ajax_url,
994 type: 'POST',
995 data: dataform,
996 processData: false,
997 contentType: false
998 })
999 .done(function (response_str) {
1000 wppm_open_project(id);
1001 });
1002 }
1003
1004 function wppm_edit_project_users(id){
1005 wppm_modal_open('Add Users');
1006 var data = {
1007 action: 'wppm_get_project_users',
1008 id: id
1009 }
1010 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1011 var response = JSON.parse(response_str);
1012 jQuery('#wppm_popup_body').html(response.body);
1013 jQuery('#wppm_popup_footer').html(response.footer);
1014 });
1015 }
1016
1017 function wppm_delete_project(id){
1018 wppm_modal_open('Delete Project');
1019 var data = {
1020 action: 'wppm_get_delete_project',
1021 id: id
1022 }
1023 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1024 var response = JSON.parse(response_str);
1025 jQuery('#wppm_popup_body').html(response.body);
1026 jQuery('#wppm_popup_footer').html(response.footer);
1027 });
1028 }
1029
1030 function wppm_set_delete_project(){
1031 var dataform = new FormData(jQuery('#frm_delete_project')[0]);
1032 wppm_modal_close();
1033 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1034 jQuery.ajax({
1035 url: wppm_admin.ajax_url,
1036 type: 'POST',
1037 data: dataform,
1038 processData: false,
1039 contentType: false
1040 })
1041 .done(function (response_str) {
1042 wppm_get_project_list();
1043 });
1044 }
1045
1046 function wppm_get_delete_task(id,proj_id,project_id){
1047 if(proj_id==0){
1048 wppm_task_modal_open('Delete Task');
1049 }else{
1050 wppm_modal_open('Delete Task');
1051 }
1052 var data = {
1053 action: 'wppm_get_delete_task',
1054 id: id,
1055 proj_id:proj_id,
1056 project_id:project_id
1057 }
1058 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1059 var response = JSON.parse(response_str);
1060 if(proj_id==0){
1061 jQuery('#wppm_task_popup_body').html(response.body);
1062 jQuery('#wppm_task_popup_footer').html(response.footer);
1063 }else{
1064 jQuery('#wppm_popup_body').html(response.body);
1065 jQuery('#wppm_popup_footer').html(response.footer);
1066 }
1067 });
1068 }
1069
1070 function wppm_set_delete_task(proj_id,project_id){
1071 var dataform = new FormData(jQuery('#frm_delete_task')[0]);
1072 if(proj_id==0){
1073 wppm_task_modal_close();
1074 }else{
1075 wppm_modal_close();
1076 }
1077 jQuery.ajax({
1078 url: wppm_admin.ajax_url,
1079 type: 'POST',
1080 data: dataform,
1081 processData: false,
1082 contentType: false
1083 })
1084 .done(function (response_str) {
1085 if(project_id!=0){
1086 wppm_get_project_tasks_kanban_view(project_id);
1087 }else{
1088 if(proj_id==0){
1089 wppm_get_task_list();
1090 }else{
1091 wppm_get_project_tasks(proj_id);
1092 }
1093 }
1094 });
1095 }
1096
1097 function wppm_get_edit_email_notification(id){
1098 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1099 var data = {
1100 action: 'wppm_get_edit_email_notification',
1101 id : id
1102 };
1103 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1104 jQuery('.wppm_setting_col2').html(response);
1105 });
1106 }
1107
1108 function wppm_get_tinymce(selector,body_id){
1109 jQuery('#visual').addClass('btn btn-primary');
1110 jQuery('#text').removeClass('btn btn-primary');
1111 jQuery('#text').addClass('btn btn-default');
1112 tinymce.init({
1113 selector:'#'+selector,
1114 body_id: body_id,
1115 menubar: false,
1116 statusbar: false,
1117 height : '200',
1118 plugins: [
1119 'lists link image directionality'
1120 ],
1121 image_advtab: true,
1122 toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image',
1123 branding: false,
1124 autoresize_bottom_margin: 20,
1125 browser_spellcheck : true,
1126 relative_urls : false,
1127 remove_script_host : false,
1128 convert_urls : true,
1129 setup: function (editor) {
1130 }
1131 });
1132 }
1133
1134 function wppm_get_textarea(){
1135 jQuery('#visual').removeClass('btn btn-primary');
1136 jQuery('#visual').addClass('btn btn-default');
1137 jQuery('#text').addClass('btn btn-primary');
1138 tinymce.remove();
1139 }
1140
1141 function wppm_get_templates(){
1142 wppm_modal_open(wppm_admin.templates);
1143 var data = {
1144 action: 'wppm_get_templates'
1145 };
1146 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1147 var response = JSON.parse(response_str);
1148 jQuery('#wppm_popup_body').html(response.body);
1149 jQuery('#wppm_popup_footer').html(response.footer);
1150 });
1151 }
1152
1153 function wppm_set_edit_email_notification(){
1154 var dataform = new FormData(jQuery('#wppm_edit_email_notification_settings')[0]);
1155 wppm_modal_close();
1156 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1157 jQuery.ajax({
1158 url: wppm_admin.ajax_url,
1159 type: 'POST',
1160 data: dataform,
1161 processData: false,
1162 contentType: false
1163 })
1164 .done(function (response_str) {
1165 var response = JSON.parse(response_str);
1166 if (response.sucess_status=='1') {
1167 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1168 }
1169 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1170 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1171 wppm_get_en_task_notifications();
1172 });
1173 }
1174
1175 function wppm_set_general_settings(){
1176 jQuery('.wppm_submit_wait').show();
1177 var dataform = new FormData(jQuery('#wppm_frm_general_settings')[0]);
1178 jQuery.ajax({
1179 url: wppm_admin.ajax_url,
1180 type: 'POST',
1181 data: dataform,
1182 processData: false,
1183 contentType: false
1184 })
1185 .done(function (response_str) {
1186 var response = JSON.parse(response_str);
1187 jQuery('.wppm_submit_wait').hide();
1188 if (response.sucess_status=='1') {
1189 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1190 }
1191 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1192 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1193 });
1194 }
1195
1196 function wppm_get_project_tasks(id){
1197 wppm_modal_open('Tasks');
1198 var data = {
1199 action: 'wppm_get_project_tasks',
1200 id: id
1201 }
1202 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1203 var response = JSON.parse(response_str);
1204 jQuery('#wppm_popup_body').html(response.body);
1205 jQuery('#wppm_popup_footer').html(response.footer);
1206 });
1207 }
1208
1209 function wppm_create_project_task(id){
1210 wppm_task_modal_open('Tasks');
1211 var data = {
1212 action: 'wppm_add_new_task',
1213 proj_id: id
1214 }
1215 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1216 jQuery('#wppm_popup_body').html(response_str);
1217 });
1218 }
1219
1220 function wppm_load_prev_page(prev_page_no,page_no,sort_by, order){
1221 if(prev_page_no!=0){
1222 page_no=prev_page_no-1;
1223 wppm_get_project_list(page_no,sort_by,order);
1224 }
1225 }
1226
1227 function wppm_load_next_page(next_page_no,page_no,sort_by,order){
1228 if(next_page_no!=page_no){
1229 page_no = next_page_no;
1230 wppm_get_project_list(page_no,sort_by,order);
1231 }
1232 }
1233
1234 function wppm_load_prev_task_page(prev_page_no,page_no, sort_by, order){
1235 if(prev_page_no!=0){
1236 page_no=prev_page_no-1;
1237 wppm_get_task_list(page_no,sort_by,order);
1238 }
1239 }
1240
1241 function wppm_load_next_task_page(next_page_no,page_no,sort_by,order){
1242 if(next_page_no!=page_no){
1243 page_no = next_page_no;
1244 wppm_get_task_list(page_no,sort_by,order);
1245 }
1246 }
1247
1248 function wppm_load_prev_task_page_card_view(prev_page_no,page_no){
1249 if(prev_page_no!=0){
1250 page_no=prev_page_no-1;
1251 wppm_view_task_search_filter(page_no);
1252 }
1253 }
1254
1255 function wppm_load_next_task_page_card_view(next_page_no,page_no){
1256 if(next_page_no!=page_no){
1257 page_no = next_page_no;
1258 wppm_view_task_search_filter(page_no);
1259 }
1260 }
1261
1262 function wppm_thread_attachment_remove(obj,attachment,comment_id,task_id,proj_id){
1263 if( confirm(wppm_admin.confirm) ){
1264 var data = {
1265 action: 'wppm_remove_thread_attachment',
1266 attachment : attachment,
1267 comment_id : comment_id,
1268 task_id:task_id,
1269 _ajax_nonce : jQuery('#wppm_ajax_nonce').val()
1270 };
1271 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1272 jQuery(obj).parent('td').parent('tr').remove();
1273 if((proj_id!=0)||(proj_id!="")){
1274 wppm_open_project_tasks(task_id,proj_id);
1275 }else if((proj_id==0)||(proj_id=="")){
1276 wppm_open_task(task_id);
1277 }
1278 });
1279 }
1280 }
1281
1282 function wppm_proj_thread_attachment_remove(obj,attachment,comment_id,id){
1283 if( confirm(wppm_admin.confirm) ){
1284 var data = {
1285 action: 'wppm_remove_proj_thread_attachment',
1286 attachment : attachment,
1287 comment_id : comment_id,
1288 proj_id:id,
1289 _ajax_nonce:jQuery('#wppm_proj_thread_attachment_remove').val()
1290 };
1291 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1292 jQuery(obj).parent('td').parent('tr').remove();
1293 wppm_open_project(id);
1294 });
1295 }
1296 }
1297
1298 function wppm_open_project(id){
1299 jQuery('#wppm_project_list').hide();
1300 jQuery('#wppm_project_container').show();
1301 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1302 var data = {
1303 action: 'wppm_open_project',
1304 id:id,
1305 auth_code: wppm_admin.auth_code
1306 };
1307 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1308 jQuery('#wppm_project_container').html(response);
1309 });
1310 }
1311
1312 function wppm_project_search_filter(){
1313 var project_search = jQuery("#wppm_project_search_filter").val();
1314 jQuery('#wppm_project_container').show();
1315 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1316 var data = {
1317 action: 'wppm_get_project_list',
1318 project_search:project_search,
1319 page: wppm_admin.page
1320 };
1321 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1322 jQuery('#wppm_project_container').html(response);
1323 });
1324 }
1325
1326 function wppm_clone_task(id,proj_id,project_id){
1327 if(proj_id==0){
1328 wppm_task_modal_open('Clone Task');
1329 }else{
1330 wppm_modal_open('Clone Task');
1331 }
1332 var data = {
1333 action: 'wppm_clone_task',
1334 id: id,
1335 proj_id: proj_id,
1336 project_id: project_id
1337 }
1338 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1339 var response = JSON.parse(response_str);
1340 if(proj_id==0){
1341 jQuery('#wppm_task_popup_body').html(response.body);
1342 jQuery('#wppm_task_popup_footer').html(response.footer);
1343 }else{
1344 jQuery('#wppm_popup_body').html(response.body);
1345 jQuery('#wppm_popup_footer').html(response.footer);
1346 }
1347 });
1348 }
1349
1350 function wppm_set_clone_task(proj_id,project_id){
1351 var dataform = new FormData(jQuery('#frm_edit_clone_task_name')[0]);
1352 if(proj_id==0){
1353 wppm_task_modal_close();
1354 }else{
1355 wppm_modal_close();
1356 }
1357 jQuery.ajax({
1358 url: wppm_admin.ajax_url,
1359 type: 'POST',
1360 data: dataform,
1361 processData: false,
1362 contentType: false
1363 })
1364 .done(function (response_str) {
1365 if(project_id!=0){
1366 wppm_get_project_tasks_kanban_view(project_id);
1367 }else{
1368 if(proj_id==0){
1369 wppm_get_task_list();
1370 }else{
1371 wppm_get_project_tasks(proj_id);
1372 }
1373 }
1374 });
1375 }
1376
1377 function wppm_sort_up_task_list(sort_by,order,page){
1378 jQuery('#wppm_task_container').show();
1379 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1380 var data = {
1381 action: 'wppm_get_task_list',
1382 sort_by:sort_by,
1383 order:order,
1384 page:page
1385 };
1386 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1387 jQuery('#wppm_task_container').html(response);
1388 });
1389 }
1390
1391 function wppm_sort_up_project_list(sort_by,order){
1392 jQuery('#wppm_project_container').show();
1393 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1394 var data = {
1395 action: 'wppm_get_project_list',
1396 sort_by:sort_by,
1397 order:order,
1398 page: wppm_admin.page
1399 };
1400 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1401 jQuery('#wppm_project_container').html(response);
1402 });
1403 }
1404
1405 function wppm_get_miscellaneous_settings(){
1406 jQuery('.wppm_setting_pills li').removeClass('active');
1407 jQuery('#wppm_settings_miscellaneous').addClass('active');
1408 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1409 var data = {
1410 action: 'wppm_get_advanced_settings'
1411 };
1412 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1413 jQuery('.wppm_setting_col2').html(response);
1414 });
1415 }
1416
1417 function wppm_get_appearance_settings(){
1418 jQuery('.wppm_setting_pills li').removeClass('active');
1419 jQuery('#wppm_settings_appearance').addClass('active');
1420 var data = {
1421 action: 'wppm_get_appearance_settings'
1422 };
1423 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1424 jQuery('.wppm_setting_col2').html(response);
1425 });
1426 }
1427
1428 function wppm_get_coworker_permission_settings(){
1429 jQuery('.wppm_setting_pills li').removeClass('active');
1430 jQuery('#wppm_settings_coworker').addClass('active');
1431 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1432 var data = {
1433 action: 'wppm_get_coworker_permission_settings'
1434 };
1435 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1436 jQuery('.wppm_setting_col2').html(response);
1437 });
1438 }
1439
1440 function wppm_set_coworkers_permission_settings(){
1441 jQuery('.wppm_submit_wait').show();
1442 var dataform = new FormData(jQuery('#wppm_frm_coworkers_permission_settings')[0]);
1443 jQuery.ajax({
1444 url: wppm_admin.ajax_url,
1445 type: 'POST',
1446 data: dataform,
1447 processData: false,
1448 contentType: false
1449 })
1450 .done(function (response_str) {
1451 var response = JSON.parse(response_str);
1452 jQuery('.wppm_submit_wait').hide();
1453 if (response.sucess_status=='1') {
1454 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1455 }
1456 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1457 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1458 });
1459 }
1460
1461 function wppm_get_rich_text_editor_settings(){
1462 jQuery('.wppm_setting_pills li').removeClass('active');
1463 jQuery('#wppm_settings_rich_text_editor').addClass('active');
1464 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1465 var data = {
1466 action: 'wppm_get_rich_text_editor_settings'
1467 };
1468 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1469 jQuery('.wppm_setting_col2').html(response);
1470 });
1471 }
1472
1473 function wppm_set_rich_text_editor_settings(){
1474 jQuery('.wppm_submit_wait').show();
1475 var dataform = new FormData(jQuery('#wppm_frm_rich_text_editor_settings')[0]);
1476 jQuery.ajax({
1477 url: wppm_admin.ajax_url,
1478 type: 'POST',
1479 data: dataform,
1480 processData: false,
1481 contentType: false
1482 })
1483 .done(function (response_str) {
1484 var response = JSON.parse(response_str);
1485 jQuery('.wppm_submit_wait').hide();
1486 if (response.sucess_status=='1') {
1487 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1488 }
1489 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1490 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1491 });
1492 }
1493
1494 function wppm_get_ap_proj_list(current_tab_class) {
1495 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1496 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1497 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1498 var data = { action: 'wppm_get_ap_proj_list' ,
1499 current_tab:current_tab_class
1500 };
1501 jQuery.post(
1502 wppm_admin.ajax_url,
1503 data,
1504 function (response) {
1505 jQuery( '.wppm-setting-section-body' ).html( response );
1506 }
1507 );
1508 }
1509
1510 function wppm_get_ap_modal_popup(current_tab_class){
1511 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1512 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1513 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1514 var data = { action: 'wppm_get_ap_modal_popup' ,
1515 current_tab:current_tab_class };
1516 jQuery.post(
1517 wppm_admin.ajax_url,
1518 data,
1519 function (response) {
1520 jQuery( '.wppm-setting-section-body' ).html( response );
1521 }
1522 );
1523 }
1524
1525 function wppm_get_ap_task_list(current_tab_class){
1526 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1527 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1528 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1529 var data = { action: 'wppm_get_ap_task_list' ,
1530 current_tab:current_tab_class
1531 };
1532 jQuery.post(
1533 wppm_admin.ajax_url,
1534 data,
1535 function (response) {
1536 jQuery( '.wppm-setting-section-body' ).html( response );
1537 }
1538 );
1539 }
1540
1541 function wppm_get_ap_individual_proj(current_tab_class){
1542 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1543 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1544 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1545 var data = { action: 'wppm_get_ap_individual_proj' ,
1546 current_tab:current_tab_class
1547 };
1548 jQuery.post(
1549 wppm_admin.ajax_url,
1550 data,
1551 function (response) {
1552 jQuery( '.wppm-setting-section-body' ).html( response );
1553 }
1554 );
1555 }
1556
1557 function wppm_get_ap_individual_task(current_tab_class){
1558 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1559 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1560 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1561 var data = { action: 'wppm_get_ap_individual_task' ,
1562 current_tab:current_tab_class
1563 };
1564 jQuery.post(
1565 wppm_admin.ajax_url,
1566 data,
1567 function (response) {
1568 jQuery( '.wppm-setting-section-body' ).html( response );
1569 }
1570 );
1571 }
1572
1573 function wppm_get_ap_grid_view(current_tab_class){
1574 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1575 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1576 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1577 var data = { action: 'wppm_get_ap_grid_view' ,
1578 current_tab:current_tab_class
1579 };
1580 jQuery.post(
1581 wppm_admin.ajax_url,
1582 data,
1583 function (response) {
1584 jQuery( '.wppm-setting-section-body' ).html( response );
1585 }
1586 );
1587 }
1588
1589 function wppm_get_ap_settings(current_tab_class){
1590 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1591 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1592 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1593 var data = { action: 'wppm_get_ap_settings' ,
1594 current_tab:current_tab_class
1595 };
1596 jQuery.post(
1597 wppm_admin.ajax_url,
1598 data,
1599 function (response) {
1600 jQuery( '.wppm-setting-section-body' ).html( response );
1601 }
1602 );
1603 }
1604
1605 function wppm_set_ap_settings(){
1606 var form = jQuery( '.wppm-frm-ap-settings' )[0];
1607 var dataform = new FormData( form );
1608 jQuery('.wppm_submit_wait').show();
1609 jQuery.ajax(
1610 {
1611 url: wppm_admin.ajax_url,
1612 type: 'POST',
1613 data: dataform,
1614 processData: false,
1615 contentType: false
1616 }
1617 ).done(
1618 function (response_str) {
1619 var response = JSON.parse(response_str);
1620 jQuery('.wppm_submit_wait').hide();
1621 if (response.sucess_status=='1') {
1622 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1623 }
1624 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1625 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1626 }
1627 );
1628 }
1629
1630 function wppm_set_ap_proj_list() {
1631 var form = jQuery( '.wppm-frm-ap-pl' )[0];
1632 var dataform = new FormData( form );
1633 jQuery('.wppm_submit_wait').show();
1634 jQuery.ajax(
1635 {
1636 url: wppm_admin.ajax_url,
1637 type: 'POST',
1638 data: dataform,
1639 processData: false,
1640 contentType: false
1641 }
1642 ).done(
1643 function (response_str) {
1644 var response = JSON.parse(response_str);
1645 jQuery('.wppm_submit_wait').hide();
1646 if (response.sucess_status=='1') {
1647 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1648 }
1649 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1650 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1651 }
1652 );
1653 }
1654
1655 function wppm_set_ap_task_list(){
1656 var form = jQuery( '.wppm-frm-ap-tl' )[0];
1657 var dataform = new FormData( form );
1658 jQuery('.wppm_submit_wait').show();
1659 jQuery.ajax(
1660 {
1661 url: wppm_admin.ajax_url,
1662 type: 'POST',
1663 data: dataform,
1664 processData: false,
1665 contentType: false
1666 }
1667 ).done(
1668 function (response_str) {
1669 var response = JSON.parse(response_str);
1670 jQuery('.wppm_submit_wait').hide();
1671 if (response.sucess_status=='1') {
1672 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1673 }
1674 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1675 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1676 }
1677 );
1678 }
1679
1680 function wppm_set_ap_individual_proj(){
1681 var form = jQuery( '.wppm-frm-ap-individual_pl' )[0];
1682 var dataform = new FormData( form );
1683 jQuery('.wppm_submit_wait').show();
1684 jQuery.ajax(
1685 {
1686 url: wppm_admin.ajax_url,
1687 type: 'POST',
1688 data: dataform,
1689 processData: false,
1690 contentType: false
1691 }
1692 ).done(
1693 function (response_str) {
1694 var response = JSON.parse(response_str);
1695 jQuery('.wppm_submit_wait').hide();
1696 if (response.sucess_status=='1') {
1697 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1698 }
1699 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1700 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1701 }
1702 );
1703 }
1704
1705 function wppm_set_ap_individual_task(){
1706 var form = jQuery( '.wppm-frm-ap-individual_tl' )[0];
1707 var dataform = new FormData( form );
1708 jQuery('.wppm_submit_wait').show();
1709 jQuery.ajax(
1710 {
1711 url: wppm_admin.ajax_url,
1712 type: 'POST',
1713 data: dataform,
1714 processData: false,
1715 contentType: false
1716 }
1717 ).done(
1718 function (response_str) {
1719 var response = JSON.parse(response_str);
1720 jQuery('.wppm_submit_wait').hide();
1721 if (response.sucess_status=='1') {
1722 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1723 }
1724 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1725 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1726 }
1727 );
1728 }
1729
1730 function wppm_set_ap_modal_popup(){
1731 var form = jQuery( '.wppm-frm-ap-modal_popup' )[0];
1732 var dataform = new FormData( form );
1733 jQuery('.wppm_submit_wait').show();
1734 jQuery.ajax(
1735 {
1736 url: wppm_admin.ajax_url,
1737 type: 'POST',
1738 data: dataform,
1739 processData: false,
1740 contentType: false
1741 }
1742 ).done(
1743 function (response_str) {
1744 var response = JSON.parse(response_str);
1745 jQuery('.wppm_submit_wait').hide();
1746 if (response.sucess_status=='1') {
1747 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1748 }
1749 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1750 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1751 }
1752 );
1753 }
1754
1755 function wppm_set_ap_grid_view(){
1756 var form = jQuery( '.wppm-frm-ap-grid_view' )[0];
1757 var dataform = new FormData( form );
1758 jQuery('.wppm_submit_wait').show();
1759 jQuery.ajax(
1760 {
1761 url: wppm_admin.ajax_url,
1762 type: 'POST',
1763 data: dataform,
1764 processData: false,
1765 contentType: false
1766 }
1767 ).done(
1768 function (response_str) {
1769 var response = JSON.parse(response_str);
1770 jQuery('.wppm_submit_wait').hide();
1771 if (response.sucess_status=='1') {
1772 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1773 }
1774 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1775 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1776 }
1777 );
1778 }
1779
1780 function wppm_set_advanced_settings(){
1781 jQuery('.wppm_submit_wait').show();
1782 var dataform = new FormData(jQuery('#wppm_frm_advanced_settings')[0]);
1783 jQuery.ajax({
1784 url: wppm_admin.ajax_url,
1785 type: 'POST',
1786 data: dataform,
1787 processData: false,
1788 contentType: false
1789 })
1790 .done(function (response_str) {
1791 var response = JSON.parse(response_str);
1792 jQuery('.wppm_submit_wait').hide();
1793 if (response.sucess_status=='1') {
1794 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1795 }
1796 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1797 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1798 });
1799 }
1800
1801 function wppm_get_project_visibility(id){
1802 wppm_modal_open('Change Visibility');
1803 var data = {
1804 action: 'wppm_get_project_visibility',
1805 id: id
1806 }
1807 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1808 var response = JSON.parse(response_str);
1809 jQuery('#wppm_popup_body').html(response.body);
1810 jQuery('#wppm_popup_footer').html(response.footer);
1811 });
1812 }
1813
1814 function wppm_select_project_visibility(proj_id){
1815 if(jQuery('input[name="wppm_project_visibility_option"]').is(':checked')){
1816 var project_visibility = jQuery('input[name="wppm_project_visibility_option"]:checked').val();
1817 }else{
1818 var project_visibility = 0;
1819 }
1820 var data = {
1821 action: 'wppm_change_project_visibility',
1822 project_id:proj_id,
1823 project_visibility:project_visibility,
1824 _ajax_nonce:jQuery('#wppm_proj_visibility_ajax_nonce').val()
1825 };
1826 jQuery.post(wppm_admin.ajax_url, data, function() {
1827 });
1828 }
1829
1830 function wppm_apply_project_filter(){
1831 wppm_project_filter = jQuery('#wppm_project_filter').find(":selected").val();
1832 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1833 var data = {
1834 action: 'wppm_get_project_list',
1835 wppm_project_filter:wppm_project_filter,
1836 page:wppm_admin.page
1837 };
1838 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1839 jQuery('#wppm_project_container').html(response);
1840 });
1841 }
1842
1843 function wppm_apply_task_filter(page){
1844 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1845 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1846 var data = {
1847 action: 'wppm_get_task_list',
1848 wppm_task_filter:wppm_task_filter,
1849 page:page
1850 };
1851 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1852 jQuery('#wppm_task_container').html(response);
1853 });
1854 }
1855
1856 function wppm_tl_reset_filter(page){
1857 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1858 var data = {
1859 action: 'wppm_get_task_list',
1860 wppm_task_filter:'all',
1861 task_search:"",
1862 sort_by:"task_name",
1863 order:"ASC",
1864 wppm_proj_filter:0,
1865 page:page
1866 };
1867 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1868 jQuery('#wppm_task_container').html(response);
1869 });
1870 }
1871
1872 function wppm_apply_task_filter_grid_view(page,id){
1873 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1874 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1875 var data = {
1876 action: 'wppm_view_project_tasks',
1877 wppm_task_filter:wppm_task_filter,
1878 page:page,
1879 id:id
1880 };
1881 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1882 jQuery('#wppm_task_container').html(response);
1883 });
1884 }
1885
1886 function wppm_tl_reset_grid_view_filter(page,id){
1887 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1888 var data = {
1889 action: 'wppm_view_project_tasks',
1890 wppm_task_filter:'all',
1891 task_search:"",
1892 sort_by:"task_name",
1893 order:"ASC",
1894 wppm_proj_filter:"0",
1895 page:page,
1896 id:id
1897 };
1898 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1899 jQuery('#wppm_task_container').html(response);
1900 });
1901 }
1902
1903 function wppm_pl_reset_filter(){
1904 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1905 var data = {
1906 action: 'wppm_get_project_list',
1907 wppm_project_filter:'all',
1908 project_search:"",
1909 sort_by:"project_name",
1910 order:"ASC",
1911 page:wppm_admin.page
1912 };
1913 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1914 jQuery('#wppm_project_container').html(response);
1915 });
1916 }
1917
1918 function wppm_tasks_by_select_project(page){
1919 wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val();
1920 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1921 var data = {
1922 action: 'wppm_get_task_list',
1923 wppm_proj_filter:wppm_proj_filter,
1924 page:page
1925 };
1926 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1927 jQuery('#wppm_task_container').html(response);
1928 });
1929 }
1930
1931 function wppm_tasks_by_select_project_grid_view(page){
1932 wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val();
1933 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1934 var data = {
1935 action: 'wppm_view_project_tasks',
1936 wppm_proj_filter:wppm_proj_filter,
1937 page:page
1938 };
1939 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1940 jQuery('#wppm_task_container').html(response);
1941 });
1942 }
1943
1944 function wppm_reset_ap_proj_list(){
1945 jQuery( "#wppm_reset_ap_proj_list_btn" ).text( wppm_admin.please_wait );
1946 var _ajax_nonce = jQuery("#wppm_reset_ap_proj_list_nonce").val();
1947 var data = { action: 'wppm_reset_ap_proj_list',_ajax_nonce };
1948 jQuery.post(
1949 wppm_admin.ajax_url,
1950 data,
1951 function () {
1952 wppm_get_ap_proj_list('project-list');
1953 }
1954 );
1955 }
1956
1957 function wppm_reset_ap_task_list(){
1958 jQuery( "#wppm_reset_ap_task_list_btn" ).text( wppm_admin.please_wait );
1959 var _ajax_nonce = jQuery("#wppm_reset_ap_task_list_ajax_nonce").val();
1960 var data = { action: 'wppm_reset_ap_task_list',_ajax_nonce };
1961 jQuery.post(
1962 wppm_admin.ajax_url,
1963 data,
1964 function () {
1965 wppm_get_ap_task_list('task-list');
1966 }
1967 );
1968 }
1969
1970 function wppm_reset_ap_individual_proj(){
1971 jQuery( "#wppm_reset_ap_individual_proj_btn" ).text( wppm_admin.please_wait );
1972 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_proj_ajax_nonce").val();
1973 var data = { action: 'wppm_reset_ap_individual_proj',
1974 _ajax_nonce, };
1975 jQuery.post(
1976 wppm_admin.ajax_url,
1977 data,
1978 function () {
1979 wppm_get_ap_individual_proj('individual-project');
1980 }
1981 );
1982 }
1983
1984 function wppm_reset_ap_individual_task(){
1985 jQuery( "#wppm_reset_ap_individual_task_btn" ).text( wppm_admin.please_wait );
1986 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_task_ajax_nonce" ).val();
1987 var data = { action: 'wppm_reset_ap_individual_task',_ajax_nonce };
1988 jQuery.post(
1989 wppm_admin.ajax_url,
1990 data,
1991 function () {
1992 wppm_get_ap_individual_task('individual-task');
1993 }
1994 );
1995 }
1996
1997 function wppm_reset_ap_modal_popup(){
1998 jQuery( "#wppm_reset_ap_modal_popup_btn" ).text( wppm_admin.please_wait );
1999 var _ajax_nonce = jQuery( "#wppm_reset_ap_modal_popup_nonce" ).val();
2000 var data = { action: 'wppm_reset_ap_modal_popup',_ajax_nonce };
2001 jQuery.post(
2002 wppm_admin.ajax_url,
2003 data,
2004 function () {
2005 wppm_get_ap_modal_popup('modal-popup');
2006 }
2007 );
2008 }
2009
2010 function wppm_reset_ap_grid_view(){
2011 jQuery( "#wppm_reset_ap_grid_view_btn" ).text( wppm_admin.please_wait );
2012 var wppm_reset_grid_ajax_nonce = jQuery( "#wppm_reset_ap_grid_view_ajax_nonce" ).val();
2013 var data = {
2014 action: 'wppm_reset_ap_grid_view',
2015 wppm_reset_grid_ajax_nonce:wppm_reset_grid_ajax_nonce
2016 };
2017 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2018 wppm_get_ap_grid_view('grid-view');
2019 });
2020 }
2021
2022 function wppm_reset_ap_settings(){
2023 jQuery( "#wppm_reset_ap_settings_btn" ).text( wppm_admin.please_wait );
2024 var _ajax_nonce = jQuery("#wppm_reset_ap_settings_nonce").val();
2025 var data = { action: 'wppm_reset_ap_settings',_ajax_nonce };
2026 jQuery.post(
2027 wppm_admin.ajax_url,
2028 data,
2029 function () {
2030 wppm_get_ap_settings('settings');
2031 }
2032 );
2033 }
2034 /**
2035 * Bulk selector change
2036 */
2037 function wppm_bulk_select_change() {
2038 jQuery("#wppm-bulk-actions-btn").show();
2039 var checked = jQuery(".wppm-bulk-selector").is(":checked");
2040 jQuery(".wppm-bulk-select").prop("checked", checked);
2041 if(!checked){
2042 jQuery("#wppm-bulk-actions-btn").hide();
2043 }
2044 }
2045
2046 function wppm_task_bulk_select_change() {
2047 jQuery("#wppm-task-bulk-actions-btn").show();
2048 var checked = jQuery(".wppm-bulk-selector").is(":checked");
2049 jQuery(".wppm-task-bulk-select").prop("checked", checked);
2050 if(!checked){
2051 jQuery("#wppm-bulk-actions-btn").hide();
2052 }
2053 }
2054
2055 function wppm_bulk_change_status(nonce){
2056 var items = jQuery(".wppm-bulk-select:checked");
2057 var checked = items.length === 0 ? false : true;
2058 jQuery(".wppm-bulk-selector").prop("checked", checked);
2059 if (items.length != 0) {
2060 var proj_ids = jQuery(".wppm-bulk-select:checked")
2061 .map(function () {
2062 return this.value;
2063 })
2064 .get();
2065 wppm_modal_open('Change Status');
2066 var data = {
2067 action: "wppm_get_bulk_change_proj_status",
2068 proj_ids,
2069 _ajax_nonce: nonce,
2070 };
2071 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2072 var response = JSON.parse(response_str);
2073 jQuery('#wppm_popup_body').html(response.body);
2074 jQuery('#wppm_popup_footer').html(response.footer);
2075 });
2076 }
2077 }
2078
2079 function wppm_set_bulk_change_project_status(){
2080 var dataform = new FormData(jQuery('#frm_get_bulk_project_change_status')[0]);
2081 wppm_modal_close();
2082 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2083 jQuery.ajax({
2084 url: wppm_admin.ajax_url,
2085 type: 'POST',
2086 data: dataform,
2087 processData: false,
2088 contentType: false
2089 })
2090 .done(function (response_str) {
2091 wppm_get_project_list();
2092 });
2093 }
2094
2095 function wppm_bulk_change_category(nonce){
2096 var items = jQuery(".wppm-bulk-select:checked");
2097 var checked = items.length === 0 ? false : true;
2098 jQuery(".wppm-bulk-selector").prop("checked", checked);
2099 if (items.length != 0) {
2100 var proj_ids = jQuery(".wppm-bulk-select:checked")
2101 .map(function () {
2102 return this.value;
2103 })
2104 .get();
2105 wppm_modal_open('Change Category');
2106 var data = {
2107 action: "wppm_get_bulk_change_proj_cat",
2108 proj_ids,
2109 _ajax_nonce: nonce,
2110 };
2111 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2112 var response = JSON.parse(response_str);
2113 jQuery('#wppm_popup_body').html(response.body);
2114 jQuery('#wppm_popup_footer').html(response.footer);
2115 });
2116 }
2117 }
2118
2119 function wppm_set_bulk_change_project_category(){
2120 var dataform = new FormData(jQuery('#frm_get_bulk_project_change_category')[0]);
2121 wppm_modal_close();
2122 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2123 jQuery.ajax({
2124 url: wppm_admin.ajax_url,
2125 type: 'POST',
2126 data: dataform,
2127 processData: false,
2128 contentType: false
2129 })
2130 .done(function (response_str) {
2131 wppm_get_project_list();
2132 });
2133 }
2134
2135 function wppm_bulk_assign_users(nonce){
2136 var items = jQuery(".wppm-bulk-select:checked");
2137 var checked = items.length === 0 ? false : true;
2138 jQuery(".wppm-bulk-selector").prop("checked", checked);
2139 if (items.length != 0) {
2140 var proj_ids = jQuery(".wppm-bulk-select:checked")
2141 .map(function () {
2142 return this.value;
2143 })
2144 .get();
2145 wppm_modal_open('Assign Co-workers');
2146 var data = {
2147 action: "wppm_get_bulk_assign_users",
2148 proj_ids,
2149 _ajax_nonce: nonce,
2150 };
2151 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2152 var response = JSON.parse(response_str);
2153 jQuery('#wppm_popup_body').html(response.body);
2154 jQuery('#wppm_popup_footer').html(response.footer);
2155 });
2156 }
2157 }
2158
2159 function wppm_set_bulk_project_users(){
2160 var dataform = new FormData(jQuery('#frm_get_bulk_project_users')[0]);
2161 wppm_modal_close();
2162 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2163 jQuery.ajax({
2164 url: wppm_admin.ajax_url,
2165 type: 'POST',
2166 data: dataform,
2167 processData: false,
2168 contentType: false
2169 })
2170 .done(function (response_str) {
2171 wppm_get_project_list();
2172 });
2173 }
2174
2175 function wppm_bulk_delete_project(nonce){
2176 var items = jQuery(".wppm-bulk-select:checked");
2177 var checked = items.length === 0 ? false : true;
2178 jQuery(".wppm-bulk-selector").prop("checked", checked);
2179 if (items.length != 0) {
2180 var proj_ids = jQuery(".wppm-bulk-select:checked")
2181 .map(function () {
2182 return this.value;
2183 })
2184 .get();
2185 wppm_modal_open('Delete Project');
2186 var data = {
2187 action: "wppm_get_bulk_delete_project",
2188 proj_ids,
2189 _ajax_nonce: nonce,
2190 };
2191 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2192 var response = JSON.parse(response_str);
2193 jQuery('#wppm_popup_body').html(response.body);
2194 jQuery('#wppm_popup_footer').html(response.footer);
2195 });
2196 }
2197 }
2198
2199 function wppm_set_delete_bulk_projects(){
2200 var dataform = new FormData(jQuery('#frm_delete_bulk_project')[0]);
2201 wppm_modal_close();
2202 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2203 jQuery.ajax({
2204 url: wppm_admin.ajax_url,
2205 type: 'POST',
2206 data: dataform,
2207 processData: false,
2208 contentType: false
2209 })
2210 .done(function (response_str) {
2211 wppm_get_project_list();
2212 });
2213 }
2214
2215 function wppm_bulk_change_task_status(nonce){
2216 var items = jQuery(".wppm-task-bulk-select:checked");
2217 var checked = items.length === 0 ? false : true;
2218 jQuery(".wppm-bulk-selector").prop("checked", checked);
2219 if (items.length != 0) {
2220 var task_ids = jQuery(".wppm-task-bulk-select:checked")
2221 .map(function () {
2222 return this.value;
2223 })
2224 .get();
2225 wppm_task_modal_open('Change Task Status');
2226 var data = {
2227 action: "wppm_get_bulk_change_task_status",
2228 task_ids,
2229 _ajax_nonce: nonce,
2230 };
2231 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2232 var response = JSON.parse(response_str);
2233 jQuery('#wppm_task_popup_body').html(response.body);
2234 jQuery('#wppm_task_popup_footer').html(response.footer);
2235 });
2236 }
2237 }
2238
2239 function wppm_set_bulk_change_task_priority(){
2240 var dataform = new FormData(jQuery('#frm_get_bulk_task_change_priority')[0]);
2241 wppm_task_modal_close();
2242 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2243 jQuery.ajax({
2244 url: wppm_admin.ajax_url,
2245 type: 'POST',
2246 data: dataform,
2247 processData: false,
2248 contentType: false
2249 })
2250 .done(function (response_str) {
2251 wppm_get_task_list();
2252 });
2253 }
2254
2255 function wppm_set_bulk_change_task_status(){
2256 var dataform = new FormData(jQuery('#frm_get_bulk_task_change_status')[0]);
2257 wppm_task_modal_close();
2258 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2259 jQuery.ajax({
2260 url: wppm_admin.ajax_url,
2261 type: 'POST',
2262 data: dataform,
2263 processData: false,
2264 contentType: false
2265 })
2266 .done(function (response_str) {
2267 wppm_get_task_list();
2268 });
2269 }
2270
2271 function wppm_bulk_change_task_priority(nonce){
2272 var items = jQuery(".wppm-task-bulk-select:checked");
2273 var checked = items.length === 0 ? false : true;
2274 jQuery(".wppm-bulk-selector").prop("checked", checked);
2275 if (items.length != 0) {
2276 var task_ids = jQuery(".wppm-task-bulk-select:checked")
2277 .map(function () {
2278 return this.value;
2279 })
2280 .get();
2281 wppm_task_modal_open('Change Task Priority');
2282 var data = {
2283 action: "wppm_get_bulk_change_task_priority",
2284 task_ids,
2285 _ajax_nonce: nonce
2286 };
2287 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2288 var response = JSON.parse(response_str);
2289 jQuery('#wppm_task_popup_body').html(response.body);
2290 jQuery('#wppm_task_popup_footer').html(response.footer);
2291 });
2292 }
2293 }
2294
2295 function wppm_bulk_delete_task(nonce){
2296 var items = jQuery(".wppm-task-bulk-select:checked");
2297 var checked = items.length === 0 ? false : true;
2298 jQuery(".wppm-bulk-selector").prop("checked", checked);
2299 if (items.length != 0) {
2300 var task_ids = jQuery(".wppm-task-bulk-select:checked")
2301 .map(function () {
2302 return this.value;
2303 })
2304 .get();
2305 wppm_task_modal_open('Delete Task');
2306 var data = {
2307 action: "wppm_get_bulk_delete_task",
2308 task_ids,
2309 _ajax_nonce: nonce,
2310 };
2311 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2312 var response = JSON.parse(response_str);
2313 jQuery('#wppm_task_popup_body').html(response.body);
2314 jQuery('#wppm_task_popup_footer').html(response.footer);
2315 });
2316 }
2317 }
2318
2319 function wppm_set_delete_bulk_tasks(){
2320 var dataform = new FormData(jQuery('#frm_delete_bulk_tasks')[0]);
2321 wppm_task_modal_close();
2322 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2323 jQuery.ajax({
2324 url: wppm_admin.ajax_url,
2325 type: 'POST',
2326 data: dataform,
2327 processData: false,
2328 contentType: false
2329 })
2330 .done(function (response_str) {
2331 wppm_get_task_list();
2332 });
2333 }
2334
2335 function wppm_print_task(id){
2336 jQuery('#wppmprint_menu').css('display', 'flex');
2337 }
2338
2339 function wppm_open_pdf(id){
2340 window.open(wppm_admin.ajax_url + "?action=wppm_get_task_pdf&id=" + id, "_blank");
2341 }
2342
2343 function wppm_download_pdf(id){
2344 window.open(wppm_admin.ajax_url + "?action=wppm_download_pdf&id=" + id, "_blank");
2345 }
2346
2347 function wppm_archive_task(id,is_archived,project_id){
2348 if (!confirm(wppm_admin.confirm)) {
2349 return;
2350 } else {
2351 var data = {
2352 action: 'wppm_archive_task',
2353 id: id,
2354 is_archived: is_archived,
2355 project_id: project_id,
2356 };
2357 jQuery.post(wppm_admin.ajax_url, data, function() {
2358 wppm_open_task(id,project_id);
2359 });
2360 }
2361 }
2362
2363 function wppm_archive_project(project_id,is_archived){
2364 if (!confirm(wppm_admin.confirm)) {
2365 return;
2366 } else {
2367 var data = {
2368 action: 'wppm_archive_project',
2369 project_id: project_id,
2370 is_archived: is_archived,
2371 };
2372 jQuery.post(wppm_admin.ajax_url, data, function() {
2373 wppm_open_project(project_id);
2374 });
2375 }
2376 }
2377
2378 function wppm_get_print_task_settings(){
2379 jQuery('.wppm_setting_pills li').removeClass('active');
2380 jQuery('#wppm_settings_print_task').addClass('active');
2381 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
2382 var data = {
2383 action: 'wppm_get_print_task_settings'
2384 };
2385 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2386 jQuery('.wppm_setting_col2').html(response);
2387 });
2388 }
2389
2390 function wppm_set_print_task_settings(){
2391 jQuery('.wppm_submit_wait').show();
2392 var dataform = new FormData(jQuery('#wppm_print_task_settings')[0]);
2393 jQuery.ajax({
2394 url: wppm_admin.ajax_url,
2395 type: 'POST',
2396 data: dataform,
2397 processData: false,
2398 contentType: false
2399 })
2400 .done(function (response_str) {
2401 var response = JSON.parse(response_str);
2402 jQuery('.wppm_submit_wait').hide();
2403 if (response.sucess_status=='1') {
2404 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
2405 }
2406 jQuery('#wppm_alert_success').slideDown('fast',function(){});
2407 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
2408 });
2409 }
2410
2411 function wppm_get_overdue_notifier_settings(){
2412 jQuery('.wppm_setting_pills li').removeClass('active');
2413 jQuery('#wppm_settings_overdue_notifier').addClass('active');
2414 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
2415 var data = {
2416 action: 'wppm_get_overdue_notifier_settings'
2417 };
2418 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2419 jQuery('.wppm_setting_col2').html(response);
2420 });
2421 }
2422
2423 function wppm_get_recurring_notifier_settings(){
2424 jQuery('.wppm_setting_pills li').removeClass('active');
2425 jQuery('#wppm_settings_recurring_notifier').addClass('active');
2426 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
2427 var data = {
2428 action: 'wppm_get_recurring_notifier_settings'
2429 };
2430 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2431 jQuery('.wppm_setting_col2').html(response);
2432 });
2433 }
2434
2435 function wppm_get_due_date_reminder_settings(){
2436 jQuery('.wppm_setting_pills li').removeClass('active');
2437 jQuery('#wppm_settings_due_date_reminder').addClass('active');
2438 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
2439 var data = {
2440 action: 'wppm_get_due_date_reminder_settings'
2441 };
2442 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2443 jQuery('.wppm_setting_col2').html(response);
2444 });
2445 }
2446
2447 function wppm_get_email_piping_settings(){
2448 jQuery('.wppm_setting_pills li').removeClass('active');
2449 jQuery('#wppm_settings_email_piping').addClass('active');
2450 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
2451 var data = {
2452 action: 'wppm_get_email_piping_settings'
2453 };
2454 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2455 jQuery('.wppm_setting_col2').html(response);
2456 });
2457 }
2458
2459 function wppm_get_buddypress_integration_settings(){
2460 jQuery('.wppm_setting_pills li').removeClass('active');
2461 jQuery('#wppm_settings_buddypress').addClass('active');
2462 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
2463 var data = {
2464 action: 'wppm_get_buddypress_integration_settings'
2465 };
2466 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2467 jQuery('.wppm_setting_col2').html(response);
2468 });
2469 }
2470
2471 function wppm_get_woocommerce_integration_settings(){
2472 jQuery('.wppm_setting_pills li').removeClass('active');
2473 jQuery('#wppm_settings_woocommerce').addClass('active');
2474 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
2475 var data = {
2476 action: 'wppm_get_woocommerce_settings'
2477 };
2478 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2479 jQuery('.wppm_setting_col2').html(response);
2480 });
2481 }
2482
2483 function wppm_edit_checklist_item(item_id,checklist_id,proj_id,task_id){
2484 wppm_task_modal_open('Edit Checklist Item') ;
2485 var data = {
2486 action: 'wppm_edit_checklist_item',
2487 item_id:item_id,
2488 checklist_id: checklist_id,
2489 task_id: task_id,
2490 proj_id: proj_id,
2491 _ajax_nonce:jQuery('#wppm_edit_checklist_item_ajax_nonce').val()
2492 };
2493 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2494 var response = JSON.parse(response);
2495 if(proj_id==0){
2496 jQuery('#wppm_task_popup_body').html(response.body);
2497 jQuery('#wppm_task_popup_footer').html(response.footer);
2498 }else{
2499 jQuery('#wppm_popup_body').html(response.body);
2500 jQuery('#wppm_popup_footer').html(response.footer);
2501 }
2502 });
2503 }
2504
2505 function wppm_set_checklist_item_name(item_id,checklist_id,task_id){
2506 var dataform = new FormData(jQuery('#frm_get_edit_checklist_item')[0]);
2507 wppm_task_modal_close();
2508 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2509 jQuery.ajax({
2510 url: wppm_admin.ajax_url,
2511 type: 'POST',
2512 data: dataform,
2513 processData: false,
2514 contentType: false
2515 })
2516 .done(function (response_str) {
2517 wppm_open_task(task_id);
2518 });
2519 }
2520
2521 function wppm_get_project_tasks_kanban_view(proj_id){
2522 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2523 var data = {
2524 action: 'wppm_get_project_tasks_kanban_view',
2525 id:proj_id
2526 };
2527 jQuery.post(wppm_admin.ajax_url, data, function(response) {
2528 jQuery('#wppm_project_container').html(response);
2529 });
2530 }
2531
2532