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

develop
Last change on this file since cb88e9f was cb88e9f, checked in by Berat Kjufliju <kufliju@…>, 3 years ago

bug fixes

  • Property mode set to 100644
File size: 22.7 KB
Line 
1@extends('layouts.app')
2
3@section("title", "SaveSpace - Users")
4
5@section('head')
6 <!-- Datatable -->
7{{-- <link rel="stylesheet" href="{{ url('vendors/dataTable/dataTables.min.css') }}" type="text/css">--}}
8
9@endsection
10
11@section('content')
12
13
14 <div class="row app-block mb-4">
15 <div class="page-header justify-content-between">
16 <nav aria-label="breadcrumb" class="d-flex align-items-start">
17 <ol class="breadcrumb">
18 <li class="breadcrumb-item">
19 <a href="{{ url('/') }}">Dashboard</a>
20 </li>
21 <li class="breadcrumb-item active" aria-current="page">Users</li>
22 </ol>
23 </nav>
24 <div class="dropdown">
25 @if(auth()->user()->hasPermission('manage_all_users'))
26 <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">
27 New
28 </a>
29 @endif
30 @if(auth()->user()->hasPermission('export_data'))
31 <a href="{{ route('dashboard.users.export') }}" class="btn btn-success text-white">
32 Export
33 </a>
34 @endif
35 </div>
36 </div>
37
38 <div class="row">
39 <div class="col-md-12">
40 <div class="card">
41 <div class="card-body">
42 <div class="table-responsive">
43 <table id="user-list" class="table table-lg">
44 <thead>
45 <tr>
46 <th></th>
47 <th>State</th>
48 <th>Username</th>
49 <th>Name</th>
50 <th>Created by</th>
51 <th>Created at</th>
52 <th>Updated at</th>
53 <th>Status</th>
54 <th>Actions</th>
55 </tr>
56 </thead>
57 <tbody>
58 @foreach($users as $user)
59 <tr>
60 <td></td>
61 <td>
62 @if($user->is_confirmed)
63 @if ($user->is_active)
64 <span class="badge bg-success-bright text-success">Active</span>
65 @else
66 <span class="badge bg-danger-bright text-danger">Blocked</span>
67 @endif
68 @else
69 <span class="badge bg-warning-bright text-warning">New user</span>
70 @endif
71 </td>
72 <td>
73 <figure class="avatar avatar-sm mr-2">
74 @if($user->avatar==NULL)
75 <img src="{{ url('assets/media/images/user.png') }}" class="rounded-circle" alt="avatar">
76 @else
77 <img src="{{url('uploads/users/' . $user->avatar)}}" class="rounded-circle" alt="avatar">
78 @endif
79 </figure>
80 {{$user->username}}
81 </td>
82 <td>{{$user->name .' '. $user->surname}}
83 <div class="font-weight-light p-1">{{$user->role->name}}</div>
84 <div class="font-weight-light p-1">{{$user->email}}</div>
85 <div class="font-weight-light p-1">{{$user->phone_number}}</div>
86 </td>
87 <td>{{ $user->getCreatedByName() }}</td>
88 <td>{{ date('d.m.Y - H:i', strtotime($user->created_at)) }}</td>
89 @if($user->updated_at==NULL)
90 <td>/</td>
91 @else
92 <td>{{ date('d.m.Y - H:i', strtotime($user->updated_at)) }}</td>
93 @endif
94 <td>
95 @if(Cache::has('is_online' . $user->id))
96 <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" style="cursor: pointer;" class="text-success">Online</span>
97 @else
98 <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" class="text-secondary">Offline</span>
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 @endforeach
238 </tbody>
239 </table>
240
241 <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
242 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
243 <div class="modal-content">
244 <div class="modal-header">
245 <h5 class="modal-title" id="exampleModalCenterTitle">Create user</h5>
246 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
247 <i class="ti-close"></i>
248 </button>
249 </div>
250 <div class="modal-body">
251 <form action="{{ route("dashboard.users.store") }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
252 @csrf
253 <div class="row">
254 <div class="col-md-6">
255 <div class="form-group">
256 <label>Name</label>
257 <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
258 </div>
259 </div>
260 <div class="col-md-6">
261 <div class="form-group">
262 <label>Surname</label>
263 <input type="text" name="surname" value="{{ old('surname') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
264 </div>
265 </div>
266 </div>
267 <div class="row">
268 <div class="col-md-6">
269 <div class="form-group">
270 <label class="form-label">Username</label>
271 <input type="text" name="username" value="{{ old('username') }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
272 </div>
273 </div>
274 <div class="col-md-6">
275 <div class="form-group">
276 <label class="form-label">Role</label>
277 <select class="form-control" name="userRole" required>
278 @foreach ($roles as $role)
279 <option value="{{ $role->id }}" {{ (old("userRole") == $role->id ? "selected" : "" ) }}>{{ $role->name }}</option>
280 @endforeach
281 </select>
282 </div>
283 </div>
284 </div>
285 <div class="row">
286 <div class="col-md-6">
287 <div class="form-group">
288 <label>Email</label>
289 <input type="email" name="email" value="{{ old('email') }}" class="form-control" placeholder="E-mail" required>
290 </div>
291 </div>
292 <div class="col-md-6">
293 <div class="form-group">
294 <label class="form-label">Phone Number</label>
295 <input type="text" name="phone_number" value="{{ old('phone_number') }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
296 </div>
297 </div>
298 </div>
299 <div class="row">
300 <div class="col-md-6">
301 <div class="form-group">
302 <label>Avatar</label>
303 <input type="file" name="avatar" value="{{ old('avatar') }}" class="form-control" accept="image/*">
304 </div>
305 </div>
306 </div>
307 <div class="modal-footer">
308 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
309 </button>
310 <button type="submit" class="btn btn-primary">Save changes</button>
311 </div>
312 </form>
313 </div>
314 </div>
315 </div>
316 </div>
317
318 </div>
319 </div>
320 </div>
321 </div>
322 </div>
323 </div>
324
325@endsection
326
327@section('script')
328 @yield('script')
329 <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
330@endsection
Note: See TracBrowser for help on using the repository browser.