Files
bandtoolv2/resources/views/admin/bewerbungen/index.blade.php
T

88 lines
3.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('template')
@section('title','Admin · Bewerbungsrunden')
@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="h4 mb-0">Bewerbungsrunden</h1>
</div>
{{-- Live-Filter UI (Vue) --}}
<div id="admin-bewerbungen-index" class="card mb-3">
<div class="card-body">
<div class="row g-2 align-items-center">
<div class="col-md-6">
<input type="search" class="form-control" placeholder="Suchen (Name/Zeitraum)..." v-model="q">
</div>
<div class="col-md-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="activeOnly" v-model="activeOnly">
<label class="form-check-label" for="activeOnly">Nur aktive anzeigen</label>
</div>
</div>
<div class="col-md-3 text-md-end">
<button class="btn btn-sm btn-outline-secondary" @click="clear">Zurücksetzen</button>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>Name</th>
<th>Zeitraum</th>
<th>Aktiv</th>
<th class="text-end">Bewerbungen</th>
<th></th>
</tr>
</thead>
<tbody>
<template v-if="filtered.length">
<tr v-for="b in filtered" :key="b.id">
<td class="fw-semibold">@{{ b.name }}</td>
<td>@{{ b.period }}</td>
<td>
<span class="badge" :class="b.active ? 'text-bg-success' : 'text-bg-secondary'">
@{{ b.active ? 'aktiv' : 'inaktiv' }}
</span>
</td>
<td class="text-end">@{{ b.applications_count }}</td>
<td class="text-end">
<a class="btn btn-sm btn-outline-primary" :href="b.url">Öffnen</a>
</td>
</tr>
</template>
<tr v-else><td colspan="5" class="text-muted">Keine Treffer.</td></tr>
</tbody>
</table>
</div>
{{-- Original Laravel-Pagination ist ausgeblendet, da die Liste clientseitig gefiltert wird. --}}
{{-- {{ $bewerbungen->links() }} --}}
{{-- Serverdaten für Vue als JSON bereitstellen --}}
<script type="application/json" id="admin-bewerbungen-index-data">
@php
echo json_encode([
'items' => $bewerbungen->map(function($b){
return [
'id' => $b->id,
'name' => $b->name,
'period' => trim(($b->start_at ? $b->start_at->format('d.m.Y') : '') . ' – ' . ($b->end_at ? $b->end_at->format('d.m.Y') : '')),
'active' => (bool)$b->active,
'applications_count' => (int)($b->applications_count ?? 0),
'url' => route('admin.bewerbungen.show', $b),
];
})->values(),
], JSON_UNESCAPED_UNICODE);
@endphp
</script>
@endsection
@push('scripts')
{{-- Vue 3 CDN + App --}}
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<script src="/js/admin-live-filters.js"></script>
@endpush