183 lines
11 KiB
PHP
183 lines
11 KiB
PHP
@extends('layouts.bo-layout')
|
|
|
|
@section('content')
|
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
|
<h1 class="h2">Dashboard</h1>
|
|
</div>
|
|
<div class="container">
|
|
{{-- DATES --}}
|
|
<form action="{{ route('bo.dashboard') }}">
|
|
<div class="row">
|
|
<div class="col">
|
|
<label for="start">{{ __('Date de début') }}:</label>
|
|
<input class="form-control" type="date" id="start" name="start" value="{{ request()->start }}" required/>
|
|
@if (!empty($statsShop))
|
|
<label for="previousStart">{{ __('Date de début de la période précédente') }}:</label>
|
|
<input class="form-control" type="date" id="previousStart" name="previousStart" value="{{ $prevDates->start->toDateString() }}" aria-label="disabled input" disabled>
|
|
@endif
|
|
<br>
|
|
</div>
|
|
<div class="col">
|
|
<label for="end">{{ __('Date de fin') }}:</label>
|
|
<input class="form-control" type="date" id="end" name="end" value="{{ request()->end }}" required/>
|
|
@if (!empty($statsShop))
|
|
<label for="previousEnd">{{ __('Date de fin de la période précédente') }}:</label>
|
|
<input class="form-control" type="date" id="previousEnd" name="previousEnd" value="{{ $prevDates->end->toDateString() }}" aria-label="disabled input" disabled>
|
|
@endif
|
|
</div>
|
|
<div class="col d-inline-flex align-items-center">
|
|
<input class="btn btn-primary flex-end" type="submit" value="{{ __('Envoyer') }}" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{{-- CUSTOMERS DATA --}}
|
|
@if(!empty($statsCustomer))
|
|
<table class="table table-responsive table-bordered table-hover">
|
|
<thead>
|
|
<tr class="text-center bg-secondary bg-gradient bg-opacity-25">
|
|
<th scope="col">{{-- keep empty --}}</th>
|
|
<th scope="col">{{ __('Période précédente') }}</th>
|
|
<th scope="col">{{ __('Période actuelle') }}</th>
|
|
<th scope="col">{{ __('Différence') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($statsCustomer as $k => $stat)
|
|
<tr class="text-center">
|
|
<th @if ($stat['diff'] > 0) class="table-success" @else class="table-danger"@endif>
|
|
{{ App\Enums\StatsCustomerType::make($k)->label }}
|
|
</th>
|
|
<td @if ($stat['diff'] > 0) class="table-success" @else class="table-danger"@endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsCustomerType::membershipRate()->value)
|
|
{{ number_format($stat['previous'], 2, ",", " ") }} %
|
|
@break
|
|
@default
|
|
{{ $stat['previous'] }}
|
|
@endswitch
|
|
</td>
|
|
<td @if ($stat['diff'] > 0) class="table-success" @else class="table-danger"@endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsCustomerType::membershipRate()->value)
|
|
{{ number_format($stat['current'], 2, ",", " ") }} %
|
|
@break
|
|
@default
|
|
{{ $stat['current'] }}
|
|
@endswitch
|
|
</td>
|
|
<td @if ($stat['diff'] > 0) class="text-success table-success" @else class="text-danger table-danger" @endif>
|
|
<b>
|
|
@switch($k)
|
|
@case(App\Enums\StatsCustomerType::membershipRate()->value)
|
|
{{ number_format($stat['diff'], 2, ",", " ") }} %
|
|
@break
|
|
@default
|
|
{{ $stat['diff'] }}
|
|
@endswitch
|
|
</b>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
@if(!empty($statsShop))
|
|
<table class="table table-responsive table-bordered table-hover">
|
|
<thead>
|
|
<tr class="text-center bg-secondary bg-gradient bg-opacity-25">
|
|
<th scope="col">{{-- keep empty --}}</th>
|
|
<th scope="col">{{ __('Période précédente') }}</th>
|
|
<th scope="col">{{ __('Période actuelle') }}</th>
|
|
<th scope="col">{{ __('Différence') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($statsShop as $k => $stat)
|
|
<tr class="text-center">
|
|
@if (
|
|
$k === App\Enums\StatsShopType::nbWaitingCmd()->value ||
|
|
$k === App\Enums\StatsShopType::nbCanceledCmd()->value ||
|
|
$k === App\Enums\StatsShopType::canceledRate()->value
|
|
)
|
|
<th @if ($stat['diff'] < 0) class="table-success" @else class="table-danger"@endif>{{ App\Enums\StatsShopType::make($k)->label }}</th>
|
|
<td @if ($stat['diff'] < 0) class="table-success" @else class="table-danger"@endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsShopType::canceledRate()->value)
|
|
{{ number_format($stat['previous'], 2, ",", " ") }} %
|
|
@break
|
|
@default
|
|
{{ str_replace(".", ",", $stat['previous']) }}
|
|
@endswitch
|
|
</td>
|
|
<td @if ($stat['diff'] < 0) class="table-success" @else class="table-danger"@endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsShopType::canceledRate()->value)
|
|
{{ number_format($stat['current'], 2, ",", " ") }} %
|
|
@break
|
|
@default
|
|
{{ str_replace(".", ",", $stat['current']) }}
|
|
@endswitch
|
|
</td>
|
|
<td @if ($stat['diff'] < 0) class="text-success table-success" @else class="text-danger table-danger" @endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsShopType::canceledRate()->value)
|
|
<b>{{ number_format($stat['diff'], 2, ",", " ") }} %</b>
|
|
@break
|
|
@default
|
|
<b>{{ str_replace(".", ",", $stat['diff']) }}</b>
|
|
@endswitch
|
|
</td>
|
|
@else
|
|
<th @if ($stat['diff'] > 0) class="table-success" @else class="table-danger"@endif>{{ App\Enums\StatsShopType::make($k)->label }}</th>
|
|
<td @if ($stat['diff'] > 0) class="table-success" @else class="table-danger"@endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsShopType::caHt()->value)
|
|
@case(App\Enums\StatsShopType::caTtc()->value)
|
|
@case(App\Enums\StatsShopType::averageBasketHt()->value)
|
|
{{ number_format($stat['previous'], 2, ",", " ") }} €
|
|
@break
|
|
@case(App\Enums\StatsShopType::orderFrequency()->value)
|
|
{{ number_format($stat['previous'], 2, ",", " ") }} {{ __('jours') }}
|
|
@break
|
|
@default
|
|
{{ str_replace(".", ",", $stat['previous']) }}
|
|
@endswitch
|
|
</td>
|
|
<td @if ($stat['diff'] > 0) class="table-success" @else class="table-danger"@endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsShopType::caHt()->value)
|
|
@case(App\Enums\StatsShopType::caTtc()->value)
|
|
@case(App\Enums\StatsShopType::averageBasketHt()->value)
|
|
{{ number_format($stat['current'], 2, ",", " ") }} €
|
|
@break
|
|
@case(App\Enums\StatsShopType::orderFrequency()->value)
|
|
{{ number_format($stat['current'], 2, ",", " ") }} {{ __('jours') }}
|
|
@break
|
|
@default
|
|
{{ str_replace(".", ",", $stat['current']) }}
|
|
@endswitch
|
|
</td>
|
|
<td @if ($stat['diff'] > 0) class="text-success table-success" @else class="text-danger table-danger" @endif>
|
|
@switch($k)
|
|
@case(App\Enums\StatsShopType::caHt()->value)
|
|
@case(App\Enums\StatsShopType::caTtc()->value)
|
|
@case(App\Enums\StatsShopType::averageBasketHt()->value)
|
|
<b>{{ number_format($stat['diff'], 2, ",", " ") }} €</b>
|
|
@break
|
|
@case(App\Enums\StatsShopType::orderFrequency()->value)
|
|
<b>{{ number_format($stat['diff'], 2, ",", " ") }} {{ __('jours') }}</b>
|
|
@break
|
|
@default
|
|
<b>{{ str_replace(".", ",", $stat['diff']) }}</b>
|
|
@endswitch
|
|
</td>
|
|
@endif
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@else
|
|
<p>{{ __('Veuillez renseigner une période afin de visualiser les statistiques') }}</p>
|
|
@endif
|
|
</div>
|
|
@endsection
|