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