TCheckinManagementEdit.blade.php 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. @extends('admin.master')
  2. @section('content')
  3. <div class="row">
  4. <div class="col-lg-12">
  5. <!-- 指定新增的端點 -->
  6. <form id="EditForm" class="form-horizontal" method="post"
  7. action="{{ url('/backend/dataManagement/tcheckinManagement/store') }}">
  8. {{ csrf_field() }}
  9. <div class="panel panel-primary">
  10. <div class="panel-heading">
  11. <!-- 更改文案 -->
  12. <h4 class="panel-title">{{ ($operdata == "") ? "Create " : "Modify " }}簽到贈點</h4>
  13. </div>
  14. <div class="panel-body">
  15. <div>
  16. <!-- 表格本體 -->
  17. <table class="table" cellspacing="0" id="DetailsView1" style="border-collapse:collapse;">
  18. <tbody>
  19. <!-- 欄位:自增量 -->
  20. @if ($operdata == "")
  21. <input type="hidden" name="mode" value="insert"/>
  22. <!-- Insert Mode -->
  23. @else
  24. <!-- Edit Mode -->
  25. <tr>
  26. <td class="col-lg-2">自增量</td>
  27. <td>
  28. <input name="id" type="hidden" value="{{ $operdata['id'] }}" id="id"/>
  29. {{ $operdata['id'] }}
  30. </td>
  31. </tr>
  32. @endif
  33. <!-- 欄位:滿幾天 -->
  34. <!-- ALL Mode -->
  35. <tr>
  36. <td class="header-require col-lg-2">滿幾天</td>
  37. <td>
  38. <div class="col-lg-3 nopadding">
  39. @if ($operdata == "")
  40. <input name="day" type="text" value="" maxlength="2" id="day"
  41. class="form-control">
  42. @else
  43. <input name="day" type="text" value="{{ $operdata['day'] }}"
  44. maxlength="2" id="day" class="form-control">
  45. @endif
  46. <label class="error" for="day"></label>
  47. </div>
  48. </td>
  49. </tr>
  50. <!-- 欄位:吉點 -->
  51. <!-- ALL Mode -->
  52. <tr>
  53. <td class="header-require col-lg-2">吉點</td>
  54. <td>
  55. <div class="col-lg-3 nopadding">
  56. @if ($operdata == "")
  57. <input name="gp" type="text" value="" maxlength="2" id="gp"
  58. class="form-control">
  59. @else
  60. <input name="gp" type="text" value="{{ $operdata['gp'] }}"
  61. maxlength="2" id="gp" class="form-control">
  62. @endif
  63. <label class="error" for="gp"></label>
  64. </div>
  65. </td>
  66. </tr>
  67. <!-- 欄位:建立日期 -->
  68. <!-- ALL Mode -->
  69. @if ($operdata == "")
  70. @else
  71. <tr>
  72. <td class="header-require col-lg-2">建立日期</td>
  73. <td>
  74. <div class="col-lg-3 nopadding">
  75. {{ $operdata['cdate'] }}
  76. </div>
  77. </td>
  78. </tr>
  79. @endif
  80. <!-- 欄位:最後修改日期 -->
  81. <!-- ALL Mode -->
  82. @if ($operdata == "")
  83. @else
  84. <tr>
  85. <td class="header-require col-lg-2">最後修改日期</td>
  86. <td>
  87. <div class="col-lg-3 nopadding">
  88. {{ $operdata['mdate'] }}
  89. </div>
  90. </td>
  91. </tr>
  92. @endif
  93. <!-- 欄位:最後修改人 -->
  94. <!-- ALL Mode -->
  95. @if ($operdata == "")
  96. @else
  97. <tr>
  98. <td class="header-require col-lg-2">最後修改人</td>
  99. <td>
  100. <div class="col-lg-3 nopadding">
  101. {{ $operdata['oid'] }}
  102. </div>
  103. </td>
  104. </tr>
  105. @endif
  106. <!-- 下控制按鈕 -->
  107. <tr>
  108. <td>&nbsp;</td>
  109. <td>
  110. <div style="text-align: right">
  111. @if ($operdata == "")
  112. <!-- Insert Mode -->
  113. <input type="submit" name="btnUpdate_foot" value="Create"
  114. id="btnUpdate_foot" class="btn btn-primary btn-xs"
  115. onclick="submitForm();">
  116. @else
  117. <!-- Edit Mode -->
  118. <input type="submit" name="btnUpdate_foot" value="Modify"
  119. id="btnUpdate_foot" class="btn btn-primary btn-xs"
  120. onclick="submitForm();">
  121. @endif
  122. <input type="button" name="btnBackTo2_foot" value="Back"
  123. id="btnBackTo2_foot" class="btn btn-default btn-xs">
  124. </div>
  125. </td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. </div>
  130. </div>
  131. <!-- panel-body -->
  132. </div>
  133. </form>
  134. </div>
  135. </div>
  136. @endsection
  137. @section('extjs')
  138. <script>
  139. $(document).ready(function () {
  140. $("#btnBackTo2").click(function () {
  141. // 上方的返回列表按鈕觸發
  142. location.href = '{{ url('backend/dataManagement/tcheckinManagement') }}';
  143. });
  144. $("#btnBackTo2_foot").click(function () {
  145. // 下方的返回列表按鈕觸發
  146. location.href = '{{ url('backend/dataManagement/tcheckinManagement') }}';
  147. });
  148. // 初始化需要偵錯的表格
  149. $('#EditForm').validate();
  150. // 正規表達驗證初始化
  151. $.validator.addMethod(
  152. "regex",
  153. function (value, element, regexp) {
  154. var re = new RegExp(regexp);
  155. return this.optional(element) || re.test(value);
  156. }
  157. );
  158. // 各欄位
  159. $('#day').rules("add", {
  160. required: true,
  161. number: true,
  162. minlength: 1,
  163. maxlength: 2,
  164. messages: {
  165. required: "滿幾天 length must between 1-2",
  166. number: "滿幾天 must number",
  167. minlength: "滿幾天 length must between 1-2",
  168. maxlength: "滿幾天 length must between 1-2"
  169. }
  170. });
  171. $('#gp').rules("add", {
  172. required: true,
  173. number: true,
  174. minlength: 1,
  175. maxlength: 2,
  176. messages: {
  177. required: "吉點 length must between 1-2",
  178. number: "吉點 must number",
  179. minlength: "吉點 length must between 1-2",
  180. maxlength: "吉點 length must between 1-2"
  181. }
  182. });
  183. });
  184. //提交與取消按鈕
  185. function submitForm() {
  186. if (!!($("#EditForm").valid()) === false) {
  187. return false;
  188. } else {
  189. $(document).ready(function () {
  190. $.blockUI({
  191. css: {
  192. border: 'none',
  193. padding: '15px',
  194. backgroundColor: '#000',
  195. '-webkit-border-radius': '10px',
  196. '-moz-border-radius': '10px',
  197. opacity: .5,
  198. color: '#FFF'
  199. }
  200. });
  201. });
  202. }
  203. }
  204. function cancelValidate() {
  205. $("#EditForm").validate().cancelSubmit = true;
  206. }
  207. </script>
  208. @endsection