@extends('admin/layouts.master-soyuz')
@section('title', __('Admin Dashboard | '))
@section('body')
@component('admin.component.breadcumb')
@slot('heading'){{ __('Dashboard') }}@endslot
@endcomponent
@can('dashboard.states')
{{-- Welcome strip --}}
{{ $day }}, {{ auth()->user()->name }}!
{{ $quote }}
{{ __('Today') }}
{{ now()->format('l, M j Y') }}
{{-- Auto-update banner --}}
{{-- KPI tiles --}}
@php
$kpis = [
['label' => __('Total Users'), 'value' => $user, 'icon' => 'feather icon-users', 'color' => '#3b6df0', 'bg' => '#dbeafe', 'url' => route('users.index')],
['label' => __('Total Orders'), 'value' => $order, 'icon' => 'feather icon-shopping-cart', 'color' => '#f59e0b', 'bg' => '#fef3c7', 'url' => url('admin/order')],
['label' => __('Cancelled Orders'), 'value' => $totalcancelorder,'icon' => 'feather icon-x-circle', 'color' => '#dc2626', 'bg' => '#fee2e2', 'url' => url('admin/ord/canceled')],
['label' => __('Total Products'), 'value' => $totalproducts, 'icon' => 'feather icon-box', 'color' => '#16a34a', 'bg' => '#dcfce7', 'url' => url('admin/products')],
['label' => __('Total Stores'), 'value' => $store, 'icon' => 'feather icon-home', 'color' => '#06b6d4', 'bg' => '#cffafe', 'url' => url('admin/stores')],
['label' => __('Total Categories'), 'value' => $category, 'icon' => 'feather icon-grid', 'color' => '#8b5cf6', 'bg' => '#ede9fe', 'url' => url('admin/category')],
['label' => __('Total Coupons'), 'value' => $coupan, 'icon' => 'feather icon-tag', 'color' => '#10b981', 'bg' => '#d1fae5', 'url' => url('admin/coupan')],
['label' => __('Total FAQs'), 'value' => $faqs, 'icon' => 'feather icon-help-circle', 'color' => '#f97316', 'bg' => '#ffedd5', 'url' => url('admin/faq')],
];
if (isset($genrals_settings) && $genrals_settings->vendor_enable == 1) {
$kpis[] = ['label' => __('Pending Payouts'), 'value' => $pending_payout, 'icon' => 'feather icon-credit-card', 'color' => '#e11d48', 'bg' => '#ffe4e6', 'url' => route('seller.payouts.index')];
$kpis[] = ['label' => __('Active Sellers'), 'value' => $totalsellers, 'icon' => 'feather icon-briefcase', 'color' => '#0ea5e9', 'bg' => '#e0f2fe', 'url' => route('users.index', ['filter' => 'sellers'])];
}
$kpis[] = ['label' => __('Active Testimonials'), 'value' => $total_testinonials, 'icon' => 'feather icon-message-circle', 'color' => '#a855f7', 'bg' => '#f3e8ff', 'url' => route('testimonial.index')];
$kpis[] = ['label' => __('Active Hot Deals'), 'value' => $total_hotdeals, 'icon' => 'feather icon-zap', 'color' => '#ec4899', 'bg' => '#fce7f3', 'url' => route('hotdeal.index')];
@endphp
@foreach($kpis as $kpi)
@endforeach
{{-- Social widgets --}}
@if($dashsetting->fb_wid == 1 || $dashsetting->tw_wid == 1 || $dashsetting->insta_wid == 1)
@php $connected = @fsockopen('www.facebook.com', 80); @endphp
@if($dashsetting->fb_wid == 1)
{{ __('Facebook') }}
@if($dashsetting->fb_page_id != '' || $dashsetting->fb_page_token != '')
@if($connected)
@php
$url = 'https://graph.facebook.com/v3.2/'.$dashsetting->fb_page_id.'?fields=fan_count&access_token='.$dashsetting->fb_page_token;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($curl);
curl_close($curl);
$fanCount = '—';
if ($result) {
$r = json_decode($result);
if (isset($r->fan_count)) $fanCount = number_format($r->fan_count);
}
@endphp
{{ $fanCount }} {{ __('Likes') }}
@else {{ __('Connection Problem') }}
@endif
@else {{ __('Set FB key in dashboard settings') }}
@endif
@endif
@if($dashsetting->tw_wid == 1)
{{ __('Twitter') }}
@if($dashsetting->tw_username != '' && $connected)
@php
$data = @file_get_contents('https://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names=' . $dashsetting->tw_username);
$parsed = @json_decode($data, true);
$tw = isset($parsed[0]['followers_count']) ? number_format($parsed[0]['followers_count']) : '—';
@endphp
{{ $tw }} {{ __('Followers') }}
@else {{ __('Set Twitter username in settings') }}
@endif
@endif
@if($dashsetting->insta_wid == 1)
{{ __('Instagram') }}
@if($dashsetting->inst_username != '' && $connected)
@php
$raw = @file_get_contents("https://www.instagram.com/$dashsetting->inst_username");
preg_match('/\"edge_followed_by\"\:\s?\{\"count\"\:\s?([0-9]+)/', (string) $raw, $m);
$ig = isset($m[1]) ? number_format($m[1]) : '—';
@endphp
{{ $ig }} {{ __('Followers') }}
@else {{ __('Set Instagram username in settings') }}
@endif
@endif
@endif
{{-- Charts row --}}
{!! $orderchart->container() !!}
{!! $userchart->container() !!}
@if($dashsetting->lat_ord == 1)
| # |
{{ __('Order ID') }} |
{{ __('Customer') }} |
{{ __('Qty') }} |
{{ __('Total') }} |
{{ __('Date') }} |
@forelse($latestorders as $key => $orderRow)
| {{ $key + 1 }} |
#{{ $inv_cus->order_prefix . $orderRow->order_id }} |
{{ optional($orderRow->user)->name ?? '—' }} |
{{ $orderRow->qty_total }} |
{{ $orderRow->order_total }} |
{{ date('d M Y', strtotime($orderRow->created_at)) }} |
@empty
| {{ __('No orders found') }} |
@endforelse
@endif
{!! $piechart->container() !!}
@if(isset($genrals_settings) && $genrals_settings->vendor_enable == 1 && $dashsetting->rct_str == 1)
| # |
{{ __('Store Name') }} |
{{ __('Business Email') }} |
{{ __('Requested By') }} |
@forelse($storerequest as $key => $storeRow)
| {{ $key + 1 }} |
{{ $storeRow->name }} |
{{ $storeRow->email }} |
{{ $storeRow->owner }} |
@empty
| {{ __('No store requests yet') }} |
@endforelse
@endif
@if($dashsetting->rct_pro == 1)
@endif
@if($dashsetting->rct_cust == 1)
@foreach($users = App\User::where('role_id', '!=', 'a')->orderBy('id', 'DESC')->take($dashsetting->max_item_cust)->get() as $userRow)
@if($userRow->image != '' && file_exists(public_path() . '/images/user/' . $userRow->image))
 }})
@else
->tobase64() }})
@endif
{{ $userRow->name }}
{{ $userRow->email }}
{{ \Carbon\Carbon::parse($userRow->created_at)->diffForHumans(null, true) }}
@endforeach
@endif
@else
{{ $day }}, {{ auth()->user()->name }}
{{ $quote }}
@endcan
@endsection
@section('custom-script')
{!! $userchart->script() !!}
{!! $piechart->script() !!}
{!! $orderchart->script() !!}
@endsection