@props([ 'sender' => [], 'currentSender' => null, 'isBo' => false, ]) @php $name = data_get($sender, 'sender'); $status = data_get($sender, 'status'); $createdAt = data_get($sender, 'created_at'); $updatedAt = data_get($sender, 'last_updated'); $companyId = data_get($sender, 'company_id'); $companyName = data_get($sender, 'company_name'); $isOwnCompany = $companyId === Auth::user()->company_id; $statusKey = \Illuminate\Support\Str::of($status ?? 'unknown')->lower()->value(); $isActive = $name === $currentSender; if (in_array($statusKey, ['active', 'approved', 'validé'])) { $statusColor = 'success'; $statusIcon = 'check-circle'; } elseif (in_array($statusKey, ['pending', 'en attente'])) { $statusColor = 'warning'; $statusIcon = 'clock'; } elseif (in_array($statusKey, ['rejected', 'refusé'])) { $statusColor = 'danger'; $statusIcon = 'cross-circle'; } else { $statusColor = 'secondary'; $statusIcon = 'help'; } $statusLabel = $status ? \Illuminate\Support\Str::of($status)->lower()->replace('_', ' ')->title() : __('Unknown status'); $escapedName = addslashes($name ?? ''); // Actions differ based on whether it's own company or not if ($isBo && !$isOwnCompany) { // BO users viewing other companies' senders - can only delete $actions = [ [ 'icon' => 'trash', 'label' => __('Remove sender'), 'click' => "removeSender('{$escapedName}', {$companyId})", 'confirm' => true, 'confirm_message' => __('Are you sure you want to remove this sender from :company?', ['company' => $companyName]), 'title' => __('Remove sender from company'), ], ]; } else { // Own company sender - full actions (both BO and regular users) $actions = [ [ 'icon' => 'check-thick', 'label' => __('Set as Current'), 'click' => "setCurrentSender('{$escapedName}')", 'show' => !$isActive && in_array($statusKey, ['active', 'approved', 'validé']), 'title' => __('Use this sender for outgoing SMS'), ], [ 'divider' => true, 'show' => !$isActive, ], [ 'icon' => 'trash', 'label' => __('Remove sender'), 'click' => "removeSender('{$escapedName}')", 'confirm' => true, 'confirm_message' => __('Are you sure you want to remove this sender?'), 'title' => __('Remove sender from your account'), ], ]; } @endphp

@if($isBo && $companyName) {{ $companyName }} @endif {{ $isActive ? __('Active Sender') : __('Sender identity') }}

{{ $name ?: __('Unknown sender') }}