@extends('layouts.admin')

@section('title', __('admin.moderation.title'))

@section('content')
<div class="container-fluid px-4 py-4">
    <h1 class="display-md text-white mb-4">{{ __('admin.moderation.title') }}</h1>

    @if (session('status'))
        <div class="alert alert-success">{{ session('status') }}</div>
    @endif

    <div class="row g-4">
        <div class="col-lg-6">
            <h2 class="text-white fs-5 mb-3">{{ __('admin.moderation.records') }}</h2>
            @forelse($records as $record)
                <div class="card-arena p-3 mb-3">
                    <div class="fw-600 text-white">{{ $record->title }}</div>
                    <div class="text-muted fs-sm">{{ $record->playerProfile?->user?->username }} · {{ $record->game?->name }}</div>
                    <form method="POST" action="{{ route('admin.moderation.records', $record) }}" class="row g-2 mt-2">
                        @csrf
                        <div class="col-md-4">
                            <select name="status" class="form-select form-select-sm">
                                @foreach([\App\Enums\ModerationStatus::Approved, \App\Enums\ModerationStatus::Rejected, \App\Enums\ModerationStatus::Hidden] as $status)
                                    <option value="{{ $status->value }}">{{ $status->label() }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="col-md-5">
                            <input type="text" name="reason" class="form-control form-control-sm" placeholder="{{ __('admin.moderation.moderation_reason') }}">
                        </div>
                        <div class="col-md-3">
                            <button class="btn-arena btn-sm btn-primary w-100">{{ __('admin.actions.update') }}</button>
                        </div>
                    </form>
                </div>
            @empty
                <div class="card-arena p-3 text-muted">{{ __('admin.empty.no_results') }}</div>
            @endforelse
            {{ $records->links() }}
        </div>

        <div class="col-lg-6">
            <h2 class="text-white fs-5 mb-3">{{ __('admin.moderation.videos') }}</h2>
            @forelse($videos as $video)
                <div class="card-arena p-3 mb-3">
                    <div class="fw-600 text-white">{{ $video->title }}</div>
                    <div class="text-muted fs-sm">{{ $video->playerProfile?->user?->username }} · {{ $video->provider->label() }}</div>
                    <form method="POST" action="{{ route('admin.moderation.videos', $video) }}" class="row g-2 mt-2">
                        @csrf
                        <div class="col-md-4">
                            <select name="status" class="form-select form-select-sm">
                                @foreach([\App\Enums\ModerationStatus::Approved, \App\Enums\ModerationStatus::Rejected, \App\Enums\ModerationStatus::Hidden] as $status)
                                    <option value="{{ $status->value }}">{{ $status->label() }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="col-md-5">
                            <input type="text" name="reason" class="form-control form-control-sm" placeholder="{{ __('admin.moderation.moderation_reason') }}">
                        </div>
                        <div class="col-md-3">
                            <button class="btn-arena btn-sm btn-primary w-100">{{ __('admin.actions.update') }}</button>
                        </div>
                    </form>
                </div>
            @empty
                <div class="card-arena p-3 text-muted">{{ __('admin.empty.no_results') }}</div>
            @endforelse
            {{ $videos->links() }}
        </div>
    </div>
</div>
@endsection
