123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- @extends('admin.master')
-
- @section('content')
- <div class="row">
- <div class="col-lg-12">
- <!-- 指定新增的端點 -->
- <form id="EditForm" class="form-horizontal" method="post" action="{{ url('/backend/zooManagement/tigerManagement/store') }}">
- {{ csrf_field() }}
- <div class="panel panel-primary">
- <div class="panel-heading">
- <!-- 更改文案 -->
- <h4 class="panel-title">{{ ($operdata == "") ? "Create " : "Modify " }}老虎</h4>
- </div>
- <div class="panel-body">
- <div>
- <!-- 表格本體 -->
- <table class="table" cellspacing="0" id="DetailsView1" style="border-collapse:collapse;">
- <tbody>
- <!-- 欄位:自增量 -->
- @if ($operdata == "")
- <input type="hidden" name="mode" value="insert" />
- <!-- Insert Mode -->
- @else
- <!-- Edit Mode -->
- <tr>
- <td class="col-lg-2">自增量</td>
- <td>
- <input name="id" type="hidden" value="{{ $operdata['id'] }}" id="id" />
- {{ $operdata['id'] }}
- </td>
- </tr>
- @endif
- <!-- 欄位:老虎名字 -->
- <!-- ALL Mode -->
- <tr>
- <td class="header-require col-lg-2">老虎名字</td>
- <td>
- <div class="col-lg-3 nopadding">
- @if ($operdata == "")
- <input name="tigerName" type="text" value="" maxlength="16" id="tigerName" class="form-control">
- @else
- <input name="tigerName" type="text" value="{{ $operdata['tigerName'] }}" maxlength="16" id="tigerName" class="form-control">
- @endif
- <label class="error" for="name"></label>
- </div>
- </td>
- </tr>
- <!-- 下控制按鈕 -->
- <tr>
- <td> </td>
- <td>
- <div style="text-align: right">
- @if ($operdata == "")
- <!-- Insert Mode -->
- <input type="submit" name="btnUpdate_foot" value="Create" id="btnUpdate_foot" class="btn btn-primary btn-xs" onclick="submitForm();">
- @else
- <!-- Edit Mode -->
- <input type="submit" name="btnUpdate_foot" value="Modify" id="btnUpdate_foot" class="btn btn-primary btn-xs" onclick="submitForm();">
- @endif
- <input type="button" name="btnBackTo2_foot" value="Back" id="btnBackTo2_foot" class="btn btn-default btn-xs">
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <!-- panel-body -->
- </div>
- </form>
- </div>
- </div>
- @endsection
-
- @section('extjs')
- <script>
- $(document).ready(function() {
- $("#btnBackTo2").click(function() {
- // 上方的返回列表按鈕觸發
- location.href='{{ url('backend/zooManagement/tigerManagement') }}';
- });
- $("#btnBackTo2_foot").click(function() {
- // 下方的返回列表按鈕觸發
- location.href='{{ url('backend/zooManagement/tigerManagement') }}';
- });
- // 初始化需要偵錯的表格
- $('#EditForm').validate();
- // 正規表達驗證初始化
- $.validator.addMethod(
- "regex",
- function (value, element, regexp) {
- var re = new RegExp(regexp);
- return this.optional(element) || re.test(value);
- }
- );
- // 各欄位
- $('#tigerName').rules("add", {
- required: true,
- minlength: 1,
- maxlength: 16,
- messages: {
- required: "老虎名字 length must between 1-16",
- minlength: "老虎名字 length must between 1-16",
- maxlength: "老虎名字 length must between 1-16"
- }
- });
- });
- //提交與取消按鈕
- function submitForm() {
- if (!!($("#EditForm").valid()) === false) {
- return false;
- } else {
- $(document).ready(function() {
- $.blockUI({ css: {
- border: 'none',
- padding: '15px',
- backgroundColor: '#000',
- '-webkit-border-radius': '10px',
- '-moz-border-radius': '10px',
- opacity: .5,
- color: '#fff'
- }});
- });
- }
- }
- function cancelValidate() {
- $("#EditForm").validate().cancelSubmit = true;
- }
- </script>
- @endsection
|