g_sto/themes/gokbakja/pages/machine/all-production-machine-mont...

152 lines
6.7 KiB
HTML

title = "All production machine by month group"
url = "/all-production-machine-month/:month/:year?"
layout = "platform_main"
is_hidden = 0
==
<?php
function onStart() {
$currentDate = Carbon\Carbon::now();
$this["month"] = $this->param("month");
$year = $this->param("year");
if($this["month"] == 'default'){
$this["month"] = $currentDate->month;
}
if($year){
$this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])->whereYear('created_at', $year)->groupBy(DB::raw("DAY(created_at)"))->get();
$this["month_all_amount"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])
->whereYear('created_at', $year)
->sum('produced_weight');
}else{
$this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])->whereYear('created_at', $currentDate->year)->groupBy(DB::raw("DAY(created_at)"))->addSelect(DB::raw("*, SUM(produced_weight) as produced_weight"))->get();
$this["month_all_amount"] = Romanah\Gokbakja\Models\ProductionMachine::whereMonth('created_at', $this["month"])
->whereYear('created_at', $currentDate->year)
->sum('produced_weight');
}
}
?>
==
{% 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="/machine" type="button" class="btn btn-danger waves-effect waves-light">
Täze Hasabat
</a>
<div class="mail-list mt-4">
<a href="/all-production-machine-month/1" class="{{ month == 1 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Ýanwar</a>
<a href="/all-production-machine-month/2" class="{{ month == 2 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Fewral</a>
<a href="/all-production-machine-month/3" class="{{ month == 3 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Mart</a>
<a href="/all-production-machine-month/4" class="{{ month == 4 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Aprel</a>
<a href="/all-production-machine-month/5" class="{{ month == 5 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Maý</a>
<a href="/all-production-machine-month/6" class="{{ month == 6 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Iýun</a>
<a href="/all-production-machine-month/7" class="{{ month == 7 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Iýul</a>
<a href="/all-production-machine-month/8" class="{{ month == 8 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Awgust</a>
<a href="/all-production-machine-month/9" class="{{ month == 9 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Sentýabr</a>
<a href="/all-production-machine-month/10" class="{{ month == 10 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Oktýabr</a>
<a href="/all-production-machine-month/11" class="{{ month == 11 ? 'active' : '' }}"><i
class="mdi mdi-archive me-2 font-size-16"></i> Noýabr</a>
<a href="/all-production-machine-month/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%;" data-page-length='80'>
<thead>
<tr>
<th style="width: 5%;"></th>
<th>Sene</th>
<th>Önen Önüm</th>
<!-- <th>Настройки</th> -->
</tr>
</thead>
<tbody>
{% for key, machine in machineProductions %}
<tr>
<td style="font-weight: bold;">{{key + 1}}</td>
<td><a href="/get-production-machine/{{machine.id}}" style="font-weight: bold;">{{machine.created_at|date("d.m.Y")}}</a></td>
<td>{{machine.produced_weight|number_format}} kg</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Sene</th>
<th>Önen Önüm</th>
</tr>
</tfoot>
</table>
</div>
</div> <!-- card -->
</div>
</div>
</div>
<!-- End row -->
</div>
{% partial 'dataTableJs' %}