{{ __('Dashboard') }}

{{ __('Dashboard') }}

@if(Auth::user()->hasReachedQueryLimit())

@trans_db('query_limit_reached', 'dashboard', 'Limită Query-uri DNS Atinsă!')

@trans_db('query_limit_message', 'dashboard', 'Ai atins limita de query-uri DNS pentru luna aceasta. Toate operațiunile DNS sunt temporar dezactivate.')

@trans_db('upgrade_plan', 'dashboard', 'Upgrade Plan') @trans_db('reset_date', 'dashboard', 'Resetare'): {{ now()->addMonth()->startOfMonth()->format('d M Y') }}
@elseif(Auth::user()->getQueryUsagePercentage() >= 80)

@trans_db('warning_near_limit', 'dashboard', 'Atenție: Aproape de Limită')

@trans_db('near_limit_message', 'dashboard', 'Ai consumat din limita ta de query-uri DNS. Consideră un upgrade pentru a evita întreruperi.')

@trans_db('view_plans', 'dashboard', 'Vezi Planuri')
@endif @if(Auth::user()->role === 'reseller')

{{ Auth::user()->resellerPlan?->name ?? 'Reseller' }}

{{ Auth::user()->resellerPlan?->description ?? 'Pachet Reseller' }}

@if(Auth::user()->resellerPlan && Auth::user()->resellerPlan->price > 0)

{{ number_format(Auth::user()->resellerPlan->price, 2) }} RON

/ lună

@else

{{ __('Free Plan') }}

@endif
@else

{{ Auth::user()->plan?->name ?? 'Fără plan' }}

{{ Auth::user()->plan?->description ?? '' }}

@if(Auth::user()->plan && Auth::user()->plan->price > 0)

{{ number_format(Auth::user()->plan->price, 2) }} RON

/ lună

@else

{{ __('Free Plan') }}

@endif
@endif

@trans_db('dns_zones', 'dashboard', 'DNS Zones')

@php // Numără zonele locale $localZonesCollection = Auth::user()->dnsZones()->get(); $localZones = $localZonesCollection->count(); // Numără zonele PowerDNS atribuite care NU există deja local $assignments = \App\Models\DnsZoneAssignment::where('user_id', Auth::id())->get(); $uniquePowerDnsZones = 0; foreach ($assignments as $assignment) { $existsLocally = $localZonesCollection->where('domain', rtrim($assignment->zone_name, '.'))->first(); if (!$existsLocally) { $uniquePowerDnsZones++; } } $totalZones = $localZones + $uniquePowerDnsZones; @endphp @if(Auth::user()->role === 'admin') {{ $totalZones }} / ∞ @elseif(Auth::user()->role === 'reseller') {{ $totalZones }} / {{ Auth::user()->resellerPlan?->dns_zones_per_client ?? 'N/A' }} @else {{ $totalZones }} / {{ Auth::user()->plan?->dns_zones_limit ?? 0 }} @endif

@if(Auth::user()->role !== 'admin')
@php // Folosește $totalZones calculat mai sus (care exclude duplicatele) $zonesCount = $totalZones; if(Auth::user()->role === 'reseller') { $zonesLimit = Auth::user()->resellerPlan?->dns_zones_per_client ?? 1; } else { $zonesLimit = Auth::user()->plan?->dns_zones_limit ?? 1; } $zonesPercent = $zonesLimit > 0 ? min(($zonesCount / $zonesLimit) * 100, 100) : 0; @endphp
@else

Unlimited

@endif

@trans_db('dns_records', 'dashboard', 'DNS Records')

@php $recordsCount = Auth::user()->getTotalRecordsCount(); @endphp @if(Auth::user()->role === 'admin') {{ $recordsCount }} / ∞ @elseif(Auth::user()->role === 'reseller') {{ $recordsCount }} / {{ Auth::user()->resellerPlan?->subdomains_per_client ?? 'N/A' }} @else {{ $recordsCount }} / {{ Auth::user()->plan?->subdomains_limit ?? 0 }} @endif

