From 68dbfd617e91bfc265274345d05852af2709b1a0 Mon Sep 17 00:00:00 2001 From: Shohrat Date: Thu, 23 Nov 2023 12:24:52 +0500 Subject: [PATCH] order item rulon integration --- .../romanah/gokbakja/components/OrderItem.php | 24 ++++++++++------- ..._update_romanah_gokbakja_order_item_10.php | 23 ++++++++++++++++ ...e_update_romanah_gokbakja_order_item_9.php | 27 +++++++++++++++++++ plugins/romanah/gokbakja/updates/version.yaml | 6 +++++ themes/gokbakja/pages/orders/order-detail.htm | 27 ++++++++++++++----- themes/gokbakja/pages/produced/rulonstock.htm | 2 +- 6 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_10.php create mode 100644 plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_9.php diff --git a/plugins/romanah/gokbakja/components/OrderItem.php b/plugins/romanah/gokbakja/components/OrderItem.php index 5f154de..97ffddc 100644 --- a/plugins/romanah/gokbakja/components/OrderItem.php +++ b/plugins/romanah/gokbakja/components/OrderItem.php @@ -50,19 +50,23 @@ class OrderItem extends ComponentBase $stock = Stock::where("type", 'rulon')->first(); $bag_type = $orderItems[$x]->type_id; - $bag_size = $orderItems[$x]->size_id; + $bag_size = $orderItems[$x]->width; + $bag_gram = $orderItems[$x]->rulon_gram; + $rulon_layer = $orderItems[$x]->rulon_layer; $color = $orderItems[$x]->color_id; $amountCalc = $orderItems[$x]->amount; $rulonCalc = RulonAction::with('product') - ->whereHas('product', function($q)use($bag_type, $bag_size, $color){ + ->whereHas('product', function($q)use($bag_type, $bag_size, $color, $bag_gram, $rulon_layer){ $q->where('type_id', $bag_type) - ->where('size_id', $bag_size) + ->where('width', $bag_size) + ->where('gram', $bag_gram) + ->where('layer', $rulon_layer) ->where('color_id', $color); }) ->where("stock_id", $stock->id) - ->where("status_accountant", "accept") - ->where("status_director", "accept") + //->where("status_accountant", "accept") + //->where("status_director", "accept") ->sum('amount'); @@ -101,8 +105,8 @@ class OrderItem extends ComponentBase $qqq->where('width', $bag_width)->where('height', $bag_height); }) ->where("stock_id", $stock->id) - ->where("status_accountant", "accept") - ->where("status_director", "accept") + //->where("status_accountant", "accept") + //->where("status_director", "accept") ->sum('amount'); @@ -164,7 +168,7 @@ class OrderItem extends ComponentBase $html_data .=' '; if ($orderItems[$x]->order_item_type == 'rulon'){ - $html_data .= $orderItems[$x]->size->name ?? ""; + $html_data .= 'Ölçegi: '.($orderItems[$x]->width ?? "").', '.$orderItems[$x]->rulon_gram.' gram m2 , rulon gaty: '.$orderItems[$x]->rulon_layer; }else{ $html_data .= 'Ini: '.$orderItems[$x]->bag_width.' Boýy: '.$orderItems[$x]->bag_height; } @@ -322,7 +326,9 @@ class OrderItem extends ComponentBase $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->width = $data["width"]; + $createOrderItem->rulon_layer = $data["rulon_layer"]; + $createOrderItem->rulon_gram = $data["rulon_gram"]; $createOrderItem->color_id = $data["color_id"]; $createOrderItem->bag_gram = $data["bag_gram"]; $createOrderItem->bag_width = $data["bag_width"]; diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_10.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_10.php new file mode 100644 index 0000000..ff26411 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_10.php @@ -0,0 +1,23 @@ +integer('rulon_layer')->default(1); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_order_item', function($table) + { + $table->dropColumn('rulon_layer'); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_9.php b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_9.php new file mode 100644 index 0000000..411de89 --- /dev/null +++ b/plugins/romanah/gokbakja/updates/builder_table_update_romanah_gokbakja_order_item_9.php @@ -0,0 +1,27 @@ +double('rulon_gram', 10, 0)->nullable(); + $table->double('width', 10, 0)->nullable(); + $table->dropColumn('size_id'); + }); + } + + public function down() + { + Schema::table('romanah_gokbakja_order_item', function($table) + { + $table->dropColumn('rulon_gram'); + $table->dropColumn('width'); + $table->integer('size_id'); + }); + } +} diff --git a/plugins/romanah/gokbakja/updates/version.yaml b/plugins/romanah/gokbakja/updates/version.yaml index c2251e2..3006f5a 100644 --- a/plugins/romanah/gokbakja/updates/version.yaml +++ b/plugins/romanah/gokbakja/updates/version.yaml @@ -405,3 +405,9 @@ 1.0.136: - 'Updated table romanah_gokbakja_production_machine' - builder_table_update_romanah_gokbakja_production_machine_17.php +1.0.137: + - 'Updated table romanah_gokbakja_order_item' + - builder_table_update_romanah_gokbakja_order_item_9.php +1.0.138: + - 'Updated table romanah_gokbakja_order_item' + - builder_table_update_romanah_gokbakja_order_item_10.php diff --git a/themes/gokbakja/pages/orders/order-detail.htm b/themes/gokbakja/pages/orders/order-detail.htm index 8959c9e..16a0289 100644 --- a/themes/gokbakja/pages/orders/order-detail.htm +++ b/themes/gokbakja/pages/orders/order-detail.htm @@ -103,13 +103,24 @@ function onStart(){ placeholder="Halta Boýy" value="0"> +
- - +
+ +
+ + +
+ +
+ +
@@ -263,6 +274,8 @@ function onStart(){ if(orderType == 'rulon'){ $("#rulon_type").show(); $("#rulon_size").show(); + $("#rulon_gram").show(); + $("#rulon_layer").show(); $("#bag_width").hide(); $("#bag_height").hide(); @@ -273,6 +286,8 @@ function onStart(){ $("#bag_gram").show(); $("#rulon_size").hide(); + $("#rulon_gram").hide(); + $("#rulon_layer").hide(); } } diff --git a/themes/gokbakja/pages/produced/rulonstock.htm b/themes/gokbakja/pages/produced/rulonstock.htm index 96b6ece..d94c176 100644 --- a/themes/gokbakja/pages/produced/rulonstock.htm +++ b/themes/gokbakja/pages/produced/rulonstock.htm @@ -93,7 +93,7 @@ function onStart(){ {{key + 1}} #Rulon{{record.product_id}} - {{record.product.bag_type.name}}, {{record.product.bag_size.name}}, {{record.product.color.name}} + {{record.product.bag_type.name}}, Ölçegi: {{record.product.width}}, {{record.product.gram}} m2, {{record.product.layer}} gat, {{record.product.color.name}} {{record.type}} {{record.quantity|number_format(2)}} kg