@extends('adminpanel.layouts.app')

@section('title')Все текстовые страницы @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 m-2" href="{{route('createTextPage')}}">Создать страницу</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($pages as $item)
                                <tr>
                                    <td>{{$item->id}}</td>
                                    <td>{{(isset($item->category->title_ru))?$item->category->title_ru : null }}</td>
                                    <td>{{ ($item->status === 1)? 'Опубликовано': 'Не опубликовано' }}</td>
                                    <td>{{ $item->title_ru }}</td>
                                    <td>
                                        <a class="btn btn-primary btn-sm"
                                           href="{{route('editTextPage',['page'=>$item->id])}}">Редактировать</a>
                                        <a class="btn btn-danger btn-sm"
                                           href="{{route('deleteTextPage',['page'=>$item->id])}}">Удалить</a>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
