generated from astrogoat/app-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DTCE-76: Add search field and filters to Load Up > Zip Codes (#9)
Co-authored-by: BaffourAdu <[email protected]>
- Loading branch information
1 parent
3e35f24
commit 04d2741
Showing
8 changed files
with
106 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,63 @@ | ||
@extends('lego::layouts.lego') | ||
|
||
@section('content') | ||
<x-fab::layouts.page | ||
title="Zip codes" | ||
:breadcrumbs="[ | ||
['title' => 'Go Load Up'], | ||
['title' => 'Zip codes', 'url' => route('lego.go-load-up.zip-codes.index')], | ||
]" | ||
> | ||
<x-slot name="actions"> | ||
<x-fab::elements.button type="link" :url="route('lego.go-load-up.zip-codes.upload')">Upload Zip Codes</x-fab::elements.button> | ||
<x-fab::layouts.page | ||
title="Zip codes" | ||
:breadcrumbs="[ | ||
['title' => 'Go Load Up'], | ||
['title' => 'Zip codes', 'url' => route('lego.go-load-up.zip-codes.index')], | ||
]" | ||
x-data="{ showColumnFilters: false }" | ||
> | ||
<x-slot name="actions"> | ||
<x-fab::elements.button type="link" :url="route('lego.go-load-up.zip-codes.upload')">Upload Zip Codes</x-fab::elements.button> | ||
</x-slot> | ||
|
||
@include('lego::models._includes.indexes.filters') | ||
|
||
<x-fab::lists.table class="mt-8"> | ||
<x-slot name="headers"> | ||
@include('lego::models._includes.indexes.headers') | ||
<x-fab::lists.table.header :hidden="true">Edit</x-fab::lists.table.header> | ||
</x-slot> | ||
|
||
<x-fab::lists.table class="mt-8"> | ||
<x-slot name="headers"> | ||
<x-fab::lists.table.header>Zip</x-fab::lists.table.header> | ||
<x-fab::lists.table.header>Name</x-fab::lists.table.header> | ||
<x-fab::lists.table.header>Eligibility</x-fab::lists.table.header> | ||
<x-fab::lists.table.header>Last updated</x-fab::lists.table.header> | ||
<x-fab::lists.table.header :hidden="true">Edit</x-fab::lists.table.header> | ||
</x-slot> | ||
|
||
@foreach($zipCodes as $zipCode) | ||
<x-fab::lists.table.row :odd="$loop->odd"> | ||
@include('lego::models._includes.indexes.header-filters') | ||
<x-fab::lists.table.header x-show="showColumnFilters" x-cloak class="bg-gray-100" /> | ||
|
||
@foreach($models as $zipCode) | ||
<x-fab::lists.table.row :odd="$loop->odd"> | ||
@if($this->shouldShowColumn('zip')) | ||
<x-fab::lists.table.column full primary> | ||
<a href="{{ route('lego.go-load-up.zip-codes.edit', $zipCode) }}">{{ $zipCode->zip }}</a> | ||
</x-fab::lists.table.column> | ||
@endif | ||
|
||
@if($this->shouldShowColumn('name')) | ||
<x-fab::lists.table.column > | ||
<a href="{{ route('lego.go-load-up.zip-codes.edit', $zipCode) }}">{{ $zipCode->name }}</a> | ||
</x-fab::lists.table.column> | ||
@endif | ||
|
||
@if($this->shouldShowColumn('is_eligible')) | ||
<x-fab::lists.table.column > | ||
{{ $zipCode->isEligible() ? 'Eligible' : 'Ineligible' }} | ||
</x-fab::lists.table.column> | ||
@endif | ||
|
||
@if($this->shouldShowColumn('updated_at')) | ||
<x-fab::lists.table.column | ||
align="right">{{ $zipCode->updated_at->toFormattedDateString() }}</x-fab::lists.table.column> | ||
<x-fab::lists.table.column align="right" slim> | ||
<a href="{{ route('lego.go-load-up.zip-codes.edit', $zipCode) }}">Edit</a> | ||
align="right">{{ $zipCode->updated_at->toFormattedDateString() }} | ||
</x-fab::lists.table.column> | ||
</x-fab::lists.table.row> | ||
@endforeach | ||
</x-fab::lists.table> | ||
|
||
<div class="pt-6"> | ||
{{ $zipCodes->links() }} | ||
</div> | ||
</x-fab::layouts.page> | ||
@endsection | ||
|
||
@push('styles') | ||
<link href="{{ asset('vendor/go-load-up/css/go-load-up.css') }}" rel="stylesheet"> | ||
@endpush | ||
@endif | ||
|
||
<x-fab::lists.table.column align="right" slim> | ||
<a href="{{ route('lego.go-load-up.zip-codes.edit', $zipCode) }}">Edit</a> | ||
</x-fab::lists.table.column> | ||
</x-fab::lists.table.row> | ||
@endforeach | ||
</x-fab::lists.table> | ||
|
||
@include('lego::models._includes.indexes.pagination') | ||
|
||
@push('styles') | ||
<link href="{{ asset('vendor/go-load-up/css/go-load-up.css') }}" rel="stylesheet"> | ||
@endpush | ||
</x-fab::layouts.page> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Astrogoat\GoLoadUp\Http\Livewire\Models\ZipCodes; | ||
|
||
use Astrogoat\GoLoadUp\Models\ZipCode; | ||
use Helix\Lego\Http\Livewire\Models\Index as BaseIndex; | ||
|
||
class Index extends BaseIndex | ||
{ | ||
public function model(): string | ||
{ | ||
return ZipCode::class; | ||
} | ||
|
||
public function columns(): array | ||
{ | ||
return [ | ||
'zip' => 'Zip', | ||
'name' => 'Name', | ||
'is_eligible' => 'Eligibility', | ||
'updated_at' => 'Last updated', | ||
]; | ||
} | ||
|
||
public function mainSearchColumn(): string|false | ||
{ | ||
return 'name'; | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('go-load-up::models.zip-codes.index', [ | ||
'models' => $this->getModels(), | ||
])->extends('lego::layouts.lego')->section('content'); | ||
} | ||
} |