| 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 |
/* |
| 43 |
* Category Settings |
| 44 |
*/ |
| 45 |
function wppm_get_category_settings(){ |
| 46 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 47 |
jQuery('#wppm_settings_category').addClass('active'); |
| 48 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 49 |
var data = { |
| 50 |
action: 'wppm_get_category_settings' |
| 51 |
}; |
| 52 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 53 |
jQuery('.wppm_setting_col2').html(response); |
| 54 |
}); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Delete category |
| 59 |
*/ |
| 60 |
function wppm_delete_category(cat_id) { |
| 61 |
|
| 62 |
const flag = confirm(wppm_admin.confirm); |
| 63 |
if (!flag) return; |
| 64 |
|
| 65 |
var data = { action: 'wppm_delete_category', cat_id }; |
| 66 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 67 |
wppm_get_category_settings(); |
| 68 |
}); |
| 69 |
} |
| 70 |
|
| 71 |
function wppm_get_proj_status_settings(){ |
| 72 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 73 |
jQuery('#wppm_settings_proj_status').addClass('active'); |
| 74 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 75 |
var data = { |
| 76 |
action: 'wppm_get_proj_status_settings' |
| 77 |
}; |
| 78 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 79 |
jQuery('.wppm_setting_col2').html(response); |
| 80 |
}); |
| 81 |
} |
| 82 |
|
| 83 |
function wppm_get_add_proj_status(){ |
| 84 |
wppm_modal_open(wppm_admin.add_new_status); |
| 85 |
var data = { |
| 86 |
action: 'wppm_get_add_proj_status' |
| 87 |
}; |
| 88 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 89 |
var response = JSON.parse(response_str); |
| 90 |
jQuery('#wppm_popup_body').html(response.body); |
| 91 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 92 |
jQuery('#wppm_proj_status_name').focus(); |
| 93 |
}); |
| 94 |
} |
| 95 |
|
| 96 |
function wppm_delete_proj_status(status_id){ |
| 97 |
const flag = confirm(wppm_admin.confirm); |
| 98 |
if (!flag) return; |
| 99 |
|
| 100 |
var data = { action: 'wppm_delete_status', status_id }; |
| 101 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 102 |
wppm_get_proj_status_settings(); |
| 103 |
}); |
| 104 |
} |
| 105 |
|
| 106 |
function wppm_set_project_users(){ |
| 107 |
var dataform = new FormData(jQuery('#frm_get_project_users')[0]); |
| 108 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 109 |
var proj_id = jQuery('#wppm_proj_id').val(); |
| 110 |
jQuery.ajax({ |
| 111 |
url: wppm_admin.ajax_url, |
| 112 |
type: 'POST', |
| 113 |
data: dataform, |
| 114 |
processData: false, |
| 115 |
contentType: false |
| 116 |
}) |
| 117 |
.done(function () { |
| 118 |
wppm_modal_close(); |
| 119 |
wppm_open_project(proj_id); |
| 120 |
}); |
| 121 |
} |
| 122 |
|
| 123 |
function wppm_set_task_users(proj_id){ |
| 124 |
var dataform = new FormData(jQuery('#frm_get_task_users')[0]); |
| 125 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 126 |
var task_id = jQuery('#wppm_task_id').val(); |
| 127 |
jQuery.ajax({ |
| 128 |
url: wppm_admin.ajax_url, |
| 129 |
type: 'POST', |
| 130 |
data: dataform, |
| 131 |
processData: false, |
| 132 |
contentType: false |
| 133 |
}) |
| 134 |
.done(function () { |
| 135 |
if((proj_id!=0)||(proj_id!="")){ |
| 136 |
wppm_modal_close(); |
| 137 |
wppm_open_project_tasks(task_id,proj_id); |
| 138 |
}else if((proj_id==0)||(proj_id=="")){ |
| 139 |
wppm_modal_close(); |
| 140 |
wppm_open_task(task_id); |
| 141 |
} |
| 142 |
}); |
| 143 |
} |
| 144 |
|
| 145 |
function wppm_get_project_list(page_no){ |
| 146 |
jQuery('#wppm_project_container').show(); |
| 147 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 148 |
var dataform=new FormData(jQuery('#wppm_project_list_frm')[0]); |
| 149 |
dataform.append("page_no", page_no); |
| 150 |
dataform.append("action", 'wppm_get_project_list'); |
| 151 |
jQuery.ajax( { |
| 152 |
url: wppm_admin.ajax_url, |
| 153 |
type: 'POST', |
| 154 |
data: dataform, |
| 155 |
processData: false, |
| 156 |
contentType: false |
| 157 |
}) |
| 158 |
.done(function( response ) { |
| 159 |
jQuery('#wppm_project_container').html(response); |
| 160 |
}); |
| 161 |
} |
| 162 |
|
| 163 |
function wppm_add_new_task(proj_id){ |
| 164 |
jQuery('#wppm_task_container').show(); |
| 165 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 166 |
var data = { |
| 167 |
action: 'wppm_add_new_task', |
| 168 |
proj_id:proj_id |
| 169 |
}; |
| 170 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 171 |
jQuery('#wppm_task_container').html(response); |
| 172 |
}); |
| 173 |
} |
| 174 |
|
| 175 |
function wppm_get_task_list(page_no){ |
| 176 |
jQuery('#wppm_task_container').show(); |
| 177 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 178 |
var data = { |
| 179 |
action: 'wppm_get_task_list', |
| 180 |
page_no:page_no |
| 181 |
}; |
| 182 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 183 |
jQuery('#wppm_task_container').html(response); |
| 184 |
}); |
| 185 |
} |
| 186 |
|
| 187 |
function wppm_get_task_prioriy_settings(){ |
| 188 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 189 |
jQuery('#wppm_settings_task_priorities').addClass('active'); |
| 190 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 191 |
var data = { |
| 192 |
action: 'wppm_get_priority_settings' |
| 193 |
}; |
| 194 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 195 |
jQuery('.wppm_setting_col2').html(response); |
| 196 |
}); |
| 197 |
} |
| 198 |
|
| 199 |
function wppm_add_task_priority(){ |
| 200 |
wppm_modal_open(wppm_admin.add_new_priority); |
| 201 |
var data = { |
| 202 |
action: 'wppm_add_task_priority' |
| 203 |
}; |
| 204 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 205 |
var response = JSON.parse(response_str); |
| 206 |
jQuery('#wppm_popup_body').html(response.body); |
| 207 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 208 |
jQuery('#wppm_cat_name').focus(); |
| 209 |
}); |
| 210 |
} |
| 211 |
|
| 212 |
function wppm_delete_task_priority(priority_id){ |
| 213 |
const flag = confirm(wppm_admin.confirm); |
| 214 |
if (!flag) return; |
| 215 |
|
| 216 |
var data = { action: 'wppm_delete_task_priority', priority_id }; |
| 217 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 218 |
wppm_get_task_prioriy_settings(); |
| 219 |
}); |
| 220 |
} |
| 221 |
|
| 222 |
function wppm_get_task_status_settings(){ |
| 223 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 224 |
jQuery('#wppm_settings_task_status').addClass('active'); |
| 225 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 226 |
var data = { |
| 227 |
action: 'wppm_get_task_status_settings' |
| 228 |
}; |
| 229 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 230 |
jQuery('.wppm_setting_col2').html(response); |
| 231 |
}); |
| 232 |
} |
| 233 |
|
| 234 |
function wppm_get_add_task_status(){ |
| 235 |
wppm_modal_open(wppm_admin.add_new_status); |
| 236 |
var data = { |
| 237 |
action: 'wppm_get_add_task_status' |
| 238 |
}; |
| 239 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 240 |
var response = JSON.parse(response_str); |
| 241 |
jQuery('#wppm_popup_body').html(response.body); |
| 242 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 243 |
jQuery('#wppm_cat_name').focus(); |
| 244 |
}); |
| 245 |
} |
| 246 |
|
| 247 |
function wppm_delete_task_status(status_id){ |
| 248 |
const flag = confirm(wppm_admin.confirm); |
| 249 |
if (!flag) return; |
| 250 |
|
| 251 |
var data = { action: 'wppm_delete_task_status', status_id }; |
| 252 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 253 |
wppm_get_task_status_settings(); |
| 254 |
}); |
| 255 |
} |
| 256 |
|
| 257 |
function wppm_task_search_filter(){ |
| 258 |
var task_search = jQuery("#wppm_task_search_filter").val(); |
| 259 |
jQuery('#wppm_task_container').show(); |
| 260 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 261 |
var data = { |
| 262 |
action: 'wppm_get_task_list', |
| 263 |
task_search:task_search |
| 264 |
}; |
| 265 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 266 |
jQuery('#wppm_task_container').html(response); |
| 267 |
}); |
| 268 |
} |
| 269 |
|
| 270 |
function wppm_view_task_search_filter(page_no){ |
| 271 |
var task_search = jQuery("#wppm_view_task_search_filter").val(); |
| 272 |
jQuery('#wppm_task_container').show(); |
| 273 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 274 |
|
| 275 |
var data = { |
| 276 |
action: 'wppm_get_task_list_card_view', |
| 277 |
task_search:task_search, |
| 278 |
page_no:page_no |
| 279 |
}; |
| 280 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 281 |
jQuery('#wppm_task_container').html(response); |
| 282 |
}); |
| 283 |
} |
| 284 |
|
| 285 |
function wppm_open_task(id){ |
| 286 |
jQuery('#wppm_task_container').show(); |
| 287 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 288 |
var data = { |
| 289 |
action: 'wppm_open_task', |
| 290 |
id:id |
| 291 |
}; |
| 292 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 293 |
jQuery('#wppm_task_container').html(response); |
| 294 |
}); |
| 295 |
} |
| 296 |
|
| 297 |
function wppm_open_project_tasks(id,proj_id){ |
| 298 |
wppm_modal_open('Open Tasks'); |
| 299 |
jQuery('#wppm_task_container').show(); |
| 300 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 301 |
var data = { |
| 302 |
action: 'wppm_open_task', |
| 303 |
id: id, |
| 304 |
proj_id:proj_id |
| 305 |
} |
| 306 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 307 |
jQuery('#wppm_popup_body').html(response_str); |
| 308 |
//jQuery('#wppm_task_container').html(response_str); |
| 309 |
}); |
| 310 |
} |
| 311 |
|
| 312 |
function wppm_add_new_checklist(task_id,proj_id){ |
| 313 |
if(jQuery('#wppm_checklist_label').val()==''){ |
| 314 |
jQuery('#wppm_checklist_label').focus(); |
| 315 |
return false; |
| 316 |
} |
| 317 |
var data = { |
| 318 |
action: 'wppm_add_new_checklist', |
| 319 |
task_id: task_id, |
| 320 |
proj_id: proj_id, |
| 321 |
checklist_name: jQuery('#wppm_checklist_label').val() |
| 322 |
}; |
| 323 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 324 |
if((proj_id!=0)||(proj_id!="")){ |
| 325 |
//wppm_modal_close(); |
| 326 |
wppm_open_project_tasks(task_id,proj_id); |
| 327 |
}else if((proj_id==0)||(proj_id=="")){ |
| 328 |
//wppm_modal_close(); |
| 329 |
wppm_open_task(task_id); |
| 330 |
} |
| 331 |
}); |
| 332 |
} |
| 333 |
|
| 334 |
function wppm_add_new_checklist_item(checklist_id,task_id,proj_id){ |
| 335 |
if(jQuery('#wppm_checklist_item_label_'+checklist_id).val()==''){ |
| 336 |
jQuery('#wppm_checklist_item_label_'+checklist_id).focus(); |
| 337 |
return false; |
| 338 |
} |
| 339 |
var data = { |
| 340 |
action: 'wppm_add_new_checklist_item', |
| 341 |
checklist_id: checklist_id, |
| 342 |
proj_id:proj_id, |
| 343 |
label: jQuery('#wppm_checklist_item_label_'+checklist_id).val() |
| 344 |
}; |
| 345 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 346 |
if((proj_id!=0)||(proj_id!="")){ |
| 347 |
wppm_open_project_tasks(task_id,proj_id); |
| 348 |
}else if((proj_id==0)||(proj_id=="")){ |
| 349 |
wppm_open_task(task_id); |
| 350 |
} |
| 351 |
}); |
| 352 |
} |
| 353 |
|
| 354 |
function wppm_delete_checklist(checklist_id,task_id,proj_id){ |
| 355 |
const flag = confirm(wppm_admin.confirm); |
| 356 |
if (!flag) return; |
| 357 |
var data = { |
| 358 |
action: 'wppm_delete_checklist', |
| 359 |
checklist_id: checklist_id |
| 360 |
}; |
| 361 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 362 |
if((proj_id!=0)||(proj_id!="")){ |
| 363 |
wppm_open_project_tasks(task_id,proj_id); |
| 364 |
}else if((proj_id==0)||(proj_id=="")){ |
| 365 |
wppm_open_task(task_id); |
| 366 |
} |
| 367 |
}); |
| 368 |
} |
| 369 |
|
| 370 |
function wppm_delete_checklist_item(item_id,checklist_id,proj_id,task_id){ |
| 371 |
const flag = confirm(wppm_admin.confirm); |
| 372 |
if (!flag) return; |
| 373 |
var data = { |
| 374 |
action: 'wppm_remove_checklist_item', |
| 375 |
item_id:item_id, |
| 376 |
checklist_id: checklist_id |
| 377 |
}; |
| 378 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 379 |
if((proj_id!=0)||(proj_id!="")){ |
| 380 |
wppm_open_project_tasks(task_id,proj_id); |
| 381 |
}else if((proj_id==0)||(proj_id=="")){ |
| 382 |
wppm_open_task(task_id); |
| 383 |
} |
| 384 |
}); |
| 385 |
} |
| 386 |
|
| 387 |
function wppm_checklist_progress(checklist_id,item_id,task_id){ |
| 388 |
var $checkboxes = jQuery('.wppm_checklist_item_'+checklist_id); |
| 389 |
var $progress = jQuery('#CheckProgress_'+checklist_id); |
| 390 |
var total = $checkboxes.length; |
| 391 |
var checked = jQuery('.wppm_checklist_item_'+checklist_id).filter(':checked').length; |
| 392 |
var progressWidth = (checked / total) * 100; |
| 393 |
var checked_item; |
| 394 |
jQuery('#CheckProgress_'+checklist_id).css('background','#5ba4cf'); |
| 395 |
jQuery('#CheckProgress_'+checklist_id).css('width', progressWidth + '%'); |
| 396 |
if (jQuery("#wppm_checklist_item_"+item_id).prop("checked")==true) { |
| 397 |
checked_item=1; |
| 398 |
}else{ |
| 399 |
checked_item=0; |
| 400 |
} |
| 401 |
var data = { |
| 402 |
action: 'wppm_set_checklist_progress', |
| 403 |
checklist_id: checklist_id, |
| 404 |
item_id:item_id, |
| 405 |
checked_item: checked_item |
| 406 |
}; |
| 407 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 408 |
wppm_open_task(task_id); |
| 409 |
}); |
| 410 |
} |
| 411 |
|
| 412 |
function wppm_open_individual_task(id){ |
| 413 |
jQuery('#wppm_project_container').show(); |
| 414 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 415 |
var data = { |
| 416 |
action: 'wppm_open_task', |
| 417 |
id:id |
| 418 |
}; |
| 419 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 420 |
jQuery('#wppm_project_container').html(response); |
| 421 |
}); |
| 422 |
} |
| 423 |
|
| 424 |
function wppm_display_grid_view(){ |
| 425 |
var task_search = jQuery("#wppm_view_task_search_filter").val(); |
| 426 |
jQuery('#wppm_task_container').show(); |
| 427 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 428 |
var data = { |
| 429 |
action: 'wppm_get_task_list_card_view', |
| 430 |
task_search: task_search |
| 431 |
}; |
| 432 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 433 |
jQuery('#wppm_task_container').html(response); |
| 434 |
}); |
| 435 |
} |
| 436 |
|
| 437 |
function wppm_remove_filter(id){ |
| 438 |
jQuery('#wppm_user_display_container_'+id).remove(); |
| 439 |
} |
| 440 |
|
| 441 |
function wppm_remove_user_from_project(id){ |
| 442 |
jQuery('#wppm_user_container_'+id).remove(); |
| 443 |
} |
| 444 |
|
| 445 |
function wppm_remove_task_user_filter(id){ |
| 446 |
jQuery('#wppm_task_user_display_container_'+id).remove(); |
| 447 |
} |
| 448 |
|
| 449 |
function wppm_cancel_comment(){ |
| 450 |
tinyMCE. activeEditor. setContent(''); |
| 451 |
tinymce.remove('#wppm_task_comment'); |
| 452 |
jQuery('#wppm_comment_btn').hide(); |
| 453 |
} |
| 454 |
|
| 455 |
function wppm_submit_task_comment(id,proj_id){ |
| 456 |
var dataform = new FormData(jQuery('#wppm_open_task')[0]); |
| 457 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 458 |
dataform.append('action','wppm_submit_task_comment'); |
| 459 |
var comment_body = tinyMCE.get('wppm_task_comment').getContent().trim(); |
| 460 |
dataform.append('comment_body',comment_body); |
| 461 |
dataform.append('task_id',id); |
| 462 |
jQuery.ajax({ |
| 463 |
url: wppm_admin.ajax_url, |
| 464 |
type: 'POST', |
| 465 |
data: dataform, |
| 466 |
processData: false, |
| 467 |
contentType: false |
| 468 |
}) |
| 469 |
.done(function (response_str) { |
| 470 |
if((proj_id!=0)||(proj_id!="")){ |
| 471 |
wppm_open_project_tasks(id,proj_id); |
| 472 |
}else if((proj_id==0)||(proj_id=="")){ |
| 473 |
wppm_open_task(id); |
| 474 |
} |
| 475 |
}); |
| 476 |
} |
| 477 |
|
| 478 |
function wppm_attachment_cancel( obj ){ |
| 479 |
jQuery(obj).parent().remove(); |
| 480 |
} |
| 481 |
|
| 482 |
function wppm_get_en_general_setting(){ |
| 483 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 484 |
jQuery('#wppm_en_setting_general').addClass('active'); |
| 485 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 486 |
|
| 487 |
var data = { |
| 488 |
action: 'wppm_get_en_general_setting', |
| 489 |
}; |
| 490 |
|
| 491 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 492 |
jQuery('.wppm_setting_col2').html(response); |
| 493 |
}); |
| 494 |
} |
| 495 |
|
| 496 |
function wppm_set_en_general_settings(){ |
| 497 |
jQuery('.wppm_submit_wait').show(); |
| 498 |
var dataform = new FormData(jQuery('#wppm_en_frm_general_settings')[0]); |
| 499 |
|
| 500 |
jQuery.ajax({ |
| 501 |
url: wppm_admin.ajax_url, |
| 502 |
type: 'POST', |
| 503 |
data: dataform, |
| 504 |
processData: false, |
| 505 |
contentType: false |
| 506 |
}) |
| 507 |
.done(function (response_str) { |
| 508 |
var response = JSON.parse(response_str); |
| 509 |
jQuery('.wppm_submit_wait').hide(); |
| 510 |
if (response.sucess_status=='1') { |
| 511 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 512 |
} |
| 513 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 514 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 515 |
}); |
| 516 |
} |
| 517 |
|
| 518 |
function wppm_get_en_task_notifications(){ |
| 519 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 520 |
jQuery('#wppm_en_ticket_notifications').addClass('active'); |
| 521 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 522 |
|
| 523 |
var data = { |
| 524 |
action: 'wppm_get_en_task_notifications' |
| 525 |
}; |
| 526 |
|
| 527 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 528 |
jQuery('.wppm_setting_col2').html(response); |
| 529 |
}); |
| 530 |
} |
| 531 |
|
| 532 |
function wppm_edit_task_status(id,proj_id){ |
| 533 |
wppm_modal_open('Edit'); |
| 534 |
var data = { |
| 535 |
action: 'wppm_edit_task_status', |
| 536 |
task_id: id, |
| 537 |
proj_id:proj_id |
| 538 |
} |
| 539 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 540 |
var response = JSON.parse(response_str); |
| 541 |
jQuery('#wppm_popup_body').html(response.body); |
| 542 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 543 |
}); |
| 544 |
} |
| 545 |
|
| 546 |
function wppm_edit_task_users(task_id,proj_id){ |
| 547 |
wppm_modal_open('Add Users'); |
| 548 |
var data = { |
| 549 |
action: 'wppm_get_task_users', |
| 550 |
task_id: task_id, |
| 551 |
proj_id:proj_id |
| 552 |
} |
| 553 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 554 |
var response = JSON.parse(response_str); |
| 555 |
jQuery('#wppm_popup_body').html(response.body); |
| 556 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 557 |
}); |
| 558 |
} |
| 559 |
|
| 560 |
function wppm_edit_task_details(id,proj_id){ |
| 561 |
wppm_modal_open('Edit Task Details'); |
| 562 |
var data = { |
| 563 |
action: 'wppm_edit_task_details', |
| 564 |
task_id: id, |
| 565 |
proj_id:proj_id |
| 566 |
} |
| 567 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 568 |
var response = JSON.parse(response_str); |
| 569 |
jQuery('#wppm_popup_body').html(response.body); |
| 570 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 571 |
}); |
| 572 |
} |
| 573 |
|
| 574 |
function wppm_set_change_task_status(task_id,proj_id){ |
| 575 |
var dataform = new FormData(jQuery('#frm_get_task_change_status')[0]); |
| 576 |
wppm_modal_close(); |
| 577 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 578 |
jQuery.ajax({ |
| 579 |
url: wppm_admin.ajax_url, |
| 580 |
type: 'POST', |
| 581 |
data: dataform, |
| 582 |
processData: false, |
| 583 |
contentType: false |
| 584 |
}) |
| 585 |
.done(function (response_str) { |
| 586 |
if((proj_id!=0)||(proj_id!="")){ |
| 587 |
wppm_open_project_tasks(task_id,proj_id); |
| 588 |
}else if((proj_id==0)||(proj_id=="")){ |
| 589 |
wppm_open_task(task_id); |
| 590 |
} |
| 591 |
|
| 592 |
}); |
| 593 |
} |
| 594 |
|
| 595 |
function wppm_edit_task_creator(task_id,proj_id){ |
| 596 |
wppm_modal_open('Edit Task Creator'); |
| 597 |
var data = { |
| 598 |
action: 'wppm_edit_task_creator', |
| 599 |
task_id: task_id, |
| 600 |
proj_id: proj_id |
| 601 |
} |
| 602 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 603 |
var response = JSON.parse(response_str); |
| 604 |
jQuery('#wppm_popup_body').html(response.body); |
| 605 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 606 |
}); |
| 607 |
} |
| 608 |
|
| 609 |
function wppm_set_change_raised_by(task_id,proj_id){ |
| 610 |
var dataform = new FormData(jQuery('#frm_get_task_creator')[0]); |
| 611 |
wppm_modal_close(); |
| 612 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 613 |
jQuery.ajax({ |
| 614 |
url: wppm_admin.ajax_url, |
| 615 |
type: 'POST', |
| 616 |
data: dataform, |
| 617 |
processData: false, |
| 618 |
contentType: false |
| 619 |
}) |
| 620 |
.done(function (response_str) { |
| 621 |
if((proj_id!=0)||(proj_id!="")){ |
| 622 |
wppm_open_project_tasks(task_id,proj_id); |
| 623 |
}else if((proj_id==0)||(proj_id=="")){ |
| 624 |
wppm_open_task(task_id); |
| 625 |
} |
| 626 |
}); |
| 627 |
} |
| 628 |
|
| 629 |
function wppm_set_change_task_details(task_id,proj_id){ |
| 630 |
var dataform = new FormData(jQuery('#frm_get_edit_task_deatils')[0]); |
| 631 |
var description = tinyMCE.get('wppm_edit_task_description').getContent().trim(); |
| 632 |
dataform.append('wppm_edit_task_description', description); |
| 633 |
wppm_modal_close(); |
| 634 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 635 |
jQuery.ajax({ |
| 636 |
url: wppm_admin.ajax_url, |
| 637 |
type: 'POST', |
| 638 |
data: dataform, |
| 639 |
processData: false, |
| 640 |
contentType: false |
| 641 |
}) |
| 642 |
.done(function (response_str) { |
| 643 |
if((proj_id!=0)||(proj_id!="")){ |
| 644 |
wppm_open_project_tasks(task_id,proj_id); |
| 645 |
}else if((proj_id==0)||(proj_id=="")){ |
| 646 |
wppm_open_task(task_id); |
| 647 |
} |
| 648 |
}); |
| 649 |
} |
| 650 |
|
| 651 |
function wppm_edit_thread(comment_id,task_id,proj_id){ |
| 652 |
wppm_modal_open('Edit Thread'); |
| 653 |
var data = { |
| 654 |
action: 'wppm_edit_task_thread', |
| 655 |
comment_id:comment_id, |
| 656 |
task_id: task_id, |
| 657 |
proj_id: proj_id |
| 658 |
} |
| 659 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 660 |
var response = JSON.parse(response_str); |
| 661 |
jQuery('#wppm_popup_body').html(response.body); |
| 662 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 663 |
}); |
| 664 |
} |
| 665 |
|
| 666 |
function wppm_set_edit_task_thread(task_id,proj_id){ |
| 667 |
var dataform = new FormData(jQuery('#frm_edit_task_thread')[0]); |
| 668 |
var comment_body = tinyMCE.get('wppm_edit_task_thread_editor').getContent().trim(); |
| 669 |
dataform.append('wppm_edit_task_thread', comment_body); |
| 670 |
wppm_modal_close(); |
| 671 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 672 |
jQuery.ajax({ |
| 673 |
url: wppm_admin.ajax_url, |
| 674 |
type: 'POST', |
| 675 |
data: dataform, |
| 676 |
processData: false, |
| 677 |
contentType: false |
| 678 |
}) |
| 679 |
.done(function (response_str) { |
| 680 |
if((proj_id!=0)||(proj_id!="")){ |
| 681 |
wppm_open_project_tasks(task_id,proj_id); |
| 682 |
}else if((proj_id==0)||(proj_id=="")){ |
| 683 |
wppm_open_task(task_id); |
| 684 |
} |
| 685 |
}); |
| 686 |
} |
| 687 |
|
| 688 |
function wppm_delete_thread(comment_id,task_id,proj_id){ |
| 689 |
wppm_modal_open('Delete Thread'); |
| 690 |
var data = { |
| 691 |
action: 'wppm_delete_task_thread', |
| 692 |
comment_id:comment_id, |
| 693 |
task_id: task_id, |
| 694 |
proj_id:proj_id |
| 695 |
} |
| 696 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 697 |
var response = JSON.parse(response_str); |
| 698 |
jQuery('#wppm_popup_body').html(response.body); |
| 699 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 700 |
}); |
| 701 |
} |
| 702 |
|
| 703 |
function wppm_set_delete_thread(task_id,proj_id){ |
| 704 |
var dataform = new FormData(jQuery('#frm_delete_task_thread')[0]); |
| 705 |
wppm_modal_close(); |
| 706 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 707 |
jQuery.ajax({ |
| 708 |
url: wppm_admin.ajax_url, |
| 709 |
type: 'POST', |
| 710 |
data: dataform, |
| 711 |
processData: false, |
| 712 |
contentType: false |
| 713 |
}) |
| 714 |
.done(function (response_str) { |
| 715 |
if((proj_id!=0)||(proj_id!="")){ |
| 716 |
wppm_open_project_tasks(task_id,proj_id); |
| 717 |
}else if((proj_id==0)||(proj_id=="")){ |
| 718 |
wppm_open_task(task_id); |
| 719 |
} |
| 720 |
}); |
| 721 |
} |
| 722 |
|
| 723 |
function wppm_edit_proj_details(id){ |
| 724 |
wppm_modal_open('Edit Project Details'); |
| 725 |
var data = { |
| 726 |
action: 'wppm_edit_project_details', |
| 727 |
id: id |
| 728 |
} |
| 729 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 730 |
var response = JSON.parse(response_str); |
| 731 |
jQuery('#wppm_popup_body').html(response.body); |
| 732 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 733 |
}); |
| 734 |
} |
| 735 |
|
| 736 |
function wppm_set_change_project_details(id){ |
| 737 |
var dataform = new FormData(jQuery('#frm_get_edit_project_deatils')[0]); |
| 738 |
var description = tinyMCE.get('wppm_edit_project_description').getContent().trim(); |
| 739 |
dataform.append('wppm_edit_project_description', description); |
| 740 |
wppm_modal_close(); |
| 741 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 742 |
jQuery.ajax({ |
| 743 |
url: wppm_admin.ajax_url, |
| 744 |
type: 'POST', |
| 745 |
data: dataform, |
| 746 |
processData: false, |
| 747 |
contentType: false |
| 748 |
}) |
| 749 |
.done(function (response_str) { |
| 750 |
wppm_open_project(id); |
| 751 |
}); |
| 752 |
} |
| 753 |
|
| 754 |
function wppm_edit_project_status(id){ |
| 755 |
wppm_modal_open('Edit Project Status'); |
| 756 |
var data = { |
| 757 |
action: 'wppm_edit_project_status', |
| 758 |
id: id |
| 759 |
} |
| 760 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 761 |
var response = JSON.parse(response_str); |
| 762 |
jQuery('#wppm_popup_body').html(response.body); |
| 763 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 764 |
}); |
| 765 |
} |
| 766 |
|
| 767 |
function wppm_set_change_project_status(id){ |
| 768 |
var dataform = new FormData(jQuery('#frm_get_project_change_status')[0]); |
| 769 |
wppm_modal_close(); |
| 770 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 771 |
jQuery.ajax({ |
| 772 |
url: wppm_admin.ajax_url, |
| 773 |
type: 'POST', |
| 774 |
data: dataform, |
| 775 |
processData: false, |
| 776 |
contentType: false |
| 777 |
}) |
| 778 |
.done(function (response_str) { |
| 779 |
wppm_open_project(id); |
| 780 |
}); |
| 781 |
} |
| 782 |
|
| 783 |
function wppm_edit_project_creator(id){ |
| 784 |
wppm_modal_open('Edit Project Creator'); |
| 785 |
var data = { |
| 786 |
action: 'wppm_edit_project_creator', |
| 787 |
id: id |
| 788 |
} |
| 789 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 790 |
var response = JSON.parse(response_str); |
| 791 |
jQuery('#wppm_popup_body').html(response.body); |
| 792 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 793 |
}); |
| 794 |
} |
| 795 |
|
| 796 |
function wppm_set_change_project_raised_by(id){ |
| 797 |
var dataform = new FormData(jQuery('#frm_get_project_creator')[0]); |
| 798 |
wppm_modal_close(); |
| 799 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 800 |
jQuery.ajax({ |
| 801 |
url: wppm_admin.ajax_url, |
| 802 |
type: 'POST', |
| 803 |
data: dataform, |
| 804 |
processData: false, |
| 805 |
contentType: false |
| 806 |
}) |
| 807 |
.done(function (response_str) { |
| 808 |
wppm_open_project(id); |
| 809 |
}); |
| 810 |
} |
| 811 |
|
| 812 |
function wppm_edit_project_users(id){ |
| 813 |
wppm_modal_open('Add Users'); |
| 814 |
var data = { |
| 815 |
action: 'wppm_get_project_users', |
| 816 |
id: id |
| 817 |
} |
| 818 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 819 |
var response = JSON.parse(response_str); |
| 820 |
jQuery('#wppm_popup_body').html(response.body); |
| 821 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 822 |
}); |
| 823 |
} |
| 824 |
|
| 825 |
function wppm_delete_project(id){ |
| 826 |
wppm_modal_open('Delete Project'); |
| 827 |
var data = { |
| 828 |
action: 'wppm_get_delete_project', |
| 829 |
id: id |
| 830 |
} |
| 831 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 832 |
var response = JSON.parse(response_str); |
| 833 |
jQuery('#wppm_popup_body').html(response.body); |
| 834 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 835 |
}); |
| 836 |
} |
| 837 |
|
| 838 |
function wppm_set_delete_project(){ |
| 839 |
var dataform = new FormData(jQuery('#frm_delete_project')[0]); |
| 840 |
wppm_modal_close(); |
| 841 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 842 |
jQuery.ajax({ |
| 843 |
url: wppm_admin.ajax_url, |
| 844 |
type: 'POST', |
| 845 |
data: dataform, |
| 846 |
processData: false, |
| 847 |
contentType: false |
| 848 |
}) |
| 849 |
.done(function (response_str) { |
| 850 |
wppm_get_project_list(); |
| 851 |
}); |
| 852 |
} |
| 853 |
|
| 854 |
function wppm_get_delete_task(id){ |
| 855 |
wppm_modal_open('Delete Task'); |
| 856 |
var data = { |
| 857 |
action: 'wppm_get_delete_task', |
| 858 |
id: id |
| 859 |
} |
| 860 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 861 |
var response = JSON.parse(response_str); |
| 862 |
jQuery('#wppm_popup_body').html(response.body); |
| 863 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 864 |
}); |
| 865 |
} |
| 866 |
|
| 867 |
function wppm_set_delete_task(){ |
| 868 |
var dataform = new FormData(jQuery('#frm_delete_task')[0]); |
| 869 |
wppm_modal_close(); |
| 870 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 871 |
jQuery.ajax({ |
| 872 |
url: wppm_admin.ajax_url, |
| 873 |
type: 'POST', |
| 874 |
data: dataform, |
| 875 |
processData: false, |
| 876 |
contentType: false |
| 877 |
}) |
| 878 |
.done(function (response_str) { |
| 879 |
wppm_get_task_list(); |
| 880 |
}); |
| 881 |
} |
| 882 |
|
| 883 |
function wppm_get_edit_email_notification(id){ |
| 884 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 885 |
var data = { |
| 886 |
action: 'wppm_get_edit_email_notification', |
| 887 |
id : id |
| 888 |
}; |
| 889 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 890 |
jQuery('.wppm_setting_col2').html(response); |
| 891 |
}); |
| 892 |
} |
| 893 |
|
| 894 |
function wppm_get_tinymce(selector,body_id){ |
| 895 |
jQuery('#visual').addClass('btn btn-primary'); |
| 896 |
jQuery('#text').removeClass('btn btn-primary'); |
| 897 |
jQuery('#text').addClass('btn btn-default'); |
| 898 |
tinymce.init({ |
| 899 |
selector:'#'+selector, |
| 900 |
body_id: body_id, |
| 901 |
menubar: false, |
| 902 |
statusbar: false, |
| 903 |
height : '200', |
| 904 |
plugins: [ |
| 905 |
'lists link image directionality' |
| 906 |
], |
| 907 |
image_advtab: true, |
| 908 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 909 |
branding: false, |
| 910 |
autoresize_bottom_margin: 20, |
| 911 |
browser_spellcheck : true, |
| 912 |
relative_urls : false, |
| 913 |
remove_script_host : false, |
| 914 |
convert_urls : true, |
| 915 |
setup: function (editor) { |
| 916 |
} |
| 917 |
}); |
| 918 |
} |
| 919 |
|
| 920 |
function wppm_get_textarea(){ |
| 921 |
jQuery('#visual').removeClass('btn btn-primary'); |
| 922 |
jQuery('#visual').addClass('btn btn-default'); |
| 923 |
jQuery('#text').addClass('btn btn-primary'); |
| 924 |
tinymce.remove(); |
| 925 |
} |
| 926 |
|
| 927 |
function wppm_get_templates(){ |
| 928 |
wppm_modal_open(wppm_admin.templates); |
| 929 |
var data = { |
| 930 |
action: 'wppm_get_templates' |
| 931 |
}; |
| 932 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 933 |
var response = JSON.parse(response_str); |
| 934 |
jQuery('#wppm_popup_body').html(response.body); |
| 935 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 936 |
}); |
| 937 |
} |
| 938 |
|
| 939 |
function wppm_set_edit_email_notification(){ |
| 940 |
var dataform = new FormData(jQuery('#wppm_edit_email_notification_settings')[0]); |
| 941 |
wppm_modal_close(); |
| 942 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 943 |
jQuery.ajax({ |
| 944 |
url: wppm_admin.ajax_url, |
| 945 |
type: 'POST', |
| 946 |
data: dataform, |
| 947 |
processData: false, |
| 948 |
contentType: false |
| 949 |
}) |
| 950 |
.done(function (response_str) { |
| 951 |
var response = JSON.parse(response_str); |
| 952 |
if (response.sucess_status=='1') { |
| 953 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 954 |
} |
| 955 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 956 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 957 |
wppm_get_en_task_notifications(); |
| 958 |
}); |
| 959 |
} |
| 960 |
|
| 961 |
function wppm_set_general_settings(){ |
| 962 |
jQuery('.wppm_submit_wait').show(); |
| 963 |
var dataform = new FormData(jQuery('#wppm_frm_general_settings')[0]); |
| 964 |
jQuery.ajax({ |
| 965 |
url: wppm_admin.ajax_url, |
| 966 |
type: 'POST', |
| 967 |
data: dataform, |
| 968 |
processData: false, |
| 969 |
contentType: false |
| 970 |
}) |
| 971 |
.done(function (response_str) { |
| 972 |
var response = JSON.parse(response_str); |
| 973 |
jQuery('.wppm_submit_wait').hide(); |
| 974 |
if (response.sucess_status=='1') { |
| 975 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 976 |
} |
| 977 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 978 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 979 |
}); |
| 980 |
} |
| 981 |
|
| 982 |
function wppm_get_project_tasks(id){ |
| 983 |
wppm_modal_open('Tasks'); |
| 984 |
var data = { |
| 985 |
action: 'wppm_get_project_tasks', |
| 986 |
id: id |
| 987 |
} |
| 988 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 989 |
var response = JSON.parse(response_str); |
| 990 |
jQuery('#wppm_popup_body').html(response.body); |
| 991 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 992 |
}); |
| 993 |
} |
| 994 |
|
| 995 |
function wppm_create_project_task(id){ |
| 996 |
wppm_modal_open('Tasks'); |
| 997 |
var data = { |
| 998 |
action: 'wppm_add_new_task', |
| 999 |
proj_id: id |
| 1000 |
} |
| 1001 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1002 |
jQuery('#wppm_popup_body').html(response_str); |
| 1003 |
}); |
| 1004 |
} |
| 1005 |
|
| 1006 |
function wppm_load_prev_page(prev_page_no,page_no,sort_by, order){ |
| 1007 |
if(prev_page_no!=0){ |
| 1008 |
page_no=prev_page_no-1; |
| 1009 |
wppm_get_project_list(page_no,sort_by,order); |
| 1010 |
} |
| 1011 |
} |
| 1012 |
|
| 1013 |
function wppm_load_next_page(next_page_no,page_no,sort_by,order){ |
| 1014 |
if(next_page_no!=page_no){ |
| 1015 |
page_no = next_page_no; |
| 1016 |
wppm_get_project_list(page_no,sort_by,order); |
| 1017 |
} |
| 1018 |
} |
| 1019 |
|
| 1020 |
function wppm_load_prev_task_page(prev_page_no,page_no, sort_by, order){ |
| 1021 |
if(prev_page_no!=0){ |
| 1022 |
page_no=prev_page_no-1; |
| 1023 |
wppm_get_task_list(page_no,sort_by,order); |
| 1024 |
} |
| 1025 |
} |
| 1026 |
|
| 1027 |
function wppm_load_next_task_page(next_page_no,page_no,sort_by,order){ |
| 1028 |
if(next_page_no!=page_no){ |
| 1029 |
page_no = next_page_no; |
| 1030 |
wppm_get_task_list(page_no,sort_by,order); |
| 1031 |
} |
| 1032 |
} |
| 1033 |
|
| 1034 |
function wppm_load_prev_task_page_card_view(prev_page_no,page_no){ |
| 1035 |
if(prev_page_no!=0){ |
| 1036 |
page_no=prev_page_no-1; |
| 1037 |
wppm_view_task_search_filter(page_no); |
| 1038 |
} |
| 1039 |
} |
| 1040 |
|
| 1041 |
function wppm_load_next_task_page_card_view(next_page_no,page_no){ |
| 1042 |
if(next_page_no!=page_no){ |
| 1043 |
page_no = next_page_no; |
| 1044 |
wppm_view_task_search_filter(page_no); |
| 1045 |
} |
| 1046 |
} |
| 1047 |
|
| 1048 |
function wppm_thread_attachment_remove(obj,attachment,comment_id,task_id,proj_id){ |
| 1049 |
if( confirm(wppm_admin.confirm) ){ |
| 1050 |
var data = { |
| 1051 |
action: 'wppm_remove_thread_attachment', |
| 1052 |
attachment : attachment, |
| 1053 |
comment_id : comment_id, |
| 1054 |
task_id:task_id |
| 1055 |
}; |
| 1056 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1057 |
jQuery(obj).parent('td').parent('tr').remove(); |
| 1058 |
if((proj_id!=0)||(proj_id!="")){ |
| 1059 |
wppm_open_project_tasks(task_id,proj_id); |
| 1060 |
}else if((proj_id==0)||(proj_id=="")){ |
| 1061 |
wppm_open_task(task_id); |
| 1062 |
} |
| 1063 |
}); |
| 1064 |
} |
| 1065 |
} |
| 1066 |
|
| 1067 |
function wppm_open_project(id){ |
| 1068 |
jQuery('#wppm_project_list').hide(); |
| 1069 |
jQuery('#wppm_project_container').show(); |
| 1070 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1071 |
var data = { |
| 1072 |
action: 'wppm_open_project', |
| 1073 |
id:id |
| 1074 |
}; |
| 1075 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1076 |
jQuery('#wppm_project_container').html(response); |
| 1077 |
}); |
| 1078 |
} |
| 1079 |
|
| 1080 |
function wppm_project_search_filter(){ |
| 1081 |
var project_search = jQuery("#wppm_project_search_filter").val(); |
| 1082 |
jQuery('#wppm_project_container').show(); |
| 1083 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1084 |
var data = { |
| 1085 |
action: 'wppm_get_project_list', |
| 1086 |
project_search:project_search |
| 1087 |
}; |
| 1088 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1089 |
jQuery('#wppm_project_container').html(response); |
| 1090 |
}); |
| 1091 |
} |
| 1092 |
|
| 1093 |
function wppm_clone_task(id){ |
| 1094 |
wppm_modal_open('Clone Task'); |
| 1095 |
var data = { |
| 1096 |
action: 'wppm_clone_task', |
| 1097 |
id: id |
| 1098 |
} |
| 1099 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1100 |
var response = JSON.parse(response_str); |
| 1101 |
jQuery('#wppm_popup_body').html(response.body); |
| 1102 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1103 |
}); |
| 1104 |
} |
| 1105 |
|
| 1106 |
function wppm_set_clone_task(){ |
| 1107 |
var data = { |
| 1108 |
action: 'wppm_set_clone_task', |
| 1109 |
task_id: jQuery("input[name=task_id]").val(), |
| 1110 |
task_name:jQuery("input[name=task_name]").val() |
| 1111 |
} |
| 1112 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1113 |
wppm_modal_close(); |
| 1114 |
wppm_get_task_list(); |
| 1115 |
}); |
| 1116 |
} |
| 1117 |
|
| 1118 |
function wppm_sort_up_task_list(sort_by,order){ |
| 1119 |
jQuery('#wppm_task_container').show(); |
| 1120 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1121 |
var data = { |
| 1122 |
action: 'wppm_get_task_list', |
| 1123 |
sort_by:sort_by, |
| 1124 |
order:order |
| 1125 |
}; |
| 1126 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1127 |
jQuery('#wppm_task_container').html(response); |
| 1128 |
}); |
| 1129 |
} |
| 1130 |
|
| 1131 |
function wppm_sort_up_project_list(sort_by,order){ |
| 1132 |
jQuery('#wppm_project_container').show(); |
| 1133 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1134 |
var data = { |
| 1135 |
action: 'wppm_get_project_list', |
| 1136 |
sort_by:sort_by, |
| 1137 |
order:order |
| 1138 |
}; |
| 1139 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1140 |
jQuery('#wppm_project_container').html(response); |
| 1141 |
}); |
| 1142 |
} |
| 1143 |
|
| 1144 |
function wppm_get_miscellaneous_settings(){ |
| 1145 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 1146 |
jQuery('#wppm_settings_miscellaneous').addClass('active'); |
| 1147 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 1148 |
var data = { |
| 1149 |
action: 'wppm_get_advanced_settings' |
| 1150 |
}; |
| 1151 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1152 |
jQuery('.wppm_setting_col2').html(response); |
| 1153 |
}); |
| 1154 |
} |
| 1155 |
|
| 1156 |
function wppm_set_advanced_settings(){ |
| 1157 |
jQuery('.wppm_submit_wait').show(); |
| 1158 |
var dataform = new FormData(jQuery('#wppm_frm_advanced_settings')[0]); |
| 1159 |
jQuery.ajax({ |
| 1160 |
url: wppm_admin.ajax_url, |
| 1161 |
type: 'POST', |
| 1162 |
data: dataform, |
| 1163 |
processData: false, |
| 1164 |
contentType: false |
| 1165 |
}) |
| 1166 |
.done(function (response_str) { |
| 1167 |
var response = JSON.parse(response_str); |
| 1168 |
jQuery('.wppm_submit_wait').hide(); |
| 1169 |
if (response.sucess_status=='1') { |
| 1170 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1171 |
} |
| 1172 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1173 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1174 |
}); |
| 1175 |
} |
| 1176 |
|
| 1177 |
function wppm_get_project_visibility(id){ |
| 1178 |
wppm_modal_open('Change Visibility'); |
| 1179 |
var data = { |
| 1180 |
action: 'wppm_get_project_visibility', |
| 1181 |
id: id |
| 1182 |
} |
| 1183 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1184 |
var response = JSON.parse(response_str); |
| 1185 |
jQuery('#wppm_popup_body').html(response.body); |
| 1186 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1187 |
}); |
| 1188 |
} |
| 1189 |
|
| 1190 |
function wppm_select_project_visibility(proj_id){ |
| 1191 |
if(jQuery('input[name="wppm_project_visibility_option"]').is(':checked')){ |
| 1192 |
var project_visibility = jQuery('input[name="wppm_project_visibility_option"]:checked').val(); |
| 1193 |
}else{ |
| 1194 |
var project_visibility = 0; |
| 1195 |
} |
| 1196 |
var data = { |
| 1197 |
action: 'wppm_change_project_visibility', |
| 1198 |
project_id:proj_id, |
| 1199 |
project_visibility:project_visibility |
| 1200 |
}; |
| 1201 |
jQuery.post(wppm_admin.ajax_url, data, function() { |
| 1202 |
}); |
| 1203 |
} |
| 1204 |
|
| 1205 |
function wppm_apply_project_filter(){ |
| 1206 |
wppm_project_filter = jQuery('#wppm_project_filter').find(":selected").val(); |
| 1207 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1208 |
var data = { |
| 1209 |
action: 'wppm_get_project_list', |
| 1210 |
wppm_project_filter:wppm_project_filter |
| 1211 |
}; |
| 1212 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1213 |
jQuery('#wppm_project_container').html(response); |
| 1214 |
}); |
| 1215 |
} |
| 1216 |
|
| 1217 |
function wppm_apply_task_filter(){ |
| 1218 |
wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val(); |
| 1219 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1220 |
var data = { |
| 1221 |
action: 'wppm_get_task_list', |
| 1222 |
wppm_task_filter:wppm_task_filter |
| 1223 |
}; |
| 1224 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1225 |
jQuery('#wppm_task_container').html(response); |
| 1226 |
}); |
| 1227 |
} |
| 1228 |
|
| 1229 |
function wppm_tl_reset_filter(){ |
| 1230 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1231 |
var data = { |
| 1232 |
action: 'wppm_get_task_list', |
| 1233 |
wppm_task_filter:'all', |
| 1234 |
task_search:"", |
| 1235 |
sort_by:"task_name", |
| 1236 |
order:"ASC" |
| 1237 |
}; |
| 1238 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1239 |
jQuery('#wppm_task_container').html(response); |
| 1240 |
}); |
| 1241 |
} |
| 1242 |
|
| 1243 |
function wppm_apply_task_filter_grid_view(){ |
| 1244 |
wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val(); |
| 1245 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1246 |
var data = { |
| 1247 |
action: 'wppm_view_project_tasks', |
| 1248 |
wppm_task_filter:wppm_task_filter |
| 1249 |
}; |
| 1250 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1251 |
jQuery('#wppm_task_container').html(response); |
| 1252 |
}); |
| 1253 |
} |
| 1254 |
|
| 1255 |
function wppm_tl_reset_grid_view_filter(){ |
| 1256 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1257 |
var data = { |
| 1258 |
action: 'wppm_view_project_tasks', |
| 1259 |
wppm_task_filter:'all', |
| 1260 |
task_search:"", |
| 1261 |
sort_by:"task_name", |
| 1262 |
order:"ASC" |
| 1263 |
}; |
| 1264 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1265 |
jQuery('#wppm_task_container').html(response); |
| 1266 |
}); |
| 1267 |
} |
| 1268 |
|
| 1269 |
function wppm_pl_reset_filter(){ |
| 1270 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1271 |
var data = { |
| 1272 |
action: 'wppm_get_project_list', |
| 1273 |
wppm_project_filter:'all', |
| 1274 |
project_search:"", |
| 1275 |
sort_by:"project_name", |
| 1276 |
order:"ASC" |
| 1277 |
}; |
| 1278 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1279 |
jQuery('#wppm_project_container').html(response); |
| 1280 |
}); |
| 1281 |
} |