source: resources/views/dashboard/users/index.blade.php@ 4d73966

Last change on this file since 4d73966 was 1f7c934, checked in by beratkjufliju <kufliju@…>, 3 years ago

bug fixes

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