From aac7f1d0331c4f4a90c4c6f3531808f5e7db8c78 Mon Sep 17 00:00:00 2001
From: cody <648753004@qq.com>
Date: Thu, 26 Dec 2024 10:33:23 +0800
Subject: [PATCH] update
---
.../Controllers/Admin/OrdersController.php | 38 ++++++++++++-------
resources/views/admin/orders/index.blade.php | 1 -
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/app/Http/Controllers/Admin/OrdersController.php b/app/Http/Controllers/Admin/OrdersController.php
index db1777c..0c8008f 100755
--- a/app/Http/Controllers/Admin/OrdersController.php
+++ b/app/Http/Controllers/Admin/OrdersController.php
@@ -88,20 +88,30 @@ class OrdersController extends CommonController
});
}
- $data = $this->model
- ->with([
- "orderItems",
- "firstItem",
- "lastItem",
- "project",
- "product",
- "customer",
- "manager",
- "bed" => function ($query) {
- $query->with(["room", "building", "area"]);
+ $data = $this->model->with([
+ "orderItems",
+ "firstItem",
+ "lastItem",
+ "project",
+ "product",
+ "customer",
+ "manager",
+ "bed" => function ($query) {
+ $query->with(["room", "building", "area"]);
+ }
+ ])->where('status', $status)
+ ->where(function ($query) use ($building_id, $area_id) {
+ if ($building_id || $area_id) {
+ $query->whereHas('bed', function ($q) use ($building_id, $area_id) {
+ if (isset($building_id)) {
+ $q->where('building_id', $building_id);
+ }
+ if (isset($area_id)) {
+ $q->where('area_id', $area_id);
+ }
+ });
}
- ])->where('status', $status)
- ->orderBy("id", "desc");
+ })->orderBy("id", "desc");
if (request()->is_export) {
$data = $data->get();
@@ -126,7 +136,7 @@ class OrdersController extends CommonController
'20' => '进行中',
'100' => '已完成'
];
- return view($this->bladePath . ".index", compact('area_id','building_id','buildings', 'areas', "status", "data", "project_id", "month", "project", "hushizhang", "yuanfang", "order_status_list"));
+ return view($this->bladePath . ".index", compact('area_id', 'building_id', 'buildings', 'areas', "status", "data", "project_id", "month", "project", "hushizhang", "yuanfang", "order_status_list"));
}
public function _getMonths()
diff --git a/resources/views/admin/orders/index.blade.php b/resources/views/admin/orders/index.blade.php
index 641c102..51f66f9 100755
--- a/resources/views/admin/orders/index.blade.php
+++ b/resources/views/admin/orders/index.blade.php
@@ -41,7 +41,6 @@
value="{{ sprintf("%02d",$i)}}" @if(sprintf("%02d",$i) == request()->date) {{ "selected" }}@endif>{{sprintf("%02d",$i)}}
@endfor
-