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

develop
Last change on this file since 2eee9a0 was 4b7e2d3, checked in by beratkjufliju <kufliju@…>, 3 years ago

bug fixes, edited export, added fileSeeder for DB testing

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