@extends('admin.layouts.app') @section('title', get_setting('site_name').' | '.__('Asset detail')) @include('admin.asset.partials.page_styles') @section('content')
{{ __('Back') }}

{{ $item->name }}

{{ $item->typeLabel() }} {{ $item->statusLabel() }}
@php $holder = $item->resolveHolder(); $isDisposed = (int) $item->status === \App\Support\Asset\AssetStatus::DISPOSED; @endphp @can('Asset-edit')
@php $canMarkAvailable = ! $isDisposed && ! $item->hasActiveAssignment() && in_array((int) $item->status, [ \App\Support\Asset\AssetStatus::DAMAGED, \App\Support\Asset\AssetStatus::UNDER_MAINTENANCE, \App\Support\Asset\AssetStatus::REPAIRING, ], true); $canSell = ! $isDisposed && ! $item->hasActiveAssignment() && ! $item->staff_id; @endphp @if($canMarkAvailable)
@csrf
@endif @if($canSell) {{ __('Sell') }} @endif @if(\App\Support\Asset\AssetType::usesBulkQuantity($item->asset_type ?? '') && ($item->tracking_mode ?? '') === 'bulk_quantity' && ! $isDisposed) @endif @if(! $isDisposed) @endif
@endcan
@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{ __('Category') }}
{{ $item->asset_category?->parentCategory?->name ?? $item->asset_category?->name ?? '—' }}
{{ __('Sub-type') }}
{{ $item->asset_category?->parentCategory ? $item->asset_category?->name : '—' }}
{{ __('Serial / code') }}
{{ $item->identity ?: $item->code ?: '—' }}
{{ __('Branch') }}
{{ $item->branch?->name ?? '—' }}
{{ __('Location') }}
{{ $item->location ? $item->location->building_name.' / '.$item->location->floor.' / '.$item->location->room_number_or_name : '—' }}
{{ __('Current holder') }}
@if($holder) {{ $holder->user?->name ?? '—' }} @if($holder->user?->id)
ID: {{ $holder->user->id }}
@endif @if($item->activeAssignment && ! $item->staff_id)
{{ __('From active assignment') }}
@endif @else — @endif
{{ __('Qty / tracking') }}
{{ $item->formattedQty() }} · {{ $item->tracking_mode ?? 'individual' }}
{{ __('Price') }}
{{ number_format((float)$item->price, 2) }}
{{ __('Book value') }}
{{ number_format($item->currentBookValue(), 2) }}
{{ __('Accumulated depreciation') }}
{{ number_format((float)($item->accumulated_depreciation ?? 0), 2) }}
@if($item->depreciation_method)
{{ __('Depreciation method') }}
{{ \App\Support\Asset\DepreciationMethod::label($item->depreciation_method) }}
@endif @if($item->latestSale)

{{ __('Latest sale') }}: {{ $item->latestSale->sale_date?->format('Y-m-d') }} · {{ __('Proceeds') }} {{ number_format((float)$item->latestSale->sale_price, 2) }} · {{ __('Gain/loss') }} {{ number_format((float)$item->latestSale->gain_loss, 2) }}
@endif @if($item->asset_type === \App\Support\Asset\AssetType::DIGITAL)

{{ __('License') }}: {{ $item->license_holder_email ?? '—' }} · {{ __('Expires') }} {{ $item->license_expires_at?->format('d/m/Y') ?? '—' }}
@endif @if($item->asset_type === \App\Support\Asset\AssetType::FLEET)

