@extends('layouts.backend')
@section('title')
    Admin | All Pages
@endsection

@section('extra_css')

    <style type="text/css">

    </style>
@endsection

@section('extra_js')

@endsection

@section('content')
   
<div class="container-fluid">
    @include('back.parts.message')
    <div class="row justify-content-center">
        <div class="col-lg-10">
            <div class="card mb-4">
                <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                    <div class="col-md-6">
                        <h6 class="m-0 font-weight-bold text-primary">All Pages</h6>
                    </div>
                    <div class="col-md-6">
                        <a href="{{ route('page.create') }}" class="btn btn-primary float-right">Add New</a>
                    </div>
                </div>
                    <div class="table-responsive">
                        <table class="table align-items-center table-flush">
                            <thead class="thead-light">
                            <tr>
                                <th class="text-center col__id">ID</th>
                                <th>Title</th>
                                <th>Category</th>
                                <th>Status</th>
                                <th class="col__action__body">Action</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach(\App\Models\Page::all() as $row)
                                <tr>
                                    <td class="text-center">{{$row->id}}</td>
                                    <td>{{$row->title}}</td>
                                    <td>{{ $row->Pagecategory->name }}</td>
                                    <td>{{ $row->status?'Active':'In-Active' }}</td>
                                    <td class="col__action__body">
                                        <a title="view" target="_blank" href="{{page_url($row->slug)}}" class="btn btn-success btn-sm">View</a>
                                        <a href="{{ route('page.edit', ['id' => $row->id])}}"
                                           class="btn btn-info btn-sm">Edit</a>
                                        <a href="{{ route('page.destroy', ['id' => $row->id])}}"
                                           onclick="return confirm('Are you sure to delete this!')"
                                           class="btn btn-danger btn-sm">Delete</a>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
            </div>
        </div>
    </div>
</div>
    
@endsection
