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

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

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