fixed breadcrumb component

pull/44/head
A1Gard 5 months ago
parent 970dfd0795
commit 391a57c566

@ -1,6 +1,7 @@
<?php <?php
use App\Helpers; use App\Helpers;
use Illuminate\Support\Facades\Route;
/** /**
@ -257,3 +258,74 @@ function sluger($name, $replace_char = '-')
return substr($name, 0, 120); return substr($name, 0, 120);
} }
/**
* generate last item of breadcrumb of admin panel
* @return void
*/
function lastCrump()
{
$routes = explode('.', Route::currentRouteName());
if (count($routes) != 3) {
echo '<li >
<a>
<i class="fa fa-cube" ></i>
' . __(ucfirst($routes[count($routes) - 1])) . '
</a>
</li>';
return;
}
$route = $routes[count($routes) - 1];
if ($route == 'home') {
return;
}
if ($route == 'all' || $route == 'index' || $route == 'list') {
echo '<li >
<a>
<i class="fa fa-list" ></i>
' . __(ucfirst($routes[count($routes) - 2])) . '
</a>
</li>';
} else {
$link = '#';
$temp = $routes;
array_pop($temp);
$temp = implode('.', $temp) . '.';
$link = \route($temp . 'index');
echo '<li>
<a href="' . $link . '">
<i class="ri-list-check" ></i>
' . __(Str::plural(ucfirst($routes[count($routes) - 2]))) . '
</a>
</li>';
switch ($route) {
case 'create':
$title = __('Add') . ' ' . __($routes[count($routes) - 2]);
$icon = 'ri-add-line';
break;
case 'edit':
$title = __('Edit') . ' ' . __($routes[count($routes) - 2]);
$icon = 'ri-edit-line';
break;
case 'show':
$title = __('Show') . ' ' . __($routes[count($routes) - 2]);
$icon = 'ri-eye-line';
break;
case 'sort':
$title = __('Sort') . ' ' . __($routes[count($routes) - 2]);
$icon = 'ri-sort-number-asc';
break;
default:
$title = __('') . ' ' . __(ucfirst($routes[count($routes) - 1]));
$icon = 'ri-bubble-chart-line';
break;
}
echo '<li>
<a>
<i class="' . $icon . '" ></i>
' . $title . '
</a>
</li>';
}
}

@ -88,7 +88,7 @@
class="form-control @error('parent') is-invalid @enderror"> class="form-control @error('parent') is-invalid @enderror">
<option value=""> {{__('No parent')}} </option> <option value=""> {{__('No parent')}} </option>
@foreach($cats as $cat ) @foreach($cats as $cat )
@if($cat->id != $item->id) @if( !isset($item) || $cat->id != $item->id )
<option value="{{ $cat->id }}" <option value="{{ $cat->id }}"
@if (old('parent',$item->parent_id??null) == $cat->id ) selected @endif > @if (old('parent',$item->parent_id??null) == $cat->id ) selected @endif >
{{$cat->name}} {{$cat->name}}

@ -1,28 +1,29 @@
<nav id="panel-breadcrumb"> <nav id="panel-breadcrumb">
<ul> <ul>
<li> <li>
<a href="#1"> <a href="{{url('/')}}" target="_blank">
<i class="ri-home-3-line"></i> <i class="ri-home-3-line"></i>
{{config('app.name')}} {{config('app.name')}}
</a> </a>
</li> </li>
<li> <li>
<a href="#2"> <a href="{{route('admin.dash')}}">
<i class="ri-dashboard-3-line"></i> <i class="ri-dashboard-3-line"></i>
{{__("Dashboard")}} {{__("Dashboard")}}
</a> </a>
</li> </li>
<li> {{lastCrump()}}
<a href="#3"> {{-- <li>--}}
<i class="ri-user-3-line"></i> {{-- <a href="#3">--}}
{{__("Users")}} {{-- <i class="ri-user-3-line"></i>--}}
</a> {{-- {{__("Users")}}--}}
</li> {{-- </a>--}}
<li> {{-- </li>--}}
<span> {{-- <li>--}}
<i class="ri-add-line"></i> {{-- <span>--}}
{{__("Add new user")}} {{-- <i class="ri-add-line"></i>--}}
</span> {{-- {{__("Add new user")}}--}}
</li> {{-- </span>--}}
{{-- </li>--}}
</ul> </ul>
</nav> </nav>

Loading…
Cancel
Save