@php $num = fn ($v): string => rtrim(rtrim(number_format((float) $v, 2), '0'), '.'); @endphp

{{ __('Business development targets') }}

{{ __('Per officer and period, from each Performance Agreement. A target counts once someone other than the officer approves it; after that it is revised, never overwritten.') }}

@if ($canSet) {{ __('Set a target') }} @endif
@forelse ($rows as $row) @php($t = $row['target']) @empty @endforelse
{{ __('Officer') }} {{ __('Measure') }} {{ __('Period') }} {{ __('Target') }} {{ __('In force') }} {{ __('Status') }} {{ __('Actions') }}
{{ $t->user?->name ?? __('Not available') }} {{ __($metrics[$t->metric] ?? $t->metric) }} @if (in_array($t->metric, $notMeasured, true)) {{ __('Actual not measured yet') }} @endif {{ __($periods[$t->period] ?? ucfirst($t->period)) }} {{ $num($t->value) }}{{ $t->metric === 'crm_record_completeness' ? '%' : '' }} @if ($t->revision > 1) {{ __('Revision :n', ['n' => $t->revision]) }} @endif {{ $t->effective_from->format('j M Y') }} {{ __('to') }} {{ $t->effective_to?->format('j M Y') ?? __('open') }} @if ($row['status'] === 'draft') {{ $statuses['draft'] }} @elseif ($row['ended']) {{ __('Ended') }} @else {{ $statuses['approved'] }} @endif @if ($t->approver) {{ __('by :name', ['name' => $t->approver->name]) }} @endif @if ($row['pendingRevision']) {{ __('Revision to :value from :date awaiting approval', ['value' => $num($row['pendingRevision']->value), 'date' => $row['pendingRevision']->effective_from->format('j M Y')]) }} @endif
@php($approvable = $row['status'] === 'draft' ? $t : $row['pendingRevision']) @if ($approvable) @can('approve', $approvable) @endcan @endif @if ($canSet && ! $row['pendingRevision'] && ! $row['ended']) @endif @if ($t->revision > 1 || $row['pendingRevision']) @endif @if ($canSet && $row['status'] === 'draft') @endif @if ($row['pendingRevision'] && $canSet) @endif
@include('livewire.crm.partials.paginator', ['rows' => $rows])
@if ($canSet) @if ($revisingId) {{ __('Revise a target') }} @elseif ($editingId) {{ __('Change a target awaiting approval') }} @else {{ __('Set a business development target') }} @endif @if ($revising)

{{ __('The current target of :value stays in force until this revision is approved. Approving it closes the current one the day before the revision starts.', ['value' => $num($revising->value)]) }}

@endif
{{ __('Cancel') }} {{ $revisingId ? __('Save revision') : __('Save') }} {{ __('Saving…') }}
@endif {{ __('Target history') }}
    @foreach ($history as $version)
  1. {{ __('Revision :n', ['n' => $version->revision]) }}: {{ $num($version->value) }} @if ($version->approved_at) {{ __('Approved :date by :name', ['date' => $version->approved_at->timezone(config('app.display_timezone'))->format('j M Y'), 'name' => $version->approver?->name ?? __('Not available')]) }} @else {{ $statuses['draft'] }} @endif

    {{ __('In force :from to :to. Set by :name.', ['from' => $version->effective_from->format('j M Y'), 'to' => $version->effective_to?->format('j M Y') ?? __('open'), 'name' => $version->creator?->name ?? __('Not available')]) }}

    @if ($version->revision_note)

    {{ $version->revision_note }}

    @endif
  2. @endforeach
{{ __('Close') }}