Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 4.37 KB | None | 0 0
  1. @extends('layout.main')
  2.  
  3. @section('title')
  4.     List Data User
  5. @endsection
  6.  
  7. @section('moreStyle')
  8. <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">
  9. <link rel="stylesheet" type="text/css" href="{{asset('css/sweetalert.css')}}">
  10. @endsection
  11.  
  12. @section('content')
  13.     @if ($errors->count()>0)
  14.         <div class="alert alert-dismissable alert-danger" >
  15.             <button type="button" class="close fade" data-dismiss="alert">&times;</button>
  16.             @foreach ($errors->all() as $error)
  17.                 <p>{{ $error }}</p>
  18.             @endforeach
  19.         </div>
  20.     @endif
  21.     @if (Session::get('message'))
  22.         <div class="alert alert-dismissable alert-success"> <!-- style="color:white; background-color: green; font-weight:bold; padding: 0.5em" -->
  23.             <button type="button" class="close fade" data-dismiss="alert">&times;</button>
  24.             {{Session::get('message')}}
  25.         </div>
  26.     @endif
  27.     <div class="panel" style="margin-left: auto; margin-right: auto; padding : 30px;">
  28.         <div class="judul-halaman">
  29.             <h4><strong>List Data User</strong></h4>
  30.             <hr>
  31.         </div>
  32.         <div class="data-user">
  33.             <table id="listUser" class="table table-striped">
  34.                 <thead>
  35.                 <tr>
  36.                     <th class="col-md-1 text-center"><strong>id user</strong></th>
  37.                     <th class="col-md-3"><strong>Username</strong></th>
  38.                     <th class="col-md-5"><strong>Nama</strong></th>
  39.                     <th class="col-md-1 text-center"><strong>Peran</strong></th>
  40.                     <th class="col-md-2 text-center"><strong>Aksi</strong></th>
  41.                 </tr>
  42.                 </thead>
  43.                 <tbody>
  44.                 @if($users)
  45.                     @foreach($users as $key => $user)
  46.                         <tr>
  47.                             <td class="text-center">{{$key+1}}</td>
  48.                             <td>{{$user->username}}</td>
  49.                             <td>{{$user->nama}}</td>
  50.                             @if($user->role == 1)
  51.                                 <td class="text-center">Mahasiswa</th>
  52.                             @elseif($user->role == 2)
  53.                                 <td class="text-center">Dosen</th>
  54.                             @else
  55.                                 <td class="text-center">Koordinator TA</th>
  56.                             @endif
  57.                             <td>
  58.                                 <div class="text-center">
  59.                                     <button class="btn btn-warning btn-sm" value="{{$user->id_user}}"><i class="glyphicon glyphicon-repeat"></i></button>
  60.                                     <a class="btn btn-info btn-sm" href="{{url('/user/'.$user->id_user)}}"><i class="glyphicon glyphicon-align-justify"></i></a>
  61.                                    
  62.                                 </div>
  63.                             </td>
  64.                         </tr>
  65.                     @endforeach
  66.                 @endif
  67.                 </tbody>
  68.             </table>
  69.         </div>
  70.     </div>
  71.     <form id="resetPassword" method="POST" action="{{url('/resetpass')}}" style="display: none;">
  72.         {{csrf_field()}}
  73.         {{method_field('POST')}}
  74.         <input type="text" id="inpIdUser" name="idUser">
  75.     </form>
  76. @endsection
  77.  
  78. @section('moreScript')
  79. <script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
  80. <script type="text/javascript" src="{{asset('js/sweetalert.min.js')}}"></script>
  81. <script type="text/javascript">
  82.     $(document).ready(function(){
  83.         console.log("YES");
  84.         $('#listUser').DataTable().ajax.reload();
  85.         $('.btn-warning').click( function(){
  86.             console.log("MASUK");
  87.             var idUser = $(this).attr('value');
  88.             console.log(iduser)
  89.             swal({
  90.                 title: "Perhatian",
  91.                 text: "Apakah anda yakin ingin mereset password dari user ini (index) ?",
  92.                 type: "warning",
  93.                 showCancelButton: true,
  94.                 confirmButtonText: "Ya",
  95.                 cancelButtonText: "Batal"
  96.             },
  97.             function(){
  98.                 $('#inpIdUser').val(idUser);
  99.                 $('#resetPassword').submit();
  100.             });
  101.         });
  102.     });
  103. </script>
  104. @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement