mejoras
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-05-23 00:26:53 +02:00
parent 19fa52ca65
commit 28c225687a
431 changed files with 161955 additions and 2096 deletions

View File

@@ -10,7 +10,6 @@ class ImageUploader extends Component
{
use WithFileUploads;
<<<<<<< HEAD
public $image;
public $imagePath;
public $fieldName; // Nombre del campo para el formulario
@@ -47,41 +46,10 @@ class ImageUploader extends Component
field: $this->fieldName,
path: $this->imagePath
);
=======
public $photo;
public $currentImage;
public $fieldName;
public $placeholder;
public $storagePath = 'tmp/uploads';
protected $rules = [
'photo' => 'nullable|image|max:2048', // 2MB Max
];
public function mount($fieldName = 'photo', $currentImage = null, $placeholder = null)
{
$this->fieldName = $fieldName;
$this->currentImage = $currentImage;
$this->placeholder = $placeholder ?? asset('images/default-avatar.png');
}
public function updatedPhoto()
{
$this->validate([
'photo' => 'image|max:2048', // 2MB Max
]);
}
public function removePhoto()
{
$this->photo = null;
$this->currentImage = null;
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
}
public function save()
{
<<<<<<< HEAD
$this->validate([
'image' => 'required|image|max:2048',
]);
@@ -111,38 +79,6 @@ class ImageUploader extends Component
$this->hover = $status;
}
=======
$this->validate();
if ($this->photo) {
$path = $this->photo->store($this->storagePath);
if ($this->model) {
// Eliminar imagen anterior si existe
if ($this->model->{$this->fieldName}) {
Storage::delete($this->model->{$this->fieldName});
}
$this->model->{$this->fieldName} = $path;
$this->model->save();
}
$this->currentUrl = Storage::url($path);
$this->showSavedMessage = true;
$this->photo = null; // Limpiar el input de subida
}
}
protected function getCurrentImageUrl()
{
if ($this->model && $this->model->{$this->fieldName}) {
return Storage::url($this->model->{$this->fieldName});
}
return $this->placeholder;
}
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
public function render()
{
return view('livewire.image-uploader');

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Livewire;
use Illuminate\Support\Facades\Storage;
use Livewire\Component;
class PdfViewer extends Component
{
public $pdfUrl;
public $currentPage = 1;
public $totalPages = 1;
public $zoomLevel = 1;
protected $listeners = ['pageChanged', 'annotationSaved'];
public function mount($pdfId)
{
$this->pdfUrl = Storage::disk('pdfs')->temporaryUrl($pdfId, now()->addMinutes(30));
}
public function pageChanged($page)
{
$this->currentPage = $page;
}
public function annotationSaved($data)
{
// Procesar y guardar anotaciones
$this->emit('refreshAnnotations');
}
public function render()
{
return view('livewire.pdf-viewer');
}
}

View File

@@ -240,16 +240,6 @@ class ProjectShow extends Component
public function render()
{
<<<<<<< HEAD
return view('livewire.project.show')->layout('components.layouts.documents', [
'title' => __('Project: :name', ['name' => $this->project->name]),
'breadcrumbs' => [
['name' => __('Projects'), 'url' => route('projects.index')],
['name' => $this->project->name, 'url' => route('projects.show', $this->project)],
],
]);
=======
return view('livewire.project-show');
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
return view('livewire.project.show');
}
}