GoodManagementEdit.blade.php 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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/goodManagement/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. <!-- 欄位:LINE POINT -->
  34. <!-- ALL Mode -->
  35. <tr>
  36. <td class="header-require col-lg-2">LINE POINT</td>
  37. <td>
  38. <div class="col-lg-3 nopadding">
  39. @if ($operdata == "")
  40. <input name="lp" type="text" value="" maxlength="2" id="lp"
  41. class="form-control">
  42. @else
  43. <input name="lp" type="text" value="{{ $operdata['lp'] }}"
  44. maxlength="2" id="lp" class="form-control">
  45. @endif
  46. <label class="error" for="lp"></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. <tr>
  70. <td class="header-require col-lg-2">有效否</td>
  71. <td>
  72. @if ($operdata == "")
  73. <input id="active" type="checkbox" name="active" checked='checked'/>
  74. @else
  75. <input id="active" type="checkbox"
  76. name="active" {{ ($operdata['active'] == \App\Http\Services\ConstDef\GeneralConst::ACTIVE_YES)?"checked='checked'":"" }} />
  77. @endif
  78. </td>
  79. </tr>
  80. <!-- 欄位:共可發數量 -->
  81. <!-- ALL Mode -->
  82. <tr>
  83. <td class="header-require col-lg-2">共可發數量</td>
  84. <td>
  85. <div class="col-lg-3 nopadding">
  86. @if ($operdata == "")
  87. <input name="totalQty" type="text" value="" maxlength="5" id="totalQty"
  88. class="form-control">
  89. @else
  90. <input name="totalQty" type="text" value="{{ $operdata['totalQty'] }}"
  91. maxlength="5" id="totalQty" class="form-control">
  92. @endif
  93. <label class="error" for="totalQty"></label>
  94. </div>
  95. </td>
  96. </tr>
  97. <!-- 欄位:已發數量 -->
  98. <!-- ALL Mode -->
  99. <tr>
  100. <td class="header-require col-lg-2">已發數量</td>
  101. <td>
  102. <div class="col-lg-3 nopadding">
  103. @if ($operdata == "")
  104. <input name="issuedQty" type="text" value="0" maxlength="5" id="issuedQty"
  105. class="form-control" readonly>
  106. @else
  107. <input name="issuedQty" type="text" value="{{ $operdata['issuedQty'] }}"
  108. maxlength="5" id="issuedQty" class="form-control" readonly>
  109. @endif
  110. <label class="error" for="issuedQty"></label>
  111. </div>
  112. </td>
  113. </tr>
  114. <!-- 欄位:建立日期 -->
  115. <!-- ALL Mode -->
  116. @if ($operdata == "")
  117. @else
  118. <tr>
  119. <td class="header-require col-lg-2">建立日期</td>
  120. <td>
  121. <div class="col-lg-3 nopadding">
  122. {{ $operdata['cdate'] }}
  123. </div>
  124. </td>
  125. </tr>
  126. @endif
  127. <!-- 欄位:最後修改日期 -->
  128. <!-- ALL Mode -->
  129. @if ($operdata == "")
  130. @else
  131. <tr>
  132. <td class="header-require col-lg-2">最後修改日期</td>
  133. <td>
  134. <div class="col-lg-3 nopadding">
  135. {{ $operdata['mdate'] }}
  136. </div>
  137. </td>
  138. </tr>
  139. @endif
  140. <!-- 欄位:最後修改人 -->
  141. <!-- ALL Mode -->
  142. @if ($operdata == "")
  143. @else
  144. <tr>
  145. <td class="header-require col-lg-2">最後修改人</td>
  146. <td>
  147. <div class="col-lg-3 nopadding">
  148. {{ $operdata['oid'] }}
  149. </div>
  150. </td>
  151. </tr>
  152. @endif
  153. <!-- 下控制按鈕 -->
  154. <tr>
  155. <td>&nbsp;</td>
  156. <td>
  157. <div style="text-align: right">
  158. @if ($operdata == "")
  159. <!-- Insert Mode -->
  160. <input type="submit" name="btnUpdate_foot" value="Create"
  161. id="btnUpdate_foot" class="btn btn-primary btn-xs"
  162. onclick="submitForm();">
  163. @else
  164. <!-- Edit Mode -->
  165. <input type="submit" name="btnUpdate_foot" value="Modify"
  166. id="btnUpdate_foot" class="btn btn-primary btn-xs"
  167. onclick="submitForm();">
  168. @endif
  169. <input type="button" name="btnBackTo2_foot" value="Back"
  170. id="btnBackTo2_foot" class="btn btn-default btn-xs">
  171. </div>
  172. </td>
  173. </tr>
  174. </tbody>
  175. </table>
  176. </div>
  177. </div>
  178. <!-- panel-body -->
  179. </div>
  180. </form>
  181. </div>
  182. </div>
  183. @endsection
  184. @section('extjs')
  185. <script>
  186. $(document).ready(function () {
  187. $("#btnBackTo2").click(function () {
  188. // 上方的返回列表按鈕觸發
  189. location.href = '{{ url('backend/dataManagement/goodManagement') }}';
  190. });
  191. $("#btnBackTo2_foot").click(function () {
  192. // 下方的返回列表按鈕觸發
  193. location.href = '{{ url('backend/dataManagement/goodManagement') }}';
  194. });
  195. // 初始化需要偵錯的表格
  196. $('#EditForm').validate();
  197. // 正規表達驗證初始化
  198. $.validator.addMethod(
  199. "regex",
  200. function (value, element, regexp) {
  201. var re = new RegExp(regexp);
  202. return this.optional(element) || re.test(value);
  203. }
  204. );
  205. // 各欄位
  206. $('#lp').rules("add", {
  207. required: true,
  208. number: true,
  209. minlength: 1,
  210. maxlength: 2,
  211. min: 1,
  212. max: 10,
  213. messages: {
  214. required: "LINE POINT length must between 1-2",
  215. number: "LINE POINT must number",
  216. minlength: "LINE POINT length must between 1-2",
  217. maxlength: "LINE POINT length must between 1-2",
  218. min: "LINE POINT must between 1-10",
  219. max: "LINE POINT must between 1-10"
  220. }
  221. });
  222. $('#gp').rules("add", {
  223. required: true,
  224. number: true,
  225. minlength: 1,
  226. maxlength: 2,
  227. messages: {
  228. required: "吉點 length must between 1-2",
  229. number: "吉點 must number",
  230. minlength: "吉點 length must between 1-2",
  231. maxlength: "吉點 length must between 1-2"
  232. }
  233. });
  234. $('#totalQty').rules("add", {
  235. required: true,
  236. number: true,
  237. minlength: 1,
  238. maxlength: 5,
  239. messages: {
  240. required: "共可發數量 length must between 1-5",
  241. number: "共可發數量 must number",
  242. minlength: "共可發數量 length must between 1-5",
  243. maxlength: "共可發數量 length must between 1-5"
  244. }
  245. });
  246. });
  247. //提交與取消按鈕
  248. function submitForm() {
  249. if (!!($("#EditForm").valid()) === false) {
  250. return false;
  251. } else {
  252. $(document).ready(function () {
  253. $.blockUI({
  254. css: {
  255. border: 'none',
  256. padding: '15px',
  257. backgroundColor: '#000',
  258. '-webkit-border-radius': '10px',
  259. '-moz-border-radius': '10px',
  260. opacity: .5,
  261. color: '#FFF'
  262. }
  263. });
  264. });
  265. }
  266. }
  267. function cancelValidate() {
  268. $("#EditForm").validate().cancelSubmit = true;
  269. }
  270. </script>
  271. @endsection