100 lines
6.8 KiB
PHP
100 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">
|
|
<h1 class="text-2xl font-bold text-gray-900">{{ __('inventory.warehouses') }}</h1>
|
|
<a href="{{ route('inventory.warehouses.create') }}"
|
|
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>
|
|
{{ __('inventory.create_warehouse') ?? 'افزودن انبار' }}
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="bg-white rounded-xl border border-gray-200 p-4">
|
|
<form method="GET" action="{{ route('inventory.warehouses') }}" class="flex flex-wrap gap-3 items-end">
|
|
<div class="w-52">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('inventory.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-32">
|
|
<label class="block text-xs font-medium text-gray-500 mb-1">{{ __('common.status') }}</label>
|
|
<select name="is_active" 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_active') === '1' ? 'selected' : '' }}>{{ __('inventory.active') }}</option>
|
|
<option value="0" {{ request('is_active') === '0' ? 'selected' : '' }}>{{ __('inventory.inactive') }}</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>
|
|
|
|
<!-- Warehouses 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">{{ __('inventory.warehouse_name') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('inventory.location') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('inventory.project') }}</th>
|
|
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500">{{ __('inventory.items_count') ?? 'تعداد اقلام' }}</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"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
@forelse($warehouses as $warehouse)
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-5 py-3 text-sm font-medium text-gray-900">{{ $warehouse->name }}</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600">{{ $warehouse->location ?? '-' }}</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600">{{ $warehouse->project?->name ?? '-' }}</td>
|
|
<td class="px-5 py-3 text-sm text-gray-600">{{ persian_num($warehouse->inventoryTransactions()->distinct('item_id')->count('item_id')) }}</td>
|
|
<td class="px-5 py-3">
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
|
|
{{ $warehouse->is_active ? 'bg-emerald-50 text-emerald-700' : 'bg-gray-100 text-gray-500' }}">
|
|
{{ $warehouse->is_active ? __('inventory.active') : __('inventory.inactive') }}
|
|
</span>
|
|
</td>
|
|
<td class="px-5 py-3">
|
|
<div class="flex items-center gap-1">
|
|
<a href="{{ route('inventory.warehouses.edit', $warehouse) }}" class="p-1.5 text-gray-400 hover:text-sky-600 hover:bg-sky-50 rounded-lg transition-colors" title="{{ __('inventory.edit_warehouse') }}">
|
|
<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="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/></svg>
|
|
</a>
|
|
@if($warehouse->inventoryTransactions()->count() === 0)
|
|
<form method="POST" action="{{ route('inventory.warehouses.destroy', $warehouse) }}" onsubmit="return confirm('{{ __('common.confirm_delete') ?? 'آیا مطمئن هستید؟' }}')">
|
|
@csrf @method('DELETE')
|
|
<button type="submit" class="p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors" title="{{ __('common.delete') }}">
|
|
<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="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
|
</button>
|
|
</form>
|
|
@endif
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="text-center py-12 text-gray-500">{{ __('inventory.no_warehouses') }}</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<div class="flex justify-center">
|
|
{{ $warehouses->withQueryString()->links() }}
|
|
</div>
|
|
</div>
|
|
@endsection
|