@extends('layouts.app') @section('content') @php $now = \Carbon\CarbonImmutable::today()->locale('fr_FR'); $today = explode(' ', $now->toDateTimeString())[0]; $idStatePaid = App\Models\State::where('name', 'PAID')->first()->id; $idStatePending = App\Models\State::where('name', 'PENDING')->first()->id; //Today Sell $startOfDay = $now->startOfDay()->toDateTimeString(); $endOfDay = $now->endOfDay()->toDateTimeString(); $sells = App\Models\Sell::where('state_id', $idStatePaid)->whereBetween('date', [$startOfDay, $endOfDay])->get(); $todaySell = $sells->sum('total'); //Yesterday Sell $startOfDay = $now->subDay()->startOfDay()->toDateTimeString(); $endOfDay = $now->subDay()->endOfDay()->toDateTimeString(); $sells = App\Models\Sell::where('state_id', $idStatePaid)->whereBetween('date', [$startOfDay, $endOfDay])->get(); $yesterdaySell = $sells->sum('total'); //Week Sell $startOfWeek = $now->startOfWeek()->toDateTimeString(); $endOfWeek = $now->endOfWeek()->toDateTimeString(); $sells = App\Models\Sell::where('state_id', $idStatePaid)->whereBetween('date', [$startOfWeek, $endOfWeek])->get(); $weekSell = $sells->sum('total'); //Month Sell $startOfMonth = $now->startOfMonth()->toDateTimeString(); $endOfMonth = $now->endOfMonth()->toDateTimeString(); $sells = App\Models\Sell::where('state_id', $idStatePaid)->whereBetween('date', [$startOfMonth, $endOfMonth])->get(); $monthSell = $sells->sum('total'); $sellsInPending = App\Models\Sell::where('state_id', $idStatePending)->get(); $nbreSellsInPending = $sellsInPending->count(); @endphp

Sorties {{ ($nbreSellsInPending > 0)? "(". $nbreSellsInPending . ") en attente(s)" : "" }}

{{ $todaySell }}

Aujourd'hui

FCFA

{{ $weekSell }}

Cette Semaine

FCFA

{{ $monthSell }}

Ce Mois

FCFA

{{ $chart2->options['chart_title'] }}

{!! $chart2->renderHtml() !!}

{{ $chart1->options['chart_title'] }}

{!! $chart1->renderHtml() !!}
@endsection @push('scripts') {{-- {!! $chart1->renderJs() !!} {!! $chart2->renderJs() !!} --}} @endpush