bowler/src/resources/views/projects/index.blade.php

70 lines
4.2 KiB
PHP

@extends('layouts.app')
@section('title', 'Projects — ' . config('app.name'))
@section('content')
<div class="mb-4 flex items-center justify-between">
<h1 class="text-2xl font-bold">My Projects</h1>
<a href="{{ route('projects.create') }}" class="rounded-md bg-primary px-4 py-2 font-medium text-white hover:bg-primary-hover">New project</a>
</div>
@if ($projects->isEmpty())
<div class="rounded-lg border border-gray-200 bg-white px-6 py-10 text-center text-gray-500">
No projects yet. <a href="{{ route('projects.create') }}" class="text-primary hover:underline">Create your first project.</a>
</div>
@else
<div class="overflow-x-auto rounded-lg border border-gray-200 bg-white">
<table class="w-full text-left">
<thead>
<tr class="bg-gray-50 text-xs font-semibold uppercase tracking-wide text-gray-500">
<th class="px-4 py-3">Name</th>
<th class="px-4 py-3">Team / Category</th>
<th class="px-4 py-3">Description</th>
<th class="px-4 py-3">Current status</th>
<th class="px-4 py-3">Entries</th>
<th class="px-4 py-3">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach ($projects as $project)
<tr>
<td class="px-4 py-3 font-medium">
<a href="{{ route('projects.entries.index', $project) }}" class="hover:underline">{{ $project->name }}</a>
</td>
<td class="px-4 py-3 text-sm">
{{ $project->team?->name ?? '—' }} <span class="text-gray-400">/</span> {{ $project->category?->name ?? '—' }}
</td>
<td class="max-w-md px-4 py-3 text-gray-600">{{ $project->description }}</td>
<td class="px-4 py-3">
@if ($project->latestEntry)
@include('partials.status-badge', ['status' => $project->latestEntry->status])
<span class="ml-1 text-sm text-gray-500">{{ $project->latestEntry->entry_date->format('Y-m-d') }}</span>
@else
<span class="text-gray-400"></span>
@endif
</td>
<td class="px-4 py-3">{{ $project->entries_count }}</td>
<td class="whitespace-nowrap px-4 py-3">
<a href="{{ route('projects.entries.index', $project) }}"
class="mr-1 inline-block rounded-md border border-gray-300 bg-white px-2.5 py-1 text-sm text-gray-900 hover:bg-gray-50">Entries</a>
<a href="{{ route('projects.edit', $project) }}"
class="mr-1 inline-block rounded-md border border-gray-300 bg-white px-2.5 py-1 text-sm text-gray-900 hover:bg-gray-50">Edit</a>
<form method="POST" action="{{ route('projects.destroy', $project) }}" class="js-confirm-delete inline"
data-title="Delete project &quot;{{ $project->name }}&quot;?"
data-message="This permanently deletes the project and all {{ $project->entries_count }} of its status entries, and removes it from every bowler chart it appears on.">
@csrf
@method('DELETE')
<button type="submit"
class="cursor-pointer rounded-md border border-red-600 px-2.5 py-1 text-sm text-red-700 hover:bg-red-50">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
@include('partials.delete-modal')
@endsection