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

66 lines
3.5 KiB
PHP

@extends('layouts.app')
@section('title', 'Teams — ' . config('app.name'))
@section('content')
<div class="mb-4 flex items-center justify-between">
<h1 class="text-2xl font-bold">My Teams</h1>
<a href="{{ route('categories.index') }}" class="text-blue-600 hover:underline">Manage categories </a>
</div>
<p class="mb-4 text-sm text-gray-500">Teams group your KPIs and projects on bowler charts e.g. "Website Development" or "Integrations".</p>
<div class="mb-6 rounded-lg border border-gray-200 bg-white p-4">
<form method="POST" action="{{ route('teams.store') }}" class="flex items-end gap-3">
@csrf
<div class="flex-1">
<label for="name" class="mb-1 block font-semibold">New team</label>
<input id="name" type="text" name="name" value="{{ old('name') }}" required placeholder="e.g. Website Development"
class="w-full rounded-md border border-gray-300 px-3 py-2 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/40">
</div>
<button type="submit" class="cursor-pointer rounded-md bg-blue-600 px-4 py-2 font-medium text-white hover:bg-blue-700">Add team</button>
</form>
@error('name')
<p class="mt-1 text-sm text-red-700">{{ $message }}</p>
@enderror
</div>
<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">KPIs</th>
<th class="px-4 py-3">Projects</th>
<th class="px-4 py-3">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@forelse ($teams as $team)
<tr>
<td class="px-4 py-3 font-medium">{{ $team->name }}</td>
<td class="px-4 py-3">{{ $team->kpis_count }}</td>
<td class="px-4 py-3">{{ $team->projects_count }}</td>
<td class="whitespace-nowrap px-4 py-3">
<a href="{{ route('teams.edit', $team) }}"
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">Rename</a>
<form method="POST" action="{{ route('teams.destroy', $team) }}" class="js-confirm inline"
data-confirm="Delete team &quot;{{ $team->name }}&quot;? Its {{ $team->kpis_count + $team->projects_count }} item(s) will become unassigned (not deleted).">
@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>
@empty
<tr>
<td colspan="4" class="px-4 py-6 text-center text-gray-500">No teams yet add your first above.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@include('partials.confirm-script')
@endsection