72 lines
4.3 KiB
PHP
72 lines
4.3 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'KPIs — ' . config('app.name'))
|
|
|
|
@section('content')
|
|
<div class="mb-4 flex items-center justify-between">
|
|
<h1 class="text-2xl font-bold">My KPIs</h1>
|
|
<a href="{{ route('kpis.create') }}" class="rounded-md bg-primary px-4 py-2 font-medium text-white hover:bg-primary-hover">New KPI</a>
|
|
</div>
|
|
|
|
@if ($kpis->isEmpty())
|
|
<div class="rounded-lg border border-gray-200 bg-white px-6 py-10 text-center text-gray-500">
|
|
No KPIs yet. <a href="{{ route('kpis.create') }}" class="text-primary hover:underline">Create your first KPI.</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">Type</th>
|
|
<th class="px-4 py-3">Thresholds</th>
|
|
<th class="px-4 py-3">Latest</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 ($kpis as $kpi)
|
|
<tr>
|
|
<td class="px-4 py-3 font-medium">
|
|
<a href="{{ route('kpis.entries.index', $kpi) }}" class="hover:underline">{{ $kpi->name }}</a>
|
|
</td>
|
|
<td class="px-4 py-3 text-sm">
|
|
{{ $kpi->team?->name ?? '—' }} <span class="text-gray-400">/</span> {{ $kpi->category?->name ?? '—' }}
|
|
</td>
|
|
<td class="px-4 py-3">{{ $kpi->value_type->label() }} · {{ $kpi->evaluation->label() }}</td>
|
|
<td class="px-4 py-3 text-sm text-gray-600">{{ $kpi->thresholdSummary() }}</td>
|
|
<td class="px-4 py-3">
|
|
@if ($kpi->latestEntry)
|
|
@include('partials.status-badge', ['status' => $kpi->latestEntry->status])
|
|
<span class="ml-1 text-sm text-gray-500">{{ $kpi->value_type->format($kpi->latestEntry->value, $kpi->unit_label) }}</span>
|
|
@else
|
|
<span class="text-gray-400">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-3">{{ $kpi->entries_count }}</td>
|
|
<td class="whitespace-nowrap px-4 py-3">
|
|
<a href="{{ route('kpis.entries.index', $kpi) }}"
|
|
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('kpis.edit', $kpi) }}"
|
|
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('kpis.destroy', $kpi) }}" class="js-confirm-delete inline"
|
|
data-title="Delete KPI "{{ $kpi->name }}"?"
|
|
data-message="This permanently deletes the KPI and all {{ $kpi->entries_count }} of its 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
|