This was already implemented, migrated, and running live, but had never been committed. Bringing it into git: Project/Task/Idea/ TaskComment models, their JSON API (CRUD + status transitions, task comments, idea<->project linking), Livewire UI pages, and the nav/route wiring for them. All 42 of its own tests pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
125 lines
6.1 KiB
PHP
125 lines
6.1 KiB
PHP
<div>
|
|
<div class="flex justify-between items-center mb-4">
|
|
<div>
|
|
<h1 class="text-xl font-semibold">Projects</h1>
|
|
<p class="text-sm text-gray-500">
|
|
{{ $totalProjects }} total |
|
|
{{ $activeProjects }} active |
|
|
{{ $completedProjects }} completed
|
|
</p>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<button wire:click="create" class="bg-blue-600 text-white px-4 py-2 rounded">Add Project</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white border border-gray-200 rounded p-4 mb-6">
|
|
<div class="flex gap-4 items-center">
|
|
<div class="flex-1">
|
|
<label class="block text-sm font-medium mb-1">Search</label>
|
|
<input type="text" wire:model.live="search" placeholder="Search projects..."
|
|
class="w-full border rounded p-2">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium mb-1">Status</label>
|
|
<select wire:model.live="statusFilter" class="border rounded p-2">
|
|
<option value="">All Statuses</option>
|
|
@foreach ($statuses as $status)
|
|
<option value="{{ $status }}">{{ ucfirst(str_replace('_', ' ', $status)) }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="flex items-end">
|
|
<button wire:click="clearFilters" class="text-sm text-gray-600 hover:text-gray-800">Clear</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
@forelse ($projects as $project)
|
|
<div wire:key="project-{{ $project->id }}" class="bg-white border border-gray-200 rounded p-4 hover:shadow-md transition-shadow">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div class="flex-1">
|
|
<h3 class="font-semibold text-lg">{{ $project->name }}</h3>
|
|
<div class="flex gap-2 mt-1">
|
|
<span class="{{ $this->getStatusColor($project->status) }} text-xs px-2 py-0.5 rounded">
|
|
{{ ucfirst(str_replace('_', ' ', $project->status)) }}
|
|
</span>
|
|
@if($project->due_at)
|
|
<span class="text-xs text-gray-600">
|
|
Due: {{ $project->due_at->format('M d, Y') }}
|
|
</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
<div class="flex gap-1">
|
|
<button wire:click="edit({{ $project->id }})" class="text-blue-600 hover:text-blue-800 text-sm">Edit</button>
|
|
<button wire:click="delete({{ $project->id }})" wire:confirm="Delete this project?" class="text-red-600 hover:text-red-800 text-sm">Delete</button>
|
|
</div>
|
|
</div>
|
|
|
|
@if($project->description)
|
|
<p class="text-sm text-gray-600 mb-3">{{ $project->description }}</p>
|
|
@endif
|
|
|
|
<div class="flex justify-between items-center text-xs text-gray-500 border-t border-gray-100 pt-2">
|
|
<span>{{ $this->getTasksCount($project->id) }} tasks</span>
|
|
<span>{{ $project->created_at->format('M d, Y') }}</span>
|
|
</div>
|
|
|
|
<div class="mt-3">
|
|
<a href="{{ route('tasks.index', ['project_id' => $project->id]) }}"
|
|
class="text-blue-600 hover:text-blue-800 text-sm font-medium">
|
|
View Tasks
|
|
</a>
|
|
</div>
|
|
</div>
|
|
@empty
|
|
<div class="col-span-full text-center py-8 text-gray-500">
|
|
No projects found. Create your first project!
|
|
</div>
|
|
@endforelse
|
|
</div>
|
|
|
|
@if ($showForm)
|
|
<div class="fixed inset-0 bg-black/30 flex items-center justify-center z-50">
|
|
<div class="bg-white p-6 rounded w-full max-w-md space-y-4">
|
|
<h2 class="text-lg font-semibold">{{ $editingId ? 'Edit Project' : 'Add Project' }}</h2>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">Name</label>
|
|
<input type="text" wire:model="name" class="w-full border rounded p-2">
|
|
@error('name') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">Description</label>
|
|
<textarea wire:model="description" rows="3" class="w-full border rounded p-2"></textarea>
|
|
@error('description') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">Status</label>
|
|
<select wire:model="status" class="w-full border rounded p-2">
|
|
@foreach ($statuses as $status)
|
|
<option value="{{ $status }}">{{ ucfirst(str_replace('_', ' ', $status)) }}</option>
|
|
@endforeach
|
|
</select>
|
|
@error('status') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">Due Date</label>
|
|
<input type="datetime-local" wire:model="dueAt" class="w-full border rounded p-2">
|
|
@error('dueAt') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-2">
|
|
<button wire:click="$set('showForm', false)" class="px-4 py-2">Cancel</button>
|
|
<button wire:click="save" class="bg-blue-600 text-white px-4 py-2 rounded">Save</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|