fedi-feed-router/resources/views/pages/articles/index.blade.php
2025-07-10 14:57:10 +02:00

79 lines
4.9 KiB
PHP

@extends('layouts.app')
@section('page-title', 'Articles')
@section('content')
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-lg font-medium text-gray-900">Article Feed</h2>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">URL</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Approval</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Created At</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($articles as $article)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $article->id }}</td>
<td class="px-6 py-4 text-sm text-gray-900">
<a href="{{ $article->url }}" target="_blank" class="text-blue-600 hover:text-blue-900 hover:underline">
{{ Str::limit($article->url, 60) }}
</a>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full
{{ $article->articlePublication ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800' }}">
{{ $article->articlePublication ? 'Published' : 'Pending' }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full
@if($article->approval_status === 'approved') bg-green-100 text-green-800
@elseif($article->approval_status === 'rejected') bg-red-100 text-red-800
@else bg-yellow-100 text-yellow-800 @endif">
{{ ucfirst($article->approval_status) }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $article->created_at->format('Y-m-d H:i') }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
@if($publishingApprovalsEnabled && $article->isValid() && $article->isPending() && !$article->articlePublication)
<div class="flex space-x-2">
<form method="POST" action="{{ route('articles.approve', $article) }}" class="inline">
@csrf
<button type="submit" class="text-green-600 hover:text-green-900 font-medium">
Approve & Publish
</button>
</form>
<form method="POST" action="{{ route('articles.reject', $article) }}" class="inline">
@csrf
<button type="submit" class="text-red-600 hover:text-red-900 font-medium">
Reject
</button>
</form>
</div>
@elseif($article->isValid() && !$article->articlePublication)
<span class="text-gray-500">Auto-publishing enabled</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@if($articles->hasPages())
<div class="px-6 py-4 border-t border-gray-200">
{{ $articles->links() }}
</div>
@endif
</div>
@endsection