@switch($activity->description)
@case('employee status changed')
@if($status = $activity->getExtraProperty('status'))
{{ $status == 1 ? 'принял в работу' : 'решил' }}
@endif
@break
@case('agents assigned')
@if($ids = $activity->getExtraProperty('agents'))
@foreach($ids as $id)
{{ $users->firstWhere('id', $id)->name }}
@endforeach
@endif
@break
@case('agents changed')
@if($props = $activity->getExtraProperty('sync'))
@foreach($props as $key => $ids)
@if(!empty($ids))
@lang($key)
@foreach($ids as $id)
{{ $users->firstWhere('id', $id)->name }}
@endforeach
@endif
@endforeach
@endif
@break
@case('groups assigned')
@if($ids = $activity->getExtraProperty('groups'))
@foreach($ids as $id)
{{ $groups->firstWhere('id', $id)->name }}
@endforeach
@endif
@break
@case('groups changed')
@if($props = $activity->getExtraProperty('sync'))
@foreach($props as $key => $ids)
@if(!empty($ids))
@lang($key)
@foreach($ids as $id)
{{ $groups->firstWhere('id', $id)->name }}
@endforeach
@endif
@endforeach
@endif
@break
@case('updated')
@if(isset($activity->changes['old']) && count($activity->changes['old']))
@foreach($activity->changes['old'] as $field => $value)
@php
$oldValue = $value;
$newValue = $activity->changes['attributes'][$field];
switch ($field) {
case 'ktc_responsibility':
case 'in_note':
case 'checked_cus':
$oldValue = $oldValue ? 'есть галочка':'нет галочки'; $newValue = $newValue ? 'есть галочка':'нет галочки'; break;
case 'client_id': $oldValue = $oldValue ? \App\Models\Client::find($oldValue)->name : ''; $newValue = $newValue ? \App\Models\Client::find($newValue)->name : ''; break;
case 'requester_id': $oldValue = $oldValue ? $users->firstWhere('id', $oldValue)->name : ''; $newValue = $newValue ? $users->firstWhere('id', $newValue)->name : ''; break;
case 'status_id': $oldValue = $statuses->firstWhere('id', $oldValue)->name; $newValue = $statuses->firstWhere('id', $newValue)->name; break;
case 'priority_id': $oldValue = __($priorities->firstWhere('id', $oldValue)->name); $newValue = __($priorities->firstWhere('id', $newValue)->name); break;
case 'urgency': $oldValue = $oldValue ? \App\Ticket::urgency($oldValue) : ''; $newValue = $newValue ? \App\Ticket::urgency($newValue) : ''; break;
case 'influence': $oldValue = $oldValue ? \App\Ticket::influence($oldValue) : ''; $newValue = $newValue ? \App\Ticket::influence($newValue) : ''; break;
case 'ticket_type': $oldValue = $oldValue ? $ticket_types->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $ticket_types->firstWhere('id', $newValue)['label'] : ''; break;
case 'damage_type': $oldValue = $oldValue ? $damage_types->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $damage_types->firstWhere('id', $newValue)['label'] : ''; break;
case 'network_type': $oldValue = $oldValue ? $network_types->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $network_types->firstWhere('id', $newValue)['label'] : ''; break;
case 'source': $oldValue = $oldValue ? $sources->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $sources->firstWhere('id', $newValue)['label'] : ''; break;
case 'filial': $oldValue = $oldValue ? $filials->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $filials->firstWhere('id', $newValue)['label'] : ''; break;
case 'network_type_ssop': $oldValue = $oldValue ? $network_types_ssop->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $network_types_ssop->firstWhere('id', $newValue)['label'] : ''; break;
case 'service': $oldValue = $oldValue ? $services->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $services->firstWhere('id', $newValue)['label'] : ''; break;
case 'confirmation_document': $oldValue = $oldValue ? $confirmation_documents->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $confirmation_documents->firstWhere('id', $newValue)['label'] : ''; break;
case 'cause': $oldValue = $oldValue ? $causes->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $causes->firstWhere('id', $newValue)['label'] : ''; break;
case 'support_level': $oldValue = $oldValue ? $support_levels->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $support_levels->firstWhere('id', $newValue)['label'] : ''; break;
case 'closing_code': $oldValue = $oldValue ? $closing_codes->firstWhere('id', $oldValue)['label'] : ''; $newValue = $newValue ? $closing_codes->firstWhere('id', $newValue)['label'] : ''; break;
}
@endphp
{{ __($field) }}
@switch($field)
@case('description')
@case('damage_character')
@case('what_is_done')
{!! nl2br(htmlspecialchars($oldValue)) !!}
{!! nl2br(htmlspecialchars($newValue)) !!}
@break
@default
{{ $oldValue }}
{{ $newValue }}
@break
@endswitch
@endforeach
@endif
@break
@endswitch