Files

31 lines
1.3 KiB
PHP

<div class="flex items-end ml-auto">
@php
$activeProfile = getActiveProfile();
$isOwnCall = $callable && $activeProfile &&
get_class($activeProfile) === get_class($callable) &&
$activeProfile->id === $callable->id;
$isDeleted = $call->trashed();
$isExpired = $call->till !== null && $call->till->isPast();
$isSuppressed = $call->is_suppressed;
$isPaused = $call->is_paused;
$callableRemoved = $callable?->isRemoved();
$unavailableReason = match(true) {
$isDeleted => __('This call has been deleted.'),
$isSuppressed => __('This call has been blocked.'),
$isPaused => __('This call is currently paused.'),
$isExpired => __('This call has expired.'),
$callableRemoved => __('This user is no longer available.'),
default => null,
};
@endphp
@if ($isOwnCall)
@livewire('calls.edit', ['call' => $call], key('edit-call-' . $call->id))
@elseif ($unavailableReason)
<p class="text-sm text-white/70 italic max-w-48 text-right">{{ $unavailableReason }}</p>
@else
<x-jetstream.button wire:click="createConversation">
{{ __('Respond') }}
</x-jetstream.button>
@endif
</div>