añadir nuevas funcionalidades

This commit is contained in:
2025-04-30 20:56:28 +02:00
parent 883daf32ed
commit 655ea60d6b
71 changed files with 3836 additions and 1158 deletions

View File

@@ -1,360 +1,378 @@
<!-- resources/views/projects/create.blade.php -->
<x-layouts.app :title="__('Create Project')">
<x-slot name="header">
<h2 class="flex items-center gap-2 text-xl font-semibold leading-tight text-gray-800">
<!-- Icono (ejemplo con Heroicons) -->
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
</svg>
<div class="max-w-4xl mx-auto px-0 py-4">
<header class="bg-white shadow">
<div class="px-4 py-6 mx-auto max-w-7xl sm:px-6 lg:px-8">
<h2 class="flex items-center text-xl font-semibold leading-tight text-gray-800">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
</svg>
{{ __('Nuevo Proyecto') }}
@error('error')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</h2>
</div>
</header>
<form method="POST" action="{{ route('projects.store') }}" enctype="multipart/form-data">
@csrf
{{ __('Nuevo Proyecto') }}
</h2>
</x-slot>
<header class="bg-white shadow">
<div class="px-4 py-6 mx-auto max-w-7xl sm:px-6 lg:px-8">
<h2 class="flex items-center text-xl font-semibold leading-tight text-gray-800">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
</svg>
{{ __('Nuevo Proyecto') }}
</h2>
</div>
</header>
<div class="py-6">
<div class="px-4 py-6 mx-auto max-w-7xl sm:px-6 lg:px-8">
<div class="overflow-hidden bg-white shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<form method="POST" action="{{ route('projects.store') }}" enctype="multipart/form-data">
@csrf
<table class="w-full mb-8">
<tbody>
<!-- Nombre -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="name" :value="__('Nombre del Proyecto')" />
</td>
<td class="py-3">
<x-input id="name"
class="block w-[150px] mt-1 border-0 border-b border-gray-300 focus:ring-0 focus:border-blue-500"
type="text" name="name"
:value="old('name')"
required />
@error('name')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Descripción -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="description" :value="__('Descripción')" />
</td>
<td class="py-3">
<x-textarea id="description" class="block w-full mt-1" name="description" rows="4" required>
{{ old('description') }}
</x-textarea>
@error('description')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Editor Enriquecido -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="description" :value="__('Descripción Detallada')" />
</td>
<td class="py-3">
<div id="editor-container">
<!-- Barra de herramientas -->
<div id="toolbar">
<button class="ql-bold"></button>
<button class="ql-italic"></button>
<button class="ql-underline"></button>
<button class="ql-strike"></button>
<button class="ql-blockquote"></button>
<button class="ql-code-block"></button>
<button class="ql-link"></button>
<button class="ql-image"></button>
</div>
<!-- Editor -->
<input type="hidden" name="description">
<div id="rich-editor" class="h-48">{!! old('description') !!}</div>
</div>
@error('description')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Estado -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="status" :value="__('Estado del Proyecto')" />
</td>
<td class="py-3">
<x-select id="status" name="status" class="block w-full mt-1">
<option :value="active" {{ old('status') == 'active' ? 'selected' : '' }}>Activo</option>
<option :value="inactive" {{ old('status') == 'inactive' ? 'selected' : '' }}>Inactivo</option>
</x-select>
@error('status')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Imagen de Referencia -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="reference_image" :value="__('Imagen de Referencia')" />
</td>
<td class="py-3">
<div class="relative mt-1">
<input type="file" id="project_image" name="project_image"
class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4
file:rounded-md file:border-0
file:text-sm file:font-semibold
file:bg-blue-50 file:text-blue-700
hover:file:bg-blue-100"
accept="image/*"
onchange="previewImage(event)">
<div class="mt-2" id="image-preview-container" style="display:none;">
<img id="image-preview" class="object-cover h-48 w-full rounded-lg">
</div>
</div>
@error('project_image')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Dirección -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Ubicación')" />
</td>
<td class="py-3">
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div>
<x-input id="address" class="block w-full mt-1"
type="text" name="address"
:value="old('address')"
placeholder="Dirección" />
@error('address')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<x-input id="postal_code" class="block w-full mt-1"
type="text" name="postal_code"
:value="old('postal_code')"
placeholder="Código Postal" />
@error('postal_code')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<x-input id="province" class="block w-full mt-1"
type="text" name="province"
:value="old('province')"
placeholder="Provincia" />
@error('province')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<x-select id="country" name="country" class="block w-full mt-1">
<option :value="">Seleccione País</option>
@foreach(config('countries') as $code => $name)
<option :value="{{ $code }}" {{ old('country') == $code ? 'selected' : '' }}>
{{ $name }}
</option>
@endforeach
</x-select>
@error('country')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</td>
</tr>
<!-- Mapa para Coordenadas -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Seleccione Ubicación en el Mapa')" />
</td>
<td class="py-3">
<div id="map" class="h-64 rounded-lg border-2 border-gray-200"></div>
<div class="grid grid-cols-2 gap-4 mt-2">
<div>
<x-label for="latitude" :value="__('Latitud')" />
<x-input id="latitude" name="latitude"
type="number" step="any"
:value="old('latitude')" required />
</div>
<div>
<x-label for="longitude" :value="__('Longitud')" />
<x-input id="longitude" name="longitude"
type="number" step="any"
:value="old('longitude')" required />
</div>
</div>
@error('latitude')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
@error('longitude')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Icono y Categorías -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Identificación Visual')" />
</td>
<td class="py-3">
<div class="grid grid-cols-2 gap-4">
<div>
<x-label for="icon" :value="__('Icono del Proyecto')" />
<div class="relative mt-1">
<select id="icon" name="icon"
class="w-full rounded-md shadow-sm border-gray-300 focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
<option :value="">Seleccionar Icono</option>
@foreach(config('project.icons') as $icon)
<option :value="{{ $icon }}"
{{ old('icon') == $icon ? 'selected' : '' }}>
<i class="fas fa-{{ $icon }} mr-2"></i>
{{ Str::title($icon) }}
</option>
@endforeach
</select>
</div>
</div>
<div>
<x-label for="categories" :value="__('Categorías')" />
<x-multiselect
name="categories[]"
:options="$categories"
:selected="old('categories', [])"
placeholder="Seleccione categorías"
/>
</div>
</div>
</td>
</tr>
<!-- Fechas Importantes -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="start_date" :value="__('Fechas')" />
</td>
<td class="py-3">
<div class="flex items-center gap-4 mt-2">
<span class="text-gray-700">de</span>
<x-input id="start_date" type="date" name="start_date" :value="old('start_date')" />
<span class="text-gray-700">a</span>
<x-input id="deadline" type="date" name="deadline" :value="old('deadline')" min="{{ now()->format('Y-m-d') }}" />
</div>
</td>
</tr>
<!-- Archivos Adjuntos -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Documentos Iniciales')" />
</td>
<td class="py-3">
<div x-data="{ files: [] }" class="mt-1">
<div class="flex items-center justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
<div class="text-center">
<input type="file"
name="documents[]"
multiple
class="absolute opacity-0"
x-ref="fileInput"
@change="files = Array.from($event.target.files)">
<template x-if="files.length === 0">
<div>
<x-icons.upload class="mx-auto h-12 w-12 text-gray-400" />
<p class="mt-1 text-sm text-gray-600">
Arrastra archivos o haz clic para subir
</p>
</div>
</template>
<template x-if="files.length > 0">
<div class="space-y-2">
<template x-for="(file, index) in files" :key="index">
<div class="flex items-center text-sm text-gray-600">
<x-icons icon="document" class="w-5 h-5 mr-2" />
<span x-text="file.name"></span>
</div>
</template>
</div>
</template>
</div>
</div>
</div>
</td>
</tr>
<!-- Miembros del Equipo -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Miembros del Equipo')" />
</td>
<td class="py-3">
<div class="grid grid-cols-1 mt-2 gap-y-2 gap-x-4 sm:grid-cols-2">
@foreach($users as $user)
<label class="flex items-center space-x-2">
<input type="checkbox"
name="team[]"
value="{{ $user->id }}"
{{ in_array($user->id, old('team', [])) ? 'checked' : '' }}
class="rounded border-gray-300 text-blue-600 shadow-sm focus:ring-blue-500">
<span class="text-sm text-gray-700">{{ $user->name }}</span>
</label>
@endforeach
</div>
@error('team')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
</tbody>
</table>
<!-- Botones de Acción -->
<div class="flex justify-end mt-8 space-x-4">
<a href="{{ route('projects.index') }}"
class="px-4 py-2 text-gray-600 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50">
{{ __('Cancelar') }}
</a>
<x-button type="submit" class="bg-blue-600 hover:bg-blue-700">
<x-icons icon="save" class="w-5 h-5 mr-2" />
{{ __('Crear Proyecto') }}
</x-button>
</div>
</form>
<!-- Separador -->
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center">
<span class="px-4 bg-white text-sm text-gray-500">Datos Generales</span>
</div>
</div>
</div>
</div>
@push('styles')
<div class="bg-white py-6">
<table class="w-full mb-8">
<tbody>
<!-- Nombre -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="name" :value="__('Nombre del Proyecto')" />
</td>
<td class="py-3">
<input type="text" name="name"
value="{{ old('name', $project->name ?? '') }}"
class="w-[250px] border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none"
autofocus
required>
@error('name')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Descripción -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="description" :value="__('Descripción')" />
</td>
<td class="py-3">
<x-textarea id="description" class="block w-full mt-1" name="description" rows="4" required>
{{ old('description') }}
</x-textarea>
@error('description')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Estado -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="status" :value="__('Estado del Proyecto')" />
</td>
<td class="py-3">
<x-select id="status" name="status" class="block w-full mt-1">
<option :value="active" {{ old('status') == 'active' ? 'selected' : '' }}>Activo</option>
<option :value="inactive" {{ old('status') == 'inactive' ? 'selected' : '' }}>Inactivo</option>
</x-select>
@error('status')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Fechas Importantes -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="start_date" :value="__('Fechas')" />
</td>
<td class="py-3">
<div class="flex gap-4">
<span class="text-gray-700">de</span>
<input type="date"
id="start_date"
name="start_date"
value="{{ old('start_date') }}"
class="w-[150px] border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">
<span class="text-gray-700">a</span>
<input type="date"
id="deadline"
name="deadline"
value="{{ old('end_date') }}"
class="w-[150px] border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center">
<span class="px-4 bg-white text-sm text-gray-500">Ubicación </span>
</div>
</div>
<div class="bg-white py-6">
<table class="w-full mb-8">
<tbody>
<!-- Dirección -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Dirección')" />
</td>
<td class="py-3">
<div class="grid grid-cols-1 gap-4 sm:grid-cols-1">
<div>
<textarea id="address"
name="address"
rows="3"
class="w-full border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">{{ old('address') }}
</textarea>
@error('address')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<input type="text"
id="postal_code"
name="postal_code"
value="{{ old('postal_code') }}"
placeholder="Código Postal"
class="w-[120px] border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">
@error('postal_code')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<input type="text"
id="province"
name="province"
value="{{ old('province') }}"
placeholder="Provincia"
class="w-[300px] border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">
@error('province')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<livewire:country-select :initialCountry="old('country')" />
@error('country')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</td>
</tr>
<!-- Mapa para Coordenadas -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Seleccione Ubicación')" />
</td>
<td class="py-3">
<div id="map" class="h-64 border-2 border-gray-200"></div>
<div class="grid grid-cols-2 gap-4 mt-2">
<div>
<x-label for="latitude" :value="__('Latitud')" />
<input type="number"
id="latitude"
name="latitude"
value="{{ old('latitude') }}"
step="any"
class="border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">
</div>
<div>
<x-label for="longitude" :value="__('Longitud')" />
<input type="number"
id="longitude"
name="longitude"
value="{{ old('longitude') }}"
step="any"
class="border-b-1 border-gray-300 focus:border-blue-500 focus:outline-none">
</div>
</div>
@error('latitude')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
@error('longitude')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
</tbody>
</table>
</div>
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center">
<span class="px-4 bg-white text-sm text-gray-500">Otros datos</span>
</div>
</div>
<div class="bg-white py-6">
<table class="w-full mb-8">
<tbody>
<!-- Imagen de Referencia -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label for="reference_image" :value="__('Imagen de Referencia')" />
</td>
<td class="py-3">
<div class="relative mt-1">
<input type="file" id="project_image" name="project_image"
class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4
file:rounded-md file:border-0
file:text-sm file:font-semibold
file:bg-blue-50 file:text-blue-700
hover:file:bg-blue-100"
accept="image/*"
onchange="previewImage(event)">
<div class="mt-2" id="image-preview-container" style="display:none;">
<img id="image-preview" class="object-cover h-48 w-full rounded-lg">
</div>
</div>
@error('project_image')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
<!-- Icono y Categorías -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Identificación Visual')" />
</td>
<td class="py-3">
<div class="grid grid-cols-2 gap-4">
<div>
<x-label for="icon" :value="__('Icono del Proyecto')" />
<div class="relative mt-1">
<select id="icon" name="icon"
class="w-full rounded-md shadow-sm border-gray-300 focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
<option :value="">Seleccionar Icono</option>
@foreach(config('project.icons') as $icon)
<option :value="{{ $icon }}"
{{ old('icon') == $icon ? 'selected' : '' }}>
<i class="fas fa-{{ $icon }} mr-2"></i>
{{ Str::title($icon) }}
</option>
@endforeach
</select>
</div>
</div>
<div>
<x-label for="categories" :value="__('Categorías')" />
<x-multiselect
name="categories[]"
:options="$categories"
:selected="old('categories', [])"
placeholder="Seleccione categorías"
/>
</div>
</div>
</td>
</tr>
<!-- Archivos Adjuntos -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Documentos Iniciales')" />
</td>
<td class="py-3">
<div x-data="{ files: [] }" class="mt-1">
<div class="flex items-center justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
<div class="text-center">
<input type="file"
name="documents[]"
multiple
class="absolute opacity-0"
x-ref="fileInput"
@change="files = Array.from($event.target.files)">
<template x-if="files.length === 0">
<div>
<x-icons icon="upload" class="mx-auto h-12 w-12 text-gray-400" />
<p class="mt-1 text-sm text-gray-600">
Arrastra archivos o haz clic para subir
</p>
</div>
</template>
<template x-if="files.length > 0">
<div class="space-y-2">
<template x-for="(file, index) in files" :key="index">
<div class="flex items-center text-sm text-gray-600">
<x-icons icon="document" class="w-5 h-5 mr-2" />
<span x-text="file.name"></span>
</div>
</template>
</div>
</template>
</div>
</div>
</div>
</td>
</tr>
<!-- Miembros del Equipo -->
<tr>
<td class="w-1/4 py-3 pr-4 align-top">
<x-label :value="__('Miembros del Equipo')" />
</td>
<td class="py-3">
<div class="grid grid-cols-1 mt-2 gap-y-2 gap-x-4 sm:grid-cols-2">
@foreach($users as $user)
<label class="flex items-center space-x-2">
<input type="checkbox"
name="team[]"
value="{{ $user->id }}"
{{ in_array($user->id, old('team', [])) ? 'checked' : '' }}
class="rounded border-gray-300 text-blue-600 shadow-sm focus:ring-blue-500">
<span class="text-sm text-gray-700">{{ $user->first_name}} {{ $user->last_name}}</span>
</label>
@endforeach
</div>
@error('team')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</td>
</tr>
</tbody>
</table>
</div>
<!-- Botones de Acción -->
<div class="flex justify-end mt-8 space-x-4">
<a href="{{ route('projects.index') }}"
class="px-4 py-2 text-gray-600 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50">
{{ __('Cancelar') }}
</a>
<x-button type="submit" class="bg-blue-600 hover:bg-blue-700">
<x-icons icon="save" class="w-5 h-5 mr-2" />
{{ __('Crear Proyecto') }}
</x-button>
</div>
</form>
</div>
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.snow.css" rel="stylesheet" />
@@ -363,11 +381,7 @@
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
@endpush
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify"></script>
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.js"></script>
<!-- Leaflet JS -->
@@ -469,5 +483,4 @@
};
</script>
@endpush
</x-layouts.app>

