140 lines
9.4 KiB
PHP
140 lines
9.4 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">{{ __('letters.letters') }}</h1>
|
|
<div class="flex gap-2 flex-wrap">
|
|
<a href="{{ route('letters.create', ['type' => 'incoming']) }}"
|
|
class="inline-flex items-center gap-2 px-4 py-2 bg-emerald-600 text-white text-sm font-medium rounded-lg hover:bg-emerald-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>
|
|
{{ __('letters.new_incoming') }}
|
|
</a>
|
|
<a href="{{ route('letters.create', ['type' => 'outgoing']) }}"
|
|
class="inline-flex items-center gap-2 px-4 py-2 bg-sky-600 text-white text-sm font-medium rounded-lg hover:bg-sky-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>
|
|
{{ __('letters.new_outgoing') }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="bg-white rounded-xl border border-gray-200 p-4">
|
|
<form method="GET" action="{{ route('letters.index') }}" class="flex flex-wrap gap-3 items-end">
|
|
<div class="w-52">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('common.search') }}</label>
|
|
<input type="text" name="search" value="{{ request('search') }}"
|
|
placeholder="{{ __('letters.subject') }} / {{ __('letters.reference_number') }}"
|
|
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">{{ __('letters.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($types as $t)
|
|
<option value="{{ $t }}" {{ request('type') === $t ? 'selected' : '' }}>{{ __('letters.type_' . $t) }}</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="status" 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($statuses as $s)
|
|
<option value="{{ $s }}" {{ request('status') === $s ? 'selected' : '' }}>{{ __('letters.status_' . $s) }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="w-44">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('letters.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>
|
|
<div class="w-36">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('letters.from_date') }}</label>
|
|
<x-date-input name="from_date" :value="request('from_date')" />
|
|
</div>
|
|
<div class="w-36">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('letters.to_date') }}</label>
|
|
<x-date-input name="to_date" :value="request('to_date')" />
|
|
</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>
|
|
|
|
<!-- Letters 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">{{ __('letters.type') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('letters.reference_number') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('letters.subject') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('letters.sender') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('letters.recipient') }}</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">{{ __('letters.letter_date') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
@forelse($letters as $letter)
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-5 py-3">
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
|
|
{{ $letter->type === 'incoming' ? 'bg-emerald-50 text-emerald-700' : 'bg-sky-50 text-sky-700' }}">
|
|
{{ __('letters.type_' . $letter->type) }}
|
|
</span>
|
|
</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600 font-mono">{{ $letter->reference_number ?? '-' }}</td>
|
|
<td class="px-5 py-3 text-sm font-medium text-gray-900 max-w-xs truncate">{{ $letter->subject }}</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600 max-w-[120px] truncate">{{ $letter->sender }}</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600 max-w-[120px] truncate">{{ $letter->recipient }}</td>
|
|
<td class="px-5 py-3">
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
|
|
{{ $letter->status === 'draft' ? 'bg-gray-100 text-gray-600' :
|
|
($letter->status === 'sent' ? 'bg-sky-50 text-sky-700' :
|
|
($letter->status === 'received' ? 'bg-emerald-50 text-emerald-700' :
|
|
'bg-amber-50 text-amber-700')) }}">
|
|
{{ __('letters.status_' . $letter->status) }}
|
|
</span>
|
|
</td>
|
|
<td class="px-5 py-3 text-sm text-gray-400">{{ $letter->letter_date ? calendar_date($letter->letter_date) : '-' }}</td>
|
|
<td class="px-5 py-3">
|
|
<div class="flex items-center gap-1">
|
|
@if($letter->attachments->count() > 0)
|
|
<span class="p-1 text-gray-400" title="{{ $letter->attachments->count() }} پیوست">
|
|
<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="M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"/></svg>
|
|
</span>
|
|
@endif
|
|
<a href="{{ route('letters.show', $letter) }}" class="p-1.5 text-gray-400 hover:text-teal-600 hover:bg-teal-50 rounded-lg transition-colors" title="{{ __('letters.view_letter') }}">
|
|
<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="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="8" class="text-center py-12 text-gray-500">{{ __('letters.no_letters') }}</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<div class="flex justify-center">
|
|
{{ $letters->withQueryString()->links() }}
|
|
</div>
|
|
</div>
|
|
@endsection
|