	<!-- Date Picker -->
    <link rel="stylesheet" href="<?= base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
    <!-- ChartJS -->
    <script src="<?= base_url('bower_components/Chart.js/Chart.js') ?>"></script>

    <?php
    $month = time();
    $months[]=convertDate(date("M"));
    $label_months [] = date("M")." ".date("Y");
    $years[]= date("Y");
    for ($i = 1; $i <= 11; $i++) {
        $month = strtotime('last month', $month);
        $months [] = convertDate(date("M", $month));
        $years[] = date("Y", $month);
        $label_months [] = date("M", $month)." ".date("Y", $month);
    }
    /**
     ** Simple User Treatment
     **/

    $date = date("Y");

    $demandes_data[] = '';
    $demandes_data =array();
    for ($i = 1; $i <= 12; $i++) {
        $demandes_query_mounth = $this->db->query("SELECT id FROM nh_infos_invoices
                      WHERE MONTH(created_at) = '".$months[$i-1]."' AND YEAR(created_at) = ".$years[$i-1]."
                        AND network_id='".$network_id."'"
                        );
        $demandes_data[] = $demandes_query_mounth->num_rows();
    }

	$pieChart = array();
    ?>

<div class="content-wrapper">

    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <?= $this->lang->line('controller_doctor'); ?>
            <small><?= $this->lang->line('Tableau de bord'); ?></small>
        </h1>
    </section>

    <section class="content">
        <!-- Small boxes (Stat box) -->
        <div class="row">
            <div class="col-lg-3 col-md-4 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-green">
                    <div class="inner">
                        <h3><?= $count_accepted ?? 0;?></h3>

                        <p><?= $this->lang->line('accepted_invoices'); ?></p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-checkmark-circled"></i>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-md-4 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-orange">
                    <div class="inner">
                        <h3><?= $count_accepted_modified ?? 0;?></h3>

                        <p><?= $this->lang->line('accepted_modified_invoices'); ?></p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-alert-circled"></i>
                    </div>
                </div>
            </div>
			<div class="col-lg-3 col-md-4 col-xs-6">
				<!-- small box -->
				<div class="small-box bg-red">
					<div class="inner">
						<h3><?= $count_rejected ?? 0;?></h3>

						<p><?= $this->lang->line("rejected_invoices"); ?></p>
					</div>
					<div class="icon">
						<i class="ion ion-close-circled"></i>
					</div>
				</div>
			</div>

			<div class="col-lg-3 col-md-4 col-xs-6">
				<!-- small box -->
				<div class="small-box bg-blue">
					<div class="inner">
						<h3><?= $count_under_validation ?? 0;?></h3>

						<p><?= $this->lang->line("under_validation_invoices"); ?></p>
					</div>
					<div class="icon">
						<i class="ion ion-information-circled"></i>
					</div>
				</div>
			</div>


            <div class="col-xs-12">
                <!-- BAR CHART -->
                <div class="box box-success">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?= $this->lang->line('invoices'); ?></h3>
                    </div>
                    <div class="box-body">
                        <div class="chart">
                            <canvas id="barChart" style="height:230px"></canvas>
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>

</div>


    <!-- jQuery 3 -->
    <script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="<?= base_url('bower_components/jquery-ui/jquery-ui.min.js') ?>"></script>
    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <!-- Bootstrap 3.3.7 -->
    <script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
    <!-- Morris.js charts -->
    <script src="<?= base_url('bower_components/raphael/raphael.min.js') ?>"></script>
    <!-- Sparkline -->
    <script src="<?= base_url('bower_components/jquery-sparkline/dist/jquery.sparkline.min.js') ?>"></script>
    <!-- jvectormap -->
    <script src="<?= base_url('plugins/jvectormap/jquery-jvectormap-1.2.2.min.js') ?>"></script>
    <script src="<?= base_url('plugins/jvectormap/jquery-jvectormap-world-mill-en.js') ?>"></script>
    <!-- jQuery Knob Chart -->
    <script src="<?= base_url('bower_components/jquery-knob/dist/jquery.knob.min.js') ?>"></script>
    <!-- daterangepicker -->
    <script src="<?= base_url('bower_components/moment/min/moment.min.js') ?>"></script>
    <script src="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
    <!-- datepicker -->
    <script src="<?= base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
    <!-- Bootstrap WYSIHTML5 -->
    <script src="<?= base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') ?>"></script>
    <!-- Slimscroll -->
    <script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
    <!-- FastClick -->
    <script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
    <!-- AdminLTE App -->
    <script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="<?= base_url('dist/js/demo.js') ?>"></script>

    <!-- ChartJS -->
    <script src="<?= base_url('bower_components/chart.js/Chart.js') ?>"></script>

    <script >

        //var Pie = '<?//= json_encode($pieChart) ?>//';
        //if(Pie==='[]'){
        //    var select = document.getElementById('chartAd');
        //    $(select.children).hide();
        //    //$(select).append("<p><?////= $this->lang->line('Aucune adhesion'); ?>////</p>");
        //}else{
        //    Pie = JSON.parse(Pie);
        //}

        //var Pie2 = '<?//= json_encode($pieChart2) ?>//';
        //if(Pie2==='[]') {
        //    var select = document.getElementById('chartDem');
        //    $(select.children).hide();
        //    $(select).append("<p><?//= $this->lang->line('Aucune demande'); ?>//</p>");
        //}else{
        //    Pie2 = JSON.parse(Pie2);
        //}



        var areaChartData = {
            labels  : <?= json_encode($label_months) ?>,
            datasets: [
                {
                    label               : 'Electronics',
                    fillColor           : 'rgba(255, 162, 0, 1)',
                    strokeColor         : 'rgba(255, 162, 0, 1)',
                    pointColor          : 'rgba(255, 162, 0, 1)',
                    pointStrokeColor    : '#ffa200',
                    pointHighlightFill  : '#fff',
                    pointHighlightStroke: 'rgba(220,220,220,1)',
                    data: <?= json_encode($demandes_data) ?>
			},
                //{
                //    label               : 'Digital Goods',
                //    fillColor           : 'rgba(0, 187, 255, 1)',
                //    strokeColor         : 'rgba(0, 187, 255, 1)',
                //    pointColor          : '#00bbff',
                //    pointStrokeColor    : 'rgba(0, 187, 255, 1)',
                //    pointHighlightFill  : '#fff',
                //    pointHighlightStroke: 'rgba(0, 187, 255, 1)',
                //    data                : <?//= json_encode($demandes_data) ?>
                //}
            ]
        };

        var ctx = document.getElementById('barChart').getContext('2d');
        var chart = new Chart(ctx, {
            // The type of chart we want to create
            type: 'line',

            // The data for our dataset
            data: {
                labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July','August','September','October','November','December'],
                datasets: [{
                    label: "My First dataset",
                    backgroundColor: 'rgb(255, 99, 132)',
                    borderColor: 'rgb(255, 99, 132)',
                    data: [0, 10, 5, 2, 20, 30, 45]
                }]
            },

            // Configuration options go here
            options: {}
        });
    </script>
    <!-- Page script -->
    <script src="<?= base_url('dist/js/custom.js') ?>"></script>
