92 lines
6.0 KiB
PHP
92 lines
6.0 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="space-y-6">
|
|
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
|
|
<h1 class="text-2xl font-bold text-gray-900">{{ __('document.documents') }}</h1>
|
|
<a href="{{ route('documents.create') }}" class="inline-flex items-center gap-2 px-4 py-2 bg-teal-600 text-white text-sm font-medium rounded-lg hover:bg-teal-700 transition-colors">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
|
{{ __('document.upload_document') }}
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="bg-white rounded-xl border border-gray-200 p-4">
|
|
<form method="GET" action="{{ route('documents.index') }}" class="flex flex-wrap gap-3 items-end">
|
|
<div class="w-44">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('document.project') }}</label>
|
|
<select name="project_id" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
|
|
<option value="">{{ __('common.all') }}</option>
|
|
@foreach($projects as $project)
|
|
<option value="{{ $project->id }}" {{ request('project_id') == $project->id ? 'selected' : '' }}>{{ $project->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="w-40">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('document.file_type') }}</label>
|
|
<select name="file_type" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
|
|
<option value="">{{ __('common.all') }}</option>
|
|
@foreach($fileTypes as $type)
|
|
<option value="{{ $type }}" {{ request('file_type') === $type ? 'selected' : '' }}>{{ __('document.type_' . $type) }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="w-48">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('common.search') }}</label>
|
|
<input type="text" name="search" value="{{ request('search') }}" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
|
|
</div>
|
|
<button type="submit" class="px-4 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-lg hover:bg-gray-200 transition-colors">{{ __('common.filter') }}</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Documents List -->
|
|
<div class="bg-white rounded-xl border border-gray-200 overflow-hidden">
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full">
|
|
<thead class="bg-gray-50 border-b border-gray-200">
|
|
<tr>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('document.title') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('document.file_type') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('document.project') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('document.uploaded_by') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('common.actions') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
@forelse($documents as $document)
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-5 py-3">
|
|
<a href="{{ route('documents.show', $document) }}" class="text-sm font-medium text-gray-900 hover:text-teal-600">{{ $document->title }}</a>
|
|
</td>
|
|
<td class="px-5 py-3">
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-50 text-gray-700">{{ __('document.type_' . $document->file_type) }}</span>
|
|
</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600">{{ $document->project?->name ?? '-' }}</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600">{{ $document->uploader?->name ?? '-' }}</td>
|
|
<td class="px-5 py-3">
|
|
<div class="flex items-center gap-1">
|
|
<a href="{{ route('documents.download', $document) }}" class="px-2 py-1 text-xs font-medium text-teal-700 bg-teal-50 rounded hover:bg-teal-100 transition-colors">{{ __('document.download') }}</a>
|
|
<a href="{{ route('documents.edit', $document) }}" class="px-2 py-1 text-xs font-medium text-blue-700 bg-blue-50 rounded hover:bg-blue-100 transition-colors">{{ __('common.edit') }}</a>
|
|
<form method="POST" action="{{ route('documents.destroy', $document) }}" class="inline" onsubmit="return confirm('{{ __('common.confirm_delete') }}')">
|
|
@csrf @method('DELETE')
|
|
<button type="submit" class="px-2 py-1 text-xs font-medium text-red-700 bg-red-50 rounded hover:bg-red-100 transition-colors">{{ __('common.delete') }}</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="5" class="text-center py-12 text-gray-500">{{ __('document.no_documents') }}</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-center">
|
|
{{ $documents->withQueryString()->links() }}
|
|
</div>
|
|
</div>
|
|
@endsection
|