g_sto/themes/gokbakja/pages/actions/rulon.htm

251 lines
12 KiB
HTML

title = "actions/rulon"
url = "/actions/rulon/:type?"
layout = "platform_main"
is_hidden = 0
[rulonAction]
==
<?php
function onStart(){
$type = $this->param("type");
$this["type"] = $this->param("type");
//$this["products"] = '';
//dump($catId);
$this["stocksq"] = Romanah\Gokbakja\Models\Stock::orderBy("id", "desc")->where("type", 'rulon')->get();
if($type){
$this["actions"] = Romanah\Gokbakja\Models\RulonAction::orderBy("id", "desc")
->with(['stock', 'product'])
->where("type", $type)
->get();
}else{
$this["actions"] = Romanah\Gokbakja\Models\RulonAction::orderBy("id", "desc")
->with(['stock', 'product'])
->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">
<link href="{{'assets/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css'|theme}}" rel="stylesheet">
<link href="{{'assets/libs/spectrum-colorpicker2/spectrum.min.css'|theme}}" rel="stylesheet" type="text/css">
<link href="{{'assets/libs/bootstrap-touchspin/jquery.bootstrap-touchspin.min.css'|theme}}" rel="stylesheet">
{% endput %}
{% set products = builderList.records %}
{% set stocks = builderList2.records %}
<div class="row">
<div class="col-12">
<div class="alert alert-info" role="alert">
Direktor bilen Bugalter tassyklamadyk bolsa sklat-da hasaba goşulmaz.
</div>
</div>
<div class="col-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;">Rulon Sklad Hereketleri</h3>
<p class="card-title-desc" style="color: #6c6ff5;">{{type}}</p>
</div>
</div>
<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>Haryt</th>
<th>Görnüşi</th>
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
</thead>
<tbody>
{% for key, record in actions %}
<tr>
<td style="font-weight: bold;width: 5%;">{{key + 1}}</td>
<td><a href="/machine" style="font-weight: bold;color: #0005c5;">#Rulon{{record.product_id}}</a></td>
<td style="text-align: center;">
<span
class="badge badge-soft-{% if record.type == 'inbox' %}success {% else %}danger {% endif %}"
style="font-size: 14px;">{% if record.type == 'inbox' %} GIRIŞ {% else %} ÇYKYŞ {% endif %}</span>
</td>
<td style="color: #500101;font-weight: bold;">{{record.amount|number_format(2)}} kg</td>
<td>{{record.created_at|date('d.m.Y')}}</td>
<td>{{record.stock.name}}</td>
<!-- <td style="color: {% if record.status_director == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_director == 'accept' %} + {% else %}<a href="#" data-request="onApproveAction" data-request-data="user_type: 'director', id: {{record.id}}" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td>
<td style="color: {% if record.status_accountant == 'accept' %}darkgreen {% else %}darkred {% endif %};">{% if record.status_accountant == 'accept' %} + {% else %} <a href="#" data-request="onApproveAction" data-request-data="user_type: 'accountant', id: {{record.id}}'" style="color: darkred;" data-request-confirm="Tassyklamak isleyarsinizmi?"> Tassyklanmadyk </a> {% endif %}</td> -->
<td>{{record.note}}</td>
<td>
<div style="display: flex;justify-content: center;">
{% if crudProductionRulon %}
{% if record.user_id != user.id %}
<div style="margin-right: 10px;">
<a type="button"
class="btn btn-warning waves-effect waves-light"
style="padding-top: 5px;padding-bottom: 5px;">
<i class="ri-user-line align-middle me-2"></i> Size degişli däl
</a>
</div>
{% else %}
<div style="margin-right: 10px;">
<a onClick="getData({{record.id}});" type="button"
class="btn btn-warning waves-effect waves-light" data-bs-toggle="offcanvas"
data-bs-target="#offcanvasBottom" aria-controls="offcanvasBottom"
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-confirm="Вы уверены? Удалить этот продукт"
data-request-data="id:{{record.id}}" data-request="onDeleteAction"
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>
{% endif %}
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Haryt</th>
<th>Görnüşi</th>
<th>Mukdary (KG)</th>
<th>Senesi</th>
<th>Sklad</th>
<!-- <th>Direktor</th>
<th>Bugalter</th> -->
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
</tfoot>
</table>
</div>
<div class="offcanvas offcanvas-top" id="offcanvasBottom" aria-labelledby="offcanvasBottomLabel"
style="height: 40%;">
<div class="offcanvas-header">
<h5 id="offcanvasBottomLabel">Täze Hereket</h5>
<button onClick="createData();" type="button" class="btn-close text-reset"
data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<form class="needs-validation" novalidate data-request="onCreateAction" id="prodForm">
<div class="row">
<!-- <div class="col-md-4">
<div class="mb-3">
<label for="validationCustom02" class="form-label">Mukdary</label>
<input type="number" class="form-control" id="validationCustom02"
placeholder="Mukdary" name="quantity" required>
<div class="valid-feedback">
dogry
</div>
</div>
</div>
<div class="col-md-4">
<label for="validationCustom03" class="form-label">Sklad</label>
<select class="form-control select2" name="stock_id" id="stockId">
<option value="0">Saýla</option>
{% for record in stocksq %}
<option value="{{record.id}}" style="text-transform: capitalize;">{{record.name}}
</option>
{% endfor %}
</select>
</div> -->
<div class="col-md-4">
<div class="mb-3">
<label for="validationCustom02" class="form-label">Bellik</label>
<input type="text" class="form-control" id="validationCustom02" placeholder="Bellik"
name="note">
</div>
</div>
</div>
<input name="id" type="hidden" value="">
<div>
<button class="btn btn-primary" type="submit" id="formBtn">Goş</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% put scripts %}
<script>
function createData() {
$('#prodForm').attr('data-request', 'onCreateAction');
$('#formBtn').html('Goş');
$('input[name=id]').val('');
$("#productId").select2().val(0).trigger("change");
$('input[name=quantity]').val('');
$('input[name=note]').val('');
$("#stockId").select2().val(0).trigger("change");
}
function getData(id) {
$(this).request('onGetAction', {
data: { id: id },
success: function (data) {
$('#prodForm').attr('data-request', 'onUpdateAction');
$('#formBtn').html('Täzele');
$('input[name=id]').val(data.id);
$("#productId").select2().val(data.product_id).trigger("change");
$('input[name=quantity]').val(data.amount);
$('input[name=note]').val(data.note);
$("#stockId").select2().val(data.stock_id).trigger("change");
}
});
};
</script>
<script src="{{'assets/libs/select2/js/select2.min.js'|theme}}"></script>
<script src="{{'assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js'|theme}}"></script>
<script src="{{'assets/libs/spectrum-colorpicker2/spectrum.min.js'|theme}}"></script>
<script src="{{'assets/libs/bootstrap-touchspin/jquery.bootstrap-touchspin.min.js'|theme}}"></script>
<script src="{{'assets/libs/admin-resources/bootstrap-filestyle/bootstrap-filestyle.min.js'|theme}}"></script>
<script src="{{'assets/libs/bootstrap-maxlength/bootstrap-maxlength.min.js'|theme}}"></script>
<script src="{{'assets/js/pages/form-advanced.init.js'|theme}}"></script>
{% endput %}
{% partial 'dataTableJs' %}