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

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

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

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

    $sewerIds = Romanah\Gokbakja\Models\SewerProduction::whereYear('date', $this["year"])->get()->pluck("id")->toArray();

    $this["all_amount_total"] = Romanah\Gokbakja\Models\PivotSewer::whereIn("sewer_production_id", $sewerIds)->sum("spent_amount");

    $this["all_bag_qty_total"] = Romanah\Gokbakja\Models\SewerProduction::whereYear('date', $this["year"])
                            ->sum('produced_bag_qty');

}
?>
==
{% put styles %}
<link href="{{'assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css'|theme}}" rel="stylesheet"
    type="text/css" />
<link href="{{'assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css'|theme}}" rel="stylesheet"
    type="text/css" />
<link href="{{'assets/libs/datatables.net-select-bs4/css/select.bootstrap4.min.css'|theme}}" rel="stylesheet"
    type="text/css" />
{% endput %}


<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6">
                            <h3 class="card-title" style="font-size: 22px;color: #1e2038;">Tikinçiler boýunça ({{year}} ýyl)</h3>
                            <p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
                        </div>
                        <div class="col-md-3">
                            <div class="card bg-info text-white-50">
                                <div class="card-body">
                                    <h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Dikilen Halta: {{all_bag_qty_total|number_format}} sany</h5>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="card bg-info text-white-50">
                                <div class="card-body">
                                    <h5 class="text-white" style="text-transform: uppercase;margin-bottom: 0;"><i class="mdi mdi-bullseye-arrow me-3"></i> Jemi Sarp Edilen Çig mal: {{all_amount_total|number_format}} kg</h5>
                                </div>
                            </div>
                        </div>
                    </div>


                    <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap"
                        style="border-collapse: collapse; border-spacing: 0; width: 100%;" data-page-length='13'>
                        <thead>
                            <tr>
                                <th style="width: 5%;">№</th>
                                <th>Aýlar</th>
                                <th>Sarp Edilen  Çig Mal</th>
                                <th>Öndürlen Halta Sany</th>

                                <!--  <th>Настройки</th> -->
                            </tr>
                        </thead>
                        <tbody>


                            {% partial 'sewer/row' title="Ýanwar" no=1  %}
                            {% partial 'sewer/row' title="Fewral" no=2  %}
                            {% partial 'sewer/row' title="Mart" no=3  %}
                            {% partial 'sewer/row' title="Aprel" no=4  %}
                            {% partial 'sewer/row' title="Maý" no=5  %}
                            {% partial 'sewer/row' title="Iýun" no=6  %}
                            {% partial 'sewer/row' title="Iýul" no=7  %}
                            {% partial 'sewer/row' title="Awgust" no=8  %}
                            {% partial 'sewer/row' title="Sentýabr" no=9  %}
                            {% partial 'sewer/row' title="Oktýabr" no=10  %}
                            {% partial 'sewer/row' title="Noýabr" no=11  %}
                            {% partial 'sewer/row' title="Dekabr" no=12  %}


                        </tbody>
                        <tfoot>
                            <tr>
                                <th style="width: 5%;">№</th>
                                <th>Aýlar</th>
                                <th>Sarp Edilen  Çig Mal</th>
                                <th>Öndürlen Halta Sany</th>
                            </tr>
                        </tfoot>
                    </table>
                </div>



            </div>
        </div>
    </div>
</div>


{% partial 'dataTableJs' %}
