Files
newznab-tmux/resources/views/music/index.blade.php
T
2026-03-05 12:01:15 +01:00

272 lines
18 KiB
PHP

@extends('layouts.main')
@push('modals')
@include('partials.release-modals')
@endpush
@section('content')
<div class="surface-panel rounded-xl shadow-sm">
<!-- Breadcrumb -->
<div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700">
<nav aria-label="breadcrumb">
<ol class="flex items-center space-x-2 text-sm text-gray-600 dark:text-gray-400">
<li><a href="{{ url($site['home_link'] ?? '/') }}" class="hover:text-blue-600 dark:hover:text-blue-400">Home</a></li>
<li><i class="fas fa-chevron-right text-xs mx-2"></i></li>
<li><a href="{{ url('/browse/Audio') }}" class="hover:text-blue-600 dark:hover:text-blue-400">Audio</a></li>
@if(!empty($categorytitle) && $categorytitle !== 'All')
<li><i class="fas fa-chevron-right text-xs mx-2"></i></li>
<li class="text-gray-500 dark:text-gray-400">{{ $categorytitle }}</li>
@endif
</ol>
</nav>
</div>
<div class="px-6 py-4">
<!-- Search Filters -->
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 mb-6">
<form method="get" action="{{ url('/browse/Audio/' . ($categorytitle ?: 'All')) }}">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<!-- Artist Filter -->
<div>
<label for="artist" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Artist</label>
<input type="text"
id="artist"
name="artist"
value="{{ $artist ?? '' }}"
placeholder="Search by artist"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500">
</div>
<!-- Title Filter -->
<div>
<label for="title" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Title</label>
<input type="text"
id="title"
name="title"
value="{{ $title ?? '' }}"
placeholder="Search by title"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500">
</div>
<!-- Genre Filter -->
<div>
<label for="genre" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Genre</label>
<select id="genre"
name="genre"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100">
<option value="">All Genres</option>
@foreach($genres ?? [] as $g)
<option value="{{ $g->id }}" {{ ($genre ?? '') == $g->id ? 'selected' : '' }}>
{{ $g->title }}
</option>
@endforeach
</select>
</div>
<!-- Year Filter -->
<div>
<label for="year" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Year</label>
<select id="year"
name="year"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100">
<option value="">All Years</option>
@foreach($years ?? [] as $y)
<option value="{{ $y }}" {{ ($year ?? '') == $y ? 'selected' : '' }}>
{{ $y }}
</option>
@endforeach
</select>
</div>
</div>
<div class="mt-4 flex gap-2">
<button type="submit" class="px-4 py-2 bg-blue-600 dark:bg-blue-700 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-800">
<i class="fa fa-search mr-2"></i>Search
</button>
<a href="{{ url('/browse/Audio/' . ($categorytitle ?: 'All')) }}" class="px-4 py-2 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-md hover:bg-gray-300 dark:hover:bg-gray-600">
<i class="fa fa-times mr-2"></i>Clear
</a>
</div>
</form>
</div>
<!-- Results -->
@if(count($results) > 0)
<div class="mb-4 flex flex-wrap justify-between items-center gap-4">
<div class="flex items-center gap-4">
<h2 class="text-xl font-semibold text-gray-800 dark:text-gray-200">
<i class="fa fa-music mr-2 text-blue-600 dark:text-blue-400"></i>
{{ $catname ?? 'All' }} Albums
</h2>
<x-view-toggle
current-view="covers"
covgroup="music"
:category="$categorytitle ?? 'All'"
parentcat="Audio"
:shows="false"
/>
</div>
<div class="flex items-center gap-4">
<x-inline-search placeholder="Search in Audio..." :category="$category ?? null" />
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ $results->total() }} results found
</span>
</div>
</div>
<!-- Album Grid - Card Layout with Multiple Releases -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6">
@foreach($resultsadd as $result)
@php
$releases = $result->releases ?? [];
$totalReleases = $result->total_releases ?? count($releases);
$maxReleases = 2;
$displayReleases = array_slice($releases, 0, $maxReleases);
$guid = !empty($displayReleases) ? $displayReleases[0]->guid : null;
$totalFailed = collect($releases)->sum(fn($r) => (int)($r->failed_count ?? 0));
@endphp
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden hover:shadow-lg transition-shadow">
<div class="flex flex-row">
<!-- Album Cover -->
<div class="shrink-0">
@if($guid)
<a href="{{ url('/details/' . $guid) }}" class="block">
@if(!empty($result->cover))
<img src="{{ url('/covers/music/' . $result->cover) }}"
alt="{{ $result->artist ?? '' }} - {{ $result->title ?? '' }}"
class="w-32 h-48 object-cover"
data-fallback-src="{{ url('/images/no-cover.png') }}">
@else
<div class="w-32 h-48 bg-gray-200 dark:bg-gray-700 flex items-center justify-center">
<i class="fas fa-music text-gray-400 text-2xl"></i>
</div>
@endif
</a>
@else
<div class="w-32 h-48 bg-gray-200 dark:bg-gray-700 flex items-center justify-center">
<i class="fas fa-music text-gray-400 text-2xl"></i>
</div>
@endif
</div>
<!-- Album Details -->
<div class="flex-1 p-4">
<div class="flex justify-between items-start mb-2">
<div class="flex-1">
<h3 class="text-xl font-bold text-gray-900 dark:text-gray-100">{{ $result->title ?? 'Unknown Album' }}</h3>
<p class="text-sm text-gray-600 dark:text-gray-400">{{ $result->artist ?? 'Unknown Artist' }}</p>
@if($totalFailed > 0)
<div class="inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-red-100 text-red-800 border border-red-200 mt-1">
<i class="fas fa-exclamation-triangle mr-1"></i>
<span>{{ $totalFailed }} failed report{{ $totalFailed > 1 ? 's' : '' }}</span>
</div>
@endif
<div class="flex items-center gap-4 mt-1 text-sm text-gray-600 dark:text-gray-400">
@if(!empty($result->year))
<span><i class="fas fa-calendar mr-1"></i> {{ $result->year }}</span>
@endif
@if(!empty($result->genre))
<span><i class="fas fa-tag mr-1"></i> {{ $result->genre }}</span>
@endif
</div>
@if(!empty($result->label))
<div class="text-xs text-gray-600 dark:text-gray-400 mt-1">
<strong>Label:</strong> {{ $result->label }}
</div>
@endif
</div>
</div>
<!-- Release Information -->
@if(!empty($displayReleases))
<div class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-700">
<h4 class="text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2">
Available Releases
@if($totalReleases > $maxReleases)
<span class="text-xs font-normal text-gray-500">(Showing {{ $maxReleases }} of {{ $totalReleases }})</span>
@endif
</h4>
<div class="space-y-2">
@foreach($displayReleases as $release)
@if($release->searchname)
<div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-2 border border-gray-200 dark:border-gray-700">
<div class="space-y-2">
<!-- Release Name -->
<a href="{{ url('/details/' . $release->guid) }}" class="text-sm text-gray-800 dark:text-gray-200 hover:text-blue-600 dark:hover:text-blue-400 font-medium block break-all" title="{{ $release->searchname }}">
{{ $release->searchname }}
</a>
<!-- Info Badges -->
<div class="flex flex-wrap items-center gap-1.5">
@if(isset($release->size))
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300">
<i class="fas fa-hdd mr-1"></i>{{ number_format($release->size / 1073741824, 2) }} GB
</span>
@endif
@if(isset($release->postdate))
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300">
<i class="fas fa-calendar-alt mr-1"></i>{{ date('M d, Y H:i', strtotime($release->postdate)) }}
</span>
@endif
@if(isset($release->nfoid) && !empty($release->nfoid))
<button type="button"
class="nfo-badge inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200 hover:bg-yellow-200 dark:hover:bg-yellow-800 transition cursor-pointer"
data-guid="{{ $release->guid }}"
title="View NFO file">
<i class="fas fa-file-alt mr-1"></i> NFO
</button>
@endif
</div>
<!-- Action Buttons -->
<div class="flex flex-wrap items-center gap-1.5">
<a href="{{ url('/getnzb/' . $release->guid) }}" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-600 dark:bg-green-700 text-white hover:bg-green-700 dark:hover:bg-green-800 transition">
<i class="fas fa-download mr-1"></i> Download
</a>
<button class="add-to-cart inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-600 dark:bg-blue-700 text-white hover:bg-blue-700 dark:hover:bg-blue-800 transition" data-guid="{{ $release->guid }}">
<i class="fas fa-shopping-cart mr-1"></i> Cart
</button>
<a href="{{ url('/details/' . $release->guid) }}" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-600 dark:bg-gray-700 text-white hover:bg-gray-700 dark:hover:bg-gray-800 transition">
<i class="fas fa-info-circle mr-1"></i> Details
</a>
</div>
</div>
</div>
@endif
@endforeach
</div>
</div>
@endif
</div>
</div>
</div>
@endforeach
</div>
<!-- Pagination -->
<div class="flex justify-center">
{{ $results->links() }}
</div>
@else
<!-- No Results -->
<div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-700 rounded-lg p-8 text-center">
<i class="fa fa-music text-yellow-600 dark:text-yellow-500 text-5xl mb-4"></i>
<h3 class="text-xl font-semibold text-gray-800 dark:text-gray-200 mb-2">No albums found</h3>
<p class="text-gray-600 dark:text-gray-400 mb-4">Try adjusting your search filters or browse all music.</p>
<a href="{{ url('/browse/Audio/All') }}" class="inline-flex items-center px-4 py-2 bg-blue-600 dark:bg-blue-700 text-white rounded-lg hover:bg-blue-700 dark:hover:bg-blue-800">
<i class="fa fa-music mr-2"></i> Browse All Audio
</a>
</div>
@endif
</div>
</div>
{{-- NFO modal is included globally via layouts.main --}}
@endsection