m.create.html.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /**
  3. * The create mobile view file of lieu module of ZDOO.
  4. *
  5. * @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license ZPL (http://zpl.pub/page/zplv12.html)
  7. * @author Gang Liu <liugang@cnezsoft.com>
  8. * @package lieu
  9. * @version $Id$
  10. * @link http://www.zdoo.com
  11. */
  12. if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
  13. <?php if(!helper::isAjaxRequest()):?>
  14. <?php include "../../common/view/m.header.html.php";?>
  15. <?php endif;?>
  16. <div class='heading divider'>
  17. <div class='title'><i class='icon icon-plus'></i> <strong><?php echo $lang->makeup->create;?></strong></div>
  18. <?php if(helper::isAjaxRequest()):?>
  19. <nav class='nav'><a data-dismiss='display'><i class='icon-remove muted'></i></a></nav>
  20. <?php endif;?>
  21. </div>
  22. <form class='content box' id='createMakeupForm' data-form-refresh='#page' method='post' action='<?php echo $this->createLink('makeup', 'create');?>'>
  23. <div class='row'>
  24. <div class='cell-6'>
  25. <div class='control'>
  26. <label for='begin'><?php echo $lang->makeup->begin;?></label>
  27. <input type='date' class='input' id='begin' name='begin' placeholder='<?php echo $lang->required;?>'>
  28. </div>
  29. </div>
  30. <div class='cell-6'>
  31. <div class='control'>
  32. <label for='start'><?php echo $lang->makeup->start;?></label>
  33. <input type='time' class='input' id='start' value='<?php echo $config->attend->signInLimit;?>' name='start' placeholder='<?php echo $lang->required;?>'>
  34. </div>
  35. </div>
  36. </div>
  37. <div class='row'>
  38. <div class='cell-6'>
  39. <div class='control'>
  40. <label for='end'><?php echo $lang->makeup->end;?></label>
  41. <input type='date' class='input' id='end' name='end' placeholder='<?php echo $lang->required;?>'>
  42. </div>
  43. </div>
  44. <div class='cell-6'>
  45. <div class='control'>
  46. <label for='finish'><?php echo $lang->makeup->finish;?></label>
  47. <input type='time' class='input' id='finish' value='<?php echo $config->attend->signOutLimit;?>' name='finish' placeholder='<?php echo $lang->required;?>'>
  48. </div>
  49. </div>
  50. </div>
  51. <div class='control'>
  52. <label for='hours'><?php echo $lang->makeup->hours;?></label>
  53. <?php echo html::input('hours', '', "class='input' placeholder='{$lang->required}'");?>
  54. </div>
  55. <div class='control'>
  56. <label for='leave[]'><?php echo $lang->makeup->leave;?></label>
  57. <div class='select'>
  58. <?php echo html::select('leave[]', $leaves, '', 'multiple');?>
  59. </div>
  60. </div>
  61. <div class='control'>
  62. <label for='desc'><?php echo $lang->makeup->desc;?></label>
  63. <?php echo html::textarea('desc', '', "rows='3' class='textarea'");?>
  64. </div>
  65. </form>
  66. <div class='footer has-padding'>
  67. <button type='button' data-submit='#createMakeupForm' class='btn primary'><?php echo $lang->save;?></button>
  68. </div>
  69. <script>
  70. $(function()
  71. {
  72. $('#createMakeupForm').modalForm({onResult: true}).listenScroll({container: 'parent'});
  73. $('#begin, #start, #end, #finish').on('change', function()
  74. {
  75. var begin = $('#begin').val();
  76. var end = $('#end').val();
  77. var start = $('#start').val();
  78. var finish = $('#finish').val();
  79. if(!begin || !end || !start || !finish) return false;
  80. begin = begin.replace(/-/g, '/');
  81. end = end.replace(/-/g, '/');
  82. var hours = 0;
  83. var workingHours = <?php echo $config->attend->workingHours;?>;
  84. var beginTime = Date.parse(new Date(begin + ' ' + start));
  85. var endTime = Date.parse(new Date(end + ' ' + finish));
  86. if(beginTime > endTime) return false;
  87. if(begin == end)
  88. {
  89. hours = Math.round((endTime - beginTime)/(3600*1000)*100)/100;
  90. if(hours > workingHours) hours = parseFloat(workingHours);
  91. }
  92. else
  93. {
  94. var signOut = <?php echo json_encode($config->attend->signOutLimit);?>;
  95. var signIn = <?php echo json_encode($config->attend->signInLimit);?>;
  96. var signOutTime = Date.parse(new Date(begin + ' ' + signOut));
  97. var signInTime = Date.parse(new Date(end + ' ' + signIn));
  98. var hoursStart = 0;
  99. var hoursEnd = 0;
  100. var hoursContent = 0;
  101. if(beginTime < signOutTime) hoursStart = Math.round((signOutTime - beginTime)/(3600*1000)*100)/100;
  102. if(hoursStart > workingHours) hoursStart = parseFloat(workingHours);
  103. if(endTime > signInTime) hoursEnd = Math.round((endTime - signInTime)/(3600*1000)*100)/100;
  104. if(hoursEnd > workingHours) hoursEnd = parseFloat(workingHours);
  105. var days = Math.floor((Date.parse(new Date(end)) - Date.parse(new Date(begin)))/(24*3600*1000));
  106. if(days > 1) hoursContent = (days - 1) * workingHours;
  107. hours = hoursStart + hoursEnd + hoursContent;
  108. }
  109. $('#hours').val(hours);
  110. });
  111. });
  112. </script>
  113. <?php if(!helper::isAjaxRequest()):?>
  114. <?php include "../../common/view/m.footer.html.php";?>
  115. <?php endif;?>