This commit is contained in:
Shohrat 2023-11-04 13:35:11 +05:00
parent 262d9e233f
commit 73fe5a9d55
16 changed files with 517 additions and 16 deletions

View File

@ -13,6 +13,7 @@ class Plugin extends PluginBase
'Romanah\Gokbakja\Components\Sewer' => 'sewer',
'Romanah\Gokbakja\Components\Order' => 'order',
'Romanah\Gokbakja\Components\OrderItem' => 'orderItem',
'Romanah\Gokbakja\Components\Journal' => 'journal',
];
}

View File

@ -0,0 +1,144 @@
<?php
namespace Romanah\Gokbakja\Components;
use Cms\Classes\ComponentBase;
use Romanah\Gokbakja\Models\Production as ProductionModel;
use Romanah\Gokbakja\Models\PivotProduction as PivotProductionModel;
use Romanah\Gokbakja\Models\SewerProduction as SewerModel;
use Redirect;
use Carbon\Carbon;
use Flash;
use DB;
use Romanah\Gokbakja\Models\Journal as ModelsJournal;
use Romanah\Gokbakja\Models\ProductionMachine;
use Romanah\Gokbakja\Models\PivotSewer;
class Journal extends ComponentBase
{
public function componentDetails()
{
return [
'name' => 'Journal',
'description' => 'Journal settings'
];
}
public function onModalSetIsRead()
{
$data = post();
$journal = ModelsJournal::where('id', $data["journalId"])
->first();
$oldData = json_decode(json_encode((object) $journal->data), FALSE);;
$html_data = '<div class="modal-header">
<h5 class="modal-title" id="mySmallModalLabel">Žurnal No #' . $journal->id . '</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form data-request="onUpdateJournalItem" method="POST" data-request-flash>
<div class="row">
<div class="col-md-12 mt-3">
<table id="datatable-buttons2" class="table table-striped table-bordered dt-responsive nowrap"
style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
<tr>
<th>#</th>
<th>Ady</th>
<th>Köne Maglumat</th>
<th>Täze Maglumat</th>
</tr>
</thead>
<tr>
<td>1</td>
<td>Görnüş Ady</td>
<td>'.$oldData->old_data->bag_type->name.'</td>
<td>'.$oldData->new_data->bag_type->name.'</td>
</tr>
<tr>
<td>2</td>
<td>Ölçegi</td>
<td>'.$oldData->old_data->bag_size->name.'</td>
<td>'.$oldData->new_data->bag_size->name.'</td>
</tr>
<tr>
<td>3</td>
<td>Enjam</td>
<td>'.$oldData->old_data->machine->name.'</td>
<td>'.$oldData->new_data->machine->name.'</td>
</tr>
<tr>
<td>4</td>
<td>Jogapkär</td>
<td>'.$oldData->old_data->employee->name.'</td>
<td>'.$oldData->new_data->employee->name.'</td>
</tr>
<tr>
<td>5</td>
<td>Mehanik</td>
<td>'.$oldData->old_data->mechanic->name.'</td>
<td>'.$oldData->new_data->mechanic->name.'</td>
</tr>
<tr>
<td>6</td>
<td>Reňki</td>
<td>'.$oldData->old_data->color->name.'</td>
<td>'.$oldData->new_data->color->name.'</td>
</tr>
<tr>
<td>7</td>
<td>Öndürlen önüm (kg)</td>
<td>'.$oldData->old_data->produced_weight.' kg</td>
<td>'.$oldData->new_data->produced_weight.' kg</td>
</tr>
</table>
</div>
</div>';
$html_data .=' <input type="hidden" name="journal_id" value="' . $data["journalId"] . '">';
if(!$journal->is_read){
$html_data .= '<button type="submit" data-bs-dismiss="modal"
class="btn btn-primary waves-effect waves-light"
style="margin-top: 15px;width: 100%;">Okaldy</button>';
}
$html_data .='</form>
</div>';
return [
'#modal-form' => $html_data,
];
}
public function onUpdateJournalItem(){
$data = post();
$journal = ModelsJournal::where('id', $data["journal_id"])->first();
$journal->is_read = 1;
$journal->save();
if($journal){
Flash::success("Hasabat Ustunlikli Okaldy");
return Redirect::refresh();
} else {
Flash::error("Yalnyshlyk bar!!");
return Redirect::refresh();
}
}
}

