title = "drobika/new"
url = "/drobika/new"
layout = "platform_main"
is_hidden = 0

[drobika]
==
<?php
function onStart(){
    $this["shifts"] = Romanah\Gokbakja\Models\Shift::get();
    $this["products"] = Romanah\Gokbakja\Models\Product::get();

    $this["drobika"] = Romanah\Gokbakja\Models\Drobika::with(['product', 'shift'])->orderBy('id', 'desc')->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" />

<link href="{{'assets/libs/select2/css/select2.min.css'|theme}}" rel="stylesheet" type="text/css">
{% endput %}

<div class="container-fluid">
    <div class="row">
        {% if crudSewerProduction %}
        <div class="col-md-12">
            <div class="collapse multi-collapse" id="multiCollapseExample1">
                <form data-request="onCreateDrobika" data-request-flash>

                    <div class="card">
                        <div class="card-body">
                            <div class="row">
                                <div class="col">
                                    <label class="form-label">Çig mal</label>
                                    <select class="form-control select2" name="product_id">
                                         {% for product in products %}
                                            <option value="{{product.id}}">{{product.code}}</option>
                                         {% endfor %}
                                    </select>
                                </div>

                                <div class="col">
                                    <label class="form-label">Smen Saýlaň</label>
                                    <select class="form-control select2" name="shift_id">
                                        <option value="0">Saýla</option>
                                        {% for shift in shifts %}
                                        <option value="{{shift.id}}">{{shift.desc}}</option>
                                        {% endfor %}
                                    </select>
                                </div>


                                <div class="col">
                                    <label class="form-label">Sene</label>
                                    <div class="input-group" id="datepicker2">
                                        <input type="text" class="form-control" name="date" placeholder="Sene"
                                            data-date-format="d.m.yyyy" data-date-container='#datepicker2' data-provide="datepicker"
                                            data-date-autoclose="true" required>

                                        <span class="input-group-text"><i class="mdi mdi-calendar"></i></span>
                                    </div>
                                </div>

                                <div class="col">
                                    <div>
                                        <label class="form-label">Enjama Goýulan mukdar (kg)</label>

                                        <input type="number" step="0.01" name="amount" class="form-control"
                                            placeholder="Enjama Goýulan mukdar" required>
                                    </div>
                                </div>

                                  <div class="col">
                                    <div>
                                        <label class="form-label">Önen mukdar (kg)</label>

                                        <input type="number" step="0.01" name="produced_weight" class="form-control"
                                            placeholder="Önen mukdar" required>
                                    </div>
                                </div>


                                <div class="col">
                                    <div>
                                        <label class="form-label">Bellik</label>

                                        <input type="text" name="note" class="form-control" placeholder="Bellik">
                                    </div>
                                </div>


                                <div class="col">
                                    <button type="submit" class="btn btn-primary waves-effect waves-light"
                                        style="margin-top: 30px;width: 100%;">Goş</button>
                                </div>

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

                </form>
            </div>
        </div>
        {% endif %}
    </div>

    <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;">Drobika Enjamy</h3>
                            <p class="card-title-desc" style="color: #6c6ff5;">Hasabaty</p>
                        </div>
                        <div class="col-md-6" style="text-align: right;">
                            {% if crudSewerProduction %}
                            <a class="btn btn-primary" data-bs-toggle="collapse" href="#multiCollapseExample1"
                                role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Täze
                                Maglumat</a>
                            {% endif %}
                        </div>
                    </div>

                    <!-- <h1>{{machineProductions}}</h1> -->

                    <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>No</th>
                                <th>Çig mal</th>
                                <th>Smen</th>
                                <th>Sene</th>
                                <th>Goýulan mukdar (kg)</th>
                                <th>Önen Mukdar (kg)</th>
                                <th>Bellik</th>
                                <th>Sazlamalar</th>
                                <!--  <th>Настройки</th> -->
                            </tr>
                        </thead>
                        <tbody id="sewer_datas">

                            {% for key, drobika in drobika %}
                                <tr>
                                    <td>{{key+1}}</td>
                                    <td style="font-weight: bold;color: #0005c5;">{{drobika.product.code}}</td>
                                    <td>{{drobika.shift.desc}}</td>
                                    <td>{{drobika.date|date('d.m.Y')}}</td>
                                    <td><span class="badge badge-soft-primary"
                                        style="font-size: 14px;">{{drobika.amount|number_format}} kg</span></td>
                                    <td> <span class="badge badge-soft-success"
                                        style="font-size: 14px;">{{drobika.produced_weight|number_format}} kg</span></td>
                                    <td>{{drobika.note}}</td>
                                    <td>
                                        <div style="display: flex;justify-content: center;">
                                            <div style="margin-right: 10px;">
                                                <a type="button" data-request="onModalSetDrobika"
                                                data-request-data="id: {{drobika.id}}"
                                                    data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1"
                                                    class="btn btn-warning waves-effect waves-light"
                                                    style="padding-top: 5px;padding-bottom: 5px;">
                                                    <i class="ri-pencil-line align-middle me-2"></i> Täzele
                                                </a>
                                            </div>
                                            <div>
                                                <a type="button"
                                                    data-request="onDeleteDrobika"
                                                    data-request-data="id: {{drobika.id}}"
                                                    data-request-confirm="#Drobika{{drobika.id}}  pozmak isleýäňizmi?"
                                                    class="btn btn-danger waves-effect waves-light"
                                                    style="padding-top: 5px;padding-bottom: 5px;">
                                                    <i class="ri-close-line align-middle me-2"></i> Poz
                                                </a>
                                            </div>
                                        </div>
                                    </td>
                                    <!--  <th>Настройки</th> -->
                                </tr>
                            {% endfor %}

                        </tbody>
                        <tfoot>
                             <tr>
                                <th>No</th>
                                <th>Çig mal</th>
                                <th>Smen</th>
                                <th>Sene</th>
                                <th>Goýulan mukdar</th>
                                <th>Önen Mukdar</th>
                                <th>Bellik</th>
                                <th>Sazlamalar</th>
                                <!--  <th>Настройки</th> -->
                            </tr>
                        </tfoot>
                    </table>
                </div>

                <div class="modal fade bs-example-modal-sm-1" tabindex="-1" role="dialog"
                    aria-labelledby="mySmallModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content" id="modal-form">



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

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

{% put scripts %}
<script src="{{'assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js'|theme}}"></script>
<script src="{{'assets/libs/select2/js/select2.min.js'|theme}}"></script>
<script src="{{'assets/js/pages/form-advanced.init.js'|theme}}"></script>


{% endput %}
{% partial 'dataTableJs' %}
