modal.ejs 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <div class="modal" id="add-qi" data-backdrop="static" aria-modal="true" role="dialog">
  2. <div class="modal-dialog" role="document">
  3. <form class="modal-content" action="pay/add" method="POST" onsubmit="return checkAddValid();">
  4. <div class="modal-header">
  5. <h5 class="modal-title">添加新一期</h5>
  6. </div>
  7. <div class="modal-body">
  8. <div class="form-group form-group-sm">
  9. <label>支付期</label>
  10. <input class="form-control form-control-sm" value="第 <%- (phasePays.length + 1) %> 期" type="text" readonly="">
  11. <input type="hidden" value="<%- (phasePays.length + 1) %>" name="phase_order">
  12. </div>
  13. <div class="form-group form-group-sm">
  14. <label>支付年月</label>
  15. <input class="datepicker-here form-control form-control-sm" name="date" placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text">
  16. </div>
  17. <div class="form-group form-group-sm">
  18. <label>计量期</label>
  19. <select class="form-control form-control-sm" name="stage">
  20. <% for (const s of validStages) { %>
  21. <option value="<%- s.order %>" <%- (s.order === validStages[0].order ? 'selected' : '') %>>第 <%- s.order %> 期</option>
  22. <% } %>
  23. </select>
  24. </div>
  25. <div class="form-group form-group-sm">
  26. <label>支付期备注</label>
  27. <textarea class="form-control form-control-sm" rows="3" name="memo"></textarea>
  28. </div>
  29. </div>
  30. <div class="modal-footer">
  31. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  32. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">关闭</button>
  33. <button type="submit" class="btn btn-sm btn-primary" id="add-qi-ok">确定</button>
  34. </div>
  35. </form>
  36. </div>
  37. </div>
  38. <div class="modal" id="edit-qi" data-backdrop="static" aria-modal="true" role="dialog">
  39. <div class="modal-dialog" role="document">
  40. <div class="modal-content" action="pay/save" method="POST" onsubmit="return checkEditValid();">
  41. <div class="modal-header">
  42. <h5 class="modal-title">编辑</h5>
  43. </div>
  44. <div class="modal-body">
  45. <div class="form-group form-group-sm">
  46. <label>支付期</label>
  47. <input class="form-control form-control-sm" value="第 <%- (phasePays.length + 1) %> 期" type="text" readonly="">
  48. </div>
  49. <div class="form-group form-group-sm">
  50. <label>支付年月</label>
  51. <input class="datepicker-here form-control form-control-sm" name="date" placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text">
  52. </div>
  53. <div class="form-group form-group-sm">
  54. <label>支付期备注</label>
  55. <textarea class="form-control form-control-sm" rows="3" name="memo"></textarea>
  56. </div>
  57. </div>
  58. <div class="modal-footer">
  59. <input type="hidden" value="" name="phase_id">
  60. <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
  61. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">关闭</button>
  62. <button type="button" class="btn btn-sm btn-primary" id="add-qi-ok">确定</button>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <script>
  68. $('.datepicker-here').datepicker({
  69. autoClose: true,
  70. });
  71. const checkAddValid = function() {
  72. if ($('[name=date]', '#add-qi').val() == '') {
  73. toastr.error('请选择计量年月');
  74. return false;
  75. }
  76. if ($('[name=stage]', '#add-qi').val() == '') {
  77. toastr.error('请选择计量期');
  78. return false;
  79. }
  80. }
  81. const checkEditValid = function() {
  82. }
  83. </script>