View File

@@ -1,386 +0,0 @@
<!-- resources/views/projects/create.blade.php -->
<x-layouts.app :title="__('Create Project')">
<x-slot name="header">
<h2 class="text-xl font-semibold leading-tight text-gray-800">
Nuevo Proyecto
</h2>
</x-slot>
<div class="py-6">
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
<div class="overflow-hidden bg-white shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<form method="POST" action="{{ route('projects.store') }}" enctype="multipart/form-data">
@csrf
<!-- Sección de Información Básica -->
<div class="grid gap-6 mb-8 md:grid-cols-2">
<!-- Columna Izquierda -->
<div>
<!-- Nombre -->
<div class="mb-6">
<x-label for="name" value="__('Nombre del Proyecto')" />
<x-input id="name" class="block w-full mt-1"
type="text" name="name" value="old('name')" required />
@error('name')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Descripción -->
<div class="mb-6">
<x-label for="description" value="__('Descripción')" />
<x-textarea id="description" class="block w-full mt-1"
name="description" rows="4" required>
{{ old('description') }}
</x-textarea>
@error('description')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Editor Enriquecido -->
<div class="mb-6">
<x-label for="description" value="__('Descripción Detallada')" />
<div id="editor-container">
<!-- Barra de herramientas -->
<div id="toolbar">
<button class="ql-bold"></button>
<button class="ql-italic"></button>
<button class="ql-underline"></button>
<button class="ql-strike"></button>
<button class="ql-blockquote"></button>
<button class="ql-code-block"></button>
<button class="ql-link"></button>
<button class="ql-image"></button>
</div>
<!-- Editor -->
<div id="rich-editor">{!! old('description') !!}</div>
</div>
@error('description')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Estado -->
<div class="mb-6">
<x-label for="status" value="__('Estado del Proyecto')" />
<x-select id="status" name="status" class="block w-full mt-1">
<option value="active" {{ old('status') == 'active' ? 'selected' : '' }}>Activo</option>
<option value="inactive" {{ old('status') == 'inactive' ? 'selected' : '' }}>Inactivo</option>
</x-select>
@error('status')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Imagen de Referencia -->
<div class="mb-6">
<x-label for="project_image" value="__('Imagen de Referencia')" />
<div class="relative mt-1">
<input type="file" id="project_image" name="project_image"
class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4
file:rounded-md file:border-0
file:text-sm file:font-semibold
file:bg-blue-50 file:text-blue-700
hover:file:bg-blue-100"
accept="image/*"
onchange="previewImage(event)">
<div class="mt-2" id="image-preview-container" style="display:none;">
<img id="image-preview" class="object-cover h-48 w-full rounded-lg">
</div>
</div>
@error('project_image')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<!-- Columna Derecha -->
<div>
<!-- Dirección -->
<div class="mb-6">
<x-label value="__('Ubicación')" />
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div>
<x-input id="address" class="block w-full mt-1"
type="text" name="address"
value="old('address')"
placeholder="Dirección" />
@error('address')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<x-input id="postal_code" class="block w-full mt-1"
type="text" name="postal_code"
value="old('postal_code')"
placeholder="Código Postal" />
@error('postal_code')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<x-input id="province" class="block w-full mt-1"
type="text" name="province"
value="old('province')"
placeholder="Provincia" />
@error('province')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<x-select id="country" name="country" class="block w-full mt-1">
<option value="">Seleccione País</option>
@foreach(config('countries') as $code => $name)
<option value="{{ $code }}" {{ old('country') == $code ? 'selected' : '' }}>
{{ $name }}
</option>
@endforeach
</x-select>
@error('country')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<!-- Mapa para Coordenadas -->
<div class="mb-6">
<x-label value="__('Seleccione Ubicación en el Mapa')" />
<div id="map" class="h-64 rounded-lg border-2 border-gray-200"></div>
<div class="grid grid-cols-2 gap-4 mt-2">
<div>
<x-label for="latitude" value="__('Latitud')" />
<x-input id="latitude" name="latitude"
type="number" step="any"
value="old('latitude')" required />
</div>
<div>
<x-label for="longitude" value="__('Longitud')" />
<x-input id="longitude" name="longitude"
type="number" step="any"
value="old('longitude')" required />
</div>
</div>
@error('latitude')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
@error('longitude')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<!-- Sección Principal en 2 Columnas -->
<div class="grid gap-6 mb-8 md:grid-cols-2">
<!-- Columna Izquierda -->
<div>
<!-- Icono y Categorías -->
<div class="mb-6">
<x-label value="__('Identificación Visual')" />
<div class="grid grid-cols-2 gap-4">
<div>
<x-label for="icon" value="__('Icono del Proyecto')" />
<div class="relative mt-1">
<select id="icon" name="icon"
class="w-full rounded-md shadow-sm border-gray-300 focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50">
<option value="">Seleccionar Icono</option>
@foreach(config('project.icons') as $icon)
<option value="{{ $icon }}"
{{ old('icon') == $icon ? 'selected' : '' }}>
<i class="fas fa-{{ $icon }} mr-2"></i>
{{ Str::title($icon) }}
</option>
@endforeach
</select>
</div>
</div>
<div>
<x-label for="categories" value="__('Categorías')" />
<x-multiselect
name="categories[]"
:options="$categories"
:selected="old('categories', [])"
placeholder="Seleccione categorías"
/>
</div>
</div>
</div>
<!-- Fechas Importantes -->
<div class="grid grid-cols-2 gap-4 mb-6">
<div>
<x-label for="start_date" value="__('Fecha de Inicio')" />
<x-input id="start_date" type="date"
name="start_date" value="old('start_date')" />
</div>
<div>
<x-label for="deadline" value="__('Fecha Límite')" />
<x-input id="deadline" type="date"
name="deadline" value="old('deadline')"
min="{{ now()->format('Y-m-d') }}" />
</div>
</div>
</div>
<!-- Columna Derecha -->
<div>
<!-- Archivos Adjuntos -->
<div class="mb-6">
<x-label value="__('Documentos Iniciales')" />
<div x-data="{ files: [] }" class="mt-1">
<div class="flex items-center justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
<div class="text-center">
<input type="file"
name="documents[]"
multiple
class="absolute opacity-0"
x-ref="fileInput"
@change="files = Array.from($event.target.files)">
<template x-if="files.length === 0">
<div>
<x-icons.upload class="mx-auto h-12 w-12 text-gray-400" />
<p class="mt-1 text-sm text-gray-600">
Arrastra archivos o haz clic para subir
</p>
</div>
</template>
<template x-if="files.length > 0">
<div class="space-y-2">
<template x-for="(file, index) in files" :key="index">
<div class="flex items-center text-sm text-gray-600">
<x-icons icon="document" class="w-5 h-5 mr-2" />
<span x-text="file.name"></span>
</div>
</template>
</div>
</template>
</div>
</div>
</div>
</div>
<!-- Mapa y Ubicación (Implementación previa) -->
<!-- ... (Mantener sección de mapa y ubicación anterior) ... -->
</div>
</div>
<!-- Resto del formulario -->
<!-- ... (Mantener secciones anteriores de equipo, estado, etc) ... -->
<!-- Miembros del Equipo -->
<div class="mb-6">
Miembros del Equipo
<x-label value="__('Miembros del Equipo')" />
<div class="grid grid-cols-1 mt-2 gap-y-2 gap-x-4 sm:grid-cols-2">
@foreach($users as $user)
<label class="flex items-center space-x-2">
<input type="checkbox"
name="team[]"
value="{{ $user->id }}"
{{ in_array($user->id, old('team', [])) ? 'checked' : '' }}
class="rounded border-gray-300 text-blue-600 shadow-sm focus:ring-blue-500">
<span class="text-sm text-gray-700">{{ $user->name }}</span>
</label>
@endforeach
</div>
@error('team')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Botones de Acción -->
<div class="flex justify-end mt-8 space-x-4">
<a href="{{ route('projects.index') }}"
class="px-4 py-2 text-gray-600 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50">
{{ __('Cancelar') }}
</a>
<x-button type="submit" class="bg-blue-600 hover:bg-blue-700">
<x-icons icon="save" class="w-5 h-5 mr-2" />
{{ __('Crear Proyecto') }}
</x-button>
</div>
</form>
</div>
</div>
</div>
</div>
@push('styles')
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.snow.css" rel="stylesheet" />
@endpush
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify"></script>
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.js"></script>
<script>
// Editor Quill
onst toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
['link', 'image', 'video', 'formula'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered'}, { 'list': 'bullet' }, { 'list': 'check' }],
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'] // remove formatting button
];
const quill = new Quill('#rich-editor', {
theme: 'snow',
modules: {
toolbar: toolbarOptions,
placeholder: 'Description...',
}
});
// Tagify para categorías
new Tagify(document.querySelector('[name="categories[]"]'), {
enforceWhitelist: true,
whitelist: @json($categories->pluck('name')),
dropdown: {
enabled: 1,
maxItems: 5
}
});
</script>
<script>
function previewImage(event) {
const reader = new FileReader();
const preview = document.getElementById('image-preview');
reader.onload = function() {
preview.innerHTML = `
<img src="${reader.result}"
class="object-cover w-full h-48 rounded-lg shadow-sm"
alt="Vista previa de la imagen">
`;
}
if(event.target.files[0]) {
reader.readAsDataURL(event.target.files[0]);
}
}
</script>
@endpush
</x-layouts.app>

