@props(['name', 'kind', 'label' => null, 'value' => null, 'required' => false, 'companyId' => null, 'weightOnly' => false]) @php $selected = (string) old($name, $value); $options = app(\App\Services\MaestroCatalog::class)->options($kind, $companyId ?? auth()->user()?->id_empresa); if ($weightOnly) $options = $options->whereIn('codigo', ['kg', 'g', 't']); $scope = config('maestros.'.$kind.'.scope'); $user = auth()->user(); $canCreate = !$weightOnly && $scope !== 'readonly' && (($user?->isSuperAdmin() && in_array($scope, ['global', 'shared'])) || ($user?->isCompanyAdmin() && $user->id_empresa && in_array($scope, ['company', 'shared']))); @endphp
{{ $message }}
@enderror @if($canCreate) @elseif($options->isEmpty())No hay opciones disponibles. Consulta al administrador para configurar este catálogo.
@endif