index.blade.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. @extends('backend.layouts.app')
  2. @section('content')
  3. <div class="aiz-titlebar text-left mt-2 mb-3">
  4. <div class="row align-items-center">
  5. <!--<div class="col-auto">-->
  6. <!-- <h1 class="h3">{{translate('All Posts')}}</h1>-->
  7. <!--</div>-->
  8. <div class="col text-left">
  9. <a href="{{ route('blog.create') }}" class="btn btn-circle btn-info">
  10. <span>{{translate('Add New Post')}}</span>
  11. </a>
  12. </div>
  13. </div>
  14. </div>
  15. <br>
  16. <div class="card">
  17. <form class="" id="sort_blogs" action="" method="GET">
  18. <div class="card-header row gutters-5">
  19. <div class="col text-center text-md-left">
  20. <h5 class="mb-md-0 h6">{{ translate('All blog posts') }}</h5>
  21. </div>
  22. <div class="col-md-2">
  23. <div class="form-group mb-0">
  24. <input type="text" class="form-control form-control-sm" id="search" name="search"@isset($sort_search) value="{{ $sort_search }}" @endisset placeholder="{{ translate('Type & Enter') }}">
  25. </div>
  26. </div>
  27. </div>
  28. </from>
  29. <div class="card-body">
  30. <table class="table mb-0 aiz-table">
  31. <thead>
  32. <tr>
  33. <th>#</th>
  34. <th>{{translate('Title')}}</th>
  35. <th data-breakpoints="lg">{{translate('Category')}}</th>
  36. <th data-breakpoints="lg">{{translate('Short Description')}}</th>
  37. <th data-breakpoints="lg">{{translate('Status')}}</th>
  38. <th class="text-right">{{translate('Options')}}</th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. @foreach($blogs as $key => $blog)
  43. <tr>
  44. <td>
  45. {{ ($key+1) + ($blogs->currentPage() - 1) * $blogs->perPage() }}
  46. </td>
  47. <td>
  48. {{ $blog->title }}
  49. </td>
  50. <td>
  51. @if($blog->category != null)
  52. {{ $blog->category->category_name }}
  53. @else
  54. --
  55. @endif
  56. </td>
  57. <td>
  58. {{ $blog->short_description }}
  59. </td>
  60. <td>
  61. <label class="aiz-switch aiz-switch-success mb-0">
  62. <input type="checkbox" onchange="change_status(this)" value="{{ $blog->id }}" <?php if($blog->status == 1) echo "checked";?>>
  63. <span></span>
  64. </label>
  65. </td>
  66. <td class="text-right">
  67. <a class="btn btn-soft-primary btn-icon btn-circle btn-sm" href="{{ route('blog.edit',$blog->id)}}" title="{{ translate('Edit') }}">
  68. <i class="las la-pen"></i>
  69. </a>
  70. <a href="#" class="btn btn-soft-danger btn-icon btn-circle btn-sm confirm-delete" data-href="{{route('blog.destroy', $blog->id)}}" title="{{ translate('Delete') }}">
  71. <i class="las la-trash"></i>
  72. </a>
  73. </td>
  74. </tr>
  75. @endforeach
  76. </tbody>
  77. </table>
  78. <div class="aiz-pagination">
  79. {{ $blogs->links() }}
  80. </div>
  81. </div>
  82. </div>
  83. @endsection
  84. @section('modal')
  85. @include('modals.delete_modal')
  86. @endsection
  87. @section('script')
  88. <script type="text/javascript">
  89. function change_status(el){
  90. var status = 0;
  91. if(el.checked){
  92. var status = 1;
  93. }
  94. $.post('{{ route('blog.change-status') }}', {_token:'{{ csrf_token() }}', id:el.value, status:status}, function(data){
  95. if(data == 1){
  96. AIZ.plugins.notify('success', '{{ translate('Change blog status successfully') }}');
  97. }
  98. else{
  99. AIZ.plugins.notify('danger', '{{ translate('Something went wrong') }}');
  100. }
  101. });
  102. }
  103. </script>
  104. @endsection