PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 5.0.2
Taskbuilder – Project Management & Task Management Tool With Kanban Board v5.0.2
6.0.6 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 All 58 releases
taskbuilder / asset / js / admin.js

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

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