staff.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. body.on('click','#quitAccount',function(){QuitAccount(this);});
  2. function EditJobs(obj, job_id) {
  3. for (var i=0;i<obj.parentElement.children.length; i++)
  4. {
  5. obj.parentElement.children[i].disabled = false;
  6. }
  7. FillTaskTypes(job_id);
  8. }
  9. function FillTaskTypes(job_id) {
  10. var alltasktypescont = document.getElementById("alltasktypescont");
  11. var allttselect = alltasktypescont.children[0];
  12. var divEl = document.getElementById("jobid_"+job_id);
  13. var k = 0;
  14. for (var i=1; i< divEl.children.length; i++)
  15. {
  16. var selectEl = divEl.children[i];
  17. if (selectEl.tagName == "SELECT")
  18. {
  19. var sel = selectEl.options[selectEl.selectedIndex].value;
  20. selectEl.innerHTML = allttselect.innerHTML;
  21. for (var g=0; g < selectEl.options.length; g++) {
  22. if (selectEl.options[g].value === sel) {
  23. selectEl.options[g].setAttribute('selected', true);
  24. }
  25. }
  26. k++;
  27. }
  28. }
  29. var e=document.querySelectorAll('option')
  30. e.forEach(x=>{
  31. if(x.textContent.length>200)
  32. x.textContent=x.textContent.substring(0,200)+'...';
  33. })
  34. }
  35. function ReceiveTasktypes(data) {
  36. var jsn = JSON.parse(data);
  37. var divEl = document.getElementById("jobid_"+jsn.jobid);
  38. var k = 0;
  39. for (var i=1; i< divEl.children.length; i++)
  40. {
  41. var selectEl = divEl.children[i];
  42. if (selectEl.tagName == "SELECT")
  43. {
  44. selectEl.innerHTML = jsn.tasktypes[k].html;
  45. k++;
  46. }
  47. }
  48. var e=document.querySelectorAll('option')
  49. e.forEach(x=>{
  50. if(x.textContent.length>200)
  51. x.textContent=x.textContent.substring(0,200)+'...';
  52. })
  53. }
  54. function ChangeBasic(val, accid)
  55. {
  56. var dict = new Object(); //or Map()
  57. dict[ 'basic_count' ] = val;
  58. dict[ 'accid' ] = accid;
  59. sendAjax('result', dict, Reload);
  60. }
  61. function Reload() {
  62. window.location.reload();
  63. }
  64. function QuitAccount(obj) {
  65. var dict = new Object(); //or Map()
  66. dict[ 'quitaccount' ] = obj.title;
  67. //sendAjax('', dict, Reload);
  68. sendAjax('', dict, Reload);
  69. }
  70. function ChangeJob(id, jobvalue, index, previous)
  71. {
  72. var dict = new Object(); //or Map()
  73. dict[ 'new' ] = 4;
  74. dict[ 'newjob_accid' ] = id;
  75. dict[ 'jobvalue' ] = jobvalue;
  76. dict[ 'index' ] = index;
  77. dict[ 'previous' ] = previous;
  78. sendAjax('result', dict, Reload);
  79. }
  80. function downloadStaff(){
  81. location.href="staffPDF.php";
  82. }
  83. $( document ).ready(function() {
  84. var Toggled = false;
  85. $('.button_staff_toggle').click(function(){
  86. var selector_staff = $(this).attr('data');
  87. $("." + selector_staff ).slideToggle("slow");
  88. $("." + selector_staff + "_top").slideToggle("slow");
  89. if(Toggled==false){$('.button_sou_toggle').html('Свернуть');
  90. Toggled=true;
  91. } else {$('.button_sou_toggle').html('Развернуть');
  92. Toggled=false;}
  93. return false;
  94. });
  95. var data = {};
  96. $('#form6').change(function(){
  97. /*
  98. $('#form6').find ('select').each(function() {
  99. data[$(this).attr('name')] = $(this).val();
  100. });
  101. */
  102. $(this).submit();
  103. //location.href="index.php?act=staff&order="+ data.asc +"&kind=" + data.kind + "&shift_filter=" + data.shift;
  104. });
  105. $( function() {
  106. $( "#tabs" ).tabs();
  107. } );
  108. var accountsEntityCount = $('#accountsEntityCount').attr('data_pos');
  109. for (var r = 1; r <= accountsEntityCount; r++) {
  110. var countSubJob = $(".data_pos_"+ r +"_0").attr('data');
  111. //console.log(countSubJob);
  112. var jobsString = '';
  113. if ( 0 == countSubJob) {
  114. jobsString += '<b>Основная: </b>' + $(".data_pos_"+ r +"_0 option:selected").text() + '. ';
  115. }
  116. if ( 0 < countSubJob) {
  117. jobsString += '<b>Основная: </b>' + $(".data_pos_"+ r +"_0 option:selected").text() + '. ';
  118. jobsString += '<b>Замещающая: </b>';
  119. $point = ', ';
  120. for (var i = 1; i <= countSubJob; i++) {
  121. if ( i == countSubJob){
  122. $point = '.';
  123. }
  124. jobsString += $(".data_pos_"+ r +"_" + i + " option:selected").text() + $point;
  125. }
  126. }
  127. $("#data_pos_top_" + r ).html(jobsString);
  128. }
  129. });