index.blade.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. @extends('layouts.idara.panel')
  2. @section('content')
  3. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js" integrity="sha512-STof4xm1wgkfm7heWqFJVn58Hm3EtS31XFaagaa8VMReCXAkQnJZ+jEy8PCC/iT18dFy95WcExNHFTqLyp72eQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  4. <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js" integrity="sha512-F636MAkMAhtTplahL9F6KmTfxTmYcAcjcCkyu0f0voT3N/6vzAuJ4Num55a0gEJ+hRLHhdz3vDvZpf6kqgEa5w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  5. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" integrity="sha512-hievggED+/IcfxhYRSr4Auo1jbiOczpqpLZwfTVL/6hFACdbI3WQ8S9NCX50gsM9QVE+zLk/8wb9TlgriFbX+Q==" crossorigin="anonymous" referrerpolicy="no-referrer" />
  6. @include('backend.partials.import')
  7. <section style="margin-bottom: 44px;">
  8. <div class="card">
  9. <div class="card-header">
  10. Catégories
  11. </div>
  12. <div class="card-body">
  13. <a href="{{route('categorie.add')}}" class="btn btn-primary">+ Ajouter</a>
  14. <a href="javascript:window.location.href=window.location.href" class="btn btn-secondary"><i class="fa-solid fa-arrows-rotate"></i>Actualiser</a>
  15. </div>
  16. </div>
  17. </section>
  18. @if(session('success'))
  19. <div class="alert alert-success">
  20. {{ session('success') }}
  21. </div>
  22. @endif
  23. @if (count($errors) > 0)
  24. <div class="alert alert-danger">
  25. <strong>Whoops!</strong> Some problems with your input.<br><br>
  26. <ul>
  27. @foreach ($errors->all() as $error)
  28. <li>{{ $error }}</li>
  29. @endforeach
  30. </ul>
  31. </div>
  32. @endif
  33. @if (Session::has('message'))
  34. <div class="alert alert-info">{{ Session::get('message') }}</div>
  35. @endif
  36. <div class="card">
  37. <div class="card-header">
  38. Catégories
  39. </div>
  40. <div class="card-body">
  41. <div class="table-responsive">
  42. <table class="table table-bordered">
  43. <thead>
  44. <tr>
  45. <th scope="col">Nom</th>
  46. <th scope="col">Date</th>
  47. <th scope="col">Action</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. @foreach($articles as $article)
  52. <tr>
  53. <th scope="row">
  54. <a class="title" href="{{ route('category.show',['id'=>$article]) }}" >{{$article->nom}}</a>
  55. </th>
  56. <th scope="row">
  57. {{$article->created_at}}
  58. </th>
  59. <th scope="row" class="buttonOffOut">
  60. <div>
  61. <form action="{{url('categorie/'.$article->id)}}" method="post">
  62. @csrf
  63. @if($article->etat == 1)
  64. <Tooltip title="Masquer">
  65. <input data-id="{{$article->id}}" class="toggle-class" type="checkbox" data-onstyle="success" data-offstyle="danger" data-toggle="toggle" data-on="✔" data-off="⊘" {{ $article->etat ? 'checked' : '' }}>
  66. </Tooltip>
  67. @else
  68. <Tooltip title="Afficher">
  69. <input data-id="{{$article->id}}" class="toggle-class" type="checkbox" data-onstyle="success" data-offstyle="danger" data-toggle="toggle" data-on="✔" data-off="⊘" {{ $article->etat ? 'checked' : '' }}>
  70. </Tooltip>
  71. @endif
  72. <Tooltip title="Voir Plus"> <a href="{{ route('category.show',['id'=>$article]) }}" class="btn btn-xs btn-primary"><i class="fa fa-sign-out" aria-hidden="true"></i></a></Tooltip>
  73. <input name="_method" type="hidden" value="DELETE">
  74. <Tooltip title="Supprimer"> <button type="submit" class="btn btn-xs btn-danger btn-flat show_confirm" data-toggle="tooltip" ref="{{ url('slide/'.$article->id) }}"><i class="fa-solid fa-trash" aria-hidden="true"></i></button></Tooltip>
  75. </form>
  76. </div>
  77. </th>
  78. </tr>
  79. @endforeach
  80. </tbody>
  81. </table>
  82. {!! $articles->links() !!}
  83. </div>
  84. </div>
  85. </div>
  86. @include('backend.partials.alert')
  87. <script>
  88. $(function() {
  89. $('.toggle-class').change(function() {
  90. var etat = $(this).prop('checked') == true ? 1 : 0;
  91. var Id = $(this).data('id');
  92. $.ajax({
  93. type: "GET"
  94. , dataType: "json"
  95. , url: '/changeStatusCategory'
  96. , data: {
  97. 'etat': etat
  98. , 'Id': Id
  99. }
  100. , success: function(data) {
  101. console.log(data.success)
  102. }
  103. });
  104. })
  105. })
  106. </script>
  107. @endsection