View File

@@ -109,11 +109,7 @@
</div>
<!-- Paginación -->
@if($projects->hasPages())
<div class="mt-6">
{{ $projects->withQueryString()->links() }}
</div>
@endif
</div>
</div>
</x-layouts.app>

View File

@@ -0,0 +1,30 @@
<x-layouts.app :title="__('Show Project')">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6">
<!-- Barra de herramientas con breadcrumbs -->
<div class="mb-6">
<nav class="flex" aria-label="Breadcrumb">
<ol class="flex items-center space-x-2">
<li>
<div class="flex items-center">
<a href="{{ route('projects.index') }}" class="text-gray-400 hover:text-gray-500">
<x-icons icon="home" class="h-5 w-5" />
</a>
</div>
</li>
</ol>
</nav>
</div>
<!-- Barra de herramientas principal -->
javi
<!-- Componente principal Livewire -->
<!-- Modales -->
</div>
</x-layouts.app>

View File

@@ -1,48 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6">
<!-- Barra de herramientas con breadcrumbs -->
<div class="mb-6">
<nav class="flex" aria-label="Breadcrumb">
<ol class="flex items-center space-x-2">
<li>
<div class="flex items-center">
<a href="{{ route('projects.index') }}" class="text-gray-400 hover:text-gray-500">
<x-icons.home class="h-5 w-5" />
</a>
</div>
</li>
@foreach($breadcrumbs as $crumb)
<li>
<div class="flex items-center">
<x-icons.chevron-right class="h-5 w-5 text-gray-400" />
@if(!$loop->last)
<a href="{{ $crumb['url'] }}" class="ml-2 text-sm font-medium text-gray-500 hover:text-gray-700">
{{ $crumb['name'] }}
</a>
@else
<span class="ml-2 text-sm font-medium text-gray-700">{{ $crumb['name'] }}</span>
@endif
</div>
</li>
@endforeach
</ol>
</nav>
</div>
<!-- Barra de herramientas principal -->
<x-toolbar :project="$project" :current-folder="$currentFolder" />
<!-- Componente principal Livewire -->
<livewire:project-show
:project="$project"
:current-folder="$currentFolder ?? null"
wire:key="project-show-{{ $project->id }}-{{ $currentFolder->id ?? 'root' }}"
/>
<!-- Modales -->
@livewire('folder.create-modal', ['project' => $project, 'parentFolder' => $currentFolder ?? null])
@livewire('document.upload-modal', ['project' => $project, 'currentFolder' => $currentFolder ?? null])
</div>
@endsection