@extends('layouts.dashboard') @section('title', 'User Details') @section('page-title', 'User Details: ' . $user->name) @section('content') @php $canViewCalls = auth()->guard('admin')->user()->hasPermission('logs.call.view'); $canViewSms = auth()->guard('admin')->user()->hasPermission('logs.sms.view'); $canViewPromos = auth()->guard('admin')->user()->hasPermission('logs.promotion.view'); $hasLogsPermission = $canViewCalls || $canViewSms; $canViewWhatsApp = $canViewSms; // WhatsApp visibility follows SMS permission $visibleStatsCount = ($canViewCalls ? 1 : 0) + ($canViewSms ? 1 : 0) + ($canViewWhatsApp ? 1 : 0) + ($canViewPromos ? 1 : 0); $colSize = $visibleStatsCount > 0 ? max(3, floor(12 / $visibleStatsCount)) : 12; $settings = $user->settings; @endphp
| ID | {{ $user->id }} |
|---|---|
| Name | {{ $user->name }} |
| {{ $user->email }} | |
| Phone | {{ $user->phone }} |
| SMS Service | @if($user->sms_service_enabled) Enabled @else Disabled @endif |
| @if($settings && $settings->whatsapp_enabled) Enabled @else Disabled @endif | |
| Channel | @php $channel = $settings->preferred_channel ?? 'sms'; $channelLabel = match($channel) { 'whatsapp' => 'WhatsApp Only', 'both' => 'Both (SMS + WA)', default => 'SMS Only', }; $channelBadge = match($channel) { 'whatsapp' => 'bg-success', 'both' => 'bg-info', default => 'bg-primary', }; @endphp {{ $channelLabel }} |
| Promotions | @if($user->promotions_enabled) Enabled @else Disabled @endif |
| Last Active | {{ $user->last_active_at?->diffForHumans() ?? 'Never' }} |
| Registered | {{ $user->created_at->format('M d, Y H:i') }} |
| Phone Number | Type | SMS Sent | Time |
|---|---|---|---|
| {{ $call->phone_number }} | {{ ucfirst($call->call_type) }} | @if($call->sms_sent) Yes @else No @endif | {{ $call->call_time->format('M d, Y H:i') }} |
| No call logs | |||
| Phone Number | Channel | Message | Status | Sent At |
|---|---|---|---|---|
| {{ $sms->phone_number }} | @if(($sms->channel ?? 'sms') === 'whatsapp') WhatsApp @else SMS @endif | {{ Str::limit($sms->message, 40) }} | {{ ucfirst($sms->status) }} | {{ $sms->sent_at?->format('M d, Y H:i') ?? '-' }} |
| No SMS / WhatsApp logs | ||||
| Phone Number | Message | Trigger | Status | Sent At |
|---|---|---|---|---|
| {{ $promo->phone_number }} | {{ Str::limit($promo->message, 40) }} | {{ ucfirst($promo->trigger_type) }} | {{ ucfirst($promo->status) }} | {{ $promo->sent_at?->format('M d, Y H:i') ?? '-' }} |
| No promotion logs | ||||