@extends('layouts.app') @section('title', 'Envanter Detayi') @section('content')
Liste

Envanter Detayi

{{ $asset->name }} ({{ $asset->asset_code }})

@if(!empty($serialFilter ?? ''))

Seri no filtresi: {{ $serialFilter }}

@endif
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @php $totalQty = (int) ($asset->total_quantity_effective ?? ($asset->total_quantity ?? 1)); $assignedQty = (int) ($asset->assigned_quantity ?? 0); $availableQty = (int) ($asset->available_quantity ?? max($totalQty - $assignedQty, 0)); $summaryTotalQty = $totalQty; $summaryAssignedQty = $assignedQty; $summaryAvailableQty = $availableQty; $mergedAssetCount = (int) data_get($groupSummary ?? null, 'merged_asset_count', 1); $assetMeta = json_decode((string) ($asset->metadata_json ?? ''), true); if (!is_array($assetMeta)) { $assetMeta = []; } $assetSerials = array_values(array_filter(array_map(static fn($v) => trim((string) $v), (array) ($assetMeta['serials'] ?? [])), static fn($v) => $v !== '')); $assetPcNames = array_values(array_filter(array_map(static fn($v) => trim((string) $v), (array) ($assetMeta['pc_names'] ?? [])), static fn($v) => $v !== '')); $assetHardwareSpecs = array_values(array_filter(array_map(static fn($v) => trim((string) $v), (array) ($assetMeta['hardware_specs'] ?? [])), static fn($v) => $v !== '')); $assetSerialDetails = []; foreach ((array) ($assetMeta['serial_details'] ?? []) as $row) { if (!is_array($row)) { continue; } $serial = trim((string) ($row['serial_no'] ?? $row['serial'] ?? '')); $pc = trim((string) ($row['pc_name'] ?? $row['pc'] ?? '')); $hw = trim((string) ($row['hardware_spec'] ?? $row['hardware'] ?? '')); if ($serial === '' && $pc === '' && $hw === '') { continue; } $assetSerialDetails[] = ['serial_no' => $serial, 'pc_name' => $pc, 'hardware_spec' => $hw]; } if (empty($assetSerialDetails)) { $maxMetaRows = max(count($assetSerials), count($assetPcNames), count($assetHardwareSpecs)); for ($i = 0; $i < $maxMetaRows; $i++) { $serial = trim((string) ($assetSerials[$i] ?? '')); $pc = trim((string) ($assetPcNames[$i] ?? '')); $hw = trim((string) ($assetHardwareSpecs[$i] ?? '')); if ($serial === '' && $pc === '' && $hw === '') { continue; } $assetSerialDetails[] = ['serial_no' => $serial, 'pc_name' => $pc, 'hardware_spec' => $hw]; } } $assetSerialDetailsText = implode("\n", array_map( static fn(array $row): string => trim((string) ($row['serial_no'] ?? '')) . ' | ' . trim((string) ($row['pc_name'] ?? '')) . ' | ' . trim((string) ($row['hardware_spec'] ?? '')), $assetSerialDetails )); @endphp
Envanter Bilgileri
Kod
{{ trim((string) ($asset->mikro_stok_kod ?? '')) }}
Ad
{{ $asset->name }}
Kategori
{{ $asset->category ?: '-' }}
Marka / Model
{{ trim(($asset->brand ?? '') . ' ' . ($asset->model ?? '')) ?: '-' }}
Seri No
{{ trim((string) ($asset->serial_no ?? '')) !== '' ? $asset->serial_no : '-' }}
Mikro Stok Kodu
{{ trim((string) ($asset->mikro_stok_kod ?? '')) }}
Depo
{{ trim((string) ($asset->depo_no ?? '')) !== '' ? trim((string) ($asset->depo_no ?? '')) : '-' }}
@csrf
@php $assetDepoNo = trim((string) old('depo_no', (string) ($asset->depo_no ?? ''))); @endphp
Stok Ozeti
Toplam: {{ $summaryTotalQty }}
Zimmetli: {{ $summaryAssignedQty }}
Kalan: {{ $summaryAvailableQty }}
@if($mergedAssetCount > 1)
Ayni grupta {{ $mergedAssetCount }} ayri envanter kaydı bulunuyor. Bu alan secili kaydin adetini gosterir.
@endif
@csrf
Yeni Zimmet Atama
@csrf
Mevcut Zimmet Dagilimi
{{ $activeAssignments->count() }} kayıt
@if($activeAssignments->isEmpty())
Bu envanter icin aktif zimmet yok.
@else
@foreach($activeAssignments as $assignment) @php $assignmentAssigneeToken = (string) ($assignment->assignee_token ?? ('user:' . (int) $assignment->user_id)); $serials = (array) ($assignment->serials ?? []); $pcNames = (array) ($assignment->pc_names ?? []); $hardwareSpecs = (array) ($assignment->hardware_specs ?? []); $serialDetails = (array) ($assignment->serial_details ?? []); $serialDetailsText = implode("\n", array_map( static fn($row) => trim((string) ($row['serial_no'] ?? '')) . ' | ' . trim((string) ($row['pc_name'] ?? '')) . ' | ' . trim((string) ($row['hardware_spec'] ?? '')), is_array($serialDetails) ? $serialDetails : [] )); $serialsText = implode("\n", $serials); $pcNamesText = implode("\n", $pcNames); $hardwareSpecsText = implode("\n", $hardwareSpecs); $assignmentEditCollapseId = 'assignmentEditForm_' . (int) ($assignment->id ?? 0); @endphp
{{ $assignment->assignee_label ?? ($assignment->user_name ?: ('Kullanıcı #' . $assignment->user_id)) }}
{{ (int) ($assignment->quantity ?? 1) }} adet zimmetli
@if(!empty($assignment->assigned_at)) {{ \Carbon\Carbon::parse($assignment->assigned_at)->format('d.m.Y H:i') }} @endif
@if(!empty($serials) || !empty($pcNames) || !empty($hardwareSpecs) || !empty($serialDetails))
@if(!empty($serialDetails))
Seri / PC / Donanım:
@foreach($serialDetails as $row)
{{ trim((string) ($row['serial_no'] ?? '')) !== '' ? $row['serial_no'] : '-' }} | {{ trim((string) ($row['pc_name'] ?? '')) !== '' ? $row['pc_name'] : '-' }} | {{ trim((string) ($row['hardware_spec'] ?? '')) !== '' ? $row['hardware_spec'] : '-' }}
@endforeach @elseif(!empty($serials))
Seri No: {{ implode(', ', $serials) }}
PC Adi: {{ implode(', ', $pcNames) }}
Donanım Bilgileri: {{ implode(' | ', $hardwareSpecs) }}
@endif
@endif
@csrf
@csrf
@csrf @php $transferSelectId = 'assetTransferUserSelect_' . (int) ($assignment->id ?? $assignment->user_id); @endphp
@endforeach
@endif
@endsection