View File

@ -16,6 +16,7 @@ use DB;
use Romanah\Gokbakja\Models\BagColor;
use Romanah\Gokbakja\Models\BagSize;
use Romanah\Gokbakja\Models\BagType;
use Romanah\Gokbakja\Models\Journal;
use Romanah\Gokbakja\Models\Machine;
use Romanah\Gokbakja\Models\PivotSewer;
@ -442,19 +443,47 @@ class MachineProduction extends ComponentBase
public function onUpdateMachineProduction(){
$data = post();
$updateProductionMachine = ProductionMachineModel::where("id", $data["production_id"])->first();
$updateProductionMachine->type_id = $data["type_id"];
$updateProductionMachine->size_id = $data["size_id"];
$updateProductionMachine->machine_id = $data["machine_id"];
$updateProductionMachine->color_id = $data["color_id"];
$user = \Auth::user();
$data = post();
$oldData = ProductionMachineModel::where("id", $data["production_id"])
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
->first();
$updateProductionMachine = ProductionMachineModel::where("id", $data["production_id"])
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
->first();
$updateProductionMachine->type_id = (int) $data["type_id"];
$updateProductionMachine->size_id = (int) $data["size_id"];
$updateProductionMachine->machine_id = (int) $data["machine_id"];
$updateProductionMachine->color_id = (int) $data["color_id"];
$updateProductionMachine->produced_weight = $data["produced_weight"];
$updateProductionMachine->note = $data["note"];
$updateProductionMachine->date = Carbon::parse($data["date"])->format('Y-m-d');
$contentJournal = array(
"old_data" => $oldData,
"new_data" => $updateProductionMachine,
);
$journal = new Journal();
$journal->type = "ProductionMachine";
$journal->content_id = $data["production_id"];
$journal->user_id = $user->id;
$journal->data = $contentJournal;
$journal->save();
$updateProductionMachine->save();
if ($updateProductionMachine) {
if ($updateProductionMachine && $journal) {
Flash::success("Hasabat Ustunlikli Uytgedildi");
return Redirect::refresh();
} else {

View File

@ -837,6 +837,8 @@ class Order extends ComponentBase
$createShippingTransport->transport_no = $data["transport_no"];
$createShippingTransport->note = $data["note"];
$createShippingTransport->shipping_id = $orderq->shipping_id;
$createShippingTransport->order_id = $orderId;
$createShippingTransport->order_item_id = $data["order_item_id"];
$createShippingTransport->save();
// $html_data = '';

View File

@ -26,6 +26,8 @@ class Journal extends Model
*/
public $table = 'romanah_gokbakja_journal';
public $jsonable = ['data'];
/**
* @var array Validation rules
*/

View File

@ -23,6 +23,10 @@ class ShippingTransport extends Model
'shipping' => [
'Romanah\Gokbakja\Models\Shipping',
'key' => 'shipping_id'
],
'order_item' => [
'Romanah\Gokbakja\Models\OrderItem',
'key' => 'order_item_id'
]
];
/**

View File

@ -27,3 +27,13 @@ fields:
label: Note
span: auto
type: textarea
tabs:
fields:
data:
label: DATA
span: auto
prompt: 'Add new item'
style: default
type: repeater
tab: 'Tab 1'
form: { }

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaJournal extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_journal', function($table)
{
$table->text('data');
});
}
public function down()
{
Schema::table('romanah_gokbakja_journal', function($table)
{
$table->dropColumn('data');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaJournal2 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_journal', function($table)
{
$table->boolean('is_read')->default(0);
});
}
public function down()
{
Schema::table('romanah_gokbakja_journal', function($table)
{
$table->dropColumn('is_read');
});
}
}

View File

@ -0,0 +1,25 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaShippingTransport5 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_shipping_transport', function($table)
{
$table->integer('order_id')->nullable();
$table->integer('order_item_id')->nullable();
});
}
public function down()
{
Schema::table('romanah_gokbakja_shipping_transport', function($table)
{
$table->dropColumn('order_id');
$table->dropColumn('order_item_id');
});
}
}

View File

@ -309,3 +309,12 @@
1.0.104:
- 'Updated table romanah_gokbakja_order_item'
- builder_table_update_romanah_gokbakja_order_item_8.php
1.0.105:
- 'Updated table romanah_gokbakja_journal'
- builder_table_update_romanah_gokbakja_journal.php
1.0.106:
- 'Updated table romanah_gokbakja_journal'
- builder_table_update_romanah_gokbakja_journal_2.php
1.0.107:
- 'Updated table romanah_gokbakja_shipping_transport'
- builder_table_update_romanah_gokbakja_shipping_transport_5.php

View File

@ -80,9 +80,13 @@ items:
isExternal: '0'
-
title: 'Ekstrudor boýunça'
nesting: null
type: url
url: /w
code: ''
reference: null
cmsPage: null
replace: null
viewBag:
isHidden: '0'
cssClass: ri-stack-line
@ -338,4 +342,13 @@ items:
isHidden: '0'
cssClass: ''
isExternal: '0'
-
title: Žurnal
type: cms-page
code: ''
reference: journal
viewBag:
isHidden: '0'
cssClass: ri-chat-history-line
isExternal: '0'
name: aside

View File

@ -17,6 +17,11 @@ function onStart(){
$this["year"] = $currentDate->year;
}
if($year == 'default'){
$year = $currentDate->year;
$this["year"] = $currentDate->year;
}
$this["production1"] = Romanah\Gokbakja\Models\SewerProduction::whereMonth('date', 1)->whereYear('date', $year)->count() ?? 0;

View File

@ -0,0 +1,198 @@
title = "journal"
url = "/journal"
layout = "platform_main"
is_hidden = 0
[journal]
==
<?php
function onStart() {
$this["journals"] = Romanah\Gokbakja\Models\Journal::with('user')->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">
<div class="col-md-12">
<div class="collapse multi-collapse" id="multiCollapseExample1">
<form data-request="onCreateSewerProduction" data-request-flash>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col">
<label class="form-label">Tikinçi Saýlaň</label>
<select class="form-control select2" name="employee_id">
<option value="0">Saýla</option>
</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">
<span class="input-group-text"><i class="mdi mdi-calendar"></i></span>
</div>
</div>
<div class="col-3">
<label class="form-label">Rulon Saýlaň</label>
<select class="form-control select2" name="machine_production_id">
<option value="0">Saýla</option>
</select>
</div>
<div class="col">
<div>
<label class="form-label">Halta Ini</label>
<input type="number" name="width" step="0.01" class="form-control"
placeholder="Halta Ini">
</div>
</div>
<div class="col">
<div>
<label class="form-label">Halta Boýy</label>
<input type="number" name="height" step="0.01" class="form-control"
placeholder="Halta Boýy">
</div>
</div>
<div class="col">
<div>
<label class="form-label">Halta agramy (gr)</label>
<input type="number" step="0.01" name="bag_gram" class="form-control"
placeholder="Halta gramy">
</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>
</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;">Žurnal</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</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 style="width: 5%;"></th>
<th>Üýtgeden Ulanyjy</th>
<th>Üýtgedilen Sene</th>
<th>Maglumat Kody</th>
<th>Bölümi</th>
<th>Sazlamalar</th>
<!-- <th>Настройки</th> -->
</tr>
</thead>
<tbody id="sewer_datas">
{% for key, item in journals %}
<tr>
<td style="font-weight: bold;">{{(key+1)}}</td>
<td><a href="#" style="font-weight: bold;">{{item.user.username}}</a></td>
<td>{{item.created_at|date('d.m.Y | H:i')}}</td>
<td>#{{item.content_id}}</td>
<td>{{item.type}}</td>
<td>
{% if item.is_read %}
<a href="#" data-request="onModalSetIsRead"
data-request-data="journalId: {{item.id}}"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" style="color: orange;"> Okaldy </a>
{% else %}
<a href="#" data-request="onModalSetIsRead"
data-request-data="journalId: {{item.id}}"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" style="color: orange;"> Oka </a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Üýtgeden Ulanyjy</th>
<th>Üýtgedilen Sene</th>
<th>Maglumat Kody</th>
<th>Bölümi</th>
<th>Sazlamalar</th>
</tr>
</tfoot>
</table>
</div>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog"
aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" style="max-width: 1211px;">
<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' %}

View File

@ -25,7 +25,7 @@ function onStart(){
$this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price);
$this["transports"] = Romanah\Gokbakja\Models\ShippingTransport::where("shipping_id", $this["order"]->shipping_id)->with('shipping.order')->orderBy("id", "DESC")->get();
$this["transports"] = Romanah\Gokbakja\Models\ShippingTransport::where("shipping_id", $this["order"]->shipping_id)->with('shipping.order')->with('order_item')->orderBy("id", "DESC")->get();
$this["allLoaded"] = Romanah\Gokbakja\Models\ShippingTransport::where("shipping_id", $this["order"]->shipping_id)->sum("loaded_amount");
@ -87,14 +87,15 @@ function onStart(){
<div class="col">
<label class="form-label">Sargyt Harytlary</label>
<select class="form-control select2" name="order_item_id">
<select class="form-control select2" name="order_item_id" onchange="setLoaded(this.value);">
<option value="0">Saýla</option>
{% for item in orderItems %}
<option value="{{item.id}}">#{{item.id}}
{% if item.order_item_type == 'rulon' %}
Rulon -
Rulon - {{item.amount}} kg
{% else %}
Halta -
Halta - {{item.bag_gram}} gr, {{item.amount}} sany
{% endif %}
@ -153,7 +154,7 @@ function onStart(){
<div class="row">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Sargyt Logistika Maglumatlary</h3>
<p class="card-title-desc" style="color: #6c6ff5;font-size: 17px;" id="all_loaded">Jemi Ýüklenen Ýük: {{allLoaded|number_format(2)}} kg</p>
<p class="card-title-desc" style="color: #6c6ff5;font-size: 17px;" ></p>
</div>
<div class="col-md-6" style="text-align: right;">
{% if order.user_id == user.id %}
@ -170,6 +171,7 @@ function onStart(){
<thead>
<tr>
<th style="width: 5%;"></th>
<th>Haryt</th>
<th>Transport</th>
<th>Şu wagtky ýeri</th>
<th>Ýüklenen Mukdar</th>
@ -185,6 +187,14 @@ function onStart(){
{% for key, transport in transports %}
<tr>
<td style="font-weight: bold;">{{(key+1)}}</td>
<td><a href="#" style="font-weight: bold;">
{% if transport.order_item_type == 'rulon' %}
Rulon, {{transport.order_item.order_item_type}}
{% else %}
Halta, {{transport.order_item.bag_gram}} gr, ini: {{transport.order_item.bag_width}} x boyy: {{transport.order_item.bag_height}}
{% endif %}
</a></td>
<td><a href="#" style="font-weight: bold;">{{transport.transport_type}}</a></td>
<td>{{transport.place_now}}</td>
<td>{{transport.loaded_amount}} kg</td>
@ -222,6 +232,7 @@ function onStart(){
<tfoot>
<tr>
<th style="width: 5%;"></th>
<th>Haryt</th>
<th>Transport</th>
<th>Şu wagtky ýeri</th>
<th>Ýüklenen Mukdar</th>

View File

@ -4,14 +4,16 @@
function onStart()
{
$link = $this->page["url"];
$this["journal"] = Romanah\Gokbakja\Models\Journal::where("is_read", 0)->count();
}
?>
==
<a href="#" class="dropdown d-inline-block">
<a href="/journal" class="dropdown d-inline-block">
<button type="button" class="btn header-item noti-icon waves-effect">
<i class="ri-notification-3-line"></i>
{% if journal > 0 %}
<span class="noti-dot"></span>
{% endif %}
</button>
</a>
</a>