@extends('layouts.app')

@section('title', 'Add Holiday')
@section('heading', 'Add Holiday')

@section('content')
    <x-card class="w-full max-w-xl">
        <form action="{{ route('holidays.store') }}" method="POST" class="space-y-6" novalidate data-holiday-form="create">
            @csrf
            <div class="space-y-6">
                <div>
                    <label class="block text-sm font-medium text-slate-700">Name <span class="text-red-500">*</span></label>
                    <input type="text" name="name" value="{{ old('name') }}" class="mt-1 block w-full rounded-lg border border-slate-300 px-3 py-2">
                    @error('name')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
                    <p data-js-error="name" class="mt-1 text-sm text-red-600 hidden"></p>
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700">Date <span class="text-red-500">*</span></label>
                    <input type="date" name="date" value="{{ old('date') }}" class="mt-1 block w-full rounded-lg border border-slate-300 px-3 py-2">
                    @error('date')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
                    <p data-js-error="date" class="mt-1 text-sm text-red-600 hidden"></p>
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700">Type</label>
                    <select name="type" class="mt-1 block w-full rounded-lg border border-slate-300 px-3 py-2 js-select2">
                        <option value="public" {{ old('type') === 'public' ? 'selected' : '' }}>Public</option>
                        <option value="company" {{ old('type') === 'company' ? 'selected' : '' }}>Company</option>
                    </select>
                </div>
            </div>
            <div class="flex gap-2">
                <x-button type="submit" variant="primary">Save</x-button>
                <a href="{{ route('holidays.index') }}" class="inline-flex items-center rounded-lg bg-slate-100 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200">Cancel</a>
            </div>
        </form>
    </x-card>
@endsection

@push('scripts')
<script src="{{ asset('js/form-validation.js') }}"></script>
<script src="{{ asset('js/form-text-rules.js') }}"></script>
<script src="{{ asset('js/holiday-form-validation.js') }}"></script>
@endpush
