1 | @extends('layouts.app')
|
---|
2 |
|
---|
3 | @section("title", "SaveSpace - Users")
|
---|
4 |
|
---|
5 | @section('head')
|
---|
6 |
|
---|
7 | @endsection
|
---|
8 |
|
---|
9 | @section('content')
|
---|
10 |
|
---|
11 | <div class="page-header justify-content-between">
|
---|
12 | <nav aria-label="breadcrumb" class="d-flex align-items-start">
|
---|
13 | <ol class="breadcrumb">
|
---|
14 | <li class="breadcrumb-item">
|
---|
15 | <a href="{{ url('/') }}">Dashboard</a>
|
---|
16 | </li>
|
---|
17 | <li class="breadcrumb-item active" aria-current="page">Users</li>
|
---|
18 | </ol>
|
---|
19 | </nav>
|
---|
20 | <div class="dropdown">
|
---|
21 | @if(auth()->user()->hasPermission('manage_all_users'))
|
---|
22 | <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">
|
---|
23 | New
|
---|
24 | </a>
|
---|
25 | @endif
|
---|
26 | @if(auth()->user()->hasPermission('export_data'))
|
---|
27 | <a href="{{ route('dashboard.users.export') }}" class="btn btn-success text-white">
|
---|
28 | Export
|
---|
29 | </a>
|
---|
30 | @endif
|
---|
31 | </div>
|
---|
32 | </div>
|
---|
33 |
|
---|
34 | <div class="row">
|
---|
35 | <div class="col-md-12">
|
---|
36 | <div class="card">
|
---|
37 | <div class="card-body">
|
---|
38 | <div class="table-responsive">
|
---|
39 | <table id="user-list" class="table">
|
---|
40 | <thead>
|
---|
41 | <tr>
|
---|
42 | <th></th>
|
---|
43 | <th>State</th>
|
---|
44 | <th>Username</th>
|
---|
45 | <th>Name</th>
|
---|
46 | <th>Created by</th>
|
---|
47 | <th>Updated at</th>
|
---|
48 | <th>Status</th>
|
---|
49 | <th>Actions</th>
|
---|
50 | </tr>
|
---|
51 | </thead>
|
---|
52 | <tbody>
|
---|
53 | @foreach($users as $user)
|
---|
54 | <tr>
|
---|
55 | <td></td>
|
---|
56 | <td>
|
---|
57 | @if($user->is_confirmed)
|
---|
58 | @if ($user->is_active)
|
---|
59 | <span class="badge bg-success-bright text-success">Active</span>
|
---|
60 | @else
|
---|
61 | <span class="badge bg-danger-bright text-danger">Blocked</span>
|
---|
62 | @endif
|
---|
63 | @else
|
---|
64 | <span class="badge bg-warning-bright text-warning">New user</span>
|
---|
65 | @endif
|
---|
66 | </td>
|
---|
67 | <td>
|
---|
68 | <figure class="avatar avatar-sm mr-2">
|
---|
69 | @if($user->avatar==NULL)
|
---|
70 | <img src="{{ url('assets/media/images/user.png') }}" class="rounded-circle" alt="avatar">
|
---|
71 | @else
|
---|
72 | <img src="{{url('uploads/users/' . $user->avatar)}}" class="rounded-circle" alt="avatar">
|
---|
73 | @endif
|
---|
74 | </figure>
|
---|
75 | {{$user->username}}
|
---|
76 | </td>
|
---|
77 | <td>{{$user->name .' '. $user->surname}}
|
---|
78 | <div class="font-weight-light p-1">{{$user->role->name}}</div>
|
---|
79 | <div class="font-weight-light p-1">{{$user->email}}</div>
|
---|
80 | <div class="font-weight-light p-1">{{$user->phone_number}}</div>
|
---|
81 | </td>
|
---|
82 | <td>{{ $user->getCreatedByUsername() }}
|
---|
83 | <div class="font-weight-light p-1">{{$user->getCreatedByName()}}</div>
|
---|
84 | <div class="font-weight-light p-1">{{ date('d.m.Y - H:i', strtotime($user->created_at)) }}</div>
|
---|
85 | </td>
|
---|
86 |
|
---|
87 | @if($user->updated_at==NULL)
|
---|
88 | <td>/</td>
|
---|
89 | @else
|
---|
90 | <td>{{ date('d.m.Y - H:i', strtotime($user->updated_at)) }}</td>
|
---|
91 | @endif
|
---|
92 |
|
---|
93 | <td>
|
---|
94 | @if(Cache::has('is_online' . $user->id))
|
---|
95 | <span data-toggle="tooltip" data-placement="bottom" title="{{ \Carbon\Carbon::parse($user->last_seen)->format('d.m.Y - H:i') }}" class="text-success">Online</span>
|
---|
96 | @else
|
---|
97 | @if($user->last_seen == null)
|
---|
98 | <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" class="text-secondary">Offline</span>
|
---|
99 | @else
|
---|
100 | <span data-toggle="tooltip" data-placement="bottom" title="{{ \Carbon\Carbon::parse($user->last_seen)->format('d.m.Y - H:i') }}" class="text-secondary">Offline</span>
|
---|
101 | @endif
|
---|
102 | @endif
|
---|
103 | </td>
|
---|
104 | @if(auth()->user()->hasPermission('manage_all_users') && auth()->user()->id != $user->id)
|
---|
105 | @if($user->hasRole("Referent") || $user->hasRole("Viewer") && $user->is_confirmed)
|
---|
106 | <td>
|
---|
107 | <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$user->id}}" title="Edit">
|
---|
108 | <i class="ti-pencil"></i>
|
---|
109 | </a>
|
---|
110 | @if ($user->is_active)
|
---|
111 | <a href="javascript:void(0)" data-toggle="modal" data-target="#blockModal_{{$user->id}}" class="text-warning ml-2" title="Block">
|
---|
112 | <i class="ti-lock"></i>
|
---|
113 | </a>
|
---|
114 | @else
|
---|
115 | <a href="javascript:void(0)" data-toggle="modal" data-target="#unBlockModal_{{$user->id}}" class="text-warning ml-2" title="Unblock">
|
---|
116 | <i class="ti-unlock"></i>
|
---|
117 | </a>
|
---|
118 | @endif
|
---|
119 | <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$user->id}}" title="Delete">
|
---|
120 | <i class="ti-trash"></i>
|
---|
121 | </a>
|
---|
122 |
|
---|
123 | </td>
|
---|
124 | @else
|
---|
125 | <td>/</td>
|
---|
126 | @endif
|
---|
127 | @else
|
---|
128 | <td></td>
|
---|
129 | @endif
|
---|
130 | </tr>
|
---|
131 |
|
---|
132 | <div class="modal fade" id="editModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
133 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
---|
134 | <div class="modal-content">
|
---|
135 | <div class="modal-header">
|
---|
136 | <h5 class="modal-title" id="exampleModalCenterTitle">Edit user</h5>
|
---|
137 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
138 | <i class="ti-close"></i>
|
---|
139 | </button>
|
---|
140 | </div>
|
---|
141 | <div class="modal-body">
|
---|
142 | <form action="{{ route("dashboard.users.edit", ["id" =>$user->id]) }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
|
---|
143 | @method("patch")
|
---|
144 | @csrf
|
---|
145 | <div class="row">
|
---|
146 | <div class="col-md-6">
|
---|
147 | <div class="form-group">
|
---|
148 | <label>Name</label>
|
---|
149 | <input type="text" name="name" value="{{ $user->name }}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
|
---|
150 | </div>
|
---|
151 | </div>
|
---|
152 | <div class="col-md-6">
|
---|
153 | <div class="form-group">
|
---|
154 | <label>Surname</label>
|
---|
155 | <input type="text" name="surname" value="{{$user->surname}}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
|
---|
156 | </div>
|
---|
157 | </div>
|
---|
158 | </div>
|
---|
159 | <div class="row">
|
---|
160 | <div class="col-md-6">
|
---|
161 | <div class="form-group">
|
---|
162 | <label class="form-label">Username</label>
|
---|
163 | <input type="text" name="username" value="{{ $user->username }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
|
---|
164 | </div>
|
---|
165 | </div>
|
---|
166 | <div class="col-md-6">
|
---|
167 | <div class="form-group">
|
---|
168 | <label class="form-label">Role</label>
|
---|
169 |
|
---|
170 | <select class="form-control" name="userRole" required>
|
---|
171 | @foreach($roles as $role)
|
---|
172 | <option value="{{ $role->id }}" {{ $user->role_id == $role->id ? "selected" : "" }}>{{ $role->name }}</option>
|
---|
173 | @endforeach
|
---|
174 | </select>
|
---|
175 | </div>
|
---|
176 | </div>
|
---|
177 | </div>
|
---|
178 | <div class="row">
|
---|
179 | <div class="col-md-6">
|
---|
180 | <div class="form-group">
|
---|
181 | <label>Email</label>
|
---|
182 | <input type="email" name="email" value="{{ $user->email }}" maxlength="50" class="form-control" placeholder="E-mail" required>
|
---|
183 | </div>
|
---|
184 | </div>
|
---|
185 | <div class="col-md-6">
|
---|
186 | <div class="form-group">
|
---|
187 | <label class="form-label">Phone Number</label>
|
---|
188 | <input type="text" name="phone_number" value="{{ $user->phone_number }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
|
---|
189 | </div>
|
---|
190 | </div>
|
---|
191 | </div>
|
---|
192 | <div class="row">
|
---|
193 | <div class="col-md-5">
|
---|
194 | <div class="form-group">
|
---|
195 | <label>Avatar</label>
|
---|
196 | <input type="file" name="avatar" value="{{ $user->avatar }}" class="form-control" accept="image/*">
|
---|
197 | </div>
|
---|
198 | </div>
|
---|
199 | <div class="col-md-1">
|
---|
200 | <div class="form-group">
|
---|
201 | <label></label>
|
---|
202 | <figure class="avatar avatar-sm mr-2">
|
---|
203 | @if($user->avatar==NULL)
|
---|
204 | <img src="{{ url('assets/media/images/user.png') }}" class="rounded-circle" alt="avatar">
|
---|
205 | @else
|
---|
206 | <img src="{{url('uploads/users/' . $user->avatar)}}" class="rounded-circle" alt="avatar">
|
---|
207 | @endif
|
---|
208 | </figure>
|
---|
209 | </div>
|
---|
210 | </div>
|
---|
211 | </div>
|
---|
212 | <div class="modal-footer">
|
---|
213 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
214 | </button>
|
---|
215 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
216 | </div>
|
---|
217 | </form>
|
---|
218 | </div>
|
---|
219 |
|
---|
220 | </div>
|
---|
221 | </div>
|
---|
222 | </div>
|
---|
223 |
|
---|
224 | <div class="modal fade" id="deleteModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
225 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
226 | <div class="modal-content">
|
---|
227 | <div class="modal-header">
|
---|
228 | <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
|
---|
229 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
230 | <i class="ti-close"></i>
|
---|
231 | </button>
|
---|
232 | </div>
|
---|
233 | <div class="modal-body">
|
---|
234 | <form action="{{ route("dashboard.users.destroy", $user->id) }}" method="POST">
|
---|
235 | @csrf
|
---|
236 | @method('DELETE')
|
---|
237 | <p>Are you sure you want to delete user {{$user->username}} ?</p>
|
---|
238 | <p>Number of folders created: <a href="{{ route("dashboard.folders.index", ['id' => $user->id]) }}" class="text-linkedin">{{\App\Models\Folder::where('user_id', $user->id)->count()}}</a></p>
|
---|
239 | <div class="modal-footer">
|
---|
240 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
241 | </button>
|
---|
242 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
243 | </div>
|
---|
244 | </form>
|
---|
245 | </div>
|
---|
246 |
|
---|
247 | </div>
|
---|
248 | </div>
|
---|
249 | </div>
|
---|
250 |
|
---|
251 | <div class="modal fade" id="blockModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
252 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
253 | <div class="modal-content">
|
---|
254 | <div class="modal-header">
|
---|
255 | <h5 class="modal-title" id="exampleModalCenterTitle">Block confirmation</h5>
|
---|
256 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
257 | <i class="ti-close"></i>
|
---|
258 | </button>
|
---|
259 | </div>
|
---|
260 | <div class="modal-body">
|
---|
261 | <form action="{{ route("dashboard.users.block", $user->id) }}" method="POST">
|
---|
262 | @csrf
|
---|
263 | @method('patch')
|
---|
264 | <p>Are you sure you want to block user {{$user->username}} ?</p>
|
---|
265 | <p>Number of folders created: <a href="{{ route("dashboard.folders.index", ['id' => $user->id]) }}" class="text-linkedin">{{\App\Models\Folder::where('user_id', $user->id)->count()}}</a></p>
|
---|
266 | <div class="modal-footer">
|
---|
267 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
268 | </button>
|
---|
269 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
270 | </div>
|
---|
271 | </form>
|
---|
272 | </div>
|
---|
273 |
|
---|
274 | </div>
|
---|
275 | </div>
|
---|
276 | </div>
|
---|
277 |
|
---|
278 |
|
---|
279 | <div class="modal fade" id="unBlockModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
280 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
281 | <div class="modal-content">
|
---|
282 | <div class="modal-header">
|
---|
283 | <h5 class="modal-title" id="exampleModalCenterTitle">Unblock confirmation</h5>
|
---|
284 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
285 | <i class="ti-close"></i>
|
---|
286 | </button>
|
---|
287 | </div>
|
---|
288 | <div class="modal-body">
|
---|
289 | <form action="{{ route("dashboard.users.unblock", $user->id) }}" method="POST">
|
---|
290 | @csrf
|
---|
291 | @method('patch')
|
---|
292 | <p>Are you sure you want to block user {{$user->username}} ?</p>
|
---|
293 | <p>Number of folders created: <a href="{{ route("dashboard.folders.index", ['id' => $user->id]) }}" class="text-linkedin">{{\App\Models\Folder::where('user_id', $user->id)->count()}}</a></p>
|
---|
294 | <div class="modal-footer">
|
---|
295 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
296 | </button>
|
---|
297 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
298 | </div>
|
---|
299 | </form>
|
---|
300 | </div>
|
---|
301 |
|
---|
302 | </div>
|
---|
303 | </div>
|
---|
304 | </div>
|
---|
305 |
|
---|
306 | @endforeach
|
---|
307 | </tbody>
|
---|
308 | </table>
|
---|
309 |
|
---|
310 | </div>
|
---|
311 | </div>
|
---|
312 | </div>
|
---|
313 | </div>
|
---|
314 | </div>
|
---|
315 |
|
---|
316 |
|
---|
317 | <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
318 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
---|
319 | <div class="modal-content">
|
---|
320 | <div class="modal-header">
|
---|
321 | <h5 class="modal-title" id="exampleModalCenterTitle">Create user</h5>
|
---|
322 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
323 | <i class="ti-close"></i>
|
---|
324 | </button>
|
---|
325 | </div>
|
---|
326 | <div class="modal-body">
|
---|
327 | <form action="{{ route("dashboard.users.store") }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
|
---|
328 | @csrf
|
---|
329 | <div class="row">
|
---|
330 | <div class="col-md-6">
|
---|
331 | <div class="form-group">
|
---|
332 | <label>Name</label>
|
---|
333 | <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
|
---|
334 | </div>
|
---|
335 | </div>
|
---|
336 | <div class="col-md-6">
|
---|
337 | <div class="form-group">
|
---|
338 | <label>Surname</label>
|
---|
339 | <input type="text" name="surname" value="{{ old('surname') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
|
---|
340 | </div>
|
---|
341 | </div>
|
---|
342 | </div>
|
---|
343 | <div class="row">
|
---|
344 | <div class="col-md-6">
|
---|
345 | <div class="form-group">
|
---|
346 | <label class="form-label">Username</label>
|
---|
347 | <input type="text" name="username" value="{{ old('username') }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
|
---|
348 | </div>
|
---|
349 | </div>
|
---|
350 | <div class="col-md-6">
|
---|
351 | <div class="form-group">
|
---|
352 | <label class="form-label">Role</label>
|
---|
353 | <select class="form-control" name="userRole" required>
|
---|
354 | @foreach ($roles as $role)
|
---|
355 | <option value="{{ $role->id }}" {{ (old("userRole") == $role->id ? "selected" : "" ) }}>{{ $role->name }}</option>
|
---|
356 | @endforeach
|
---|
357 | </select>
|
---|
358 | </div>
|
---|
359 | </div>
|
---|
360 | </div>
|
---|
361 | <div class="row">
|
---|
362 | <div class="col-md-6">
|
---|
363 | <div class="form-group">
|
---|
364 | <label>Email</label>
|
---|
365 | <input type="email" name="email" value="{{ old('email') }}" class="form-control" placeholder="E-mail" required>
|
---|
366 | </div>
|
---|
367 | </div>
|
---|
368 | <div class="col-md-6">
|
---|
369 | <div class="form-group">
|
---|
370 | <label class="form-label">Phone Number</label>
|
---|
371 | <input type="text" name="phone_number" value="{{ old('phone_number') }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
|
---|
372 | </div>
|
---|
373 | </div>
|
---|
374 | </div>
|
---|
375 | <div class="row">
|
---|
376 | <div class="col-md-6">
|
---|
377 | <div class="form-group">
|
---|
378 | <label>Avatar</label>
|
---|
379 | <input type="file" name="avatar" value="{{ old('avatar') }}" class="form-control" accept="image/*">
|
---|
380 | </div>
|
---|
381 | </div>
|
---|
382 | </div>
|
---|
383 | <div class="modal-footer">
|
---|
384 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
385 | </button>
|
---|
386 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
387 | </div>
|
---|
388 | </form>
|
---|
389 | </div>
|
---|
390 | </div>
|
---|
391 | </div>
|
---|
392 | </div>
|
---|
393 |
|
---|
394 | @endsection
|
---|
395 |
|
---|
396 | @section('script')
|
---|
397 | @yield('script')
|
---|
398 | <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
|
---|
399 | @endsection
|
---|