This commit is contained in:
Shohrat 2023-10-24 03:37:45 +05:00
parent a2aa82e934
commit 094d0c6cc8
18 changed files with 44471 additions and 89 deletions

43884
gok_bakja_stock_23_10.sql Normal file

File diff suppressed because one or more lines are too long

View File

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

View File

@ -27,6 +27,75 @@ class MachineProduction extends ComponentBase
];
}
public function onModalSetMachineData()
{
$data = post();
$machinProdId = $data["machineProdId"];
$productions = PivotSewer::where("machine_production_id", $machinProdId)->with(["sewer_production", "machin_production"])->get();
$allBagQty = 0;
$allSpent = 0;
$allLeft = 0;
$html_data = '<div class="modal-header">
<h5 class="modal-title" id="mySmallModalLabel">#Rulon'.$machinProdId.' Agramy: '.$productions[0]->machin_production->produced_weight.' kg</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<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>#Rulon Kody</th>
<th>#Dikiş Kody</th>
<th>Dikiş Senesi</th>
<th>Dikilen Halta Mukdary</th>
<th>Mukdary (kg)</th>
<th>Ulanylan (kg)</th>
<th>Galyndy (kg)</th>
<th>Status</th>
</tr>
</thead>
';
for ($x = 0; $x < count($productions); $x++) {
$allBagQty += $productions[$x]->sewer_production->produced_bag_qty;
$allSpent += $productions[$x]->spent_amount;
$allLeft += $productions[$x]->left_amount;
$html_data .='<tr>
<td>'.($x+1).'</td>
<td>#Rulon'.$productions[$x]->machine_production_id.'</td>
<td>#Dikiş'.$productions[$x]->sewer_production_id.'</td>
<td>' . ($productions[$x]->sewer_production->date == null ? "" : Carbon::parse($productions[$x]->sewer_production->date)->format('d.m.Y')) . '</td>
<td>' . ($productions[$x]->sewer_production->produced_bag_qty) . '</td>
<td>'.$productions[$x]->amount.' kg</td>
<td>'.$productions[$x]->spent_amount.' kg</td>
<td>'.$productions[$x]->left_amount.' kg</td>
<td>'.$productions[$x]->status.'</td>
</tr>';
}
$html_data .='<tr style="background: #a2a9ff !important;">
<td colspan="4" style="font-weight: 700;color: black;">JEMI</td>
<td style="font-weight: 700;color: black;">'.$allBagQty.' sany</td>
<td></td>
<td style="font-weight: 700;color: black;">'.$allSpent.' kg</td>
<td style="font-weight: 700;color: black;"></td>
<td></td>
</tr>';
$html_data .='</table></div>';
return [
'#modal-form' => $html_data,
];
}
public function onRender()
{
@ -42,7 +111,9 @@ class MachineProduction extends ComponentBase
// dd($machineProductions[0]->bag_size);
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td style="font-weight: bold;"> #' . ($machineProductions[$x]->id) . '</td>
<td style="font-weight: bold;"><a type="button" data-request="onModalSetMachineData"
data-request-data="machineProdId: ' . $machineProductions[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg"> #Rulon' . ($machineProductions[$x]->id) . '</a></td>
<td><a href="#">' . ($machineProductions[$x]->date == null ? "" : Carbon::parse($machineProductions[$x]->date)->format('d.m.Y')) . '</a></td>
<td><a href="#" style="font-weight: bold;">' . $machineProductions[$x]->building_name . '</a></td>
<td>' . $machineProductions[$x]->machine->name . '</td>
@ -174,7 +245,9 @@ class MachineProduction extends ComponentBase
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td style="font-weight: bold;"> #' . $machineProductionsFiltered[$x]->id . '</td>
<td style="font-weight: bold;"><a type="button" data-request="onModalSetMachineData"
data-request-data="machineProdId: ' . $machineProductionsFiltered[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg"> #Rulon' . $machineProductionsFiltered[$x]->id . '</a></td>
<td><a href="#" style="font-weight: bold;">' . $dateFormat . '</a></td>
<td><a href="#" style="font-weight: bold;">' . $machineProductionsFiltered[$x]->building_name . '</a></td>
<td>' . $machineProductionsFiltered[$x]->machine->name . '</td>

View File

@ -1133,58 +1133,20 @@ class Order extends ComponentBase
$createOrderItem = new OrderItemModel();
$createOrderItem->amount = $data["amount"];
$createOrderItem->order_item_type = $data["order_item_type"];
$createOrderItem->order_id = $orderId;
$createOrderItem->type_id = $data["type_id"];
$createOrderItem->size_id = $data["size_id"];
$createOrderItem->color_id = $data["color_id"];
$createOrderItem->bag_width = $data["bag_width"];
$createOrderItem->bag_height = $data["bag_height"];
$createOrderItem->price = $data["price"];
$createOrderItem->note = $data["note"];
$createOrderItem->save();
$html_data = '';
$orderDatas = OrderItemModel::with(["type", "size"])->where("order_id", $orderId)->orderBy('id', 'DESC')->get();
for ($x = 0; $x < count($orderDatas); $x++) {
// dd($orderDatas[$x]->shipping->status);
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td><a href="#" style="font-weight: bold;">' . $orderDatas[$x]->type->name . '</a></td>
<td>' . $orderDatas[$x]->size->name . '</td>
<td><a href="#" data-request="onModalSet"
data-request-data="orderItemId: ' . $orderDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1"
class="badge badge-soft-success"
style="font-size: 14px;">' . number_format($orderDatas[$x]->price) . ' $</a>
</td>
<td><a href="#" data-request="onModalSetAmount"
data-request-data="orderItemId: ' . $orderDatas[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1">' . $orderDatas[$x]->amount . '</a></td>
<td>' . $orderDatas[$x]->note . '</td>
</tr>';
}
$order = OrderModel::where("id", $orderId)->with(["client", "shipping"])
->withCount(['order_items as order_all_amount' => function ($query) {
$query->select(DB::raw('sum(amount)'));
}])
->withCount(['order_items as order_all_price' => function ($query) {
$query->select(DB::raw('sum(price)'));
}])
->first();
$all = ($order->order_all_amount * $order->order_all_price);
if ($createOrderItem) {
Flash::success("Sargyt Harydy Ustunlikli Goşuldy");
return [
'#order_item_datas' => $html_data,
'#allAmount' => $order->order_all_amount . " kg",
'#allPrice' => $order->order_all_price . " $",
'#all' => "Jemi Bahasy: " . number_format($all) . " $",
];
} else {
return Flash::error("Yalnyshlyk bar!!");
return Redirect::refresh();
}
}

