title = "Home"
url = "/:year?"
layout = "platform_main"
is_hidden = 0
==
<?php
function onStart(){
    $currentDate = Carbon\Carbon::now()->timezone('UTC +05:00');

    $year = $this->param("year");

    if($year){
        $year = $this->param("year");
        $this["year"] = $this->param("year");
    }else{
        $year = $currentDate->year;
        $this["year"] = $currentDate->year;
    }



    $this["production1"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 1)->whereYear('created_at', $year)->avg('all_amount') ?? 0;

    $this["production2"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 2)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production3"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 3)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production4"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 4)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production5"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 5)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production6"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 6)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production7"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 7)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production8"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 8)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production9"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 9)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production10"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 10)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production11"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 11)->whereYear('created_at', $year)->avg('all_amount') ?? 0;
    $this["production12"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', 12)->whereYear('created_at', $year)->avg('all_amount') ?? 0;



}
?>
==
<!-- start page title -->
<div class="row">
    <div class="col-12">
        <div class="page-title-box d-flex align-items-center justify-content-between">
            <h3 class="mb-0">GOK BAKJA</h3>
<!--
            <div class="page-title-right">
                <form action="/year/dynamic" class="search" method="POST">
                    <input type="text" class="form-control" type="number" name="year" placeholder="Введите год"
                        aria-label="Введите год">
                </form>
            </div> -->

        </div>
    </div>
</div>
<!-- end page title -->

<div class="row">


    <div class="col-lg-12">
        <div class="card">
            <div class="card-body">
                <h4 class="card-title mb-4">Statistika hasabat {{year}} ýyl </h4>

                <div id="line_chart_datalabel" class="apex-charts" dir="ltr"></div>
            </div>
        </div>
        <!--end card-->
    </div>

    <!-- end col -->
</div><!-- end col -->

{% put scripts %}

<!-- apexcharts -->
<script src="{{'assets/libs/apexcharts/apexcharts.min.js'|theme}}"></script>

<script>
    var options = {
        chart: {
            height: 380,
            type: "line",
            zoom: {
                enabled: !1
            },
            toolbar: {
                show: !1
            }
        },
        colors: ["#6fbe36", "#ff5d5d"],
        dataLabels: {
            enabled: !1
        },
        stroke: {
            width: [3, 3],
            curve: "straight"
        },
        series: [{
            name: "Ortaça Öndürilen Önüm ",
            data: ['{{production1}}', '{{production2}}', '{{production3}}', '{{production4}}', '{{production5}}', '{{production6}}', '{{production7}}', '{{production8}}', '{{production9}}', '{{production10}}', '{{production11}}', '{{production12}}']
        }, {
            name: "Brak Önüm ",
            data: ['{{production1}}', '{{production2}}', '{{production3}}', '{{production4}}', '{{production5}}', '{{production6}}', '{{production7}}', '{{production8}}', '12312', '{{production10}}', '{{production11}}', '{{production12}}']
        }],
        title: {
            text: "Hasabat",
            align: "left"
        },
        grid: {
            row: {
                colors: ["transparent", "transparent"],
                opacity: .2
            },
            borderColor: "#f1f1f1"
        },
        markers: {
            style: "inverted",
            size: 6
        },
        xaxis: {
            categories: ['Ýanwar', 'Fewral', 'Mart', 'Aprel', 'Maý', 'Iýun', 'Iýul', 'Awgust', 'Sentýabr', 'Oktýabr', 'Noýabr', 'Dekabr'],
            title: {
                text: "Aýlar"
            }
        },
        yaxis: {
            title: {
                text: ""
            }
        },
        legend: {
            position: "top",
            horizontalAlign: "right",
            floating: !0,
            offsetY: -25,
            offsetX: -5
        },
        responsive: [{
            breakpoint: 600,
            options: {
                chart: {
                    toolbar: {
                        show: !1
                    }
                },
                legend: {
                    show: !1
                }
            }
        }]
    },
        chart = new ApexCharts(document.querySelector("#line_chart_datalabel"), options);
    chart.render();
</script>
{% endput %}