edit.blade.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. @extends('admin/public/layout')
  2. @section('title')编辑分类@endsection
  3. @section('content')
  4. <section class="content-header">
  5. <h1>编辑分类</h1>
  6. </section>
  7. <section class="content">
  8. <div class="row">
  9. <div class="col-xs-12">
  10. <div class="box box-primary">
  11. <form role="form" name="editForm" method="POST" action="{{ route('admin.category.update',['id'=>$category->id]) }}">
  12. <input name="_method" type="hidden" value="PUT">
  13. <input type="hidden" name="_token" value="{{ csrf_token() }}">
  14. <div class="box-body">
  15. <div class="form-group @if($errors->has('name')) has-error @endif">
  16. <label>分类名称</label>
  17. <input type="text" name="name" class="form-control " placeholder="分类名称" value="{{ old('name',$category->name) }}">
  18. @if($errors->has('name')) <p class="help-block">{{ $errors->first('name') }}</p> @endif
  19. </div>
  20. <div class="form-group @if($errors->has('slug')) has-error @endif">
  21. <label>分类标识</label>
  22. <span class="text-muted">(英文字母)</span>
  23. <input type="text" name="slug" class="form-control " placeholder="分类标识" value="{{ old('slug',$category->slug) }}">
  24. @if($errors->has('slug')) <p class="help-block">{{ $errors->first('slug') }}</p> @endif
  25. </div>
  26. <div class="form-group">
  27. <label>栏目</label>
  28. <span class="text-muted">(允许显示的栏目)</span>
  29. <div class="checkbox">
  30. @foreach( config('tipask.category_types') as $key => $name )
  31. <input type="checkbox" name="types[]" value="{{ $key }}" @if(str_contains($category->type,$key)) checked @endif > {{ $name }} &nbsp;&nbsp;
  32. @endforeach
  33. </div>
  34. </div>
  35. <div class="form-group @if($errors->has('sort')) has-error @endif">
  36. <label>排序</label>
  37. <span class="text-muted">(仅对当前层级分类有效)</span>
  38. <input type="text" name="sort" class="form-control " placeholder="排序" value="{{ old('sort',$category->sort) }}">
  39. @if($errors->has('sort')) <p class="help-block">{{ $errors->first('sort') }}</p> @endif
  40. </div>
  41. <div class="form-group">
  42. <label>状态</label>
  43. <span class="text-muted">(禁用后前台不会显示)</span>
  44. <div class="radio">
  45. <label>
  46. <input type="radio" name="status" value="1" checked /> 启用
  47. </label>&nbsp;&nbsp;
  48. <label>
  49. <input type="radio" name="status" value="0" /> 禁用
  50. </label>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="box-footer">
  55. <button type="submit" class="btn btn-primary">保存</button>
  56. <button type="reset" class="btn btn-success">重置</button>
  57. </div>
  58. </form>
  59. </div>
  60. </div>
  61. </div>
  62. </section>
  63. @endsection
  64. @section('script')
  65. <script type="text/javascript">
  66. set_active_menu('manage_content',"{{ route('admin.category.index') }}");
  67. $(function(){
  68. var parent_id = "{{ $category->parent_id }}";
  69. $("#parent_id option").each(function(){
  70. if( $(this).val() == parent_id ){
  71. $(this).attr("selected","selected");
  72. }
  73. });
  74. });
  75. </script>
  76. @endsection