Files
Nexora/resources/views/projects/index.blade.php
2025-05-07 00:07:40 +02:00

115 lines
6.1 KiB
PHP

<!-- resources/views/projects/index.blade.php -->
<x-layouts.app :title="__('Proyectos')">
<x-slot name="header">
<h2 class="text-xl font-semibold leading-tight text-gray-800">
{{ __('Mis Proyectos') }}
</h2>
</x-slot>
<div class="py-6">
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
<!-- Barra de búsqueda y creación -->
<div class="flex flex-col justify-between mb-6 space-y-4 md:flex-row md:space-y-0">
<div class="flex-1 max-w-md">
<form action="{{ route('projects.index') }}" method="GET">
<div class="relative">
<input type="search" name="search" value="{{ request('search') }}"
class="w-full pl-10 pr-4 py-2 rounded-lg border focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="Buscar proyectos...">
<x-icons icon="search" class="absolute left-3 top-2.5 w-5 h-5 text-gray-400" />
</div>
</form>
</div>
@can('create', App\Models\Project::class)
<a href="{{ route('projects.create') }}"
class="flex items-center px-4 py-2 text-white bg-blue-600 rounded-lg hover:bg-blue-700">
<x-icons icon="plus" class="w-5 h-5 mr-2" />
{{ __('Nuevo Proyecto') }}
</a>
@endcan
</div>
<!-- Listado de proyectos -->
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
@forelse($projects as $project)
<div class="overflow-hidden bg-white rounded-lg shadow">
<div class="p-6">
<div class="flex items-start justify-between">
<div class="flex-1">
<h3 class="text-lg font-semibold text-gray-900">
<a href="{{ route('projects.show', $project) }}"
class="hover:text-blue-600 hover:underline">
{{ $project->name }}
</a>
</h3>
<p class="mt-2 text-sm text-gray-500">
{{ Str::limit($project->description, 100) }}
</p>
</div>
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="p-1 text-gray-400 hover:text-gray-600">
<x-icons icon="dots-vertical class="w-5 h-5" />
</button>
</x-slot>
<x-slot name="content">
<x-dropdown-link href="{{ route('projects.show', $project) }}">
<x-icons icon="eye" class="w-5 h-5 mr-2" /> Ver Detalles
</x-dropdown-link>
@can('update', $project)
<x-dropdown-link href="{{ route('projects.edit', $project) }}">
<x-icons icon="pencil" class="w-5 h-5 mr-2" /> Editar
</x-dropdown-link>
@endcan
@can('delete', $project)
<form method="POST" action="{{ route('projects.destroy', $project) }}">
@csrf
@method('DELETE')
<x-dropdown-link href="#"
onclick="event.preventDefault(); this.closest('form').submit();"
class="text-red-600 hover:bg-red-50">
<x-icons icon="trash" class="w-5 h-5 mr-2" /> Eliminar
</x-dropdown-link>
</form>
@endcan
</x-slot>
</x-dropdown>
</div>
<!-- Metadatos del proyecto -->
<div class="mt-4">
<div class="flex items-center justify-between mt-3 text-sm">
<span class="flex items-center text-gray-500">
<x-icons icon="document" class="w-4 h-4 mr-1" />
{{ $project->documents_count }} documentos
</span>
<span class="px-2 py-1 text-sm rounded-full
{{ $project->status === 'active' ? 'bg-green-100 text-green-800' : 'bg-gray-100 text-gray-800' }}">
{{ __(Str::ucfirst($project->status)) }}
</span>
</div>
<div class="mt-2 text-sm text-gray-500">
<x-icons icon="calendar" class="w-4 h-4 mr-1 inline" />
Creado {{ $project->created_at->diffForHumans() }}
</div>
</div>
</div>
</div>
@empty
<div class="p-6 text-center text-gray-500 col-span-full">
<x-icons icon="folder-remove" class="w-12 h-12 mx-auto mb-4 text-gray-400" />
{{ __('No tienes proyectos asignados.') }}
</div>
@endforelse
</div>
<!-- Paginación -->
</div>
</div>
</x-layouts.app>