From ab1842f5c632f2b524138ab63fa08f1f5c44b125 Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 27 Sep 2023 09:31:18 +0700 Subject: [PATCH] add filter project id --- app/Http/Controllers/PresenceController.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 0d79917..f5309ac 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -259,13 +259,17 @@ class PresenceController extends Controller // geom ada di table activity // $clock_time = $user = HumanResource::find($params->user_id); - $geom = DB::table("assign_hr_to_activity as ahta")->select("ma.geom", "ma.id") - ->join("m_activity as ma", "ma.id", "=", "ahta.activity_id") - ->where("ahta.user_id", $params->user_id) - ->whereNotNull("ma.geom") - ->whereDate("ma.start_date", "<=", $params->time) - ->whereDate("ma.end_date", ">=", $params->time) - ->get(); + $geomQuery = DB::table("assign_hr_to_activity as ahta")->select("ma.geom", "ma.id") + ->join("m_activity as ma", "ma.id", "=", "ahta.activity_id") + ->where("ahta.user_id", $params->user_id) + ->whereNotNull("ma.geom") + ->whereDate("ma.start_date", "<=", $params->time) + ->whereDate("ma.end_date", ">=", $params->time); + if (isset($params->report_k3['proyek_id'])) { + $geom = $geomQuery->where("ma.proyek_id", $params->report_k3['proyek_id'])->get(); + } else { + $geom = $geomQuery->get(); + } $temp = []; if (count($geom) > 0) { foreach($geom as $dataGeom){