DC Team 的 Laravel 基底框架、資料庫描述、開發規範、環境佈署、版控規範

TigerManagementEdit.blade.php 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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" action="{{ url('/backend/zooManagement/tigerManagement/store') }}">
  7. {{ csrf_field() }}
  8. <div class="panel panel-primary">
  9. <div class="panel-heading">
  10. <!-- 更改文案 -->
  11. <h4 class="panel-title">{{ ($operdata == "") ? "Create " : "Modify " }}老虎</h4>
  12. </div>
  13. <div class="panel-body">
  14. <div>
  15. <!-- 表格本體 -->
  16. <table class="table" cellspacing="0" id="DetailsView1" style="border-collapse:collapse;">
  17. <tbody>
  18. <!-- 欄位:自增量 -->
  19. @if ($operdata == "")
  20. <input type="hidden" name="mode" value="insert" />
  21. <!-- Insert Mode -->
  22. @else
  23. <!-- Edit Mode -->
  24. <tr>
  25. <td class="col-lg-2">自增量</td>
  26. <td>
  27. <input name="id" type="hidden" value="{{ $operdata['id'] }}" id="id" />
  28. {{ $operdata['id'] }}
  29. </td>
  30. </tr>
  31. @endif
  32. <!-- 欄位:老虎名字 -->
  33. <!-- ALL Mode -->
  34. <tr>
  35. <td class="header-require col-lg-2">老虎名字</td>
  36. <td>
  37. <div class="col-lg-3 nopadding">
  38. @if ($operdata == "")
  39. <input name="tigerName" type="text" value="" maxlength="16" id="tigerName" class="form-control">
  40. @else
  41. <input name="tigerName" type="text" value="{{ $operdata['tigerName'] }}" maxlength="16" id="tigerName" class="form-control">
  42. @endif
  43. <label class="error" for="name"></label>
  44. </div>
  45. </td>
  46. </tr>
  47. <!-- 下控制按鈕 -->
  48. <tr>
  49. <td>&nbsp;</td>
  50. <td>
  51. <div style="text-align: right">
  52. @if ($operdata == "")
  53. <!-- Insert Mode -->
  54. <input type="submit" name="btnUpdate_foot" value="Create" id="btnUpdate_foot" class="btn btn-primary btn-xs" onclick="submitForm();">
  55. @else
  56. <!-- Edit Mode -->
  57. <input type="submit" name="btnUpdate_foot" value="Modify" id="btnUpdate_foot" class="btn btn-primary btn-xs" onclick="submitForm();">
  58. @endif
  59. <input type="button" name="btnBackTo2_foot" value="Back" id="btnBackTo2_foot" class="btn btn-default btn-xs">
  60. </div>
  61. </td>
  62. </tr>
  63. </tbody>
  64. </table>
  65. </div>
  66. </div>
  67. <!-- panel-body -->
  68. </div>
  69. </form>
  70. </div>
  71. </div>
  72. @endsection
  73. @section('extjs')
  74. <script>
  75. $(document).ready(function() {
  76. $("#btnBackTo2").click(function() {
  77. // 上方的返回列表按鈕觸發
  78. location.href='{{ url('backend/zooManagement/tigerManagement') }}';
  79. });
  80. $("#btnBackTo2_foot").click(function() {
  81. // 下方的返回列表按鈕觸發
  82. location.href='{{ url('backend/zooManagement/tigerManagement') }}';
  83. });
  84. // 初始化需要偵錯的表格
  85. $('#EditForm').validate();
  86. // 正規表達驗證初始化
  87. $.validator.addMethod(
  88. "regex",
  89. function (value, element, regexp) {
  90. var re = new RegExp(regexp);
  91. return this.optional(element) || re.test(value);
  92. }
  93. );
  94. // 各欄位
  95. $('#tigerName').rules("add", {
  96. required: true,
  97. minlength: 1,
  98. maxlength: 16,
  99. messages: {
  100. required: "老虎名字 length must between 1-16",
  101. minlength: "老虎名字 length must between 1-16",
  102. maxlength: "老虎名字 length must between 1-16"
  103. }
  104. });
  105. });
  106. //提交與取消按鈕
  107. function submitForm() {
  108. if (!!($("#EditForm").valid()) === false) {
  109. return false;
  110. } else {
  111. $(document).ready(function() {
  112. $.blockUI({ css: {
  113. border: 'none',
  114. padding: '15px',
  115. backgroundColor: '#000',
  116. '-webkit-border-radius': '10px',
  117. '-moz-border-radius': '10px',
  118. opacity: .5,
  119. color: '#fff'
  120. }});
  121. });
  122. }
  123. }
  124. function cancelValidate() {
  125. $("#EditForm").validate().cancelSubmit = true;
  126. }
  127. </script>
  128. @endsection