m.edit.html.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * The edit mobile view file of lieu module of ZDOO.
  4. *
  5. * @copyright Copyright 2009-2016 青岛易软天创网络科技有限公司(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. <div class='heading divider'>
  14. <div class='title'><i class='icon icon-plus'></i> <strong><?php echo $lang->lieu->edit;?></strong></div>
  15. <nav class='nav'><a data-dismiss='display'><i class='icon icon-remove'></i></a></nav>
  16. </div>
  17. <form class='content box' id='editLieuForm' data-form-refresh='#page' method='post' action='<?php echo $this->createLink('lieu', 'edit', "lieuID={$lieu->id}");?>'>
  18. <div class='row'>
  19. <div class='cell-6'>
  20. <div class='control'>
  21. <label for='begin'><?php echo $lang->lieu->begin;?></label>
  22. <input type='date' class='input' id='begin' name='begin' value="<?php echo $lieu->begin;?>" placeholder='<?php echo $lang->required;?>'>
  23. </div>
  24. </div>
  25. <div class='cell-6'>
  26. <div class='control'>
  27. <label for='start'><?php echo $lang->lieu->start;?></label>
  28. <input type='time' class='input' id='start' name='start' value="<?php echo $lieu->start;?>" placeholder='<?php echo $lang->required;?>'>
  29. </div>
  30. </div>
  31. </div>
  32. <div class='row'>
  33. <div class='cell-6'>
  34. <div class='control'>
  35. <label for='end'><?php echo $lang->lieu->end;?></label>
  36. <input type='date' class='input' id='end' name='end' value="<?php echo $lieu->end;?>" placeholder='<?php echo $lang->required;?>'>
  37. </div>
  38. </div>
  39. <div class='cell-6'>
  40. <div class='control'>
  41. <label for='finish'><?php echo $lang->lieu->finish;?></label>
  42. <input type='time' class='input' id='finish' value="<?php echo $lieu->finish;?>" name='finish' placeholder='<?php echo $lang->required;?>'>
  43. </div>
  44. </div>
  45. </div>
  46. <div class='control'>
  47. <label for='overtime[]'><?php echo $lang->lieu->overtime;?></label>
  48. <div class='select'>
  49. <?php echo html::select('overtime[]', $overtimes, $lieu->overtime, 'multiple');?>
  50. </div>
  51. </div>
  52. <div class='control'>
  53. <label for='trip[]'><?php echo $lang->lieu->trip;?></label>
  54. <div class='select'>
  55. <?php echo html::select('trip[]', $trips, $lieu->trip, 'multiple');?>
  56. </div>
  57. </div>
  58. <div class='control'>
  59. <label for='hours'><?php echo $lang->lieu->hours;?></label>
  60. <?php echo html::input('hours', $lieu->hours, "class='input' placeholder='{$lang->required}'");?>
  61. </div>
  62. <div class='control'>
  63. <label for='desc'><?php echo $lang->lieu->desc;?></label>
  64. <?php echo html::textarea('desc', $lieu->desc, "rows='3' class='textarea'");?>
  65. </div>
  66. </form>
  67. <div class='footer has-padding'>
  68. <button type='button' data-submit='#editLieuForm' class='btn primary'><?php echo $lang->save;?></button>
  69. </div>
  70. <script>
  71. $(function()
  72. {
  73. $('#editLieuForm').modalForm().listenScroll({container: 'parent'});
  74. $('#begin, #start, #end, #finish').on('change', function()
  75. {
  76. var begin = $('#begin').val();
  77. var end = $('#end').val();
  78. var start = $('#start').val();
  79. var finish = $('#finish').val();
  80. if(!begin || !end || !start || !finish) return false;
  81. begin = begin.replace(/-/g, '/');
  82. end = end.replace(/-/g, '/');
  83. var hours = 0;
  84. var beginTime = Date.parse(new Date(begin + ' ' + start));
  85. var endTime = Date.parse(new Date(end + ' ' + finish));
  86. var workingHours = <?php echo $config->attend->workingHours;?>;
  87. if(beginTime > endTime) return false;
  88. if(begin == end)
  89. {
  90. hours = Math.round((endTime - beginTime)/(3600*1000)*100)/100;
  91. if(hours > workingHours) hours = parseFloat(workingHours);
  92. }
  93. else
  94. {
  95. var signOut = <?php echo json_encode($config->attend->signOutLimit);?>;
  96. var signIn = <?php echo json_encode($config->attend->signInLimit);?>;
  97. var signOutTime = Date.parse(new Date(begin + ' ' + signOut));
  98. var signInTime = Date.parse(new Date(end + ' ' + signIn));
  99. var hoursStart = 0;
  100. var hoursEnd = 0;
  101. var hoursContent = 0;
  102. if(beginTime < signOutTime) hoursStart = Math.round((signOutTime - beginTime)/(3600*1000)*100)/100;
  103. if(hoursStart > workingHours) hoursStart = parseFloat(workingHours);
  104. if(endTime > signInTime) hoursEnd = Math.round((endTime - signInTime)/(3600*1000)*100)/100;
  105. if(hoursEnd > workingHours) hoursEnd = parseFloat(workingHours);
  106. var days = Math.floor((Date.parse(new Date(end)) - Date.parse(new Date(begin)))/(24*3600*1000));
  107. if(days > 1) hoursContent = (days - 1) * workingHours;
  108. hours = hoursStart + hoursEnd + hoursContent;
  109. }
  110. $('#hours').val(hours);
  111. });
  112. });
  113. </script>