Advertisement
Guest User

index

a guest
Sep 16th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.07 KB | None | 0 0
  1. @extends("layouts.global")
  2.  
  3. @section("title") Users list @endsection
  4.  
  5. @section("content")
  6.  
  7.     <form action="{{route('users.index')}}">
  8.         <div class="row">
  9.         <div class="col-md-6">
  10.             <input
  11.              value="{{Request::get('keyword')}}"
  12.              name="keyword"
  13.              class="form-control"
  14.              type="text"
  15.              placeholder="Masukan email untuk filter..."/>
  16.         </div>
  17.         <div class="col-md-6">
  18.             <input {{Request::get('status') == 'ACTIVE' ? 'checked' : ''}}
  19.              value="ACTIVE"
  20.              name="status"
  21.              type="radio"
  22.              class="form-control"
  23.              id="active">
  24.               <label for="active">Active</label>
  25.    
  26.             <input {{Request::get('status') == 'INACTIVE' ? 'checked' : ''}}
  27.              value="INACTIVE"
  28.              name="status"
  29.              type="radio"
  30.              class="form-control"
  31.              id="inactive">
  32.               <label for="inactive">Inactive</label>
  33.    
  34.             <input
  35.              type="submit"
  36.              value="Filter"
  37.              class="btn btn-primary">
  38.         </div>
  39.         </div>
  40.     </form>
  41.  
  42.     <br>
  43.  
  44.     @if(session('status'))
  45.         <div class="alert alert-success">
  46.             {{session('status')}}
  47.         </div>
  48.     @endif
  49.  
  50.     <div class="row">
  51.         <div class="col-md-12 text-right">
  52.             <a href="{{route('users.create')}}" class="btn btn-primary">Create user</a>
  53.         </div>
  54.     </div>
  55.     <br>
  56.  
  57.     <table class="table table-bordered">
  58.         <thead>
  59.         <tr>
  60.             <th><b>Name</b></th>
  61.             <th><b>Username</b></th>
  62.             <th><b>Email</b></th>
  63.             <th><b>Avatar</b></th>
  64.             <th><b>Status</b></th>
  65.             <th><b>Action</b></th>
  66.         </tr>
  67.         </thead>
  68.         <tbody>
  69.         @foreach($users as $user)
  70.             <tr>
  71.                 <td>{{$user->name}}</td>
  72.                 <td>{{$user->username}}</td>
  73.                 <td>{{$user->email}}</td>
  74.                 <td>
  75.                     @if($user->avatar)
  76.                     <img src="{{asset('storage/'.$user->avatar)}}" width="70px"/>
  77.                     @else
  78.                     N/A
  79.                     @endif
  80.  
  81.                 </td>
  82.                 <td>
  83.                     @if($user->status == "ACTIVE")
  84.                     <span class="badge badge-success">
  85.                         {{$user->status}}
  86.                     </span>
  87.                     @else
  88.                     <span class="badge badge-danger">
  89.                         {{$user->status}}
  90.                     </span>
  91.                     @endif
  92.                 </td>
  93.                 <td>
  94.                     {{-- [TODO: actions] --}}
  95.                     <a
  96.                        class="btn btn-info text-white btn-sm"
  97.                        href="{{route('users.edit', [$user->id])}}">Edit</a>
  98.                     <a
  99.                        href="{{route('users.show', [$user->id])}}"
  100.                         class="btn btn-primary btn-sm">Detail</a>
  101.                                        
  102.                     <form
  103.                        onsubmit="return confirm('Delete this user permanently?')"
  104.                        class="d-inline"
  105.                        action="{{route('users.destroy', [$user->id])}}"
  106.                         method="POST">
  107.  
  108.                         @csrf
  109.  
  110.                         <input
  111.                            type="hidden"
  112.                            name="_method"
  113.                            value="DELETE">
  114.  
  115.                         <input
  116.                            type="submit"
  117.                            value="Delete"
  118.                            class="btn btn-danger btn-sm">
  119.                     </form>
  120.                 </td>
  121.             </tr>
  122.         @endforeach
  123.         <tfoot>
  124.             <tr>
  125.                 <td colspan=10>
  126.                 {{$users->links()}}
  127.                 </td>
  128.             </tr>
  129.         </tfoot>
  130.         </tbody>
  131.     </table>
  132.  
  133. @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement