Compare commits
2 Commits
f97a7a8498
...
19fa52ca65
| Author | SHA1 | Date | |
|---|---|---|---|
| 19fa52ca65 | |||
| 655ea60d6b |
23
app/Helpers/FileHelper.php
Normal file
23
app/Helpers/FileHelper.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// En App\Helpers\FileHelper.php
|
||||
namespace App\Helpers;
|
||||
|
||||
class FileHelper
|
||||
{
|
||||
public static function getFileType($filename)
|
||||
{
|
||||
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
return match($extension) {
|
||||
'pdf' => 'pdf',
|
||||
'doc', 'docx' => 'word',
|
||||
'xls', 'xlsx' => 'excel',
|
||||
'ppt', 'pptx' => 'powerpoint',
|
||||
'jpg', 'jpeg', 'png', 'gif' => 'image',
|
||||
'zip', 'rar' => 'archive',
|
||||
'txt' => 'text',
|
||||
default => 'document'
|
||||
};
|
||||
}
|
||||
}
|
||||
82
app/Http/Controllers/DocumentCommentController.php
Normal file
82
app/Http/Controllers/DocumentCommentController.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\DocumentComment;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DocumentCommentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request, Document $document)
|
||||
{
|
||||
$request->validate([
|
||||
'content' => 'required|string|max:1000',
|
||||
'page' => 'required|integer|min:1',
|
||||
'x' => 'required|numeric|between:0,1',
|
||||
'y' => 'required|numeric|between:0,1'
|
||||
]);
|
||||
|
||||
$document->comments()->create([
|
||||
'user_id' => auth()->id(),
|
||||
'content' => $request->content,
|
||||
'page' => $request->page,
|
||||
'x' => $request->x,
|
||||
'y' => $request->y,
|
||||
'parent_id' => $request->parent_id
|
||||
]);
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(DocumentComment $documentComment)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(DocumentComment $documentComment)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, DocumentComment $documentComment)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(DocumentComment $documentComment)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,13 @@ use App\Jobs\ProcessDocumentOCR;
|
||||
use App\Models\Document;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class DocumentController extends Controller
|
||||
{
|
||||
public $comments=[];
|
||||
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
@@ -56,7 +60,19 @@ class DocumentController extends Controller
|
||||
*/
|
||||
public function show(Document $document)
|
||||
{
|
||||
//
|
||||
$this->authorize('view', $document); // Si usas políticas
|
||||
|
||||
if (!Storage::exists($document->file_path)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$document->url = Storage::url($document->file_path);
|
||||
|
||||
return view('documents.show', [
|
||||
'document' => $document,
|
||||
'versions' => $document->versions()->latest()->get(),
|
||||
'comments' => $this->comments,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,12 +17,16 @@ class ProjectController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$projects = Project::withCount('documents')
|
||||
->whereHas('users', function($query) {
|
||||
$projects = auth()->user()->hasRole('admin')
|
||||
? Project::get() // Todos los proyectos para admin
|
||||
: auth()->user()->projects()->latest()->get(); // Solo proyectos asignados
|
||||
|
||||
/*
|
||||
$projects = Project::whereHas('users', function($query) {
|
||||
$query->where('user_id', auth()->id());
|
||||
})
|
||||
->filter(['search' => request('search')])
|
||||
->paginate(9);
|
||||
->paginate(9);*/
|
||||
|
||||
return view('projects.index', compact('projects'));
|
||||
}
|
||||
@@ -89,6 +93,7 @@ class ProjectController extends Controller
|
||||
}
|
||||
|
||||
// Manejar documentos adjuntos
|
||||
/*
|
||||
if($request->hasFile('documents')) {
|
||||
foreach ($request->file('documents') as $file) {
|
||||
$project->documents()->create([
|
||||
@@ -96,7 +101,7 @@ class ProjectController extends Controller
|
||||
'original_name' => $file->getClientOriginalName()
|
||||
]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return redirect()->route('projects.show', $project)->with('success', 'Proyecto creado exitosamente');
|
||||
|
||||
@@ -110,7 +115,7 @@ class ProjectController extends Controller
|
||||
*/
|
||||
public function show(Project $project)
|
||||
{
|
||||
$this->authorize('view', $project); // Si usas políticas
|
||||
//$this->authorize('view', $project); // Si usas políticas
|
||||
$project->load(['categories', 'documents']);
|
||||
|
||||
return view('projects.show', [
|
||||
|
||||
@@ -57,7 +57,12 @@ class UserController extends Controller
|
||||
'end_date' => 'nullable|date|after_or_equal:start_date',
|
||||
'email' => 'required|email|unique:users',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
<<<<<<< HEAD
|
||||
'address' => 'nullable|string|max:255',
|
||||
'profile_photo_path' => 'nullable|string' // Ruta de la imagen subida por Livewire
|
||||
=======
|
||||
'address' => 'nullable|string|max:255'
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
]);
|
||||
|
||||
// Creación del usuario
|
||||
@@ -72,11 +77,20 @@ class UserController extends Controller
|
||||
'address' => $validated['address'],
|
||||
'access_start' => $validated['start_date'],
|
||||
'access_end' => $validated['end_date'],
|
||||
<<<<<<< HEAD
|
||||
'is_active' => true,
|
||||
'profile_photo_path' => $validated['profile_photo_path'] ?? null
|
||||
]);
|
||||
|
||||
if ($request->hasFile('image_path')) {
|
||||
$path = $request->file('image_path')->store('public/photos');
|
||||
=======
|
||||
'is_active' => true
|
||||
]);
|
||||
|
||||
if ($request->hasFile('photo')) {
|
||||
$path = $request->file('photo')->store('public/photos');
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
$user->profile_photo_path = basename($path);
|
||||
$user->save();
|
||||
}
|
||||
@@ -128,9 +142,17 @@ class UserController extends Controller
|
||||
Rule::unique('users')->ignore($user->id)
|
||||
],
|
||||
'phone' => 'nullable|string|max:20',
|
||||
<<<<<<< HEAD
|
||||
'address' => 'nullable|string|max:255',
|
||||
'profile_photo_path' => 'nullable|string', // Añadido para la ruta de la imagen
|
||||
//'is_active' => 'nullable|boolean' // Añadido para el estado activo
|
||||
]);
|
||||
|
||||
=======
|
||||
'address' => 'nullable|string|max:255'
|
||||
]);
|
||||
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
// Preparar datos para actualización
|
||||
$updateData = [
|
||||
'title' => $validated['title'],
|
||||
@@ -142,13 +164,39 @@ class UserController extends Controller
|
||||
'address' => $validated['address'],
|
||||
'access_start' => $validated['start_date'],
|
||||
'access_end' => $validated['end_date'],
|
||||
<<<<<<< HEAD
|
||||
'is_active' => $validated['is_active'] ?? false,
|
||||
'profile_photo_path' => $validated['profile_photo_path'] ?? $user->profile_photo_path
|
||||
];
|
||||
|
||||
=======
|
||||
'is_active' => $request->has('is_active') // Si usas un checkbox
|
||||
];
|
||||
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
// Actualizar contraseña solo si se proporciona
|
||||
if (!empty($validated['password'])) {
|
||||
$updateData['password'] = Hash::make($validated['password']);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
// Eliminar imagen anterior si se está actualizando
|
||||
if (isset($validated['profile_photo_path']) && $user->profile_photo_path) {
|
||||
Storage::disk('public')->delete($user->profile_photo_path);
|
||||
}
|
||||
|
||||
// Actualizar el usuario
|
||||
$user->update($updateData);
|
||||
|
||||
// Redireccionar con mensaje de éxito
|
||||
return redirect()->route('users.show', $user)
|
||||
->with('success', 'Usuario actualizado exitosamente');
|
||||
|
||||
} catch (ValidationException $e) {
|
||||
return redirect()->back()->withErrors($e->validator)->withInput();
|
||||
|
||||
} catch (QueryException $e) {
|
||||
=======
|
||||
|
||||
if ($request->hasFile('photo')) {
|
||||
// Eliminar foto anterior si existe
|
||||
@@ -173,6 +221,7 @@ class UserController extends Controller
|
||||
|
||||
} catch (QueryException $e) {
|
||||
// Manejar errores de base de datos
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
$errorCode = $e->errorInfo[1];
|
||||
$errorMessage = 'Error al actualizar el usuario: ';
|
||||
|
||||
@@ -181,12 +230,20 @@ class UserController extends Controller
|
||||
} else {
|
||||
$errorMessage .= 'Error en la base de datos';
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
Log::error("Error actualizando usuario ID {$user->id}: " . $e->getMessage());
|
||||
return redirect()->back()->with('error', $errorMessage)->withInput();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
=======
|
||||
|
||||
Log::error("Error actualizando usuario ID {$user->id}: " . $e->getMessage());
|
||||
return redirect()->back()->with('error', $errorMessage)->withInput();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Manejar otros errores
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
Log::error("Error general actualizando usuario ID {$user->id}: " . $e->getMessage());
|
||||
return redirect()->back()->with('error', 'Ocurrió un error inesperado al actualizar el usuario')->withInput();
|
||||
}
|
||||
@@ -196,12 +253,20 @@ class UserController extends Controller
|
||||
{
|
||||
$previousUser = User::where('id', '<', $user->id)->latest('id')->first();
|
||||
$nextUser = User::where('id', '>', $user->id)->oldest('id')->first();
|
||||
<<<<<<< HEAD
|
||||
$permissionGroups = $this->getPermissionGroups($user);
|
||||
=======
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
|
||||
return view('users.show', [
|
||||
'user' => $user,
|
||||
'previousUser' => $previousUser,
|
||||
'nextUser' => $nextUser,
|
||||
<<<<<<< HEAD
|
||||
'permissionGroups' => $permissionGroups,
|
||||
=======
|
||||
'permissionGroups' => Permission::all()->groupBy('group')
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -234,4 +299,45 @@ class UserController extends Controller
|
||||
return redirect()->route('users.index')
|
||||
->with('success', 'Usuario eliminado correctamente');
|
||||
}
|
||||
|
||||
private function getPermissionGroups(User $user)
|
||||
{
|
||||
// Obtener todos los permisos disponibles
|
||||
$allPermissions = Permission::all();
|
||||
|
||||
// Agrupar permisos por tipo (asumiendo que los nombres siguen el formato "tipo.acción")
|
||||
$grouped = $allPermissions->groupBy(function ($permission) {
|
||||
return explode('.', $permission->name)[0]; // Extrae "user" de "user.create"
|
||||
});
|
||||
|
||||
// Formatear para la vista
|
||||
$groups = [];
|
||||
foreach ($grouped as $groupName => $permissions) {
|
||||
$groups[$groupName] = [
|
||||
'name' => ucfirst($groupName),
|
||||
'permissions' => $permissions->map(function ($permission) use ($user) {
|
||||
return [
|
||||
'id' => $permission->id,
|
||||
'name' => $permission->name,
|
||||
'description' => $this->getPermissionDescription($permission->name),
|
||||
'enabled' => $user->hasPermissionTo($permission)
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
private function getPermissionDescription($permissionName)
|
||||
{
|
||||
$descriptions = [
|
||||
'user.create' => 'Crear nuevos usuarios',
|
||||
'user.edit' => 'Editar usuarios existentes',
|
||||
'document.view' => 'Ver documentos',
|
||||
// Agrega más descripciones según necesites
|
||||
];
|
||||
|
||||
return $descriptions[$permissionName] ?? str_replace('.', ' ', $permissionName);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,44 @@ class ImageUploader extends Component
|
||||
{
|
||||
use WithFileUploads;
|
||||
|
||||
<<<<<<< HEAD
|
||||
public $image;
|
||||
public $imagePath;
|
||||
public $fieldName; // Nombre del campo para el formulario
|
||||
public $label = 'Subir imagen'; // Etiqueta personalizable
|
||||
public $hover = false;
|
||||
|
||||
// Recibir parámetros si es necesario
|
||||
public function mount($fieldName = 'image_path', $label = 'Subir imagen')
|
||||
{
|
||||
$this->fieldName = $fieldName;
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
public function updatedImage()
|
||||
{
|
||||
$this->validate([
|
||||
'image' => 'image|max:2048', // 2MB Max
|
||||
]);
|
||||
|
||||
// Subir automáticamente al seleccionar
|
||||
$this->uploadImage();
|
||||
}
|
||||
|
||||
public function uploadImage()
|
||||
{
|
||||
$this->validate([
|
||||
'image' => 'required|image|max:2048',
|
||||
]);
|
||||
|
||||
// Guardar la imagen
|
||||
$this->imagePath = $this->image->store('uploads', 'public');
|
||||
// Emitir evento con el nombre del campo y la ruta
|
||||
$this->dispatch('imageUploaded',
|
||||
field: $this->fieldName,
|
||||
path: $this->imagePath
|
||||
);
|
||||
=======
|
||||
public $photo;
|
||||
public $currentImage;
|
||||
public $fieldName;
|
||||
@@ -38,10 +76,42 @@ class ImageUploader extends Component
|
||||
{
|
||||
$this->photo = null;
|
||||
$this->currentImage = null;
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
$this->validate([
|
||||
'image' => 'required|image|max:2048',
|
||||
]);
|
||||
|
||||
// Guardar la imagen
|
||||
$this->imagePath = $this->image->store('images', 'public');
|
||||
|
||||
// Emitir evento con el nombre del campo y la ruta
|
||||
$this->emit('imageUploaded', [
|
||||
'field' => $this->fieldName,
|
||||
'path' => $this->imagePath
|
||||
]);
|
||||
}
|
||||
|
||||
public function removeImage()
|
||||
{
|
||||
$this->reset(['image', 'imagePath']);
|
||||
|
||||
// Cambiar emit por dispatch en Livewire v3+
|
||||
$this->dispatch('imageRemoved',
|
||||
field: $this->fieldName
|
||||
);
|
||||
}
|
||||
|
||||
public function toggleHover($status)
|
||||
{
|
||||
$this->hover = $status;
|
||||
}
|
||||
|
||||
=======
|
||||
$this->validate();
|
||||
|
||||
if ($this->photo) {
|
||||
@@ -72,6 +142,7 @@ class ImageUploader extends Component
|
||||
return $this->placeholder;
|
||||
}
|
||||
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.image-uploader');
|
||||
|
||||
@@ -9,12 +9,15 @@ use App\Models\Project;
|
||||
use App\Models\Folder;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ProjectShow extends Component
|
||||
{
|
||||
|
||||
use WithFileUploads;
|
||||
|
||||
protected $middleware = ['auth']; // Añade esto
|
||||
|
||||
public Project $project;
|
||||
public ?Folder $currentFolder = null;
|
||||
public $expandedFolders = [];
|
||||
@@ -22,8 +25,13 @@ class ProjectShow extends Component
|
||||
public $folderName = '';
|
||||
|
||||
public $selectedFolderId = null;
|
||||
public $showFolderModal = false;
|
||||
public $showUploadModal = false;
|
||||
public $tempFiles = [];
|
||||
public $selectedFiles = []; // Archivos temporales en el modal
|
||||
public $uploadProgress = [];
|
||||
|
||||
|
||||
|
||||
public function mount(Project $project)
|
||||
{
|
||||
$this->project = $project->load('rootFolders');
|
||||
@@ -57,13 +65,13 @@ class ProjectShow extends Component
|
||||
})
|
||||
]
|
||||
]);
|
||||
|
||||
Folder::create([
|
||||
'name' => $this->folderName,
|
||||
'project_id' => $this->project->id,
|
||||
'parent_id' => $this->currentFolder?->id
|
||||
'parent_id' => $this->currentFolder?->id,
|
||||
]);
|
||||
|
||||
$this->hideCreateFolderModal();
|
||||
$this->reset('folderName');
|
||||
$this->project->load('rootFolders'); // Recargar carpetas raíz
|
||||
if ($this->currentFolder) {
|
||||
@@ -72,12 +80,12 @@ class ProjectShow extends Component
|
||||
$this->project->refresh();
|
||||
}
|
||||
|
||||
public function uploadFiles(): void
|
||||
/*public function uploadFiles(): void
|
||||
{
|
||||
$this->validate([
|
||||
'files.*' => 'file|max:10240|mimes:pdf,docx,xlsx,jpg,png'
|
||||
]);
|
||||
|
||||
dd($this->files);
|
||||
foreach ($this->files as $file) {
|
||||
Document::create([
|
||||
'name' => $file->getClientOriginalName(),
|
||||
@@ -92,7 +100,7 @@ class ProjectShow extends Component
|
||||
$this->currentFolder->refresh(); // Recargar documentos
|
||||
}
|
||||
$this->reset('files');
|
||||
}
|
||||
}*/
|
||||
|
||||
public function getDocumentsProperty()
|
||||
{
|
||||
@@ -116,8 +124,132 @@ class ProjectShow extends Component
|
||||
return $breadcrumbs;
|
||||
}
|
||||
|
||||
public function showCreateFolderModal()
|
||||
{
|
||||
$this->folderName = '';
|
||||
$this->showFolderModal = true;
|
||||
}
|
||||
|
||||
public function hideCreateFolderModal()
|
||||
{
|
||||
$this->showFolderModal = false;
|
||||
}
|
||||
|
||||
// Método para abrir el modal
|
||||
public function openUploadModal(): void
|
||||
{
|
||||
$this->showUploadModal = true;
|
||||
}
|
||||
|
||||
// Método para manejar archivos seleccionados
|
||||
public function selectFiles($files): void
|
||||
{
|
||||
$this->validate([
|
||||
'selectedFiles.*' => 'file|max:10240|mimes:pdf,docx,xlsx,jpg,png'
|
||||
]);
|
||||
|
||||
$this->selectedFiles = array_merge($this->selectedFiles, $files);
|
||||
}
|
||||
|
||||
// Método para eliminar un archivo de la lista
|
||||
public function removeFile($index): void
|
||||
{
|
||||
unset($this->selectedFiles[$index]);
|
||||
$this->selectedFiles = array_values($this->selectedFiles); // Reindexar array
|
||||
}
|
||||
|
||||
// Método para confirmar y guardar
|
||||
public function uploadFiles(): void
|
||||
{
|
||||
foreach ($this->selectedFiles as $file) {
|
||||
Document::create([
|
||||
'name' => $file->getClientOriginalName(),
|
||||
'file_path' => $file->store("projects/{$this->project->id}/documents"),
|
||||
'project_id' => $this->project->id, // Asegurar que se envía
|
||||
'folder_id' => $this->currentFolder?->id,
|
||||
//'user_id' => Auth::id(),
|
||||
//'status' => 'active' // Añadir si tu modelo lo requiere
|
||||
]);
|
||||
}
|
||||
|
||||
$this->resetUpload();
|
||||
$this->project->refresh();
|
||||
}
|
||||
|
||||
// Método para procesar los archivos
|
||||
protected function processFiles(): void
|
||||
{
|
||||
foreach ($this->files as $file) {
|
||||
Document::create([
|
||||
'name' => $file->getClientOriginalName(),
|
||||
'file_path' => $file->store("projects/{$this->project->id}/documents"),
|
||||
'project_id' => $this->project->id, // Asegurar que se envía
|
||||
'folder_id' => $this->currentFolder?->id,
|
||||
//'user_id' => Auth::id(),
|
||||
//'status' => 'active' // Añadir si tu modelo lo requiere
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// Método para resetear
|
||||
public function resetUpload(): void
|
||||
{
|
||||
$this->reset(['selectedFiles', 'showUploadModal', 'uploadProgress']);
|
||||
}
|
||||
|
||||
#[On('upload-progress')]
|
||||
public function updateProgress($name, $progress)
|
||||
{
|
||||
$this->uploadProgress[$name] = $progress;
|
||||
}
|
||||
|
||||
public function addFiles($files)
|
||||
{
|
||||
$this->validate([
|
||||
'selectedFiles.*' => 'file|max:10240|mimes:pdf,docx,xlsx,jpg,png'
|
||||
]);
|
||||
|
||||
$this->selectedFiles = array_merge($this->selectedFiles, $files);
|
||||
}
|
||||
|
||||
public function startUpload()
|
||||
{
|
||||
foreach ($this->selectedFiles as $file) {
|
||||
try {
|
||||
$path = $file->store(
|
||||
"projects/{$this->project->id}/".($this->currentFolder ? "folders/{$this->currentFolder->id}" : ""),
|
||||
'public'
|
||||
);
|
||||
|
||||
Document::create([
|
||||
'name' => $file->getClientOriginalName(),
|
||||
'file_path' => $path,
|
||||
'project_id' => $this->project->id,
|
||||
'folder_id' => $this->currentFolder?->id,
|
||||
'user_id' => Auth::id()
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->addError('upload', "Error subiendo {$file->getClientOriginalName()}: {$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
$this->resetUpload();
|
||||
$this->project->refresh();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
36
app/Models/Comment.php
Normal file
36
app/Models/Comment.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'content',
|
||||
'user_id',
|
||||
'document_id',
|
||||
'parent_id',
|
||||
'page',
|
||||
'x',
|
||||
'y'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function document()
|
||||
{
|
||||
return $this->belongsTo(Document::class);
|
||||
}
|
||||
|
||||
public function replies()
|
||||
{
|
||||
return $this->hasMany(Comment::class, 'parent_id');
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,11 @@ class Document extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'status',
|
||||
'project_id',
|
||||
'file_path',
|
||||
'project_id', // Asegurar que está en fillable
|
||||
'folder_id',
|
||||
'current_version_id'
|
||||
'user_id',
|
||||
'status'
|
||||
];
|
||||
|
||||
|
||||
@@ -36,6 +37,7 @@ class Document extends Model
|
||||
return $this->hasMany(Comment::class)->whereNull('parent_id');
|
||||
}
|
||||
|
||||
|
||||
public function createVersion($file)
|
||||
{
|
||||
return $this->versions()->create([
|
||||
|
||||
22
app/Models/DocumentComment.php
Normal file
22
app/Models/DocumentComment.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DocumentComment extends Model
|
||||
{
|
||||
protected $fillable = ['content', 'page', 'x', 'y', 'parent_id'];
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function children() {
|
||||
return $this->hasMany(DocumentComment::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function parent() {
|
||||
return $this->belongsTo(DocumentComment::class, 'parent_id');
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ class Folder extends Model
|
||||
'name',
|
||||
'parent_id',
|
||||
'project_id',
|
||||
'icon',
|
||||
'color',
|
||||
'description',
|
||||
//'icon',
|
||||
//'color',
|
||||
//'description',
|
||||
];
|
||||
|
||||
public function descendants()
|
||||
|
||||
@@ -16,6 +16,6 @@ class DashboardPolicy
|
||||
|
||||
public function view(User $user)
|
||||
{
|
||||
return $user->hasPermissionTo('view dashboard');
|
||||
return true; //$user->hasPermissionTo('view.dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class DocumentPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return false;
|
||||
return $user->hasPermissionTo('document.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ class DocumentPolicy
|
||||
*/
|
||||
public function view(User $user, Document $document)
|
||||
{
|
||||
return $user->hasPermissionTo('view documents')
|
||||
return $user->hasPermissionTo('document.view')
|
||||
&& $user->hasProjectAccess($document->project_id)
|
||||
&& $user->hasPermissionToResource($document->resource(), 'view');
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class DocumentPolicy
|
||||
*/
|
||||
public function update(User $user, Document $document): bool
|
||||
{
|
||||
return $user->hasPermissionToResource($document->resource(), 'edit');
|
||||
return $user->hasPermissionToResource($document->resource(), 'document.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ class DocumentPolicy
|
||||
*/
|
||||
public function delete(User $user, Document $document): bool
|
||||
{
|
||||
return $user->hasPermissionTo('delete documents');
|
||||
return $user->hasPermissionTo('document.delete');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,18 +22,18 @@ class FolderPolicy
|
||||
$user->projects->contains($folder->project_id);
|
||||
}
|
||||
|
||||
return $user->can('manage-projects');
|
||||
return $user->can('project.create');
|
||||
}
|
||||
|
||||
public function move(User $user, Folder $folder)
|
||||
{
|
||||
return $user->can('manage-projects') &&
|
||||
return $user->can('project.create') &&
|
||||
$user->projects->contains($folder->project_id);
|
||||
}
|
||||
|
||||
public function delete(User $user, Folder $folder)
|
||||
{
|
||||
return $user->can('delete-projects') &&
|
||||
return $user->can('project.delete') &&
|
||||
$user->projects->contains($folder->project_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class PermissionPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('view permissions');
|
||||
return $user->hasPermissionTo('permission.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,7 +22,7 @@ class PermissionPolicy
|
||||
*/
|
||||
public function view(User $user, Permission $permission): bool
|
||||
{
|
||||
return $user->hasPermissionTo('view permissions');
|
||||
return $user->hasPermissionTo('permission.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ class PermissionPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('create permissions');
|
||||
return $user->hasPermissionTo('permission.create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ class PermissionPolicy
|
||||
{
|
||||
if($permission->is_system) return false;
|
||||
|
||||
return $user->hasPermissionTo('edit permissions');
|
||||
return $user->hasPermissionTo('permission.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ class PermissionPolicy
|
||||
return false;
|
||||
}
|
||||
|
||||
return $user->hasPermissionTo('delete permissions');
|
||||
return $user->hasPermissionTo('permission.delete');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ class PermissionPolicy
|
||||
*/
|
||||
public function restore(User $user, Permission $permission): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage permissions');
|
||||
return $user->hasPermissionTo('permission.create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,6 +68,6 @@ class PermissionPolicy
|
||||
*/
|
||||
public function forceDelete(User $user, Permission $permission): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage permissions');
|
||||
return $user->hasPermissionTo('permission.delete');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class ProjectPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('view projects');
|
||||
return $user->hasPermissionTo('project.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,13 @@ class ProjectPolicy
|
||||
*/
|
||||
public function view(User $user, Project $project): bool
|
||||
{
|
||||
return $user->hasPermissionTo('view projects') &&
|
||||
// Admin ve todo, otros usuarios solo proyectos asignados
|
||||
/*
|
||||
return $user->hasRole('admin') ||
|
||||
$project->users->contains($user->id) ||
|
||||
$project->manager_id === $user->id;*/
|
||||
|
||||
return $user->hasPermissionTo('project.view') &&
|
||||
$this->hasProjectAccess($user, $project);
|
||||
}
|
||||
|
||||
@@ -30,7 +36,7 @@ class ProjectPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('create projects');
|
||||
return $user->hasPermissionTo('project.create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,7 +44,7 @@ class ProjectPolicy
|
||||
*/
|
||||
public function update(User $user, Project $project): bool
|
||||
{
|
||||
return $user->hasPermissionTo('edit projects') &&
|
||||
return $user->hasPermissionTo('project.edit') &&
|
||||
$this->hasProjectAccess($user, $project);
|
||||
}
|
||||
|
||||
@@ -47,7 +53,7 @@ class ProjectPolicy
|
||||
*/
|
||||
public function delete(User $user, Project $project): bool
|
||||
{
|
||||
return $user->hasPermissionTo('delete projects') &&
|
||||
return $user->hasPermissionTo('project.delete') &&
|
||||
$this->hasProjectAccess($user, $project);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class RolePolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('view roles');
|
||||
return $user->hasPermissionTo('role.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ class RolePolicy
|
||||
*/
|
||||
public function view(User $user, Role $role): bool
|
||||
{
|
||||
return false;
|
||||
return $user->hasPermissionTo('role.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ class RolePolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('create roles');
|
||||
return $user->hasPermissionTo('role.create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ class RolePolicy
|
||||
*/
|
||||
public function update(User $user, Role $role): bool
|
||||
{
|
||||
return $user->hasPermissionTo('edit roles') && !$role->is_protected;
|
||||
return $user->hasPermissionTo('role.edit') && !$role->is_protected;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ class RolePolicy
|
||||
*/
|
||||
public function delete(User $user, Role $role): bool
|
||||
{
|
||||
return $user->hasPermissionTo('delete roles') && !$role->is_protected;
|
||||
return $user->hasPermissionTo('role.delete') && !$role->is_protected;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,7 @@ class UserPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users');
|
||||
return $user->hasPermissionTo('user.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ class UserPolicy
|
||||
*/
|
||||
public function view(User $user, User $model): bool
|
||||
{
|
||||
return false;
|
||||
return $user->hasPermissionTo('user.view');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ class UserPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users');
|
||||
return $user->hasPermissionTo('user.create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ class UserPolicy
|
||||
*/
|
||||
public function update(User $user, User $model): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users') && !$model->is_protected;
|
||||
return $user->hasPermissionTo('user.create') && !$model->is_protected;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ class UserPolicy
|
||||
*/
|
||||
public function delete(User $user, User $model): bool
|
||||
{
|
||||
return $user->hasPermissionTo('manage users')
|
||||
return $user->hasPermissionTo('user.delete')
|
||||
&& !$model->is_protected
|
||||
&& $user->id !== $model->id;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Livewire\FileUpload;
|
||||
use App\Livewire\ImageUploader;
|
||||
use App\Livewire\ProjectShow;
|
||||
use App\Livewire\Toolbar;
|
||||
use App\View\Components\Multiselect;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
@@ -25,12 +30,13 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
// Configuración de componentes Blade
|
||||
Blade::componentNamespace('App\\View\\Components', 'icons');
|
||||
Blade::component('multiselect', \App\View\Components\Multiselect::class);
|
||||
Blade::component('multiselect', Multiselect::class);
|
||||
|
||||
// Registro de componentes Livewire
|
||||
Livewire::component('project-show', \App\Http\Livewire\ProjectShow::class);
|
||||
Livewire::component('file-upload', \App\Http\Livewire\FileUpload::class);
|
||||
Livewire::component('toolbar', \App\Http\Livewire\Toolbar::class);
|
||||
Livewire::component('project-show', ProjectShow::class);
|
||||
Livewire::component('file-upload', FileUpload::class);
|
||||
Livewire::component('toolbar', Toolbar::class);
|
||||
Livewire::component('image-uploader', ImageUploader::class);
|
||||
|
||||
// Validación personalizada
|
||||
Validator::extend('max_upload_size', function ($attribute, $value, $parameters, $validator) {
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\Folder;
|
||||
use App\Models\Project;
|
||||
use App\Models\User;
|
||||
use App\Policies\DocumentPolicy;
|
||||
use App\Policies\FolderPolicy;
|
||||
use App\Policies\PermissionPolicy;
|
||||
use App\Policies\ProfilePolicy;
|
||||
use App\Policies\ProjectPolicy;
|
||||
use App\Policies\RolePolicy;
|
||||
use App\Policies\UserPolicy;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Livewire\Livewire;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
protected $policies = [
|
||||
User::class => UserPolicy::class,
|
||||
User::class => ProfilePolicy::class,
|
||||
Role::class => RolePolicy::class,
|
||||
Permission::class => PermissionPolicy::class,
|
||||
Document::class => DocumentPolicy::class,
|
||||
Project::class => ProjectPolicy::class,
|
||||
Folder::class => FolderPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
Blade::componentNamespace('App\\View\\Components', 'icons');
|
||||
Blade::component('multiselect', \App\View\Components\Multiselect::class);
|
||||
|
||||
Livewire::component('project-show', \App\Http\Livewire\ProjectShow::class);
|
||||
Livewire::component('project-show', \App\Http\Livewire\FileUpload::class);
|
||||
Livewire::component('toolbar', \App\Http\Livewire\Toolbar::class);
|
||||
|
||||
Validator::extend('max_upload_size', function ($attribute, $value, $parameters, $validator) {
|
||||
$maxSize = env('MAX_UPLOAD_SIZE', 51200); // Default 50MB
|
||||
$totalSize = array_reduce($value, function($sum, $file) {
|
||||
return $sum + $file->getSize();
|
||||
}, 0);
|
||||
|
||||
return $totalSize <= ($maxSize * 1024);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ return new class extends Migration
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->foreignId('project_id')->constrained();
|
||||
$table->foreignId('creator_id')->constrained('users');
|
||||
//$table->foreignId('creator_id')->constrained('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('documents', function (Blueprint $table) {
|
||||
$table->string('file_path')->require();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('documents', function (Blueprint $table) {
|
||||
$table->dropColumn('file_path');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('document_comments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('document_id')->constrained();
|
||||
$table->foreignId('user_id')->constrained();
|
||||
$table->foreignId('parent_id')->nullable()->constrained('document_comments');
|
||||
$table->text('content');
|
||||
$table->unsignedInteger('page');
|
||||
$table->decimal('x', 5, 3); // Posición X normalizada (0-1)
|
||||
$table->decimal('y', 5, 3); // Posición Y normalizada (0-1)
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('document_comments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('comments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('content');
|
||||
$table->foreignId('user_id')->constrained();
|
||||
$table->foreignId('document_id')->constrained();
|
||||
$table->foreignId('parent_id')->nullable()->constrained('comments');
|
||||
$table->unsignedInteger('page');
|
||||
$table->decimal('x', 5, 3); // Posición X (0-1)
|
||||
$table->decimal('y', 5, 3); // Posición Y (0-1)
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('comments');
|
||||
}
|
||||
};
|
||||
@@ -13,6 +13,7 @@ class PermissionSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
/*
|
||||
$permissions = [
|
||||
// Permissions for Projects
|
||||
'create projects',
|
||||
@@ -49,6 +50,22 @@ class PermissionSeeder extends Seeder
|
||||
'name' => $permission,
|
||||
'guard_name' => 'web'
|
||||
]);
|
||||
}*/
|
||||
|
||||
$permissions = [
|
||||
'user' => ['view', 'create', 'edit', 'delete'],
|
||||
'document' => ['view', 'upload', 'edit', 'delete', 'approve'],
|
||||
'project' => ['view', 'create', 'edit', 'delete'],
|
||||
'comment' => ['create', 'edit', 'delete'],
|
||||
'folder' => ['view', 'create', 'edit', 'delete'],
|
||||
'role' => ['view', 'create', 'edit', 'delete'],
|
||||
'permission' => ['view', 'create', 'edit', 'delete'],
|
||||
];
|
||||
|
||||
foreach ($permissions as $type => $actions) {
|
||||
foreach ($actions as $action) {
|
||||
Permission::create(['name' => "{$type}.{$action}"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,38 +23,9 @@ class RolePermissionSeeder extends Seeder
|
||||
//['description' => 'Administrador del sistema']
|
||||
);
|
||||
|
||||
// Obtener o crear todos los permisos existentes
|
||||
$permissions = Permission::all();
|
||||
|
||||
if ($permissions->isEmpty()) {
|
||||
// Crear permisos básicos si no existen
|
||||
$permissions = collect([
|
||||
'view projects',
|
||||
'edit projects',
|
||||
'delete projects',
|
||||
'view roles',
|
||||
'create roles',
|
||||
'edit roles',
|
||||
'delete roles',
|
||||
'view permissions',
|
||||
'create permissions',
|
||||
'edit permissions',
|
||||
'delete permissions',
|
||||
'assign permissions',
|
||||
'revoke permissions',
|
||||
|
||||
])->map(function ($permission) {
|
||||
return Permission::updateOrCreate(
|
||||
['name' => $permission],
|
||||
['guard_name' => 'web']
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Sincronizar todos los permisos con el rol admin
|
||||
$allPermissions = Permission::all();
|
||||
$adminRole->syncPermissions($allPermissions);
|
||||
$adminRole->syncPermissions($permissions);
|
||||
|
||||
$adminEmail = env('ADMIN_EMAIL', 'admin@example.com');
|
||||
$user = User::where('email', $adminEmail)->first();
|
||||
|
||||
183
package-lock.json
generated
183
package-lock.json
generated
@@ -12,6 +12,7 @@
|
||||
"axios": "^1.7.4",
|
||||
"concurrently": "^9.0.1",
|
||||
"laravel-vite-plugin": "^1.0",
|
||||
"pdfjs-dist": "^5.2.133",
|
||||
"quill": "^2.0.3",
|
||||
"tailwindcss": "^4.0.7",
|
||||
"vite": "^6.0"
|
||||
@@ -430,6 +431,177 @@
|
||||
"react": ">= 16"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas/-/canvas-0.1.70.tgz",
|
||||
"integrity": "sha512-nD6NGa4JbNYSZYsTnLGrqe9Kn/lCkA4ybXt8sx5ojDqZjr2i0TWAHxx/vhgfjX+i3hCdKWufxYwi7CfXqtITSA==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@napi-rs/canvas-android-arm64": "0.1.70",
|
||||
"@napi-rs/canvas-darwin-arm64": "0.1.70",
|
||||
"@napi-rs/canvas-darwin-x64": "0.1.70",
|
||||
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.70",
|
||||
"@napi-rs/canvas-linux-arm64-gnu": "0.1.70",
|
||||
"@napi-rs/canvas-linux-arm64-musl": "0.1.70",
|
||||
"@napi-rs/canvas-linux-riscv64-gnu": "0.1.70",
|
||||
"@napi-rs/canvas-linux-x64-gnu": "0.1.70",
|
||||
"@napi-rs/canvas-linux-x64-musl": "0.1.70",
|
||||
"@napi-rs/canvas-win32-x64-msvc": "0.1.70"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-android-arm64": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-android-arm64/-/canvas-android-arm64-0.1.70.tgz",
|
||||
"integrity": "sha512-I/YOuQ0wbkVYxVaYtCgN42WKTYxNqFA0gTcTrHIGG1jfpDSyZWII/uHcjOo4nzd19io6Y4+/BqP8E5hJgf9OmQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-darwin-arm64": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-arm64/-/canvas-darwin-arm64-0.1.70.tgz",
|
||||
"integrity": "sha512-4pPGyXetHIHkw2TOJHujt3mkCP8LdDu8+CT15ld9Id39c752RcI0amDHSuMLMQfAjvusA9B5kKxazwjMGjEJpQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-darwin-x64": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-x64/-/canvas-darwin-x64-0.1.70.tgz",
|
||||
"integrity": "sha512-+2N6Os9LbkmDMHL+raknrUcLQhsXzc5CSXRbXws9C3pv/mjHRVszQ9dhFUUe9FjfPhCJznO6USVdwOtu7pOrzQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-linux-arm-gnueabihf": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm-gnueabihf/-/canvas-linux-arm-gnueabihf-0.1.70.tgz",
|
||||
"integrity": "sha512-QjscX9OaKq/990sVhSMj581xuqLgiaPVMjjYvWaCmAJRkNQ004QfoSMEm3FoTqM4DRoquP8jvuEXScVJsc1rqQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-linux-arm64-gnu": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-gnu/-/canvas-linux-arm64-gnu-0.1.70.tgz",
|
||||
"integrity": "sha512-LNakMOwwqwiHIwMpnMAbFRczQMQ7TkkMyATqFCOtUJNlE6LPP/QiUj/mlFrNbUn/hctqShJ60gWEb52ZTALbVw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-linux-arm64-musl": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-musl/-/canvas-linux-arm64-musl-0.1.70.tgz",
|
||||
"integrity": "sha512-wBTOllEYNfJCHOdZj9v8gLzZ4oY3oyPX8MSRvaxPm/s7RfEXxCyZ8OhJ5xAyicsDdbE5YBZqdmaaeP5+xKxvtg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-linux-riscv64-gnu": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-riscv64-gnu/-/canvas-linux-riscv64-gnu-0.1.70.tgz",
|
||||
"integrity": "sha512-GVUUPC8TuuFqHip0rxHkUqArQnlzmlXmTEBuXAWdgCv85zTCFH8nOHk/YCF5yo0Z2eOm8nOi90aWs0leJ4OE5Q==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-linux-x64-gnu": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-gnu/-/canvas-linux-x64-gnu-0.1.70.tgz",
|
||||
"integrity": "sha512-/kvUa2lZRwGNyfznSn5t1ShWJnr/m5acSlhTV3eXECafObjl0VBuA1HJw0QrilLpb4Fe0VLywkpD1NsMoVDROQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-linux-x64-musl": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-musl/-/canvas-linux-x64-musl-0.1.70.tgz",
|
||||
"integrity": "sha512-aqlv8MLpycoMKRmds7JWCfVwNf1fiZxaU7JwJs9/ExjTD8lX2KjsO7CTeAj5Cl4aEuzxUWbJPUUE2Qu9cZ1vfg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/canvas-win32-x64-msvc": {
|
||||
"version": "0.1.70",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/canvas-win32-x64-msvc/-/canvas-win32-x64-msvc-0.1.70.tgz",
|
||||
"integrity": "sha512-Q9QU3WIpwBTVHk4cPfBjGHGU4U0llQYRXgJtFtYqqGNEOKVN4OT6PQ+ve63xwIPODMpZ0HHyj/KLGc9CWc3EtQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||
"version": "4.34.8",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz",
|
||||
@@ -1890,6 +2062,17 @@
|
||||
"resolved": "https://registry.npmjs.org/parchment/-/parchment-3.0.0.tgz",
|
||||
"integrity": "sha512-HUrJFQ/StvgmXRcQ1ftY6VEZUq3jA2t9ncFN4F84J/vN0/FPpQF+8FKXb3l6fLces6q0uOHj6NJn+2xvZnxO6A=="
|
||||
},
|
||||
"node_modules/pdfjs-dist": {
|
||||
"version": "5.2.133",
|
||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.2.133.tgz",
|
||||
"integrity": "sha512-abE6ZWDxztt+gGFzfm4bX2ggfxUk9wsDEoFzIJm9LozaY3JdXR7jyLK4Bjs+XLXplCduuWS1wGhPC4tgTn/kzg==",
|
||||
"engines": {
|
||||
"node": ">=20.16.0 || >=22.3.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@napi-rs/canvas": "^0.1.67"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"axios": "^1.7.4",
|
||||
"concurrently": "^9.0.1",
|
||||
"laravel-vite-plugin": "^1.0",
|
||||
"pdfjs-dist": "^5.2.133",
|
||||
"quill": "^2.0.3",
|
||||
"tailwindcss": "^4.0.7",
|
||||
"vite": "^6.0"
|
||||
|
||||
@@ -83,3 +83,20 @@ select:focus[data-flux-control] {
|
||||
.btn-primary {
|
||||
@apply inline-flex items-center px-4 py-2 bg-blue-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-blue-700 active:bg-blue-900 focus:outline-none focus:border-blue-900 focus:ring focus:ring-blue-300 disabled:opacity-25 transition;
|
||||
}
|
||||
|
||||
.modal-enter {
|
||||
opacity: 0;
|
||||
}
|
||||
.modal-enter-active {
|
||||
opacity: 1;
|
||||
transition: opacity 200ms;
|
||||
}
|
||||
.modal-exit {
|
||||
opacity: 1;
|
||||
}
|
||||
.modal-exit-active {
|
||||
opacity: 0;
|
||||
transition: opacity 200ms;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
<x-app-logo-icon class="size-5 fill-current text-white dark:text-black" />
|
||||
</div>
|
||||
<div class="ms-1 grid flex-1 text-start text-sm">
|
||||
<span class="mb-0.5 truncate leading-none font-semibold">Laravel Starter Kit</span>
|
||||
<span class="mb-0.5 truncate leading-none font-semibold">{{ config('app.name') }}</span>
|
||||
</div>
|
||||
|
||||
23
resources/views/components/comment-item.blade.php
Normal file
23
resources/views/components/comment-item.blade.php
Normal file
@@ -0,0 +1,23 @@
|
||||
@props(['comment', 'document'])
|
||||
|
||||
<div class="border-l-2 border-blue-200 pl-3 ml-2" style="margin-left: {{ $comment->depth * 20 }}px">
|
||||
<div class="flex items-start space-x-2">
|
||||
<div class="flex-1">
|
||||
<div class="text-sm font-medium">{{ $comment->user->name }}</div>
|
||||
<div class="text-gray-600 text-sm">{{ $comment->created_at->diffForHumans() }}</div>
|
||||
<p class="mt-1 text-gray-800">{{ $comment->content }}</p>
|
||||
<div class="mt-1 text-xs text-blue-600 cursor-pointer hover:underline"
|
||||
@click="window.PDFViewer.scrollToComment({{ $comment->page }}, {{ $comment->x }}, {{ $comment->y }})">
|
||||
Página {{ $comment->page }} - ({{ number_format($comment->x*100, 1) }}%, {{ number_format($comment->y*100, 1) }}%)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($comment->children->isNotEmpty())
|
||||
<div class="mt-2 space-y-2">
|
||||
@foreach($comment->children as $child)
|
||||
<x-comment-item :comment="$child" :document="$document" />
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@@ -7,12 +7,12 @@
|
||||
<button wire:click.prevent="toggleFolder({{ $folder->id }})"
|
||||
class="mr-2">
|
||||
@if(in_array($folder->id, $expandedFolders))
|
||||
<x-icons.chevron-down class="w-4 h-4" />
|
||||
<x-icons icon="chevron-down" class="w-4 h-4" />
|
||||
@else
|
||||
<x-icons.chevron-right class="w-4 h-4" />
|
||||
<x-icons icon="chevron-right" class="w-4 h-4" />
|
||||
@endif
|
||||
</button>
|
||||
<x-icons.folder class="w-5 h-5 mr-2 text-yellow-500" />
|
||||
<x-icons icon="folder" class="w-5 h-5 mr-2 text-yellow-500" />
|
||||
<span>{{ $folder->name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
<div class="flex items-center flex-1" wire:click="selectFolder({{ $folder->id }})">
|
||||
<button wire:click.prevent="toggleFolder({{ $folder->id }})" class="mr-2">
|
||||
@if(in_array($folder->id, $expandedFolders))
|
||||
<x-icons.chevron-down class="w-4 h-4 text-gray-400" />
|
||||
<x-icons icon="chevron-down" class="w-4 h-4 text-gray-400" />
|
||||
@else
|
||||
<x-icons.chevron-right class="w-4 h-4 text-gray-400" />
|
||||
<x-icons icon="chevron-right" class="w-4 h-4 text-gray-400" />
|
||||
@endif
|
||||
</button>
|
||||
<x-icons.folder class="w-5 h-5 mr-2 text-yellow-500" />
|
||||
<x-icons icon="folder" class="w-5 h-5 mr-2 text-yellow-500" />
|
||||
<span class="cursor-pointer">{{ $folder->name }}</span>
|
||||
</div>
|
||||
<span class="text-sm text-gray-500">
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
|
||||
@elseif($icon === 'chevron-right')
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5" />
|
||||
</svg>
|
||||
|
||||
|
||||
@elseif($icon === 'user')
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" {{ $attributes }}>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
||||
|
||||
4
resources/views/components/icons/excel.blade.php
Normal file
4
resources/views/components/icons/excel.blade.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="{{ $class }}" viewBox="0 0 32 32">
|
||||
<path fill="#217346" d="M28.901 8.319l-5.223-5.223c-.379-.379-.868-.558-1.364-.595h-14.314v3.5h13.5v6h-13.5v3.5h13.5v6h-13.5v3.5h14.5c.828 0 1.5-.672 1.5-1.5v-22c0-.496-.217-.985-.603-1.364zm-5.598-3.776l3.181 3.181h-3.181v-3.181zm-16.303 25.457v-25.5h8.5v6h6v19.5h-14.5z"/>
|
||||
<path fill="#fff" d="M20.1 15.3l-2.1-3.4-2.1 3.4h-1.5l2.6-4.2-2.5-4.1h1.5l1.9 3.2 1.9-3.2h1.5l-2.5 4.1 2.6 4.2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 488 B |
1
resources/views/components/icons/pdf.blade.php
Normal file
1
resources/views/components/icons/pdf.blade.php
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgba(0, 0, 0, 1);transform: ;msFilter:;"><path d="M8.267 14.68c-.184 0-.308.018-.372.036v1.178c.076.018.171.023.302.023.479 0 .774-.242.774-.651 0-.366-.254-.586-.704-.586zm3.487.012c-.2 0-.33.018-.407.036v2.61c.077.018.201.018.313.018.817.006 1.349-.444 1.349-1.396.006-.83-.479-1.268-1.255-1.268z"></path><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM9.498 16.19c-.309.29-.765.42-1.296.42a2.23 2.23 0 0 1-.308-.018v1.426H7v-3.936A7.558 7.558 0 0 1 8.219 14c.557 0 .953.106 1.22.319.254.202.426.533.426.923-.001.392-.131.723-.367.948zm3.807 1.355c-.42.349-1.059.515-1.84.515-.468 0-.799-.03-1.024-.06v-3.917A7.947 7.947 0 0 1 11.66 14c.757 0 1.249.136 1.633.426.415.308.675.799.675 1.504 0 .763-.279 1.29-.663 1.615zM17 14.77h-1.532v.911H16.9v.734h-1.432v1.604h-.906V14.03H17v.74zM14 9h-1V4l5 5h-4z"></path></svg>
|
||||
|
After Width: | Height: | Size: 937 B |
@@ -1,5 +1,5 @@
|
||||
<x-layouts.app.sidebar :title="$title ?? null">
|
||||
<x-layouts.app.header :title="$title ?? null">
|
||||
<flux:main>
|
||||
{{ $slot }}
|
||||
</flux:main>
|
||||
</x-layouts.app.sidebar>
|
||||
</x-layouts.app.header>
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
{{ __('Dashboard') }}
|
||||
</flux:navbar.item>
|
||||
</flux:navbar>
|
||||
|
||||
<flux:navbar class="-mb-px max-lg:hidden">
|
||||
<flux:navbar.item icon="layout-grid" :href="route('dashboard')" :current="request()->routeIs('dashboard')" wire:navigate>
|
||||
{{ __('User') }}
|
||||
</flux:navbar.item>
|
||||
</flux:navbar>
|
||||
|
||||
<flux:spacer />
|
||||
|
||||
|
||||
6
resources/views/components/layouts/documents.blade.php
Normal file
6
resources/views/components/layouts/documents.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<x-layouts.app.header :title="$title ?? null">
|
||||
<flux:main>
|
||||
documents layout
|
||||
{{ $slot }}
|
||||
</flux:main>
|
||||
</x-layouts.app.header>
|
||||
6
resources/views/components/property-item.blade.php
Normal file
6
resources/views/components/property-item.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@props(['label', 'value'])
|
||||
|
||||
<div class="flex justify-between items-center border-b border-gray-100 pb-2">
|
||||
<span class="text-sm text-gray-500">{{ $label }}:</span>
|
||||
<span class="text-sm font-medium text-gray-900">{{ $value }}</span>
|
||||
</div>
|
||||
11
resources/views/components/tab-button.blade.php
Normal file
11
resources/views/components/tab-button.blade.php
Normal file
@@ -0,0 +1,11 @@
|
||||
@props(['active' => false])
|
||||
|
||||
<button
|
||||
{{ $attributes->merge([
|
||||
'class' => $active
|
||||
? 'border-b-2 border-blue-500 text-blue-600 px-4 py-2 text-sm font-medium'
|
||||
: 'text-gray-500 hover:text-gray-700 hover:border-gray-300 px-4 py-2 text-sm font-medium border-b-2 border-transparent'
|
||||
]) }}
|
||||
>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
5
resources/views/components/tab-content.blade.php
Normal file
5
resources/views/components/tab-content.blade.php
Normal file
@@ -0,0 +1,5 @@
|
||||
@props(['show' => false])
|
||||
|
||||
<div x-show="activeTab === '{{ $show }}'" class="space-y-4">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
0
resources/views/components/version-item.blade.php
Normal file
0
resources/views/components/version-item.blade.php
Normal file
@@ -28,8 +28,10 @@
|
||||
<x-icons icon="document" class="w-5 h-5 mr-3" />
|
||||
Documentos
|
||||
</x-nav-link>
|
||||
|
||||
@can('view roles')
|
||||
<x-nav-link :href="route('roles.index')" :active="request()->routeIs('roles.*')">
|
||||
<x-icons icon="roles" class="w-5 h-5 mr-3" />
|
||||
{{ __('Roles') }}
|
||||
</x-nav-link>
|
||||
@endcan
|
||||
@@ -168,7 +170,7 @@
|
||||
<x-icons icon="storage" class="w-12 h-12 text-purple-500" />
|
||||
</div>
|
||||
<div class="w-full bg-gray-200 rounded-full h-2">
|
||||
div class="bg-purple-500 rounded-full h-2"
|
||||
<div class="bg-purple-500 rounded-full h-2"
|
||||
style="width: {{ $stats['storage_percentage'] }}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
288
resources/views/documents/show.blade.php
Normal file
288
resources/views/documents/show.blade.php
Normal file
@@ -0,0 +1,288 @@
|
||||
<x-layouts.app :title="__('Show document')">
|
||||
<div class="flex h-screen bg-gray-100"
|
||||
@resize.window.debounce="renderPage(currentPage)">
|
||||
|
||||
<!-- Zona izquierda - Visualizador de documentos -->
|
||||
<div class="w-1/2 bg-gray-800 p-4 relative">
|
||||
<!-- Loading State -->
|
||||
<template x-if="loading">
|
||||
<div class="absolute inset-0 bg-white bg-opacity-90 flex items-center justify-center">
|
||||
<div class="text-center">
|
||||
<svg class="animate-spin h-12 w-12 text-blue-500 mx-auto mb-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-600">Cargando documento...</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Error State -->
|
||||
<template x-if="error">
|
||||
<div class="absolute inset-0 bg-red-50 flex items-center justify-center p-4">
|
||||
<div class="text-center text-red-600">
|
||||
<svg class="h-12 w-12 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||
</svg>
|
||||
<p x-text="error"></p>
|
||||
<p class="mt-2 text-sm">URL del documento: <span class="break-all" x-text="pdfUrl"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Controles del PDF -->
|
||||
<div class="flex items-center justify-between mb-4 bg-gray-700 p-2 rounded">
|
||||
<div class="flex items-center space-x-4 text-white">
|
||||
<button @click="previousPage" :disabled="currentPage <= 1" class="disabled:opacity-50">
|
||||
<x-icons icon="chevron-left" class="w-6 h-6" />
|
||||
</button>
|
||||
<span>Página <span x-text="currentPage"></span> de <span x-text="totalPages"></span></span>
|
||||
<button @click="nextPage" :disabled="currentPage >= totalPages" class="disabled:opacity-50">
|
||||
<x-icons icon="chevron-right" class="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="text-white">
|
||||
Zoom:
|
||||
<select x-model="scale" @change="renderPage(currentPage)" class="bg-gray-600 rounded px-2 py-1">
|
||||
<option value="0.25">25%</option>
|
||||
<option value="0.5">50%</option>
|
||||
<option value="0.75">75%</option>
|
||||
<option value="1">100%</option>
|
||||
<option value="1.5">150%</option>
|
||||
<option value="2">200%</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Canvas del PDF con comentarios -->
|
||||
<div class="relative" id="pdf-container">
|
||||
<canvas
|
||||
id="pdf-canvas"
|
||||
class="mx-auto shadow-lg bg-white"
|
||||
@click="handleCanvasClick($event)"
|
||||
></canvas>
|
||||
|
||||
<!-- Marcadores de comentarios existentes -->
|
||||
<template x-for="comment in comments" :key="comment.id">
|
||||
<div
|
||||
class="absolute w-4 h-4 bg-yellow-400 rounded-full cursor-pointer border-2 border-yellow-600"
|
||||
:style="`left: ${comment.x * 100}%; top: ${comment.y * 100}%;`"
|
||||
@click="scrollToComment(comment)"
|
||||
x-tooltip="'Ver comentario'"
|
||||
></div>
|
||||
</template>
|
||||
|
||||
<!-- Formulario flotante para nuevos comentarios -->
|
||||
<div
|
||||
class="absolute bg-white p-4 rounded-lg shadow-xl w-64"
|
||||
x-show="showCommentForm"
|
||||
:style="`top: ${clickY}px; left: ${clickX}px`"
|
||||
@click.outside="closeCommentForm"
|
||||
>
|
||||
<form @submit.prevent="submitComment">
|
||||
<textarea
|
||||
x-model="commentText"
|
||||
class="w-full mb-2 p-2 border rounded"
|
||||
placeholder="Escribe tu comentario..."
|
||||
rows="3"
|
||||
required
|
||||
></textarea>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary w-full flex items-center justify-center"
|
||||
>
|
||||
<x-icons icon="save" class="w-4 h-4 mr-2" /> Guardar
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Zona derecha - Tabs de información -->
|
||||
<div x-data="{ activeTab: 'properties' }" class="w-1/2 flex flex-col bg-white">
|
||||
<!-- Tabs de navegación -->
|
||||
<div class="border-b border-gray-200">
|
||||
<nav class="flex space-x-4 px-4 pt-2">
|
||||
<button @click="activeTab = 'properties'"
|
||||
:class="activeTab === 'properties' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700'"
|
||||
class="py-4 px-1 border-b-2 font-medium">
|
||||
Propiedades
|
||||
</button>
|
||||
<button @click="activeTab = 'security'"
|
||||
:class="activeTab === 'security' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700'"
|
||||
class="py-4 px-1 border-b-2 font-medium">
|
||||
Seguridad
|
||||
</button>
|
||||
<button @click="activeTab = 'comments'"
|
||||
:class="activeTab === 'comments' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700'"
|
||||
class="py-4 px-1 border-b-2 font-medium">
|
||||
Comentarios
|
||||
</button>
|
||||
<button @click="activeTab = 'history'"
|
||||
:class="activeTab === 'history' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700'"
|
||||
class="py-4 px-1 border-b-2 font-medium">
|
||||
Historial
|
||||
</button>
|
||||
<button @click="activeTab = 'relations'"
|
||||
:class="activeTab === 'relations' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700'"
|
||||
class="py-4 px-1 border-b-2 font-medium">
|
||||
Relaciones
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Contenido de los tabs -->
|
||||
<div class="flex-1 overflow-y-auto p-4 space-y-6">
|
||||
<!-- Propiedades -->
|
||||
<div x-show="activeTab === 'properties'">
|
||||
<div class="space-y-4">
|
||||
<x-property-item label="Nombre" :value="$document->name" />
|
||||
<x-property-item label="Tipo" :value="$document->type" />
|
||||
<x-property-item label="Tamaño" :value="$document->size_for_humans" />
|
||||
<x-property-item label="Creado por" :value="Storage::url($document->file_path)" />
|
||||
<x-property-item label="Fecha creación" :value="$document->created_at->format('d/m/Y H:i')" />
|
||||
<x-property-item label="Última modificación" :value="$document->updated_at->format('d/m/Y H:i')" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Seguridad -->
|
||||
<div x-show="activeTab === 'security'" x-cloak>
|
||||
implementar
|
||||
</div>
|
||||
|
||||
<!-- Comentarios -->
|
||||
<div x-show="activeTab === 'comments'" x-cloak>
|
||||
<template x-for="comment in comments" :key="comment.id">
|
||||
<div class="p-4 mb-2 border rounded hover:bg-gray-50">
|
||||
<div class="text-sm text-gray-500"
|
||||
x-text="`Página ${comment.page} - ${new Date(comment.created_at).toLocaleString()}`"></div>
|
||||
<div x-text="comment.text" class="mt-1"></div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Historial -->
|
||||
<div x-show="activeTab === 'history'" x-cloak>
|
||||
<div class="space-y-4">
|
||||
@foreach($document->versions as $version)
|
||||
<x-version-item :version="$version" />
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Relaciones -->
|
||||
<div x-show="activeTab === 'relations'" x-cloak>
|
||||
implementar
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.min.js"></script>
|
||||
<script>
|
||||
// Configuración del Visor PDF
|
||||
var currentPage = 1;
|
||||
var nextPage = 2;
|
||||
|
||||
const url = "{{ Storage::url($document->file_path) }}";
|
||||
let pdfDoc = null,
|
||||
pageNum = 1,
|
||||
pageRendering = false,
|
||||
pageNumPending = null,
|
||||
scale = 0.8,
|
||||
canvas = document.getElementById('pdf-canvas');
|
||||
ctx = canvas.getContext('2d');
|
||||
|
||||
function renderPage(num) {
|
||||
pageRendering = true;
|
||||
pdfDoc.getPage(num).then(function(page) {
|
||||
const viewport = page.getViewport({ scale: 1.5 });
|
||||
canvas.height = viewport.height;
|
||||
canvas.width = viewport.width;
|
||||
|
||||
const renderContext = {
|
||||
canvasContext: ctx,
|
||||
viewport: viewport
|
||||
};
|
||||
|
||||
page.render(renderContext).promise.then(() => {
|
||||
pageRendering = false;
|
||||
loadCommentsForPage(num);
|
||||
});
|
||||
|
||||
// Wait for rendering to finish
|
||||
renderTask.promise.then(function() {
|
||||
pageRendering = false;
|
||||
if (pageNumPending !== null) {
|
||||
// New page rendering is pending
|
||||
renderPage(pageNumPending);
|
||||
pageNumPending = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handleCanvasClick(event) {
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
this.clickX = event.clientX - rect.left;
|
||||
this.clickY = event.clientY - rect.top;
|
||||
this.showCommentForm = true;
|
||||
}
|
||||
|
||||
// Cargar PDF
|
||||
pdfjsLib.getDocument(url).promise.then(function(pdf) {
|
||||
pdfDoc = pdf;
|
||||
renderPage(pageNum);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* If another page rendering in progress, waits until the rendering is
|
||||
* finised. Otherwise, executes rendering immediately.
|
||||
*/
|
||||
function queueRenderPage(num) {
|
||||
if (pageRendering) {
|
||||
pageNumPending = num;
|
||||
} else {
|
||||
renderPage(num);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays previous page.
|
||||
*/
|
||||
function onPrevPage() {
|
||||
if (pageNum <= 1) {
|
||||
return;
|
||||
}
|
||||
pageNum--;
|
||||
queueRenderPage(pageNum);
|
||||
}
|
||||
document.getElementById('prev').addEventListener('click', onPrevPage);
|
||||
|
||||
/**
|
||||
* Displays next page.
|
||||
*/
|
||||
function onNextPage() {
|
||||
if (pageNum >= pdfDoc.numPages) {
|
||||
return;
|
||||
}
|
||||
pageNum++;
|
||||
queueRenderPage(pageNum);
|
||||
}
|
||||
document.getElementById('next').addEventListener('click', onNextPage);
|
||||
|
||||
/**
|
||||
* Asynchronously downloads PDF.
|
||||
*/
|
||||
pdfjsLib.getDocument(url).promise.then(function(pdfDoc_) {
|
||||
pdfDoc = pdfDoc_;
|
||||
document.getElementById('page_count').textContent = pdfDoc.numPages;
|
||||
|
||||
// Initial/first page rendering
|
||||
renderPage(pageNum);
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -1,3 +1,61 @@
|
||||
<<<<<<< HEAD
|
||||
<div x-data="{ isUploading: false }"
|
||||
x-on:livewire-upload-start="isUploading = true"
|
||||
x-on:livewire-upload-finish="isUploading = false"
|
||||
x-on:livewire-upload-error="isUploading = false">
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ $label }}</label>
|
||||
|
||||
<!-- Zona de dropzone modificada -->
|
||||
<div wire:ignore
|
||||
x-on:drop.prevent="
|
||||
const files = event.dataTransfer.files;
|
||||
if (files.length) {
|
||||
@this.upload('image', files[0]);
|
||||
}
|
||||
$wire.toggleHover(false);
|
||||
event.stopPropagation(); // Evita propagación del evento
|
||||
"
|
||||
x-on:dragover.prevent="$wire.toggleHover(true)"
|
||||
x-on:dragleave.prevent="$wire.toggleHover(false)"
|
||||
class="dropzone {{ $hover ? 'dropzone-hover' : '' }} mb-3 p-4 border-2 border-dashed rounded text-center cursor-pointer">
|
||||
|
||||
<!-- Contenido modificado -->
|
||||
<div wire:loading wire:target="image" class="text-center py-4">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="visually-hidden">Cargando...</span>
|
||||
</div>
|
||||
<p>Subiendo imagen...</p>
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="image">
|
||||
@if(!$imagePath && !$image)
|
||||
<i class="fas fa-cloud-upload-alt fa-3x mb-2 text-muted"></i>
|
||||
<p class="mb-1">Arrastra y suelta tu imagen aquí</p>
|
||||
<p class="text-muted small">o haz clic para seleccionar</p>
|
||||
<!-- Input file modificado -->
|
||||
<input type="file"
|
||||
wire:model="image"
|
||||
class="d-none"
|
||||
id="fileInput"
|
||||
x-on:change="$wire.uploadImage(); event.stopPropagation();">
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-outline-primary mt-2"
|
||||
onclick="document.getElementById('fileInput').click()">
|
||||
Seleccionar archivo
|
||||
</button>
|
||||
@endif
|
||||
|
||||
<!-- Resto del contenido se mantiene igual -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@error('image')
|
||||
<div class="alert alert-danger mt-2">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
=======
|
||||
<div>
|
||||
<!-- Preview de imagen -->
|
||||
<div class="relative mb-4">
|
||||
@@ -41,4 +99,5 @@
|
||||
@enderror
|
||||
|
||||
<p class="mt-1 text-xs text-gray-500">PNG, JPG o JPEG (Max. 2MB)</p>
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
</div>
|
||||
283
resources/views/livewire/project/show.blade.php
Normal file
283
resources/views/livewire/project/show.blade.php
Normal file
@@ -0,0 +1,283 @@
|
||||
<div>
|
||||
<!-- Header y Breadcrumbs -->
|
||||
<div class="p-4 bg-white border-b">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<nav class="flex space-x-2 text-sm">
|
||||
<a wire:click="currentFolder = null" class="cursor-pointer text-gray-600 hover:text-blue-600">
|
||||
Inicio
|
||||
</a>
|
||||
@foreach($this->breadcrumbs as $folder)
|
||||
<span class="text-gray-400">/</span>
|
||||
<a wire:click="selectFolder({{ $folder->id }})"
|
||||
class="cursor-pointer text-gray-600 hover:text-blue-600">
|
||||
{{ $folder->name }}
|
||||
</a>
|
||||
@endforeach
|
||||
</nav>
|
||||
<h1 class="mt-2 text-2xl font-bold">{{ $project->name }}</h1>
|
||||
</div>
|
||||
<a href="{{ route('projects.edit', $project) }}"
|
||||
class="px-4 py-2 text-white bg-blue-600 rounded-lg hover:bg-blue-700">
|
||||
Editar Proyecto
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div wire:loading wire:target="files" class="fixed top-0 right-0 p-4 bg-blue-100 text-blue-800">
|
||||
Subiendo archivos...
|
||||
</div>
|
||||
|
||||
<!-- Contenedor principal con layout de explorador -->
|
||||
<div class="flex flex-col h-full">
|
||||
<!-- Barra de herramientas -->
|
||||
<div class="flex items-center justify-between p-4 bg-white border-b">
|
||||
<div class="flex items-center space-x-4">
|
||||
<!-- Botón Nueva Carpeta -->
|
||||
<button wire:click="showCreateFolderModal" class="flex items-center p-2 text-gray-600 hover:bg-gray-100 rounded">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z" />
|
||||
</svg>
|
||||
<span class="text-sm">Nueva carpeta</span>
|
||||
</button>
|
||||
|
||||
<!-- Botón Subir Archivos (versión con button) -->
|
||||
<div class="relative">
|
||||
<button
|
||||
wire:click="openUploadModal"
|
||||
class="flex items-center p-2 text-gray-600 hover:bg-gray-100 rounded">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
|
||||
</svg>
|
||||
<span class="text-sm">Subir archivos</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contenido principal (treeview + documentos) -->
|
||||
<div class="flex flex-1 overflow-hidden">
|
||||
<!-- Treeview de Carpetas -->
|
||||
<div class="w-64 h-full overflow-y-auto border-r bg-white">
|
||||
<div class="p-4">
|
||||
<ul class="space-y-1">
|
||||
@foreach($project->rootFolders as $folder)
|
||||
<x-folder-item
|
||||
:folder="$folder"
|
||||
:currentFolder="$currentFolder"
|
||||
:expandedFolders="$expandedFolders"
|
||||
wire:key="folder-{{ $folder->id }}"
|
||||
/>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Documentos -->
|
||||
<div class="flex-1 overflow-auto bg-white">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50 sticky top-0">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">Nombre</th>
|
||||
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">Versiones</th>
|
||||
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">Última Actualización</th>
|
||||
<th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase">Estado</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
@forelse($this->documents as $document)
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<a href="{{ route('documents.show', $document) }}"
|
||||
target="_blank"
|
||||
class="flex items-center hover:text-blue-600 transition-colors">
|
||||
@php
|
||||
$type = App\Helpers\FileHelper::getFileType($document->name);
|
||||
$iconComponent = $iconComponent = "icons." . $type;
|
||||
$iconClass = [
|
||||
'pdf' => 'pdf text-red-500',
|
||||
'word' => 'word text-blue-500',
|
||||
'excel' => 'excel text-green-500',
|
||||
// ... agregar todos los tipos
|
||||
][$type] ?? 'document text-gray-400';
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
component="{{ $iconComponent }}"
|
||||
class="w-5 h-5 mr-2 {{ explode(' ', $iconClass)[1] }}"
|
||||
/>
|
||||
|
||||
{{ $document->name }}
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{{ $document->versions_count }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{{ $document->updated_at->diffForHumans() }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<x-status-badge :status="$document->status" />
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="px-6 py-4 text-center text-gray-500">
|
||||
No se encontraron documentos en esta carpeta
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal para crear carpeta -->
|
||||
@if($showFolderModal)
|
||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
|
||||
<div class="w-full max-w-md p-6 bg-white rounded-lg shadow-xl">
|
||||
<div class="mb-4">
|
||||
<h3 class="text-lg font-medium text-gray-900">Crear nueva carpeta</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">Ingresa el nombre de la nueva carpeta</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<input
|
||||
type="text"
|
||||
wire:model="folderName"
|
||||
placeholder="Nombre de la carpeta"
|
||||
class="w-full p-2 border rounded focus:ring-blue-500 focus:border-blue-500"
|
||||
autofocus
|
||||
@keyup.enter="createFolder"
|
||||
>
|
||||
@error('folderName')
|
||||
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button
|
||||
wire:click="hideCreateFolderModal"
|
||||
class="px-4 py-2 text-sm text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50">
|
||||
Cancelar
|
||||
</button>
|
||||
<button
|
||||
wire:click="createFolder"
|
||||
class="px-4 py-2 text-sm text-white bg-blue-600 rounded-md hover:bg-blue-700">
|
||||
Crear carpeta
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Modal de subida -->
|
||||
@if($showUploadModal)
|
||||
<div
|
||||
x-data="{ isDragging: false }"
|
||||
x-on:drop.prevent="isDragging = false; $wire.selectFiles(Array.from($event.dataTransfer.files))"
|
||||
x-on:dragover.prevent="isDragging = true"
|
||||
x-on:dragleave.prevent="isDragging = false"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
|
||||
|
||||
<div class="w-full max-w-2xl p-6 bg-white rounded-lg shadow-xl">
|
||||
<div class="mb-4">
|
||||
<h3 class="text-lg font-medium text-gray-900">Subir archivos</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
{{ $currentFolder ? "Carpeta destino: {$currentFolder->name}" : "Carpeta raíz del proyecto" }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Área de drag & drop -->
|
||||
<div
|
||||
x-on:click="$refs.fileInput.click()"
|
||||
:class="isDragging ? 'border-blue-500 bg-blue-50' : 'border-gray-300'"
|
||||
class="flex flex-col items-center justify-center p-8 border-2 border-dashed rounded-lg cursor-pointer hover:bg-gray-50 transition-colors">
|
||||
<input
|
||||
type="file"
|
||||
x-ref="fileInput"
|
||||
wire:model="selectedFiles"
|
||||
multiple
|
||||
class="hidden"
|
||||
wire:change="selectFiles($event.target.files)">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-12 h-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
|
||||
</svg>
|
||||
|
||||
<div class="mt-4 text-center">
|
||||
<p class="font-medium text-gray-900">
|
||||
Arrastra archivos aquí o haz clic para seleccionar
|
||||
</p>
|
||||
<p class="text-sm text-gray-500">
|
||||
Formatos soportados: PDF, DOCX, XLSX, JPG, PNG (Máx. 10MB)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Lista de archivos -->
|
||||
<div class="mt-4 max-h-64 overflow-y-auto">
|
||||
@if(count($selectedFiles) > 0)
|
||||
<ul class="space-y-2">
|
||||
@foreach($selectedFiles as $index => $file)
|
||||
<li class="flex items-center justify-between p-2 bg-gray-50 rounded">
|
||||
<div class="flex items-center truncate">
|
||||
<x-icons icon="document" class="w-4 h-4 mr-2 text-gray-400" />
|
||||
<span class="text-sm truncate">
|
||||
{{ $file->getClientOriginalName() }} <!-- Ahora funciona -->
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center space-x-2">
|
||||
<span class="text-xs text-gray-500">
|
||||
{{ number_format($file->getSize() / 1024, 2) }} KB
|
||||
</span>
|
||||
<button
|
||||
wire:click="removeFile({{ $index }})"
|
||||
type="button"
|
||||
class="p-1 text-gray-400 hover:text-red-600">
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Footer del modal -->
|
||||
<div class="flex justify-end mt-6 space-x-3">
|
||||
<button
|
||||
wire:click="resetUpload"
|
||||
type="button"
|
||||
class="px-4 py-2 text-sm text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50">
|
||||
Cancelar
|
||||
</button>
|
||||
<button
|
||||
wire:click="uploadFiles"
|
||||
:disabled="!selectedFiles.length"
|
||||
class="px-4 py-2 text-sm text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">
|
||||
Subir archivos ({{ count($selectedFiles) }})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('livewire:init', () => {
|
||||
Livewire.on('upload-progress', (name, progress) => {
|
||||
// Actualizar progreso en el frontend
|
||||
const progressBar = document.querySelector(`[data-file="${name}"] .progress-bar`);
|
||||
if (progressBar) {
|
||||
progressBar.style.width = `${progress}%`;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -75,7 +75,11 @@
|
||||
<!-- Foto del usuario -->
|
||||
@if($user->profile_photo_path)
|
||||
<div class="mr-3 flex-shrink-0">
|
||||
<<<<<<< HEAD
|
||||
<img src="{{ asset('storage/' . $user->profile_photo_path) }}"
|
||||
=======
|
||||
<img src="{{ asset($user->profile_photo_path) }}"
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
alt="{{ $user->full_name }}"
|
||||
class="w-8 h-8 rounded-full object-cover transition-transform group-hover:scale-110">
|
||||
</div>
|
||||
|
||||
@@ -197,9 +197,15 @@
|
||||
<div>
|
||||
<x-label for="longitude" :value="__('Longitud')" />
|
||||
<input type="number"
|
||||
<<<<<<< HEAD
|
||||
id="longitude"
|
||||
name="longitude"
|
||||
value="{{ old('longitude') }}"
|
||||
=======
|
||||
id="latitude"
|
||||
name="latitude"
|
||||
value="{{ old('latitude') }}"
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
step="any"
|
||||
class="border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">
|
||||
</div>
|
||||
@@ -308,7 +314,11 @@
|
||||
|
||||
<template x-if="files.length === 0">
|
||||
<div>
|
||||
<<<<<<< HEAD
|
||||
<x-icons icon="upload" class="mx-auto h-12 w-12 text-gray-400" />
|
||||
=======
|
||||
<x-icons.upload class="mx-auto h-12 w-12 text-gray-400" />
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
<p class="mt-1 text-sm text-gray-600">
|
||||
Arrastra archivos o haz clic para subir
|
||||
</p>
|
||||
|
||||
@@ -109,11 +109,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Paginación -->
|
||||
@if($projects->hasPages())
|
||||
<div class="mt-6">
|
||||
{{ $projects->withQueryString()->links() }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
@@ -17,6 +17,10 @@
|
||||
</div>
|
||||
|
||||
<!-- Barra de herramientas principal -->
|
||||
<<<<<<< HEAD
|
||||
javi
|
||||
=======
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
|
||||
|
||||
<!-- Componente principal Livewire -->
|
||||
|
||||
@@ -291,12 +291,21 @@
|
||||
</td>
|
||||
<td class="py-2">
|
||||
<div class="mb-6">
|
||||
<<<<<<< HEAD
|
||||
@livewire('image-uploader', [
|
||||
'fieldName' => 'image_path', // Nombre del campo en la BD
|
||||
'label' => 'Imagen principal' // Etiqueta personalizada
|
||||
])
|
||||
<!-- Campo oculto para la ruta de la imagen -->
|
||||
<input type="hidden" name="profile_photo_path" id="profilePhotoPathInput" value="{{ old('profile_photo_path', $user->profile_photo_path) }}">
|
||||
=======
|
||||
|
||||
@livewire('image-uploader', [
|
||||
'fieldName' => 'profile_photo_path',
|
||||
'currentImage' => $user->profile_photo_path ?? null,
|
||||
'placeholder' => asset('images/default-user.png')
|
||||
])
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
</div>
|
||||
</td>
|
||||
</tr>php
|
||||
@@ -317,6 +326,18 @@
|
||||
|
||||
|
||||
<script>
|
||||
<<<<<<< HEAD
|
||||
// Escuchar el evento de Livewire y actualizar el campo oculto
|
||||
document.addEventListener('imageUploaded', (event) => {
|
||||
document.getElementById('profilePhotoPathInput').value = event.detail.path;
|
||||
});
|
||||
|
||||
document.addEventListener('imageRemoved', (event) => {
|
||||
document.getElementById('profilePhotoPathInput').value = '';
|
||||
});
|
||||
|
||||
=======
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
function generatePassword() {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()';
|
||||
let password = '';
|
||||
|
||||
@@ -6,9 +6,14 @@
|
||||
<!-- User Info Left -->
|
||||
<div class="flex items-center space-x-6">
|
||||
<!-- User Photo -->
|
||||
<<<<<<< HEAD
|
||||
<img src="{{ $user->profile_photo_path ? asset('storage/' . $user->profile_photo_path) : 'https://via.placeholder.com/150' }}"
|
||||
class="w-24 h-24 rounded-full object-cover border-2 border-blue-100">
|
||||
=======
|
||||
<img src="{{ $user->photo_url ?? 'https://via.placeholder.com/150' }}"
|
||||
class="w-24 h-24 rounded-full object-cover border-4 border-blue-100">
|
||||
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
<!-- User Details -->
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-gray-700">
|
||||
@@ -128,9 +133,15 @@
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<<<<<<< HEAD
|
||||
<div class="mt-6 flex justify-end space-x-4">
|
||||
<a href="{{ route('users.edit', $user) }}"
|
||||
class="w-[150px] px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg flex items-center justify-center">
|
||||
=======
|
||||
<div class="mt-6 flex space-x-4">
|
||||
<a href="{{ route('users.edit', $user) }}"
|
||||
class="px-4 py-2 w-[150px] bg-blue-600 hover:bg-blue-700 text-white rounded-lg flex items-center">
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"/>
|
||||
</svg>
|
||||
@@ -142,7 +153,11 @@
|
||||
@csrf
|
||||
@method('PUT') <!-- Important! -->
|
||||
<button type="submit"
|
||||
<<<<<<< HEAD
|
||||
class="w-[150px] px-4 py-2 bg-yellow-500 hover:bg-yellow-600 text-white rounded-lg flex items-center justify-center">
|
||||
=======
|
||||
class="px-4 py-2 w-[150px] {{ $user->is_active ? 'bg-red-600 hover:bg-red-700' : 'bg-green-600 hover:bg-green-700' }} text-white rounded-lg flex items-center">
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"/>
|
||||
</svg>
|
||||
@@ -156,7 +171,11 @@
|
||||
@method('DELETE') <!-- Important! -->
|
||||
<button type="submit"
|
||||
onclick="return confirm('¿Estás seguro de querer eliminar este usuario?')"
|
||||
<<<<<<< HEAD
|
||||
class="px-4 py-2 w-[150px] bg-red-600 hover:bg-red-700 text-white rounded-lg flex items-center justify-center">
|
||||
=======
|
||||
class="px-4 py-2 w-[150px] bg-red-600 hover:bg-red-700 text-white rounded-lg flex items-center">
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||||
</svg>
|
||||
@@ -167,6 +186,67 @@
|
||||
</div>
|
||||
|
||||
<!-- Permissions Tab -->
|
||||
<<<<<<< HEAD
|
||||
<div class="space-y-4">
|
||||
@foreach($permissionGroups as $groupName => $group)
|
||||
<div class="border rounded-lg overflow-hidden">
|
||||
<!-- Group Header -->
|
||||
<div class="bg-gray-50 px-4 py-3 flex justify-between items-center border-b">
|
||||
<h3 class="font-semibold text-gray-700">
|
||||
{{ ucfirst($groupName) }} Permissions
|
||||
</h3>
|
||||
|
||||
<div class="flex space-x-2">
|
||||
<!-- Toggle All On -->
|
||||
<button wire:click="toggleAllGroupPermissions('{{ $groupName }}', true)"
|
||||
class="px-3 py-1 text-xs bg-green-100 text-green-800 rounded hover:bg-green-200 flex items-center">
|
||||
<svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
||||
</svg>
|
||||
Activar Todos
|
||||
</button>
|
||||
|
||||
<!-- Toggle All Off -->
|
||||
<button wire:click="toggleAllGroupPermissions('{{ $groupName }}', false)"
|
||||
class="px-3 py-1 text-xs bg-red-100 text-red-800 rounded hover:bg-red-200 flex items-center">
|
||||
<svg class="w-3 h-3 mr-1" 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>
|
||||
Desactivar Todos
|
||||
</button>
|
||||
|
||||
<!-- Collapse Toggle -->
|
||||
<button wire:click="toggleGroupCollapse('{{ $groupName }}')"
|
||||
class="px-3 py-1 text-xs bg-gray-100 text-gray-800 rounded hover:bg-gray-200 flex items-center">
|
||||
<svg x-show="!collapsedGroups.includes('{{ $groupName }}')" class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
|
||||
</svg>
|
||||
<svg x-show="collapsedGroups.includes('{{ $groupName }}')" class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" x-cloak>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Permissions List -->
|
||||
<div x-show="!collapsedGroups.includes('{{ $groupName }}')" class="divide-y divide-gray-200">
|
||||
@foreach($group['permissions'] as $permission)
|
||||
<div class="px-4 py-3 flex justify-between items-center hover:bg-gray-50">
|
||||
<div class="flex items-center">
|
||||
<span class="text-sm text-gray-700">{{ $permission['description'] ?? $permission['name'] }}</span>
|
||||
|
||||
@if($permission['description'])
|
||||
<span class="ml-2 text-xs text-gray-500">({{ $permission['name'] }})</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<label class="relative inline-flex items-center cursor-pointer">
|
||||
<input type="checkbox"
|
||||
@if(true || $user->hasPermissionTo($permission['name'])) checked @endif
|
||||
wire:change="togglePermission('{{ $permission['name'] }}')"
|
||||
class="sr-only peer">
|
||||
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
|
||||
=======
|
||||
<div x-show="activeTab === 'permissions'" x-cloak>
|
||||
<div class="space-y-6">
|
||||
@foreach($permissionGroups as $group => $permissions)
|
||||
@@ -181,6 +261,7 @@
|
||||
@if($user->hasPermissionTo($permission)) checked @endif
|
||||
wire:change="togglePermission('{{ $permission->name }}')">
|
||||
<span class="slider round"></span>
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@@ -190,7 +271,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<!-- Pestaña de Proyectos -->
|
||||
=======
|
||||
<!-- Nueva Pestaña de Proyectos -->
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
<div x-show="activeTab === 'projects'" x-cloak>
|
||||
<div class="space-y-6">
|
||||
<!-- Proyectos Actuales -->
|
||||
@@ -256,4 +341,25 @@
|
||||
transform: translateX(26px);
|
||||
}
|
||||
</style>
|
||||
<<<<<<< HEAD
|
||||
|
||||
<script>
|
||||
document.addEventListener('alpine:init', () => {
|
||||
Alpine.data('permissions', () => ({
|
||||
init() {
|
||||
// Inicializar datos desde Livewire
|
||||
this.$watch('$wire.permissionGroups', value => {
|
||||
this.groups = value;
|
||||
});
|
||||
},
|
||||
|
||||
toggleAll(groupName, enable) {
|
||||
this.$wire.toggleAllGroupPermissions(groupName, enable);
|
||||
}
|
||||
}));
|
||||
});
|
||||
</script>
|
||||
|
||||
=======
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
</x-layouts.app>
|
||||
@@ -49,15 +49,22 @@ Route::middleware(['auth', 'verified'])->group(function () {
|
||||
|
||||
// Proyectos
|
||||
Route::resource('projects', ProjectController::class);
|
||||
<<<<<<< HEAD
|
||||
//Route::get('/projects/{project}', ProjectController::class)->name('projects.show');
|
||||
//Route::get('/projects/{project}', ProjectController::class)->name('projects.show')->middleware('can:view,project'); // Opcional: política de acceso
|
||||
Route::get('/projects/{project}', ProjectShow::class)->name('projects.show')->middleware('auth');
|
||||
=======
|
||||
Route::get('/projects/{project}', ProjectController::class)->name('projects.show');
|
||||
//Route::get('/projects/{project}', ProjectController::class)->name('projects.show')->middleware('can:view,project'); // Opcional: política de acceso
|
||||
//Route::get('/projects/{project}', ProjectShow::class)->name('projects.show');
|
||||
|
||||
>>>>>>> f97a7a84985ea300216ba3ea2ab4c31306e1659a
|
||||
|
||||
// Documentos
|
||||
Route::resource('documents', DocumentController::class);
|
||||
Route::post('/documents/{document}/approve', [DocumentController::class, 'approve'])->name('documents.approve');
|
||||
Route::post('/documents/{document}/comment', [DocumentController::class, 'addComment'])->name('documents.comment');
|
||||
Route::post('/documents/{document}', [DocumentController::class, 'show'])->name('documents.show');
|
||||
//Route::post('/documents/{document}/approve', [DocumentController::class, 'approve'])->name('documents.approve');
|
||||
//Route::post('/documents/{document}/comment', [DocumentController::class, 'addComment'])->name('documents.comment');
|
||||
|
||||
// Carpetas
|
||||
Route::prefix('folders')->group(function () {
|
||||
|
||||
2
storage/app/public/.gitignore
vendored
2
storage/app/public/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
Reference in New Issue
Block a user