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

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

    if($this["month"] != "default"){
        $this["month"] = $this->param("month");
    }else{
        $this["month"] = $currentDate->format('m');
    }

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

    $this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->groupBy(DB::raw("DAY(created_at)"))->withCount(['pivot_production'])->get();

    if($year){
        $this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $this["month"])->whereYear('created_at', $year)->groupBy(DB::raw("DAY(created_at)"))->with(['pivot_production'])->get();
    }else{
        $this["productions"] = Romanah\Gokbakja\Models\Production::whereMonth('created_at', $currentDate->format('m'))->whereYear('created_at', $currentDate->year)->groupBy(DB::raw("DAY(created_at)"))->with(['pivot_production'])->get();
    }

}
?>
==
{% 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">

    <!-- start page title -->
    <div class="row">
        <div class="col-12">
            <div class="page-title-box d-flex align-items-center justify-content-between">
                <h4 class="mb-0">Aýlar Boýunça {{year}}</h4>

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

    <div class="row">
        <div class="col-12">
            <!-- Left sidebar -->
            <div class="email-leftbar card">
                <a href="/excruiters" type="button" class="btn btn-danger waves-effect waves-light">
                    Täze Hasabat
                </a>
                <div class="mail-list mt-4">
                    <a href="/all-productions/1" class="{{ month == 1 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Ýanwar</a>
                    <a href="/all-productions/2" class="{{ month == 2 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Fewral</a>
                    <a href="/all-productions/3" class="{{ month == 3 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Mart</a>
                    <a href="/all-productions/4" class="{{ month == 4 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Aprel</a>
                    <a href="/all-productions/5" class="{{ month == 5 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Maý</a>
                    <a href="/all-productions/6" class="{{ month == 6 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Iýun</a>
                    <a href="/all-productions/7" class="{{ month == 7 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Iýul</a>
                    <a href="/all-productions/8" class="{{ month == 8 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Awgust</a>
                    <a href="/all-productions/9" class="{{ month == 9 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Sentýabr</a>
                    <a href="/all-productions/10" class="{{ month == 10 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Oktýabr</a>
                    <a href="/all-productions/11" class="{{ month == 11 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Noýabr</a>
                    <a href="/all-productions/12" class="{{ month == 12 ? 'active' : '' }}"><i
                            class="mdi mdi-archive me-2 font-size-16"></i> Dekabr</a>

                </div>



            </div>
            <!-- End Left sidebar -->


            <!-- Right Sidebar -->
            <div class="email-rightbar mb-3">

                <div class="card">




                    <div class="card-body">
                        <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap"
                            style="border-collapse: collapse; border-spacing: 0; width: 100%;">
                            <thead>
                                <tr>
                                    <th style="width: 5%;">№</th>
                                    <th>Senesi</th>
                                    <th>Hemmesi</th>
                                    <th>Çig Mal Sany</th>
                                    <th>Bellik</th>
                                    <!--  <th>Настройки</th> -->
                                </tr>
                            </thead>
                            <tbody>

                                {% for key, report in productions %}
                                <tr>
                                    <td style="font-weight: bold;width: 5%;">{{key + 1}}</td>
                                    <td><a href="/get-production/{{report.id}}"
                                            style="font-weight: bold;color: #0005c5;">{{report.created_at|date('d.m.Y |
                                            H:i')}}</a></td>
                                    <td style="text-align: center;">
                                        <span class="badge badge-soft-success"
                                            style="font-size: 14px;">{{report.all_amount|number_format}} kg</span>
                                    </td>

                                    <td>{{report.pivot_production_count}}</td>
                                    <td style="font-weight: bold;color: #0005c5;">{{report.note}}</td>
                                </tr>
                                {% endfor %}

                            </tbody>
                            <tfoot>
                                <tr>
                                    <th style="width: 5%;">№</th>
                                    <th>Senesi</th>
                                    <th>Hemmesi</th>
                                    <th>Çig Mal Sany</th>
                                    <th>Bellik</th>
                                </tr>
                            </tfoot>
                        </table>

                    </div>

                </div> <!-- card -->

            </div>

        </div>
    </div>
    <!-- End row -->
</div>


{% partial 'dataTableJs' %}