{{ __('Registration') }}: {{ $item->registration_number ?? '—' }} · {{ __('Insurance') }} {{ $item->insurance_expires_at?->format('d/m/Y') ?? '—' }}
@endif @if($item->description)
{{ __('Description') }}
{{ $item->description }}
@endif
{{ __('Method') }}
{{ $item->depreciation_method ? \App\Support\Asset\DepreciationMethod::label($item->depreciation_method) : __('None') }}
{{ __('Useful life (months)') }}
{{ $item->useful_life_months ?: '—' }}
{{ __('Rate %') }}
{{ $item->depreciation_rate !== null ? number_format((float)$item->depreciation_rate, 2) : '—' }}
{{ __('Salvage') }}
{{ number_format((float)($item->salvage_value ?? 0), 2) }}
{{ __('Start date') }}
{{ ($item->depreciation_start_date ?? $item->purchase_date)?->format('Y-m-d') ?? '—' }}
{{ __('Last depreciated') }}
{{ $item->last_depreciated_at?->format('Y-m-d') ?? '—' }}
{{ __('Accumulated') }}
{{ number_format((float)($item->accumulated_depreciation ?? 0), 2) }}
{{ __('Book value') }}
{{ number_format($item->currentBookValue(), 2) }}
@forelse($item->depreciationEntries as $entry) @empty @endforelse
{{ __('Period') }}{{ __('Method') }}{{ __('Opening') }}{{ __('Amount') }}{{ __('Closing') }}{{ __('Posted by') }}
{{ $entry->periodLabel() }} {{ $entry->methodLabel() }} {{ number_format((float)$entry->opening_book_value, 2) }} {{ number_format((float)$entry->depreciation_amount, 2) }} {{ number_format((float)$entry->closing_book_value, 2) }} {{ $entry->poster?->name ?? '—' }}
{{ __('No depreciation posted yet.') }}
@forelse($item->sales as $sale) @empty @endforelse
{{ __('Date') }}{{ __('Buyer') }}{{ __('Qty') }}{{ __('Sale price') }}{{ __('Book value') }}{{ __('Gain / loss') }}
{{ $sale->sale_date?->format('Y-m-d') }} {{ $sale->buyer_name }} {{ number_format((float)$sale->qty, 2) }} {{ number_format((float)$sale->sale_price, 2) }} {{ number_format((float)$sale->book_value_at_sale, 2) }} {{ number_format((float)$sale->gain_loss, 2) }} {{ __('View') }}
{{ __('No sales for this asset.') }}
@include('admin.asset.partials.assign_history_table', ['historys' => $item->assignmentHistories])
@csrf

{{ __('When maintenance is completed and the asset is not assigned, status becomes Available automatically.') }}

@forelse($item->maintenanceHistories as $m) @empty @endforelse
{{ __('Type') }}{{ __('Scheduled') }}{{ __('Completed') }}{{ __('Status') }}{{ __('Vendor') }}{{ __('Cost') }}{{ __('Action') }}
{{ ucfirst($m->type) }} {{ $m->scheduled_at?->format('d/m/Y') ?? '—' }} {{ $m->completed_at?->format('d/m/Y') ?? '—' }} {{ str_replace('_', ' ', $m->status) }} {{ $m->vendor ?? '—' }} {{ $m->cost ? number_format((float)$m->cost,2) : '—' }} @can('Asset-edit') @if($m->status !== 'completed' && $m->status !== 'cancelled')
@csrf
@else @endif @endcan
{{ __('No maintenance records.') }}
@csrf
@forelse($item->components as $c)@empty@endforelse
{{ __('Name') }}{{ __('Serial') }}{{ __('Spec') }}{{ __('Installed') }}{{ __('Status') }}
{{ $c->name }}{{ $c->serial_number ?? '—' }}{{ $c->specification ?? '—' }}{{ $c->installed_at?->format('d/m/Y') ?? '—' }}{{ $c->status }}
{{ __('No components.') }}
@forelse($item->inventoryLogs as $log)@empty@endforelse
{{ __('Type') }}{{ __('Qty') }}{{ __('Staff') }}{{ __('Note') }}{{ __('Date') }}
{{ strtoupper($log->type) }}{{ $log->quantity }} {{ $item->qtyUnitLabel() }}{{ $log->staff?->user?->name ?? '—' }}{{ $log->note ?? '—' }}{{ $log->created_at?->format('d/m/Y H:i') }}
{{ __('No inventory movements.') }}
@endsection @section('modal') @include('admin.asset.partials.receive_stock_modal') @endsection @section('script') @include('admin.asset.partials.scripts') @endsection