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

79 lines
4.8 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">{{ __('employee.employees') }}</h1>
<a href="{{ route('employees.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>
{{ __('employee.new') }}
</a>
</div>
<!-- Filters -->
<div class="bg-white rounded-xl border border-gray-200 p-4">
<form method="GET" action="{{ route('employees.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="{{ __('employee.search_placeholder') }}">
</div>
<div class="w-44">
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('employee.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 focus:border-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-36">
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('employee.contract_type') }}</label>
<select name="contract_type" 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($contractTypes as $type)
<option value="{{ $type }}" {{ request('contract_type') === $type ? 'selected' : '' }}>{{ __('employee.contract_' . $type) }}</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>
</form>
</div>
<!-- Employee Cards -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
@forelse($employees as $employee)
<a href="{{ route('employees.show', $employee) }}" class="block bg-white rounded-xl border border-gray-200 hover:border-teal-300 hover:shadow-md transition-all p-5 text-center">
<div class="w-14 h-14 mx-auto bg-teal-50 text-teal-700 rounded-full flex items-center justify-center text-xl font-semibold mb-3">
{{ mb_strtoupper(mb_substr($employee->full_name, 0, 1)) }}
</div>
<h3 class="text-sm font-semibold text-gray-900">{{ $employee->full_name }}</h3>
<p class="text-xs text-gray-500 mt-0.5">{{ $employee->job_title ?? $employee->contract_type_label }}</p>
<div class="mt-3 flex items-center justify-center gap-2">
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium {{ $employee->status === 'active' ? 'bg-emerald-50 text-emerald-700' : 'bg-gray-100 text-gray-600' }}">
{{ $employee->status === 'active' ? __('employee.active') : __('employee.inactive') }}
</span>
</div>
@if($employee->project)
<p class="text-xs text-gray-400 mt-2">{{ $employee->project->name }}</p>
@endif
</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="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1z"/></svg>
<p class="mt-2 text-gray-500">{{ __('employee.no_employees') }}</p>
</div>
@endforelse
</div>
<!-- Pagination -->
<div class="flex justify-center">
{{ $employees->withQueryString()->links() }}
</div>
</div>
@endsection