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

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

added fileTypes controller, notifications, excel export, edited views

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