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

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

bug fixes

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