View File

@ -0,0 +1,302 @@
<?php
namespace Romanah\Gokbakja\Components;
use Cms\Classes\ComponentBase;
use Romanah\Gokbakja\Models\ProductionMachine as ProductionMachineModel;
use Romanah\Gokbakja\Models\Order as OrderModel;
use Romanah\Gokbakja\Models\OrderItem as OrderItemModel;
use Romanah\Gokbakja\Models\SewerProduction as SewerModel;
use Redirect;
use Carbon\Carbon;
use Flash;
use DB;
use October\Rain\Support\Facades\Flash as FacadesFlash;
class OrderItem extends ComponentBase
{
public function componentDetails()
{
return [
'name' => 'OrderItem',
'description' => 'OrderItem settings'
];
}
public function onRender()
{
$orderId = $this->param("orderId");
$html_data = '';
$orderItems = OrderItemModel::where("order_id", $orderId)->orderBy("id", "DESC")->with(["type", "size", "color"])->get();
//dd($orderItems);
for ($x = 0; $x < count($orderItems); $x++) {
$calcAmount = ($orderItems[$x]->amount * $orderItems[$x]->price);
$stockCalc = 0;
$notCompleteCalc = 0;
if ($orderItems[$x]->order_item_type == 'rulon'){
$machineProductionsFiltered = ProductionMachineModel::where("type_id", $orderItems[$x]->type_id)
->where("size_id", $orderItems[$x]->size_id)
->where("color_id", $orderItems[$x]->color_id)
->withCount([
'pivot_sewer AS leftSum' => function ($query) {
$query->select(DB::raw("(amount - SUM(spent_amount)) as leftSum"))->where('status', 'complated');
}
])
->withCount([
'pivot_sewer AS spentSum' => function ($query) {
$query->select(DB::raw("(SUM(spent_amount)) as spentSum"))->where('status', 'complated');
}
])
->get();
if($machineProductionsFiltered != null){
for ($i = 0; $i < count($machineProductionsFiltered); $i++) {
$left = ($machineProductionsFiltered[$i]->produced_weight - $machineProductionsFiltered[$i]->spentSum);
$stockCalc += $left;
}
if($stockCalc > $orderItems[$x]->amount){
$notCompleteCalc = 'artykmaç';
}else{
$notCompleteCalc = number_format(($orderItems[$x]->amount - $stockCalc),2).' kg';
}
}else{
$stockCalc = 0;
}
// $stockCalc = number_format(($sumOfProduced - $prodMachine[0]->spentSum),2);
}else{
$colorId = $orderItems[$x]->color_id;
$sewerProductions = SewerModel::where("width", $orderItems[$x]->bag_width)
->where("height", $orderItems[$x]->bag_height)
->with("machin_production")
->whereHas('machin_production', function ($query) use($colorId) {
$query->where('color_id', $colorId);
})
->sum("produced_bag_qty");
$stockCalc= $sewerProductions;
if($stockCalc > $orderItems[$x]->amount){
$notCompleteCalc = 'artykmaç';
}else{
$notCompleteCalc = number_format(($orderItems[$x]->amount - $stockCalc),2).' sany';
}
}
$html_data .= '<tr>
<td style="font-weight: bold;">'.($x+1).'</td>
<td><a href="#" style="font-weight: bold;">';
if ($orderItems[$x]->order_item_type == 'rulon'){
$html_data .= 'Rulon, '.$orderItems[$x]->type->name ?? "" .','. $orderItems[$x]->color->name ?? "";
}else{
$html_data .= 'Halta, '. $orderItems[$x]->color->name ?? "";
}
$html_data .='</a></td>
<td>';
if ($orderItems[$x]->order_item_type == 'rulon'){
$html_data .= $orderItems[$x]->size->name ?? "";
}else{
$html_data .= 'Ini: '.$orderItems[$x]->bag_width.' Boýy: '.$orderItems[$x]->bag_height;
}
$html_data .='</td>
<td><a href="#" data-request="onModalSet"
data-request-data="orderItemId: '.$orderItems[$x]->id.'"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1"
class="badge badge-soft-success"
style="font-size: 14px;">'.number_format($orderItems[$x]->price).' $</a>
</td>
<td><a href="#" data-request="onModalSetAmount"
data-request-data="orderItemId: '.$orderItems[$x]->id.'"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1">'.$orderItems[$x]->amount;
if ($orderItems[$x]->order_item_type == 'rulon'){
$html_data .=' kg';
}else{
$html_data .=' sany';
}
$html_data .= '</a></td>
<td>
'.number_format($calcAmount, 2).' $
</td>
<td>
'.number_format($stockCalc, 2);
if ($orderItems[$x]->order_item_type == 'rulon'){
$html_data .=' kg';
}else{
$html_data .=' sany';
}
$html_data .= '</td>
<td>'.$notCompleteCalc.'</td>
<td>'.$orderItems[$x]->note.'</td>
<td><a href="#" data-request="onDeleteOrder" data-request-confirm="Sargyt Haryt #' . $orderItems[$x]->id . ' pozmak isleýäňizmi?" data-request-data="orderItemId: ' . $orderItems[$x]->id . '" style="color: darkred;font-weight: bold;">POZ</a></td>
</tr>';
}
return $html_data;
}
public function onModalSet()
{
$data = post();
$orderItem = OrderItemModel::where("id", $data["orderItemId"])->first();
$html_data = '<div class="modal-header">
<h5 class="modal-title" id="mySmallModalLabel">Sargyt Haryt Bahasy</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form data-request="onUpdateOrderItemPrice" method="POST" data-request-flash>
<input type="number" step="0.01" pattern="/^-?\d+\.?\d*$/"
onKeyPress="if(this.value.length==4) return false;"
name="price" class="form-control"
placeholder="%"
value="' . $orderItem->price . '">
<input type="hidden" name="id" value="' . $data["orderItemId"] . '">
<button type="submit"
class="btn btn-primary waves-effect waves-light"
data-bs-dismiss="modal"
style="margin-top: 15px;width: 100%;">Üýtget</button>
</form>
</div>';
return [
'#modal-form' => $html_data,
];
}
public function onModalSetAmount()
{
$data = post();
$orderItem = OrderItemModel::where("id", $data["orderItemId"])->first();
$html_data = '<div class="modal-header">
<h5 class="modal-title" id="mySmallModalLabel">Sargyt Mukdary</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form data-request="onUpdateOrderItemAmount" method="POST" data-request-flash>
<input type="number" step="0.01" pattern="/^-?\d+\.?\d*$/"
onKeyPress="if(this.value.length==4) return false;"
name="amount" class="form-control"
placeholder=""
value="' . $orderItem->amount . '">
<input type="hidden" name="id" value="' . $data["orderItemId"] . '">
<button type="submit"
class="btn btn-primary waves-effect waves-light"
data-bs-dismiss="modal"
style="margin-top: 15px;width: 100%;">Üýtget</button>
</form>
</div>';
return [
'#modal-form' => $html_data,
];
}
public function onUpdateOrderItemAmount()
{
// $this["currentMonth"] = $currentDate->format('m');
$data = post();
$orderItem = OrderItemModel::where("id", $data["id"])->first();
$orderItem->amount = (float) $data["amount"];
$orderItem->save();
if ($orderItem) {
Flash::success("Sargyt Harydy Ustunlikli Uytgedildi");
return Redirect::refresh();
} else {
return Flash::error("Yalnyshlyk bar!!");
}
}
public function onUpdateOrderItemPrice()
{
// $this["currentMonth"] = $currentDate->format('m');
$data = post();
$orderItem = OrderItemModel::where("id", $data["id"])->first();
$orderItem->price = (float) $data["price"];
$orderItem->save();
if ($orderItem) {
Flash::success("Sargyt Harydy Ustunlikli Uytgedildi");
return Redirect::refresh();
} else {
return Flash::error("Yalnyshlyk bar!!");
}
}
public function onCreateOrderItem()
{
$data = post();
$orderId = $this->param("orderId");
$createOrderItem = new OrderItemModel();
$createOrderItem->amount = $data["amount"];
$createOrderItem->order_item_type = $data["order_item_type"];
$createOrderItem->order_id = $orderId;
$createOrderItem->type_id = $data["type_id"];
$createOrderItem->size_id = $data["size_id"];
$createOrderItem->color_id = $data["color_id"];
$createOrderItem->bag_width = $data["bag_width"];
$createOrderItem->bag_height = $data["bag_height"];
$createOrderItem->price = $data["price"];
$createOrderItem->note = $data["note"];
$createOrderItem->save();
if ($createOrderItem) {
Flash::success("Sargyt Harydy Ustunlikli Goşuldy");
return Redirect::refresh();
}
}
public function onDeleteOrder()
{
$data = post();
$orderItem = OrderItemModel::where("id", $data["orderItemId"])->delete();
if ($orderItem) {
Flash::success("Sargyt Ustunlikli Pozuldy");
return Redirect::refresh();
} else {
return Flash::error("Yalnyshlyk bar!!");
}
}
}

