@props([
'label' => '',
'name' => '',
'disabled' => false,
'required' => false,
'class' => '',
'options' => []
])

<div class="mb-3">
    @if($label)
    <label class="form-label">
        {{ $label }}
        @if($required)
        <span class="text-danger">*</span>
        @endif
    </label>
    @endif

    <select
        id="{{ $name }}"
        wire:model.live="{{ $name }}"
        @disabled($disabled)
        @required($required)
        {{ $attributes->merge([
    'class' => "form-control $class " . ($errors->has($name) ? 'is-invalid' : '')
    ]) }}
    >
        <option value="">please select...</option>
        @foreach($options as $value => $option)
            <option value="{{ $value }}">{{ $option }}</option>
        @endforeach
    </select>

    @error($name)
    <div class="invalid-feedback">
        {{ $message }}
    </div>
    @enderror
</div>
