list.blade.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. @extends('admin.layout.index')
  2. @push('css-head')
  3. @endpush
  4. @section('content')
  5. <!-- Page header -->
  6. <div class="page-header page-header-light">
  7. <div class="breadcrumb-line breadcrumb-line-light header-elements-md-inline">
  8. <div class="d-flex">
  9. <div class="breadcrumb">
  10. <a href="{{url('/admin')}}" class="breadcrumb-item"><i class="icon-home2 mr-2"></i> Dashboard</a>
  11. <span class="breadcrumb-item active">Admins</span>
  12. </div>
  13. </div>
  14. <div class="header-elements d-none">
  15. <div class="breadcrumb justify-content-center">
  16. <a href="{{ url('admin/admins/create') }}" class="breadcrumb-elements-item">
  17. <i class="icon-plus3 mr-2"></i>
  18. Create new
  19. </a>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. <!-- /page header -->
  25. <!-- Content area -->
  26. <div class="content">
  27. <div class="card">
  28. <table class="table datatable-basic">
  29. <thead>
  30. <tr>
  31. <th style="width: 5%;">#</th>
  32. <th>Name</th>
  33. <th>Email</th>
  34. <th>Role</th>
  35. <th>Status</th>
  36. <th class="text-center">Actions</th>
  37. </tr>
  38. </thead>
  39. <tbody>
  40. @foreach($admins as $key => $row)
  41. <tr>
  42. <td>{{ ++$key }}</td>
  43. <td>{{ $row->name }}</td>
  44. <td>{{ $row->email }}</td>
  45. <td>{{ $row->roles->first()?$row->roles->first()->name:'--' }}</td>
  46. <td>
  47. <div class="form-check form-check-switchery">
  48. <label class="form-check-label">
  49. <input type="checkbox" class="form-check-input-switchery switchery" name="status{{ $row->id }}" @if($row->status == 1) {{ 'checked' }} @endif data-id="{{ $row->id }}">
  50. </label>
  51. </div>
  52. </td>
  53. <td class="text-center">
  54. <div class="list-icons">
  55. <div class="dropdown">
  56. <a href="#" class="list-icons-item" data-toggle="dropdown">
  57. <i class="icon-menu9"></i>
  58. </a>
  59. <div class="dropdown-menu dropdown-menu-right">
  60. <a href="{{ url('admin/admins/view') }}/{{ $row->id }}" class="dropdown-item">
  61. <i class="icon-eye"></i> View
  62. </a>
  63. <a href="{{ url('admin/admins/edit') }}/{{ $row->id }}" class="dropdown-item">
  64. <i class="icon-pencil7"></i> Edit
  65. </a>
  66. {!! Form::model($admins, ['method' => 'delete', 'url' => ['admin/admins/delete', $row->id], 'class' =>'dropdown-item form-delete']) !!}
  67. {!! Form::hidden('id', $row->id) !!}
  68. <i class="icon-trash"></i> Delete
  69. {!! Form::close() !!}
  70. </div>
  71. </div>
  72. </div>
  73. </td>
  74. </tr>
  75. @endforeach
  76. </tbody>
  77. </table>
  78. </div>
  79. </div>
  80. <!-- /content area -->
  81. @endsection
  82. @push('scripts')
  83. <script src="{{ asset('/assets/global/js/plugins/notifications/sweet_alert.min.js') }}"></script>
  84. <script src="{{ asset('/assets/global/js/plugins/tables/datatables/datatables.min.js') }}"></script>
  85. <script src="{{ asset('/assets/global/js/demo_pages/datatables_basic.js') }}"></script>
  86. <script src="{{ asset('/assets/global/js/plugins/forms/styling/switchery.min.js') }}"></script>
  87. <script type="text/javascript">
  88. $(document).ready(function(){
  89. $('[data-toggle="tooltip"]').tooltip();
  90. var elem = document.querySelector('.switchery');
  91. var init = new Switchery(elem);
  92. });
  93. </script>
  94. <script type="text/javascript">
  95. $('.form-delete').click(function(e){
  96. e.preventDefault();
  97. $form = $(this);
  98. swal({
  99. title: 'Are you sure?',
  100. text: "You won't be able to revert this!",
  101. type: 'warning',
  102. showCancelButton: true,
  103. confirmButtonColor: '#3085d6',
  104. cancelButtonColor: '#d33',
  105. confirmButtonText: 'Yes, delete it!'
  106. }).then((result) => {
  107. if (result.value) {
  108. $form.submit();
  109. }
  110. });
  111. });
  112. $("input[type='checkbox']").on('click', function(){
  113. var id = $(this).data('id');
  114. var urll="{{ url('admin/admins/status') }}/"+id;
  115. var msg_success = 'Status Updated Successfully.';
  116. var msg_error = 'Something went wrong!';
  117. $.ajax({
  118. url:urll,
  119. success: function(data){
  120. notify('success',msg_success);
  121. },
  122. error: function (data) {
  123. notify('error',msg_error);
  124. }
  125. });
  126. });
  127. </script>
  128. @endpush