41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
@if( $monthly_incoming->count() === 0 && $monthly_invoices->count() === 0)
|
|
<div class="w-full text-center">{{ __('dashboard.No data') }}</div>
|
|
@else
|
|
<div class="w-full">
|
|
<canvas id="monthly"></canvas>
|
|
</div>
|
|
|
|
<script>
|
|
function drawMonth() {
|
|
let monthly_invoices = {!! $monthly_invoices !!};
|
|
let monthly_incoming = {!! $monthly_incoming !!};
|
|
let year = {!! $year !!};
|
|
|
|
let el = document.querySelector('#dashboard_graph_month h2');
|
|
el.innerHTML += ' ' + year;
|
|
|
|
new Chart(
|
|
document.getElementById('monthly'),
|
|
{
|
|
type: 'line',
|
|
data: {
|
|
datasets: [
|
|
{
|
|
label: '{{ __('invoice.Invoices') }}',
|
|
data: monthly_invoices,
|
|
backgroundColor: 'rgb(25,48,90)',
|
|
borderColor: 'rgb(25,48,90)',
|
|
},
|
|
{
|
|
label: '{{ __('incoming.Incoming') }}',
|
|
data: monthly_incoming,
|
|
backgroundColor: 'rgb(237,125,35)',
|
|
borderColor: 'rgb(237,125,35)',
|
|
}
|
|
]
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
@endif
|