Add enable/disable toggle for channels
This commit is contained in:
parent
c551b12360
commit
3d899034f9
6 changed files with 499 additions and 0 deletions
|
|
@ -61,6 +61,13 @@ public function store(Request $request): RedirectResponse
|
|||
->with('success', 'Channel created successfully!');
|
||||
}
|
||||
|
||||
public function show(PlatformChannel $channel): View
|
||||
{
|
||||
$channel->load(['platformInstance', 'feeds']);
|
||||
|
||||
return ViewFacade::make('pages.channels.show', compact('channel'));
|
||||
}
|
||||
|
||||
public function edit(PlatformChannel $channel): View
|
||||
{
|
||||
$instances = PlatformInstance::where('is_active', true)
|
||||
|
|
@ -95,4 +102,15 @@ public function destroy(PlatformChannel $channel): RedirectResponse
|
|||
return redirect()->route('channels.index')
|
||||
->with('success', 'Channel deleted successfully!');
|
||||
}
|
||||
|
||||
public function toggle(PlatformChannel $channel): RedirectResponse
|
||||
{
|
||||
$newStatus = !$channel->is_active;
|
||||
$channel->update(['is_active' => $newStatus]);
|
||||
|
||||
$status = $newStatus ? 'activated' : 'deactivated';
|
||||
|
||||
return redirect()->route('channels.index')
|
||||
->with('success', "Channel {$status} successfully!");
|
||||
}
|
||||
}
|
||||
100
resources/views/pages/channels/create.blade.php
Normal file
100
resources/views/pages/channels/create.blade.php
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-2xl mx-auto py-6 sm:px-6 lg:px-8">
|
||||
<div class="px-4 py-6 sm:px-0">
|
||||
<div class="mb-6">
|
||||
<h1 class="text-2xl font-semibold text-gray-900">Create New Channel</h1>
|
||||
<p class="mt-1 text-sm text-gray-600">Add a new publishing channel to your platform</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white shadow sm:rounded-lg">
|
||||
<form action="{{ route('channels.store') }}" method="POST" class="px-4 py-5 sm:p-6">
|
||||
@csrf
|
||||
|
||||
<div class="grid grid-cols-1 gap-6">
|
||||
<div>
|
||||
<label for="platform_instance_id" class="block text-sm font-medium text-gray-700">Platform</label>
|
||||
<select name="platform_instance_id" id="platform_instance_id" required
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('platform_instance_id') border-red-300 @enderror">
|
||||
<option value="">Select a platform</option>
|
||||
@foreach($instances as $instance)
|
||||
<option value="{{ $instance->id }}" {{ old('platform_instance_id') == $instance->id ? 'selected' : '' }}>
|
||||
{{ $instance->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('platform_instance_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="name" class="block text-sm font-medium text-gray-700">Channel Name</label>
|
||||
<input type="text" name="name" id="name" required
|
||||
value="{{ old('name') }}"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('name') border-red-300 @enderror"
|
||||
placeholder="technology">
|
||||
<p class="mt-1 text-sm text-gray-500">The channel identifier (e.g., "technology", "news")</p>
|
||||
@error('name')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="display_name" class="block text-sm font-medium text-gray-700">Display Name</label>
|
||||
<input type="text" name="display_name" id="display_name"
|
||||
value="{{ old('display_name') }}"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('display_name') border-red-300 @enderror"
|
||||
placeholder="Technology">
|
||||
<p class="mt-1 text-sm text-gray-500">Human-readable name for the channel (optional)</p>
|
||||
@error('display_name')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="channel_id" class="block text-sm font-medium text-gray-700">Channel ID</label>
|
||||
<input type="text" name="channel_id" id="channel_id"
|
||||
value="{{ old('channel_id') }}"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('channel_id') border-red-300 @enderror"
|
||||
placeholder="12345">
|
||||
<p class="mt-1 text-sm text-gray-500">Platform-specific channel ID (optional)</p>
|
||||
@error('channel_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
|
||||
<textarea name="description" id="description" rows="3"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('description') border-red-300 @enderror"
|
||||
placeholder="Channel for technology-related content">{{ old('description') }}</textarea>
|
||||
@error('description')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="flex items-center">
|
||||
<input type="checkbox" name="is_active" id="is_active" value="1"
|
||||
{{ old('is_active', true) ? 'checked' : '' }}
|
||||
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
|
||||
<label for="is_active" class="ml-2 block text-sm text-gray-900">
|
||||
Active (channel can receive published content)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex items-center justify-end space-x-3">
|
||||
<a href="{{ route('channels.index') }}" class="bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
Cancel
|
||||
</a>
|
||||
<button type="submit" class="bg-indigo-600 py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white hover:bg-indigo-700">
|
||||
Create Channel
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
104
resources/views/pages/channels/edit.blade.php
Normal file
104
resources/views/pages/channels/edit.blade.php
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-2xl mx-auto py-6 sm:px-6 lg:px-8">
|
||||
<div class="px-4 py-6 sm:px-0">
|
||||
<div class="mb-6">
|
||||
<h1 class="text-2xl font-semibold text-gray-900">Edit Channel</h1>
|
||||
<p class="mt-1 text-sm text-gray-600">Update channel details</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white shadow sm:rounded-lg">
|
||||
<form action="{{ route('channels.update', $channel) }}" method="POST" class="px-4 py-5 sm:p-6">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="grid grid-cols-1 gap-6">
|
||||
<div>
|
||||
<label for="platform_instance_id" class="block text-sm font-medium text-gray-700">Platform</label>
|
||||
<select name="platform_instance_id" id="platform_instance_id" required
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('platform_instance_id') border-red-300 @enderror">
|
||||
@foreach($instances as $instance)
|
||||
<option value="{{ $instance->id }}" {{ old('platform_instance_id', $channel->platform_instance_id) == $instance->id ? 'selected' : '' }}>
|
||||
{{ $instance->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('platform_instance_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="name" class="block text-sm font-medium text-gray-700">Channel Name</label>
|
||||
<input type="text" name="name" id="name" required
|
||||
value="{{ old('name', $channel->name) }}"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('name') border-red-300 @enderror">
|
||||
@error('name')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="display_name" class="block text-sm font-medium text-gray-700">Display Name</label>
|
||||
<input type="text" name="display_name" id="display_name"
|
||||
value="{{ old('display_name', $channel->display_name) }}"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('display_name') border-red-300 @enderror">
|
||||
@error('display_name')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="channel_id" class="block text-sm font-medium text-gray-700">Channel ID</label>
|
||||
<input type="text" name="channel_id" id="channel_id"
|
||||
value="{{ old('channel_id', $channel->channel_id) }}"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('channel_id') border-red-300 @enderror">
|
||||
@error('channel_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
|
||||
<textarea name="description" id="description" rows="3"
|
||||
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm @error('description') border-red-300 @enderror">{{ old('description', $channel->description) }}</textarea>
|
||||
@error('description')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="flex items-center">
|
||||
<input type="checkbox" name="is_active" id="is_active" value="1"
|
||||
{{ old('is_active', $channel->is_active) ? 'checked' : '' }}
|
||||
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
|
||||
<label for="is_active" class="ml-2 block text-sm text-gray-900">
|
||||
Active (channel can receive published content)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex items-center justify-between">
|
||||
<form action="{{ route('channels.destroy', $channel) }}" method="POST" class="inline"
|
||||
onsubmit="return confirm('Are you sure you want to delete this channel?')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="bg-red-600 py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white hover:bg-red-700">
|
||||
Delete Channel
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="flex items-center space-x-3">
|
||||
<a href="{{ route('channels.show', $channel) }}" class="bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
Cancel
|
||||
</a>
|
||||
<button type="submit" class="bg-indigo-600 py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white hover:bg-indigo-700">
|
||||
Update Channel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
99
resources/views/pages/channels/index.blade.php
Normal file
99
resources/views/pages/channels/index.blade.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
@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">Platform Channels</h1>
|
||||
<p class="mt-1 text-sm text-gray-600">Manage channels for publishing content</p>
|
||||
</div>
|
||||
<a href="{{ route('channels.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||||
Add New Channel
|
||||
</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="bg-white shadow overflow-hidden sm:rounded-md">
|
||||
@if($channels->count() > 0)
|
||||
<ul class="divide-y divide-gray-200">
|
||||
@foreach($channels as $channel)
|
||||
<li>
|
||||
<div class="px-4 py-4 flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<x-heroicon-o-hashtag class="w-5 h-5 text-gray-400" />
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
<div class="flex items-center">
|
||||
<div class="text-sm font-medium text-gray-900">{{ $channel->display_name ?? $channel->name }}</div>
|
||||
@if(!$channel->is_active)
|
||||
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
||||
Inactive
|
||||
</span>
|
||||
@else
|
||||
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
||||
Active
|
||||
</span>
|
||||
@endif
|
||||
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||
{{ $channel->platformInstance->name }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-sm text-gray-500">{{ $channel->name }}</div>
|
||||
@if($channel->description)
|
||||
<div class="text-sm text-gray-500 mt-1">{{ Str::limit($channel->description, 100) }}</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-3">
|
||||
<!-- Toggle Switch -->
|
||||
<form action="{{ route('channels.toggle', $channel) }}" method="POST" class="inline">
|
||||
@csrf
|
||||
<label class="inline-flex items-center cursor-pointer">
|
||||
<span class="text-xs text-gray-600 mr-2">{{ $channel->is_active ? 'Active' : 'Inactive' }}</span>
|
||||
<button type="submit" class="relative inline-flex h-6 w-11 items-center rounded-full transition-colors {{ $channel->is_active ? 'bg-green-600' : 'bg-gray-200' }}">
|
||||
<span class="inline-block h-4 w-4 transform rounded-full bg-white transition-transform {{ $channel->is_active ? 'translate-x-6' : 'translate-x-1' }}"></span>
|
||||
</button>
|
||||
</label>
|
||||
</form>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<a href="{{ route('channels.show', $channel) }}" class="text-indigo-600 hover:text-indigo-900 text-sm font-medium">
|
||||
View
|
||||
</a>
|
||||
<a href="{{ route('channels.edit', $channel) }}" class="text-indigo-600 hover:text-indigo-900 text-sm font-medium">
|
||||
Edit
|
||||
</a>
|
||||
<form action="{{ route('channels.destroy', $channel) }}" method="POST" class="inline"
|
||||
onsubmit="return confirm('Are you sure you want to delete this channel?')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-600 hover:text-red-900 text-sm font-medium">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@else
|
||||
<div class="text-center py-12">
|
||||
<x-heroicon-o-hashtag class="w-24 h-24 text-gray-400 mb-4" />
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-2">No channels yet</h3>
|
||||
<p class="text-gray-500 mb-4">Get started by adding your first publishing channel.</p>
|
||||
<a href="{{ route('channels.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||||
Add New Channel
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
177
resources/views/pages/channels/show.blade.php
Normal file
177
resources/views/pages/channels/show.blade.php
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-4xl mx-auto py-6 sm:px-6 lg:px-8">
|
||||
<div class="px-4 py-6 sm:px-0">
|
||||
<!-- Header -->
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold text-gray-900">{{ $channel->display_name ?? $channel->name }}</h1>
|
||||
<p class="mt-1 text-sm text-gray-600">{{ $channel->platformInstance->name }} Channel</p>
|
||||
</div>
|
||||
<div class="flex items-center space-x-3">
|
||||
<a href="{{ route('channels.edit', $channel) }}" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-md">
|
||||
Edit Channel
|
||||
</a>
|
||||
<a href="{{ route('channels.index') }}" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-md">
|
||||
Back to Channels
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(session('success'))
|
||||
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-6">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<!-- Channel Status & Toggle -->
|
||||
<div class="bg-white overflow-hidden shadow rounded-lg">
|
||||
<div class="px-4 py-5 sm:p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<div>
|
||||
<h3 class="text-lg font-medium text-gray-900">Channel Status</h3>
|
||||
<p class="text-sm text-gray-500">Enable or disable publishing to this channel</p>
|
||||
</div>
|
||||
@if($channel->is_active)
|
||||
<div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center">
|
||||
<x-heroicon-o-check-circle class="w-5 h-5 text-green-600" />
|
||||
</div>
|
||||
@else
|
||||
<div class="w-8 h-8 bg-red-100 rounded-full flex items-center justify-center">
|
||||
<x-heroicon-o-x-circle class="w-5 h-5 text-red-600" />
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-lg font-medium {{ $channel->is_active ? 'text-green-600' : 'text-red-600' }}">
|
||||
{{ $channel->is_active ? 'Active' : 'Inactive' }}
|
||||
</span>
|
||||
|
||||
<form action="{{ route('channels.toggle', $channel) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
class="relative inline-flex h-6 w-11 items-center rounded-full transition-colors {{ $channel->is_active ? 'bg-green-600' : 'bg-gray-200' }}"
|
||||
title="{{ $channel->is_active ? 'Click to deactivate' : 'Click to activate' }}">
|
||||
<span class="inline-block h-4 w-4 transform rounded-full bg-white transition-transform {{ $channel->is_active ? 'translate-x-6' : 'translate-x-1' }}"></span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@if(!$channel->is_active)
|
||||
<div class="mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md">
|
||||
<p class="text-sm text-yellow-800">
|
||||
<x-heroicon-o-exclamation-triangle class="w-4 h-4 inline mr-1" />
|
||||
This channel is inactive. No articles will be published here until reactivated.
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Channel Details -->
|
||||
<div class="lg:col-span-2 bg-white overflow-hidden shadow rounded-lg">
|
||||
<div class="px-4 py-5 sm:p-6">
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-4">Channel Details</h3>
|
||||
|
||||
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Channel Name</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $channel->name }}</dd>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Display Name</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $channel->display_name ?? $channel->name }}</dd>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Platform</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $channel->platformInstance->name }}</dd>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Channel ID</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $channel->channel_id ?? 'Not set' }}</dd>
|
||||
</div>
|
||||
|
||||
@if($channel->language)
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Language</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $channel->language->name }}</dd>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Created</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $channel->created_at->format('M j, Y') }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
@if($channel->description)
|
||||
<div class="mt-4">
|
||||
<dt class="text-sm font-medium text-gray-500">Description</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $channel->description }}</dd>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Connected Feeds -->
|
||||
@if($channel->feeds->count() > 0)
|
||||
<div class="mt-6 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">Connected Feeds</h3>
|
||||
<p class="mt-1 max-w-2xl text-sm text-gray-500">Feeds that route content to this channel</p>
|
||||
</div>
|
||||
<ul class="divide-y divide-gray-200">
|
||||
@foreach($channel->feeds as $feed)
|
||||
<li class="px-4 py-4">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
@if($feed->type === 'rss')
|
||||
<x-heroicon-o-rss class="w-4 h-4 text-orange-500 mr-3" />
|
||||
@else
|
||||
<x-heroicon-o-globe-alt class="w-4 h-4 text-blue-500 mr-3" />
|
||||
@endif
|
||||
<div>
|
||||
<p class="text-sm font-medium text-gray-900">{{ $feed->name }}</p>
|
||||
<p class="text-sm text-gray-500">{{ $feed->url }}</p>
|
||||
</div>
|
||||
@if(!$feed->pivot->is_active)
|
||||
<span class="ml-3 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
||||
Route Inactive
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<a href="{{ route('feeds.show', $feed) }}" class="text-indigo-600 hover:text-indigo-900 text-sm">
|
||||
View Feed
|
||||
</a>
|
||||
<a href="{{ route('routing.edit', [$feed, $channel]) }}" class="text-indigo-600 hover:text-indigo-900 text-sm">
|
||||
Edit Route
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@else
|
||||
<div class="mt-6 bg-white shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-8 text-center">
|
||||
<x-heroicon-o-arrow-path class="w-12 h-12 text-gray-400 mx-auto mb-4" />
|
||||
<h3 class="text-sm font-medium text-gray-900 mb-2">No feeds connected</h3>
|
||||
<p class="text-sm text-gray-500 mb-4">This channel doesn't have any feeds routing content to it yet.</p>
|
||||
<a href="{{ route('routing.create') }}" class="bg-blue-500 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm">
|
||||
Create Route
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
Route::post('/platforms/{platformAccount}/set-active', [App\Http\Controllers\PlatformAccountsController::class, 'setActive'])->name('platforms.set-active');
|
||||
|
||||
Route::resource('channels', App\Http\Controllers\PlatformChannelsController::class)->names('channels');
|
||||
Route::post('/channels/{channel}/toggle', [App\Http\Controllers\PlatformChannelsController::class, 'toggle'])->name('channels.toggle');
|
||||
Route::resource('feeds', App\Http\Controllers\FeedsController::class)->names('feeds');
|
||||
|
||||
Route::get('/routing', [App\Http\Controllers\RoutingController::class, 'index'])->name('routing.index');
|
||||
|
|
|
|||
Loading…
Reference in a new issue