<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Edit Absensi') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-2xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6">
                    <h2 class="text-xl font-bold text-primary mb-4">Edit Absensi Santri</h2>
                    <form action="{{ route('absensis.update', $absensi) }}" method="POST">
                        @csrf
                        @method('PUT')
                        <div class="mb-3">
                            <label class="font-semibold text-gray-700 mb-1 block">Nama Santri</label>
                            <input type="text" class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-gray-100" value="{{ $santri->nama }}" readonly>
                        </div>
                        <div class="mb-3">
                            <label class="font-semibold text-gray-700 mb-1 block">Status</label>
                            <select name="status" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors" required>
                                <option value="">Pilih Status</option>
                                <option value="hadir" {{ $absensi->status=='hadir'?'selected':'' }}>Hadir</option>
                                <option value="izin" {{ $absensi->status=='izin'?'selected':'' }}>Izin</option>
                                <option value="sakit" {{ $absensi->status=='sakit'?'selected':'' }}>Sakit</option>
                                <option value="alfa" {{ $absensi->status=='alfa'?'selected':'' }}>Alpa</option>
                            </select>
                            @error('status')<div class="text-red-600 text-sm mt-1">{{ $message }}</div>@enderror
                        </div>
                        <div class="mb-3">
                            <label class="font-semibold text-gray-700 mb-1 block">Keterangan</label>
                            <input type="text" name="keterangan" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors" value="{{ old('keterangan', $absensi->keterangan) }}">
                            @error('keterangan')<div class="text-red-600 text-sm mt-1">{{ $message }}</div>@enderror
                        </div>
                        <div class="flex gap-2 mt-4">
                            <button type="submit" class="inline-flex items-center px-6 py-3 text-sm font-medium text-white bg-green-600 rounded-lg hover:bg-green-700 transition-colors">
                                <i class="fas fa-save mr-2"></i>
                                Update
                            </button>
                            <a href="{{ route('absensis.index', ['kelas_id'=>$absensi->kelas_id, 'tanggal'=>$absensi->tanggal]) }}" class="inline-flex items-center px-6 py-3 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">
                                <i class="fas fa-arrow-left mr-2"></i>
                                Kembali
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</x-app-layout> 