source: resources/views/dashboard/users/index.blade.php@ 1f7c934

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

bug fixes

  • Property mode set to 100644
File size: 21.4 KB
Line 
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>Created at</th>
48 <th>Updated at</th>
49 <th>Status</th>
50 <th>Actions</th>
51 </tr>
52 </thead>
53 <tbody>
54 @foreach($users as $user)
55 <tr>
56 <td></td>
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>
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>
76 {{$user->username}}
77 </td>
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>
83 <td>{{ $user->getCreatedByName() }}</td>
84 <td>{{ date('d.m.Y - H:i', strtotime($user->created_at)) }}</td>
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
90 <td>
91 @if(Cache::has('is_online' . $user->id))
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>
93 @else
94 @if($user->last_seen == null)
95 <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" class="text-secondary">Offline</span>
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
99 @endif
100 </td>
101 @if(auth()->user()->hasPermission('manage_all_users'))
102 @if($user->hasRole("Referent") || $user->hasRole("Viewer") && $user->is_confirmed)
103 <td>
104 <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$user->id}}" title="Edit">
105 <i class="ti-pencil"></i>
106 </a>
107 <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$user->id}}" title="Delete">
108 <i class="ti-trash"></i>
109 </a>
110 </td>
111 @else
112 <td>/</td>
113 @endif
114 @else
115 <td></td>
116 @endif
117 </tr>
118
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>
137 </div>
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>
143 </div>
144 </div>
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>
151 </div>
152 </div>
153 <div class="col-md-6">
154 <div class="form-group">
155 <label class="form-label">Role</label>
156
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>
162 </div>
163 </div>
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>
170 </div>
171 </div>
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>
176 </div>
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/*">
184 </div>
185 </div>
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>
197 </div>
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>
210
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>
219 </div>
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
234 </div>
235 </div>
236 </div>
237
238 @endforeach
239 </tbody>
240 </table>
241
242 </div>
243 </div>
244 </div>
245 </div>
246 </div>
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>
325
326@endsection
327
328@section('script')
329 @yield('script')
330 <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
331@endsection
Note: See TracBrowser for help on using the repository browser.