|
|
|
|
@ -205,6 +205,7 @@ class OrdersController extends CommonController
|
|
|
|
|
*/
|
|
|
|
|
public function artboard(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$has_ongoing_order = $request->get('has_ongoing_order',1);
|
|
|
|
|
$userId = auth()->id();
|
|
|
|
|
// 判断是否护士长
|
|
|
|
|
$roleId = Role::where('name', 'like', '%护士长%')->where('guard_name', 'admin')->value('id');
|
|
|
|
|
@ -227,9 +228,9 @@ class OrdersController extends CommonController
|
|
|
|
|
if ($request->project_id) {
|
|
|
|
|
$query->where('project_id', $request->project_id);
|
|
|
|
|
}
|
|
|
|
|
})->with([
|
|
|
|
|
"beds" => function ($query) use ($request) {
|
|
|
|
|
if ($request->has_ongoing_order) {
|
|
|
|
|
})->with(['project',
|
|
|
|
|
"beds" => function ($query) use ($request,$has_ongoing_order) {
|
|
|
|
|
if ($has_ongoing_order) {
|
|
|
|
|
$query->has("onGoingOrder");
|
|
|
|
|
}
|
|
|
|
|
$query->with(["onGoingOrder" => function ($query) {
|
|
|
|
|
@ -247,12 +248,11 @@ class OrdersController extends CommonController
|
|
|
|
|
->addSelect("building.name as building_name")
|
|
|
|
|
->withCount("beds")
|
|
|
|
|
->paginate(10);
|
|
|
|
|
if ($request->has_ongoing_order) {
|
|
|
|
|
if ($has_ongoing_order) {
|
|
|
|
|
$data = $data->filter(function ($item) {
|
|
|
|
|
return $item->beds->count();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dd($data->toArray());
|
|
|
|
|
return view($this->bladePath . ".artboard", compact("data"));
|
|
|
|
|
|
|
|
|
|
|