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

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

2,273 lines 65.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function wppm_add_new_project(){
2 jQuery('#wppm_project_container').show();
3 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
4 var data = {
5 action: 'wppm_add_new_project'
6 };
7 jQuery.post(wppm_admin.ajax_url, data, function(response) {
8 jQuery('#wppm_project_container').html(response);
9 });
10 }
11
12 function wppm_projects(){
13 jQuery('#wppm_project_container').hide();
14 jQuery('#wppm_project_list').show();
15 }
16
17 function wppm_get_users(proj_id){
18 wppm_modal_open('Add Users');
19 var data = {
20 action: 'wppm_get_users',
21 proj_id: proj_id
22 }
23 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
24 var response = JSON.parse(response_str);
25 jQuery('#wppm_popup_body').html(response.body);
26 jQuery('#wppm_popup_footer').html(response.footer);
27 });
28 }
29
30 function wppm_get_general_settings(){
31 jQuery('.wppm_setting_pills li').removeClass('active');
32 jQuery('#wppm_settings_general').addClass('active');
33 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
34 var data = {
35 action: 'wppm_get_general_setings'
36 };
37 jQuery.post(wppm_admin.ajax_url, data, function(response) {
38 jQuery('.wppm_setting_col2').html(response);
39 });
40 }
41
42 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){
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);
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 jQuery.ajax( {
190 url: wppm_admin.ajax_url,
191 type: 'POST',
192 data: dataform,
193 processData: false,
194 contentType: false
195 })
196 .done(function( response ) {
197 jQuery('#wppm_project_container').html(response);
198 });
199 }
200
201 function wppm_add_new_task(proj_id){
202 jQuery('#wppm_task_container').show();
203 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
204 var data = {
205 action: 'wppm_add_new_task',
206 proj_id:proj_id
207 };
208 jQuery.post(wppm_admin.ajax_url, data, function(response) {
209 jQuery('#wppm_task_container').html(response);
210 });
211 }
212
213 function wppm_get_task_list(page_no){
214 jQuery('#wppm_task_container').show();
215 window.history.replaceState( {}, null, 'admin.php?page=wppm-tasks&section=task-list' );
216 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
217 var data = {
218 action: 'wppm_get_task_list',
219 page_no:page_no
220 };
221 jQuery.post(wppm_admin.ajax_url, data, function(response) {
222 jQuery('#wppm_task_container').html(response);
223 });
224 }
225
226 function wppm_get_task_prioriy_settings(){
227 jQuery('.wppm_setting_pills li').removeClass('active');
228 jQuery('#wppm_settings_task_priorities').addClass('active');
229 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
230 var data = {
231 action: 'wppm_get_priority_settings'
232 };
233 jQuery.post(wppm_admin.ajax_url, data, function(response) {
234 jQuery('.wppm_setting_col2').html(response);
235 });
236 }
237
238 function wppm_add_task_priority(){
239 wppm_modal_open(wppm_admin.add_new_priority);
240 var data = {
241 action: 'wppm_add_task_priority'
242 };
243 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
244 var response = JSON.parse(response_str);
245 jQuery('#wppm_popup_body').html(response.body);
246 jQuery('#wppm_popup_footer').html(response.footer);
247 jQuery('#wppm_cat_name').focus();
248 });
249 }
250
251 function wppm_delete_task_priority(priority_id){
252 const flag = confirm(wppm_admin.confirm);
253 if (!flag) return;
254
255 var data = { action: 'wppm_delete_task_priority', priority_id,
256 _ajax_nonce:jQuery('#wppm_delete_tprio_ajax_nonce').val()
257 };
258 jQuery.post(wppm_admin.ajax_url, data, function (res) {
259 wppm_get_task_prioriy_settings();
260 });
261 }
262
263 function wppm_get_task_status_settings(){
264 jQuery('.wppm_setting_pills li').removeClass('active');
265 jQuery('#wppm_settings_task_status').addClass('active');
266 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
267 var data = {
268 action: 'wppm_get_task_status_settings'
269 };
270 jQuery.post(wppm_admin.ajax_url, data, function(response) {
271 jQuery('.wppm_setting_col2').html(response);
272 });
273 }
274
275 function wppm_get_add_task_status(){
276 wppm_modal_open(wppm_admin.add_new_status);
277 var data = {
278 action: 'wppm_get_add_task_status'
279 };
280 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
281 var response = JSON.parse(response_str);
282 jQuery('#wppm_popup_body').html(response.body);
283 jQuery('#wppm_popup_footer').html(response.footer);
284 jQuery('#wppm_cat_name').focus();
285 });
286 }
287
288 function wppm_delete_task_status(status_id){
289 const flag = confirm(wppm_admin.confirm);
290 if (!flag) return;
291
292 var data = { action: 'wppm_delete_task_status', status_id,
293 _ajax_nonce: jQuery('#wppm_delete_tstatus_ajax_nonce').val()};
294 jQuery.post(wppm_admin.ajax_url, data, function (res) {
295 wppm_get_task_status_settings();
296 });
297 }
298
299 function wppm_task_search_filter(){
300 var task_search = jQuery("#wppm_task_search_filter").val();
301 jQuery('#wppm_task_container').show();
302 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
303 var data = {
304 action: 'wppm_get_task_list',
305 task_search:task_search
306 };
307 jQuery.post(wppm_admin.ajax_url, data, function(response) {
308 jQuery('#wppm_task_container').html(response);
309 });
310 }
311
312 function wppm_view_task_search_filter(page_no){
313 var task_search = jQuery("#wppm_view_task_search_filter").val();
314 jQuery('#wppm_task_container').show();
315 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
316
317 var data = {
318 action: 'wppm_get_task_list_card_view',
319 task_search:task_search,
320 page_no:page_no
321 };
322 jQuery.post(wppm_admin.ajax_url, data, function(response) {
323 jQuery('#wppm_task_container').html(response);
324 });
325 }
326
327 function wppm_open_task(id){
328 jQuery('#wppm_task_container').show();
329 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
330 var data = {
331 action: 'wppm_open_task',
332 id:id,
333 auth_code: wppm_admin.auth_code
334 };
335 jQuery.post(wppm_admin.ajax_url, data, function(response) {
336 jQuery('#wppm_task_container').html(response);
337 });
338 }
339
340 function wppm_open_project_tasks(id,proj_id){
341 wppm_modal_open('Open Tasks');
342 jQuery('#wppm_task_container').show();
343 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
344 var data = {
345 action: 'wppm_open_task',
346 id: id,
347 proj_id:proj_id
348 }
349 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
350 jQuery('#wppm_popup_body').html(response_str);
351 //jQuery('#wppm_task_container').html(response_str);
352 });
353 }
354
355 function wppm_add_new_checklist(task_id,proj_id){
356 if(jQuery('#wppm_checklist_label').val()==''){
357 jQuery('#wppm_checklist_label').focus();
358 return false;
359 }
360 var data = {
361 action: 'wppm_add_new_checklist',
362 task_id: task_id,
363 proj_id: proj_id,
364 checklist_name: jQuery('#wppm_checklist_label').val(),
365 _ajax_nonce:jQuery('#wppm_checklist_ajax_nonce').val()
366 };
367 jQuery.post(wppm_admin.ajax_url, data, function(response) {
368 if((proj_id!=0)||(proj_id!="")){
369 //wppm_modal_close();
370 wppm_open_project_tasks(task_id,proj_id);
371 }else if((proj_id==0)||(proj_id=="")){
372 //wppm_modal_close();
373 wppm_open_task(task_id);
374 }
375 });
376 }
377
378 function wppm_add_new_checklist_item(checklist_id,task_id,proj_id){
379 if(jQuery('#wppm_checklist_item_label_'+checklist_id).val()==''){
380 jQuery('#wppm_checklist_item_label_'+checklist_id).focus();
381 return false;
382 }
383 var data = {
384 action: 'wppm_add_new_checklist_item',
385 checklist_id: checklist_id,
386 proj_id:proj_id,
387 label: jQuery('#wppm_checklist_item_label_'+checklist_id).val(),
388 _ajax_nonce:jQuery('#wppm_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_delete_checklist(checklist_id,task_id,proj_id){
400 const flag = confirm(wppm_admin.confirm);
401 if (!flag) return;
402 var data = {
403 action: 'wppm_delete_checklist',
404 checklist_id: checklist_id,
405 _ajax_nonce:jQuery('#wppm_delete_checklist_ajax_nonce').val()
406 };
407 jQuery.post(wppm_admin.ajax_url, data, function(response) {
408 if((proj_id!=0)||(proj_id!="")){
409 wppm_open_project_tasks(task_id,proj_id);
410 }else if((proj_id==0)||(proj_id=="")){
411 wppm_open_task(task_id);
412 }
413 });
414 }
415
416 function wppm_delete_checklist_item(item_id,checklist_id,proj_id,task_id){
417 const flag = confirm(wppm_admin.confirm);
418 if (!flag) return;
419 var data = {
420 action: 'wppm_remove_checklist_item',
421 item_id:item_id,
422 checklist_id: checklist_id,
423 _ajax_nonce:jQuery('#wppm_delete_checklist_item_ajax_nonce').val()
424 };
425 jQuery.post(wppm_admin.ajax_url, data, function(response) {
426 if((proj_id!=0)||(proj_id!="")){
427 wppm_open_project_tasks(task_id,proj_id);
428 }else if((proj_id==0)||(proj_id=="")){
429 wppm_open_task(task_id);
430 }
431 });
432 }
433
434 function wppm_checklist_progress(checklist_id,item_id,task_id){
435 var $checkboxes = jQuery('.wppm_checklist_item_'+checklist_id);
436 var $progress = jQuery('#CheckProgress_'+checklist_id);
437 var total = $checkboxes.length;
438 var checked = jQuery('.wppm_checklist_item_'+checklist_id).filter(':checked').length;
439 var progressWidth = (checked / total) * 100;
440 var checked_item;
441 jQuery('#CheckProgress_'+checklist_id).css('background','#5ba4cf');
442 jQuery('#CheckProgress_'+checklist_id).css('width', progressWidth + '%');
443 if (jQuery("#wppm_checklist_item_"+item_id).prop("checked")==true) {
444 checked_item=1;
445 }else{
446 checked_item=0;
447 }
448 var data = {
449 action: 'wppm_set_checklist_progress',
450 checklist_id: checklist_id,
451 item_id:item_id,
452 checked_item: checked_item,
453 _ajax_nonce:jQuery('#wppm_checklist_progress_ajax_nonce').val()
454 };
455 jQuery.post(wppm_admin.ajax_url, data, function(response) {
456 wppm_open_task(task_id);
457 });
458 }
459
460 function wppm_open_individual_task(id){
461 jQuery('#wppm_project_container').show();
462 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
463 var data = {
464 action: 'wppm_open_task',
465 id:id
466 };
467 jQuery.post(wppm_admin.ajax_url, data, function(response) {
468 jQuery('#wppm_project_container').html(response);
469 });
470 }
471
472 function wppm_display_grid_view(){
473 var task_search = jQuery("#wppm_view_task_search_filter").val();
474 jQuery('#wppm_task_container').show();
475 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
476 var data = {
477 action: 'wppm_get_task_list_card_view',
478 task_search: task_search
479 };
480 jQuery.post(wppm_admin.ajax_url, data, function(response) {
481 jQuery('#wppm_task_container').html(response);
482 });
483 }
484
485 function wppm_remove_filter(id){
486 jQuery('#wppm_user_display_container_'+id).remove();
487 }
488
489 function wppm_remove_user_from_project(id){
490 jQuery('#wppm_user_container_'+id).remove();
491 }
492
493 function wppm_remove_task_user_filter(id){
494 jQuery('#wppm_task_user_display_container_'+id).remove();
495 }
496
497 function wppm_attachment_cancel( obj ){
498 jQuery(obj).parent().remove();
499 }
500
501 function wppm_get_en_general_setting(){
502 jQuery('.wppm_setting_pills li').removeClass('active');
503 jQuery('#wppm_en_setting_general').addClass('active');
504 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
505
506 var data = {
507 action: 'wppm_get_en_general_setting',
508 };
509
510 jQuery.post(wppm_admin.ajax_url, data, function(response) {
511 jQuery('.wppm_setting_col2').html(response);
512 });
513 }
514
515 function wppm_set_en_general_settings(){
516 jQuery('.wppm_submit_wait').show();
517 var dataform = new FormData(jQuery('#wppm_en_frm_general_settings')[0]);
518
519 jQuery.ajax({
520 url: wppm_admin.ajax_url,
521 type: 'POST',
522 data: dataform,
523 processData: false,
524 contentType: false
525 })
526 .done(function (response_str) {
527 var response = JSON.parse(response_str);
528 jQuery('.wppm_submit_wait').hide();
529 if (response.sucess_status=='1') {
530 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
531 }
532 jQuery('#wppm_alert_success').slideDown('fast',function(){});
533 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
534 });
535 }
536
537 function wppm_get_en_task_notifications(){
538 jQuery('.wppm_setting_pills li').removeClass('active');
539 jQuery('#wppm_en_ticket_notifications').addClass('active');
540 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
541
542 var data = {
543 action: 'wppm_get_en_task_notifications'
544 };
545
546 jQuery.post(wppm_admin.ajax_url, data, function(response) {
547 jQuery('.wppm_setting_col2').html(response);
548 });
549 }
550
551 function wppm_edit_task_status(id,proj_id){
552 if(proj_id==0){
553 wppm_task_modal_open('Edit');
554 }else{
555 wppm_modal_open('Edit');
556 }
557 var data = {
558 action: 'wppm_edit_task_status',
559 task_id: id,
560 proj_id:proj_id
561 }
562 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
563 var response = JSON.parse(response_str);
564 if(proj_id==0){
565 jQuery('#wppm_task_popup_body').html(response.body);
566 jQuery('#wppm_task_popup_footer').html(response.footer);
567 }else{
568 jQuery('#wppm_popup_body').html(response.body);
569 jQuery('#wppm_popup_footer').html(response.footer);
570 }
571 });
572 }
573
574 function wppm_edit_task_users(task_id,proj_id){
575 if(proj_id==0){
576 wppm_task_modal_open('Add Users');
577 }else{
578 wppm_modal_open('Add Users');
579 }
580 var data = {
581 action: 'wppm_get_task_users',
582 task_id: task_id,
583 proj_id:proj_id
584 }
585 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
586 var response = JSON.parse(response_str);
587 if(proj_id==0){
588 jQuery('#wppm_task_popup_body').html(response.body);
589 jQuery('#wppm_task_popup_footer').html(response.footer);
590 }else{
591 jQuery('#wppm_popup_body').html(response.body);
592 jQuery('#wppm_popup_footer').html(response.footer);
593 }
594 });
595 }
596
597 function wppm_edit_task_details(id,proj_id){
598 if(proj_id==0){
599 wppm_task_modal_open('Edit Task Details');
600 }else{
601 wppm_modal_open('Edit Task Details');
602 }
603 var data = {
604 action: 'wppm_edit_task_details',
605 task_id: id,
606 proj_id:proj_id
607 }
608 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
609 var response = JSON.parse(response_str);
610 if(proj_id==0){
611 jQuery('#wppm_task_popup_body').html(response.body);
612 jQuery('#wppm_task_popup_footer').html(response.footer);
613 }else{
614 jQuery('#wppm_popup_body').html(response.body);
615 jQuery('#wppm_popup_footer').html(response.footer);
616 }
617 });
618 }
619
620 function wppm_set_change_task_status(task_id,proj_id){
621 var dataform = new FormData(jQuery('#frm_get_task_change_status')[0]);
622 if(proj_id == 0){
623 wppm_task_modal_close();
624 }else{
625 wppm_modal_close();
626 }
627 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
628 jQuery.ajax({
629 url: wppm_admin.ajax_url,
630 type: 'POST',
631 data: dataform,
632 processData: false,
633 contentType: false
634 })
635 .done(function (response_str) {
636 if((proj_id!=0)||(proj_id!="")){
637 wppm_open_project_tasks(task_id,proj_id);
638 }else if((proj_id==0)||(proj_id=="")){
639 wppm_open_task(task_id);
640 }
641
642 });
643 }
644
645 function wppm_edit_task_creator(task_id,proj_id){
646 if(proj_id==0){
647 wppm_task_modal_open('Edit Task Creator');
648 }else{
649 wppm_modal_open('Edit Task Creator');
650 }
651 var data = {
652 action: 'wppm_edit_task_creator',
653 task_id: task_id,
654 proj_id: proj_id
655 }
656 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
657 var response = JSON.parse(response_str);
658 if(proj_id==0){
659 jQuery('#wppm_task_popup_body').html(response.body);
660 jQuery('#wppm_task_popup_footer').html(response.footer);
661 }else{
662 jQuery('#wppm_popup_body').html(response.body);
663 jQuery('#wppm_popup_footer').html(response.footer);
664 }
665 });
666 }
667
668 function wppm_set_change_raised_by(task_id,proj_id){
669 var dataform = new FormData(jQuery('#frm_get_task_creator')[0]);
670 if(proj_id==0){
671 wppm_task_modal_close();
672 }else{
673 wppm_modal_close();
674 }
675 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
676 jQuery.ajax({
677 url: wppm_admin.ajax_url,
678 type: 'POST',
679 data: dataform,
680 processData: false,
681 contentType: false
682 })
683 .done(function (response_str) {
684 if((proj_id!=0)||(proj_id!="")){
685 wppm_open_project_tasks(task_id,proj_id);
686 }else if((proj_id==0)||(proj_id=="")){
687 wppm_open_task(task_id);
688 }
689 });
690 }
691
692 function wppm_set_change_task_details(task_id,proj_id){
693 var dataform = new FormData(jQuery('#frm_get_edit_task_deatils')[0]);
694 var description = tinyMCE.get('wppm_edit_task_description').getContent().trim();
695 dataform.append('wppm_edit_task_description', description);
696 if(proj_id==0){
697 wppm_task_modal_close();
698 }else{
699 wppm_modal_close();
700 }
701 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
702 jQuery.ajax({
703 url: wppm_admin.ajax_url,
704 type: 'POST',
705 data: dataform,
706 processData: false,
707 contentType: false
708 })
709 .done(function (response_str) {
710 if((proj_id!=0)||(proj_id!="")){
711 wppm_open_project_tasks(task_id,proj_id);
712 }else if((proj_id==0)||(proj_id=="")){
713 wppm_open_task(task_id);
714 }
715 });
716 }
717
718 function wppm_edit_thread(comment_id,task_id,proj_id){
719 if(proj_id==0){
720 wppm_task_modal_open('Edit Thread');
721 }else{
722 wppm_modal_open('Edit Thread');
723 }
724 var data = {
725 action: 'wppm_edit_task_thread',
726 comment_id:comment_id,
727 task_id: task_id,
728 proj_id: proj_id
729 }
730 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
731 var response = JSON.parse(response_str);
732 if(proj_id==0){
733 jQuery('#wppm_task_popup_body').html(response.body);
734 jQuery('#wppm_task_popup_footer').html(response.footer);
735 }else{
736 jQuery('#wppm_popup_body').html(response.body);
737 jQuery('#wppm_popup_footer').html(response.footer);
738 }
739 });
740 }
741
742 function wppm_edit_proj_thread(comment_id,proj_id){
743 wppm_modal_open('Edit Thread');
744 var data = {
745 action: 'wppm_edit_proj_thread',
746 comment_id:comment_id,
747 proj_id: proj_id
748 }
749 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
750 var response = JSON.parse(response_str);
751 jQuery('#wppm_popup_body').html(response.body);
752 jQuery('#wppm_popup_footer').html(response.footer);
753 });
754 }
755
756 function wppm_set_edit_task_thread(task_id,proj_id){
757 var dataform = new FormData(jQuery('#frm_edit_task_thread')[0]);
758 var comment_body = tinyMCE.get('wppm_edit_task_thread_editor').getContent().trim();
759 dataform.append('wppm_edit_task_thread', comment_body);
760 if(proj_id==0){
761 wppm_task_modal_close();
762 }else{
763 wppm_modal_close();
764 }
765 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
766 jQuery.ajax({
767 url: wppm_admin.ajax_url,
768 type: 'POST',
769 data: dataform,
770 processData: false,
771 contentType: false
772 })
773 .done(function (response_str) {
774 if((proj_id!=0)||(proj_id!="")){
775 wppm_open_project_tasks(task_id,proj_id);
776 }else if((proj_id==0)||(proj_id=="")){
777 wppm_open_task(task_id);
778 }
779 });
780 }
781
782 function wppm_set_edit_proj_thread(proj_id){
783 var dataform = new FormData(jQuery('#frm_edit_proj_thread')[0]);
784 var comment_body = tinyMCE.get('wppm_edit_proj_thread_editor').getContent().trim();
785 dataform.append('wppm_edit_proj_thread', comment_body);
786 wppm_modal_close();
787 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
788 jQuery.ajax({
789 url: wppm_admin.ajax_url,
790 type: 'POST',
791 data: dataform,
792 processData: false,
793 contentType: false
794 })
795 .done(function (response_str) {
796 wppm_open_project(proj_id);
797 });
798 }
799
800 function wppm_delete_thread(comment_id,task_id,proj_id){
801 if(proj_id==0){
802 wppm_task_modal_open('Delete Thread');
803 }else{
804 wppm_modal_open('Delete Thread');
805 }
806 var data = {
807 action: 'wppm_delete_task_thread',
808 comment_id:comment_id,
809 task_id: task_id,
810 proj_id:proj_id
811 }
812 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
813 var response = JSON.parse(response_str);
814 if(proj_id==0){
815 jQuery('#wppm_task_popup_body').html(response.body);
816 jQuery('#wppm_task_popup_footer').html(response.footer);
817 }else{
818 jQuery('#wppm_popup_body').html(response.body);
819 jQuery('#wppm_popup_footer').html(response.footer);
820 }
821 });
822 }
823
824 function wppm_delete_proj_thread(comment_id,proj_id){
825 wppm_modal_open('Delete Thread');
826 var data = {
827 action: 'wppm_delete_proj_thread',
828 comment_id:comment_id,
829 proj_id:proj_id
830 }
831 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
832 var response = JSON.parse(response_str);
833 jQuery('#wppm_popup_body').html(response.body);
834 jQuery('#wppm_popup_footer').html(response.footer);
835 });
836 }
837
838 function wppm_set_delete_thread(task_id,proj_id){
839 var dataform = new FormData(jQuery('#frm_delete_task_thread')[0]);
840 if(proj_id==0){
841 wppm_task_modal_close();
842 }else{
843 wppm_modal_close();
844 }
845 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
846 jQuery.ajax({
847 url: wppm_admin.ajax_url,
848 type: 'POST',
849 data: dataform,
850 processData: false,
851 contentType: false
852 })
853 .done(function (response_str) {
854 if((proj_id!=0)||(proj_id!="")){
855 wppm_open_project_tasks(task_id,proj_id);
856 }else if((proj_id==0)||(proj_id=="")){
857 wppm_open_task(task_id);
858 }
859 });
860 }
861
862 function wppm_set_delete_proj_thread(proj_id){
863 var dataform = new FormData(jQuery('#frm_delete_proj_thread')[0]);
864 wppm_modal_close();
865 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
866 jQuery.ajax({
867 url: wppm_admin.ajax_url,
868 type: 'POST',
869 data: dataform,
870 processData: false,
871 contentType: false
872 })
873 .done(function (response_str) {
874 wppm_open_project(proj_id);
875 });
876 }
877
878 function wppm_edit_proj_details(id){
879 wppm_modal_open('Edit Project Details');
880 var data = {
881 action: 'wppm_edit_project_details',
882 id: id
883 }
884 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
885 var response = JSON.parse(response_str);
886 jQuery('#wppm_popup_body').html(response.body);
887 jQuery('#wppm_popup_footer').html(response.footer);
888 });
889 }
890
891 function wppm_set_change_project_details(id){
892 var dataform = new FormData(jQuery('#frm_get_edit_project_deatils')[0]);
893 var description = tinyMCE.get('wppm_edit_project_description').getContent().trim();
894 dataform.append('wppm_edit_project_description', description);
895 wppm_modal_close();
896 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
897 jQuery.ajax({
898 url: wppm_admin.ajax_url,
899 type: 'POST',
900 data: dataform,
901 processData: false,
902 contentType: false
903 })
904 .done(function (response_str) {
905 wppm_open_project(id);
906 });
907 }
908
909 function wppm_edit_project_status(id){
910 wppm_modal_open('Edit Project Status');
911 var data = {
912 action: 'wppm_edit_project_status',
913 id: id
914 }
915 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
916 var response = JSON.parse(response_str);
917 jQuery('#wppm_popup_body').html(response.body);
918 jQuery('#wppm_popup_footer').html(response.footer);
919 });
920 }
921
922 function wppm_set_change_project_status(id){
923 var dataform = new FormData(jQuery('#frm_get_project_change_status')[0]);
924 wppm_modal_close();
925 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
926 jQuery.ajax({
927 url: wppm_admin.ajax_url,
928 type: 'POST',
929 data: dataform,
930 processData: false,
931 contentType: false
932 })
933 .done(function (response_str) {
934 wppm_open_project(id);
935 });
936 }
937
938 function wppm_edit_project_creator(id){
939 wppm_modal_open('Edit Project Creator');
940 var data = {
941 action: 'wppm_edit_project_creator',
942 id: id
943 }
944 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
945 var response = JSON.parse(response_str);
946 jQuery('#wppm_popup_body').html(response.body);
947 jQuery('#wppm_popup_footer').html(response.footer);
948 });
949 }
950
951 function wppm_set_change_project_raised_by(id){
952 var dataform = new FormData(jQuery('#frm_get_project_creator')[0]);
953 wppm_modal_close();
954 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
955 jQuery.ajax({
956 url: wppm_admin.ajax_url,
957 type: 'POST',
958 data: dataform,
959 processData: false,
960 contentType: false
961 })
962 .done(function (response_str) {
963 wppm_open_project(id);
964 });
965 }
966
967 function wppm_edit_project_users(id){
968 wppm_modal_open('Add Users');
969 var data = {
970 action: 'wppm_get_project_users',
971 id: id
972 }
973 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
974 var response = JSON.parse(response_str);
975 jQuery('#wppm_popup_body').html(response.body);
976 jQuery('#wppm_popup_footer').html(response.footer);
977 });
978 }
979
980 function wppm_delete_project(id){
981 wppm_modal_open('Delete Project');
982 var data = {
983 action: 'wppm_get_delete_project',
984 id: id
985 }
986 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
987 var response = JSON.parse(response_str);
988 jQuery('#wppm_popup_body').html(response.body);
989 jQuery('#wppm_popup_footer').html(response.footer);
990 });
991 }
992
993 function wppm_set_delete_project(){
994 var dataform = new FormData(jQuery('#frm_delete_project')[0]);
995 wppm_modal_close();
996 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
997 jQuery.ajax({
998 url: wppm_admin.ajax_url,
999 type: 'POST',
1000 data: dataform,
1001 processData: false,
1002 contentType: false
1003 })
1004 .done(function (response_str) {
1005 wppm_get_project_list();
1006 });
1007 }
1008
1009 function wppm_get_delete_task(id,proj_id){
1010 if(proj_id==0){
1011 wppm_task_modal_open('Delete Task');
1012 }else{
1013 wppm_modal_open('Delete Task');
1014 }
1015 var data = {
1016 action: 'wppm_get_delete_task',
1017 id: id,
1018 proj_id:proj_id
1019 }
1020 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1021 var response = JSON.parse(response_str);
1022 if(proj_id==0){
1023 jQuery('#wppm_task_popup_body').html(response.body);
1024 jQuery('#wppm_task_popup_footer').html(response.footer);
1025 }else{
1026 jQuery('#wppm_popup_body').html(response.body);
1027 jQuery('#wppm_popup_footer').html(response.footer);
1028 }
1029 });
1030 }
1031
1032 function wppm_set_delete_task(proj_id){
1033 var dataform = new FormData(jQuery('#frm_delete_task')[0]);
1034 if(proj_id==0){
1035 wppm_task_modal_close();
1036 }else{
1037 wppm_modal_close();
1038 }
1039 jQuery.ajax({
1040 url: wppm_admin.ajax_url,
1041 type: 'POST',
1042 data: dataform,
1043 processData: false,
1044 contentType: false
1045 })
1046 .done(function (response_str) {
1047 if(proj_id==0){
1048 wppm_get_task_list();
1049 }else{
1050 wppm_get_project_tasks(proj_id);
1051 }
1052 });
1053 }
1054
1055 function wppm_get_edit_email_notification(id){
1056 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1057 var data = {
1058 action: 'wppm_get_edit_email_notification',
1059 id : id
1060 };
1061 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1062 jQuery('.wppm_setting_col2').html(response);
1063 });
1064 }
1065
1066 function wppm_get_tinymce(selector,body_id){
1067 jQuery('#visual').addClass('btn btn-primary');
1068 jQuery('#text').removeClass('btn btn-primary');
1069 jQuery('#text').addClass('btn btn-default');
1070 tinymce.init({
1071 selector:'#'+selector,
1072 body_id: body_id,
1073 menubar: false,
1074 statusbar: false,
1075 height : '200',
1076 plugins: [
1077 'lists link image directionality'
1078 ],
1079 image_advtab: true,
1080 toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image',
1081 branding: false,
1082 autoresize_bottom_margin: 20,
1083 browser_spellcheck : true,
1084 relative_urls : false,
1085 remove_script_host : false,
1086 convert_urls : true,
1087 setup: function (editor) {
1088 }
1089 });
1090 }
1091
1092 function wppm_get_textarea(){
1093 jQuery('#visual').removeClass('btn btn-primary');
1094 jQuery('#visual').addClass('btn btn-default');
1095 jQuery('#text').addClass('btn btn-primary');
1096 tinymce.remove();
1097 }
1098
1099 function wppm_get_templates(){
1100 wppm_modal_open(wppm_admin.templates);
1101 var data = {
1102 action: 'wppm_get_templates'
1103 };
1104 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1105 var response = JSON.parse(response_str);
1106 jQuery('#wppm_popup_body').html(response.body);
1107 jQuery('#wppm_popup_footer').html(response.footer);
1108 });
1109 }
1110
1111 function wppm_set_edit_email_notification(){
1112 var dataform = new FormData(jQuery('#wppm_edit_email_notification_settings')[0]);
1113 wppm_modal_close();
1114 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1115 jQuery.ajax({
1116 url: wppm_admin.ajax_url,
1117 type: 'POST',
1118 data: dataform,
1119 processData: false,
1120 contentType: false
1121 })
1122 .done(function (response_str) {
1123 var response = JSON.parse(response_str);
1124 if (response.sucess_status=='1') {
1125 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1126 }
1127 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1128 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1129 wppm_get_en_task_notifications();
1130 });
1131 }
1132
1133 function wppm_set_general_settings(){
1134 jQuery('.wppm_submit_wait').show();
1135 var dataform = new FormData(jQuery('#wppm_frm_general_settings')[0]);
1136 jQuery.ajax({
1137 url: wppm_admin.ajax_url,
1138 type: 'POST',
1139 data: dataform,
1140 processData: false,
1141 contentType: false
1142 })
1143 .done(function (response_str) {
1144 var response = JSON.parse(response_str);
1145 jQuery('.wppm_submit_wait').hide();
1146 if (response.sucess_status=='1') {
1147 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1148 }
1149 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1150 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1151 });
1152 }
1153
1154 function wppm_get_project_tasks(id){
1155 wppm_modal_open('Tasks');
1156 var data = {
1157 action: 'wppm_get_project_tasks',
1158 id: id
1159 }
1160 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1161 var response = JSON.parse(response_str);
1162 jQuery('#wppm_popup_body').html(response.body);
1163 jQuery('#wppm_popup_footer').html(response.footer);
1164 });
1165 }
1166
1167 function wppm_create_project_task(id){
1168 wppm_task_modal_open('Tasks');
1169 var data = {
1170 action: 'wppm_add_new_task',
1171 proj_id: id
1172 }
1173 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1174 jQuery('#wppm_popup_body').html(response_str);
1175 });
1176 }
1177
1178 function wppm_load_prev_page(prev_page_no,page_no,sort_by, order){
1179 if(prev_page_no!=0){
1180 page_no=prev_page_no-1;
1181 wppm_get_project_list(page_no,sort_by,order);
1182 }
1183 }
1184
1185 function wppm_load_next_page(next_page_no,page_no,sort_by,order){
1186 if(next_page_no!=page_no){
1187 page_no = next_page_no;
1188 wppm_get_project_list(page_no,sort_by,order);
1189 }
1190 }
1191
1192 function wppm_load_prev_task_page(prev_page_no,page_no, sort_by, order){
1193 if(prev_page_no!=0){
1194 page_no=prev_page_no-1;
1195 wppm_get_task_list(page_no,sort_by,order);
1196 }
1197 }
1198
1199 function wppm_load_next_task_page(next_page_no,page_no,sort_by,order){
1200 if(next_page_no!=page_no){
1201 page_no = next_page_no;
1202 wppm_get_task_list(page_no,sort_by,order);
1203 }
1204 }
1205
1206 function wppm_load_prev_task_page_card_view(prev_page_no,page_no){
1207 if(prev_page_no!=0){
1208 page_no=prev_page_no-1;
1209 wppm_view_task_search_filter(page_no);
1210 }
1211 }
1212
1213 function wppm_load_next_task_page_card_view(next_page_no,page_no){
1214 if(next_page_no!=page_no){
1215 page_no = next_page_no;
1216 wppm_view_task_search_filter(page_no);
1217 }
1218 }
1219
1220 function wppm_thread_attachment_remove(obj,attachment,comment_id,task_id,proj_id){
1221 if( confirm(wppm_admin.confirm) ){
1222 var data = {
1223 action: 'wppm_remove_thread_attachment',
1224 attachment : attachment,
1225 comment_id : comment_id,
1226 task_id:task_id,
1227 _ajax_nonce : jQuery('#wppm_ajax_nonce').val()
1228 };
1229 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1230 jQuery(obj).parent('td').parent('tr').remove();
1231 if((proj_id!=0)||(proj_id!="")){
1232 wppm_open_project_tasks(task_id,proj_id);
1233 }else if((proj_id==0)||(proj_id=="")){
1234 wppm_open_task(task_id);
1235 }
1236 });
1237 }
1238 }
1239
1240 function wppm_proj_thread_attachment_remove(obj,attachment,comment_id,id){
1241 if( confirm(wppm_admin.confirm) ){
1242 var data = {
1243 action: 'wppm_remove_proj_thread_attachment',
1244 attachment : attachment,
1245 comment_id : comment_id,
1246 proj_id:id,
1247 _ajax_nonce:jQuery('#wppm_proj_thread_attachment_remove').val()
1248 };
1249 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1250 jQuery(obj).parent('td').parent('tr').remove();
1251 wppm_open_project(id);
1252 });
1253 }
1254 }
1255
1256 function wppm_open_project(id){
1257 jQuery('#wppm_project_list').hide();
1258 jQuery('#wppm_project_container').show();
1259 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1260 var data = {
1261 action: 'wppm_open_project',
1262 id:id,
1263 auth_code: wppm_admin.auth_code
1264 };
1265 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1266 jQuery('#wppm_project_container').html(response);
1267 });
1268 }
1269
1270 function wppm_project_search_filter(){
1271 var project_search = jQuery("#wppm_project_search_filter").val();
1272 jQuery('#wppm_project_container').show();
1273 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1274 var data = {
1275 action: 'wppm_get_project_list',
1276 project_search:project_search
1277 };
1278 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1279 jQuery('#wppm_project_container').html(response);
1280 });
1281 }
1282
1283 function wppm_clone_task(id,proj_id){
1284 if(proj_id==0){
1285 wppm_task_modal_open('Clone Task');
1286 }else{
1287 wppm_modal_open('Clone Task');
1288 }
1289 var data = {
1290 action: 'wppm_clone_task',
1291 id: id,
1292 proj_id: proj_id
1293 }
1294 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1295 var response = JSON.parse(response_str);
1296 if(proj_id==0){
1297 jQuery('#wppm_task_popup_body').html(response.body);
1298 jQuery('#wppm_task_popup_footer').html(response.footer);
1299 }else{
1300 jQuery('#wppm_popup_body').html(response.body);
1301 jQuery('#wppm_popup_footer').html(response.footer);
1302 }
1303 });
1304 }
1305
1306 function wppm_set_clone_task(proj_id){
1307 var dataform = new FormData(jQuery('#frm_edit_clone_task_name')[0]);
1308 if(proj_id==0){
1309 wppm_task_modal_close();
1310 }else{
1311 wppm_modal_close();
1312 }
1313 jQuery.ajax({
1314 url: wppm_admin.ajax_url,
1315 type: 'POST',
1316 data: dataform,
1317 processData: false,
1318 contentType: false
1319 })
1320 .done(function (response_str) {
1321 if(proj_id==0){
1322 wppm_get_task_list();
1323 }else{
1324 wppm_get_project_tasks(proj_id);
1325 }
1326 });
1327 }
1328
1329 function wppm_sort_up_task_list(sort_by,order){
1330 jQuery('#wppm_task_container').show();
1331 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1332 var data = {
1333 action: 'wppm_get_task_list',
1334 sort_by:sort_by,
1335 order:order
1336 };
1337 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1338 jQuery('#wppm_task_container').html(response);
1339 });
1340 }
1341
1342 function wppm_sort_up_project_list(sort_by,order){
1343 jQuery('#wppm_project_container').show();
1344 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1345 var data = {
1346 action: 'wppm_get_project_list',
1347 sort_by:sort_by,
1348 order:order
1349 };
1350 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1351 jQuery('#wppm_project_container').html(response);
1352 });
1353 }
1354
1355 function wppm_get_miscellaneous_settings(){
1356 jQuery('.wppm_setting_pills li').removeClass('active');
1357 jQuery('#wppm_settings_miscellaneous').addClass('active');
1358 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1359 var data = {
1360 action: 'wppm_get_advanced_settings'
1361 };
1362 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1363 jQuery('.wppm_setting_col2').html(response);
1364 });
1365 }
1366
1367 function wppm_get_appearance_settings(){
1368 jQuery('.wppm_setting_pills li').removeClass('active');
1369 jQuery('#wppm_settings_appearance').addClass('active');
1370 var data = {
1371 action: 'wppm_get_appearance_settings'
1372 };
1373 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1374 jQuery('.wppm_setting_col2').html(response);
1375 });
1376 }
1377
1378 function wppm_get_coworker_permission_settings(){
1379 jQuery('.wppm_setting_pills li').removeClass('active');
1380 jQuery('#wppm_settings_coworker').addClass('active');
1381 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1382 var data = {
1383 action: 'wppm_get_coworker_permission_settings'
1384 };
1385 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1386 jQuery('.wppm_setting_col2').html(response);
1387 });
1388 }
1389
1390 function wppm_set_coworkers_permission_settings(){
1391 jQuery('.wppm_submit_wait').show();
1392 var dataform = new FormData(jQuery('#wppm_frm_coworkers_permission_settings')[0]);
1393 jQuery.ajax({
1394 url: wppm_admin.ajax_url,
1395 type: 'POST',
1396 data: dataform,
1397 processData: false,
1398 contentType: false
1399 })
1400 .done(function (response_str) {
1401 var response = JSON.parse(response_str);
1402 jQuery('.wppm_submit_wait').hide();
1403 if (response.sucess_status=='1') {
1404 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1405 }
1406 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1407 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1408 });
1409 }
1410
1411 function wppm_get_rich_text_editor_settings(){
1412 jQuery('.wppm_setting_pills li').removeClass('active');
1413 jQuery('#wppm_settings_rich_text_editor').addClass('active');
1414 jQuery('.wppm_setting_col2').html(wppm_admin.loading_html);
1415 var data = {
1416 action: 'wppm_get_rich_text_editor_settings'
1417 };
1418 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1419 jQuery('.wppm_setting_col2').html(response);
1420 });
1421 }
1422
1423 function wppm_set_rich_text_editor_settings(){
1424 jQuery('.wppm_submit_wait').show();
1425 var dataform = new FormData(jQuery('#wppm_frm_rich_text_editor_settings')[0]);
1426 jQuery.ajax({
1427 url: wppm_admin.ajax_url,
1428 type: 'POST',
1429 data: dataform,
1430 processData: false,
1431 contentType: false
1432 })
1433 .done(function (response_str) {
1434 var response = JSON.parse(response_str);
1435 jQuery('.wppm_submit_wait').hide();
1436 if (response.sucess_status=='1') {
1437 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1438 }
1439 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1440 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1441 });
1442 }
1443
1444 function wppm_get_ap_proj_list(current_tab_class) {
1445 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1446 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1447 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1448 var data = { action: 'wppm_get_ap_proj_list' ,
1449 current_tab:current_tab_class
1450 };
1451 jQuery.post(
1452 wppm_admin.ajax_url,
1453 data,
1454 function (response) {
1455 jQuery( '.wppm-setting-section-body' ).html( response );
1456 }
1457 );
1458 }
1459
1460 function wppm_get_ap_modal_popup(current_tab_class){
1461 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1462 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1463 jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html);
1464 var data = { action: 'wppm_get_ap_modal_popup' ,
1465 current_tab:current_tab_class };
1466 jQuery.post(
1467 wppm_admin.ajax_url,
1468 data,
1469 function (response) {
1470 jQuery( '.wppm-setting-section-body' ).html( response );
1471 }
1472 );
1473 }
1474
1475 function wppm_get_ap_task_list(current_tab_class){
1476 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1477 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1478 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1479 var data = { action: 'wppm_get_ap_task_list' ,
1480 current_tab:current_tab_class
1481 };
1482 jQuery.post(
1483 wppm_admin.ajax_url,
1484 data,
1485 function (response) {
1486 jQuery( '.wppm-setting-section-body' ).html( response );
1487 }
1488 );
1489 }
1490
1491 function wppm_get_ap_individual_proj(current_tab_class){
1492 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1493 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1494 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1495 var data = { action: 'wppm_get_ap_individual_proj' ,
1496 current_tab:current_tab_class
1497 };
1498 jQuery.post(
1499 wppm_admin.ajax_url,
1500 data,
1501 function (response) {
1502 jQuery( '.wppm-setting-section-body' ).html( response );
1503 }
1504 );
1505 }
1506
1507 function wppm_get_ap_individual_task(current_tab_class){
1508 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1509 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1510 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1511 var data = { action: 'wppm_get_ap_individual_task' ,
1512 current_tab:current_tab_class
1513 };
1514 jQuery.post(
1515 wppm_admin.ajax_url,
1516 data,
1517 function (response) {
1518 jQuery( '.wppm-setting-section-body' ).html( response );
1519 }
1520 );
1521 }
1522
1523 function wppm_get_ap_grid_view(current_tab_class){
1524 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1525 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1526 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1527 var data = { action: 'wppm_get_ap_grid_view' ,
1528 current_tab:current_tab_class
1529 };
1530 jQuery.post(
1531 wppm_admin.ajax_url,
1532 data,
1533 function (response) {
1534 jQuery( '.wppm-setting-section-body' ).html( response );
1535 }
1536 );
1537 }
1538
1539 function wppm_get_ap_settings(current_tab_class){
1540 jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' );
1541 jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' );
1542 jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html);
1543 var data = { action: 'wppm_get_ap_settings' ,
1544 current_tab:current_tab_class
1545 };
1546 jQuery.post(
1547 wppm_admin.ajax_url,
1548 data,
1549 function (response) {
1550 jQuery( '.wppm-setting-section-body' ).html( response );
1551 }
1552 );
1553 }
1554
1555 function wppm_set_ap_settings(){
1556 var form = jQuery( '.wppm-frm-ap-settings' )[0];
1557 var dataform = new FormData( form );
1558 jQuery('.wppm_submit_wait').show();
1559 jQuery.ajax(
1560 {
1561 url: wppm_admin.ajax_url,
1562 type: 'POST',
1563 data: dataform,
1564 processData: false,
1565 contentType: false
1566 }
1567 ).done(
1568 function (response_str) {
1569 var response = JSON.parse(response_str);
1570 jQuery('.wppm_submit_wait').hide();
1571 if (response.sucess_status=='1') {
1572 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1573 }
1574 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1575 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1576 }
1577 );
1578 }
1579
1580 function wppm_set_ap_proj_list() {
1581 var form = jQuery( '.wppm-frm-ap-pl' )[0];
1582 var dataform = new FormData( form );
1583 jQuery('.wppm_submit_wait').show();
1584 jQuery.ajax(
1585 {
1586 url: wppm_admin.ajax_url,
1587 type: 'POST',
1588 data: dataform,
1589 processData: false,
1590 contentType: false
1591 }
1592 ).done(
1593 function (response_str) {
1594 var response = JSON.parse(response_str);
1595 jQuery('.wppm_submit_wait').hide();
1596 if (response.sucess_status=='1') {
1597 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1598 }
1599 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1600 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1601 }
1602 );
1603 }
1604
1605 function wppm_set_ap_task_list(){
1606 var form = jQuery( '.wppm-frm-ap-tl' )[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_individual_proj(){
1631 var form = jQuery( '.wppm-frm-ap-individual_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_individual_task(){
1656 var form = jQuery( '.wppm-frm-ap-individual_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_modal_popup(){
1681 var form = jQuery( '.wppm-frm-ap-modal_popup' )[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_grid_view(){
1706 var form = jQuery( '.wppm-frm-ap-grid_view' )[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_advanced_settings(){
1731 jQuery('.wppm_submit_wait').show();
1732 var dataform = new FormData(jQuery('#wppm_frm_advanced_settings')[0]);
1733 jQuery.ajax({
1734 url: wppm_admin.ajax_url,
1735 type: 'POST',
1736 data: dataform,
1737 processData: false,
1738 contentType: false
1739 })
1740 .done(function (response_str) {
1741 var response = JSON.parse(response_str);
1742 jQuery('.wppm_submit_wait').hide();
1743 if (response.sucess_status=='1') {
1744 jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege);
1745 }
1746 jQuery('#wppm_alert_success').slideDown('fast',function(){});
1747 setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000);
1748 });
1749 }
1750
1751 function wppm_get_project_visibility(id){
1752 wppm_modal_open('Change Visibility');
1753 var data = {
1754 action: 'wppm_get_project_visibility',
1755 id: id
1756 }
1757 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
1758 var response = JSON.parse(response_str);
1759 jQuery('#wppm_popup_body').html(response.body);
1760 jQuery('#wppm_popup_footer').html(response.footer);
1761 });
1762 }
1763
1764 function wppm_select_project_visibility(proj_id){
1765 if(jQuery('input[name="wppm_project_visibility_option"]').is(':checked')){
1766 var project_visibility = jQuery('input[name="wppm_project_visibility_option"]:checked').val();
1767 }else{
1768 var project_visibility = 0;
1769 }
1770 var data = {
1771 action: 'wppm_change_project_visibility',
1772 project_id:proj_id,
1773 project_visibility:project_visibility,
1774 _ajax_nonce:jQuery('#wppm_proj_visibility_ajax_nonce').val()
1775 };
1776 jQuery.post(wppm_admin.ajax_url, data, function() {
1777 });
1778 }
1779
1780 function wppm_apply_project_filter(){
1781 wppm_project_filter = jQuery('#wppm_project_filter').find(":selected").val();
1782 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1783 var data = {
1784 action: 'wppm_get_project_list',
1785 wppm_project_filter:wppm_project_filter
1786 };
1787 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1788 jQuery('#wppm_project_container').html(response);
1789 });
1790 }
1791
1792 function wppm_apply_task_filter(){
1793 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1794 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1795 var data = {
1796 action: 'wppm_get_task_list',
1797 wppm_task_filter:wppm_task_filter
1798 };
1799 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1800 jQuery('#wppm_task_container').html(response);
1801 });
1802 }
1803
1804 function wppm_tl_reset_filter(){
1805 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1806 var data = {
1807 action: 'wppm_get_task_list',
1808 wppm_task_filter:'all',
1809 task_search:"",
1810 sort_by:"task_name",
1811 order:"ASC",
1812 wppm_proj_filter:0
1813 };
1814 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1815 jQuery('#wppm_task_container').html(response);
1816 });
1817 }
1818
1819 function wppm_apply_task_filter_grid_view(){
1820 wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val();
1821 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1822 var data = {
1823 action: 'wppm_view_project_tasks',
1824 wppm_task_filter:wppm_task_filter
1825 };
1826 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1827 jQuery('#wppm_task_container').html(response);
1828 });
1829 }
1830
1831 function wppm_tl_reset_grid_view_filter(){
1832 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1833 var data = {
1834 action: 'wppm_view_project_tasks',
1835 wppm_task_filter:'all',
1836 task_search:"",
1837 sort_by:"task_name",
1838 order:"ASC",
1839 wppm_proj_filter:"0"
1840 };
1841 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1842 jQuery('#wppm_task_container').html(response);
1843 });
1844 }
1845
1846 function wppm_pl_reset_filter(){
1847 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
1848 var data = {
1849 action: 'wppm_get_project_list',
1850 wppm_project_filter:'all',
1851 project_search:"",
1852 sort_by:"project_name",
1853 order:"ASC"
1854 };
1855 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1856 jQuery('#wppm_project_container').html(response);
1857 });
1858 }
1859
1860 function wppm_tasks_by_select_project(){
1861 wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val();
1862 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
1863 var data = {
1864 action: 'wppm_get_task_list',
1865 wppm_proj_filter:wppm_proj_filter
1866 };
1867 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1868 jQuery('#wppm_task_container').html(response);
1869 });
1870 }
1871
1872 function wppm_tasks_by_select_project_grid_view(){
1873 wppm_proj_filter = jQuery('#wppm_task_list_proj_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_proj_filter:wppm_proj_filter
1878 };
1879 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1880 jQuery('#wppm_task_container').html(response);
1881 });
1882 }
1883
1884 function wppm_reset_ap_proj_list(){
1885 jQuery( "#wppm_reset_ap_proj_list_btn" ).text( wppm_admin.please_wait );
1886 var _ajax_nonce = jQuery("#wppm_reset_ap_proj_list_nonce").val();
1887 var data = { action: 'wppm_reset_ap_proj_list',_ajax_nonce };
1888 jQuery.post(
1889 wppm_admin.ajax_url,
1890 data,
1891 function () {
1892 wppm_get_ap_proj_list('project-list');
1893 }
1894 );
1895 }
1896
1897 function wppm_reset_ap_task_list(){
1898 jQuery( "#wppm_reset_ap_task_list_btn" ).text( wppm_admin.please_wait );
1899 var _ajax_nonce = jQuery("#wppm_reset_ap_task_list_ajax_nonce").val();
1900 var data = { action: 'wppm_reset_ap_task_list',_ajax_nonce };
1901 jQuery.post(
1902 wppm_admin.ajax_url,
1903 data,
1904 function () {
1905 wppm_get_ap_task_list('task-list');
1906 }
1907 );
1908 }
1909
1910 function wppm_reset_ap_individual_proj(){
1911 jQuery( "#wppm_reset_ap_individual_proj_btn" ).text( wppm_admin.please_wait );
1912 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_proj_ajax_nonce").val();
1913 var data = { action: 'wppm_reset_ap_individual_proj',
1914 _ajax_nonce, };
1915 jQuery.post(
1916 wppm_admin.ajax_url,
1917 data,
1918 function () {
1919 wppm_get_ap_individual_proj('individual-project');
1920 }
1921 );
1922 }
1923
1924 function wppm_reset_ap_individual_task(){
1925 jQuery( "#wppm_reset_ap_individual_task_btn" ).text( wppm_admin.please_wait );
1926 var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_task_ajax_nonce" ).val();
1927 var data = { action: 'wppm_reset_ap_individual_task',_ajax_nonce };
1928 jQuery.post(
1929 wppm_admin.ajax_url,
1930 data,
1931 function () {
1932 wppm_get_ap_individual_task('individual-task');
1933 }
1934 );
1935 }
1936
1937 function wppm_reset_ap_modal_popup(){
1938 jQuery( "#wppm_reset_ap_modal_popup_btn" ).text( wppm_admin.please_wait );
1939 var _ajax_nonce = jQuery( "#wppm_reset_ap_modal_popup_nonce" ).val();
1940 var data = { action: 'wppm_reset_ap_modal_popup',_ajax_nonce };
1941 jQuery.post(
1942 wppm_admin.ajax_url,
1943 data,
1944 function () {
1945 wppm_get_ap_modal_popup('modal-popup');
1946 }
1947 );
1948 }
1949
1950 function wppm_reset_ap_grid_view(){
1951 jQuery( "#wppm_reset_ap_grid_view_btn" ).text( wppm_admin.please_wait );
1952 var wppm_reset_grid_ajax_nonce = jQuery( "#wppm_reset_ap_grid_view_ajax_nonce" ).val();
1953 var data = {
1954 action: 'wppm_reset_ap_grid_view',
1955 wppm_reset_grid_ajax_nonce:wppm_reset_grid_ajax_nonce
1956 };
1957 jQuery.post(wppm_admin.ajax_url, data, function(response) {
1958 wppm_get_ap_grid_view('grid-view');
1959 });
1960 }
1961
1962 function wppm_reset_ap_settings(){
1963 jQuery( "#wppm_reset_ap_settings_btn" ).text( wppm_admin.please_wait );
1964 var _ajax_nonce = jQuery("#wppm_reset_ap_settings_nonce").val();
1965 var data = { action: 'wppm_reset_ap_settings',_ajax_nonce };
1966 jQuery.post(
1967 wppm_admin.ajax_url,
1968 data,
1969 function () {
1970 wppm_get_ap_settings('settings');
1971 }
1972 );
1973 }
1974 /**
1975 * Bulk selector change
1976 */
1977 function wppm_bulk_select_change() {
1978 jQuery("#wppm-bulk-actions-btn").show();
1979 var checked = jQuery(".wppm-bulk-selector").is(":checked");
1980 jQuery(".wppm-bulk-select").prop("checked", checked);
1981 if(!checked){
1982 jQuery("#wppm-bulk-actions-btn").hide();
1983 }
1984 }
1985
1986 function wppm_task_bulk_select_change() {
1987 jQuery("#wppm-task-bulk-actions-btn").show();
1988 var checked = jQuery(".wppm-bulk-selector").is(":checked");
1989 jQuery(".wppm-task-bulk-select").prop("checked", checked);
1990 if(!checked){
1991 jQuery("#wppm-bulk-actions-btn").hide();
1992 }
1993 }
1994
1995 function wppm_bulk_change_status(nonce){
1996 var items = jQuery(".wppm-bulk-select:checked");
1997 var checked = items.length === 0 ? false : true;
1998 jQuery(".wppm-bulk-selector").prop("checked", checked);
1999 if (items.length != 0) {
2000 var proj_ids = jQuery(".wppm-bulk-select:checked")
2001 .map(function () {
2002 return this.value;
2003 })
2004 .get();
2005 wppm_modal_open('Change Status');
2006 var data = {
2007 action: "wppm_get_bulk_change_proj_status",
2008 proj_ids,
2009 _ajax_nonce: nonce,
2010 };
2011 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2012 var response = JSON.parse(response_str);
2013 jQuery('#wppm_popup_body').html(response.body);
2014 jQuery('#wppm_popup_footer').html(response.footer);
2015 });
2016 }
2017 }
2018
2019 function wppm_set_bulk_change_project_status(){
2020 var dataform = new FormData(jQuery('#frm_get_bulk_project_change_status')[0]);
2021 wppm_modal_close();
2022 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2023 jQuery.ajax({
2024 url: wppm_admin.ajax_url,
2025 type: 'POST',
2026 data: dataform,
2027 processData: false,
2028 contentType: false
2029 })
2030 .done(function (response_str) {
2031 wppm_get_project_list();
2032 });
2033 }
2034
2035 function wppm_bulk_change_category(nonce){
2036 var items = jQuery(".wppm-bulk-select:checked");
2037 var checked = items.length === 0 ? false : true;
2038 jQuery(".wppm-bulk-selector").prop("checked", checked);
2039 if (items.length != 0) {
2040 var proj_ids = jQuery(".wppm-bulk-select:checked")
2041 .map(function () {
2042 return this.value;
2043 })
2044 .get();
2045 wppm_modal_open('Change Category');
2046 var data = {
2047 action: "wppm_get_bulk_change_proj_cat",
2048 proj_ids,
2049 _ajax_nonce: nonce,
2050 };
2051 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2052 var response = JSON.parse(response_str);
2053 jQuery('#wppm_popup_body').html(response.body);
2054 jQuery('#wppm_popup_footer').html(response.footer);
2055 });
2056 }
2057 }
2058
2059 function wppm_set_bulk_change_project_category(){
2060 var dataform = new FormData(jQuery('#frm_get_bulk_project_change_category')[0]);
2061 wppm_modal_close();
2062 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2063 jQuery.ajax({
2064 url: wppm_admin.ajax_url,
2065 type: 'POST',
2066 data: dataform,
2067 processData: false,
2068 contentType: false
2069 })
2070 .done(function (response_str) {
2071 wppm_get_project_list();
2072 });
2073 }
2074
2075 function wppm_bulk_assign_users(nonce){
2076 var items = jQuery(".wppm-bulk-select:checked");
2077 var checked = items.length === 0 ? false : true;
2078 jQuery(".wppm-bulk-selector").prop("checked", checked);
2079 if (items.length != 0) {
2080 var proj_ids = jQuery(".wppm-bulk-select:checked")
2081 .map(function () {
2082 return this.value;
2083 })
2084 .get();
2085 wppm_modal_open('Assign Co-workers');
2086 var data = {
2087 action: "wppm_get_bulk_assign_users",
2088 proj_ids,
2089 _ajax_nonce: nonce,
2090 };
2091 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2092 var response = JSON.parse(response_str);
2093 jQuery('#wppm_popup_body').html(response.body);
2094 jQuery('#wppm_popup_footer').html(response.footer);
2095 });
2096 }
2097 }
2098
2099 function wppm_set_bulk_project_users(){
2100 var dataform = new FormData(jQuery('#frm_get_bulk_project_users')[0]);
2101 wppm_modal_close();
2102 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2103 jQuery.ajax({
2104 url: wppm_admin.ajax_url,
2105 type: 'POST',
2106 data: dataform,
2107 processData: false,
2108 contentType: false
2109 })
2110 .done(function (response_str) {
2111 wppm_get_project_list();
2112 });
2113 }
2114
2115 function wppm_bulk_delete_project(nonce){
2116 var items = jQuery(".wppm-bulk-select:checked");
2117 var checked = items.length === 0 ? false : true;
2118 jQuery(".wppm-bulk-selector").prop("checked", checked);
2119 if (items.length != 0) {
2120 var proj_ids = jQuery(".wppm-bulk-select:checked")
2121 .map(function () {
2122 return this.value;
2123 })
2124 .get();
2125 wppm_modal_open('Delete Project');
2126 var data = {
2127 action: "wppm_get_bulk_delete_project",
2128 proj_ids,
2129 _ajax_nonce: nonce,
2130 };
2131 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2132 var response = JSON.parse(response_str);
2133 jQuery('#wppm_popup_body').html(response.body);
2134 jQuery('#wppm_popup_footer').html(response.footer);
2135 });
2136 }
2137 }
2138
2139 function wppm_set_delete_bulk_projects(){
2140 var dataform = new FormData(jQuery('#frm_delete_bulk_project')[0]);
2141 wppm_modal_close();
2142 jQuery('#wppm_project_container').html(wppm_admin.loading_html);
2143 jQuery.ajax({
2144 url: wppm_admin.ajax_url,
2145 type: 'POST',
2146 data: dataform,
2147 processData: false,
2148 contentType: false
2149 })
2150 .done(function (response_str) {
2151 wppm_get_project_list();
2152 });
2153 }
2154
2155 function wppm_bulk_change_task_status(nonce){
2156 var items = jQuery(".wppm-task-bulk-select:checked");
2157 var checked = items.length === 0 ? false : true;
2158 jQuery(".wppm-bulk-selector").prop("checked", checked);
2159 if (items.length != 0) {
2160 var task_ids = jQuery(".wppm-task-bulk-select:checked")
2161 .map(function () {
2162 return this.value;
2163 })
2164 .get();
2165 wppm_task_modal_open('Change Task Status');
2166 var data = {
2167 action: "wppm_get_bulk_change_task_status",
2168 task_ids,
2169 _ajax_nonce: nonce,
2170 };
2171 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2172 var response = JSON.parse(response_str);
2173 jQuery('#wppm_task_popup_body').html(response.body);
2174 jQuery('#wppm_task_popup_footer').html(response.footer);
2175 });
2176 }
2177 }
2178
2179 function wppm_set_bulk_change_task_priority(){
2180 var dataform = new FormData(jQuery('#frm_get_bulk_task_change_priority')[0]);
2181 wppm_task_modal_close();
2182 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2183 jQuery.ajax({
2184 url: wppm_admin.ajax_url,
2185 type: 'POST',
2186 data: dataform,
2187 processData: false,
2188 contentType: false
2189 })
2190 .done(function (response_str) {
2191 wppm_get_task_list();
2192 });
2193 }
2194
2195 function wppm_set_bulk_change_task_status(){
2196 var dataform = new FormData(jQuery('#frm_get_bulk_task_change_status')[0]);
2197 wppm_task_modal_close();
2198 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2199 jQuery.ajax({
2200 url: wppm_admin.ajax_url,
2201 type: 'POST',
2202 data: dataform,
2203 processData: false,
2204 contentType: false
2205 })
2206 .done(function (response_str) {
2207 wppm_get_task_list();
2208 });
2209 }
2210
2211 function wppm_bulk_change_task_priority(nonce){
2212 var items = jQuery(".wppm-task-bulk-select:checked");
2213 var checked = items.length === 0 ? false : true;
2214 jQuery(".wppm-bulk-selector").prop("checked", checked);
2215 if (items.length != 0) {
2216 var task_ids = jQuery(".wppm-task-bulk-select:checked")
2217 .map(function () {
2218 return this.value;
2219 })
2220 .get();
2221 wppm_task_modal_open('Change Task Priority');
2222 var data = {
2223 action: "wppm_get_bulk_change_task_priority",
2224 task_ids,
2225 _ajax_nonce: nonce
2226 };
2227 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2228 var response = JSON.parse(response_str);
2229 jQuery('#wppm_task_popup_body').html(response.body);
2230 jQuery('#wppm_task_popup_footer').html(response.footer);
2231 });
2232 }
2233 }
2234
2235 function wppm_bulk_delete_task(nonce){
2236 var items = jQuery(".wppm-task-bulk-select:checked");
2237 var checked = items.length === 0 ? false : true;
2238 jQuery(".wppm-bulk-selector").prop("checked", checked);
2239 if (items.length != 0) {
2240 var task_ids = jQuery(".wppm-task-bulk-select:checked")
2241 .map(function () {
2242 return this.value;
2243 })
2244 .get();
2245 wppm_task_modal_open('Delete Task');
2246 var data = {
2247 action: "wppm_get_bulk_delete_task",
2248 task_ids,
2249 _ajax_nonce: nonce,
2250 };
2251 jQuery.post(wppm_admin.ajax_url, data, function(response_str) {
2252 var response = JSON.parse(response_str);
2253 jQuery('#wppm_task_popup_body').html(response.body);
2254 jQuery('#wppm_task_popup_footer').html(response.footer);
2255 });
2256 }
2257 }
2258
2259 function wppm_set_delete_bulk_tasks(){
2260 var dataform = new FormData(jQuery('#frm_delete_bulk_tasks')[0]);
2261 wppm_task_modal_close();
2262 jQuery('#wppm_task_container').html(wppm_admin.loading_html);
2263 jQuery.ajax({
2264 url: wppm_admin.ajax_url,
2265 type: 'POST',
2266 data: dataform,
2267 processData: false,
2268 contentType: false
2269 })
2270 .done(function (response_str) {
2271 wppm_get_task_list();
2272 });
2273 }