master
cody 1 year ago
parent 414cf3f387
commit aac7f1d033

@ -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()

@ -41,7 +41,6 @@
value="{{ sprintf("%02d",$i)}}" @if(sprintf("%02d",$i) == request()->date) {{ "selected" }}@endif>{{sprintf("%02d",$i)}}</option>
@endfor
</select>
<br/>
<select class="form-control mr-1" name="status" onchange="$(this).closest('form').submit()">
@foreach($order_status_list as $key=>$mm)
<option value="{{$key}}" @if($key == $status) {{ "selected" }}@endif>{{$mm}}</option>

Loading…
Cancel
Save