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

98 lines
5.6 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">
<div class="flex items-center gap-4">
<a href="{{ route('employees.show', $employee) }}" class="p-2 text-gray-500 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/></svg>
</a>
<div>
<h1 class="text-2xl font-bold text-gray-900">{{ __('employee.workLogs') }}</h1>
<p class="text-sm text-gray-500">{{ $employee->first_name }} {{ $employee->last_name }}</p>
</div>
</div>
</div>
<!-- Summary Cards -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div class="bg-white rounded-xl border border-gray-200 p-4">
<p class="text-xs font-medium text-gray-500">{{ __('employee.totalHours') }}</p>
<p class="text-2xl font-bold text-gray-900 mt-1">{{ persian_num(number_format($totalHours, 1)) }}</p>
</div>
<div class="bg-white rounded-xl border border-gray-200 p-4">
<p class="text-xs font-medium text-gray-500">{{ __('employee.overtimeHours') }}</p>
<p class="text-2xl font-bold text-amber-600 mt-1">{{ persian_num(number_format($overtimeHours, 1)) }}</p>
</div>
</div>
<!-- Filters -->
<div class="bg-white rounded-xl border border-gray-200 p-4">
<form method="GET" action="{{ route('employees.work-logs', $employee) }}" class="flex flex-wrap gap-3 items-end">
<div class="w-36">
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('common.from') }}</label>
<x-date-input name="from_date" :value="request('from_date')" />
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
</div>
<div class="w-36">
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('common.to') }}</label>
<x-date-input name="to_date" :value="request('to_date')" />
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
</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">
<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>
<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>
<!-- Work Logs 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">{{ __('employee.date') }}</th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('employee.project') }}</th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('employee.hoursWorked') }}</th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('employee.overtimeHours') }}</th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('employee.description') }}</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($workLogs as $log)
<tr class="hover:bg-gray-50 transition-colors">
<td class="px-5 py-3 text-sm text-gray-900">{{ calendar_date($log->date) }}</td>
<td class="px-5 py-3 text-sm text-gray-600">{{ $log->project?->name ?? '-' }}</td>
<td class="px-5 py-3 text-sm font-medium text-gray-900">{{ persian_num(number_format($log->hours_worked, 1)) }}</td>
<td class="px-5 py-3 text-sm font-medium {{ $log->overtime_hours > 0 ? 'text-amber-600' : 'text-gray-400' }}">
{{ $log->overtime_hours > 0 ? persian_num(number_format($log->overtime_hours, 1)) : '-' }}
</td>
<td class="px-5 py-3 text-sm text-gray-600 max-w-xs truncate">{{ $log->description ?? '-' }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="text-center py-12 text-gray-500">{{ __('employee.noWorkLogs') }}</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<!-- Pagination -->
<div class="flex justify-center">
{{ $workLogs->withQueryString()->links() }}
</div>
</div>
@endsection