暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

create.blade.php 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. @extends('admin.layouts.app')
  2. @section('content')
  3. <div class="card shadow">
  4. <div class="card-header bg-transparent">
  5. <div class="row align-items-center">
  6. <div class="col">
  7. <h6 class="text-uppercase text-muted ls-1 mb-1">{{ $sub_header }}</h6>
  8. <h2 class="mb-0">{{ $header }} Tambah</h2>
  9. </div>
  10. </div>
  11. </div>
  12. <div class="card-body">
  13. <form action="{{ route($route.'create_action') }}" class="form-global-handle" method="POST" enctype="multipart/form-data">
  14. @csrf
  15. <div class="form-group">
  16. <label for="title"> Title <span class="text-danger">*</span> </label>
  17. <input type="text" name="title" value="{{ old('title') }}" class="form-control" required id="title" >
  18. </div>
  19. <div class="form-group">
  20. <label for="content"> Content <span class="text-danger">*</span> </label>
  21. <textarea class="form-control" name="content" id="summernote"></textarea>
  22. </div>
  23. <div class="form-group">
  24. <label for="category"> Category <span class="text-danger">*</span> </label>
  25. <select name="category" id="category" class="form-control" required>
  26. <option value="">-- Pilih Category --</option>
  27. @foreach($categories as $category)
  28. <option value="{{ $category->id }}">{{ $category->name }}</option>
  29. @endforeach
  30. </select>
  31. </div>
  32. <div class="form-group">
  33. <label for="keterangan_kirim">Kirim ke <span class="text-danger">*</span> </label>
  34. <select name="keterangan_kirim" id="keterangan_kirim" class="form-control pilih_penerima" required>
  35. <option value="semua">Semua User</option>
  36. <option value="pilih_user">Pilih User</option>
  37. </select>
  38. </div>
  39. <div class="form-group hide select-user-form-input">
  40. <label for="pilih_user"> Pilih User <span class="text-danger">*</span> </label>
  41. <select name="pilih_user[]" multiple data-metode_id="" data-route="{{route($route.'select_user') }}" class="select-user w-100">
  42. </select>
  43. </div>
  44. <div class="form-group">
  45. <button type="submit" class="btn btn-success">Simpan</button>
  46. <a class="btn btn-default bg-back" href="{{ route($route.'index') }}">Kembali</a>
  47. </div>
  48. </form>
  49. </div>
  50. </div>
  51. @endsection
  52. {{-- load JS yang lu perluin, selain itu no --}}
  53. @push('js')
  54. <script src="{{ asset('assets') }}/js/blockUI.js"></script>
  55. <script src="{{ asset('assets') }}/js/sweetalert2.js"></script>
  56. <script src="{{ asset('assets') }}/js/custom.js"></script>
  57. <script src="{{ asset('assets') }}/vendor/datetimepicker/moment.min.js"></script>
  58. <script src="{{ asset('assets') }}/vendor/datetimepicker/tempusdominus-bootstrap-4.min.js"></script>
  59. <link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.css" rel="stylesheet">
  60. <script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.js"></script>
  61. <script src="{{ asset('assets') }}/js/select2.min.js"></script>
  62. <script>
  63. $('#summernote').summernote({
  64. height: 200
  65. });
  66. $('.pilih_penerima').on('change', function() {
  67. var value = $(this).val()
  68. if(value == 'pilih_user'){
  69. $('.select-user-form-input').removeClass('hide')
  70. }else{
  71. $('.select-user-form-input').addClass('hide')
  72. }
  73. });
  74. var nama_route = 'route'
  75. var id = '.select-user';
  76. var route = $(id).data(nama_route);
  77. $('.select-user').select2({
  78. placeholder: "Pilih User",
  79. ajax: {
  80. url: route,
  81. dataType: 'json',
  82. data: function (params) {
  83. return {
  84. nama: $.trim(params.term),
  85. not_in : $(this).val(),
  86. };
  87. },
  88. processResults: function (data) {
  89. return {
  90. results: data
  91. };
  92. },
  93. cache: true
  94. }
  95. });
  96. </script>
  97. @endpush