m.create.html.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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->lieu->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='createLieuForm' data-form-refresh='#page' method='post' action='<?php echo $this->createLink('lieu', 'create');?>'>
  23. <div class='row'>
  24. <div class='cell-6'>
  25. <div class='control'>
  26. <label for='begin'><?php echo $lang->lieu->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->lieu->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->lieu->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->lieu->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='overtime[]'><?php echo $lang->lieu->overtime;?></label>
  53. <div class='select'>
  54. <?php echo html::select('overtime[]', $overtimes, '', 'multiple');?>
  55. </div>
  56. </div>
  57. <div class='control'>
  58. <label for='trip[]'><?php echo $lang->lieu->trip;?></label>
  59. <div class='select'>
  60. <?php echo html::select('trip[]', $trips, '', 'multiple');?>
  61. </div>
  62. </div>
  63. <div class='control'>
  64. <label for='hours'><?php echo $lang->lieu->hours;?></label>
  65. <?php echo html::input('hours', '', "class='input' placeholder='{$lang->required}'");?>
  66. </div>
  67. <div class='control'>
  68. <label for='desc'><?php echo $lang->lieu->desc;?></label>
  69. <?php echo html::textarea('desc', '', "rows='3' class='textarea'");?>
  70. </div>
  71. </form>
  72. <div class='footer has-padding'>
  73. <button type='button' data-submit='#createLieuForm' class='btn primary'><?php echo $lang->save;?></button>
  74. </div>
  75. <script>
  76. $(function()
  77. {
  78. $('#createLieuForm').modalForm({onResult: true}).listenScroll({container: 'parent'});
  79. $('#begin, #start, #end, #finish').on('change', function()
  80. {
  81. var begin = $('#begin').val();
  82. var end = $('#end').val();
  83. var start = $('#start').val();
  84. var finish = $('#finish').val();
  85. if(!begin || !end || !start || !finish) return false;
  86. begin = begin.replace(/-/g, '/');
  87. end = end.replace(/-/g, '/');
  88. var hours = 0;
  89. var workingHours = <?php echo $config->attend->workingHours;?>;
  90. var beginTime = Date.parse(new Date(begin + ' ' + start));
  91. var endTime = Date.parse(new Date(end + ' ' + finish));
  92. if(beginTime > endTime) return false;
  93. if(begin == end)
  94. {
  95. hours = Math.round((endTime - beginTime)/(3600*1000)*100)/100;
  96. if(hours > workingHours) hours = parseFloat(workingHours);
  97. }
  98. else
  99. {
  100. var signOut = <?php echo json_encode($config->attend->signOutLimit);?>;
  101. var signIn = <?php echo json_encode($config->attend->signInLimit);?>;
  102. var signOutTime = Date.parse(new Date(begin + ' ' + signOut));
  103. var signInTime = Date.parse(new Date(end + ' ' + signIn));
  104. var hoursStart = 0;
  105. var hoursEnd = 0;
  106. var hoursContent = 0;
  107. if(beginTime < signOutTime) hoursStart = Math.round((signOutTime - beginTime)/(3600*1000)*100)/100;
  108. if(hoursStart > workingHours) hoursStart = parseFloat(workingHours);
  109. if(endTime > signInTime) hoursEnd = Math.round((endTime - signInTime)/(3600*1000)*100)/100;
  110. if(hoursEnd > workingHours) hoursEnd = parseFloat(workingHours);
  111. var days = Math.floor((Date.parse(new Date(end)) - Date.parse(new Date(begin)))/(24*3600*1000));
  112. if(days > 1) hoursContent = (days - 1) * workingHours;
  113. hours = hoursStart + hoursEnd + hoursContent;
  114. }
  115. $('#hours').val(hours);
  116. });
  117. });
  118. </script>
  119. <?php if(!helper::isAjaxRequest()):?>
  120. <?php include "../../common/view/m.footer.html.php";?>
  121. <?php endif;?>