114 lines
6.8 KiB
PHP
114 lines
6.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">
|
|
<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.financials') }}</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.totalPaid') }}</p>
|
|
<p class="text-2xl font-bold text-emerald-600 mt-1">{{ format_currency((float)$totalPaid, $employee->currency?->code) }}</p>
|
|
</div>
|
|
<div class="bg-white rounded-xl border border-gray-200 p-4">
|
|
<p class="text-xs font-medium text-gray-500">{{ __('employee.totalUnpaid') }}</p>
|
|
<p class="text-2xl font-bold text-red-600 mt-1">{{ format_currency((float)$totalUnpaid, $employee->currency?->code) }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="bg-white rounded-xl border border-gray-200 p-4">
|
|
<form method="GET" action="{{ route('employees.financials', $employee) }}" class="flex flex-wrap gap-3 items-end">
|
|
<div class="w-40">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('employee.type') }}</label>
|
|
<select name="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($financialTypes as $ft)
|
|
<option value="{{ $ft }}" {{ request('type') === $ft ? 'selected' : '' }}>{{ __('employee.' . $ft) }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="w-36">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('common.status') }}</label>
|
|
<select name="is_paid" 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>
|
|
<option value="1" {{ request('is_paid') === '1' ? 'selected' : '' }}>{{ __('employee.isPaid') }}</option>
|
|
<option value="0" {{ request('is_paid') === '0' ? 'selected' : '' }}>{{ __('employee.isUnpaid') }}</option>
|
|
</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>
|
|
|
|
<!-- Financials 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.effectiveDate') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('employee.type') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('employee.amount') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('common.status') }}</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($financials as $fin)
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-5 py-3 text-sm text-gray-900">{{ $fin->effective_date ? calendar_date($fin->effective_date) : '-' }}</td>
|
|
<td class="px-5 py-3">
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
|
|
{{ $fin->type === 'salary' ? 'bg-blue-50 text-blue-700' :
|
|
($fin->type === 'bonus' ? 'bg-emerald-50 text-emerald-700' :
|
|
($fin->type === 'deduction' ? 'bg-red-50 text-red-700' :
|
|
($fin->type === 'overtime' ? 'bg-amber-50 text-amber-700' :
|
|
($fin->type === 'advance' ? 'bg-purple-50 text-purple-700' : 'bg-gray-50 text-gray-700')))) }}">
|
|
{{ __('employee.' . $fin->type) }}
|
|
</span>
|
|
</td>
|
|
<td class="px-5 py-3 text-sm font-medium {{ in_array($fin->type, ['deduction', 'advance']) ? 'text-red-600' : 'text-gray-900' }}">
|
|
{{ in_array($fin->type, ['deduction', 'advance']) ? '-' : '+' }}{{ format_currency((float)$fin->amount, $fin->currency?->code) }}
|
|
</td>
|
|
<td class="px-5 py-3">
|
|
@if(isset($fin->is_paid))
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
|
|
{{ $fin->is_paid ? 'bg-emerald-50 text-emerald-700' : 'bg-amber-50 text-amber-700' }}">
|
|
{{ $fin->is_paid ? __('employee.isPaid') : __('employee.isUnpaid') }}
|
|
</span>
|
|
@else
|
|
<span class="text-xs text-gray-400">-</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600 max-w-xs truncate">{{ $fin->description ?? '-' }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="5" class="text-center py-12 text-gray-500">{{ __('employee.noFinancials') }}</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<div class="flex justify-center">
|
|
{{ $financials->withQueryString()->links() }}
|
|
</div>
|
|
</div>
|
|
@endsection
|