m.edit.html.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /**
  3. * The edit mobile view file of makeup 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 makeup
  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->makeup->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='editMakeupForm' data-form-refresh='#page' method='post' action='<?php echo $this->createLink('makeup', 'edit', "makeupID={$makeup->id}");?>'>
  18. <div class='row'>
  19. <div class='cell-6'>
  20. <div class='control'>
  21. <label for='begin'><?php echo $lang->makeup->begin;?></label>
  22. <input type='date' class='input' id='begin' name='begin' value="<?php echo $makeup->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->makeup->start;?></label>
  28. <input type='time' class='input' id='start' name='start' value="<?php echo $makeup->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->makeup->end;?></label>
  36. <input type='date' class='input' id='end' name='end' value="<?php echo $makeup->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->makeup->finish;?></label>
  42. <input type='time' class='input' id='finish' value="<?php echo $makeup->finish;?>" name='finish' placeholder='<?php echo $lang->required;?>'>
  43. </div>
  44. </div>
  45. </div>
  46. <div class='control'>
  47. <label for='leave[]'><?php echo $lang->makeup->leave;?></label>
  48. <div class='select'>
  49. <?php echo html::select('leave[]', $leaves, $makeup->leave, 'multiple');?>
  50. </div>
  51. </div>
  52. <div class='control'>
  53. <label for='hours'><?php echo $lang->makeup->hours;?></label>
  54. <?php echo html::input('hours', $makeup->hours, "class='input' placeholder='{$lang->required}'");?>
  55. </div>
  56. <div class='control'>
  57. <label for='desc'><?php echo $lang->makeup->desc;?></label>
  58. <?php echo html::textarea('desc', $makeup->desc, "rows='3' class='textarea'");?>
  59. </div>
  60. </form>
  61. <div class='footer has-padding'>
  62. <button type='button' data-submit='#editMakeupForm' class='btn primary'><?php echo $lang->save;?></button>
  63. </div>
  64. <script>
  65. $(function()
  66. {
  67. $('#editMakeupForm').modalForm().listenScroll({container: 'parent'});
  68. $('#begin, #start, #end, #finish').on('change', function()
  69. {
  70. var begin = $('#begin').val();
  71. var end = $('#end').val();
  72. var start = $('#start').val();
  73. var finish = $('#finish').val();
  74. if(!begin || !end || !start || !finish) return false;
  75. begin = begin.replace(/-/g, '/');
  76. end = end.replace(/-/g, '/');
  77. var hours = 0;
  78. var beginTime = Date.parse(new Date(begin + ' ' + start));
  79. var endTime = Date.parse(new Date(end + ' ' + finish));
  80. var workingHours = <?php echo $config->attend->workingHours;?>;
  81. if(beginTime > endTime) return false;
  82. if(begin == end)
  83. {
  84. hours = Math.round((endTime - beginTime)/(3600*1000)*100)/100;
  85. if(hours > workingHours) hours = parseFloat(workingHours);
  86. }
  87. else
  88. {
  89. var signOut = <?php echo json_encode($config->attend->signOutLimit);?>;
  90. var signIn = <?php echo json_encode($config->attend->signInLimit);?>;
  91. var signOutTime = Date.parse(new Date(begin + ' ' + signOut));
  92. var signInTime = Date.parse(new Date(end + ' ' + signIn));
  93. var hoursStart = 0;
  94. var hoursEnd = 0;
  95. var hoursContent = 0;
  96. if(beginTime < signOutTime) hoursStart = Math.round((signOutTime - beginTime)/(3600*1000)*100)/100;
  97. if(hoursStart > workingHours) hoursStart = parseFloat(workingHours);
  98. if(endTime > signInTime) hoursEnd = Math.round((endTime - signInTime)/(3600*1000)*100)/100;
  99. if(hoursEnd > workingHours) hoursEnd = parseFloat(workingHours);
  100. var days = Math.floor((Date.parse(new Date(end)) - Date.parse(new Date(begin)))/(24*3600*1000));
  101. if(days > 1) hoursContent = (days - 1) * workingHours;
  102. hours = hoursStart + hoursEnd + hoursContent;
  103. }
  104. $('#hours').val(hours);
  105. });
  106. });
  107. </script>