@extends('layout')
@section('title', 'Correct event')
@section('content')
<div class="page-header"><h1>Correct attendance event</h1></div>

<div class="card" style="max-width:480px;">
    <p class="muted">
        Original: <strong>{{ $event->employee->emp_id }} — {{ $event->employee->name }}</strong>,
        {{ $event->direction }} at {{ $event->ts->format('Y-m-d H:i:s') }} ({{ $event->site->name }})
    </p>

    <form method="POST" action="{{ route('attendance.correct.store', $event) }}">
        @csrf
        <label for="direction">Corrected direction</label>
        <select name="direction" id="direction" required>
            <option value="IN" @selected($event->direction === 'IN')>IN</option>
            <option value="OUT" @selected($event->direction === 'OUT')>OUT</option>
        </select>

        <label for="ts">Corrected date &amp; time</label>
        <input type="datetime-local" id="ts" name="ts" value="{{ $event->ts->format('Y-m-d\TH:i') }}" required>

        <button type="submit" class="btn btn-primary btn-block">Save correction</button>
    </form>
</div>
@endsection
