Files
muninn/resources/views/livewire/video-projects/index.blade.php
T

79 lines
3.7 KiB
PHP
Raw Normal View History

<div>
<div class="flex justify-between items-center mb-4">
<h1 class="text-xl font-semibold">Video Projects</h1>
<button wire:click="create" class="bg-blue-600 text-white px-4 py-2 rounded">New Video Project</button>
</div>
<table class="w-full bg-white border border-gray-200 rounded">
<thead>
<tr class="text-left border-b border-gray-200">
<th class="p-3">Title</th>
<th class="p-3">Status</th>
<th class="p-3">Current Step</th>
<th class="p-3">Progress</th>
<th class="p-3">Created</th>
<th class="p-3"></th>
</tr>
</thead>
<tbody>
@forelse ($projects as $project)
<tr wire:key="video-project-{{ $project->id }}" class="border-b border-gray-100">
<td class="p-3">
<a href="{{ route('video-projects.show', $project) }}" wire:navigate class="text-blue-600 hover:underline">{{ $project->title }}</a>
</td>
<td class="p-3">{{ ucfirst($project->status) }}</td>
<td class="p-3">
@if ($project->steps->isNotEmpty())
{{ str($project->steps->first()->type)->headline() }}
<span class="text-xs text-gray-500">({{ str($project->steps->first()->status)->headline() }})</span>
@else
—
@endif
</td>
<td class="p-3">
@if ($project->steps_count > 0)
{{ $project->completed_steps_count }} / {{ $project->steps_count }}
@else
not started
@endif
</td>
<td class="p-3">{{ $project->created_at->format('Y-m-d') }}</td>
<td class="p-3 text-right space-x-2">
<a href="{{ route('video-projects.show', $project) }}" wire:navigate class="text-blue-600">Open</a>
<button wire:click="delete({{ $project->id }})" wire:confirm="Delete this video project?" class="text-red-600">Delete</button>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="p-3 text-center text-gray-500">No video projects yet.</td>
</tr>
@endforelse
</tbody>
</table>
@if ($showForm)
<div class="fixed inset-0 bg-black/30 flex items-center justify-center">
<div class="bg-white p-6 rounded w-full max-w-md space-y-4">
<h2 class="text-lg font-semibold">New Video Project</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 (optional)</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 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">Create</button>
</div>
</div>
</div>
@endif
</div>