@php
    $breadcrumbs = [
        ['label' => __('common.home'), 'url' => route('dashboard.index')],
        ['label' => __('me.overtime_title'), 'url' => route('me.overtime.index')],
        ['label' => __('overtime.create_title')],
    ];
    $minutesValue = old('overtime_minutes', $suggestedOvertimeMinutes);
@endphp

<x-ui.layout.page
    :title="__('overtime.create_title')"
    page-icon="fe fe-plus"
    :breadcrumbs="$breadcrumbs"
>
    <x-slot:actions>
        <x-ui.buttons.secondary :href="route('me.overtime.index')" icon="fe fe-arrow-left">
            {{ __('common.back') }}
        </x-ui.buttons.secondary>
    </x-slot:actions>

    <div class="card border-0 shadow-sm">
        <div class="card-body">
            <form method="POST" action="{{ route('me.overtime.store') }}" class="row g-3">
                @csrf
                <div class="col-md-6">
                    <x-ui.form.input
                        name="attendance_date"
                        type="date"
                        :label="__('overtime.fields.attendance_date')"
                        :value="old('attendance_date', $selectedAttendanceDate)"
                        required
                    />
                </div>
                <div class="col-md-6">
                    <x-ui.form.input
                        name="overtime_minutes"
                        type="number"
                        min="1"
                        :label="__('overtime.fields.overtime_minutes')"
                        :value="$minutesValue"
                        required
                    />
                </div>
                @if ($suggestedOvertimeMinutes)
                    <div class="col-12">
                        <p class="text-muted small mb-0">
                            {{ __('overtime.suggest_hint', ['minutes' => $suggestedOvertimeMinutes]) }}
                        </p>
                    </div>
                @endif
                <div class="col-12">
                    <x-ui.form.input name="reason" :label="__('overtime.fields.reason')" :value="old('reason')" />
                </div>
                <div class="col-12">
                    <p class="text-muted small mb-0">{{ __('overtime.payroll_note') }}</p>
                </div>
                <div class="col-12">
                    <x-ui.buttons.primary type="submit" icon="fe fe-send">
                        {{ __('overtime.actions.submit') }}
                    </x-ui.buttons.primary>
                </div>
            </form>
        </div>
    </div>
</x-ui.layout.page>
