This commit is contained in:
Marley Rae 2022-04-26 20:35:32 -07:00
parent 5bff8d70a0
commit 651b5b5412
5 changed files with 38 additions and 13 deletions

View file

@ -11,14 +11,20 @@ class ListFanlistings extends Component
use WithPagination;
public string $class;
public string $searchTerm = '';
public function mount($class)
{
$this->class = strtolower($class);
}
public function render()
{
if ($this->class == 'joined') {
$fanlistings = auth_collective()->joined()->paginate(8);
} elseif ($this->class == 'owned') {
// TODO: add owned class
}
$search = '%' . $this->searchTerm . '%';
$fanlistings = auth_collective()->{$this->class}()
->where('subject', 'like', $search)
->paginate(PER_PAGE);
$fanlistings->load(['categories']);
return view('livewire.admin.list-fanlistings', [
'fanlistings' => $fanlistings,

View file

@ -1,5 +1,7 @@
<?php
define('PER_PAGE', 7);
/* ------------------------------------------------------------------------- auth_collective ---- */
// returns the currently authenticated collective
@ -7,8 +9,8 @@
use App\Models\Collective;
if (!function_exists('auth_collective')) {
function auth_collective() : Collective
{
return auth()->user();
}
}
function auth_collective() : Collective
{
return auth()->user();
}
}

View file

@ -115,7 +115,7 @@ .form__label:first-child, .form__btns:first-child, .form__checkbox:first-child,
margin-top: 0;
}
.form__input, .form__select {
.form__input, .form__input--search, .form__select {
border: 1px solid #7874ff;
background-color: #e4e3ff;
border-color: #7874ff;
@ -123,13 +123,13 @@ .form__input, .form__select {
color: #7874ff;
transition: background-color 0.4s, border-color 0.4s, color 0.4s;
}
.form__input:hover, .form__select:hover {
.form__input:hover, .form__input--search:hover, .form__select:hover {
border-color: #de7cff;
background-color: #f8e5ff;
color: #de7cff;
transition: background-color 0.4s, border-color 0.4s, color 0.4s;
}
.form__input:focus, .form__select:focus {
.form__input:focus, .form__input--search:focus, .form__select:focus {
border-color: #de7cff;
background-color: #f8e5ff;
color: #de7cff;
@ -153,6 +153,13 @@ .form__input--file:focus {
color: #de7cff;
transition: background-color 0.4s, border-color 0.4s, color 0.4s;
}
.form__input--search {
width: 60%;
display: block;
margin: 0 auto;
margin-bottom: 20px;
}
.form__input--checkbox {
-webkit-appearance: none;
-moz-appearance: none;

View file

@ -75,6 +75,14 @@ h1 {
}
}
.form__input--search {
@extend .form__input;
width: 60%;
display: block;
margin: 0 auto;
margin-bottom: 20px;
}
.form__checkbox {
@extend .form__label;
}

View file

@ -1,4 +1,6 @@
<div>
<input type="text" name="search" placeholder="Search fanlistings..." class="form__input--search"
wire:model="searchTerm" />
<table class="table">
<thead class="table__thead">
<tr>