{{-- Start (DESIGN.md Page patterns 1, dashboard; #2957 slice 1). Same data as before the reskin: the company's last five sendouts starting up to a week ahead, and the month summary from Company::sumMonthStats(). Unread notices get their own card only when there are any. --}} @extends('layouts.nuhet') @php $user = Auth::user(); $company = $user->company; $firstName = trim((string) $user->first_name) !== '' ? $user->first_name : $user->username; $sendouts = $company->sendouts()->where('start_time', '<=', \Carbon\Carbon::now()->addWeek())->limit(5)->orderBy('start_time', 'DESC')->get(); $month = $company->sumMonthStats(); $notices = $company->unreadNotices(); $percentOf = fn ($part) => $month['emails_sent'] > 0 ? $part / $month['emails_sent'] * 100 : 0; $percentText = fn ($part) => formatNumber($percentOf($part)).' %'; $latest = $sendouts->first(fn ($sendout) => in_array($sendout->statusType(), [1, 3], true)); // "Kom igÄng" (#3176): null once every step is done or the company has hidden it. $onboarding = app(\App\Services\Onboarding\OnboardingChecklist::class)->forCompany($company, $user); @endphp @section('_pageTitle', trans('home.index.pageTitle', ['name' => $user->fullname()])) @section('pagename', trans('navigation.dashboard')) @section('banners') @include('partials.nh-account-banners') @endsection @section('page')

{{ __('home.start.greeting', ['name' => $firstName]) }}

{{ __('home.start.lead', ['company' => $company->name]) }}

{{ __('home.start.newSendout') }} {{ __('home.start.createNewsletter') }} {{ __('home.start.importReceivers') }}
@includeWhen($onboarding, 'home.partials.onboarding', ['onboarding' => $onboarding])

{{ ucfirst(__('global.month.'.date('n'))) }} {{ date('Y') }}

{{ __('sendout.summary.header', ['month' => __('global.month.'.date('n'))]) }}

@include('partials.package-usage-bar', ['used' => $month['emails_sent'], 'limit' => $month['emails_sent_limit']])
@if ($sendouts->isEmpty())

{{ __('dashboard.sendout.empty') }}

@else @endif
@if ($latest) @php [$pill, $word] = [$latest->statusPill(), $latest->statusLabelKey()]; @endphp {{ __($word) }}

{{ $latest->subject }}

{{ __($pill === 'done' ? 'home.start.latestSent' : 'home.start.latestStarted', ['date' => \App\Support\DisplayDate::timestamp($latest->start_time)]) }}

{{ __('home.start.latestHint') }}

{{ __('home.start.showStats') }} @else

{{ __('home.start.latestEmpty') }}

@endif
@if ($notices->isNotEmpty()) @endif
@endsection