View File

@ -39,8 +39,6 @@ class Production extends ComponentBase
$data = post();
$productions = ProductionModel::with(['pivot_production', 'excruiter', 'shift'])->orderBy('id', 'DESC');
$productionsCalc = ProductionModel::orderBy('id', 'DESC');
@ -97,10 +95,16 @@ class Production extends ComponentBase
$html_data = '';
for ($x = 0; $x < count($productionsFiltered); $x++) {
$date = "";
if($productionsFiltered[$x]->date != null){
$date = Carbon::parse($productionsFiltered[$x]->date)->format('d.m.Y').' | '.Carbon::parse($productionsFiltered[$x]->time)->format('H:i');
}else{
$date = "";
}
// dd($productionsFiltered[0]->shift->desc);
$html_data .= '<tr>
<td style="font-weight: bold;width: 5%;">' . ($x + 1) . '</td>
<td><a href="#" style="font-weight: bold;color: #0005c5;">' . $productionsFiltered[$x]->date->format("d.m.Y | H:i") . '</a></td>
<td><a href="#" style="font-weight: bold;color: #0005c5;">' . $date . '</a></td>
<td><a href="#" style="font-weight: bold;color: #1e2038;">' . $productionsFiltered[$x]->shift->desc . '</a></td>
<td style="text-align: center;">
<span class="badge badge-soft-info"

View File

@ -215,7 +215,7 @@ class Sewer extends ComponentBase
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td style="font-weight: bold;"> #' . $sewerDatas[$x]->id . '</td>
<td style="font-weight: bold;"> #Dikiş' . $sewerDatas[$x]->id . '</td>
<td><span class="badge badge-soft-primary"
style="font-size: 14px;">ini: ' . ($sewerDatas[$x]->width ?? "") . '- boyy:' . ($sewerDatas[$x]->height ?? "") . ' </span>
</td>
@ -277,6 +277,7 @@ class Sewer extends ComponentBase
$status = $data["status"];
$width = $data["width"];
$height = $data["height"];
$color_id = $data["color_id"];
@ -298,6 +299,12 @@ class Sewer extends ComponentBase
});
}
if ($color_id) {
$sewerProductions->with("machin_production")->whereHas('machin_production', function ($query) use($color_id) {
$query->where('color_id', $color_id);
});
}
if ($min) {
$sewerProductions->whereRaw('produced_bag_qty >' . ($min - 1));
}
@ -335,11 +342,11 @@ class Sewer extends ComponentBase
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td style="font-weight: bold;"> #' . $sewerDatas[$x]->id . '</td>
<td style="font-weight: bold;"> #Dikiş' . $sewerDatas[$x]->id . '</td>
<td><span class="badge badge-soft-primary"
style="font-size: 14px;">ini: ' . ($sewerDatas[$x]->width ?? "") . '- boyy:' . ($sewerDatas[$x]->height ?? "") . ' </span>
</td>
<td> #' . $sewerDatas[$x]->machin_production->id . '- ' . ($sewerDatas[$x]->machin_production->bag_size->width ?? "") . 'x' . ($sewerDatas[$x]->machin_production->bag_size->height ?? "") . 'm2, ' . ($sewerDatas[$x]->machin_production->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->machin_production->color->name ?? "") . '
<td> #Rulon' . $sewerDatas[$x]->machin_production->id . '- ' . ($sewerDatas[$x]->machin_production->bag_size->width ?? "") . 'x' . ($sewerDatas[$x]->machin_production->bag_size->height ?? "") . 'm2, ' . ($sewerDatas[$x]->machin_production->bag_type->name ?? "") . ', ' . ($sewerDatas[$x]->machin_production->color->name ?? "") . '
</td>
<td><a href="#" style="font-weight: bold;">' . $sewerDatas[$x]->employee->name . '</a></td>
<td>' . $dateTitle . '</td>

