@php /** @var \App\Models\AncillaryCost $ancillaryCost */ /** @var array{allowed: bool, reason: string|null} $editDeleteStatus */ /** @var array{allowed: bool, reason?: string|null} $changeStatusValidation */ @endphp

{{ __('Ancillary Cost') }} #{{ formatDocumentNumber($ancillaryCost->number ?? $ancillaryCost->id) }} @if ($ancillaryCost->type) - {{ $ancillaryCost->type->label() }} @endif

{{ __('Issued on :date', ['date' => $ancillaryCost->date ? formatDate($ancillaryCost->date) : __('Unknown')]) }}

{{ $ancillaryCost->type?->label() ?? __('Ancillary Cost') }} {{ $ancillaryCost->status?->label() ?? '—' }}
{{ __('Amount') }} ({{ config('amir.currency') ?? __('Rial') }})
{{ formatNumber((float) ($ancillaryCost->amount ?? 0) - ($ancillaryCost->vat ?? 0)) }}
{{ __('VAT') }} ({{ config('amir.currency') ?? __('Rial') }})
{{ formatNumber((float) ($ancillaryCost->vat ?? 0)) }}
{{ __('Total') }} ({{ config('amir.currency') ?? __('Rial') }})
{{ formatNumber((float) (($ancillaryCost->amount ?? 0))) }}
@can('ancillary-costs.approve') @if (!empty($changeStatusValidation) && ($changeStatusValidation['allowed'] ?? false)) @elseif (!empty($changeStatusValidation) && !($changeStatusValidation['allowed'] ?? true))
{{ __('Status') }}
@endif @endcan
{{ __('Customer Details') }}
@if ($ancillaryCost->customer)

{{ __('Customer') }}

{{ $ancillaryCost->customer->name }}

{{ __('Phone') }}

{{ $ancillaryCost->customer->phone ? convertToFarsi($ancillaryCost->customer->phone) : '—' }}

{{ __('Economic code') }}

{{ $ancillaryCost->customer->ecnmcs_code ? convertToFarsi($ancillaryCost->customer->ecnmcs_code) : '—' }}

{{ __('Postal code') }}

{{ $ancillaryCost->customer->postal_code ? convertToFarsi($ancillaryCost->customer->postal_code) : '—' }}

{{ __('Address') }}

{{ $ancillaryCost->customer->address ?: '—' }}

@else
{{ __('No customer is attached to this ancillary cost.') }}
@endif
{{ __('Document') }}
@if ($ancillaryCost->document_id)
{{ __('Doc Number') }}: @can('documents.show') {{ formatDocumentNumber($ancillaryCost->document?->number ?? $ancillaryCost->document_id) }} @else {{ formatDocumentNumber($ancillaryCost->document?->number ?? $ancillaryCost->document_id) }} @endcan
@else
{{ __('No document is attached to this ancillary cost.') }}
@endif
{{ __('Items') }}
@if ($ancillaryCost->items->isNotEmpty())
@foreach ($ancillaryCost->items as $index => $item) @endforeach
# {{ __('Product') }} {{ __('Amount') }}
{{ convertToFarsi($index + 1) }} @if ($item->product) {{ $item->product->name }} @else {{ __('Removed product') }} @endif {{ formatNumber((float) ($item->amount ?? 0)) }}
@else
{{ __('There are no items on this ancillary cost yet.') }}
@endif
{{ __('Back') }}
@if (!empty($editDeleteStatus) && ($editDeleteStatus['allowed'] ?? false) && !$ancillaryCost->status?->isApproved()) @can('ancillary-costs.edit') {{ __('Edit') }} @endcan @endif