<form>
    <input type="hidden" wire:model="product_id">

    <div class="row match-height mt-5">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Datos del Producto</h4>
                </div>
                <div class="card-content">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12">
                                <div class="form-group">
                                    <label for="name">Nombre</label>
                                    <input type="text" class="form-control" wire:model="name" placeholder="Nombre de la aseguradora">
                                    @error('name') <span class="text-danger">{{ $message }}</span>@enderror
                                </div>
                            </div>
                            <div class="col-12">
                                <div class="form-group">
                                    <input type="file" class="form-control d-none" wire:model="logo" id="logo">
                                    <a class="preview-image" href="javascript:" wire:click="$emit('triggerPreview', '#logo')">
                                        @if (!empty($logo))
                                            @if (is_string($logo))
                                                <img src="{{ Storage::url($logo) }}">
                                            @else
                                                <img src="{{ previewImg($logo->temporaryUrl()) }}">
                                            @endif
                                        @else
                                            <span>Seleccionar Logo</span>
                                        @endif
                                    </a>
                                    @error('logo') <span class="text-danger">{{ $message }}</span>@enderror
                                </div>
                            </div>
                            <div class="col-12 d-flex justify-content-end">
                                @if ($mode == 'create')
                                    <button wire:click.prevent="store()" class="btn btn-primary mr-1 mb-1">
                                        <i class="far fa-save"></i>
                                        Guardar
                                    </button>
                                @else
                                    <button wire:click.prevent="update()" class="btn btn-primary mr-1 mb-1">
                                        <i class="far fa-save"></i>
                                        Actualizar
                                    </button>
                                @endif
                                <button wire:click.prevent="cancel()" class="btn btn-light-secondary mr-1 mb-1">
                                    <i class="fas fa-ban"></i>
                                    Cancelar
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
