@extends('template.layout')

@section('content')
    @include('sweet::alert')

    <h1 class="page-title">
        Reporte estadístico de Eventos del año actual
    </h1>

    <div class="portlet light portlet-fit portlet-datatable bordered">

        <div class="portlet-body">

            <div class=" row" style="padding-top: 3%;">
                <div class="col-lg-12 ">
                    <div class="row">
                        <div class="col-lg-12" style="text-align: center;">
                            <span class="caption-subject font-green sbold uppercase"> Eventos con más asistencia</span>
                            <div id="graph1">
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>

    </div>


@endsection
@section('scripts')
    <script>

        $(document).ready(function () {

            var color_array = ['#03658C', '#7CA69E', '#F2594A', '#F28C4B', '#7E6F6A', '#36AFB2', '#9c6db2', '#d24a67', '#89a958', '#00739a', '#BDBDBD'];

            //-------------Graph-----------------

            $.ajax({
                url: "{{ url('graph/eventos') }}",
                type: "GET",
                success: function (result) {

                    $('#graph1').empty();

                    Morris.Bar({
                        element: 'graph1',
                        data: result,
                        xkey: 'y',
                        ykeys: ['a'],
                        labels: ['Cantidad participantes'],
                        barColors: color_array
                    });

                }
            });


            //-------------Fin Graph-------------


        });

    </script>
@endsection
