12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <!--
- Copyright (C) 2021 Echedey López Romero <elr@disroot.org>
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
- @extends('layouts.app')
- @section('content')
- <div class="container">
- <div class="row mb-3">
- <h1 class="col-12 mb-0 text-center">Users list</h1>
- </div>
- @if (Session::get('success'))
- @php $message = Session::get('success'); @endphp
- <div class = "row mb-3">
- <span class="col-xl-6 col-lg-8 col-md-10 col-12 mx-auto mb-0 alert alert-success">{{ $message }}</span>
- </div>
- @endif
- <div class="row">
- <div class="col-lg-10 col-12 mx-auto">
- <div class="container">
- <div class="row">
- <form class="col-xl-6 col-lg-8 col-md-10 col-12 mx-auto" action="{{ route('users.search') }}" method="POST">
- @csrf
- <input class="form-control" name="search" type="text" value="{{ isset($oldSearch) ? $oldSearch : '' }}" placeholder="Search by name and email"/>
- </form>
- </div>
- @if (count($users) !== 0)
- @foreach ($users as $user)
- <div class="row mt-3">
- <div class="col-xl-7 col-lg-10 col-12 mx-auto p-3 border border-secondary rounded">
- <div class="container px-0">
- <div class="row mb-3">
- <span class="col-12 text-center fs-4">{{ $user->name }}</span>
- </div>
- <div class="row">
- <div class="col-md-4 col-12 mb-md-0 mb-2 pe-md-2">
- <div class="d-grid gap-2">
- <a href="{{ route('users.show', $user->id) }}" class="btn btn-primary">Show</a>
- </div>
- </div>
- <div class="col-md-4 col-12 mb-md-0 mb-2 ps-md-2 pe-md-2">
- <div class="d-grid gap-2">
- <a href="{{ route('users.edit', $user->id) }}" class="btn btn-warning">Edit</a>
- </div>
- </div>
- <form action="{{ route('users.destroy', $user->id) }}" method="POST" class="col-md-4 col-12 ps-md-2" onsubmit="return window.confirm('Do you want to remove this user?')">
- @csrf
- @method('DELETE')
- <div class="d-grid gap-2">
- <button type="submit" class="btn btn-danger">Delete</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- @endforeach
- <div class="row mt-3">
- <div class="d-flex col-12 justify-content-center">
- {{ $users->links() }}
- </div>
- </div>
- @else
- <div class="row mt-3">
- <div class='col-xl-6 col-lg-8 col-md-10 col-12 mx-auto text-center'>
- <span>There are not users.</span>
- </div>
- </div>
- @endif
- </div>
- </div>
- </div>
- </div>
- @endsection
|