@extends('layouts.dashboard.app')
@php
$body_class = 'account-page';
$total_page_view = $total_views_by_sub = $total_alerts = $total_compliance = $accept_count = $accept_percentage = 0;
if($websites->count()){
$total_page_view = $websites->sum('views');
$total_alerts = $websites->sum('alerts');
$sites_ids = $websites->pluck('id');
$accept_count = $websites->sum('accept_count');
$accept_percentage = calculatePercentage($accept_count, $total_page_view);
$total_compliance = $websites->sum('compliance')/$websites->count();
}
if($activeSub){
if($activeSub->price_type == 'year'){
$c_plan_price = $activeSub?->plan?->year_price;
$c_plan_period = 'year';
} else {
$c_plan_price = $activeSub?->plan?->price;
$c_plan_period = 'month';
}
$c_period = $activeSub->getCurrentCycleDates();
if($c_period){
$websites_ids = $currentUser->websites()->pluck('id')->all();
$views_by_sub = \App\Models\WebsiteStat::whereIn('website_id', $websites_ids)->where('time', '>=', $c_period[0])->where('time', '<=', $c_period[1])->get();
$total_views_by_sub= $views_by_sub->sum('views');
}
}else {
$c_plan_price = $currentPlan?->price;
$c_plan_period = 'month';
}
$website_percent = cookiesFlowGetPercent($websites->count() , $currentPlan?$currentPlan->website_cnt:0 );
$views_percent = cookiesFlowGetPercent($total_page_view , $currentPlan?$currentPlan->page_views:0 );
@endphp
@section('content')
@endsection
@push('scripts')
@endpush