create.blade.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. @extends('layouts.app')
  2. @section('title')创建教程@endsection
  3. @section('head')
  4. @trixassets
  5. @endsection
  6. @section('content')
  7. <div id="nav2">
  8. @component('maintenance.menu')@endcomponent
  9. @component('maintenance.tutorial.menu')@endcomponent
  10. </div>
  11. <div class="card col-md-8 offset-md-2" id="tutorial">
  12. <div class="card-body">
  13. <form method="POST" action="{{ url('maintenance/tutorial') }}">
  14. @csrf
  15. <div class="form-group row">
  16. <label for="owner_id" class="col-2 col-form-label text-right">所属货主</label>
  17. <div class="col-8">
  18. <select @if(isset($owner_id)) v-model="owner_id" @endif name="owner_id" class="form-control @error('owner_id') is-invalid @enderror" style="width: 50%">
  19. <option v-for="owner in owners" :value="owner.id">@{{ owner.name }}</option>
  20. </select>
  21. </div>
  22. </div>
  23. <div class="form-group row">
  24. <label for="name" class="col-2 col-form-label text-right">标题</label>
  25. <div class="col-8">
  26. <input type="text" class="form-control @error('name') is-invalid @enderror"
  27. name="name" autocomplete="off" value="{{ old('name') }}" required>
  28. @error('name')
  29. <span class="invalid-feedback" role="alert">
  30. <strong>{{ $errors->first('name') }}</strong>
  31. </span>
  32. @enderror
  33. </div>
  34. </div>
  35. <div id="for-trix"></div>
  36. <div class="form-group row">
  37. <label for="initial_weight" class="col-2 col-form-label text-right">内容</label>
  38. <div class="col-8" id="content"></div>
  39. </div>
  40. <div class="form-group row">
  41. <label for="type" class="col-2 col-form-label text-right">类型</label>
  42. <div class="col-8">
  43. <select name="type" class="form-control" style="width: 50%;">
  44. <option value="二次加工">二次加工</option>
  45. </select>
  46. </div>
  47. </div>
  48. <div class="form-group row">
  49. <div class="col-8 offset-2">
  50. <input type="submit" class="btn btn-success form-control">
  51. </div>
  52. </div>
  53. </form>
  54. </div>
  55. </div>
  56. </div>
  57. <div id="trix">
  58. @trix(\App\Tutorial::class, 'content')
  59. </div>
  60. @endsection
  61. @section('lastScript')
  62. <script>
  63. new Vue({
  64. el:"#tutorial",
  65. data:{
  66. owners:[
  67. @foreach($owners as $owner)
  68. {!! $owner !!},
  69. @endforeach
  70. ],
  71. @if(isset($owner_id)) owner_id:'{{$owner_id}}', @endif
  72. },
  73. mounted() {
  74. let trix=$("#trix");
  75. $("#content").append(trix);
  76. },
  77. });
  78. </script>
  79. @endsection