vernova/resources/views/projects/index.blade.php
2026-07-26 19:58:27 +03:30

96 lines
5.5 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="space-y-6">
<!-- Page Header -->
<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">{{ __('project.projects') }}</h1>
<a href="{{ route('projects.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>
{{ __('project.new') }}
</a>
</div>
<!-- Filters -->
<div class="bg-white rounded-xl border border-gray-200 p-4">
<form method="GET" action="{{ route('projects.index') }}" class="flex flex-wrap gap-3 items-end">
<div class="flex-1 min-w-[200px]">
<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 focus:border-teal-500"
placeholder="{{ __('project.search_placeholder') }}">
</div>
<div class="w-40">
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('project.status') }}</label>
<select name="status" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500 focus:border-teal-500">
<option value="">{{ __('common.all') }}</option>
@foreach(['planning', 'active', 'on_hold', 'completed', 'cancelled'] as $status)
<option value="{{ $status }}" {{ request('status') === $status ? 'selected' : '' }}>{{ __('project.status_' . $status) }}</option>
@endforeach
</select>
</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>
<a href="{{ route('projects.index') }}" class="px-4 py-2 text-gray-500 text-sm hover:text-gray-700">{{ __('common.reset') }}</a>
</form>
</div>
<!-- Project Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@forelse($projects as $project)
<a href="{{ route('projects.show', $project) }}" class="block bg-white rounded-xl border border-gray-200 hover:border-teal-300 hover:shadow-md transition-all">
<div class="p-5">
<div class="flex items-center justify-between mb-3">
<span class="text-xs font-mono text-gray-400">{{ $project->code }}</span>
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
{{ $project->status === 'active' ? 'bg-emerald-50 text-emerald-700' :
($project->status === 'planning' ? 'bg-blue-50 text-blue-700' :
($project->status === 'on_hold' ? 'bg-amber-50 text-amber-700' :
($project->status === 'completed' ? 'bg-gray-50 text-gray-700' : 'bg-red-50 text-red-700'))) }}">
{{ $project->status_label }}
</span>
</div>
<h3 class="text-base font-semibold text-gray-900 mb-2">{{ $project->name }}</h3>
<!-- Progress Bar -->
<div class="mb-3">
<div class="flex items-center justify-between mb-1">
<span class="text-xs text-gray-500">{{ __('project.progress') }}</span>
<span class="text-xs font-medium text-gray-700">{{ $project->progress }}%</span>
</div>
<div class="w-full bg-gray-100 rounded-full h-1.5">
<div class="h-1.5 rounded-full {{ $project->progress >= 75 ? 'bg-emerald-500' : ($project->progress >= 50 ? 'bg-amber-500' : 'bg-teal-500') }}"
style="width: {{ $project->progress }}%"></div>
</div>
</div>
<div class="flex items-center justify-between text-xs text-gray-500">
<span>{{ __('project.budget') }}: {{ format_currency((float)$project->budget) }}</span>
@if($project->manager)
<span>{{ $project->manager->name }}</span>
@endif
</div>
@if($project->start_date)
<div class="mt-2 text-xs text-gray-400">
{{ calendar_date($project->start_date) }} {{ $project->end_date ? calendar_date($project->end_date) : '...' }}
</div>
@endif
</div>
</a>
@empty
<div class="col-span-full text-center py-12">
<svg class="w-12 h-12 mx-auto text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5"/></svg>
<p class="mt-2 text-gray-500">{{ __('project.no_projects') }}</p>
</div>
@endforelse
</div>
<!-- Pagination -->
<div class="flex justify-center">
{{ $projects->withQueryString()->links() }}
</div>
</div>
@endsection