diff --git a/app/Livewire/Client/ClientProjects.php b/app/Livewire/Client/ClientProjects.php
new file mode 100644
index 0000000..cf2ea96
--- /dev/null
+++ b/app/Livewire/Client/ClientProjects.php
@@ -0,0 +1,137 @@
+loadProjects();
+ }
+
+ public function loadProjects()
+ {
+ // Get projects where the user has the 'client' role
+ $user = auth()->user();
+ $this->projects = $user->projects()
+ ->wherePivot('role_in_project', 'client')
+ ->with(['phases' => function($query) {
+ $query->select('id', 'project_id', 'name', 'progress_percent');
+ }])
+ ->get()
+ ->toArray();
+ }
+
+ public function selectProject($projectId)
+ {
+ $this->selectedProject = $projectId;
+ $this->loadProjectDetails();
+ }
+
+ public function loadProjectDetails()
+ {
+ if (!$this->selectedProject) {
+ return;
+ }
+
+ $project = Project::with([
+ 'phases.features',
+ 'inspections.template'
+ ])->find($this->selectedProject);
+
+ if (!$project) {
+ return;
+ }
+
+ $this->projectDetails = [
+ 'id' => $project->id,
+ 'name' => $project->name,
+ 'description' => $project->description,
+ 'start_date' => $project->start_date,
+ 'end_date' => $project->end_date,
+ 'status' => $project->status,
+ 'progress' => $project->phases->avg('progress_percent') ?? 0,
+ ];
+
+ // Get recent images (simulated for now)
+ $this->galleryImages = [
+ [
+ 'url' => 'https://via.placeholder.com/400x300?text=Avance+1',
+ 'title' => 'Avance inicial',
+ 'date' => now()->subDays(30)->format('d/m/Y')
+ ],
+ [
+ 'url' => 'https://via.placeholder.com/400x300?text=Avance+2',
+ 'title' => 'Estructura levantada',
+ 'date' => now()->subDays(15)->format('d/m/Y')
+ ],
+ [
+ 'url' => 'https://via.placeholder.com/400x300?text=Avance+3',
+ 'title' => 'Instalaciones',
+ 'date' => now()->subDays(5)->format('d/m/Y')
+ ]
+ ];
+
+ // Get change orders (simulated for now)
+ $this->changeOrders = [
+ [
+ 'id' => 124,
+ 'title' => 'Ampliación de zona de almacenamiento',
+ 'description' => 'Solicitud de ampliación de zona de almacenamiento debido a cambios logísticos.',
+ 'status' => 'pending',
+ 'requested_at' => now()->subDays(10)->format('d/m/Y'),
+ 'amount' => 1500.00
+ ],
+ [
+ 'id' => 125,
+ 'title' => 'Cambio de material en acabados interiores',
+ 'description' => 'Cambio de cerámica estándar a porcelanato en baños y cocinas.',
+ 'status' => 'pending',
+ 'requested_at' => now()->subDays(5)->format('d/m/Y'),
+ 'amount' => 3200.00
+ ]
+ ];
+ }
+
+ public function approveChangeOrder($orderId)
+ {
+ // In a real app, this would update the database
+ foreach ($this->changeOrders as &$order) {
+ if ($order['id'] == $orderId) {
+ $order['status'] = 'approved';
+ break;
+ }
+ }
+ $this->dispatch('changeOrderUpdated', ['id' => $orderId, 'status' => 'approved']);
+ }
+
+ public function rejectChangeOrder($orderId)
+ {
+ // In a real app, this would update the database
+ foreach ($this->changeOrders as &$order) {
+ if ($order['id'] == $orderId) {
+ $order['status'] = 'rejected';
+ break;
+ }
+ }
+ $this->dispatch('changeOrderUpdated', ['id' => $orderId, 'status' => 'rejected']);
+ }
+
+ public function render()
+ {
+ return view('livewire.client.client-projects');
+ }
+}
diff --git a/resources/views/client/dashboard.blade.php b/resources/views/client/dashboard.blade.php
new file mode 100644
index 0000000..4d35640
--- /dev/null
+++ b/resources/views/client/dashboard.blade.php
@@ -0,0 +1,128 @@
+
+ Se han añadido nuevas fotos al proyecto "Centro Comercial Norte"
+
+ Hace 2 horas
+
+ La orden de cambio #123 ha sido aprobada
+
+ Hace 1 día
+
+ Solicitud de ampliación de zona de almacenamiento
+
+ Cambio de material en acabados interiores
+
+ Bienvenido, {{ auth()->user()->name }}
+
+
+
+ Mis Proyectos Activos
+
+
+
+ Notificaciones
+
+
+
+ Proyecto actualizado
+
+
+ Orden de cambio aprobada
+
+
+ Galería de Progreso
+
+
+
+ Órdenes de Cambio Pendientes
+
+
+
+ Orden de cambio #124
+
+
+ Orden de cambio #125
+
+
+ + {{ $project['description'] ?? 'Sin descripción disponible' }} +
++ @php + $statuses = [ + 'planning' => 'Planificación', + 'in_progress' => 'En progreso', + 'on_hold' => 'En espera', + 'completed' => 'Completado', + 'cancelled' => 'Cancelado' + ]; + echo $statuses[$projectDetails['status']] ?? ucfirst($projectDetails['status']); + @endphp +
++ {{ $projectDetails['start_date'] ?? 'No definida' }} +
++ {{ $projectDetails['end_date'] ?? 'No definida' }} +
++ {{ $projectDetails['description'] ?? 'No hay descripción disponible' }} +
+No hay fases definidas para este proyecto
+{{ $image['date'] }}
+{{ $order['description'] }}
+ +No hay órdenes de cambio pendientes
+