| 1 |
function getMentionDropdown(editor) { |
| 2 |
let body = jQuery(editor.getBody()); |
| 3 |
let dropdown = body.find('#wppm_mention_list'); |
| 4 |
|
| 5 |
if (!dropdown.length) { |
| 6 |
dropdown = jQuery('<div id="wppm_mention_list"></div>'); |
| 7 |
body.append(dropdown); |
| 8 |
} |
| 9 |
if (!editor.mentionDropdown) { |
| 10 |
return editor.mentionDropdown; |
| 11 |
}else{ |
| 12 |
return dropdown; |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
function updateActiveItem(items,mentionIndex) { |
| 17 |
items.removeClass('active').css({ |
| 18 |
background: '#fff', |
| 19 |
color: '#333' |
| 20 |
}); |
| 21 |
items.eq(mentionIndex) |
| 22 |
.addClass('active') |
| 23 |
.css({ |
| 24 |
background: '#0073aa', |
| 25 |
color: '#fff' |
| 26 |
}); |
| 27 |
} |
| 28 |
|
| 29 |
function wppm_add_new_project(){ |
| 30 |
jQuery('#wppm_project_container').show(); |
| 31 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 32 |
var data = { |
| 33 |
action: 'wppm_add_new_project' |
| 34 |
}; |
| 35 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 36 |
jQuery('#wppm_project_container').html(response); |
| 37 |
}); |
| 38 |
} |
| 39 |
|
| 40 |
function wppm_projects(){ |
| 41 |
jQuery('#wppm_project_container').hide(); |
| 42 |
jQuery('#wppm_project_list').show(); |
| 43 |
} |
| 44 |
|
| 45 |
function wppm_get_users(proj_id){ |
| 46 |
wppm_modal_open('Add Users'); |
| 47 |
var data = { |
| 48 |
action: 'wppm_get_users', |
| 49 |
proj_id: proj_id |
| 50 |
} |
| 51 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 52 |
var response = JSON.parse(response_str); |
| 53 |
jQuery('#wppm_popup_body').html(response.body); |
| 54 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 55 |
}); |
| 56 |
} |
| 57 |
|
| 58 |
function wppm_get_general_settings(){ |
| 59 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 60 |
jQuery('#wppm_settings_general').addClass('active'); |
| 61 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 62 |
var data = { |
| 63 |
action: 'wppm_get_general_setings' |
| 64 |
}; |
| 65 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 66 |
jQuery('.wppm_setting_col2').html(response); |
| 67 |
}); |
| 68 |
} |
| 69 |
|
| 70 |
function wppm_get_page_settings(){ |
| 71 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 72 |
jQuery('#wppm_settings_page').addClass('active'); |
| 73 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 74 |
var data = { |
| 75 |
action: 'wppm_get_page_setings' |
| 76 |
}; |
| 77 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 78 |
jQuery('.wppm_setting_col2').html(response); |
| 79 |
}); |
| 80 |
} |
| 81 |
|
| 82 |
function wppm_set_page_settings(){ |
| 83 |
jQuery('.wppm_submit_wait').show(); |
| 84 |
var dataform = new FormData(jQuery('#wppm-frm-ps')[0]); |
| 85 |
jQuery.ajax({ |
| 86 |
url: wppm_admin.ajax_url, |
| 87 |
type: 'POST', |
| 88 |
data: dataform, |
| 89 |
processData: false, |
| 90 |
contentType: false |
| 91 |
}) |
| 92 |
.done(function (response_str) { |
| 93 |
var response = JSON.parse(response_str); |
| 94 |
jQuery('.wppm_submit_wait').hide(); |
| 95 |
if (response.sucess_status=='1') { |
| 96 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 97 |
} |
| 98 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 99 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 100 |
}); |
| 101 |
} |
| 102 |
|
| 103 |
/* |
| 104 |
* Category Settings |
| 105 |
*/ |
| 106 |
function wppm_get_category_settings(){ |
| 107 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 108 |
jQuery('#wppm_settings_category').addClass('active'); |
| 109 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 110 |
var data = { |
| 111 |
action: 'wppm_get_category_settings' |
| 112 |
}; |
| 113 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 114 |
jQuery('.wppm_setting_col2').html(response); |
| 115 |
}); |
| 116 |
} |
| 117 |
|
| 118 |
/** |
| 119 |
* Delete category |
| 120 |
*/ |
| 121 |
function wppm_delete_category(cat_id) { |
| 122 |
|
| 123 |
const flag = confirm(wppm_admin.confirm); |
| 124 |
if (!flag) return; |
| 125 |
|
| 126 |
var data = { action: 'wppm_delete_category', |
| 127 |
cat_id, |
| 128 |
_ajax_nonce:jQuery('#wppm_delete_cat_ajax_nonce').val() |
| 129 |
}; |
| 130 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 131 |
wppm_get_category_settings(); |
| 132 |
}); |
| 133 |
} |
| 134 |
|
| 135 |
function wppm_get_proj_status_settings(){ |
| 136 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 137 |
jQuery('#wppm_settings_proj_status').addClass('active'); |
| 138 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 139 |
var data = { |
| 140 |
action: 'wppm_get_proj_status_settings' |
| 141 |
}; |
| 142 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 143 |
jQuery('.wppm_setting_col2').html(response); |
| 144 |
}); |
| 145 |
} |
| 146 |
|
| 147 |
function wppm_get_add_proj_status(){ |
| 148 |
wppm_modal_open(wppm_admin.add_new_status); |
| 149 |
var data = { |
| 150 |
action: 'wppm_get_add_proj_status' |
| 151 |
}; |
| 152 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 153 |
var response = JSON.parse(response_str); |
| 154 |
jQuery('#wppm_popup_body').html(response.body); |
| 155 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 156 |
jQuery('#wppm_proj_status_name').focus(); |
| 157 |
}); |
| 158 |
} |
| 159 |
|
| 160 |
function wppm_delete_proj_status(status_id){ |
| 161 |
const flag = confirm(wppm_admin.confirm); |
| 162 |
if (!flag) return; |
| 163 |
|
| 164 |
var data = { action: 'wppm_delete_status', status_id, |
| 165 |
_ajax_nonce:jQuery('#wppm_delete_pstatus_ajax_nonce').val() |
| 166 |
}; |
| 167 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 168 |
wppm_get_proj_status_settings(); |
| 169 |
}); |
| 170 |
} |
| 171 |
|
| 172 |
function wppm_set_project_users(){ |
| 173 |
var dataform = new FormData(jQuery('#frm_get_project_users')[0]); |
| 174 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 175 |
var proj_id = jQuery('#wppm_proj_id').val(); |
| 176 |
jQuery.ajax({ |
| 177 |
url: wppm_admin.ajax_url, |
| 178 |
type: 'POST', |
| 179 |
data: dataform, |
| 180 |
processData: false, |
| 181 |
contentType: false |
| 182 |
}) |
| 183 |
.done(function () { |
| 184 |
wppm_modal_close(); |
| 185 |
wppm_open_project(proj_id); |
| 186 |
}); |
| 187 |
} |
| 188 |
|
| 189 |
function wppm_set_task_users(proj_id,project_id){ |
| 190 |
var dataform = new FormData(jQuery('#frm_get_task_users')[0]); |
| 191 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 192 |
var task_id = jQuery('#wppm_task_id').val(); |
| 193 |
jQuery.ajax({ |
| 194 |
url: wppm_admin.ajax_url, |
| 195 |
type: 'POST', |
| 196 |
data: dataform, |
| 197 |
processData: false, |
| 198 |
contentType: false |
| 199 |
}) |
| 200 |
.done(function () { |
| 201 |
if((proj_id!=0)||(proj_id!="")){ |
| 202 |
wppm_task_modal_close(); |
| 203 |
wppm_open_project_tasks(task_id,proj_id); |
| 204 |
}else if((proj_id==0)||(proj_id=="")){ |
| 205 |
wppm_task_modal_close(); |
| 206 |
wppm_open_task(task_id,project_id); |
| 207 |
} |
| 208 |
}); |
| 209 |
} |
| 210 |
|
| 211 |
function wppm_get_project_list(page_no){ |
| 212 |
jQuery('#wppm_project_container').show(); |
| 213 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 214 |
var dataform=new FormData(jQuery('#wppm_project_list_frm')[0]); |
| 215 |
dataform.append("page_no", page_no); |
| 216 |
dataform.append("action", 'wppm_get_project_list'); |
| 217 |
dataform.append("page", wppm_admin.page); |
| 218 |
dataform.append("wppm_project_filter", wppm_project_filter); |
| 219 |
jQuery.ajax( { |
| 220 |
url: wppm_admin.ajax_url, |
| 221 |
type: 'POST', |
| 222 |
data: dataform, |
| 223 |
processData: false, |
| 224 |
contentType: false |
| 225 |
}) |
| 226 |
.done(function( response ) { |
| 227 |
jQuery('#wppm_project_container').html(response); |
| 228 |
}); |
| 229 |
} |
| 230 |
|
| 231 |
function wppm_add_new_task(proj_id,project_id){ |
| 232 |
jQuery('#wppm_task_container').show(); |
| 233 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 234 |
var data = { |
| 235 |
action: 'wppm_add_new_task', |
| 236 |
proj_id:proj_id, |
| 237 |
project_id:project_id |
| 238 |
}; |
| 239 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 240 |
jQuery('#wppm_task_container').html(response); |
| 241 |
}); |
| 242 |
} |
| 243 |
|
| 244 |
function wppm_get_task_list(page_no,id){ |
| 245 |
jQuery('#wppm_task_container').show(); |
| 246 |
// window.history.replaceState( {}, null, 'admin.php?page=wppm-tasks§ion=task-list' ); |
| 247 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 248 |
var data = { |
| 249 |
action: 'wppm_get_task_list', |
| 250 |
page_no:page_no, |
| 251 |
page:wppm_admin.page, |
| 252 |
project_id:id, |
| 253 |
wppm_task_filter:wppm_task_filter |
| 254 |
}; |
| 255 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 256 |
jQuery('#wppm_task_container').html(response); |
| 257 |
}); |
| 258 |
} |
| 259 |
|
| 260 |
function wppm_get_task_prioriy_settings(){ |
| 261 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 262 |
jQuery('#wppm_settings_task_priorities').addClass('active'); |
| 263 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 264 |
var data = { |
| 265 |
action: 'wppm_get_priority_settings' |
| 266 |
}; |
| 267 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 268 |
jQuery('.wppm_setting_col2').html(response); |
| 269 |
}); |
| 270 |
} |
| 271 |
|
| 272 |
function wppm_add_task_priority(){ |
| 273 |
wppm_modal_open(wppm_admin.add_new_priority); |
| 274 |
var data = { |
| 275 |
action: 'wppm_add_task_priority' |
| 276 |
}; |
| 277 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 278 |
var response = JSON.parse(response_str); |
| 279 |
jQuery('#wppm_popup_body').html(response.body); |
| 280 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 281 |
jQuery('#wppm_cat_name').focus(); |
| 282 |
}); |
| 283 |
} |
| 284 |
|
| 285 |
function wppm_delete_task_priority(priority_id){ |
| 286 |
const flag = confirm(wppm_admin.confirm); |
| 287 |
if (!flag) return; |
| 288 |
|
| 289 |
var data = { action: 'wppm_delete_task_priority', priority_id, |
| 290 |
_ajax_nonce:jQuery('#wppm_delete_tprio_ajax_nonce').val() |
| 291 |
}; |
| 292 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 293 |
wppm_get_task_prioriy_settings(); |
| 294 |
}); |
| 295 |
} |
| 296 |
|
| 297 |
function wppm_get_task_status_settings(){ |
| 298 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 299 |
jQuery('#wppm_settings_task_status').addClass('active'); |
| 300 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 301 |
var data = { |
| 302 |
action: 'wppm_get_task_status_settings' |
| 303 |
}; |
| 304 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 305 |
jQuery('.wppm_setting_col2').html(response); |
| 306 |
}); |
| 307 |
} |
| 308 |
|
| 309 |
function wppm_get_add_task_status(){ |
| 310 |
wppm_modal_open(wppm_admin.add_new_status); |
| 311 |
var data = { |
| 312 |
action: 'wppm_get_add_task_status' |
| 313 |
}; |
| 314 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 315 |
var response = JSON.parse(response_str); |
| 316 |
jQuery('#wppm_popup_body').html(response.body); |
| 317 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 318 |
jQuery('#wppm_cat_name').focus(); |
| 319 |
}); |
| 320 |
} |
| 321 |
|
| 322 |
function wppm_delete_task_status(status_id){ |
| 323 |
const flag = confirm(wppm_admin.confirm); |
| 324 |
if (!flag) return; |
| 325 |
|
| 326 |
var data = { action: 'wppm_delete_task_status', status_id, |
| 327 |
_ajax_nonce: jQuery('#wppm_delete_tstatus_ajax_nonce').val()}; |
| 328 |
jQuery.post(wppm_admin.ajax_url, data, function (res) { |
| 329 |
wppm_get_task_status_settings(); |
| 330 |
}); |
| 331 |
} |
| 332 |
|
| 333 |
function wppm_task_search_filter(page){ |
| 334 |
var task_search = jQuery("#wppm_task_search_filter").val(); |
| 335 |
jQuery('#wppm_task_container').show(); |
| 336 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 337 |
var data = { |
| 338 |
action: 'wppm_get_task_list', |
| 339 |
task_search:task_search, |
| 340 |
page:page |
| 341 |
}; |
| 342 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 343 |
jQuery('#wppm_task_container').html(response); |
| 344 |
}); |
| 345 |
} |
| 346 |
|
| 347 |
function wppm_view_task_search_filter(page_no,page,proj_id){ |
| 348 |
var task_search = jQuery("#wppm_view_task_search_filter").val() || ''; |
| 349 |
jQuery('#wppm_task_container').show(); |
| 350 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 351 |
|
| 352 |
var data = { |
| 353 |
action: 'wppm_get_task_list_card_view', |
| 354 |
task_search:task_search, |
| 355 |
page_no:page_no, |
| 356 |
page:page, |
| 357 |
project_id:proj_id |
| 358 |
}; |
| 359 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 360 |
jQuery('#wppm_task_container').html(response); |
| 361 |
}); |
| 362 |
} |
| 363 |
|
| 364 |
function wppm_open_task(id,proj_id){ |
| 365 |
jQuery('#wppm_task_container').show(); |
| 366 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 367 |
var data = { |
| 368 |
action: 'wppm_open_task', |
| 369 |
id:id, |
| 370 |
auth_code: wppm_admin.auth_code, |
| 371 |
page:wppm_admin.page, |
| 372 |
project_id:proj_id |
| 373 |
}; |
| 374 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 375 |
jQuery('#wppm_task_container').html(response); |
| 376 |
}); |
| 377 |
} |
| 378 |
|
| 379 |
function wppm_open_dashboard_task(id){ |
| 380 |
window.location.href = 'admin.php?page=wppm-tasks&task_id=' + id; |
| 381 |
} |
| 382 |
|
| 383 |
function wppm_open_project_tasks(id,proj_id){ |
| 384 |
wppm_modal_open('Open Tasks'); |
| 385 |
jQuery('#wppm_task_container').show(); |
| 386 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 387 |
var data = { |
| 388 |
action: 'wppm_open_task', |
| 389 |
id: id, |
| 390 |
proj_id:proj_id |
| 391 |
} |
| 392 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 393 |
jQuery('#wppm_popup_body').html(response_str); |
| 394 |
//jQuery('#wppm_task_container').html(response_str); |
| 395 |
}); |
| 396 |
} |
| 397 |
|
| 398 |
function wppm_add_new_checklist(task_id,proj_id){ |
| 399 |
if(jQuery('#wppm_checklist_label').val()==''){ |
| 400 |
jQuery('#wppm_checklist_label').focus(); |
| 401 |
return false; |
| 402 |
} |
| 403 |
var data = { |
| 404 |
action: 'wppm_add_new_checklist', |
| 405 |
task_id: task_id, |
| 406 |
proj_id: proj_id, |
| 407 |
checklist_name: jQuery('#wppm_checklist_label').val(), |
| 408 |
_ajax_nonce:jQuery('#wppm_checklist_ajax_nonce').val() |
| 409 |
}; |
| 410 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 411 |
if((proj_id!=0)||(proj_id!="")){ |
| 412 |
//wppm_modal_close(); |
| 413 |
wppm_open_project_tasks(task_id,proj_id); |
| 414 |
}else if((proj_id==0)||(proj_id=="")){ |
| 415 |
//wppm_modal_close(); |
| 416 |
wppm_open_task(task_id); |
| 417 |
} |
| 418 |
}); |
| 419 |
} |
| 420 |
|
| 421 |
function wppm_add_new_checklist_item(checklist_id,task_id,proj_id){ |
| 422 |
if(jQuery('#wppm_checklist_item_label_'+checklist_id).val()==''){ |
| 423 |
jQuery('#wppm_checklist_item_label_'+checklist_id).focus(); |
| 424 |
return false; |
| 425 |
} |
| 426 |
var data = { |
| 427 |
action: 'wppm_add_new_checklist_item', |
| 428 |
checklist_id: checklist_id, |
| 429 |
proj_id:proj_id, |
| 430 |
label: jQuery('#wppm_checklist_item_label_'+checklist_id).val(), |
| 431 |
_ajax_nonce:jQuery('#wppm_checklist_item_ajax_nonce').val() |
| 432 |
}; |
| 433 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 434 |
if((proj_id!=0)||(proj_id!="")){ |
| 435 |
wppm_open_project_tasks(task_id,proj_id); |
| 436 |
}else if((proj_id==0)||(proj_id=="")){ |
| 437 |
wppm_open_task(task_id); |
| 438 |
} |
| 439 |
}); |
| 440 |
} |
| 441 |
|
| 442 |
function wppm_delete_checklist(checklist_id,task_id,proj_id){ |
| 443 |
const flag = confirm(wppm_admin.confirm); |
| 444 |
if (!flag) return; |
| 445 |
var data = { |
| 446 |
action: 'wppm_delete_checklist', |
| 447 |
checklist_id: checklist_id, |
| 448 |
task_id:task_id, |
| 449 |
proj_id:proj_id, |
| 450 |
_ajax_nonce:jQuery('#wppm_delete_checklist_ajax_nonce').val() |
| 451 |
}; |
| 452 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 453 |
if((proj_id!=0)||(proj_id!="")){ |
| 454 |
wppm_open_project_tasks(task_id,proj_id); |
| 455 |
}else if((proj_id==0)||(proj_id=="")){ |
| 456 |
wppm_open_task(task_id); |
| 457 |
} |
| 458 |
}); |
| 459 |
} |
| 460 |
|
| 461 |
function wppm_delete_checklist_item(item_id,checklist_id,proj_id,task_id){ |
| 462 |
const flag = confirm(wppm_admin.confirm); |
| 463 |
if (!flag) return; |
| 464 |
var data = { |
| 465 |
action: 'wppm_remove_checklist_item', |
| 466 |
item_id:item_id, |
| 467 |
checklist_id: checklist_id, |
| 468 |
proj_id:proj_id, |
| 469 |
task_id:task_id, |
| 470 |
_ajax_nonce:jQuery('#wppm_delete_checklist_item_ajax_nonce').val() |
| 471 |
}; |
| 472 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 473 |
if((proj_id!=0)||(proj_id!="")){ |
| 474 |
wppm_open_project_tasks(task_id,proj_id); |
| 475 |
}else if((proj_id==0)||(proj_id=="")){ |
| 476 |
wppm_open_task(task_id); |
| 477 |
} |
| 478 |
}); |
| 479 |
} |
| 480 |
|
| 481 |
function wppm_checklist_progress(checklist_id,item_id,task_id){ |
| 482 |
var $checkboxes = jQuery('.wppm_checklist_item_'+checklist_id); |
| 483 |
var $progress = jQuery('#CheckProgress_'+checklist_id); |
| 484 |
var total = $checkboxes.length; |
| 485 |
var checked = jQuery('.wppm_checklist_item_'+checklist_id).filter(':checked').length; |
| 486 |
var progressWidth = (checked / total) * 100; |
| 487 |
var checked_item; |
| 488 |
jQuery('#CheckProgress_'+checklist_id).css('background','#5ba4cf'); |
| 489 |
jQuery('#CheckProgress_'+checklist_id).css('width', progressWidth + '%'); |
| 490 |
if (jQuery("#wppm_checklist_item_"+item_id).prop("checked")==true) { |
| 491 |
checked_item=1; |
| 492 |
}else{ |
| 493 |
checked_item=0; |
| 494 |
} |
| 495 |
var data = { |
| 496 |
action: 'wppm_set_checklist_progress', |
| 497 |
checklist_id: checklist_id, |
| 498 |
item_id:item_id, |
| 499 |
checked_item: checked_item, |
| 500 |
_ajax_nonce:jQuery('#wppm_checklist_progress_ajax_nonce').val() |
| 501 |
}; |
| 502 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 503 |
wppm_open_task(task_id); |
| 504 |
}); |
| 505 |
} |
| 506 |
|
| 507 |
function wppm_open_individual_task(id){ |
| 508 |
jQuery('#wppm_project_container').show(); |
| 509 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 510 |
var data = { |
| 511 |
action: 'wppm_open_task', |
| 512 |
id:id |
| 513 |
}; |
| 514 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 515 |
jQuery('#wppm_project_container').html(response); |
| 516 |
}); |
| 517 |
} |
| 518 |
|
| 519 |
|
| 520 |
function wppm_display_grid_view(page,id){ |
| 521 |
var task_search = jQuery("#wppm_view_task_search_filter").val() || ''; |
| 522 |
jQuery('#wppm_task_container').show(); |
| 523 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 524 |
var data = { |
| 525 |
action: 'wppm_get_task_list_card_view', |
| 526 |
task_search: task_search, |
| 527 |
wppm_task_filter: wppm_task_filter, |
| 528 |
page:page, |
| 529 |
id:id |
| 530 |
}; |
| 531 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 532 |
jQuery('#wppm_task_container').html(response); |
| 533 |
}); |
| 534 |
} |
| 535 |
|
| 536 |
function wppm_remove_filter(id){ |
| 537 |
jQuery('#wppm_user_display_container_'+id).remove(); |
| 538 |
} |
| 539 |
|
| 540 |
function wppm_remove_user_from_project(id){ |
| 541 |
jQuery('#wppm_user_container_'+id).remove(); |
| 542 |
} |
| 543 |
|
| 544 |
function wppm_remove_task_user_filter(id){ |
| 545 |
jQuery('#wppm_task_user_display_container_'+id).remove(); |
| 546 |
} |
| 547 |
|
| 548 |
function wppm_attachment_cancel( obj ){ |
| 549 |
jQuery(obj).parent().remove(); |
| 550 |
} |
| 551 |
|
| 552 |
function wppm_get_en_general_setting(){ |
| 553 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 554 |
jQuery('#wppm_en_setting_general').addClass('active'); |
| 555 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 556 |
|
| 557 |
var data = { |
| 558 |
action: 'wppm_get_en_general_setting', |
| 559 |
}; |
| 560 |
|
| 561 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 562 |
jQuery('.wppm_setting_col2').html(response); |
| 563 |
}); |
| 564 |
} |
| 565 |
|
| 566 |
function wppm_set_en_general_settings(){ |
| 567 |
jQuery('.wppm_submit_wait').show(); |
| 568 |
var dataform = new FormData(jQuery('#wppm_en_frm_general_settings')[0]); |
| 569 |
|
| 570 |
jQuery.ajax({ |
| 571 |
url: wppm_admin.ajax_url, |
| 572 |
type: 'POST', |
| 573 |
data: dataform, |
| 574 |
processData: false, |
| 575 |
contentType: false |
| 576 |
}) |
| 577 |
.done(function (response_str) { |
| 578 |
var response = JSON.parse(response_str); |
| 579 |
jQuery('.wppm_submit_wait').hide(); |
| 580 |
if (response.sucess_status=='1') { |
| 581 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 582 |
} |
| 583 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 584 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 585 |
}); |
| 586 |
} |
| 587 |
|
| 588 |
function wppm_get_en_task_notifications(){ |
| 589 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 590 |
jQuery('#wppm_en_ticket_notifications').addClass('active'); |
| 591 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 592 |
|
| 593 |
var data = { |
| 594 |
action: 'wppm_get_en_task_notifications' |
| 595 |
}; |
| 596 |
|
| 597 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 598 |
jQuery('.wppm_setting_col2').html(response); |
| 599 |
}); |
| 600 |
} |
| 601 |
|
| 602 |
function wppm_edit_task_status(id,proj_id,project_id){ |
| 603 |
if(proj_id==0){ |
| 604 |
wppm_task_modal_open('Edit'); |
| 605 |
}else{ |
| 606 |
wppm_modal_open('Edit'); |
| 607 |
} |
| 608 |
var data = { |
| 609 |
action: 'wppm_edit_task_status', |
| 610 |
task_id: id, |
| 611 |
proj_id:proj_id, |
| 612 |
project_id:project_id |
| 613 |
} |
| 614 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 615 |
var response = JSON.parse(response_str); |
| 616 |
if(proj_id==0){ |
| 617 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 618 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 619 |
}else{ |
| 620 |
jQuery('#wppm_popup_body').html(response.body); |
| 621 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 622 |
} |
| 623 |
}); |
| 624 |
} |
| 625 |
|
| 626 |
function wppm_edit_task_users(task_id,proj_id,project_id){ |
| 627 |
if(proj_id==0){ |
| 628 |
wppm_task_modal_open('Add Users'); |
| 629 |
}else{ |
| 630 |
wppm_modal_open('Add Users'); |
| 631 |
} |
| 632 |
var data = { |
| 633 |
action: 'wppm_get_task_users', |
| 634 |
task_id: task_id, |
| 635 |
proj_id:proj_id, |
| 636 |
project_id:project_id |
| 637 |
} |
| 638 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 639 |
var response = JSON.parse(response_str); |
| 640 |
if(proj_id==0){ |
| 641 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 642 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 643 |
}else{ |
| 644 |
jQuery('#wppm_popup_body').html(response.body); |
| 645 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 646 |
} |
| 647 |
}); |
| 648 |
} |
| 649 |
|
| 650 |
function wppm_edit_task_details(id,proj_id,project_id){ |
| 651 |
if(proj_id==0){ |
| 652 |
wppm_task_modal_open('Edit Task Details'); |
| 653 |
}else{ |
| 654 |
wppm_modal_open('Edit Task Details'); |
| 655 |
} |
| 656 |
var data = { |
| 657 |
action: 'wppm_edit_task_details', |
| 658 |
task_id: id, |
| 659 |
proj_id:proj_id, |
| 660 |
project_id:project_id |
| 661 |
} |
| 662 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 663 |
var response = JSON.parse(response_str); |
| 664 |
if(proj_id==0){ |
| 665 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 666 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 667 |
}else{ |
| 668 |
jQuery('#wppm_popup_body').html(response.body); |
| 669 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 670 |
} |
| 671 |
}); |
| 672 |
} |
| 673 |
|
| 674 |
function wppm_set_change_task_status(task_id,proj_id,project_id){ |
| 675 |
var dataform = new FormData(jQuery('#frm_get_task_change_status')[0]); |
| 676 |
if(proj_id == 0){ |
| 677 |
wppm_task_modal_close(); |
| 678 |
}else{ |
| 679 |
wppm_modal_close(); |
| 680 |
} |
| 681 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 682 |
jQuery.ajax({ |
| 683 |
url: wppm_admin.ajax_url, |
| 684 |
type: 'POST', |
| 685 |
data: dataform, |
| 686 |
processData: false, |
| 687 |
contentType: false |
| 688 |
}) |
| 689 |
.done(function (response_str) { |
| 690 |
if((proj_id!=0)||(proj_id!="")){ |
| 691 |
wppm_open_project_tasks(task_id,proj_id); |
| 692 |
}else if((proj_id==0)||(proj_id=="")){ |
| 693 |
wppm_open_task(task_id,project_id); |
| 694 |
} |
| 695 |
|
| 696 |
}); |
| 697 |
} |
| 698 |
|
| 699 |
function wppm_edit_task_creator(task_id,proj_id,project_id){ |
| 700 |
if(proj_id==0){ |
| 701 |
wppm_task_modal_open('Edit Task Creator'); |
| 702 |
}else{ |
| 703 |
wppm_modal_open('Edit Task Creator'); |
| 704 |
} |
| 705 |
var data = { |
| 706 |
action: 'wppm_edit_task_creator', |
| 707 |
task_id: task_id, |
| 708 |
proj_id: proj_id, |
| 709 |
project_id: project_id |
| 710 |
} |
| 711 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 712 |
var response = JSON.parse(response_str); |
| 713 |
if(proj_id==0){ |
| 714 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 715 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 716 |
}else{ |
| 717 |
jQuery('#wppm_popup_body').html(response.body); |
| 718 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 719 |
} |
| 720 |
}); |
| 721 |
} |
| 722 |
|
| 723 |
function wppm_set_change_raised_by(task_id,proj_id,project_id){ |
| 724 |
var dataform = new FormData(jQuery('#frm_get_task_creator')[0]); |
| 725 |
if(proj_id==0){ |
| 726 |
wppm_task_modal_close(); |
| 727 |
}else{ |
| 728 |
wppm_modal_close(); |
| 729 |
} |
| 730 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 731 |
jQuery.ajax({ |
| 732 |
url: wppm_admin.ajax_url, |
| 733 |
type: 'POST', |
| 734 |
data: dataform, |
| 735 |
processData: false, |
| 736 |
contentType: false |
| 737 |
}) |
| 738 |
.done(function (response_str) { |
| 739 |
if((proj_id!=0)||(proj_id!="")){ |
| 740 |
wppm_open_project_tasks(task_id,proj_id); |
| 741 |
}else if((proj_id==0)||(proj_id=="")){ |
| 742 |
wppm_open_task(task_id,project_id); |
| 743 |
} |
| 744 |
}); |
| 745 |
} |
| 746 |
|
| 747 |
function wppm_set_change_task_details(task_id, proj_id, project_id) { |
| 748 |
var dataform = new FormData(jQuery('#frm_get_edit_task_deatils')[0]); |
| 749 |
var editor = tinyMCE.get('wppm_edit_task_description'); |
| 750 |
var description = ''; |
| 751 |
if (editor) { |
| 752 |
description = editor.getContent().trim(); |
| 753 |
} else { |
| 754 |
description = jQuery('#wppm_edit_task_description').val().trim(); |
| 755 |
} |
| 756 |
dataform.append('wppm_edit_task_description', description); |
| 757 |
if (proj_id == 0) { |
| 758 |
wppm_task_modal_close(); |
| 759 |
} else { |
| 760 |
wppm_modal_close(); |
| 761 |
} |
| 762 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 763 |
jQuery.ajax({ |
| 764 |
url: wppm_admin.ajax_url, |
| 765 |
type: 'POST', |
| 766 |
data: dataform, |
| 767 |
processData: false, |
| 768 |
contentType: false |
| 769 |
}).done(function(response_str) { |
| 770 |
if (proj_id != 0 && proj_id != "") { |
| 771 |
wppm_open_project_tasks(task_id, proj_id); |
| 772 |
} else { |
| 773 |
wppm_open_task(task_id, project_id); |
| 774 |
} |
| 775 |
}); |
| 776 |
} |
| 777 |
|
| 778 |
function wppm_edit_thread(comment_id,task_id,proj_id){ |
| 779 |
if(proj_id==0){ |
| 780 |
wppm_task_modal_open('Edit Thread'); |
| 781 |
}else{ |
| 782 |
wppm_modal_open('Edit Thread'); |
| 783 |
} |
| 784 |
var data = { |
| 785 |
action: 'wppm_edit_task_thread', |
| 786 |
comment_id:comment_id, |
| 787 |
task_id: task_id, |
| 788 |
proj_id: proj_id |
| 789 |
} |
| 790 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 791 |
var response = JSON.parse(response_str); |
| 792 |
if(proj_id==0){ |
| 793 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 794 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 795 |
}else{ |
| 796 |
jQuery('#wppm_popup_body').html(response.body); |
| 797 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 798 |
} |
| 799 |
}); |
| 800 |
} |
| 801 |
|
| 802 |
function wppm_edit_proj_thread(comment_id,proj_id){ |
| 803 |
wppm_modal_open('Edit Thread'); |
| 804 |
var data = { |
| 805 |
action: 'wppm_edit_proj_thread', |
| 806 |
comment_id:comment_id, |
| 807 |
proj_id: proj_id |
| 808 |
} |
| 809 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 810 |
var response = JSON.parse(response_str); |
| 811 |
jQuery('#wppm_popup_body').html(response.body); |
| 812 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 813 |
}); |
| 814 |
} |
| 815 |
|
| 816 |
function wppm_set_edit_task_thread(task_id,proj_id){ |
| 817 |
var dataform = new FormData(jQuery('#frm_edit_task_thread')[0]); |
| 818 |
if(wppm_admin.rich_text_editor == 1){ |
| 819 |
var comment_body = tinyMCE.get('wppm_edit_task_thread_editor').getContent().trim(); |
| 820 |
}else{ |
| 821 |
var comment_body = jQuery('#wppm_edit_task_thread_editor').val().trim(); |
| 822 |
} |
| 823 |
dataform.append('wppm_edit_task_thread', comment_body); |
| 824 |
if(proj_id==0){ |
| 825 |
wppm_task_modal_close(); |
| 826 |
}else{ |
| 827 |
wppm_modal_close(); |
| 828 |
} |
| 829 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 830 |
jQuery.ajax({ |
| 831 |
url: wppm_admin.ajax_url, |
| 832 |
type: 'POST', |
| 833 |
data: dataform, |
| 834 |
processData: false, |
| 835 |
contentType: false |
| 836 |
}) |
| 837 |
.done(function (response_str) { |
| 838 |
if((proj_id!=0)||(proj_id!="")){ |
| 839 |
wppm_open_project_tasks(task_id,proj_id); |
| 840 |
}else if((proj_id==0)||(proj_id=="")){ |
| 841 |
wppm_open_task(task_id); |
| 842 |
} |
| 843 |
}); |
| 844 |
} |
| 845 |
|
| 846 |
function wppm_set_edit_proj_thread(proj_id){ |
| 847 |
var dataform = new FormData(jQuery('#frm_edit_proj_thread')[0]); |
| 848 |
if(wppm_admin.rich_text_editor == 1){ |
| 849 |
var comment_body = tinyMCE.get('wppm_edit_proj_thread_editor').getContent().trim(); |
| 850 |
}else{ |
| 851 |
var comment_body = jQuery('#wppm_edit_proj_thread_editor').val().trim(); |
| 852 |
} |
| 853 |
dataform.append('wppm_edit_proj_thread', comment_body); |
| 854 |
wppm_modal_close(); |
| 855 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 856 |
jQuery.ajax({ |
| 857 |
url: wppm_admin.ajax_url, |
| 858 |
type: 'POST', |
| 859 |
data: dataform, |
| 860 |
processData: false, |
| 861 |
contentType: false |
| 862 |
}) |
| 863 |
.done(function (response_str) { |
| 864 |
wppm_open_project(proj_id); |
| 865 |
}); |
| 866 |
} |
| 867 |
|
| 868 |
function wppm_delete_thread(comment_id,task_id,proj_id){ |
| 869 |
if(proj_id==0){ |
| 870 |
wppm_task_modal_open('Delete Thread'); |
| 871 |
}else{ |
| 872 |
wppm_modal_open('Delete Thread'); |
| 873 |
} |
| 874 |
var data = { |
| 875 |
action: 'wppm_delete_task_thread', |
| 876 |
comment_id:comment_id, |
| 877 |
task_id: task_id, |
| 878 |
proj_id:proj_id |
| 879 |
} |
| 880 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 881 |
var response = JSON.parse(response_str); |
| 882 |
if(proj_id==0){ |
| 883 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 884 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 885 |
}else{ |
| 886 |
jQuery('#wppm_popup_body').html(response.body); |
| 887 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 888 |
} |
| 889 |
}); |
| 890 |
} |
| 891 |
|
| 892 |
function wppm_delete_proj_thread(comment_id,proj_id){ |
| 893 |
wppm_modal_open('Delete Thread'); |
| 894 |
var data = { |
| 895 |
action: 'wppm_delete_proj_thread', |
| 896 |
comment_id:comment_id, |
| 897 |
proj_id:proj_id |
| 898 |
} |
| 899 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 900 |
var response = JSON.parse(response_str); |
| 901 |
jQuery('#wppm_popup_body').html(response.body); |
| 902 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 903 |
}); |
| 904 |
} |
| 905 |
|
| 906 |
function wppm_set_delete_thread(task_id,proj_id){ |
| 907 |
var dataform = new FormData(jQuery('#frm_delete_task_thread')[0]); |
| 908 |
if(proj_id==0){ |
| 909 |
wppm_task_modal_close(); |
| 910 |
}else{ |
| 911 |
wppm_modal_close(); |
| 912 |
} |
| 913 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 914 |
jQuery.ajax({ |
| 915 |
url: wppm_admin.ajax_url, |
| 916 |
type: 'POST', |
| 917 |
data: dataform, |
| 918 |
processData: false, |
| 919 |
contentType: false |
| 920 |
}) |
| 921 |
.done(function (response_str) { |
| 922 |
if((proj_id!=0)||(proj_id!="")){ |
| 923 |
wppm_open_project_tasks(task_id,proj_id); |
| 924 |
}else if((proj_id==0)||(proj_id=="")){ |
| 925 |
wppm_open_task(task_id); |
| 926 |
} |
| 927 |
}); |
| 928 |
} |
| 929 |
|
| 930 |
function wppm_set_delete_proj_thread(proj_id){ |
| 931 |
var dataform = new FormData(jQuery('#frm_delete_proj_thread')[0]); |
| 932 |
wppm_modal_close(); |
| 933 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 934 |
jQuery.ajax({ |
| 935 |
url: wppm_admin.ajax_url, |
| 936 |
type: 'POST', |
| 937 |
data: dataform, |
| 938 |
processData: false, |
| 939 |
contentType: false |
| 940 |
}) |
| 941 |
.done(function (response_str) { |
| 942 |
wppm_open_project(proj_id); |
| 943 |
}); |
| 944 |
} |
| 945 |
|
| 946 |
function wppm_edit_proj_details(id){ |
| 947 |
wppm_modal_open('Edit Project Details'); |
| 948 |
var data = { |
| 949 |
action: 'wppm_edit_project_details', |
| 950 |
id: id |
| 951 |
} |
| 952 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 953 |
var response = JSON.parse(response_str); |
| 954 |
jQuery('#wppm_popup_body').html(response.body); |
| 955 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 956 |
}); |
| 957 |
} |
| 958 |
|
| 959 |
function wppm_set_change_project_details(id){ |
| 960 |
var dataform = new FormData(jQuery('#frm_get_edit_project_deatils')[0]); |
| 961 |
var description = tinyMCE.get('wppm_edit_project_description').getContent().trim(); |
| 962 |
dataform.append('wppm_edit_project_description', description); |
| 963 |
wppm_modal_close(); |
| 964 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 965 |
jQuery.ajax({ |
| 966 |
url: wppm_admin.ajax_url, |
| 967 |
type: 'POST', |
| 968 |
data: dataform, |
| 969 |
processData: false, |
| 970 |
contentType: false |
| 971 |
}) |
| 972 |
.done(function (response_str) { |
| 973 |
wppm_open_project(id); |
| 974 |
}); |
| 975 |
} |
| 976 |
|
| 977 |
function wppm_edit_project_status(id){ |
| 978 |
wppm_modal_open('Edit Project Status'); |
| 979 |
var data = { |
| 980 |
action: 'wppm_edit_project_status', |
| 981 |
id: id |
| 982 |
} |
| 983 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 984 |
var response = JSON.parse(response_str); |
| 985 |
jQuery('#wppm_popup_body').html(response.body); |
| 986 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 987 |
}); |
| 988 |
} |
| 989 |
|
| 990 |
function wppm_set_change_project_status(id){ |
| 991 |
var dataform = new FormData(jQuery('#frm_get_project_change_status')[0]); |
| 992 |
wppm_modal_close(); |
| 993 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 994 |
jQuery.ajax({ |
| 995 |
url: wppm_admin.ajax_url, |
| 996 |
type: 'POST', |
| 997 |
data: dataform, |
| 998 |
processData: false, |
| 999 |
contentType: false |
| 1000 |
}) |
| 1001 |
.done(function (response_str) { |
| 1002 |
wppm_open_project(id); |
| 1003 |
}); |
| 1004 |
} |
| 1005 |
|
| 1006 |
function wppm_edit_project_creator(id){ |
| 1007 |
wppm_modal_open('Edit Project Creator'); |
| 1008 |
var data = { |
| 1009 |
action: 'wppm_edit_project_creator', |
| 1010 |
id: id |
| 1011 |
} |
| 1012 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1013 |
var response = JSON.parse(response_str); |
| 1014 |
jQuery('#wppm_popup_body').html(response.body); |
| 1015 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1016 |
}); |
| 1017 |
} |
| 1018 |
|
| 1019 |
function wppm_set_change_project_raised_by(id){ |
| 1020 |
var dataform = new FormData(jQuery('#frm_get_project_creator')[0]); |
| 1021 |
wppm_modal_close(); |
| 1022 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1023 |
jQuery.ajax({ |
| 1024 |
url: wppm_admin.ajax_url, |
| 1025 |
type: 'POST', |
| 1026 |
data: dataform, |
| 1027 |
processData: false, |
| 1028 |
contentType: false |
| 1029 |
}) |
| 1030 |
.done(function (response_str) { |
| 1031 |
wppm_open_project(id); |
| 1032 |
}); |
| 1033 |
} |
| 1034 |
|
| 1035 |
function wppm_edit_project_users(id){ |
| 1036 |
wppm_modal_open('Add Users'); |
| 1037 |
var data = { |
| 1038 |
action: 'wppm_get_project_users', |
| 1039 |
id: id |
| 1040 |
} |
| 1041 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1042 |
var response = JSON.parse(response_str); |
| 1043 |
jQuery('#wppm_popup_body').html(response.body); |
| 1044 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1045 |
}); |
| 1046 |
} |
| 1047 |
|
| 1048 |
function wppm_delete_project(id){ |
| 1049 |
wppm_modal_open('Delete Project'); |
| 1050 |
var data = { |
| 1051 |
action: 'wppm_get_delete_project', |
| 1052 |
id: id |
| 1053 |
} |
| 1054 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1055 |
var response = JSON.parse(response_str); |
| 1056 |
jQuery('#wppm_popup_body').html(response.body); |
| 1057 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1058 |
}); |
| 1059 |
} |
| 1060 |
|
| 1061 |
function wppm_set_delete_project(){ |
| 1062 |
var dataform = new FormData(jQuery('#frm_delete_project')[0]); |
| 1063 |
wppm_modal_close(); |
| 1064 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1065 |
jQuery.ajax({ |
| 1066 |
url: wppm_admin.ajax_url, |
| 1067 |
type: 'POST', |
| 1068 |
data: dataform, |
| 1069 |
processData: false, |
| 1070 |
contentType: false |
| 1071 |
}) |
| 1072 |
.done(function (response_str) { |
| 1073 |
wppm_get_project_list(); |
| 1074 |
}); |
| 1075 |
} |
| 1076 |
|
| 1077 |
function wppm_get_delete_task(id,proj_id,project_id){ |
| 1078 |
if(proj_id==0){ |
| 1079 |
wppm_task_modal_open('Delete Task'); |
| 1080 |
}else{ |
| 1081 |
wppm_modal_open('Delete Task'); |
| 1082 |
} |
| 1083 |
var data = { |
| 1084 |
action: 'wppm_get_delete_task', |
| 1085 |
id: id, |
| 1086 |
proj_id:proj_id, |
| 1087 |
project_id:project_id |
| 1088 |
} |
| 1089 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1090 |
var response = JSON.parse(response_str); |
| 1091 |
if(proj_id==0){ |
| 1092 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 1093 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 1094 |
}else{ |
| 1095 |
jQuery('#wppm_popup_body').html(response.body); |
| 1096 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1097 |
} |
| 1098 |
}); |
| 1099 |
} |
| 1100 |
|
| 1101 |
function wppm_set_delete_task(proj_id,project_id){ |
| 1102 |
var dataform = new FormData(jQuery('#frm_delete_task')[0]); |
| 1103 |
if(proj_id==0){ |
| 1104 |
wppm_task_modal_close(); |
| 1105 |
}else{ |
| 1106 |
wppm_modal_close(); |
| 1107 |
} |
| 1108 |
jQuery.ajax({ |
| 1109 |
url: wppm_admin.ajax_url, |
| 1110 |
type: 'POST', |
| 1111 |
data: dataform, |
| 1112 |
processData: false, |
| 1113 |
contentType: false |
| 1114 |
}) |
| 1115 |
.done(function (response_str) { |
| 1116 |
if(project_id!=0){ |
| 1117 |
wppm_get_project_tasks_kanban_view(project_id); |
| 1118 |
}else{ |
| 1119 |
if(proj_id==0){ |
| 1120 |
wppm_get_task_list(); |
| 1121 |
}else{ |
| 1122 |
wppm_get_project_tasks(proj_id); |
| 1123 |
} |
| 1124 |
} |
| 1125 |
}); |
| 1126 |
} |
| 1127 |
|
| 1128 |
function wppm_get_edit_email_notification(id){ |
| 1129 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 1130 |
var data = { |
| 1131 |
action: 'wppm_get_edit_email_notification', |
| 1132 |
id : id |
| 1133 |
}; |
| 1134 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1135 |
jQuery('.wppm_setting_col2').html(response); |
| 1136 |
}); |
| 1137 |
} |
| 1138 |
|
| 1139 |
function wppm_get_tinymce(selector,body_id){ |
| 1140 |
jQuery('#visual').addClass('btn btn-primary'); |
| 1141 |
jQuery('#text').removeClass('btn btn-primary'); |
| 1142 |
jQuery('#text').addClass('btn btn-default'); |
| 1143 |
tinymce.init({ |
| 1144 |
selector:'#'+selector, |
| 1145 |
body_id: body_id, |
| 1146 |
menubar: false, |
| 1147 |
statusbar: false, |
| 1148 |
height : '200', |
| 1149 |
plugins: [ |
| 1150 |
'lists link image directionality' |
| 1151 |
], |
| 1152 |
image_advtab: true, |
| 1153 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 1154 |
branding: false, |
| 1155 |
autoresize_bottom_margin: 20, |
| 1156 |
browser_spellcheck : true, |
| 1157 |
relative_urls : false, |
| 1158 |
remove_script_host : false, |
| 1159 |
convert_urls : true, |
| 1160 |
setup: function (editor) { |
| 1161 |
} |
| 1162 |
}); |
| 1163 |
} |
| 1164 |
|
| 1165 |
function wppm_get_textarea(){ |
| 1166 |
jQuery('#visual').removeClass('btn btn-primary'); |
| 1167 |
jQuery('#visual').addClass('btn btn-default'); |
| 1168 |
jQuery('#text').addClass('btn btn-primary'); |
| 1169 |
tinymce.remove(); |
| 1170 |
} |
| 1171 |
|
| 1172 |
function wppm_get_templates(){ |
| 1173 |
wppm_modal_open(wppm_admin.templates); |
| 1174 |
var data = { |
| 1175 |
action: 'wppm_get_templates' |
| 1176 |
}; |
| 1177 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1178 |
var response = JSON.parse(response_str); |
| 1179 |
jQuery('#wppm_popup_body').html(response.body); |
| 1180 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1181 |
}); |
| 1182 |
} |
| 1183 |
|
| 1184 |
function wppm_set_edit_email_notification(){ |
| 1185 |
var dataform = new FormData(jQuery('#wppm_edit_email_notification_settings')[0]); |
| 1186 |
wppm_modal_close(); |
| 1187 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 1188 |
jQuery.ajax({ |
| 1189 |
url: wppm_admin.ajax_url, |
| 1190 |
type: 'POST', |
| 1191 |
data: dataform, |
| 1192 |
processData: false, |
| 1193 |
contentType: false |
| 1194 |
}) |
| 1195 |
.done(function (response_str) { |
| 1196 |
var response = JSON.parse(response_str); |
| 1197 |
if (response.sucess_status=='1') { |
| 1198 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1199 |
} |
| 1200 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1201 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1202 |
wppm_get_en_task_notifications(); |
| 1203 |
}); |
| 1204 |
} |
| 1205 |
|
| 1206 |
function wppm_set_general_settings(){ |
| 1207 |
jQuery('.wppm_submit_wait').show(); |
| 1208 |
var dataform = new FormData(jQuery('#wppm_frm_general_settings')[0]); |
| 1209 |
jQuery.ajax({ |
| 1210 |
url: wppm_admin.ajax_url, |
| 1211 |
type: 'POST', |
| 1212 |
data: dataform, |
| 1213 |
processData: false, |
| 1214 |
contentType: false |
| 1215 |
}) |
| 1216 |
.done(function (response_str) { |
| 1217 |
var response = JSON.parse(response_str); |
| 1218 |
jQuery('.wppm_submit_wait').hide(); |
| 1219 |
if (response.sucess_status=='1') { |
| 1220 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1221 |
} |
| 1222 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1223 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1224 |
}); |
| 1225 |
} |
| 1226 |
|
| 1227 |
function wppm_get_project_tasks(id){ |
| 1228 |
wppm_modal_open('Tasks'); |
| 1229 |
var data = { |
| 1230 |
action: 'wppm_get_project_tasks', |
| 1231 |
id: id |
| 1232 |
} |
| 1233 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1234 |
var response = JSON.parse(response_str); |
| 1235 |
jQuery('#wppm_popup_body').html(response.body); |
| 1236 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1237 |
}); |
| 1238 |
} |
| 1239 |
|
| 1240 |
function wppm_create_project_task(id){ |
| 1241 |
wppm_task_modal_open('Tasks'); |
| 1242 |
var data = { |
| 1243 |
action: 'wppm_add_new_task', |
| 1244 |
proj_id: id |
| 1245 |
} |
| 1246 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1247 |
jQuery('#wppm_popup_body').html(response_str); |
| 1248 |
}); |
| 1249 |
} |
| 1250 |
|
| 1251 |
function wppm_load_prev_page(prev_page_no, page_no, sort_by, order, is_archieved) { |
| 1252 |
if (prev_page_no != 0) { |
| 1253 |
page_no = prev_page_no - 1; |
| 1254 |
if (parseInt(is_archieved) === 1) { |
| 1255 |
wppm_get_archieve_project_list( |
| 1256 |
page_no, |
| 1257 |
sort_by, |
| 1258 |
order, |
| 1259 |
1 |
| 1260 |
); |
| 1261 |
} else { |
| 1262 |
wppm_get_project_list( |
| 1263 |
page_no, |
| 1264 |
sort_by, |
| 1265 |
order |
| 1266 |
); |
| 1267 |
} |
| 1268 |
} |
| 1269 |
return false; |
| 1270 |
} |
| 1271 |
|
| 1272 |
function wppm_load_next_page(next_page_no, page_no, sort_by, order, is_archieved) { |
| 1273 |
if (next_page_no != page_no) { |
| 1274 |
page_no = next_page_no; |
| 1275 |
if (parseInt(is_archieved) === 1) { |
| 1276 |
wppm_get_archieve_project_list( |
| 1277 |
page_no, |
| 1278 |
sort_by, |
| 1279 |
order, |
| 1280 |
1 |
| 1281 |
); |
| 1282 |
} else { |
| 1283 |
wppm_get_project_list( |
| 1284 |
page_no, |
| 1285 |
sort_by, |
| 1286 |
order |
| 1287 |
); |
| 1288 |
} |
| 1289 |
} |
| 1290 |
|
| 1291 |
return false; |
| 1292 |
} |
| 1293 |
|
| 1294 |
function wppm_load_prev_task_page(prev_page_no,page_no, sort_by, order){ |
| 1295 |
if(prev_page_no!=0){ |
| 1296 |
page_no=prev_page_no-1; |
| 1297 |
wppm_get_task_list(page_no,sort_by,order); |
| 1298 |
} |
| 1299 |
} |
| 1300 |
|
| 1301 |
function wppm_load_next_task_page(next_page_no,page_no,sort_by,order){ |
| 1302 |
if(next_page_no!=page_no){ |
| 1303 |
page_no = next_page_no; |
| 1304 |
wppm_get_task_list(page_no,sort_by,order); |
| 1305 |
} |
| 1306 |
} |
| 1307 |
|
| 1308 |
function wppm_load_prev_task_page_card_view(prev_page_no,page_no){ |
| 1309 |
if(prev_page_no!=0){ |
| 1310 |
page_no=prev_page_no-1; |
| 1311 |
wppm_view_task_search_filter(page_no); |
| 1312 |
} |
| 1313 |
} |
| 1314 |
|
| 1315 |
function wppm_load_next_task_page_card_view(next_page_no,page_no){ |
| 1316 |
if(next_page_no!=page_no){ |
| 1317 |
page_no = next_page_no; |
| 1318 |
wppm_view_task_search_filter(page_no); |
| 1319 |
} |
| 1320 |
} |
| 1321 |
|
| 1322 |
function wppm_thread_attachment_remove(obj,attachment,comment_id,task_id,proj_id){ |
| 1323 |
if( confirm(wppm_admin.confirm) ){ |
| 1324 |
var data = { |
| 1325 |
action: 'wppm_remove_thread_attachment', |
| 1326 |
attachment : attachment, |
| 1327 |
comment_id : comment_id, |
| 1328 |
task_id:task_id, |
| 1329 |
_ajax_nonce : jQuery('#wppm_ajax_nonce').val() |
| 1330 |
}; |
| 1331 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1332 |
jQuery(obj).parent('td').parent('tr').remove(); |
| 1333 |
if((proj_id!=0)||(proj_id!="")){ |
| 1334 |
wppm_open_project_tasks(task_id,proj_id); |
| 1335 |
}else if((proj_id==0)||(proj_id=="")){ |
| 1336 |
wppm_open_task(task_id); |
| 1337 |
} |
| 1338 |
}); |
| 1339 |
} |
| 1340 |
} |
| 1341 |
|
| 1342 |
function wppm_proj_thread_attachment_remove(obj,attachment,comment_id,id){ |
| 1343 |
if( confirm(wppm_admin.confirm) ){ |
| 1344 |
var data = { |
| 1345 |
action: 'wppm_remove_proj_thread_attachment', |
| 1346 |
attachment : attachment, |
| 1347 |
comment_id : comment_id, |
| 1348 |
proj_id:id, |
| 1349 |
_ajax_nonce:jQuery('#wppm_proj_thread_attachment_remove').val() |
| 1350 |
}; |
| 1351 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1352 |
jQuery(obj).parent('td').parent('tr').remove(); |
| 1353 |
wppm_open_project(id); |
| 1354 |
}); |
| 1355 |
} |
| 1356 |
} |
| 1357 |
|
| 1358 |
function wppm_open_project(id){ |
| 1359 |
jQuery('#wppm_project_list').hide(); |
| 1360 |
jQuery('#wppm_project_container').show(); |
| 1361 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1362 |
var data = { |
| 1363 |
action: 'wppm_open_project', |
| 1364 |
id:id, |
| 1365 |
auth_code: wppm_admin.auth_code |
| 1366 |
}; |
| 1367 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1368 |
jQuery('#wppm_project_container').html(response); |
| 1369 |
}); |
| 1370 |
} |
| 1371 |
|
| 1372 |
function wppm_project_search_filter(is_archieved){ |
| 1373 |
var project_search = jQuery("#wppm_project_search_filter").val(); |
| 1374 |
jQuery('#wppm_project_container').show(); |
| 1375 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1376 |
var data = { |
| 1377 |
action: 'wppm_get_project_list', |
| 1378 |
project_search:project_search, |
| 1379 |
page: wppm_admin.page, |
| 1380 |
is_archieved:is_archieved |
| 1381 |
}; |
| 1382 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1383 |
jQuery('#wppm_project_container').html(response); |
| 1384 |
}); |
| 1385 |
} |
| 1386 |
|
| 1387 |
function wppm_clone_task(id,proj_id,project_id){ |
| 1388 |
if(proj_id==0){ |
| 1389 |
wppm_task_modal_open('Clone Task'); |
| 1390 |
}else{ |
| 1391 |
wppm_modal_open('Clone Task'); |
| 1392 |
} |
| 1393 |
var data = { |
| 1394 |
action: 'wppm_clone_task', |
| 1395 |
id: id, |
| 1396 |
proj_id: proj_id, |
| 1397 |
project_id: project_id |
| 1398 |
} |
| 1399 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1400 |
var response = JSON.parse(response_str); |
| 1401 |
if(proj_id==0){ |
| 1402 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 1403 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 1404 |
}else{ |
| 1405 |
jQuery('#wppm_popup_body').html(response.body); |
| 1406 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1407 |
} |
| 1408 |
}); |
| 1409 |
} |
| 1410 |
|
| 1411 |
function wppm_set_clone_task(proj_id,project_id){ |
| 1412 |
var dataform = new FormData(jQuery('#frm_edit_clone_task_name')[0]); |
| 1413 |
if(proj_id==0){ |
| 1414 |
wppm_task_modal_close(); |
| 1415 |
}else{ |
| 1416 |
wppm_modal_close(); |
| 1417 |
} |
| 1418 |
jQuery.ajax({ |
| 1419 |
url: wppm_admin.ajax_url, |
| 1420 |
type: 'POST', |
| 1421 |
data: dataform, |
| 1422 |
processData: false, |
| 1423 |
contentType: false |
| 1424 |
}) |
| 1425 |
.done(function (response_str) { |
| 1426 |
if(project_id!=0){ |
| 1427 |
wppm_get_project_tasks_kanban_view(project_id); |
| 1428 |
}else{ |
| 1429 |
if(proj_id==0){ |
| 1430 |
wppm_get_task_list(); |
| 1431 |
}else{ |
| 1432 |
wppm_get_project_tasks(proj_id); |
| 1433 |
} |
| 1434 |
} |
| 1435 |
}); |
| 1436 |
} |
| 1437 |
|
| 1438 |
function wppm_sort_up_task_list(sort_by,order,page){ |
| 1439 |
jQuery('#wppm_task_container').show(); |
| 1440 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1441 |
var data = { |
| 1442 |
action: 'wppm_get_task_list', |
| 1443 |
sort_by:sort_by, |
| 1444 |
order:order, |
| 1445 |
page:page |
| 1446 |
}; |
| 1447 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1448 |
jQuery('#wppm_task_container').html(response); |
| 1449 |
}); |
| 1450 |
} |
| 1451 |
|
| 1452 |
function wppm_sort_up_project_list(sort_by,order){ |
| 1453 |
jQuery('#wppm_project_container').show(); |
| 1454 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1455 |
var data = { |
| 1456 |
action: 'wppm_get_project_list', |
| 1457 |
sort_by:sort_by, |
| 1458 |
order:order, |
| 1459 |
page: wppm_admin.page |
| 1460 |
}; |
| 1461 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1462 |
jQuery('#wppm_project_container').html(response); |
| 1463 |
}); |
| 1464 |
} |
| 1465 |
|
| 1466 |
function wppm_get_miscellaneous_settings(){ |
| 1467 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 1468 |
jQuery('#wppm_settings_miscellaneous').addClass('active'); |
| 1469 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 1470 |
var data = { |
| 1471 |
action: 'wppm_get_advanced_settings' |
| 1472 |
}; |
| 1473 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1474 |
jQuery('.wppm_setting_col2').html(response); |
| 1475 |
}); |
| 1476 |
} |
| 1477 |
|
| 1478 |
function wppm_get_appearance_settings(){ |
| 1479 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 1480 |
jQuery('#wppm_settings_appearance').addClass('active'); |
| 1481 |
var data = { |
| 1482 |
action: 'wppm_get_appearance_settings' |
| 1483 |
}; |
| 1484 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1485 |
jQuery('.wppm_setting_col2').html(response); |
| 1486 |
}); |
| 1487 |
} |
| 1488 |
|
| 1489 |
function wppm_get_coworker_permission_settings(){ |
| 1490 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 1491 |
jQuery('#wppm_settings_coworker').addClass('active'); |
| 1492 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 1493 |
var data = { |
| 1494 |
action: 'wppm_get_coworker_permission_settings' |
| 1495 |
}; |
| 1496 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1497 |
jQuery('.wppm_setting_col2').html(response); |
| 1498 |
}); |
| 1499 |
} |
| 1500 |
|
| 1501 |
function wppm_set_coworkers_permission_settings(){ |
| 1502 |
jQuery('.wppm_submit_wait').show(); |
| 1503 |
var dataform = new FormData(jQuery('#wppm_frm_coworkers_permission_settings')[0]); |
| 1504 |
jQuery.ajax({ |
| 1505 |
url: wppm_admin.ajax_url, |
| 1506 |
type: 'POST', |
| 1507 |
data: dataform, |
| 1508 |
processData: false, |
| 1509 |
contentType: false |
| 1510 |
}) |
| 1511 |
.done(function (response_str) { |
| 1512 |
var response = JSON.parse(response_str); |
| 1513 |
jQuery('.wppm_submit_wait').hide(); |
| 1514 |
if (response.sucess_status=='1') { |
| 1515 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1516 |
} |
| 1517 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1518 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1519 |
}); |
| 1520 |
} |
| 1521 |
|
| 1522 |
function wppm_get_rich_text_editor_settings(){ |
| 1523 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 1524 |
jQuery('#wppm_settings_rich_text_editor').addClass('active'); |
| 1525 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 1526 |
var data = { |
| 1527 |
action: 'wppm_get_rich_text_editor_settings' |
| 1528 |
}; |
| 1529 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1530 |
jQuery('.wppm_setting_col2').html(response); |
| 1531 |
}); |
| 1532 |
} |
| 1533 |
|
| 1534 |
function wppm_set_rich_text_editor_settings(){ |
| 1535 |
jQuery('.wppm_submit_wait').show(); |
| 1536 |
var dataform = new FormData(jQuery('#wppm_frm_rich_text_editor_settings')[0]); |
| 1537 |
jQuery.ajax({ |
| 1538 |
url: wppm_admin.ajax_url, |
| 1539 |
type: 'POST', |
| 1540 |
data: dataform, |
| 1541 |
processData: false, |
| 1542 |
contentType: false |
| 1543 |
}) |
| 1544 |
.done(function (response_str) { |
| 1545 |
var response = JSON.parse(response_str); |
| 1546 |
jQuery('.wppm_submit_wait').hide(); |
| 1547 |
if (response.sucess_status=='1') { |
| 1548 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1549 |
} |
| 1550 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1551 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1552 |
}); |
| 1553 |
} |
| 1554 |
|
| 1555 |
function wppm_get_ap_proj_list(current_tab_class) { |
| 1556 |
jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' ); |
| 1557 |
jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' ); |
| 1558 |
jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html); |
| 1559 |
var data = { action: 'wppm_get_ap_proj_list' , |
| 1560 |
current_tab:current_tab_class |
| 1561 |
}; |
| 1562 |
jQuery.post( |
| 1563 |
wppm_admin.ajax_url, |
| 1564 |
data, |
| 1565 |
function (response) { |
| 1566 |
jQuery( '.wppm-setting-section-body' ).html( response ); |
| 1567 |
} |
| 1568 |
); |
| 1569 |
} |
| 1570 |
|
| 1571 |
function wppm_get_ap_modal_popup(current_tab_class){ |
| 1572 |
jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' ); |
| 1573 |
jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' ); |
| 1574 |
jQuery('.wppm-setting-section-body').html(wppm_admin.loading_html); |
| 1575 |
var data = { action: 'wppm_get_ap_modal_popup' , |
| 1576 |
current_tab:current_tab_class }; |
| 1577 |
jQuery.post( |
| 1578 |
wppm_admin.ajax_url, |
| 1579 |
data, |
| 1580 |
function (response) { |
| 1581 |
jQuery( '.wppm-setting-section-body' ).html( response ); |
| 1582 |
} |
| 1583 |
); |
| 1584 |
} |
| 1585 |
|
| 1586 |
function wppm_get_ap_task_list(current_tab_class){ |
| 1587 |
jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' ); |
| 1588 |
jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' ); |
| 1589 |
jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html); |
| 1590 |
var data = { action: 'wppm_get_ap_task_list' , |
| 1591 |
current_tab:current_tab_class |
| 1592 |
}; |
| 1593 |
jQuery.post( |
| 1594 |
wppm_admin.ajax_url, |
| 1595 |
data, |
| 1596 |
function (response) { |
| 1597 |
jQuery( '.wppm-setting-section-body' ).html( response ); |
| 1598 |
} |
| 1599 |
); |
| 1600 |
} |
| 1601 |
|
| 1602 |
function wppm_get_ap_individual_proj(current_tab_class){ |
| 1603 |
jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' ); |
| 1604 |
jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' ); |
| 1605 |
jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html); |
| 1606 |
var data = { action: 'wppm_get_ap_individual_proj' , |
| 1607 |
current_tab:current_tab_class |
| 1608 |
}; |
| 1609 |
jQuery.post( |
| 1610 |
wppm_admin.ajax_url, |
| 1611 |
data, |
| 1612 |
function (response) { |
| 1613 |
jQuery( '.wppm-setting-section-body' ).html( response ); |
| 1614 |
} |
| 1615 |
); |
| 1616 |
} |
| 1617 |
|
| 1618 |
function wppm_get_ap_individual_task(current_tab_class){ |
| 1619 |
jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' ); |
| 1620 |
jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' ); |
| 1621 |
jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html); |
| 1622 |
var data = { action: 'wppm_get_ap_individual_task' , |
| 1623 |
current_tab:current_tab_class |
| 1624 |
}; |
| 1625 |
jQuery.post( |
| 1626 |
wppm_admin.ajax_url, |
| 1627 |
data, |
| 1628 |
function (response) { |
| 1629 |
jQuery( '.wppm-setting-section-body' ).html( response ); |
| 1630 |
} |
| 1631 |
); |
| 1632 |
} |
| 1633 |
|
| 1634 |
function wppm_get_ap_grid_view(current_tab_class){ |
| 1635 |
jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' ); |
| 1636 |
jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' ); |
| 1637 |
jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html); |
| 1638 |
var data = { action: 'wppm_get_ap_grid_view' , |
| 1639 |
current_tab:current_tab_class |
| 1640 |
}; |
| 1641 |
jQuery.post( |
| 1642 |
wppm_admin.ajax_url, |
| 1643 |
data, |
| 1644 |
function (response) { |
| 1645 |
jQuery( '.wppm-setting-section-body' ).html( response ); |
| 1646 |
} |
| 1647 |
); |
| 1648 |
} |
| 1649 |
|
| 1650 |
function wppm_get_ap_settings(current_tab_class){ |
| 1651 |
jQuery( '.wppm-setting-tab-container button' ).removeClass( 'active' ); |
| 1652 |
jQuery( '.wppm-setting-tab-container button.' + current_tab_class ).addClass( 'active' ); |
| 1653 |
jQuery( '.wppm-setting-section-body').html(wppm_admin.loading_html); |
| 1654 |
var data = { action: 'wppm_get_ap_settings' , |
| 1655 |
current_tab:current_tab_class |
| 1656 |
}; |
| 1657 |
jQuery.post( |
| 1658 |
wppm_admin.ajax_url, |
| 1659 |
data, |
| 1660 |
function (response) { |
| 1661 |
jQuery( '.wppm-setting-section-body' ).html( response ); |
| 1662 |
} |
| 1663 |
); |
| 1664 |
} |
| 1665 |
|
| 1666 |
function wppm_set_ap_settings(){ |
| 1667 |
var form = jQuery( '.wppm-frm-ap-settings' )[0]; |
| 1668 |
var dataform = new FormData( form ); |
| 1669 |
jQuery('.wppm_submit_wait').show(); |
| 1670 |
jQuery.ajax( |
| 1671 |
{ |
| 1672 |
url: wppm_admin.ajax_url, |
| 1673 |
type: 'POST', |
| 1674 |
data: dataform, |
| 1675 |
processData: false, |
| 1676 |
contentType: false |
| 1677 |
} |
| 1678 |
).done( |
| 1679 |
function (response_str) { |
| 1680 |
var response = JSON.parse(response_str); |
| 1681 |
jQuery('.wppm_submit_wait').hide(); |
| 1682 |
if (response.sucess_status=='1') { |
| 1683 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1684 |
} |
| 1685 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1686 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1687 |
} |
| 1688 |
); |
| 1689 |
} |
| 1690 |
|
| 1691 |
function wppm_set_ap_proj_list() { |
| 1692 |
var form = jQuery( '.wppm-frm-ap-pl' )[0]; |
| 1693 |
var dataform = new FormData( form ); |
| 1694 |
jQuery('.wppm_submit_wait').show(); |
| 1695 |
jQuery.ajax( |
| 1696 |
{ |
| 1697 |
url: wppm_admin.ajax_url, |
| 1698 |
type: 'POST', |
| 1699 |
data: dataform, |
| 1700 |
processData: false, |
| 1701 |
contentType: false |
| 1702 |
} |
| 1703 |
).done( |
| 1704 |
function (response_str) { |
| 1705 |
var response = JSON.parse(response_str); |
| 1706 |
jQuery('.wppm_submit_wait').hide(); |
| 1707 |
if (response.sucess_status=='1') { |
| 1708 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1709 |
} |
| 1710 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1711 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1712 |
} |
| 1713 |
); |
| 1714 |
} |
| 1715 |
|
| 1716 |
function wppm_set_ap_task_list(){ |
| 1717 |
var form = jQuery( '.wppm-frm-ap-tl' )[0]; |
| 1718 |
var dataform = new FormData( form ); |
| 1719 |
jQuery('.wppm_submit_wait').show(); |
| 1720 |
jQuery.ajax( |
| 1721 |
{ |
| 1722 |
url: wppm_admin.ajax_url, |
| 1723 |
type: 'POST', |
| 1724 |
data: dataform, |
| 1725 |
processData: false, |
| 1726 |
contentType: false |
| 1727 |
} |
| 1728 |
).done( |
| 1729 |
function (response_str) { |
| 1730 |
var response = JSON.parse(response_str); |
| 1731 |
jQuery('.wppm_submit_wait').hide(); |
| 1732 |
if (response.sucess_status=='1') { |
| 1733 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1734 |
} |
| 1735 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1736 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1737 |
} |
| 1738 |
); |
| 1739 |
} |
| 1740 |
|
| 1741 |
function wppm_set_ap_individual_proj(){ |
| 1742 |
var form = jQuery( '.wppm-frm-ap-individual_pl' )[0]; |
| 1743 |
var dataform = new FormData( form ); |
| 1744 |
jQuery('.wppm_submit_wait').show(); |
| 1745 |
jQuery.ajax( |
| 1746 |
{ |
| 1747 |
url: wppm_admin.ajax_url, |
| 1748 |
type: 'POST', |
| 1749 |
data: dataform, |
| 1750 |
processData: false, |
| 1751 |
contentType: false |
| 1752 |
} |
| 1753 |
).done( |
| 1754 |
function (response_str) { |
| 1755 |
var response = JSON.parse(response_str); |
| 1756 |
jQuery('.wppm_submit_wait').hide(); |
| 1757 |
if (response.sucess_status=='1') { |
| 1758 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1759 |
} |
| 1760 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1761 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1762 |
} |
| 1763 |
); |
| 1764 |
} |
| 1765 |
|
| 1766 |
function wppm_set_ap_individual_task(){ |
| 1767 |
var form = jQuery( '.wppm-frm-ap-individual_tl' )[0]; |
| 1768 |
var dataform = new FormData( form ); |
| 1769 |
jQuery('.wppm_submit_wait').show(); |
| 1770 |
jQuery.ajax( |
| 1771 |
{ |
| 1772 |
url: wppm_admin.ajax_url, |
| 1773 |
type: 'POST', |
| 1774 |
data: dataform, |
| 1775 |
processData: false, |
| 1776 |
contentType: false |
| 1777 |
} |
| 1778 |
).done( |
| 1779 |
function (response_str) { |
| 1780 |
var response = JSON.parse(response_str); |
| 1781 |
jQuery('.wppm_submit_wait').hide(); |
| 1782 |
if (response.sucess_status=='1') { |
| 1783 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1784 |
} |
| 1785 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1786 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1787 |
} |
| 1788 |
); |
| 1789 |
} |
| 1790 |
|
| 1791 |
function wppm_set_ap_modal_popup(){ |
| 1792 |
var form = jQuery( '.wppm-frm-ap-modal_popup' )[0]; |
| 1793 |
var dataform = new FormData( form ); |
| 1794 |
jQuery('.wppm_submit_wait').show(); |
| 1795 |
jQuery.ajax( |
| 1796 |
{ |
| 1797 |
url: wppm_admin.ajax_url, |
| 1798 |
type: 'POST', |
| 1799 |
data: dataform, |
| 1800 |
processData: false, |
| 1801 |
contentType: false |
| 1802 |
} |
| 1803 |
).done( |
| 1804 |
function (response_str) { |
| 1805 |
var response = JSON.parse(response_str); |
| 1806 |
jQuery('.wppm_submit_wait').hide(); |
| 1807 |
if (response.sucess_status=='1') { |
| 1808 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1809 |
} |
| 1810 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1811 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1812 |
} |
| 1813 |
); |
| 1814 |
} |
| 1815 |
|
| 1816 |
function wppm_set_ap_grid_view(){ |
| 1817 |
var form = jQuery( '.wppm-frm-ap-grid_view' )[0]; |
| 1818 |
var dataform = new FormData( form ); |
| 1819 |
jQuery('.wppm_submit_wait').show(); |
| 1820 |
jQuery.ajax( |
| 1821 |
{ |
| 1822 |
url: wppm_admin.ajax_url, |
| 1823 |
type: 'POST', |
| 1824 |
data: dataform, |
| 1825 |
processData: false, |
| 1826 |
contentType: false |
| 1827 |
} |
| 1828 |
).done( |
| 1829 |
function (response_str) { |
| 1830 |
var response = JSON.parse(response_str); |
| 1831 |
jQuery('.wppm_submit_wait').hide(); |
| 1832 |
if (response.sucess_status=='1') { |
| 1833 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1834 |
} |
| 1835 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1836 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1837 |
} |
| 1838 |
); |
| 1839 |
} |
| 1840 |
|
| 1841 |
function wppm_set_advanced_settings(){ |
| 1842 |
jQuery('.wppm_submit_wait').show(); |
| 1843 |
var dataform = new FormData(jQuery('#wppm_frm_advanced_settings')[0]); |
| 1844 |
jQuery.ajax({ |
| 1845 |
url: wppm_admin.ajax_url, |
| 1846 |
type: 'POST', |
| 1847 |
data: dataform, |
| 1848 |
processData: false, |
| 1849 |
contentType: false |
| 1850 |
}) |
| 1851 |
.done(function (response_str) { |
| 1852 |
var response = JSON.parse(response_str); |
| 1853 |
jQuery('.wppm_submit_wait').hide(); |
| 1854 |
if (response.sucess_status=='1') { |
| 1855 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 1856 |
} |
| 1857 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 1858 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 1859 |
}); |
| 1860 |
} |
| 1861 |
|
| 1862 |
function wppm_get_project_visibility(id){ |
| 1863 |
wppm_modal_open('Change Visibility'); |
| 1864 |
var data = { |
| 1865 |
action: 'wppm_get_project_visibility', |
| 1866 |
id: id |
| 1867 |
} |
| 1868 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 1869 |
var response = JSON.parse(response_str); |
| 1870 |
jQuery('#wppm_popup_body').html(response.body); |
| 1871 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 1872 |
}); |
| 1873 |
} |
| 1874 |
|
| 1875 |
function wppm_select_project_visibility(proj_id){ |
| 1876 |
if(jQuery('input[name="wppm_project_visibility_option"]').is(':checked')){ |
| 1877 |
var project_visibility = jQuery('input[name="wppm_project_visibility_option"]:checked').val(); |
| 1878 |
}else{ |
| 1879 |
var project_visibility = 0; |
| 1880 |
} |
| 1881 |
var data = { |
| 1882 |
action: 'wppm_change_project_visibility', |
| 1883 |
project_id:proj_id, |
| 1884 |
project_visibility:project_visibility, |
| 1885 |
_ajax_nonce:jQuery('#wppm_proj_visibility_ajax_nonce').val() |
| 1886 |
}; |
| 1887 |
jQuery.post(wppm_admin.ajax_url, data, function() { |
| 1888 |
}); |
| 1889 |
} |
| 1890 |
|
| 1891 |
function wppm_apply_project_filter(is_archieved){ |
| 1892 |
wppm_project_filter = jQuery('#wppm_project_filter').find(":selected").val(); |
| 1893 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 1894 |
var data = { |
| 1895 |
action: 'wppm_get_project_list', |
| 1896 |
wppm_project_filter:wppm_project_filter, |
| 1897 |
page:wppm_admin.page, |
| 1898 |
is_archieved:is_archieved |
| 1899 |
}; |
| 1900 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1901 |
jQuery('#wppm_project_container').html(response); |
| 1902 |
}); |
| 1903 |
} |
| 1904 |
|
| 1905 |
function getWppmCookie(name) { |
| 1906 |
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); |
| 1907 |
if (match) return decodeURIComponent(match[2]); |
| 1908 |
return null; |
| 1909 |
} |
| 1910 |
|
| 1911 |
function wppm_apply_task_filter(page = 1, listFilters = null) { |
| 1912 |
// 🔥 use passed filters OR read from UI |
| 1913 |
if (!listFilters) { |
| 1914 |
listFilters = { |
| 1915 |
created_by: jQuery("#tb-created-by").val() || [], |
| 1916 |
assigned: jQuery("#tb-assigned").val() || [], |
| 1917 |
priority: jQuery("#tb-priority").val() || [], |
| 1918 |
start_date: jQuery("#tb-start-date").val() || "", |
| 1919 |
end_date: jQuery("#tb-end-date").val() || "" |
| 1920 |
}; |
| 1921 |
} |
| 1922 |
// 🔥 get main filter |
| 1923 |
let wppm_task_filter = jQuery('#wppm_task_filter').val(); |
| 1924 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1925 |
jQuery.post(wppm_admin.ajax_url, { |
| 1926 |
action: 'wppm_get_task_list', |
| 1927 |
wppm_task_filter: wppm_task_filter, |
| 1928 |
page: page, |
| 1929 |
listFilters: JSON.stringify(listFilters) // � |
| 1930 |
ALWAYS stringify |
| 1931 |
}, function (response) { |
| 1932 |
jQuery('#wppm_task_container').html(response); |
| 1933 |
// 🔥 save cookie |
| 1934 |
setListFilterCookie(listFilters); |
| 1935 |
// 🔥 sync UI |
| 1936 |
setTimeout(function () { |
| 1937 |
syncUIWithFilters(listFilters); |
| 1938 |
renderActiveFilters(listFilters); |
| 1939 |
}, 100); |
| 1940 |
|
| 1941 |
}); |
| 1942 |
} |
| 1943 |
|
| 1944 |
function wppm_tl_reset_filter(page){ |
| 1945 |
var url = new URL(window.location.href); |
| 1946 |
if (url.searchParams.has('wppm_task_filter')) { |
| 1947 |
url.searchParams.delete('wppm_task_filter'); |
| 1948 |
window.location.href = url.toString(); |
| 1949 |
return false; |
| 1950 |
} |
| 1951 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1952 |
var data = { |
| 1953 |
action: 'wppm_get_task_list', |
| 1954 |
wppm_task_filter:'all', |
| 1955 |
task_search:"", |
| 1956 |
sort_by:"task_name", |
| 1957 |
order:"ASC", |
| 1958 |
wppm_proj_filter:0, |
| 1959 |
page:page |
| 1960 |
}; |
| 1961 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 1962 |
jQuery('#wppm_task_container').html(response); |
| 1963 |
}); |
| 1964 |
// � |
| 1965 |
close popup |
| 1966 |
jQuery("#tb-advanced-panel").removeClass("tb-open"); |
| 1967 |
jQuery("#tb-backdrop").removeClass("active"); |
| 1968 |
|
| 1969 |
// � |
| 1970 |
clear inputs |
| 1971 |
jQuery('#tb-advanced-panel input').val(''); |
| 1972 |
jQuery('#tb-advanced-panel select').val([]); |
| 1973 |
|
| 1974 |
// � |
| 1975 |
clear chips |
| 1976 |
jQuery("#tb-active-filters").html(''); |
| 1977 |
resetFilters('list'); |
| 1978 |
} |
| 1979 |
|
| 1980 |
function wppm_apply_task_filter_grid_view(page,id,filters){ |
| 1981 |
wppm_task_filter = jQuery('#wppm_task_filter').find(":selected").val(); |
| 1982 |
if (!filters) { |
| 1983 |
filters = { |
| 1984 |
created_by: jQuery("#tb-created-by").val() || [], |
| 1985 |
assigned: jQuery("#tb-assigned").val() || [], |
| 1986 |
priority: jQuery("#tb-priority").val() || [], |
| 1987 |
start_date: jQuery("#tb-start-date").val() || "", |
| 1988 |
end_date: jQuery("#tb-end-date").val() || "" |
| 1989 |
}; |
| 1990 |
} |
| 1991 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 1992 |
var data = { |
| 1993 |
action: 'wppm_view_project_tasks', |
| 1994 |
wppm_task_filter:wppm_task_filter, |
| 1995 |
page:page, |
| 1996 |
id:id, |
| 1997 |
filters: JSON.stringify(filters) |
| 1998 |
}; |
| 1999 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2000 |
jQuery('#wppm_task_container').html(response); |
| 2001 |
// 🔥 save cookie |
| 2002 |
setFilterCookie(filters); |
| 2003 |
|
| 2004 |
// 🔥 sync UI |
| 2005 |
setTimeout(function () { |
| 2006 |
syncUIWithFilters(filters); |
| 2007 |
renderActiveFilters(filters); |
| 2008 |
}, 100); |
| 2009 |
}); |
| 2010 |
} |
| 2011 |
|
| 2012 |
function wppm_tl_reset_grid_view_filter(page,id){ |
| 2013 |
var url = new URL(window.location.href); |
| 2014 |
if (url.searchParams.has('wppm_task_filter')) { |
| 2015 |
url.searchParams.delete('wppm_task_filter'); |
| 2016 |
window.location.href = url.toString(); |
| 2017 |
return false; |
| 2018 |
} |
| 2019 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 2020 |
var data = { |
| 2021 |
action: 'wppm_view_project_tasks', |
| 2022 |
wppm_task_filter:'all', |
| 2023 |
task_search:"", |
| 2024 |
sort_by:"task_name", |
| 2025 |
order:"ASC", |
| 2026 |
wppm_proj_filter:"0", |
| 2027 |
page:page, |
| 2028 |
id:id |
| 2029 |
}; |
| 2030 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2031 |
jQuery('#wppm_task_container').html(response); |
| 2032 |
}); |
| 2033 |
// � |
| 2034 |
close popup |
| 2035 |
jQuery("#tb-advanced-panel").removeClass("tb-open"); |
| 2036 |
jQuery("#tb-backdrop").removeClass("active"); |
| 2037 |
|
| 2038 |
// � |
| 2039 |
clear inputs |
| 2040 |
jQuery('#tb-advanced-panel input').val(''); |
| 2041 |
jQuery('#tb-advanced-panel select').val([]); |
| 2042 |
|
| 2043 |
// � |
| 2044 |
clear chips |
| 2045 |
jQuery("#tb-active-filters").html(''); |
| 2046 |
window.localStorage.removeItem('wppm_task_filter'); |
| 2047 |
if(id!=0){ |
| 2048 |
resetFilters('kanban'); |
| 2049 |
}else{ |
| 2050 |
resetFilters('grid'); |
| 2051 |
} |
| 2052 |
} |
| 2053 |
function wppm_pl_reset_filter(is_archieved) { |
| 2054 |
var url = new URL(window.location.href); |
| 2055 |
if (url.searchParams.has('wppm_project_filter')) { |
| 2056 |
url.searchParams.delete('wppm_project_filter'); |
| 2057 |
window.location.href = url.toString(); |
| 2058 |
return false; |
| 2059 |
} |
| 2060 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2061 |
var data = { |
| 2062 |
action: 'wppm_get_project_list', |
| 2063 |
wppm_project_filter: 'all', |
| 2064 |
project_search: '', |
| 2065 |
sort_by: 'project_name', |
| 2066 |
order: 'ASC', |
| 2067 |
page: wppm_admin.page, |
| 2068 |
is_archieved: is_archieved |
| 2069 |
}; |
| 2070 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2071 |
jQuery('#wppm_project_container').html(response); |
| 2072 |
}); |
| 2073 |
} |
| 2074 |
|
| 2075 |
function wppm_tasks_by_select_project(page){ |
| 2076 |
wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val(); |
| 2077 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 2078 |
var data = { |
| 2079 |
action: 'wppm_get_task_list', |
| 2080 |
wppm_proj_filter:wppm_proj_filter, |
| 2081 |
page:page |
| 2082 |
}; |
| 2083 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2084 |
jQuery('#wppm_task_container').html(response); |
| 2085 |
}); |
| 2086 |
} |
| 2087 |
|
| 2088 |
function wppm_tasks_by_select_project_grid_view(page){ |
| 2089 |
wppm_proj_filter = jQuery('#wppm_task_list_proj_filter').find(":selected").val(); |
| 2090 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 2091 |
var data = { |
| 2092 |
action: 'wppm_view_project_tasks', |
| 2093 |
wppm_proj_filter:wppm_proj_filter, |
| 2094 |
page:page |
| 2095 |
}; |
| 2096 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2097 |
jQuery('#wppm_task_container').html(response); |
| 2098 |
}); |
| 2099 |
} |
| 2100 |
|
| 2101 |
function wppm_reset_ap_proj_list(){ |
| 2102 |
jQuery( "#wppm_reset_ap_proj_list_btn" ).text( wppm_admin.please_wait ); |
| 2103 |
var _ajax_nonce = jQuery("#wppm_reset_ap_proj_list_nonce").val(); |
| 2104 |
var data = { action: 'wppm_reset_ap_proj_list',_ajax_nonce }; |
| 2105 |
jQuery.post( |
| 2106 |
wppm_admin.ajax_url, |
| 2107 |
data, |
| 2108 |
function () { |
| 2109 |
wppm_get_ap_proj_list('project-list'); |
| 2110 |
} |
| 2111 |
); |
| 2112 |
} |
| 2113 |
|
| 2114 |
function wppm_reset_ap_task_list(){ |
| 2115 |
jQuery( "#wppm_reset_ap_task_list_btn" ).text( wppm_admin.please_wait ); |
| 2116 |
var _ajax_nonce = jQuery("#wppm_reset_ap_task_list_ajax_nonce").val(); |
| 2117 |
var data = { action: 'wppm_reset_ap_task_list',_ajax_nonce }; |
| 2118 |
jQuery.post( |
| 2119 |
wppm_admin.ajax_url, |
| 2120 |
data, |
| 2121 |
function () { |
| 2122 |
wppm_get_ap_task_list('task-list'); |
| 2123 |
} |
| 2124 |
); |
| 2125 |
} |
| 2126 |
|
| 2127 |
function wppm_reset_ap_individual_proj(){ |
| 2128 |
jQuery( "#wppm_reset_ap_individual_proj_btn" ).text( wppm_admin.please_wait ); |
| 2129 |
var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_proj_ajax_nonce").val(); |
| 2130 |
var data = { action: 'wppm_reset_ap_individual_proj', |
| 2131 |
_ajax_nonce, }; |
| 2132 |
jQuery.post( |
| 2133 |
wppm_admin.ajax_url, |
| 2134 |
data, |
| 2135 |
function () { |
| 2136 |
wppm_get_ap_individual_proj('individual-project'); |
| 2137 |
} |
| 2138 |
); |
| 2139 |
} |
| 2140 |
|
| 2141 |
function wppm_reset_ap_individual_task(){ |
| 2142 |
jQuery( "#wppm_reset_ap_individual_task_btn" ).text( wppm_admin.please_wait ); |
| 2143 |
var _ajax_nonce = jQuery( "#wppm_reset_ap_individual_task_ajax_nonce" ).val(); |
| 2144 |
var data = { action: 'wppm_reset_ap_individual_task',_ajax_nonce }; |
| 2145 |
jQuery.post( |
| 2146 |
wppm_admin.ajax_url, |
| 2147 |
data, |
| 2148 |
function () { |
| 2149 |
wppm_get_ap_individual_task('individual-task'); |
| 2150 |
} |
| 2151 |
); |
| 2152 |
} |
| 2153 |
|
| 2154 |
function wppm_reset_ap_modal_popup(){ |
| 2155 |
jQuery( "#wppm_reset_ap_modal_popup_btn" ).text( wppm_admin.please_wait ); |
| 2156 |
var _ajax_nonce = jQuery( "#wppm_reset_ap_modal_popup_nonce" ).val(); |
| 2157 |
var data = { action: 'wppm_reset_ap_modal_popup',_ajax_nonce }; |
| 2158 |
jQuery.post( |
| 2159 |
wppm_admin.ajax_url, |
| 2160 |
data, |
| 2161 |
function () { |
| 2162 |
wppm_get_ap_modal_popup('modal-popup'); |
| 2163 |
} |
| 2164 |
); |
| 2165 |
} |
| 2166 |
|
| 2167 |
function wppm_reset_ap_grid_view(){ |
| 2168 |
jQuery( "#wppm_reset_ap_grid_view_btn" ).text( wppm_admin.please_wait ); |
| 2169 |
var wppm_reset_grid_ajax_nonce = jQuery( "#wppm_reset_ap_grid_view_ajax_nonce" ).val(); |
| 2170 |
var data = { |
| 2171 |
action: 'wppm_reset_ap_grid_view', |
| 2172 |
wppm_reset_grid_ajax_nonce:wppm_reset_grid_ajax_nonce |
| 2173 |
}; |
| 2174 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2175 |
wppm_get_ap_grid_view('grid-view'); |
| 2176 |
}); |
| 2177 |
} |
| 2178 |
|
| 2179 |
function wppm_reset_ap_settings(){ |
| 2180 |
jQuery( "#wppm_reset_ap_settings_btn" ).text( wppm_admin.please_wait ); |
| 2181 |
var _ajax_nonce = jQuery("#wppm_reset_ap_settings_nonce").val(); |
| 2182 |
var data = { action: 'wppm_reset_ap_settings',_ajax_nonce }; |
| 2183 |
jQuery.post( |
| 2184 |
wppm_admin.ajax_url, |
| 2185 |
data, |
| 2186 |
function () { |
| 2187 |
wppm_get_ap_settings('settings'); |
| 2188 |
} |
| 2189 |
); |
| 2190 |
} |
| 2191 |
/** |
| 2192 |
* Bulk selector change |
| 2193 |
*/ |
| 2194 |
function wppm_bulk_select_change() { |
| 2195 |
jQuery("#wppm-bulk-actions-btn").show(); |
| 2196 |
var checked = jQuery(".wppm-bulk-selector").is(":checked"); |
| 2197 |
jQuery(".wppm-bulk-select").prop("checked", checked); |
| 2198 |
if(!checked){ |
| 2199 |
jQuery("#wppm-bulk-actions-btn").hide(); |
| 2200 |
} |
| 2201 |
} |
| 2202 |
|
| 2203 |
function wppm_task_bulk_select_change() { |
| 2204 |
jQuery("#wppm-task-bulk-actions-btn").show(); |
| 2205 |
var checked = jQuery(".wppm-bulk-selector").is(":checked"); |
| 2206 |
jQuery(".wppm-task-bulk-select").prop("checked", checked); |
| 2207 |
if(!checked){ |
| 2208 |
jQuery("#wppm-bulk-actions-btn").hide(); |
| 2209 |
} |
| 2210 |
} |
| 2211 |
|
| 2212 |
function wppm_bulk_change_status(nonce){ |
| 2213 |
var items = jQuery(".wppm-bulk-select:checked"); |
| 2214 |
var checked = items.length === 0 ? false : true; |
| 2215 |
jQuery(".wppm-bulk-selector").prop("checked", checked); |
| 2216 |
if (items.length != 0) { |
| 2217 |
var proj_ids = jQuery(".wppm-bulk-select:checked") |
| 2218 |
.map(function () { |
| 2219 |
return this.value; |
| 2220 |
}) |
| 2221 |
.get(); |
| 2222 |
wppm_modal_open('Change Status'); |
| 2223 |
var data = { |
| 2224 |
action: "wppm_get_bulk_change_proj_status", |
| 2225 |
proj_ids, |
| 2226 |
_ajax_nonce: nonce, |
| 2227 |
}; |
| 2228 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 2229 |
var response = JSON.parse(response_str); |
| 2230 |
jQuery('#wppm_popup_body').html(response.body); |
| 2231 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 2232 |
}); |
| 2233 |
} |
| 2234 |
} |
| 2235 |
|
| 2236 |
function wppm_set_bulk_change_project_status(){ |
| 2237 |
var dataform = new FormData(jQuery('#frm_get_bulk_project_change_status')[0]); |
| 2238 |
wppm_modal_close(); |
| 2239 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2240 |
jQuery.ajax({ |
| 2241 |
url: wppm_admin.ajax_url, |
| 2242 |
type: 'POST', |
| 2243 |
data: dataform, |
| 2244 |
processData: false, |
| 2245 |
contentType: false |
| 2246 |
}) |
| 2247 |
.done(function (response_str) { |
| 2248 |
wppm_get_project_list(); |
| 2249 |
}); |
| 2250 |
} |
| 2251 |
|
| 2252 |
function wppm_bulk_change_category(nonce){ |
| 2253 |
var items = jQuery(".wppm-bulk-select:checked"); |
| 2254 |
var checked = items.length === 0 ? false : true; |
| 2255 |
jQuery(".wppm-bulk-selector").prop("checked", checked); |
| 2256 |
if (items.length != 0) { |
| 2257 |
var proj_ids = jQuery(".wppm-bulk-select:checked") |
| 2258 |
.map(function () { |
| 2259 |
return this.value; |
| 2260 |
}) |
| 2261 |
.get(); |
| 2262 |
wppm_modal_open('Change Category'); |
| 2263 |
var data = { |
| 2264 |
action: "wppm_get_bulk_change_proj_cat", |
| 2265 |
proj_ids, |
| 2266 |
_ajax_nonce: nonce, |
| 2267 |
}; |
| 2268 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 2269 |
var response = JSON.parse(response_str); |
| 2270 |
jQuery('#wppm_popup_body').html(response.body); |
| 2271 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 2272 |
}); |
| 2273 |
} |
| 2274 |
} |
| 2275 |
|
| 2276 |
function wppm_set_bulk_change_project_category(){ |
| 2277 |
var dataform = new FormData(jQuery('#frm_get_bulk_project_change_category')[0]); |
| 2278 |
wppm_modal_close(); |
| 2279 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2280 |
jQuery.ajax({ |
| 2281 |
url: wppm_admin.ajax_url, |
| 2282 |
type: 'POST', |
| 2283 |
data: dataform, |
| 2284 |
processData: false, |
| 2285 |
contentType: false |
| 2286 |
}) |
| 2287 |
.done(function (response_str) { |
| 2288 |
wppm_get_project_list(); |
| 2289 |
}); |
| 2290 |
} |
| 2291 |
|
| 2292 |
function wppm_bulk_assign_users(nonce){ |
| 2293 |
var items = jQuery(".wppm-bulk-select:checked"); |
| 2294 |
var checked = items.length === 0 ? false : true; |
| 2295 |
jQuery(".wppm-bulk-selector").prop("checked", checked); |
| 2296 |
if (items.length != 0) { |
| 2297 |
var proj_ids = jQuery(".wppm-bulk-select:checked") |
| 2298 |
.map(function () { |
| 2299 |
return this.value; |
| 2300 |
}) |
| 2301 |
.get(); |
| 2302 |
wppm_modal_open('Assign Co-workers'); |
| 2303 |
var data = { |
| 2304 |
action: "wppm_get_bulk_assign_users", |
| 2305 |
proj_ids, |
| 2306 |
_ajax_nonce: nonce, |
| 2307 |
}; |
| 2308 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 2309 |
var response = JSON.parse(response_str); |
| 2310 |
jQuery('#wppm_popup_body').html(response.body); |
| 2311 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 2312 |
}); |
| 2313 |
} |
| 2314 |
} |
| 2315 |
|
| 2316 |
function wppm_set_bulk_project_users(){ |
| 2317 |
var dataform = new FormData(jQuery('#frm_get_bulk_project_users')[0]); |
| 2318 |
wppm_modal_close(); |
| 2319 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2320 |
jQuery.ajax({ |
| 2321 |
url: wppm_admin.ajax_url, |
| 2322 |
type: 'POST', |
| 2323 |
data: dataform, |
| 2324 |
processData: false, |
| 2325 |
contentType: false |
| 2326 |
}) |
| 2327 |
.done(function (response_str) { |
| 2328 |
wppm_get_project_list(); |
| 2329 |
}); |
| 2330 |
} |
| 2331 |
|
| 2332 |
function wppm_bulk_delete_project(nonce){ |
| 2333 |
var items = jQuery(".wppm-bulk-select:checked"); |
| 2334 |
var checked = items.length === 0 ? false : true; |
| 2335 |
jQuery(".wppm-bulk-selector").prop("checked", checked); |
| 2336 |
if (items.length != 0) { |
| 2337 |
var proj_ids = jQuery(".wppm-bulk-select:checked") |
| 2338 |
.map(function () { |
| 2339 |
return this.value; |
| 2340 |
}) |
| 2341 |
.get(); |
| 2342 |
wppm_modal_open('Delete Project'); |
| 2343 |
var data = { |
| 2344 |
action: "wppm_get_bulk_delete_project", |
| 2345 |
proj_ids, |
| 2346 |
_ajax_nonce: nonce, |
| 2347 |
}; |
| 2348 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 2349 |
var response = JSON.parse(response_str); |
| 2350 |
jQuery('#wppm_popup_body').html(response.body); |
| 2351 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 2352 |
}); |
| 2353 |
} |
| 2354 |
} |
| 2355 |
|
| 2356 |
function wppm_set_delete_bulk_projects(){ |
| 2357 |
var dataform = new FormData(jQuery('#frm_delete_bulk_project')[0]); |
| 2358 |
wppm_modal_close(); |
| 2359 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2360 |
jQuery.ajax({ |
| 2361 |
url: wppm_admin.ajax_url, |
| 2362 |
type: 'POST', |
| 2363 |
data: dataform, |
| 2364 |
processData: false, |
| 2365 |
contentType: false |
| 2366 |
}) |
| 2367 |
.done(function (response_str) { |
| 2368 |
wppm_get_project_list(); |
| 2369 |
}); |
| 2370 |
} |
| 2371 |
|
| 2372 |
function wppm_bulk_change_task_status(nonce){ |
| 2373 |
var items = jQuery(".wppm-task-bulk-select:checked"); |
| 2374 |
var checked = items.length === 0 ? false : true; |
| 2375 |
jQuery(".wppm-bulk-selector").prop("checked", checked); |
| 2376 |
if (items.length != 0) { |
| 2377 |
var task_ids = jQuery(".wppm-task-bulk-select:checked") |
| 2378 |
.map(function () { |
| 2379 |
return this.value; |
| 2380 |
}) |
| 2381 |
.get(); |
| 2382 |
wppm_task_modal_open('Change Task Status'); |
| 2383 |
var data = { |
| 2384 |
action: "wppm_get_bulk_change_task_status", |
| 2385 |
task_ids, |
| 2386 |
_ajax_nonce: nonce, |
| 2387 |
}; |
| 2388 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 2389 |
var response = JSON.parse(response_str); |
| 2390 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 2391 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 2392 |
}); |
| 2393 |
} |
| 2394 |
} |
| 2395 |
|
| 2396 |
function wppm_set_bulk_change_task_priority(){ |
| 2397 |
var dataform = new FormData(jQuery('#frm_get_bulk_task_change_priority')[0]); |
| 2398 |
wppm_task_modal_close(); |
| 2399 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 2400 |
jQuery.ajax({ |
| 2401 |
url: wppm_admin.ajax_url, |
| 2402 |
type: 'POST', |
| 2403 |
data: dataform, |
| 2404 |
processData: false, |
| 2405 |
contentType: false |
| 2406 |
}) |
| 2407 |
.done(function (response_str) { |
| 2408 |
wppm_get_task_list(); |
| 2409 |
}); |
| 2410 |
} |
| 2411 |
|
| 2412 |
function wppm_set_bulk_change_task_status(){ |
| 2413 |
var dataform = new FormData(jQuery('#frm_get_bulk_task_change_status')[0]); |
| 2414 |
wppm_task_modal_close(); |
| 2415 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 2416 |
jQuery.ajax({ |
| 2417 |
url: wppm_admin.ajax_url, |
| 2418 |
type: 'POST', |
| 2419 |
data: dataform, |
| 2420 |
processData: false, |
| 2421 |
contentType: false |
| 2422 |
}) |
| 2423 |
.done(function (response_str) { |
| 2424 |
wppm_get_task_list(); |
| 2425 |
}); |
| 2426 |
} |
| 2427 |
|
| 2428 |
function wppm_bulk_change_task_priority(nonce){ |
| 2429 |
var items = jQuery(".wppm-task-bulk-select:checked"); |
| 2430 |
var checked = items.length === 0 ? false : true; |
| 2431 |
jQuery(".wppm-bulk-selector").prop("checked", checked); |
| 2432 |
if (items.length != 0) { |
| 2433 |
var task_ids = jQuery(".wppm-task-bulk-select:checked") |
| 2434 |
.map(function () { |
| 2435 |
return this.value; |
| 2436 |
}) |
| 2437 |
.get(); |
| 2438 |
wppm_task_modal_open('Change Task Priority'); |
| 2439 |
var data = { |
| 2440 |
action: "wppm_get_bulk_change_task_priority", |
| 2441 |
task_ids, |
| 2442 |
_ajax_nonce: nonce |
| 2443 |
}; |
| 2444 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 2445 |
var response = JSON.parse(response_str); |
| 2446 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 2447 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 2448 |
}); |
| 2449 |
} |
| 2450 |
} |
| 2451 |
|
| 2452 |
function wppm_bulk_delete_task(nonce){ |
| 2453 |
var items = jQuery(".wppm-task-bulk-select:checked"); |
| 2454 |
var checked = items.length === 0 ? false : true; |
| 2455 |
jQuery(".wppm-bulk-selector").prop("checked", checked); |
| 2456 |
if (items.length != 0) { |
| 2457 |
var task_ids = jQuery(".wppm-task-bulk-select:checked") |
| 2458 |
.map(function () { |
| 2459 |
return this.value; |
| 2460 |
}) |
| 2461 |
.get(); |
| 2462 |
wppm_task_modal_open('Delete Task'); |
| 2463 |
var data = { |
| 2464 |
action: "wppm_get_bulk_delete_task", |
| 2465 |
task_ids, |
| 2466 |
_ajax_nonce: nonce, |
| 2467 |
}; |
| 2468 |
jQuery.post(wppm_admin.ajax_url, data, function(response_str) { |
| 2469 |
var response = JSON.parse(response_str); |
| 2470 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 2471 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 2472 |
}); |
| 2473 |
} |
| 2474 |
} |
| 2475 |
|
| 2476 |
function wppm_set_delete_bulk_tasks(){ |
| 2477 |
var dataform = new FormData(jQuery('#frm_delete_bulk_tasks')[0]); |
| 2478 |
wppm_task_modal_close(); |
| 2479 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 2480 |
jQuery.ajax({ |
| 2481 |
url: wppm_admin.ajax_url, |
| 2482 |
type: 'POST', |
| 2483 |
data: dataform, |
| 2484 |
processData: false, |
| 2485 |
contentType: false |
| 2486 |
}) |
| 2487 |
.done(function (response_str) { |
| 2488 |
wppm_get_task_list(); |
| 2489 |
}); |
| 2490 |
} |
| 2491 |
|
| 2492 |
function wppm_print_task(id){ |
| 2493 |
jQuery('#wppmprint_menu').css('display', 'flex'); |
| 2494 |
} |
| 2495 |
|
| 2496 |
function wppm_open_pdf(id){ |
| 2497 |
window.open(wppm_admin.ajax_url + "?action=wppm_get_task_pdf&id=" + id, "_blank"); |
| 2498 |
} |
| 2499 |
|
| 2500 |
function wppm_download_pdf(id){ |
| 2501 |
window.open(wppm_admin.ajax_url + "?action=wppm_download_pdf&id=" + id, "_blank"); |
| 2502 |
} |
| 2503 |
|
| 2504 |
function wppm_archive_task(id,is_archived,project_id){ |
| 2505 |
if (!confirm(wppm_admin.confirm)) { |
| 2506 |
return; |
| 2507 |
} else { |
| 2508 |
var data = { |
| 2509 |
action: 'wppm_archive_task', |
| 2510 |
id: id, |
| 2511 |
is_archived: is_archived, |
| 2512 |
project_id: project_id, |
| 2513 |
}; |
| 2514 |
jQuery.post(wppm_admin.ajax_url, data, function() { |
| 2515 |
wppm_open_task(id,project_id); |
| 2516 |
}); |
| 2517 |
} |
| 2518 |
} |
| 2519 |
|
| 2520 |
function wppm_archive_project(project_id,is_archived){ |
| 2521 |
if (!confirm(wppm_admin.confirm)) { |
| 2522 |
return; |
| 2523 |
} else { |
| 2524 |
var data = { |
| 2525 |
action: 'wppm_archive_project', |
| 2526 |
project_id: project_id, |
| 2527 |
is_archived: is_archived, |
| 2528 |
}; |
| 2529 |
jQuery.post(wppm_admin.ajax_url, data, function() { |
| 2530 |
wppm_open_project(project_id); |
| 2531 |
}); |
| 2532 |
} |
| 2533 |
} |
| 2534 |
|
| 2535 |
function wppm_get_print_task_settings(){ |
| 2536 |
jQuery('.wppm_setting_pills li').removeClass('active'); |
| 2537 |
jQuery('#wppm_settings_print_task').addClass('active'); |
| 2538 |
jQuery('.wppm_setting_col2').html(wppm_admin.loading_html); |
| 2539 |
var data = { |
| 2540 |
action: 'wppm_get_print_task_settings' |
| 2541 |
}; |
| 2542 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2543 |
jQuery('.wppm_setting_col2').html(response); |
| 2544 |
}); |
| 2545 |
} |
| 2546 |
|
| 2547 |
function wppm_set_print_task_settings(){ |
| 2548 |
jQuery('.wppm_submit_wait').show(); |
| 2549 |
var dataform = new FormData(jQuery('#wppm_print_task_settings')[0]); |
| 2550 |
jQuery.ajax({ |
| 2551 |
url: wppm_admin.ajax_url, |
| 2552 |
type: 'POST', |
| 2553 |
data: dataform, |
| 2554 |
processData: false, |
| 2555 |
contentType: false |
| 2556 |
}) |
| 2557 |
.done(function (response_str) { |
| 2558 |
var response = JSON.parse(response_str); |
| 2559 |
jQuery('.wppm_submit_wait').hide(); |
| 2560 |
if (response.sucess_status=='1') { |
| 2561 |
jQuery('#wppm_alert_success .wppm_alert_text').text(response.messege); |
| 2562 |
} |
| 2563 |
jQuery('#wppm_alert_success').slideDown('fast',function(){}); |
| 2564 |
setTimeout(function(){ jQuery('#wppm_alert_success').slideUp('fast',function(){}); }, 3000); |
| 2565 |
}); |
| 2566 |
} |
| 2567 |
|
| 2568 |
function wppm_edit_checklist_item(item_id,checklist_id,proj_id,task_id){ |
| 2569 |
wppm_task_modal_open('Edit Checklist Item') ; |
| 2570 |
var data = { |
| 2571 |
action: 'wppm_edit_checklist_item', |
| 2572 |
item_id:item_id, |
| 2573 |
checklist_id: checklist_id, |
| 2574 |
task_id: task_id, |
| 2575 |
proj_id: proj_id, |
| 2576 |
_ajax_nonce:jQuery('#wppm_edit_checklist_item_ajax_nonce').val() |
| 2577 |
}; |
| 2578 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2579 |
var response = JSON.parse(response); |
| 2580 |
if(proj_id==0){ |
| 2581 |
jQuery('#wppm_task_popup_body').html(response.body); |
| 2582 |
jQuery('#wppm_task_popup_footer').html(response.footer); |
| 2583 |
}else{ |
| 2584 |
jQuery('#wppm_popup_body').html(response.body); |
| 2585 |
jQuery('#wppm_popup_footer').html(response.footer); |
| 2586 |
} |
| 2587 |
}); |
| 2588 |
} |
| 2589 |
|
| 2590 |
function wppm_set_checklist_item_name(item_id,checklist_id,task_id){ |
| 2591 |
var dataform = new FormData(jQuery('#frm_get_edit_checklist_item')[0]); |
| 2592 |
wppm_task_modal_close(); |
| 2593 |
jQuery('#wppm_task_container').html(wppm_admin.loading_html); |
| 2594 |
jQuery.ajax({ |
| 2595 |
url: wppm_admin.ajax_url, |
| 2596 |
type: 'POST', |
| 2597 |
data: dataform, |
| 2598 |
processData: false, |
| 2599 |
contentType: false |
| 2600 |
}) |
| 2601 |
.done(function (response_str) { |
| 2602 |
wppm_open_task(task_id); |
| 2603 |
}); |
| 2604 |
} |
| 2605 |
|
| 2606 |
function wppm_get_project_tasks_kanban_view(proj_id, KanbanFilters = {}) { |
| 2607 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2608 |
var data = { |
| 2609 |
action: 'wppm_get_project_tasks_kanban_view', |
| 2610 |
id: proj_id, |
| 2611 |
filters: JSON.stringify(KanbanFilters) |
| 2612 |
}; |
| 2613 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2614 |
jQuery('#wppm_project_container').html(response); |
| 2615 |
}); |
| 2616 |
} |
| 2617 |
|
| 2618 |
function renderActiveFilters(filters) { |
| 2619 |
let box = document.getElementById("tb-active-filters"); |
| 2620 |
if (!box) { |
| 2621 |
return; |
| 2622 |
} |
| 2623 |
// CLEAR OLD CHIPS |
| 2624 |
box.innerHTML = ""; |
| 2625 |
if (!filters || typeof filters !== "object") { |
| 2626 |
return; |
| 2627 |
} |
| 2628 |
// CREATED BY |
| 2629 |
if (Array.isArray(filters.created_by)) { |
| 2630 |
filters.created_by.forEach(function(id) { |
| 2631 |
let text = jQuery('#tb-created-by option[value="' + id + '"]').text(); |
| 2632 |
if (text) { |
| 2633 |
createChip(text, "created_by", id); |
| 2634 |
} |
| 2635 |
}); |
| 2636 |
} |
| 2637 |
// ASSIGNED |
| 2638 |
if (Array.isArray(filters.assigned)) { |
| 2639 |
filters.assigned.forEach(function(id) { |
| 2640 |
let text = jQuery('#tb-assigned option[value="' + id + '"]').text(); |
| 2641 |
if (text) { |
| 2642 |
createChip(text, "assigned", id); |
| 2643 |
} |
| 2644 |
}); |
| 2645 |
} |
| 2646 |
|
| 2647 |
// PRIORITY |
| 2648 |
if (Array.isArray(filters.priority)) { |
| 2649 |
filters.priority.forEach(function(id) { |
| 2650 |
let text = jQuery('#tb-priority option[value="' + id + '"]').text(); |
| 2651 |
if (text) { |
| 2652 |
createChip(text, "priority", id); |
| 2653 |
} |
| 2654 |
}); |
| 2655 |
} |
| 2656 |
|
| 2657 |
// DATE CHIP |
| 2658 |
if (filters.start_date || filters.end_date) { |
| 2659 |
let dateText = |
| 2660 |
(filters.start_date || "") + |
| 2661 |
" → " + |
| 2662 |
(filters.end_date || ""); |
| 2663 |
createChip(dateText, "date", ""); |
| 2664 |
} |
| 2665 |
} |
| 2666 |
|
| 2667 |
function renderMulti(filters, key, selector, label) { |
| 2668 |
if (!filters || !filters[key]) { |
| 2669 |
return; |
| 2670 |
} |
| 2671 |
let values = filters[key] || []; |
| 2672 |
if (!Array.isArray(values) || values.length === 0) { |
| 2673 |
return; |
| 2674 |
} |
| 2675 |
jQuery(selector + " option").each(function () { |
| 2676 |
let val = String(jQuery(this).val()); |
| 2677 |
let text = jQuery(this).text(); |
| 2678 |
if (values.map(String).includes(val)) { |
| 2679 |
createChip(`${label}: ${text}`, key, val); |
| 2680 |
} |
| 2681 |
}); |
| 2682 |
} |
| 2683 |
|
| 2684 |
function createChip(text, key, value) { |
| 2685 |
let container = document.getElementById("tb-active-filters"); |
| 2686 |
if (!container) { |
| 2687 |
return; |
| 2688 |
} |
| 2689 |
let chip = document.createElement("span"); |
| 2690 |
chip.className = "tb-chip"; |
| 2691 |
chip.innerHTML = ` |
| 2692 |
${key.charAt(0).toUpperCase() + key.slice(1)}: ${text} |
| 2693 |
<span |
| 2694 |
class="tb-remove" |
| 2695 |
data-key="${key}" |
| 2696 |
data-value="${value || ''}" |
| 2697 |
> |
| 2698 |
✕ |
| 2699 |
</span> |
| 2700 |
`; |
| 2701 |
container.appendChild(chip); |
| 2702 |
} |
| 2703 |
|
| 2704 |
function syncUIWithFilters(filters) { |
| 2705 |
jQuery("#tb-created-by") |
| 2706 |
.val(filters.created_by || []) |
| 2707 |
.trigger("change"); |
| 2708 |
|
| 2709 |
jQuery("#tb-assigned") |
| 2710 |
.val(filters.assigned || []) |
| 2711 |
.trigger("change"); |
| 2712 |
|
| 2713 |
jQuery("#tb-priority") |
| 2714 |
.val(filters.priority || []) |
| 2715 |
.trigger("change"); |
| 2716 |
|
| 2717 |
jQuery("#tb-start-date") |
| 2718 |
.val(filters.start_date || ""); |
| 2719 |
|
| 2720 |
jQuery("#tb-end-date") |
| 2721 |
.val(filters.end_date || ""); |
| 2722 |
} |
| 2723 |
|
| 2724 |
function resetFilters(view_type) { |
| 2725 |
let emptyFilters = { |
| 2726 |
created_by: [], |
| 2727 |
assigned: [], |
| 2728 |
priority: [], |
| 2729 |
start_date: "", |
| 2730 |
end_date: "", |
| 2731 |
id: jQuery('#wppm_proj_id').val() || 0 |
| 2732 |
}; |
| 2733 |
// Reset UI fields |
| 2734 |
jQuery("#tb-created-by").val(null).trigger("change"); |
| 2735 |
jQuery("#tb-assigned").val(null).trigger("change"); |
| 2736 |
jQuery("#tb-priority").val(null).trigger("change"); |
| 2737 |
jQuery("#tb-start-date").val(""); |
| 2738 |
jQuery("#tb-end-date").val(""); |
| 2739 |
if (view_type === 'grid') { |
| 2740 |
window.filters = { ...emptyFilters }; |
| 2741 |
// Delete cookie |
| 2742 |
document.cookie = |
| 2743 |
"tb_filters=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; |
| 2744 |
// Apply fresh filters |
| 2745 |
wppm_apply_task_filter_grid_view('0',emptyFilters.id,window.filters); |
| 2746 |
} |
| 2747 |
if (view_type === 'list') { |
| 2748 |
window.listFilters = { ...emptyFilters }; |
| 2749 |
// Delete cookie |
| 2750 |
document.cookie = |
| 2751 |
"tb_list_filters=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; |
| 2752 |
// Apply fresh filters |
| 2753 |
wppm_apply_task_filter(1, window.listFilters); |
| 2754 |
} |
| 2755 |
if (view_type === 'kanban') { |
| 2756 |
window.KanbanFilters = { ...emptyFilters }; |
| 2757 |
// Delete cookie |
| 2758 |
document.cookie = |
| 2759 |
"tb_kanban_filters=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; |
| 2760 |
// Apply fresh filters |
| 2761 |
wppm_get_project_tasks_kanban_view( |
| 2762 |
window.KanbanFilters.id, |
| 2763 |
window.KanbanFilters |
| 2764 |
); |
| 2765 |
} |
| 2766 |
} |
| 2767 |
|
| 2768 |
function getFilterCookie() { |
| 2769 |
let name = "tb_filters="; |
| 2770 |
let arr = document.cookie.split(';'); |
| 2771 |
for (let i = 0; i < arr.length; i++) { |
| 2772 |
let c = arr[i].trim(); |
| 2773 |
if (c.indexOf(name) === 0) { |
| 2774 |
try { |
| 2775 |
return JSON.parse(decodeURIComponent(c.substring(name.length))); |
| 2776 |
} catch (e) { |
| 2777 |
return null; |
| 2778 |
} |
| 2779 |
} |
| 2780 |
} |
| 2781 |
return null; |
| 2782 |
} |
| 2783 |
|
| 2784 |
function getListFilterCookie() { |
| 2785 |
let name = "tb_list_filters="; |
| 2786 |
let arr = document.cookie.split(';'); |
| 2787 |
for (let i = 0; i < arr.length; i++) { |
| 2788 |
let c = arr[i].trim(); |
| 2789 |
if (c.indexOf(name) === 0) { |
| 2790 |
try { |
| 2791 |
return JSON.parse(decodeURIComponent(c.substring(name.length))); |
| 2792 |
} catch (e) { |
| 2793 |
return null; |
| 2794 |
} |
| 2795 |
} |
| 2796 |
} |
| 2797 |
return null; |
| 2798 |
} |
| 2799 |
|
| 2800 |
function getKanbanFilterCookie() { |
| 2801 |
let name = "tb_kanban_filters="; |
| 2802 |
let arr = document.cookie.split(';'); |
| 2803 |
for (let i = 0; i < arr.length; i++) { |
| 2804 |
let c = arr[i].trim(); |
| 2805 |
if (c.indexOf(name) === 0) { |
| 2806 |
try { |
| 2807 |
return JSON.parse(decodeURIComponent(c.substring(name.length))); |
| 2808 |
} catch (e) { |
| 2809 |
return null; |
| 2810 |
} |
| 2811 |
} |
| 2812 |
} |
| 2813 |
return null; |
| 2814 |
} |
| 2815 |
|
| 2816 |
function setFilterCookie(filters) { |
| 2817 |
document.cookie = |
| 2818 |
"tb_filters=" + encodeURIComponent(JSON.stringify(filters)) + |
| 2819 |
";path=/;max-age=" + (60 * 60 * 24); |
| 2820 |
} |
| 2821 |
|
| 2822 |
function setListFilterCookie(listFilters) { |
| 2823 |
document.cookie = |
| 2824 |
"tb_list_filters=" + encodeURIComponent(JSON.stringify(listFilters)) + |
| 2825 |
";path=/;max-age=" + (60 * 60 * 24); |
| 2826 |
} |
| 2827 |
|
| 2828 |
function setKanbanFilterCookie(KanbanFilters) { |
| 2829 |
document.cookie = |
| 2830 |
"tb_kanban_filters=" + encodeURIComponent(JSON.stringify(KanbanFilters)) + |
| 2831 |
";path=/;max-age=" + (60 * 60 * 24); |
| 2832 |
} |
| 2833 |
|
| 2834 |
let filterTimeout; |
| 2835 |
function triggerFilter(page = 1, filters = {}, view_type = 'list', proj_id = 0) { |
| 2836 |
clearTimeout(filterTimeout); |
| 2837 |
filterTimeout = setTimeout(function () { |
| 2838 |
if (view_type === 'grid') { |
| 2839 |
wppm_apply_task_filter_grid_view( |
| 2840 |
page, |
| 2841 |
proj_id, |
| 2842 |
filters |
| 2843 |
); |
| 2844 |
} |
| 2845 |
if (view_type === 'list') { |
| 2846 |
wppm_apply_task_filter( |
| 2847 |
page, |
| 2848 |
filters |
| 2849 |
); |
| 2850 |
} |
| 2851 |
if (view_type === 'kanban') { |
| 2852 |
wppm_get_project_tasks_kanban_view( |
| 2853 |
proj_id, |
| 2854 |
filters |
| 2855 |
); |
| 2856 |
} |
| 2857 |
}, 300); |
| 2858 |
} |
| 2859 |
|
| 2860 |
function wppm_archieve_project_list(){ |
| 2861 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2862 |
var data = { |
| 2863 |
action: 'wppm_archieve_project_list' |
| 2864 |
}; |
| 2865 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2866 |
jQuery('#wppm_project_container').html(response); |
| 2867 |
}); |
| 2868 |
} |
| 2869 |
|
| 2870 |
function wppm_get_archieve_project_list(page_no){ |
| 2871 |
jQuery('#wppm_project_container').html(wppm_admin.loading_html); |
| 2872 |
var data = { |
| 2873 |
action: 'wppm_get_project_list', |
| 2874 |
page_no:page_no, |
| 2875 |
is_archieved:1 |
| 2876 |
}; |
| 2877 |
jQuery.post(wppm_admin.ajax_url, data, function(response) { |
| 2878 |
jQuery('#wppm_project_container').html(response); |
| 2879 |
}); |
| 2880 |
} |
| 2881 |
|