@extends('adminpanel.layouts.app')

{{--@section('title'){!! $category->title_ru !!}@endsection--}}

@section('content')
    <div class="content">
        <div class="col-12">
            <div class="card" style="width: 100%;">
                <div class="card-body">
                    <a class="btn btn-success btn-sm col-2 m-2"
                            href="{{route('createMultimedia')}}">Добавить медиа</a>
                    <div class="table-responsive">
                        <table class="table table-striped table-sm">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>Категория</th>
                                <th>Название (Рус)</th>
                                <th>Статус</th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($medias as $item)
                                <tr>
                                    <td>{{$item->id}}</td>
                                    <td>@if($item->type !== null) {{$mediaType->{intval($item->type)}->title_ru }} @else
                                            Не указан @endif</td>
                                    <td>{{ $item->title_ru }}</td>
                                    <td>@if($item->status !== null) {{$statusType->{intval($item->status)} }} @else Не
                                        указан @endif</td>
                                    <td>
                                        <a class="btn btn-primary btn-sm"
                                           href="{{route('editMultimedia',['media'=>$item->id])}}">Редактировать</a>
                                        <a class="btn btn-danger btn-sm"
                                           href="{{route('deleteMultimedia',['media'=>$item->id])}}">Удалить</a>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
