@extends('layout.app')
@section('scripts')
    <script>
        const i18n = {
            common: {
                error_occurred: "{{ __('app.common.error_occurred') }}"
            },
            blog: {
                confirm_save: "{{ __('app.blog.confirm_save') }}",
                confirm_delete: "{{ __('app.blog.confirm_delete') }}"
            }
        };
    </script>
    <script src="{{ asset('js/events/events.js') }}"></script>
@endsection
@section('content')
    <h1>{{ __('app.nav.events') }}</h1>
    <p>{{ __('app.events.description') }}</p>

    <h2>{{ __('app.events.add') }}</h2>

    <div class="eingabemaske">
        <table>
            <tr>
                <td>{{ __('app.events.name') }}:</td>
                <td><input type="text" id="name"></td>
            </tr>
            <tr>
                <td>{{ __('app.events.shortname') }}:</td>
                <td><input type="text" id="shortname"></td>
            </tr>
            <tr>
                <td>{{ __('app.events.from_date_internal') }}:</td>
                <td><input type="date" id="from_date_internal"></td>
            </tr>
            <tr>
                <td>{{ __('app.events.to_date_internal') }}:</td>
                <td><input type="date" id="to_date_internal"></td>
            </tr>
            <tr>
                <td>{{ __('app.events.from_date_visible') }}:</td>
                <td><input type="date" id="from_date_visible"></td>
            </tr>
            <tr>
                <td>{{ __('app.events.to_date_visible') }}:</td>
                <td><input type="date" id="to_date_visible"></td>
            </tr>
            <tr>
                <td>{{ __('app.events.active') }}:</td>
                <td><input type="checkbox" id="active" name="{{ __('app.events.active') }}"></td>
            </tr>
        </table>
        <button id="add" onclick="addEvent()">{{ __('app.events.add') }}</button>
    </div>
    <br /><br />

    <h2>{{ __('app.events.list') }}</h2>
    @foreach($events as $event)
        <div id="eingabemaske_{{ $event->id }}" class="eingabemaske">
            <table>
                <tr>
                    <td>{{ __('app.events.name') }}:</td>
                    <td>{{ $event->name }}</td>
                </tr>
                <tr>
                    <td>{{ __('app.events.shortname') }}:</td>
                    <td>{{ $event->shortname }}</td>
                </tr>
                <tr>
                    <td>{{ __('app.events.from_date_internal') }}:</td>
                    <td>{{ $event->from_date_internal->format('Y-m-d') }}</td>
                </tr>
                <tr>
                    <td>{{ __('app.events.to_date_internal') }}:</td>
                    <td>{{ $event->to_date_internal->format('Y-m-d') }}</td>
                </tr>
                <tr>
                    <td>{{ __('app.events.from_date_visible') }}:</td>
                    <td>{{ $event->from_date_visible->format('Y-m-d') }}</td>
                </tr>
                <tr>
                    <td>{{ __('app.events.to_date_visible') }}:</td>
                    <td>{{ $event->to_date_visible->format('Y-m-d') }}</td>
                </tr>
                <tr>
                    <td>{{ __('app.events.active') }}:</td>
                    <td><input type="checkbox" id="active_{{ $event->id }}" @if($event->active) checked @endif></td>
                </tr>
            </table>
            <button id="setActivity_{{ $event->id }}" onclick="setActivity({{ $event->id }})">{{ __('app.events.setActivity') }}</button>
            <button id="delete_{{ $event->id }}" onclick="deleteEvent({{ $event->id }})">{{ __('app.events.delete') }}</button>
        </div>
        <br /><br />
    @endforeach

    {{ $events->links() }}
@endsection
