@props([ 'active', 'id' => null, 'mode' => 'create', 'allowedStep' => 1, 'showSaveButton' => false, ]) @php $steps = [ ['key' => 'basic', 'label' => 'البيانات الاساسية', 'route' => 'craft.crafts.create.basic'], ['key' => 'owners', 'label' => 'المُلاك', 'route' => 'craft.crafts.create.owners'], ['key' => 'details', 'label' => 'التفاصيل', 'route' => 'craft.crafts.create.details'], ]; if ($mode === 'edit' && $id) { $steps[] = ['key' => 'archive', 'label' => 'الأرشيف', 'route' => 'craft.crafts.create.archive']; } @endphp
@foreach ($steps as $index => $step) @php $stepIndex = $index + 1; $isActive = $active === $step['key']; $isLocked = ($mode === 'create' && $allowedStep < $stepIndex); $routeParams = $id ? ['id' => $id] : []; $href = route($step['route'], $routeParams); @endphp @if ($isLocked) {{ $step['label'] }} @else $isActive, 'bg-muted/30 text-foreground hover:bg-muted hover:text-primary hover:shadow-sm' => ! $isActive, ]) > {{ $step['label'] }} @endif @endforeach
@if($mode === 'edit' && $id) @can('crafts.edit') @if((bool) $showSaveButton) @endif @endcan @endif @if($mode === 'create') @can('crafts.create') @if((int) $allowedStep > 1) @endif @endcan @endif {{ $slot }}