@if(Auth::user()->role !== 'admin')
@php if(Auth::user()->role === 'reseller') { $recordsLimit = Auth::user()->resellerPlan?->subdomains_per_client ?? 1; } else { $recordsLimit = Auth::user()->plan?->subdomains_limit ?? 1; } $recordsPercent = $recordsLimit > 0 ? min(($recordsCount / $recordsLimit) * 100, 100) : 0; @endphp
@else

Unlimited

@endif
@php $user = Auth::user(); $nameserversList = []; if ($user->isAdmin()) { // Admin vede toate nameserverele active $nameserversList = \App\Models\Nameserver::active()->pluck('hostname')->toArray(); } elseif ($user->role === 'reseller' && $user->resellerPlan) { // Reseller vede nameserverele din planul său reseller $allowedIds = $user->resellerPlan->getAllowedNameServers(); $nameserversList = \App\Models\Nameserver::whereIn('id', $allowedIds) ->where('is_active', true) ->pluck('hostname') ->toArray(); } elseif ($user->reseller_id && $user->reseller && $user->reseller->resellerPlan) { // Client al unui reseller - vede nameserverele din planul resellerului $allowedIds = $user->reseller->resellerPlan->getAllowedNameServers(); $nameserversList = \App\Models\Nameserver::whereIn('id', $allowedIds) ->where('is_active', true) ->pluck('hostname') ->toArray(); } elseif ($user->plan) { // Client normal cu plan propriu $allowedIds = $user->plan->getAllowedNameServers(); $nameserversList = \App\Models\Nameserver::whereIn('id', $allowedIds) ->where('is_active', true) ->pluck('hostname') ->toArray(); } $totalNS = count($nameserversList); @endphp

@trans_db('ns_allocated', 'dashboard', 'NSuri Alocate')

@if($totalNS > 2)
@foreach(array_chunk($nameserversList, 2) as $index => $chunk)
@endforeach
@endif
@if($totalNS > 0)
@foreach(array_chunk($nameserversList, 2) as $chunkIndex => $chunk)
@foreach($chunk as $hostname)

{{ $hostname }}

@endforeach
@endforeach
@else

@trans_db('no_nameservers', 'dashboard', 'Nu există nameservere alocate')

@endif

@trans_db('quick_actions', 'dashboard', 'Quick Actions')

{{ __('DNS Zones') }} Recente

@php // Obține zonele locale $localZones = Auth::user()->dnsZones()->latest()->take(5)->get(); $allZones = collect($localZones); // Adaugă zonele PowerDNS atribuite if (!Auth::user()->isAdmin()) { $assignments = App\Models\DnsZoneAssignment::where('user_id', Auth::id())->get(); $powerDNS = new App\Services\PowerDNSService(); foreach ($assignments as $assignment) { // Verifică dacă zona nu există deja local $existsLocally = $localZones->where('domain', rtrim($assignment->zone_name, '.'))->first(); if (!$existsLocally) { $cacheKey = "powerdns_zone_{$assignment->zone_name}"; $zoneDetails = cache()->remember($cacheKey, 300, function() use ($powerDNS, $assignment) { return $powerDNS->getZone($assignment->zone_name); }); if ($zoneDetails['success']) { $zone = new \stdClass(); $zone->id = 'powerdns_' . $assignment->id; $zone->domain = rtrim($zoneDetails['data']['name'], '.'); $zone->type = 'PowerDNS'; $zone->is_active = true; $zone->is_powerdns_only = true; $zone->powerdns_assignment = $assignment; $zone->powerdns_data = $zoneDetails['data']; // Numără înregistrările individuale, nu RRsets $recordsCount = 0; foreach ($zoneDetails['data']['rrsets'] ?? [] as $rrset) { $recordsCount += count($rrset['records'] ?? []); } $zone->records_count = $recordsCount; $zone->created_at = $assignment->assigned_at; $allZones->push($zone); } } } } $recentZones = $allZones->sortByDesc('created_at')->take(5); @endphp @if($recentZones->count() > 0) @else

{{ __('No records found') }}

@if(Auth::user()->canPerformDnsOperations()) {{ __('Add DNS Zone') }} @else @endif
@endif
@push('scripts') @endpush @if(Auth::user()->isAdmin()) @endif