Files
muninn/resources/views/livewire/ideas/index.blade.php
T

221 lines
11 KiB
PHP
Raw Normal View History

<div>
<div class="flex justify-between items-center mb-4">
<div>
<h1 class="text-xl font-semibold">Ideas</h1>
<p class="text-sm text-gray-500">
{{ $totalIdeas }} total |
{{ $newIdeas }} new |
{{ $consideredIdeas }} considered |
{{ $plannedIdeas }} planned |
{{ $implementedIdeas }} implemented
</p>
</div>
<div class="flex gap-2">
<button wire:click="create" class="bg-blue-600 text-white px-4 py-2 rounded">Add Idea</button>
</div>
</div>
<div class="bg-white border border-gray-200 rounded p-4 mb-6">
<div class="flex gap-4 items-center flex-wrap">
<div class="flex-1 min-w-48">
<label class="block text-sm font-medium mb-1">Search</label>
<input type="text" wire:model.live="search" placeholder="Search ideas..."
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($status) }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Category</label>
<select wire:model.live="categoryFilter" class="border rounded p-2">
<option value="">All Categories</option>
@foreach ($categories as $category)
<option value="{{ $category }}">{{ ucfirst($category) }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Project</label>
<select wire:model.live="projectFilter" class="border rounded p-2">
<option value="">All Projects</option>
@foreach ($projects as $project)
<option value="{{ $project->id }}">{{ $project->name }}</option>
@endforeach
</select>
</div>
<div class="flex items-center">
<label class="flex items-center gap-1 cursor-pointer">
<input type="checkbox" wire:model.live="unlinkedFilter" class="rounded">
<span class="text-sm">Unlinked only</span>
</label>
</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 ($ideas as $idea)
<div wire:key="idea-{{ $idea->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">{{ $idea->title }}</h3>
<div class="flex gap-2 mt-1 flex-wrap">
<span class="{{ $this->getStatusColor($idea->status) }} text-xs px-2 py-0.5 rounded">
{{ ucfirst($idea->status) }}
</span>
@if($idea->category)
<span class="{{ $this->getCategoryColor($idea->category) }} text-xs px-2 py-0.5 rounded">
{{ ucfirst($idea->category) }}
</span>
@endif
@if($idea->priority > 0)
<span class="bg-gray-100 text-gray-800 text-xs px-2 py-0.5 rounded">
Priority: {{ $this->getPriorityLabel($idea->priority) }} ({{ $idea->priority }})
</span>
@endif
</div>
</div>
<div class="flex gap-1">
<button wire:click="edit({{ $idea->id }})" class="text-blue-600 hover:text-blue-800 text-sm">Edit</button>
<button wire:click="delete({{ $idea->id }})" wire:confirm="Delete this idea?" class="text-red-600 hover:text-red-800 text-sm">Delete</button>
</div>
</div>
@if($idea->description)
<p class="text-sm text-gray-600 mb-3">{{ $idea->description }}</p>
@endif
@if($idea->tags)
<div class="mb-3">
@foreach(explode(',', $idea->tags) as $tag)
<span class="inline-block bg-gray-100 text-gray-800 text-xs px-2 py-0.5 rounded-full mr-1 mb-1">{{ trim($tag) }}</span>
@endforeach
</div>
@endif
<div class="flex justify-between items-center text-xs text-gray-500 border-t border-gray-100 pt-2">
<div class="flex gap-2">
@if($idea->project)
<span>Project: <a href="{{ route('projects.index') }}?project_id={{ $idea->project->id }}" class="text-blue-600 hover:underline">{{ $idea->project->name }}</a></span>
@else
<span>No project linked</span>
@endif
@if($idea->user)
<span>By: {{ $idea->user->name }}</span>
@endif
</div>
<span>{{ $idea->created_at->format('M d, Y') }}</span>
</div>
<div class="mt-3 flex gap-2">
<select wire:model="status" wire:change="changeStatus({{ $idea->id }}, $event.target.value)"
class="{{ $this->getStatusColor($idea->status) }} rounded p-1 text-sm">
@foreach ($statuses as $status)
<option value="{{ $status }}" {{ $idea->status === $status ? 'selected' : '' }}>
{{ ucfirst($status) }}
</option>
@endforeach
</select>
@if($idea->project_id)
<button wire:click="unlinkFromProject({{ $idea->id }})"
wire:confirm="Unlink this idea from its project?"
class="text-xs text-gray-600 hover:text-gray-800">
Unlink
</button>
@else
<button wire:click="linkToProject({{ $idea->id }}, {{ $projectFilter ?? 0 }})"
wire:confirm="Link this idea to the selected project?"
class="text-xs text-green-600 hover:text-green-800">
Link to Project
</button>
@endif
</div>
</div>
@empty
<div class="col-span-full text-center py-8 text-gray-500">
No ideas found. Share your first idea!
</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-lg space-y-4 max-h-[90vh] overflow-y-auto">
<h2 class="text-lg font-semibold">{{ $editingId ? 'Edit Idea' : 'Add Idea' }}</h2>
<div>
<label class="block text-sm font-medium">Title</label>
<input type="text" wire:model="title" class="w-full border rounded p-2">
@error('title') <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="4" class="w-full border rounded p-2"></textarea>
@error('description') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
</div>
<div class="grid grid-cols-2 gap-4">
<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($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">Priority (0-10)</label>
<input type="number" wire:model="priority" min="0" max="10" class="w-full border rounded p-2">
@error('priority') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium">Category</label>
<select wire:model="category" class="w-full border rounded p-2">
<option value="">No category</option>
@foreach ($categories as $category)
<option value="{{ $category }}">{{ ucfirst($category) }}</option>
@endforeach
</select>
@error('category') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
</div>
<div>
<label class="block text-sm font-medium">Project (optional)</label>
<select wire:model="projectId" class="w-full border rounded p-2">
<option value="">No project</option>
@foreach ($projects as $project)
<option value="{{ $project->id }}">{{ $project->name }}</option>
@endforeach
</select>
@error('projectId') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
</div>
</div>
<div>
<label class="block text-sm font-medium">Tags (comma separated)</label>
<input type="text" wire:model="tags" placeholder="e.g., ai, automation, feature" class="w-full border rounded p-2">
@error('tags') <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>