Make dashboard configurable.
This commit is contained in:
40
resources/views/components/dashboard_graph_month.blade.php
Normal file
40
resources/views/components/dashboard_graph_month.blade.php
Normal file
@@ -0,0 +1,40 @@
|
||||
@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
|
||||
Reference in New Issue
Block a user