@extends('layouts.app') @section('title', $project->name . ' — 文件庫') @push('styles') @endpush @section('content') @include('projects._nav') @php $allProjectDocs = $project->docs() ->where('type', $docType) ->where('file_type', '!=', 'folder') ->with('author') ->orderBy('updated_at', 'desc') ->get(['id','title','file_type','updated_at','user_id']) ->map(fn($d) => [ 'id' => $d->id, 'title' => $d->title, 'type' => $d->file_type, 'updated' => $d->updated_at ? $d->updated_at->format('Y-m-d') : '', 'url' => route("{$routePrefix}.show", [$project, $d]), 'owner' => $d->author?->name ?? '—', ])->values(); @endphp
{{-- ── Sidebar ──────────────────────────────────────────────────── --}}
{{-- +新增 button (Google Drive style) --}} @can('contributeDoc', $project)
@endcan {{-- My project folder + tree --}} 我的專案資料夾 @php function renderTree($folders, $parentId, $routePrefix, $project, $folderId, $depth = 0) { $kids = $folders->where('parent_id', $parentId)->values(); foreach ($kids as $f) { $active = $folderId == $f->id ? 'active' : ''; $pl = 22 + $depth * 14; echo ' $f->id]) . '"' . ' class="tree-item ' . $active . '"' . ' style="padding-left:' . $pl . 'px"' . ' data-folder-id="' . $f->id . '"' . ' ondragover="sidebarDragOver(event,this)"' . ' ondragleave="sidebarDragLeave(this)"' . ' ondrop="sidebarDrop(event,this)">' . '' . '' . e($f->title) . '' . ''; renderTree($folders, $f->id, $routePrefix, $project, $folderId, $depth + 1); } } renderTree($allFolders, null, $routePrefix, $project, $folderId); @endphp 近期存取 我的最愛
{{-- ── Main ────────────────────────────────────────────────────── --}}
拖拉檔案至此上傳
@if(session('success'))
{{ session('success') }}
@endif
{{-- Section title --}}
@if($currentFolder) 我的專案資料夾 @foreach($breadcrumb as $crumb) @if(!$loop->last) $crumb->id]) }}" style="color:var(--bs-secondary-color);font-size:.95rem;text-decoration:none;">{{ $crumb->title }} @else {{ $crumb->title }} @endif @endforeach @else 我的專案資料夾 @endif
{{-- Filter chips + view toggle --}}
{{-- ── Content ──────────────────────────────────────────────── --}} @if($items->isEmpty())
此資料夾是空的 @can('contributeDoc', $project)
點擊上方按鈕新增文件或資料夾 @endcan
@else @php $folders = $items->where('file_type', 'folder'); $files = $items->where('file_type', '!=', 'folder'); @endphp {{-- ===== GRID VIEW ===== --}}
@if($folders->isNotEmpty())
資料夾
@foreach($folders as $item)
{{ $item->title }}
資料夾
@can('contributeDoc', $project)
@csrf @method('DELETE')
@endcan
@endforeach
@endif @if($files->isNotEmpty())
檔案
@foreach($files as $item) @php $isSheet = $item->file_type === 'spreadsheet'; $isFile = $item->file_type === 'file'; $isPres = $item->file_type === 'presentation'; @endphp
@if($isFile) @elseif($isSheet) @elseif($isPres) @else @endif
{{ $item->title }}
{{ $item->updated_at->format('Y-m-d') }}
@if($isFile) 下載 @else 編輯 @endif @can('contributeDoc', $project)
@csrf @method('DELETE')
@endcan
@endforeach
@endif
{{-- ===== LIST VIEW (Google Drive style) ===== --}} @endif
{{-- #mainContent --}} {{-- Filtered view (favorites / recent) --}}

{{-- Column filter dropdown (shared, positioned fixed) --}}
{{-- New Folder Modal --}} @can('contributeDoc', $project) @endcan @endsection {{-- Upload progress toast --}}
上傳中…
@push('scripts') @endpush