diff --git a/plugins/romanah/gokbakja/Plugin.php b/plugins/romanah/gokbakja/Plugin.php index 80508b9..b577149 100644 --- a/plugins/romanah/gokbakja/Plugin.php +++ b/plugins/romanah/gokbakja/Plugin.php @@ -9,6 +9,7 @@ class Plugin extends PluginBase return [ 'Romanah\Gokbakja\Components\Action' => 'action', 'Romanah\Gokbakja\Components\Production' => 'production', + 'Romanah\Gokbakja\Components\MachineProduction' => 'machineProduction', 'Romanah\Gokbakja\Components\Sewer' => 'sewer', 'Romanah\Gokbakja\Components\Order' => 'order', ]; diff --git a/plugins/romanah/gokbakja/components/MachineProduction.php b/plugins/romanah/gokbakja/components/MachineProduction.php new file mode 100644 index 0000000..5b1ea20 --- /dev/null +++ b/plugins/romanah/gokbakja/components/MachineProduction.php @@ -0,0 +1,130 @@ + 'Machine Production', + 'description' => 'Machine productions settings' + ]; + } + + + public function onRender() + { + + $html_data = ''; + + $currentDateFormat = Carbon::now()->format('Y-m-d'); + + $machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic'])->orderBy('id', 'DESC')->whereDate('created_at', date($currentDateFormat))->get(); + + $html_data = ''; + for ($x = 0; $x < count($machineProductions); $x++) { + // dd($machineProductions[0]->bag_size); + $html_data .= ' + ' . ($x + 1) . ' + ' . $machineProductions[$x]->building_name . ' + ' . $machineProductions[$x]->machine->name . ' + ' . $machineProductions[$x]->bag_size->name . ' + ' . $machineProductions[$x]->bag_type->name . ' + ' . number_format($machineProductions[$x]->produced_weight) . ' kg + + ' . $machineProductions[$x]->employee_name . ' + ' . $machineProductions[$x]->mechanic_name . ' + ' . $machineProductions[$x]->note . ' + '; + } + + return $html_data; + } + + + public function onCreateMachineProduction() + { + $user = \Auth::user(); + + $data = post(); + + if (empty($data["produced_weight"]) || $data["type_id"] == 0 || $data["size_id"] == 0 || $data["machine_id"] == 0) { + Flash::error("Gutulary Dolduryn!"); + return [ + '#validationq' => ' Gutulary Dolduryn!', + ]; + + } else { + $createProductionMachine = new ProductionMachineModel(); + + $createProductionMachine->type_id = $data["type_id"]; + $createProductionMachine->size_id = $data["size_id"]; + $createProductionMachine->machine_id = $data["machine_id"]; + $createProductionMachine->produced_weight = $data["produced_weight"]; + $createProductionMachine->note = $data["note"]; + $createProductionMachine->user_id = $user->id; + $createProductionMachine->save(); + + $productionMachine = ProductionMachineModel::where('id', $createProductionMachine->id)->with(['machine.employee', 'machine.mechanic', 'machine.building'])->first(); + // dd($productionMachine->machine->name); + if ($productionMachine) { + $updateResult = ProductionMachineModel::where('id', $productionMachine->id) + ->update(array( + 'employee_id' => $productionMachine->machine->employee->id, + 'mechanic_id' => $productionMachine->machine->mechanic->id, + 'employee_name' => $productionMachine->machine->employee->name, + 'mechanic_name' => $productionMachine->machine->mechanic->name, + 'building_name' => $productionMachine->machine->building->name, + )); + } + + $currentDateFormat = Carbon::now()->format('Y-m-d'); + + $machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic'])->whereDate('created_at', date($currentDateFormat))->orderBy('id', 'DESC')->get(); + + $html_data = ''; + + for ($x = 0; $x < count($machineProductions); $x++) { + $html_data .= ' + ' . ($x + 1) . ' + ' . $machineProductions[$x]->building_name . ' + ' . $machineProductions[$x]->machine->name . ' + ' . $machineProductions[$x]->bag_size->name . ' + ' . $machineProductions[$x]->bag_type->name . ' + ' . number_format($machineProductions[$x]->produced_weight) . ' kg + + ' . $machineProductions[$x]->employee_name . ' + ' . $machineProductions[$x]->mechanic_name . ' + ' . $machineProductions[$x]->note . ' + '; + } + + if ($createProductionMachine && $updateResult) { + + Flash::success("Hasabat Ustunlikli Goşuldy"); + return [ + '#machine_datas' => $html_data, + ]; + } else { + Flash::error("Yalnyshlyk bar!!"); + } + } + } +} diff --git a/plugins/romanah/gokbakja/components/Order.php b/plugins/romanah/gokbakja/components/Order.php index 63baeb9..1ba556d 100644 --- a/plugins/romanah/gokbakja/components/Order.php +++ b/plugins/romanah/gokbakja/components/Order.php @@ -25,6 +25,7 @@ class Order extends ComponentBase } + public function onRender(){ $html_data = ''; @@ -34,22 +35,56 @@ class Order extends ComponentBase for ($x = 0; $x < count($orderDatas); $x++) { $html_data .= ' '.($x+1).' - '.$orderDatas[$x]->client->name.' + Sargyt #'.$orderDatas[$x]->id.' + '.$orderDatas[$x]->client->name.' '.$orderDatas[$x]->client->country.' - '.$orderDatas[$x]->amount.' kg + '.number_format($orderDatas[$x]->amount).' kg '.$orderDatas[$x]->price.' + style="font-size: 14px;">'.number_format($orderDatas[$x]->price).' $ - '.$orderDatas[$x]->shipping->status.' + '.($orderDatas[$x]->shipping->status == 'not_loaded' ? 'Ýüklenmedik' : 'Ýüklenýär' ).' + '.$orderDatas[$x]->created_at->format('d.m.Y').' '.$orderDatas[$x]->note.' '; + } + return $html_data; } + // data-request="onModalSet" data-request-data="orderId: '.$orderDatas[$x]->id.', header: \''.$orderDatas[$x]->client->name.'\'" data-bs-toggle="modal" data-bs-target=".bs-example-modal-sm-1" + + public function onModalSet(){ + + $data = post(); + + $html_data = ' + '; + + return [ + '#modal-form' => $html_data, + ]; + + } + public function onCreateOrder() { @@ -59,6 +94,9 @@ class Order extends ComponentBase $data = post(); + + + $createOrder = new OrderModel(); $createOrder->client_id = $data["client_id"]; $createOrder->amount = $data["amount"]; @@ -69,7 +107,7 @@ class Order extends ComponentBase $createShipping = new ShippingModel(); $createShipping->order_id = $createOrder->id; - $createShipping->status = 'note_loaded'; + $createShipping->status = 'not_loaded'; $createShipping->employee_id = 0; $createShipping->place_now = "Aşgabat"; $createShipping->loaded_amount = 0; @@ -88,17 +126,20 @@ class Order extends ComponentBase // dd($orderDatas[$x]->shipping->status); $html_data .= ' '.($x+1).' + Sargyt #'.$orderDatas[$x]->id.' '.$orderDatas[$x]->client->name.' '.$orderDatas[$x]->client->country.' - '.$orderDatas[$x]->amount.' kg + '.number_format($orderDatas[$x]->amount).' kg '.$orderDatas[$x]->price.' + style="font-size: 14px;">'.number_format($orderDatas[$x]->price).' $ - '.$orderDatas[$x]->shipping->status.' + '.($orderDatas[$x]->shipping->status == 'not_loaded' ? 'Ýüklenmedik' : 'Ýüklenýär' ).' + '.$orderDatas[$x]->created_at->format('d.m.Y').' '.$orderDatas[$x]->note.' '; + + } if($createOrder){ diff --git a/plugins/romanah/gokbakja/components/Production.php b/plugins/romanah/gokbakja/components/Production.php index 64af182..c439849 100644 --- a/plugins/romanah/gokbakja/components/Production.php +++ b/plugins/romanah/gokbakja/components/Production.php @@ -99,40 +99,6 @@ class Production extends ComponentBase } - public function onCreateMachineProduction() - { - $user = \Auth::user(); - - $data = post(); - - $createProductionMachine = new ProductionMachineModel(); - - $createProductionMachine->type_id = $data["type_id"]; - $createProductionMachine->size_id = $data["size_id"]; - $createProductionMachine->machine_id = $data["machine_id"]; - $createProductionMachine->produced_weight = $data["produced_weight"]; - $createProductionMachine->note = $data["note"]; - $createProductionMachine->user_id = $user->id; - $createProductionMachine->save(); - - $productionMachine = ProductionMachineModel::where('id', $createProductionMachine->id)->with(['machine.employee', 'machine.mechanic', 'machine.building'])->first(); - // dd($productionMachine->machine->name); - if ($productionMachine) { - $updateResult = ProductionMachineModel::where('id', $productionMachine->id) - ->update(array( - 'employee_id' => $productionMachine->machine->employee->id, - 'mechanic_id' => $productionMachine->machine->mechanic->id, - 'employee_name' => $productionMachine->machine->employee->name, - 'mechanic_name' => $productionMachine->machine->mechanic->name, - 'building_name' => $productionMachine->machine->building->name, - )); - } - - if ($createProductionMachine && $updateResult) { - Flash::success("Hasabat Ustunlikli Goşuldy"); - return Redirect::refresh(); - } - } function onCalculateAvg() { diff --git a/plugins/romanah/gokbakja/models/OrderItem.php b/plugins/romanah/gokbakja/models/OrderItem.php index df4c303..9fef0fb 100644 --- a/plugins/romanah/gokbakja/models/OrderItem.php +++ b/plugins/romanah/gokbakja/models/OrderItem.php @@ -21,7 +21,15 @@ class OrderItem extends Model 'product' => [ 'Romanah\Gokbakja\Models\Product', 'key' => 'product_id' - ] + ], + 'size' => [ + 'Romanah\Gokbakja\Models\BagSize', + 'key' => 'size_id' + ], + 'type' => [ + 'Romanah\Gokbakja\Models\BagType', + 'key' => 'type_id' + ], ]; diff --git a/plugins/romanah/gokbakja/models/orderitem/fields.yaml b/plugins/romanah/gokbakja/models/orderitem/fields.yaml index 7fde472..3194d18 100644 --- a/plugins/romanah/gokbakja/models/orderitem/fields.yaml +++ b/plugins/romanah/gokbakja/models/orderitem/fields.yaml @@ -13,3 +13,15 @@ fields: label: Note span: auto type: textarea + size: + label: Razmeri + nameFrom: name + descriptionFrom: description + span: auto + type: relation + type: + label: Gornushi + span: auto + nameFrom: name + descriptionFrom: description + type: relation diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_3.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_3.php new file mode 100644 index 0000000..0b1c2ed --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_3.php @@ -0,0 +1,27 @@ +integer('type_id'); + $table->integer('size_id'); + $table->integer('product_id')->default(0)->change(); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_order_item', function($table) + { + $table->dropColumn('type_id'); + $table->dropColumn('size_id'); + $table->integer('product_id')->default(null)->change(); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_4.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_4.php new file mode 100644 index 0000000..2d25705 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_4.php @@ -0,0 +1,23 @@ +double('price', 10, 0)->default(0); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_order_item', function($table) + { + $table->dropColumn('price'); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/version.yaml b/plugins/romanah/gokbakja/updates/version.yaml index 12a02c5..e9a7468 100644 --- a/plugins/romanah/gokbakja/updates/version.yaml +++ b/plugins/romanah/gokbakja/updates/version.yaml @@ -174,3 +174,9 @@ 1.0.59: - 'Updated table romanah_gokbakja_order' - builder_table_update_romanah_gokbakja_order_4.php +1.0.60: + - 'Updated table romanah_gokbakja_order_item' + - builder_table_update_romanah_gokbakja_order_item_3.php +1.0.61: + - 'Updated table romanah_gokbakja_order_item' + - builder_table_update_romanah_gokbakja_order_item_4.php diff --git a/themes/gokbakja/layouts/platform_main.htm b/themes/gokbakja/layouts/platform_main.htm index 790038d..423cf8c 100644 --- a/themes/gokbakja/layouts/platform_main.htm +++ b/themes/gokbakja/layouts/platform_main.htm @@ -1,87 +1,84 @@ +[session] +security = "all" +redirect = "home" + [staticMenu] code = "aside" -[session] -security = "all" -redirect = "dashboard" - [account] +redirect = "home" paramCode = "code" forceSecure = 0 requirePassword = 0 == page["url"]; +function onStart(){ + + $link = $this->page["url"]; + } ?> == - + + + + GOKBAKJA | {{ this.page.title }} + + + + - + {% styles %} + + - - GOKBAKJA | {{ this.page.title }} - - - - + + + + + + + + - - - - - - - - - - - {% flash %} -

- {{ message }} -

- {% endflash %} - - {% if user %} - {% partial 'layout-settings-main' %} - {% else %} - {% partial 'login-page' %} - {% endif %} - - - - - - - - - - {% scripts %} - - - {% framework extras %} - - - - - + {% scripts %} + + + {% framework extras %} + + \ No newline at end of file diff --git a/themes/gokbakja/pages/machine/machine.htm b/themes/gokbakja/pages/machine/machine.htm index fe1ced1..318de20 100644 --- a/themes/gokbakja/pages/machine/machine.htm +++ b/themes/gokbakja/pages/machine/machine.htm @@ -43,22 +43,9 @@ detailsPage = "-" detailsUrlParameter = "id" pageNumber = "{{ :page }}" -[production] +[machineProduction] == -timezone('UTC +05:00'); - $currentDateFormat = Carbon\Carbon::now()->format('Y-m-d'); - - $this["currentDate"] = $currentDate; - $this["currentMonth"] = $currentDate->format('m'); - $this["currentYear"] = $currentDate->format('Y'); - - $this["machineProductions"] = Romanah\Gokbakja\Models\ProductionMachine::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic'])->whereDate('created_at', date($currentDateFormat))->get(); - } -?> -== {% set records = builderList.records %} {% set displayColumn = builderList.displayColumn %} {% set noRecordsMessage = builderList.noRecordsMessage %} @@ -67,8 +54,8 @@ function onStart(){ {% set detailsUrlParameter = builderList.detailsUrlParameter %} {% set machines = builderList2.records %} -{% set types = builderList3.records %} -{% set sizes = builderList4.records %} +{% set types = builderList4.records %} +{% set sizes = builderList3.records %} {% put styles %}
-
+
- + {% for size in sizes %} {% endfor %} @@ -109,7 +96,7 @@ function onStart(){
-
+ +
@@ -99,11 +100,13 @@ function onStart(){ № + Sargyt No Klent Ýurdy Mukdary Bahasy Logistika + Senesi Bellik @@ -113,27 +116,40 @@ function onStart(){ № + Sargyt No Klent Ýurdy Mukdary Bahasy Logistika + Senesi Bellik
+ +
{% put scripts %} + + {% endput %} {% partial 'dataTableJs' %} diff --git a/themes/gokbakja/pages/orders/order-detail.htm b/themes/gokbakja/pages/orders/order-detail.htm new file mode 100644 index 0000000..468fc03 --- /dev/null +++ b/themes/gokbakja/pages/orders/order-detail.htm @@ -0,0 +1,253 @@ +title = "Order detail" +url = "/order-detail/:orderId" +layout = "platform_main" +is_hidden = 0 + +[order] +== +param("orderId"); + $this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId)->with(["client", "shipping"])->first(); + $this["sizes"] = Romanah\Gokbakja\Models\BagSize::get(); + $this["types"] = Romanah\Gokbakja\Models\BagType::get(); + +} +?> +== +{% put styles %} + + + + + +{% endput %} + +
+ + +
+
+
+

Sargyt Maglumatlary

+ +
+
+
+ + +
+
+ + + + + + + + +
+
+ +
+ + +{% put scripts %} + + + + +{% endput %} +{% partial 'dataTableJs' %} diff --git a/themes/gokbakja/pages/production/production.htm b/themes/gokbakja/pages/production/production.htm index 1c317ce..d6b4091 100644 --- a/themes/gokbakja/pages/production/production.htm +++ b/themes/gokbakja/pages/production/production.htm @@ -240,6 +240,8 @@ function onStart(){ {% endfor %} + + @@ -356,4 +358,4 @@ function onStart(){ -{% endput %} +{% endput %} \ No newline at end of file