ldc-groupe/resources/views/components/front/pages/finance/graphics.blade.php
2026-02-19 16:14:05 +01:00

66 lines
2.9 KiB
PHP

@php
$graphs = [
[
'type' => 'list_affair',
'data' => data_get($data, 'list_key_numbers_values.0.list_affair.0'),
],
[
'type' => 'list_last_repartition_affair',
'data' => data_get($data, 'list_key_numbers_values.0.list_last_repartition_affair.0'),
],
[
'type' => 'list_bilan_simplify',
'data' => data_get($data, 'list_key_numbers_values.0.list_bilan_simplify.0'),
],
[
'type' => 'capacite_dautofinancement',
'data' => data_get($data, 'list_key_numbers_values.0.list_autofinancement.0'),
],
];
@endphp
<div id="{{ data_get($data, 'string_title') ? Str::slug(data_get($data, 'string_title')) : '' }}"
class="kfar">
<div class="textblock fw fw-container">
<div class="textblock__wrapper wrapper">
<x-front.sections.title :title="data_get($data, 'string_title')" :subtitle="data_get($data, 'string_subtitle')" />
<div class="textblock__container">
<div class="textblock__info textblock__block"></div>
</div>
</div>
</div>
<div class="kfar-blocks fw">
<div class="kfar__wrapper wrapper">
<div class="kfar__list">
@foreach ($graphs as $g)
<div class="kfar-item">
@if (!empty($g['data']['string_label']))
<div class="kfar-item__title subtitle">{{ $g['data']['string_label'] }}</div>
@endif
@if (!empty($g['data']['string_sub_label']))
<div class="kfar-item__text description">
<p>{{ $g['data']['string_sub_label'] }}</< /p>
</div>
@endif
<div class="kfar-item__text description">
@php
$chart = \App\Helpers\FinancePageChartHelper::buildChart($g['type'], $g['data']);
$id = sha1($g['type']);
@endphp
<canvas id="{{ $id }}" width="400" height="400"></canvas>
<script nonce="{{ $nonce ?? '' }}">
document.addEventListener('DOMContentLoaded', () => {
new window.Chart(document.getElementById('{{ $id }}'), {!! json_encode($chart) !!});
});
</script>
</div>
@if ($g['type'] === 'list_bilan_simplify')
<div class="kfar-item__text description centered">
{{ $g['data']['string_base_euros'] }}
</div>
@endif
</div>
@endforeach
</div>
</div>
</div>
</div>