Merge branch 'main' of https://homehud.duckdns.org/javier/Nexora
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
<div x-data="{ isUploading: false }"
|
||||
x-on:livewire-upload-start="isUploading = true"
|
||||
x-on:livewire-upload-finish="isUploading = false"
|
||||
@@ -54,4 +55,49 @@
|
||||
<div class="alert alert-danger mt-2">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
=======
|
||||
<div>
|
||||
<!-- Preview de imagen -->
|
||||
<div class="relative mb-4">
|
||||
<img src="{{ $photo ? $photo->temporaryUrl() : ($currentImage ?? $placeholder) }}"
|
||||
alt="Preview"
|
||||
class="w-32 h-32 rounded-full object-cover border-2 border-gray-300">
|
||||
|
||||
@if($photo || $currentImage)
|
||||
<button type="button"
|
||||
wire:click="removePhoto"
|
||||
class="absolute top-0 right-0 bg-red-500 text-white rounded-full p-1 hover:bg-red-600 transition"
|
||||
title="Eliminar foto">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Input de archivo -->
|
||||
<label class="cursor-pointer bg-white px-4 py-2 rounded-md shadow-sm border border-gray-300 hover:bg-gray-50 inline-block">
|
||||
<span class="text-sm font-medium text-gray-700">
|
||||
{{ $photo || $currentImage ? 'Cambiar imagen' : 'Seleccionar imagen' }}
|
||||
</span>
|
||||
<input type="file"
|
||||
wire:model="photo"
|
||||
class="hidden"
|
||||
accept="image/*"
|
||||
name="{{ $fieldName }}_input"> <!-- Input oculto para Livewire -->
|
||||
|
||||
<!-- Input real para el formulario -->
|
||||
@if($photo)
|
||||
<input type="hidden" name="{{ $fieldName }}" value="{{ $photo->getFilename() }}">
|
||||
@elseif($currentImage)
|
||||
<input type="hidden" name="{{ $fieldName }}" value="current">
|
||||
@endif
|
||||
</label>
|
||||
|
||||
@error('photo')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
|
||||
<p class="mt-1 text-xs text-gray-500">PNG, JPG o JPEG (Max. 2MB)</p>
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
</div>
|
||||
Reference in New Issue
Block a user