@php use App\Library\Tool; @endphp @extends('layouts/contentLayoutMaster') @section('title', __('locale.menu.Dashboard')) @section('vendor-style') @endsection @section('page-style') @endsection @section('content')
{{-- ── Announcements ─────────────────────────────────────────────────── --}} @unless($userAnnouncements->isEmpty())

{{ __('locale.menu.Announcements') }}

{{ __('locale.buttons.close') }}

    @foreach($userAnnouncements as $announcement) @if($announcement->pivot->read_at === null)
  • {{ $announcement->title }}
    {{ $announcement->created_at->diffForHumans() }}

    {!! $announcement->description !!}

  • @endif @endforeach
@endunless {{-- ── Sub-account parent login banner ──────────────────────────────── --}} @php $isAdminImpersonation = session()->has('admin_user_id') && session()->has('temp_user_id'); @endphp @if(Auth::check() && Auth::user()->parent_id !== null && !$isAdminImpersonation)

{{ __('locale.sub_accounts.manage_account') }}

{{ __('locale.buttons.close') }}

@endif {{-- ── Welcome + plan + SMS pie ──────────────────────────────────────── --}}

{{ \App\Helpers\Helper::greetingMessage() }}

{{ __('locale.description.dashboard', ['brandname' => config('app.name')]) }}

@can('sms_quick_send') {{ __('locale.menu.Quick Send') }} @endcan @can('sms_campaign_builder') {{ __('locale.menu.Campaign Builder') }} @endcan @can('sms_bulk_messages') {{ __('locale.menu.Send Using File') }} @endcan @can('view_contact_group') {{ __('locale.contacts.contact_groups') }} @endcan

{{ __('locale.labels.current_plan') }}

@if(isset(Auth::user()->customer) && Auth::user()->customer->activeSubscription() == null)

{{ __('locale.subscription.no_active_subscription') }}

@elseif(isset(Auth::user()->customer))

{!! __('locale.subscription.you_are_currently_subscribed_to_plan', [ 'plan' => auth()->user()->customer->subscription->plan->name, 'price' => Tool::format_price(auth()->user()->customer->subscription->plan->price, auth()->user()->customer->subscription->plan->currency->format), 'remain' => Tool::formatHumanTime(auth()->user()->customer->subscription->current_period_ends_at), 'end_at' => Tool::customerDateTime(auth()->user()->customer->subscription->current_period_ends_at), ]) !!}

@endif
{{ __('locale.labels.more_info') }} @if(isset(Auth::user()->customer) && Auth::user()->customer->activeSubscription()) {{ __('locale.labels.packages') }} @endif
{{-- ── Stat cards row 1 ───────────────────────────────────────────────── --}}
@foreach([ ['value' => $customerDashboardWidgets['campaign_not_done'], 'total' => $customerDashboardWidgets['campaign_total'], 'label' => Str::plural(__('locale.menu.Campaigns')), 'route' => route('customer.reports.campaigns'), 'icon' => 'pie-chart', 'color' => 'bg-light-info', 'iconColor' => 'text-info'], ['value' => $deliveredCount, 'total' => $total_sms_sent, 'label' => __('locale.labels.delivered'), 'route' => route('customer.reports.all'), 'icon' => 'phone-outgoing', 'color' => 'bg-light-success', 'iconColor' => 'text-success'], ['value' => $undeliveredCount, 'total' => $total_sms_sent, 'label' => __('locale.labels.failed'), 'route' => route('customer.reports.all'), 'icon' => 'x-square', 'color' => 'bg-light-danger', 'iconColor' => 'text-danger'], ['value' => $customerDashboardWidgets['sms_templates_count'], 'total' => null, 'label' => Str::plural(__('locale.permission.sms_template')),'route' => route('customer.templates.index'), 'icon' => 'inbox', 'color' => 'bg-light-warning', 'iconColor' => 'text-warning'], ] as $card)

@if($card['total'] !== null) {{ $card['value'] }} / {{ $card['total'] }} @else {{ $card['value'] }} @endif

{{ $card['label'] }}

@endforeach
{{-- ── Stat cards row 2 ───────────────────────────────────────────────── --}} @php $hasActiveSub = isset(Auth::user()->customer) && Auth::user()->customer->activeSubscription() != null; @endphp
@foreach([ ['value' => $hasActiveSub ? Tool::format_number($customerDashboardWidgets['contact_groups_count']) : 0, 'total' => null, 'label' => __('locale.contacts.contact_groups'), 'route' => route('customer.contacts.index'), 'icon' => 'users', 'color' => 'bg-light-primary', 'iconColor' => 'text-primary'], ['value' => $hasActiveSub ? Tool::format_number($customerDashboardWidgets['contacts_count']) : 0, 'total' => null, 'label' => __('locale.menu.Contacts'), 'route' => route('customer.contacts.index'), 'icon' => 'user', 'color' => 'bg-light-success', 'iconColor' => 'text-success'], ['value' => $customerDashboardWidgets['invoice_open'], 'total' => $customerDashboardWidgets['invoice_total'], 'label' => Str::plural(__('locale.menu.Invoices')), 'route' => route('customer.subscriptions.index'), 'icon' => 'shopping-cart', 'color' => 'bg-light-info', 'iconColor' => 'text-info'], ['value' => $customerDashboardWidgets['blacklist_count'], 'total' => null, 'label' => Str::plural(__('locale.menu.Blacklist')), 'route' => route('customer.blacklists.index'), 'icon' => 'user-x', 'color' => 'bg-light-danger', 'iconColor' => 'text-danger'], ] as $card)

@if($card['total'] !== null) {{ $card['value'] }} / {{ $card['total'] }} @else {{ $card['value'] }} @endif

{{ $card['label'] }}

@endforeach
{{-- ── SMS type chart sections (permission-gated) ────────────────────── --}} {{-- Each entry: [sms_type, permissions_needed] --}} @php $smsChartTypes = [ 'plain' => ['quick_send', 'sms_campaign_builder', 'sms_bulk_messages'], 'unicode' => ['quick_send', 'sms_campaign_builder', 'sms_bulk_messages'], 'voice' => ['voice_campaign_builder', 'voice_quick_send', 'voice_bulk_messages'], 'mms' => ['mms_campaign_builder', 'mms_quick_send', 'mms_bulk_messages'], 'whatsapp' => ['whatsapp_campaign_builder', 'whatsapp_quick_send', 'whatsapp_bulk_messages'], 'viber' => ['viber_campaign_builder', 'viber_quick_send', 'viber_bulk_messages'], 'otp' => ['otp_campaign_builder', 'otp_quick_send', 'otp_bulk_messages'], ]; @endphp @foreach($smsChartTypes as $type => $permissions) @canany($permissions)

{{ __('locale.labels.sms_statistics', ['sms_type' => __('locale.labels.' . $type . '_sms')]) }}

@endcanany @endforeach
@endsection @section('vendor-script') @endsection @section('page-script') @endsection