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

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

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