View File

@ -30,6 +30,10 @@ class OrderItem extends Model
'Romanah\Gokbakja\Models\BagType',
'key' => 'type_id'
],
'color' => [
'Romanah\Gokbakja\Models\BagColor',
'key' => 'color_id'
],
];

View File

@ -0,0 +1,25 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaOrderItem5 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_order_item', function($table)
{
$table->string('order_item_type')->default('rulon');
$table->integer('color_id');
});
}
public function down()
{
Schema::table('romanah_gokbakja_order_item', function($table)
{
$table->dropColumn('order_item_type');
$table->dropColumn('color_id');
});
}
}

View File

@ -0,0 +1,25 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaOrderItem6 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_order_item', function($table)
{
$table->double('bag_width', 10, 0);
$table->double('bag_height', 10, 0);
});
}
public function down()
{
Schema::table('romanah_gokbakja_order_item', function($table)
{
$table->dropColumn('bag_width');
$table->dropColumn('bag_height');
});
}
}

View File

@ -279,3 +279,9 @@
1.0.94:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_11.php
1.0.95:
- 'Updated table romanah_gokbakja_order_item'
- builder_table_update_romanah_gokbakja_order_item_5.php
1.0.96:
- 'Updated table romanah_gokbakja_order_item'
- builder_table_update_romanah_gokbakja_order_item_6.php

