@php

    $registro = $registro ?? null;

    $val = static fn ($field, $default = '') => old($field, $registro->{$field} ?? $default);

@endphp



<div class="row g-3">

    <div class="col-md-8">

        <label class="form-label">{{ __('Nome do Tema de Mapa') }} <span class="text-danger">*</span></label>

        <input type="text" name="nome" class="form-control @error('nome') is-invalid @enderror" value="{{ $val('nome') }}" maxlength="255" required>

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

    </div>



    <div class="col-md-4">

        <label class="form-label">{{ __('Status') }}</label>

        <select name="status" class="form-select">

            <option value="ATIVADO" @selected($val('status', 'ATIVADO') === 'ATIVADO')>{{ __('Ativado') }}</option>

            <option value="DESATIVADO" @selected($val('status') === 'DESATIVADO')>{{ __('Desativado') }}</option>

        </select>

    </div>



    <div class="col-md-4">

        <label class="form-label">{{ __('Cor (CSS)') }}</label>

        <div class="input-group">

            <input type="text" name="cor" id="observatorio-mapa-tema-cor" class="form-control" value="{{ $val('cor') }}" maxlength="30" placeholder="{{ __('#0d6efd') }}">

            <input type="color" class="form-control form-control-color" value="{{ $val('cor', '#0d6efd') }}"

                   data-observatorio-color-picker="#observatorio-mapa-tema-cor">

        </div>

    </div>



    @include('admin.observatorio.partials._icone-upload', ['registro' => $registro])



    <div class="col-md-12">

        <label class="form-label">{{ __('Descrição') }}</label>

        <textarea name="descricao" class="form-control" rows="3">{{ $val('descricao') }}</textarea>

    </div>

</div>



<div class="mt-4">

    <button type="submit" class="btn btn-success"><i class="fa-solid fa-floppy-disk"></i> {{ __('Salvar') }}</button>

</div>


