@php use App\Models\TickerMessages; @endphp
@extends('layout.app')
@section('scripts')
    <script>
        const i18n = {
            common: {
                error_occurred: "{{ __('app.common.error_occurred') }}"
            },
            ticker: {
                delete_success: "{{ __('app.ticker.delete_success') }}",
                insert_success: "{{ __('app.ticker.insert_success') }}"
            }
        };
    </script>
    <link rel="stylesheet" href="{{ asset("css/ticker/ticker.css") }}">
    <script src="{{ asset("js/intern.js") }}"></script>
    <script src="{{ asset("js/ticker/edit.js") }}"></script>
@endsection

@section('content')
    <h1>Ticker bearbeiten</h1>
    <div id="fehlermeldung">Hier kann der Ticker verändert werden.</div>
    <div class="split-left">
        <h2>Deutsch</h2>
        <label for="ticker_de">Aktive Tickernachrichten:</label><br/><br/>
        <select name="ticker_de" id="ticker_de" multiple>
            @foreach(TickerMessages::where('language', 'de')->orderBy('updated_at', 'desc')->get() as $tm)
                <option value="{{$tm->id}}">{{$tm->message}}</option>
            @endforeach
        </select>
        <br/><br/>
        <button onclick="remove('de')">Ausgewählte Tickernachricht löschen</button>
        <br/><br/><br/>

        <label for="insert_de">Tickernachricht erstellen: </label><br/>
        <input size="32" type="text" id="insert_de">
        <br/><br/>
        <button onclick="insert('de')">Tickernachricht hinzufügen</button>
    </div>
    <div class="split-right">
        <h2>Englisch</h2>
        <label for="ticker_en">Aktive Tickernachrichten:</label><br/><br/>
        <select name="ticker_en" id="ticker_en" multiple>
            @foreach(TickerMessages::where('language', 'en')->orderBy('updated_at', 'desc')->get() as $tm)
                <option value="{{$tm->id}}">{{$tm->message}}</option>
            @endforeach
        </select>
        <br/><br/>
        <button onclick="remove('en')">Ausgewählte Tickernachricht löschen</button>
        <br/><br/><br/>

        <label for="insert_de">Tickernachricht erstellen: </label><br/>
        <input size="32" type="text" id="insert_en">
        <br/><br/>
        <button onclick="insert('en')">Tickernachricht hinzufügen</button>
    </div>

@endsection
