-
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.
126 UI taxonomy terms index create edit and delete pages (#177)
Co-authored-by: Hasan10100 <[email protected]> Co-authored-by: kusaljayawardhana <[email protected]>
- Loading branch information
1 parent
4533dd4
commit 0a82200
Showing
14 changed files
with
471 additions
and
33 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 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,58 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Backend; | ||
|
||
use App\Domains\Taxonomy\Models\TaxonomyTerm; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Rappasoft\LaravelLivewireTables\DataTableComponent; | ||
use Rappasoft\LaravelLivewireTables\Views\Column; | ||
|
||
class TaxonomyTermTable extends DataTableComponent | ||
{ | ||
public array $perPageAccepted = [10, 25, 50]; | ||
public bool $perPageAll = true; | ||
|
||
public string $defaultSortColumn = 'created_at'; | ||
public string $defaultSortDirection = 'desc'; | ||
|
||
public $taxonomy; | ||
|
||
public function mount($taxonomy) | ||
{ | ||
$this->taxonomy = $taxonomy; | ||
} | ||
|
||
public function columns(): array | ||
{ | ||
return [ | ||
Column::make("Code", "code") | ||
->searchable()->sortable(), | ||
Column::make("Name", "name") | ||
->searchable()->sortable(), | ||
Column::make("Taxonomy", "taxonomy.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("Updated at", "updated_at") | ||
->sortable(), | ||
Column::make("Actions") | ||
]; | ||
} | ||
|
||
public function query(): Builder | ||
{ | ||
return TaxonomyTerm::query() | ||
->where('taxonomy_id', $this->taxonomy->id) | ||
->with('user'); | ||
} | ||
|
||
public function rowView(): string | ||
{ | ||
return 'backend.taxonomy.terms.index-table-row'; | ||
} | ||
} |
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,109 @@ | ||
@extends('backend.layouts.app') | ||
|
||
@section('content') | ||
<div> | ||
|
||
<x-backend.card> | ||
|
||
<x-slot name="body"> | ||
|
||
<div class="term py-2 pt-3" style="border: 1px solid rgb(207, 207, 207); border-radius:5px"> | ||
|
||
<div class="col-12 pb-3"> | ||
<strong>Term Configurations</strong> | ||
</div> | ||
|
||
<div class="col-12 py-2"> | ||
<div class="col ps-0"> | ||
<label for="drop1">Parent Taxonomy Term</label> | ||
</div> | ||
<select class="form-select"> | ||
<option style="display:none" selected></option> | ||
</select> | ||
</div> | ||
|
||
<div class="col-12 py-2"> | ||
<div class="col ps-0"> | ||
<label for="drop1">Taxonomy*</label> | ||
</div> | ||
<select class="form-select"> | ||
<option style="display:none" selected></option> | ||
</select> | ||
</div> | ||
|
||
<div class="col-12 py-2"> | ||
<div class="col ps-0"> | ||
<label for="drop1">Taxonomy Term Code*</label> | ||
</div> | ||
<div class="col-md-12 px-0"> | ||
{!! Form::text('code', '', ['class' => 'form-control']) !!} | ||
</div> | ||
</div> | ||
|
||
<div class="col-12 py-2"> | ||
<div class="col ps-0"> | ||
<label for="drop1">Taxonomy Term Name*</label> | ||
</div> | ||
<div class="col-md-12 px-0"> | ||
{!! Form::text('name', '', ['class' => 'form-control']) !!} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="metadata py-3 mt-5 mb-3" style="border: 1px solid rgb(207, 207, 207); border-radius:5px"> | ||
|
||
<div class="col-12 pb-3"> | ||
<strong>Metadata</strong> | ||
</div> | ||
|
||
@foreach(json_decode($taxonomy->properties, true) as $property) | ||
<div class="col-12 py-2"> | ||
<div class="col ps-0"> | ||
<label >{{ $property['name'] }} ({{\App\Domains\Taxonomy\Models\Taxonomy::$propertyType[$property['data_type']]}})</label> | ||
</div> | ||
<div class="col-md-12 px-0"> | ||
@switch($property['data_type']) | ||
@case('string') | ||
{!! Form::text("metadata[{$property['code']}]", null, ['class' => 'form-control', 'id' => $property['code']]) !!} | ||
@break | ||
@case('integer') | ||
{!! Form::number("metadata[{$property['code']}]", null, ['class' => 'form-control', 'id' => $property['code'], 'step' => '1']) !!} | ||
@break | ||
@case('float') | ||
{!! Form::number("metadata[{$property['code']}]", null, ['class' => 'form-control', 'id' => $property['code'], 'step' => 'any']) !!} | ||
@break | ||
@case('boolean') | ||
<div class="form-check"> | ||
{!! Form::checkbox("metadata[{$property['code']}]", 1, null, ['class' => 'form-check-input', 'id' => $property['code']]) !!} | ||
</div> | ||
@break | ||
@case('date') | ||
{!! Form::date("metadata[{$property['code']}]", null, ['class' => 'form-control', 'id' => $property['code']]) !!} | ||
@break | ||
@case('datetime') | ||
{!! Form::datetime("metadata[{$property['code']}]", null, ['class' => 'form-control', 'id' => $property['code']]) !!} | ||
@break | ||
@case('url') | ||
{!! Form::url("metadata[{$property['code']}]", null, ['class' => 'form-control', 'id' => $property['code']]) !!} | ||
@break | ||
@case('image') | ||
{!! Form::file("metadata[{$property['code']}]", ['class' => 'form-control', 'id' => $property['code']]) !!} | ||
@break | ||
@default | ||
{!! Form::text("metadata[{$property['code']}]", null, ['class' => 'form-control', 'id' => $property['code']]) !!} | ||
@endswitch | ||
</div> | ||
</div> | ||
@endforeach | ||
</div> | ||
</x-slot> | ||
|
||
<x-slot name="footer"> | ||
{!! Form::submit('Create', ['class' => 'btn btn-primary btn-w-150 float-right', 'id' => 'submit-button']) !!} | ||
</x-slot> | ||
|
||
</x-backend.card> | ||
|
||
</div> | ||
|
||
@endsection |
Oops, something went wrong.