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

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

bug fixes

  • Property mode set to 100644
File size: 21.3 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
[65fafc4]36 <div class="row">
[194a359]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
[7614db3]115 </tr>
[194a359]116
[65fafc4]117 <div class="col-md-12">
[7614db3]118 <div class="modal fade" id="editModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true">
119 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
120 <div class="modal-content">
121 <div class="modal-header">
122 <h5 class="modal-title" id="exampleModalCenterTitle">Edit user</h5>
123 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
124 <i class="ti-close"></i>
125 </button>
126 </div>
127 <div class="modal-body">
128 <form action="{{ route("dashboard.users.edit", ["id" =>$user->id]) }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
129 @method("patch")
130 @csrf
131 <div class="row">
132 <div class="col-md-6">
133 <div class="form-group">
134 <label>Name</label>
135 <input type="text" name="name" value="{{ $user->name }}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
[c6b84df]136 </div>
[7614db3]137 </div>
138 <div class="col-md-6">
139 <div class="form-group">
140 <label>Surname</label>
141 <input type="text" name="surname" value="{{$user->surname}}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
[c6b84df]142 </div>
143 </div>
[7614db3]144 </div>
145 <div class="row">
146 <div class="col-md-6">
147 <div class="form-group">
148 <label class="form-label">Username</label>
149 <input type="text" name="username" value="{{ $user->username }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
[c6b84df]150 </div>
[7614db3]151 </div>
152 <div class="col-md-6">
153 <div class="form-group">
154 <label class="form-label">Role</label>
[c6b84df]155
[7614db3]156 <select class="form-control" name="userRole" required>
157 @foreach($roles as $role)
158 <option value="{{ $role->id }}" {{ $user->role_id == $role->id ? "selected" : "" }}>{{ $role->name }}</option>
159 @endforeach
160 </select>
[c6b84df]161 </div>
162 </div>
[7614db3]163 </div>
164 <div class="row">
165 <div class="col-md-6">
166 <div class="form-group">
167 <label>Email</label>
168 <input type="email" name="email" value="{{ $user->email }}" maxlength="50" class="form-control" placeholder="E-mail" required>
[c6b84df]169 </div>
170 </div>
[7614db3]171 <div class="col-md-6">
172 <div class="form-group">
173 <label class="form-label">Phone Number</label>
174 <input type="text" name="phone_number" value="{{ $user->phone_number }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
[c6b84df]175 </div>
[7614db3]176 </div>
177 </div>
178 <div class="row">
179 <div class="col-md-5">
180 <div class="form-group">
181 <label>Avatar</label>
182 <input type="file" name="avatar" value="{{ $user->avatar }}" class="form-control" accept="image/*">
[c6b84df]183 </div>
184 </div>
[7614db3]185 <div class="col-md-1">
186 <div class="form-group">
187 <label>Current</label>
188 <figure class="avatar avatar-sm mr-2">
189 @if($user->avatar==NULL)
190 <img src="{{ url('assets/media/images/user.png') }}" class="rounded-circle" alt="avatar">
191 @else
192 <img src="{{url('uploads/users/' . $user->avatar)}}" class="rounded-circle" alt="avatar">
193 @endif
194 </figure>
195 </div>
[e651d0d]196 </div>
[7614db3]197 </div>
198 <div class="modal-footer">
199 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
200 </button>
201 <button type="submit" class="btn btn-primary">Save changes</button>
202 </div>
203 </form>
204 </div>
205
206 </div>
207 </div>
208 </div>
[65fafc4]209 </div>
[194a359]210
[65fafc4]211 <div class="col-md-6">
[7614db3]212 <div class="modal fade" id="deleteModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true">
213 <div class="modal-dialog modal-dialog-centered" role="document">
214 <div class="modal-content">
215 <div class="modal-header">
216 <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
217 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
218 <i class="ti-close"></i>
219 </button>
[e651d0d]220 </div>
[7614db3]221 <div class="modal-body">
222 <form action="{{ route("dashboard.users.destroy", $user->id) }}" method="POST">
223 @csrf
224 @method('DELETE')
225 <p>Are you sure you want to delete user {{$user->username}} ?</p>
226 <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>
227 <div class="modal-footer">
228 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
229 </button>
230 <button type="submit" class="btn btn-primary">Save changes</button>
231 </div>
232 </form>
233 </div>
234
[c6b84df]235 </div>
236 </div>
[7614db3]237 </div>
238 </div>
[e651d0d]239
[c6b84df]240 @endforeach
[194a359]241 </tbody>
242 </table>
[c6b84df]243
[ac3f217]244 </div>
245 </div>
246 </div>
247 </div>
[65fafc4]248 </div>
249
250
251 <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
252 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
253 <div class="modal-content">
254 <div class="modal-header">
255 <h5 class="modal-title" id="exampleModalCenterTitle">Create user</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.store") }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
262 @csrf
263 <div class="row">
264 <div class="col-md-6">
265 <div class="form-group">
266 <label>Name</label>
267 <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
268 </div>
269 </div>
270 <div class="col-md-6">
271 <div class="form-group">
272 <label>Surname</label>
273 <input type="text" name="surname" value="{{ old('surname') }}" minlength="2" maxlength="25" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
274 </div>
275 </div>
276 </div>
277 <div class="row">
278 <div class="col-md-6">
279 <div class="form-group">
280 <label class="form-label">Username</label>
281 <input type="text" name="username" value="{{ old('username') }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
282 </div>
283 </div>
284 <div class="col-md-6">
285 <div class="form-group">
286 <label class="form-label">Role</label>
287 <select class="form-control" name="userRole" required>
288 @foreach ($roles as $role)
289 <option value="{{ $role->id }}" {{ (old("userRole") == $role->id ? "selected" : "" ) }}>{{ $role->name }}</option>
290 @endforeach
291 </select>
292 </div>
293 </div>
294 </div>
295 <div class="row">
296 <div class="col-md-6">
297 <div class="form-group">
298 <label>Email</label>
299 <input type="email" name="email" value="{{ old('email') }}" class="form-control" placeholder="E-mail" required>
300 </div>
301 </div>
302 <div class="col-md-6">
303 <div class="form-group">
304 <label class="form-label">Phone Number</label>
305 <input type="text" name="phone_number" value="{{ old('phone_number') }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
306 </div>
307 </div>
308 </div>
309 <div class="row">
310 <div class="col-md-6">
311 <div class="form-group">
312 <label>Avatar</label>
313 <input type="file" name="avatar" value="{{ old('avatar') }}" class="form-control" accept="image/*">
314 </div>
315 </div>
316 </div>
317 <div class="modal-footer">
318 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
319 </button>
320 <button type="submit" class="btn btn-primary">Save changes</button>
321 </div>
322 </form>
323 </div>
324 </div>
325 </div>
326 </div>
[7614db3]327
[ac3f217]328
[194a359]329
330@endsection
331
332@section('script')
[f5097b2]333 @yield('script')
[24a616f]334 <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
[194a359]335@endsection
Note: See TracBrowser for help on using the repository browser.