@can('dashboard-counter') @if (checkSettings('free_client') == 'enable') @can('free-client') @endcan @endif @can('leftclient') @if (checkSettings('remove_left_client_from_dashboard') == 'enable') @else @php $deactiveClient = $clientCount->where('clients_status', 'deactive')->first()->total ?? 0; $totalleftClient = $deactiveClient + $deleteClients; @endphp @endif @endcan {{-- @dd($deleteClients) --}} @can('show-reseller-cost') @if (auth()->user()->hasRole(['Reseller Admin', 'Reseller', 'Reseller Technician'])) @endif @endcan @endcan @can('show-client-count-expire-date') @php $expireTodayDate = \Carbon\Carbon::today()->format('Y-m-d'); $expireTomorrowDate = \Carbon\Carbon::today()->addDay()->format('Y-m-d'); $expireDayAfterDate = \Carbon\Carbon::today()->addDays(2)->format('Y-m-d'); @endphp @endcan @can('dashboard-billing-info') @if (globalPermission('day-to-day-billing-dashboard')) @can('d-2-d-admin-dashboard') @endcan @else @endif {{-- --}} @php $isBillingDashboard = globalPermission('day-to-day-billing-dashboard'); $isDashboardCounter = auth()->user()->can('d-2-d-admin-dashboard'); if ($isBillingDashboard && !$isDashboardCounter) { $link = route('paymentReport'); $value = round($thisMonthBillCollection) ?? 0; } else { $link = route('bill-generate'); $value = round($thisMonthBillPaid) + round($resellerCurrentMonthCollection) ?? 0; } // Reseller-role users can be switched to a "this month balance log" view // of this box (and have the Today Bill COL / Discount boxes hidden) via // the 'reseller-balance-log-dashboard' global setting. $resellerBalanceLogRoles = ['Reseller', 'Reseller Admin', 'Reseller Technician', 'Sub Reseller', 'Sub Reseller Technician']; $showResellerBalanceLogBox = checkSettings('reseller-balance-log-dashboard') == 'enable' && auth()->user()->hasRole($resellerBalanceLogRoles); if ($showResellerBalanceLogBox) { if (auth()->user()->hasRole(['Sub Reseller', 'Sub Reseller Technician'])) { $balanceLogPopIds = \Illuminate\Support\Facades\DB::table('pop_user') ->where('user_id', auth()->id()) ->pluck('pop_id'); $resellerBalanceLogAmount = \App\Models\SubResellerBalanceLogReport::whereIn('sub_reseller_id', $balanceLogPopIds) ->whereMonth('created_at', now()->month) ->whereYear('created_at', now()->year) ->sum('amount'); } else { $balanceLogResellerIds = \Illuminate\Support\Facades\DB::table('reseller_user') ->where('user_id', auth()->id()) ->pluck('reseller_id'); $resellerBalanceLogAmount = \App\Models\ReselleBalanceLogReport::whereIn('reseller_id', $balanceLogResellerIds) ->whereMonth('created_at', now()->month) ->whereYear('created_at', now()->year) ->sum('amount'); } } @endphp @unless ($showResellerBalanceLogBox) @endunless @if (globalPermission('day-to-day-billing-dashboard')) @can('d-2-d-admin-dashboard') @endcan @else @endif @unless ($showResellerBalanceLogBox) @endunless {{-- Total Due and Previous Due are filled in over ajax once the page is up (see dashboard/new/index.blade.php). The total due sum has to scan the whole billing history, and waiting for it held back everything else on the page. --}} @if (globalPermission('day-to-day-billing-dashboard')) @can('d-2-d-admin-dashboard') @endcan @else @endif @endcan