Files
aibuddytool/resources/views/admin/posts/manage.blade.php
2023-10-01 00:35:27 +08:00

123 lines
6.5 KiB
PHP

@extends('layouts.admin.app')
@section('content')
<div class="container-xl">
<!-- Page title -->
<div class="page-header d-print-none">
<h2 class="page-title">
{{ __('Posts') }}
</h2>
<h4>Manage your blog posts here</h4>
</div>
</div>
<div class="page-body">
<div class="container-xl">
@include('admin.partials.webmaster_announcement')
<div class="d-flex mb-3">
<div><a href="{{ route('posts.manage.new') }}" class="btn">New Post</a></div>
</div>
<div class="card">
<div class="table-responsive">
<table class="table" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>{{ __('Post #') }}</th>
<th>
Image
</th>
<th>Status</th>
<th>Title</th>
<th>Datetime</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($posts as $post)
<tr>
<td>{{ $post->id }}</td>
<td>
@if (!is_empty($post->featured_image))
<img width="80" height="60" src="{{ $post->featured_image }}"
class="img-fluid rounded-2" alt="">
@else
<div style="width:80px; height:50px; background-color: #eeeeee;"
class="rounded-3 d-flex justify-content-center">
<div class="align-self-center">
?
</div>
</div>
@endif
</td>
<td>
@if ($post->status === 'publish')
<span class="badge bg-success">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'future')
<span class="badge bg-primary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'draft')
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'private')
<span class="badge bg-info">{{ ucfirst($post->status) }}</span>
@elseif ($post->status == 'trash')
<span class="badge bg-danger">{{ ucfirst($post->status) }}</span>
@else
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@endif
</td>
<td>
@if (!is_empty($post->post_category?->category?->country_locale_slug) && $post->status == 'publish')
<a
href="{{ route('home.country.post', ['country' => $post->post_category?->category?->country_locale_slug, 'post_slug' => $post->slug]) }}">{{ $post->title }}</a>
@else
{{ $post->title }}
@endif
<br>
@if ($post->status == 'publish')
Published at
{{ $post->publish_date->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}
@endif
</td>
<td>
Created at
{{ $post->created_at->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}<br>
Updated {{ $post->updated_at->diffForhumans() }}<br>
</td>
<td>
<div class="d-grid gap-2">
@if ($post->status == 'publish')
<a href="{{ route('posts.manage.indexing', ['post_id' => $post->id]) }}"
class="btn">Index to Search Engines</a>
@endif
@if ($post->editor == 'editorjs')
<a href="{{ route('posts.manage.edit', ['post_id' => $post->id]) }}"
class="btn">Edit</a>
@else
<a href="#" class="btn disabled">Edit (Disabled)</a>
@endif
@if ($post->status == 'trash')
<a href="{{ route('posts.manage.delete', ['post_id' => $post->id]) }}"
class="btn">Delete Forever</a>
@endif
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@if ($posts->hasPages())
<div class="card-footer pb-0">
{{ $posts->links() }}
</div>
@endif
</div>
</div>
</div>
@endsection