View File

@ -145,14 +145,10 @@ items:
cssClass: ''
isExternal: '0'
-
title: 'Enjamlar Boýunça'
nesting: null
title: 'Rulonlar Boýunça'
type: url
url: /ee
code: ''
reference: null
cmsPage: null
replace: null
viewBag:
isHidden: '0'
cssClass: 'ri-bar-chart-2-line '
@ -173,9 +169,13 @@ items:
isExternal: '0'
-
title: 'Rulonlar Sklady'
nesting: null
type: cms-page
url: null
code: ''
reference: machine/rulon
cmsPage: null
replace: null
viewBag:
isHidden: '1'
cssClass: ''

View File

@ -101,8 +101,8 @@ pageNumber = "{{ :page }}"
<!-- <input type="date" name="date" class="form-control" placeholder="Sene"> -->
<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">
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>
@ -139,7 +139,8 @@ pageNumber = "{{ :page }}"
<input type="text" name="note" class="form-control" placeholder="Bellik">
</div>
<div class="col">
<button type="submit" class="btn btn-primary waves-effect waves-light" style="width: 100%;">Goş</button>
<button type="submit" class="btn btn-primary waves-effect waves-light"
style="width: 100%;">Goş</button>
</div>
</div>
</form>
@ -153,7 +154,9 @@ pageNumber = "{{ :page }}"
<div class="row">
<div class="col-md-6">
<h3 class="card-title" style="font-size: 22px;color: #1e2038;">Enjamlar boýunça
(Şu günki sene: {{currentDate|date('d.m.Y | H:i')}}) <font id="validationq" style="color: darkred;font-size: 17px;"></font></h3>
(Şu günki sene: {{currentDate|date('d.m.Y | H:i')}}) <font id="validationq"
style="color: darkred;font-size: 17px;"></font>
</h3>
<p class="card-title-desc" style="color: #6c6ff5;">Hasabat</p>
</div>
@ -209,8 +212,17 @@ pageNumber = "{{ :page }}"
</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>

