Initial commit
This commit is contained in:
135
resources/views/documents/index.blade.php
Normal file
135
resources/views/documents/index.blade.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="text-xl font-semibold leading-tight text-gray-800">
|
||||
文件中心
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8 space-y-6">
|
||||
<!-- Categories -->
|
||||
<div class="bg-white shadow sm:rounded-lg p-6">
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-4">文件類別</h3>
|
||||
<div class="grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6">
|
||||
<a href="{{ route('documents.index') }}"
|
||||
class="flex flex-col items-center p-4 border rounded-lg hover:bg-gray-50 transition
|
||||
{{ !request('category') ? 'border-indigo-500 bg-indigo-50' : 'border-gray-200' }}">
|
||||
<span class="text-3xl mb-2">📚</span>
|
||||
<span class="text-sm font-medium text-gray-900">全部文件</span>
|
||||
<span class="text-xs text-gray-500 mt-1">{{ $documents->total() }}</span>
|
||||
</a>
|
||||
@foreach($categories as $category)
|
||||
<a href="{{ route('documents.index', ['category' => $category->id]) }}"
|
||||
class="flex flex-col items-center p-4 border rounded-lg hover:bg-gray-50 transition
|
||||
{{ request('category') == $category->id ? 'border-indigo-500 bg-indigo-50' : 'border-gray-200' }}">
|
||||
<span class="text-3xl mb-2">{{ $category->getIconDisplay() }}</span>
|
||||
<span class="text-sm font-medium text-gray-900 text-center">{{ $category->name }}</span>
|
||||
<span class="text-xs text-gray-500 mt-1">{{ $category->active_documents_count }}</span>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search -->
|
||||
<div class="bg-white shadow sm:rounded-lg p-6">
|
||||
<form method="GET" action="{{ route('documents.index') }}" class="flex gap-4">
|
||||
<input type="hidden" name="category" value="{{ request('category') }}">
|
||||
<div class="flex-1">
|
||||
<input type="text" name="search" value="{{ request('search') }}" placeholder="搜尋文件標題或說明..."
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
|
||||
</div>
|
||||
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-6 py-2 text-sm font-medium text-white hover:bg-indigo-700">
|
||||
搜尋
|
||||
</button>
|
||||
@if(request('search') || request('category'))
|
||||
<a href="{{ route('documents.index') }}" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
清除
|
||||
</a>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Documents List -->
|
||||
<div class="space-y-4">
|
||||
@forelse($documents as $document)
|
||||
<div class="bg-white shadow sm:rounded-lg hover:shadow-md transition">
|
||||
<div class="px-6 py-5">
|
||||
<div class="flex items-start">
|
||||
<div class="flex-shrink-0 text-4xl mr-4">
|
||||
{{ $document->currentVersion?->getFileIcon() ?? '📄' }}
|
||||
</div>
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-start justify-between">
|
||||
<div class="flex-1">
|
||||
<h3 class="text-lg font-medium text-gray-900">
|
||||
<a href="{{ route('documents.public.show', $document->public_uuid) }}" class="hover:text-indigo-600">
|
||||
{{ $document->title }}
|
||||
</a>
|
||||
</h3>
|
||||
@if($document->description)
|
||||
<p class="mt-1 text-sm text-gray-500">{{ $document->description }}</p>
|
||||
@endif
|
||||
<div class="mt-2 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-gray-500">
|
||||
<span class="inline-flex items-center">
|
||||
{{ $document->category->icon }} {{ $document->category->name }}
|
||||
</span>
|
||||
@if($document->document_number)
|
||||
<span class="inline-flex items-center">
|
||||
📋 {{ $document->document_number }}
|
||||
</span>
|
||||
@endif
|
||||
<span class="inline-flex items-center">
|
||||
📅 {{ $document->created_at->format('Y-m-d') }}
|
||||
</span>
|
||||
<span class="inline-flex items-center">
|
||||
🔄 版本 {{ $document->currentVersion?->version_number }}
|
||||
</span>
|
||||
<span class="inline-flex items-center">
|
||||
📏 {{ $document->currentVersion?->getFileSizeHuman() }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-6 flex flex-col space-y-2">
|
||||
<a href="{{ route('documents.public.show', $document->public_uuid) }}"
|
||||
class="inline-flex items-center justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700">
|
||||
檢視
|
||||
</a>
|
||||
<a href="{{ route('documents.public.download', $document->public_uuid) }}"
|
||||
class="inline-flex items-center justify-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
下載
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="bg-white shadow sm:rounded-lg">
|
||||
<div class="px-6 py-12 text-center">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
<h3 class="mt-2 text-sm font-medium text-gray-900">找不到文件</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">目前沒有符合條件的文件</p>
|
||||
@if(request('search') || request('category'))
|
||||
<div class="mt-6">
|
||||
<a href="{{ route('documents.index') }}" class="text-indigo-600 hover:text-indigo-900">
|
||||
瀏覽所有文件
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
@if($documents->hasPages())
|
||||
<div class="bg-white shadow sm:rounded-lg p-6">
|
||||
{{ $documents->links() }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
Reference in New Issue
Block a user