create.blade.php 3.5 KB

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