@extends('layouts.app') @section('title','Leave') @section('content')<p class="text-sm font-semibold text-blue-600">SELF SERVICE</p><h1 class="text-3xl font-black">Leave Requests</h1><div x-data="{open:false}" class="mt-6"><button @click="open=true" class="btn btn-primary">Apply for leave</button><div x-cloak x-show="open" class="mt-4 card p-5"><form method="POST" action="{{ route('leave.store') }}" class="grid gap-3 sm:grid-cols-2">@csrf<select name="leave_type_id" class="rounded-xl border-slate-200">@foreach($types as $t)<option value="{{ $t->id }}">{{ $t->name }}</option>@endforeach</select><input type="date" name="start_date" class="rounded-xl border-slate-200" required><input type="date" name="end_date" class="rounded-xl border-slate-200" required><textarea name="reason" class="rounded-xl border-slate-200 sm:col-span-2" placeholder="Reason" required></textarea><button class="btn btn-primary w-fit">Submit</button></form></div></div><div class="mt-6 card overflow-x-auto"><table class="w-full text-sm"><thead class="bg-slate-50 text-left"><tr><th class="p-4">From</th><th class="p-4">To</th><th class="p-4">Days</th><th class="p-4">Status</th></tr></thead><tbody>@foreach($requests as $r)<tr class="border-t"><td class="p-4">{{ $r->start_date->format('d M Y') }}</td><td class="p-4">{{ $r->end_date->format('d M Y') }}</td><td class="p-4">{{ $r->days }}</td><td class="p-4"><span class="badge">{{ $r->status }}</span></td></tr>@endforeach</tbody></table></div>@endsection