edit_todo.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-content">
  7. <form method="post" action="{:url('editTodo')}" class="form-horizontal">
  8. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  9. <div class="form-group">
  10. <label class="col-xs-2 control-label">开始时间<span class="text-danger">*</span></label>
  11. <div class="col-xs-6">
  12. <input type="text" class="form-control" placeholder="请选择" readonly id="start" name="start" value="{$info.start|default=''}">
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <label class="col-xs-2 control-label">结束时间<span class="text-danger">*</span></label>
  17. <div class="col-xs-6">
  18. <input type="text" class="form-control" readonly placeholder="请选择" id="end" name="end" value="{$info.end|default=''}">
  19. </div>
  20. </div>
  21. <div class="form-group">
  22. <label class="col-xs-2 control-label">服务天数</label>
  23. <div class="col-xs-6">
  24. <input type="number" class="form-control" id="day" name="day" value="{$info.day|default=''}">
  25. <span class="help-block m-b-none">不填或为0,系统将自动计算服务天数</span>
  26. </div>
  27. </div>
  28. <div class="form-group">
  29. <label class="col-sm-2 control-label">备注</label>
  30. <div class="col-sm-6">
  31. <textarea name="remark" class="form-control" value="{$info.remark|default=''}"></textarea>
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label class="col-sm-2 control-label">状态</label>
  36. <div class="col-sm-6">
  37. <label class="cr-inline">
  38. <input type="radio" value="1" name="status">服务中&nbsp;&nbsp;
  39. </label>
  40. <label class="cr-inline">
  41. <input type="radio" value="2" name="status">已结束&nbsp;&nbsp;
  42. </label>
  43. <label class="cr-inline">
  44. <input type="radio" value="0" name="status">已作废
  45. </label>
  46. </div>
  47. </div>
  48. <div class="hr-line-dashed"></div>
  49. <div class="form-group">
  50. <div class="col-sm-4 col-sm-offset-2">
  51. <button class="btn btn-primary ajax-post" data-layer="1" target-form="form-horizontal" type="submit">确 定</button>
  52. </div>
  53. </div>
  54. </form>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. {/block}
  60. {block name="script"}
  61. <script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
  62. <script>
  63. laydate.render({
  64. elem: '#start',
  65. //设置开始日期、日期日期的 input 选择器
  66. //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
  67. type: 'datetime',
  68. trigger: 'click',
  69. theme: '#2e6da4'
  70. });
  71. laydate.render({
  72. elem: '#end',
  73. //设置开始日期、日期日期的 input 选择器
  74. //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
  75. type: 'datetime',
  76. trigger: 'click',
  77. theme: '#2e6da4'
  78. });
  79. $(document).ready(function(){
  80. formSetValue("status", {$info.status|default=1});
  81. });
  82. function changeDay() {
  83. var start = $('#start').val();
  84. var end = $('#end').val();
  85. console.log(start,end);
  86. // if(!start || !end || end <= start){
  87. // $('#day').val(0);
  88. // }else{
  89. // var days = getDaysBetween(start,end);
  90. //
  91. // console.log(days);
  92. // }
  93. }
  94. function getDaysBetween(dateString1,dateString2){ // 获取两个日期之间的天数
  95. var startDate = Date.parse(dateString1);
  96. var endDate = Date.parse(dateString2);
  97. if (startDate>endDate){
  98. return 0;
  99. }
  100. if (startDate==endDate){
  101. return 1;
  102. }
  103. var days=(endDate - startDate)/(1*24*60*60*1000);
  104. return days + 1;
  105. };
  106. </script>
  107. {/block}