@php $eurRaw = old('eur_units_per_usd', $currencyEur?->units_per_usd ?? config('site.default_currency_rates.EUR', '0.9')); $irrRaw = old('irr_units_per_usd', $currencyIrr?->units_per_usd ?? config('site.default_currency_rates.IRR', '2000000')); $eurVal = rtrim(rtrim(number_format((float) $eurRaw, 4, '.', ''), '0'), '.') ?: '0'; $irrVal = number_format((float) $irrRaw, 0, '.', ''); $tomVal = number_format((float) $irrRaw / 10, 0, '.', ''); $preview = $currencyRatePreview ?? null; $effective = $preview['effective'] ?? ($currencyRates ?? []); $history = $preview['history'] ?? ['EUR' => collect(), 'IRR' => collect()]; $today = $preview['today'] ?? now()->toDateString(); $yesterday = $preview['yesterday'] ?? now()->subDay()->toDateString(); @endphp @feature('repair_products')

{{ __('admin.currency_rates.title') }}

{{ __('admin.currency_rates.subtitle') }}

{{ __('admin.currency_rates.avg_hint') }}

@csrf @method('PUT')
@error('eur_units_per_usd')

{{ $message }}

@enderror
@error('irr_units_per_usd')

{{ $message }}

@enderror

{{ __('admin.currency_rates.tom_derived') }}

{{ __('admin.currency_rates.save') }}

{{ __('admin.currency_rates.effective_title') }}

{{ __('admin.currency_rates.effective_hint') }}

EUR
{{ rtrim(rtrim(number_format((float) ($effective['EUR'] ?? $eurRaw), 4, '.', ''), '0'), '.') ?: '0' }}
IRR
{{ number_format((float) ($effective['IRR'] ?? $irrRaw), 0, '.', ',') }}
TOM
{{ number_format((float) ($effective['TOM'] ?? ($irrRaw / 10)), 0, '.', ',') }}
@foreach (['EUR', 'IRR'] as $code)

{{ $code }}

{{ __('admin.currency_rates.today') }} ({{ $today }})

{{ data_get($history, "{$code}.{$today}.units_per_usd", '—') }}

{{ __('admin.currency_rates.yesterday') }} ({{ $yesterday }})

{{ data_get($history, "{$code}.{$yesterday}.units_per_usd", '—') }}

@endforeach
@endfeature