-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Taxonomy index create edit and delete pages (#172)
Co-authored-by: Hasan10100 <[email protected]>
- Loading branch information
1 parent
999990a
commit 66d0f0b
Showing
10 changed files
with
220 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Backend; | ||
|
||
use App\Domains\Taxonomy\Models\Taxonomy; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Rappasoft\LaravelLivewireTables\DataTableComponent; | ||
use Rappasoft\LaravelLivewireTables\Views\Column; | ||
|
||
class TaxonomyTable extends DataTableComponent | ||
{ | ||
public array $perPageAccepted = [10, 25, 50]; | ||
public bool $perPageAll = true; | ||
|
||
public string $defaultSortColumn = 'created_at'; | ||
public string $defaultSortDirection = 'desc'; | ||
|
||
public function columns(): array | ||
{ | ||
return [ | ||
Column::make("Code", "code") | ||
->searchable()->sortable(), | ||
Column::make("Name", "name") | ||
->searchable()->sortable(), | ||
Column::make("Created by", "created_by") | ||
->sortable(), | ||
Column::make("Updated by", "updated_by") | ||
->sortable(), | ||
Column::make("Created at", "created_at") | ||
->sortable(), | ||
Column::make("Actions") | ||
]; | ||
} | ||
|
||
public function query(): Builder | ||
{ | ||
return Taxonomy::query(); | ||
} | ||
|
||
public function rowView(): string | ||
{ | ||
return 'backend.taxonomies.index-table-row'; | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Empty file.
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,31 @@ | ||
@extends('backend.layouts.app') | ||
|
||
@section('title', __('Delete Taxonomy')) | ||
|
||
@section('content') | ||
<div> | ||
<x-backend.card> | ||
<x-slot name="header"> | ||
Taxonomy : Delete | {{ $taxonomy->id }} | ||
</x-slot> | ||
|
||
<x-slot name="body"> | ||
<p>Are you sure you want to delete | ||
<strong><i>"{{ $taxonomy->name }}"</i></strong> ? | ||
</p> | ||
<div class="d-flex"> | ||
{!! Form::open([ | ||
'url' => route('dashboard.taxonomy.destroy', compact('taxonomy')), | ||
'method' => 'delete', | ||
'class' => 'container', | ||
]) !!} | ||
|
||
<a href="{{ route('dashboard.taxonomy.index') }}" class="btn btn-light mr-2">Back</a> | ||
{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!} | ||
|
||
{!! Form::close() !!} | ||
</div> | ||
</x-slot> | ||
</x-backend.card> | ||
</div> | ||
@endsection |
Empty file.
45 changes: 45 additions & 0 deletions
45
resources/views/backend/taxonomy/index-table-row.blade.php
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,45 @@ | ||
<?php use App\Domains\Auth\Models\User; ?> | ||
|
||
<x-livewire-ttables::table.cell> | ||
{{ $row->code }} | ||
</x-livewire-tables::table.cell> | ||
|
||
<x-livewire-tables::table.cell> | ||
{{ $row->name }} | ||
</x-livewire-tables::table.cell> | ||
|
||
<x-livewire-tables::table.cell> | ||
{{ User::find($row->created_by)->name ?? 'N/A' }} | ||
</x-livewire-tables::table.cell> | ||
|
||
<x-livewire-tables::table.cell> | ||
{{ User::find($row->updated_by)->name ?? 'N/A' }} | ||
</x-livewire-tables::table.cell> | ||
|
||
<x-livewire-tables::table.cell> | ||
<div class="d-flex px-0 mt-0 mb-0"> | ||
<div class="btn-group" role="group" aria-label=""> | ||
|
||
<!-- View Button --> | ||
<a href="{{ route('taxonomy.view', $row->id) }}" class="btn btn-sm btn-primary"> | ||
<i class="fa fa-eye" title="View"></i> | ||
</a> | ||
|
||
<!-- Manage Button --> | ||
<a href="{{ route('taxonomy.terms', $row->id) }}" class="btn btn-sm btn-secondary"> | ||
<i class="fa fa-list" title="Manage"></i> | ||
</a> | ||
|
||
<!-- Edit Button --> | ||
<a href="{{ route('taxonomy.edit', $row->id) }}" class="btn btn-sm btn-warning"> | ||
<i class="fa fa-pencil" title="Edit"></i> | ||
</a> | ||
|
||
<!-- Delete Button --> | ||
<a href="{{ route('taxonomy.delete', $row->id) }}" class="btn btn-sm btn-danger"> | ||
<i class="fa fa-trash" title="Delete"></i> | ||
</a> | ||
|
||
</div> | ||
</div> | ||
</x-livewire-tables::table.cell> |
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,31 @@ | ||
@extends('backend.layouts.app') | ||
|
||
@section('title', __('Taxonomy')) | ||
|
||
@section('content') | ||
<div> | ||
<x-backend.card> | ||
<x-slot name="header"> | ||
Taxonomy | ||
</x-slot> | ||
|
||
<x-slot name="headerActions"> | ||
<x-utils.link icon="c-icon cil-plus" class="card-header-action" :href="route('dashboard.taxonomy.create')" :text="__('Create Taxonomy')"> | ||
</x-utils.link> | ||
</x-slot> | ||
|
||
<x-slot name="body"> | ||
@if (session('Success')) | ||
<div class="alert alert-success"> | ||
{{ session('Success') }} | ||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
@endif | ||
|
||
<livewire:backend.taxonomy-table /> | ||
</x-slot> | ||
</x-backend.card> | ||
</div> | ||
@endsection |
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,3 @@ | ||
<div> | ||
{{-- Care about people's approval and you will be their prisoner. --}} | ||
</div> |
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,56 @@ | ||
<?php | ||
|
||
use Tabuna\Breadcrumbs\Trail; | ||
use App\Http\Controllers\Backend\TaxonomyController; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::group([], function () { | ||
|
||
// Index | ||
Route::get('taxonomy', function () { | ||
return view('backend.taxonomy.index'); | ||
})->name('taxonomy.index') | ||
->breadcrumbs(function (Trail $trail) { | ||
$trail->push(__('Home'), route('dashboard.home')) | ||
->push(__('Taxonomy'), route('dashboard.taxonomy.index')); | ||
}); | ||
|
||
// Create | ||
Route::get('taxonomy/create', [TaxonomyController::class, 'create']) | ||
->name('taxonomy.create') | ||
->breadcrumbs(function (Trail $trail) { | ||
$trail->push(__('Home'), route('dashboard.home')) | ||
->push(__('Taxonomy'), route('dashboard.taxonomy.index')) | ||
->push(__('Create')); | ||
}); | ||
|
||
// Store | ||
Route::post('taxonomy', [TaxonomyController::class, 'store']) | ||
->name('taxonomy.store'); | ||
|
||
// Edit | ||
Route::get('taxonomy/edit/{taxonomy}', [TaxonomyController::class, 'edit']) | ||
->name('taxonomy.edit') | ||
->breadcrumbs(function (Trail $trail, $taxonomy) { | ||
$trail->push(__('Home'), route('dashboard.home')) | ||
->push(__('Taxonomy'), route('dashboard.taxonomy.index')) | ||
->push(__('Edit'), route('dashboard.taxonomy.edit', $taxonomy)); | ||
}); | ||
|
||
// Update | ||
Route::put('taxonomy/{taxonomy}', [TaxonomyController::class, 'update']) | ||
->name('taxonomy.update'); | ||
|
||
// Delete | ||
Route::get('taxonomy/delete/{taxonomy}', [TaxonomyController::class, 'delete']) | ||
->name('taxonomy.delete') | ||
->breadcrumbs(function (Trail $trail, $taxonomy) { | ||
$trail->push(__('Home'), route('dashboard.home')) | ||
->push(__('Taxonomy'), route('dashboard.taxonomy.index')) | ||
->push(__('Delete')); | ||
}); | ||
|
||
// Destroy | ||
Route::delete('taxonomy/{taxonomy}', [TaxonomyController::class, 'destroy']) | ||
->name('taxonomy.destroy'); | ||
}); |