title = "Order detail" url = "/order-detail/:orderId" layout = "platform_main" is_hidden = 0 [orderItem] == param("orderId"); $orderId = $this->param("orderId"); $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)')); }]) ->withCount(['order_items as order_all_price' => function($query) { $query->select(DB::raw('sum(price)')); }]) ->first(); if($count > 0){ $this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price) / $count; } $orderItems = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->orderBy("id", "DESC")->with(["type", "size", "color"])->get(); $sumOfPrice = 0; for ($x = 0; $x < count($orderItems); $x++) { $sumOfPrice = ($sumOfPrice + ($orderItems[$x]->amount * $orderItems[$x]->price)); } $this["sumOfPrice"] = $sumOfPrice; $this["sizes"] = Romanah\Gokbakja\Models\BagSize::get(); $this["types"] = Romanah\Gokbakja\Models\BagType::get(); $this["colors"] = Romanah\Gokbakja\Models\BagColor::get(); } ?> == {% put styles %} {% endput %}

Sargyt Maglumatlary

{% put scripts %} {% endput %} {% partial 'dataTableJs' %}