[194a359] | 1 | @extends('layouts.app')
|
---|
| 2 |
|
---|
[d795fa6] | 3 | @section("title", "SaveSpace - Users")
|
---|
[194a359] | 4 |
|
---|
[d795fa6] | 5 | @section('pageTitle', 'Users')
|
---|
[194a359] | 6 |
|
---|
| 7 | @section('head')
|
---|
| 8 | <!-- Datatable -->
|
---|
| 9 | <link rel="stylesheet" href="{{ url('vendors/dataTable/dataTables.min.css') }}" type="text/css">
|
---|
[24a616f] | 10 |
|
---|
[194a359] | 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">
|
---|
[c6b84df] | 19 | <a href="{{ url('/') }}">Dashboard</a>
|
---|
[194a359] | 20 | </li>
|
---|
[c6b84df] | 21 | <li class="breadcrumb-item active" aria-current="page">Users</li>
|
---|
[194a359] | 22 | </ol>
|
---|
| 23 | </nav>
|
---|
| 24 | <div class="dropdown">
|
---|
[c6b84df] | 25 | <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">
|
---|
[194a359] | 26 | Add user
|
---|
| 27 | </a>
|
---|
[c6b84df] | 28 | <a href="{{ route('dashboard.users.export') }}" class="btn btn-success text-white">Export table</a>
|
---|
[194a359] | 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>
|
---|
[d795fa6] | 40 | <th></th>
|
---|
[24a616f] | 41 | <th>State</th>
|
---|
[194a359] | 42 | <th>Username</th>
|
---|
| 43 | <th>Name</th>
|
---|
| 44 | <th>Email</th>
|
---|
| 45 | <th>Phone Number</th>
|
---|
[d795fa6] | 46 | <th>Created by</th>
|
---|
[24a616f] | 47 | <th>Created at</th>
|
---|
[d795fa6] | 48 | <th>Updated at</th>
|
---|
[194a359] | 49 | <th>Role</th>
|
---|
[24a616f] | 50 | <th>Status</th>
|
---|
[194a359] | 51 | <th>Actions</th>
|
---|
| 52 | </tr>
|
---|
| 53 | </thead>
|
---|
| 54 | <tbody>
|
---|
| 55 | @foreach($users as $user)
|
---|
| 56 | <tr>
|
---|
[24a616f] | 57 | <td></td>
|
---|
[194a359] | 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>
|
---|
[24a616f] | 70 | @include('dashboard.partials.avatar')
|
---|
| 71 | {{$user->username}}
|
---|
[194a359] | 72 | </td>
|
---|
[24a616f] | 73 | <td>{{$user->name .' '. $user->surname}}</td>
|
---|
[194a359] | 74 | <td>{{$user->email}}</td>
|
---|
[d795fa6] | 75 | <td>{{$user->phone_number}}</td>
|
---|
| 76 | <td>{{ $user->getCreatedByName() }}</td>
|
---|
[ea7b12a] | 77 | <td>{{ date('d.m.Y - H:i', strtotime($user->created_at)) }}</td>
|
---|
[d795fa6] | 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
|
---|
[194a359] | 83 | <td>{{ $user->role->name }}</td>
|
---|
[24a616f] | 84 | <td>
|
---|
| 85 | @if(Cache::has('is_online' . $user->id))
|
---|
[c6b84df] | 86 | <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" style="cursor: pointer;" class="text-success">Online</span>
|
---|
[24a616f] | 87 | @else
|
---|
[c6b84df] | 88 | <span data-toggle="tooltip" data-placement="bottom" title="{{ $user->last_seen }}" class="text-secondary">Offline</span>
|
---|
[24a616f] | 89 | @endif
|
---|
| 90 | </td>
|
---|
[194a359] | 91 | @if($user->hasRole("Referent") && $user->is_confirmed)
|
---|
| 92 | <td>
|
---|
[c6b84df] | 93 | <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$user->id}}" title="Edit">
|
---|
[194a359] | 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
|
---|
[c6b84df] | 101 | <td>Admin</td>
|
---|
[194a359] | 102 | @endif
|
---|
| 103 | </tr>
|
---|
| 104 |
|
---|
[c6b84df] | 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>
|
---|
[194a359] | 186 |
|
---|
[c6b84df] | 187 | </div>
|
---|
| 188 | </div>
|
---|
| 189 | </div>
|
---|
| 190 |
|
---|
| 191 | @endforeach
|
---|
[194a359] | 192 | </tbody>
|
---|
| 193 | </table>
|
---|
[c6b84df] | 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 |
|
---|
[194a359] | 272 | </div>
|
---|
| 273 | </div>
|
---|
| 274 | </div>
|
---|
| 275 | </div>
|
---|
| 276 | </div>
|
---|
| 277 |
|
---|
| 278 | @endsection
|
---|
| 279 |
|
---|
| 280 | @section('script')
|
---|
[24a616f] | 281 | <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
|
---|
[194a359] | 282 | <!-- Datatable -->
|
---|
| 283 | <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
|
---|
| 284 | @endsection
|
---|