ldc-boutique-cnc-sable/resources/views/bo/dashboard.blade.php
2026-10-27 09:58:12 +01:00

222 lines
9.6 KiB
PHP

@extends('bo.layouts.layout')
@section('title', __('Dashboard'))
@section('description', __('Site dashboard'))
@section('breadcrumb', 'no')
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center border-bottom mb-3 flex-wrap pb-2 pt-3">
<h1 class="h2">Dashboard</h1>
</div>
<div class="container">
<table class="table-responsive table-bordered table">
<thead>
<tr class="table-secondary text-center">
<th scope="col">{{ __('Number of employees') }}</th>
<th scope="col">{{ __('Number of registered employees') }}</th>
<th scope="col">{{ __('Membership rate') }}</th>
</tr>
</thead>
<tbody>
<tr class="table-light text-bold fw-semibold text-center">
<td>{{ $employeeCount }}</td>
<td>{{ $customersLinkedToEmployeeCount }}</td>
<td>{{ $adhesion }}&nbsp;%</td>
</tr>
</tbody>
</table>
<br />
{{-- DATES --}}
<form action="{{ route('bo.dashboard') }}">
<div class="row">
<div class="col">
<label for="start">{{ __('Start date') }}:</label>
<input class="form-control" id="start" name="start" type="date" value="{{ request()->start }}" required />
@if (!empty($statsShop))
<label for="previousStart">{{ __('Start date of the previous period') }}:</label>
<input class="form-control" id="previousStart" name="previousStart" type="date"
value="{{ $prevDates->start->toDateString() }}" aria-label="disabled input" disabled>
@endif
<br>
</div>
<div class="col">
<label for="end">{{ __('End date') }}:</label>
<input class="form-control" id="end" name="end" type="date" value="{{ request()->end }}" required />
@if (!empty($statsShop))
<label for="previousEnd">{{ __('End date of the previous period') }}:</label>
<input class="form-control" id="previousEnd" name="previousEnd" type="date" 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="{{ __('Send') }}" />
</div>
</div>
</form>
{{-- CUSTOMERS DATA --}}
@if (!empty($statsCustomer))
<table class="table-responsive table-bordered table-hover table">
<thead>
<tr class="bg-secondary bg-gradient bg-opacity-25 text-center">
<th scope="col">{{-- keep empty --}}</th>
<th scope="col">{{ __('Previous period') }}</th>
<th scope="col">{{ __('Current period') }}</th>
<th scope="col">{{ __('Difference') }}</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>
{{ Domain\Enums\StatsCustomerType::make($k)->label() }}
</th>
<td @if ($stat['diff'] > 0) class="table-success" @else class="table-danger" @endif>
@switch($k)
@case(Domain\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(Domain\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(Domain\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-responsive table-bordered table-hover table">
<thead>
<tr class="bg-secondary bg-gradient bg-opacity-25 text-center">
<th scope="col">{{-- keep empty --}}</th>
<th scope="col">{{ __('Previous period') }}</th>
<th scope="col">{{ __('Current period') }}</th>
<th scope="col">{{ __('Difference') }}</th>
</tr>
</thead>
<tbody>
@foreach ($statsShop as $k => $stat)
<tr class="text-center">
@if (
$k === Domain\Enums\StatsShopType::nbWaitingCmd->value ||
$k === Domain\Enums\StatsShopType::nbCanceledCmd->value ||
$k === Domain\Enums\StatsShopType::canceledRate->value())
<th @if ($stat['diff'] < 0) class="table-success" @else class="table-danger" @endif>
{{ Domain\Enums\StatsShopType::make($k)->label() }}</th>
<td @if ($stat['diff'] < 0) class="table-success" @else class="table-danger" @endif>
@switch($k)
@case(Domain\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(Domain\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(Domain\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>
{{ Domain\Enums\StatsShopType::make($k)->label() }}</th>
<td @if ($stat['diff'] > 0) class="table-success" @else class="table-danger" @endif>
@switch($k)
@case(Domain\Enums\StatsShopType::caHt->value())
@case(Domain\Enums\StatsShopType::caTtc->value())
@case(Domain\Enums\StatsShopType::averageBasketHt->value())
{{ number_format($stat['previous'], 2, ',', ' ') }} €
@break
@case(Domain\Enums\StatsShopType::orderFrequency->value())
{{ number_format($stat['previous'], 2, ',', ' ') }} {{ __('days') }}
@break
@default
{{ str_replace('.', ',', $stat['previous']) }}
@endswitch
</td>
<td @if ($stat['diff'] > 0) class="table-success" @else class="table-danger" @endif>
@switch($k)
@case(Domain\Enums\StatsShopType::caHt->value())
@case(Domain\Enums\StatsShopType::caTtc->value())
@case(Domain\Enums\StatsShopType::averageBasketHt->value())
{{ number_format($stat['current'], 2, ',', ' ') }} €
@break
@case(Domain\Enums\StatsShopType::orderFrequency->value())
{{ number_format($stat['current'], 2, ',', ' ') }} {{ __('days') }}
@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(Domain\Enums\StatsShopType::caHt->value())
@case(Domain\Enums\StatsShopType::caTtc->value())
@case(Domain\Enums\StatsShopType::averageBasketHt->value())
<b>{{ number_format($stat['diff'], 2, ',', ' ') }} €</b>
@break
@case(Domain\Enums\StatsShopType::orderFrequency->value())
<b>{{ number_format($stat['diff'], 2, ',', ' ') }} {{ __('days') }}</b>
@break
@default
<b>{{ str_replace('.', ',', $stat['diff']) }}</b>
@endswitch
</td>
@endif
</tr>
@endforeach
</tbody>
</table>
@else
<p>{{ __('Please enter a period to view statistics') }}</p>
@endif
</div>
@endsection