[194a359] | 1 | @extends('layouts.app')
|
---|
| 2 |
|
---|
[d795fa6] | 3 | @section("title", "SaveSpace - Users")
|
---|
[194a359] | 4 |
|
---|
| 5 | @section('head')
|
---|
| 6 | <!-- Datatable -->
|
---|
| 7 | <link rel="stylesheet" href="{{ url('vendors/dataTable/dataTables.min.css') }}" type="text/css">
|
---|
[24a616f] | 8 |
|
---|
[194a359] | 9 | @endsection
|
---|
| 10 |
|
---|
| 11 | @section('content')
|
---|
| 12 |
|
---|
| 13 | <div class="page-header justify-content-between">
|
---|
| 14 | <nav aria-label="breadcrumb" class="d-flex align-items-start">
|
---|
| 15 | <ol class="breadcrumb">
|
---|
| 16 | <li class="breadcrumb-item">
|
---|
[c6b84df] | 17 | <a href="{{ url('/') }}">Dashboard</a>
|
---|
[194a359] | 18 | </li>
|
---|
[c6b84df] | 19 | <li class="breadcrumb-item active" aria-current="page">Users</li>
|
---|
[194a359] | 20 | </ol>
|
---|
| 21 | </nav>
|
---|
| 22 | <div class="dropdown">
|
---|
[c6b84df] | 23 | <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">
|
---|
[0208bbd] | 24 | <i class="fa fa-plus pr-1"></i> New
|
---|
| 25 | </a>
|
---|
| 26 | <a href="{{ route('dashboard.users.export') }}" class="btn btn-success text-white">
|
---|
| 27 | <i class="fa fa-table pr-1"></i> Export
|
---|
[194a359] | 28 | </a>
|
---|
| 29 | </div>
|
---|
| 30 | </div>
|
---|
| 31 |
|
---|
| 32 | <div class="row">
|
---|
| 33 | <div class="col-md-12">
|
---|
| 34 | <div class="card">
|
---|
| 35 | <div class="card-body">
|
---|
| 36 | <div class="table-responsive">
|
---|
| 37 | <table id="user-list" class="table table-lg">
|
---|
| 38 | <thead>
|
---|
| 39 | <tr>
|
---|
[d795fa6] | 40 | <th></th>
|
---|
[24a616f] | 41 | <th>State</th>
|
---|
[194a359] | 42 | <th>Username</th>
|
---|
| 43 | <th>Name</th>
|
---|
[d795fa6] | 44 | <th>Created by</th>
|
---|
[24a616f] | 45 | <th>Created at</th>
|
---|
[d795fa6] | 46 | <th>Updated at</th>
|
---|
[24a616f] | 47 | <th>Status</th>
|
---|
[194a359] | 48 | <th>Actions</th>
|
---|
| 49 | </tr>
|
---|
| 50 | </thead>
|
---|
| 51 | <tbody>
|
---|
| 52 | @foreach($users as $user)
|
---|
| 53 | <tr>
|
---|
[24a616f] | 54 | <td></td>
|
---|
[194a359] | 55 | <td>
|
---|
| 56 | @if($user->is_confirmed)
|
---|
| 57 | @if ($user->is_active)
|
---|
| 58 | <span class="badge bg-success-bright text-success">Active</span>
|
---|
| 59 | @else
|
---|
| 60 | <span class="badge bg-danger-bright text-danger">Blocked</span>
|
---|
| 61 | @endif
|
---|
| 62 | @else
|
---|
| 63 | <span class="badge bg-warning-bright text-warning">New user</span>
|
---|
| 64 | @endif
|
---|
| 65 | </td>
|
---|
| 66 | <td>
|
---|
[0208bbd] | 67 | <figure class="avatar avatar-sm mr-2">
|
---|
| 68 | @if($user->avatar==NULL)
|
---|
| 69 | <img src="{{ url('assets/media/images/user.png') }}" class="rounded-circle" alt="avatar">
|
---|
| 70 | @else
|
---|
| 71 | <img src="{{url('uploads/users/' . $user->avatar)}}" class="rounded-circle" alt="avatar">
|
---|
| 72 | @endif
|
---|
| 73 | </figure>
|
---|
[24a616f] | 74 | {{$user->username}}
|
---|
[194a359] | 75 | </td>
|
---|
[4b7e2d3] | 76 | <td>{{$user->name .' '. $user->surname}}
|
---|
| 77 | <div class="font-weight-light p-1">{{$user->role->name}}</div>
|
---|
| 78 | <div class="font-weight-light p-1">{{$user->email}}</div>
|
---|
| 79 | <div class="font-weight-light p-1">{{$user->phone_number}}</div>
|
---|
| 80 | </td>
|
---|
[d795fa6] | 81 | <td>{{ $user->getCreatedByName() }}</td>
|
---|
[ea7b12a] | 82 | <td>{{ date('d.m.Y - H:i', strtotime($user->created_at)) }}</td>
|
---|
[d795fa6] | 83 | @if($user->updated_at==NULL)
|
---|
| 84 | <td>/</td>
|
---|
| 85 | @else
|
---|
| 86 | <td>{{ date('d.m.Y - H:i', strtotime($user->updated_at)) }}</td>
|
---|
| 87 | @endif
|
---|
[24a616f] | 88 | <td>
|
---|
| 89 | @if(Cache::has('is_online' . $user->id))
|
---|
[c6b84df] | 90 | <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" style="cursor: pointer;" class="text-success">Online</span>
|
---|
[24a616f] | 91 | @else
|
---|
[c6b84df] | 92 | <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" class="text-secondary">Offline</span>
|
---|
[24a616f] | 93 | @endif
|
---|
| 94 | </td>
|
---|
[194a359] | 95 | @if($user->hasRole("Referent") && $user->is_confirmed)
|
---|
| 96 | <td>
|
---|
[c6b84df] | 97 | <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$user->id}}" title="Edit">
|
---|
[194a359] | 98 | <i class="ti-pencil"></i>
|
---|
| 99 | </a>
|
---|
| 100 | <a href="javascript:void(0)" class="text-danger ml-2" data-action="{{ route("dashboard.users.destroy", ["id" => $user->id]) }}" data-method="delete" title="Delete">
|
---|
| 101 | <i class="ti-trash"></i>
|
---|
| 102 | </a>
|
---|
| 103 | </td>
|
---|
| 104 | @else
|
---|
[4b7e2d3] | 105 | <td>/</td>
|
---|
[194a359] | 106 | @endif
|
---|
| 107 | </tr>
|
---|
| 108 |
|
---|
[c6b84df] | 109 | <div class="modal fade" id="editModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 110 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
---|
| 111 | <div class="modal-content">
|
---|
| 112 | <div class="modal-header">
|
---|
| 113 | <h5 class="modal-title" id="exampleModalCenterTitle">Edit user</h5>
|
---|
| 114 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 115 | <i class="ti-close"></i>
|
---|
| 116 | </button>
|
---|
| 117 | </div>
|
---|
| 118 | <div class="modal-body">
|
---|
| 119 | <form action="{{ route("dashboard.users.edit", ["id" =>$user->id]) }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
|
---|
| 120 | @method("patch")
|
---|
| 121 | @csrf
|
---|
| 122 | <div class="row">
|
---|
| 123 | <div class="col-md-6">
|
---|
| 124 | <div class="form-group">
|
---|
| 125 | <label>Name</label>
|
---|
| 126 | <input type="text" name="name" value="{{ $user->name }}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
|
---|
| 127 | </div>
|
---|
| 128 | </div>
|
---|
| 129 | <div class="col-md-6">
|
---|
| 130 | <div class="form-group">
|
---|
| 131 | <label>Surname</label>
|
---|
| 132 | <input type="text" name="surname" value="{{$user->surname}}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
|
---|
| 133 | </div>
|
---|
| 134 | </div>
|
---|
| 135 | </div>
|
---|
| 136 | <div class="row">
|
---|
| 137 | <div class="col-md-6">
|
---|
| 138 | <div class="form-group">
|
---|
| 139 | <label class="form-label">Username</label>
|
---|
| 140 | <input type="text" name="username" value="{{ $user->username }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
|
---|
| 141 | </div>
|
---|
| 142 | </div>
|
---|
| 143 | <div class="col-md-6">
|
---|
| 144 | <div class="form-group">
|
---|
| 145 | <label class="form-label">Role</label>
|
---|
| 146 |
|
---|
| 147 | <select class="form-control" name="userRole" required>
|
---|
| 148 | @foreach($roles as $role)
|
---|
| 149 | <option value="{{ $role->id }}" {{ $user->role_id == $role->id ? "selected" : "" }}>{{ $role->name }}</option>
|
---|
| 150 | @endforeach
|
---|
| 151 | </select>
|
---|
| 152 | </div>
|
---|
| 153 | </div>
|
---|
| 154 | </div>
|
---|
| 155 | <div class="row">
|
---|
| 156 | <div class="col-md-6">
|
---|
| 157 | <div class="form-group">
|
---|
| 158 | <label>Email</label>
|
---|
| 159 | <input type="email" name="email" value="{{ $user->email }}" maxlength="50" class="form-control" placeholder="E-mail" required>
|
---|
| 160 | </div>
|
---|
| 161 | </div>
|
---|
| 162 | <div class="col-md-6">
|
---|
| 163 | <div class="form-group">
|
---|
| 164 | <label class="form-label">Phone Number</label>
|
---|
| 165 | <input type="text" name="phone_number" value="{{ $user->phone_number }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
|
---|
| 166 | </div>
|
---|
| 167 | </div>
|
---|
| 168 | </div>
|
---|
| 169 | <div class="row">
|
---|
| 170 | <div class="col-md-5">
|
---|
| 171 | <div class="form-group">
|
---|
| 172 | <label>Avatar</label>
|
---|
| 173 | <input type="file" name="avatar" value="{{ $user->avatar }}" class="form-control" accept="image/*">
|
---|
| 174 | </div>
|
---|
| 175 | </div>
|
---|
| 176 | <div class="col-md-1">
|
---|
| 177 | <div class="form-group">
|
---|
| 178 | <label>Current</label>
|
---|
[0208bbd] | 179 | <figure class="avatar avatar-sm mr-2">
|
---|
| 180 | @if($user->avatar==NULL)
|
---|
| 181 | <img src="{{ url('assets/media/images/user.png') }}" class="rounded-circle" alt="avatar">
|
---|
| 182 | @else
|
---|
| 183 | <img src="{{url('uploads/users/' . $user->avatar)}}" class="rounded-circle" alt="avatar">
|
---|
| 184 | @endif
|
---|
| 185 | </figure>
|
---|
[c6b84df] | 186 | </div>
|
---|
| 187 | </div>
|
---|
| 188 | </div>
|
---|
| 189 | <div class="modal-footer">
|
---|
| 190 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 191 | </button>
|
---|
| 192 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 193 | </div>
|
---|
| 194 | </form>
|
---|
| 195 | </div>
|
---|
[194a359] | 196 |
|
---|
[c6b84df] | 197 | </div>
|
---|
| 198 | </div>
|
---|
| 199 | </div>
|
---|
| 200 |
|
---|
| 201 | @endforeach
|
---|
[194a359] | 202 | </tbody>
|
---|
| 203 | </table>
|
---|
[c6b84df] | 204 |
|
---|
| 205 | <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 206 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
---|
| 207 | <div class="modal-content">
|
---|
| 208 | <div class="modal-header">
|
---|
| 209 | <h5 class="modal-title" id="exampleModalCenterTitle">Create user</h5>
|
---|
| 210 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 211 | <i class="ti-close"></i>
|
---|
| 212 | </button>
|
---|
| 213 | </div>
|
---|
| 214 | <div class="modal-body">
|
---|
| 215 | <form action="{{ route("dashboard.users.store") }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
|
---|
| 216 | @csrf
|
---|
| 217 | <div class="row">
|
---|
| 218 | <div class="col-md-6">
|
---|
| 219 | <div class="form-group">
|
---|
| 220 | <label>Name</label>
|
---|
| 221 | <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
|
---|
| 222 | </div>
|
---|
| 223 | </div>
|
---|
| 224 | <div class="col-md-6">
|
---|
| 225 | <div class="form-group">
|
---|
| 226 | <label>Surname</label>
|
---|
| 227 | <input type="text" name="surname" value="{{ old('surname') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
|
---|
| 228 | </div>
|
---|
| 229 | </div>
|
---|
| 230 | </div>
|
---|
| 231 | <div class="row">
|
---|
| 232 | <div class="col-md-6">
|
---|
| 233 | <div class="form-group">
|
---|
| 234 | <label class="form-label">Username</label>
|
---|
| 235 | <input type="text" name="username" value="{{ old('username') }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
|
---|
| 236 | </div>
|
---|
| 237 | </div>
|
---|
| 238 | <div class="col-md-6">
|
---|
| 239 | <div class="form-group">
|
---|
| 240 | <label class="form-label">Role</label>
|
---|
| 241 | <select class="form-control" name="userRole" required>
|
---|
| 242 | @foreach ($roles as $role)
|
---|
| 243 | <option value="{{ $role->id }}" {{ (old("userRole") == $role->id ? "selected" : "" ) }}>{{ $role->name }}</option>
|
---|
| 244 | @endforeach
|
---|
| 245 | </select>
|
---|
| 246 | </div>
|
---|
| 247 | </div>
|
---|
| 248 | </div>
|
---|
| 249 | <div class="row">
|
---|
| 250 | <div class="col-md-6">
|
---|
| 251 | <div class="form-group">
|
---|
| 252 | <label>Email</label>
|
---|
| 253 | <input type="email" name="email" value="{{ old('email') }}" class="form-control" placeholder="E-mail" required>
|
---|
| 254 | </div>
|
---|
| 255 | </div>
|
---|
| 256 | <div class="col-md-6">
|
---|
| 257 | <div class="form-group">
|
---|
| 258 | <label class="form-label">Phone Number</label>
|
---|
| 259 | <input type="text" name="phone_number" value="{{ old('phone_number') }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
|
---|
| 260 | </div>
|
---|
| 261 | </div>
|
---|
| 262 | </div>
|
---|
| 263 | <div class="row">
|
---|
| 264 | <div class="col-md-6">
|
---|
| 265 | <div class="form-group">
|
---|
| 266 | <label>Avatar</label>
|
---|
| 267 | <input type="file" name="avatar" value="{{ old('avatar') }}" class="form-control" accept="image/*">
|
---|
| 268 | </div>
|
---|
| 269 | </div>
|
---|
| 270 | </div>
|
---|
| 271 | <div class="modal-footer">
|
---|
| 272 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 273 | </button>
|
---|
| 274 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 275 | </div>
|
---|
| 276 | </form>
|
---|
| 277 | </div>
|
---|
| 278 | </div>
|
---|
| 279 | </div>
|
---|
| 280 | </div>
|
---|
| 281 |
|
---|
[194a359] | 282 | </div>
|
---|
| 283 | </div>
|
---|
| 284 | </div>
|
---|
| 285 | </div>
|
---|
| 286 | </div>
|
---|
| 287 |
|
---|
| 288 | @endsection
|
---|
| 289 |
|
---|
| 290 | @section('script')
|
---|
[24a616f] | 291 | <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
|
---|
[194a359] | 292 | <!-- Datatable -->
|
---|
| 293 | <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
|
---|
| 294 | @endsection
|
---|