151 lines
9.7 KiB
PHP
151 lines
9.7 KiB
PHP
|
|
@extends('layouts.app')
|
||
|
|
|
||
|
|
@section('content')
|
||
|
|
<div class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
|
||
|
|
<div class="px-4 py-6 sm:px-0">
|
||
|
|
<div class="flex justify-between items-center mb-6">
|
||
|
|
<div>
|
||
|
|
<h1 class="text-2xl font-semibold text-gray-900">Feed Routing</h1>
|
||
|
|
<p class="mt-1 text-sm text-gray-600">Manage how feeds are routed to channels</p>
|
||
|
|
</div>
|
||
|
|
<a href="{{ route('routing.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||
|
|
Create New Routing
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
@if(session('success'))
|
||
|
|
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4">
|
||
|
|
{{ session('success') }}
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
|
||
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||
|
|
<!-- Feeds Section -->
|
||
|
|
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
||
|
|
<div class="px-4 py-5 sm:px-6 border-b border-gray-200">
|
||
|
|
<h3 class="text-lg leading-6 font-medium text-gray-900">Feeds → Channels</h3>
|
||
|
|
<p class="mt-1 max-w-2xl text-sm text-gray-500">Active feed-to-channel routing</p>
|
||
|
|
</div>
|
||
|
|
<div class="divide-y divide-gray-200">
|
||
|
|
@forelse($feeds as $feed)
|
||
|
|
@if($feed->channels->count() > 0)
|
||
|
|
<div class="px-4 py-4">
|
||
|
|
<div class="flex items-center mb-3">
|
||
|
|
@if($feed->type === 'rss')
|
||
|
|
<i class="fas fa-rss text-orange-500 mr-2"></i>
|
||
|
|
@else
|
||
|
|
<i class="fas fa-globe text-blue-500 mr-2"></i>
|
||
|
|
@endif
|
||
|
|
<span class="font-medium text-gray-900">{{ $feed->name }}</span>
|
||
|
|
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">
|
||
|
|
{{ $feed->channels->count() }} channel{{ $feed->channels->count() !== 1 ? 's' : '' }}
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
<div class="space-y-2">
|
||
|
|
@foreach($feed->channels as $channel)
|
||
|
|
<div class="flex items-center justify-between bg-gray-50 rounded px-3 py-2">
|
||
|
|
<div class="flex items-center">
|
||
|
|
<i class="fas fa-hashtag text-gray-400 mr-2"></i>
|
||
|
|
<span class="text-sm text-gray-900">{{ $channel->name }}</span>
|
||
|
|
<span class="ml-2 text-xs text-gray-500">({{ $channel->platformInstance->name }})</span>
|
||
|
|
@if(!$channel->pivot->is_active)
|
||
|
|
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
||
|
|
Inactive
|
||
|
|
</span>
|
||
|
|
@endif
|
||
|
|
@if($channel->pivot->priority > 0)
|
||
|
|
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
|
||
|
|
Priority: {{ $channel->pivot->priority }}
|
||
|
|
</span>
|
||
|
|
@endif
|
||
|
|
</div>
|
||
|
|
<div class="flex items-center space-x-2">
|
||
|
|
<form action="{{ route('routing.toggle', [$feed, $channel]) }}" method="POST" class="inline">
|
||
|
|
@csrf
|
||
|
|
<button type="submit" class="text-xs px-2 py-1 rounded {{ $channel->pivot->is_active ? 'bg-red-100 text-red-800 hover:bg-red-200' : 'bg-green-100 text-green-800 hover:bg-green-200' }}">
|
||
|
|
{{ $channel->pivot->is_active ? 'Deactivate' : 'Activate' }}
|
||
|
|
</button>
|
||
|
|
</form>
|
||
|
|
<a href="{{ route('routing.edit', [$feed, $channel]) }}" class="text-indigo-600 hover:text-indigo-900 text-xs">Edit</a>
|
||
|
|
<form action="{{ route('routing.destroy', [$feed, $channel]) }}" method="POST" class="inline"
|
||
|
|
onsubmit="return confirm('Remove this routing?')">
|
||
|
|
@csrf
|
||
|
|
@method('DELETE')
|
||
|
|
<button type="submit" class="text-red-600 hover:text-red-900 text-xs">Remove</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endforeach
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
@empty
|
||
|
|
<div class="px-4 py-8 text-center text-gray-500">
|
||
|
|
No feed routing configured
|
||
|
|
</div>
|
||
|
|
@endforelse
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Channels Section -->
|
||
|
|
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
||
|
|
<div class="px-4 py-5 sm:px-6 border-b border-gray-200">
|
||
|
|
<h3 class="text-lg leading-6 font-medium text-gray-900">Channels ← Feeds</h3>
|
||
|
|
<p class="mt-1 max-w-2xl text-sm text-gray-500">Channels and their connected feeds</p>
|
||
|
|
</div>
|
||
|
|
<div class="divide-y divide-gray-200">
|
||
|
|
@forelse($channels as $channel)
|
||
|
|
@if($channel->feeds->count() > 0)
|
||
|
|
<div class="px-4 py-4">
|
||
|
|
<div class="flex items-center mb-3">
|
||
|
|
<i class="fas fa-hashtag text-gray-400 mr-2"></i>
|
||
|
|
<span class="font-medium text-gray-900">{{ $channel->name }}</span>
|
||
|
|
<span class="ml-2 text-xs text-gray-500">({{ $channel->platformInstance->name }})</span>
|
||
|
|
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">
|
||
|
|
{{ $channel->feeds->count() }} feed{{ $channel->feeds->count() !== 1 ? 's' : '' }}
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
<div class="space-y-1">
|
||
|
|
@foreach($channel->feeds as $feed)
|
||
|
|
<div class="flex items-center justify-between bg-gray-50 rounded px-3 py-2">
|
||
|
|
<div class="flex items-center">
|
||
|
|
@if($feed->type === 'rss')
|
||
|
|
<i class="fas fa-rss text-orange-500 mr-2"></i>
|
||
|
|
@else
|
||
|
|
<i class="fas fa-globe text-blue-500 mr-2"></i>
|
||
|
|
@endif
|
||
|
|
<span class="text-sm text-gray-900">{{ $feed->name }}</span>
|
||
|
|
@if(!$feed->pivot->is_active)
|
||
|
|
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
||
|
|
Inactive
|
||
|
|
</span>
|
||
|
|
@endif
|
||
|
|
</div>
|
||
|
|
<a href="{{ route('routing.edit', [$feed, $channel]) }}" class="text-indigo-600 hover:text-indigo-900 text-xs">Edit</a>
|
||
|
|
</div>
|
||
|
|
@endforeach
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
@empty
|
||
|
|
<div class="px-4 py-8 text-center text-gray-500">
|
||
|
|
No channels with feeds
|
||
|
|
</div>
|
||
|
|
@endforelse
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
@if($feeds->where('channels')->isEmpty() && $channels->where('feeds')->isEmpty())
|
||
|
|
<div class="text-center py-12">
|
||
|
|
<i class="fas fa-route text-gray-400 text-6xl mb-4"></i>
|
||
|
|
<h3 class="text-lg font-medium text-gray-900 mb-2">No routing configured</h3>
|
||
|
|
<p class="text-gray-500 mb-4">Connect your feeds to channels to start routing content.</p>
|
||
|
|
<a href="{{ route('routing.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||
|
|
Create First Routing
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endsection
|