View File

@ -218,8 +218,17 @@ function onStart(){
</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>

View File

@ -0,0 +1,5 @@
title = "machine/rulon-data"
url = "/machine/rulon-data/:id"
layout = "platform_main"
is_hidden = 0
==

View File

@ -3,7 +3,7 @@ url = "/order-detail/:orderId"
layout = "platform_main"
is_hidden = 0
[order]
[orderItem]
==
<?php
function onStart(){
@ -11,7 +11,10 @@ function onStart(){
$this["orderId"] = $this->param("orderId");
$orderId = $this->param("orderId");
$this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId)->with(["client", "shipping"])
$count = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->count();
$this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId)
->withCount(['order_items as order_all_amount' => function($query) {
$query->select(DB::raw('sum(amount)'));
}])
@ -20,12 +23,14 @@ function onStart(){
}])
->first();
$this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price);
$this["orderItems"] = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->orderBy("id", "DESC")->with(["type", "size"])->get();
$this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price) / $count;
$this["orderItems"] = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->orderBy("id", "DESC")->with(["type", "size", "color"])->get();
$this["sizes"] = Romanah\Gokbakja\Models\BagSize::get();
$this["types"] = Romanah\Gokbakja\Models\BagType::get();
$this["colors"] = Romanah\Gokbakja\Models\BagColor::get();
}
?>
@ -73,6 +78,26 @@ function onStart(){
<div class="card-body">
<div class="row">
<div class="col">
<label class="form-label">Haryt Görnüşi</label>
<select class="form-control select2" name="order_item_type" id="order_item_type" onchange="setFields(this.value);">
<option value="rulon" selected>Rulon</option>
<option value="bag">Halta</option>
</select>
</div>
<div class="col" id="bag_width">
<label class="form-label">Halta Ini</label>
<input type="number" name="bag_width" step="0.01" class="form-control"
placeholder="Halta Ini" value="0">
</div>
<div class="col" id="bag_height">
<label class="form-label">Halta Boýy</label>
<input type="number" name="bag_height" step="0.01" class="form-control"
placeholder="Halta Boýy" value="0">
</div>
<div class="col" id="rulon_size">
<label class="form-label">Razmer Saýlaň</label>
<select class="form-control select2" name="size_id">
<option value="0">Saýla</option>
@ -81,7 +106,8 @@ function onStart(){
{% endfor %}
</select>
</div>
<div class="col">
<div class="col" id="rulon_type">
<label class="form-label">Görnüş Saýlaň</label>
<select class="form-control select2" name="type_id">
<option value="0">Saýla</option>
@ -91,6 +117,16 @@ function onStart(){
</select>
</div>
<div class="col">
<label class="form-label">Reňk Saýlaň</label>
<select class="form-control select2" name="color_id">
<option value="0">Saýla</option>
{% for color in colors %}
<option value="{{color.id}}">{{color.name}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<div>
<label class="form-label">Bahasy</label>
@ -159,27 +195,15 @@ function onStart(){
<th>Razmer</th>
<th>Bahasy</th>
<th>Mukdary</th>
<th>Jemi</th>
<th>SKLATDA</th>
<th>Ýetmezçilik</th>
<th>Bellik</th>
<th>POZ</th>
</tr>
</thead>
<tbody id="order_item_datas">
{% for key, item in orderItems %}
<tr>
<td style="font-weight: bold;">{{(key+1)}}</td>
<td><a href="#" style="font-weight: bold;">{{item.type.name}}</a></td>
<td>{{item.size.name}}</td>
<td><a href="#" data-request="onModalSet"
data-request-data="orderItemId: {{item.id}}"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1"
class="badge badge-soft-success"
style="font-size: 14px;">{{item.price|number_format}} $</a>
</td>
<td><a href="#" data-request="onModalSetAmount"
data-request-data="orderItemId: {{item.id}}"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1">{{item.amount}}</a></td>
<td>{{item.note}}</td>
</tr>
{% endfor %}
<tbody>
{% component 'orderItem' %}
</tbody>
<tfoot>
<tr>
@ -188,7 +212,11 @@ function onStart(){
<th>Razmer</th>
<th>Bahasy</th>
<th>Mukdary</th>
<th>Jemi</th>
<th>SKLATDA</th>
<th>Ýetmezçilik</th>
<th>Bellik</th>
<th>POZ</th>
</tr>
</tfoot>
</table>
@ -217,6 +245,30 @@ function onStart(){
{% put scripts %}
<script>
var typeq = $('#order_item_type').val();
setFields(typeq);
function setFields(orderType){
if(orderType == 'rulon'){
$("#rulon_type").show();
$("#rulon_size").show();
$("#bag_width").hide();
$("#bag_height").hide();
}else{
$("#bag_width").show();
$("#bag_height").show();
$("#rulon_type").hide();
$("#rulon_size").hide();
}
}
</script>
<script src="{{'assets/libs/select2/js/select2.min.js'|theme}}"></script>
<script src="{{'assets/js/pages/form-advanced.init.js'|theme}}"></script>

View File

@ -12,6 +12,7 @@ function onStart(){
$this["widths"] = Romanah\Gokbakja\Models\SewerProduction::groupBy("width")->get();
$this["heights"] = Romanah\Gokbakja\Models\SewerProduction::groupBy("height")->get();
$this["colors"] = Romanah\Gokbakja\Models\BagColor::get();
}
?>
@ -46,6 +47,16 @@ function onStart(){
</select>
</div>
<div class="col">
<label class="form-label">Reňk Saýlaň</label>
<select class="form-control select2" name="color_id">
<option value="0">Saýla</option>
{% for color in colors %}
<option value="{{color.id}}">{{color.name}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<label class="form-label">Halta Ini</label>
<select class="form-control select2" name="width">

View File

@ -19,7 +19,7 @@
</div>
</div>
</div>
<div class="col-md-3">
<div class="col-md-4">
<div class="d-flex mt-4 mt-md-0">
<div class="avatar-sm me-3">
<span
@ -33,7 +33,7 @@
</div>
</div>
</div>
<div class="col-md-3">
<!-- <div class="col-md-3">
<div class="d-flex mt-4 mt-md-0">
<div class="avatar-sm me-3">
<span
@ -46,8 +46,8 @@
<p class="text-muted mb-0">Umumy Mukdary</p>
</div>
</div>
</div>
<div class="col-md-3">
</div> -->
<div class="col-md-4">
<div class="d-flex mt-4 mt-md-0">
<div class="avatar-sm me-3">
<span
@ -56,8 +56,8 @@
</span>
</div>
<div class="flex-grow-1 align-self-center overflow-hidden">
<h5 id="allPrice">{{allPrice}} $</h5>
<p class="text-muted mb-0" id="all">Jemi Bahasy: {{all|number_format}} $</p>
<h5 id="allPrice">Jemi Bahasy: {{all|number_format}} $</h5>
<p class="text-muted mb-0" id="all">{{allPrice}} $</p>
</div>
</div>
</div>