From c8b1c603c78c103d4aa2e3cfaa040382efafde0f Mon Sep 17 00:00:00 2001 From: ardhi Date: Fri, 3 Feb 2023 15:07:29 +0700 Subject: [PATCH] add property material_id di fungsi datatablesForReportActivity AssignMaterialController dan report_id di fungsi add ReportActivityMaterialController --- app/Http/Controllers/AssignMaterialController.php | 1 + app/Http/Controllers/ReportActivityMaterialController.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/AssignMaterialController.php b/app/Http/Controllers/AssignMaterialController.php index 583d2cd..d037750 100644 --- a/app/Http/Controllers/AssignMaterialController.php +++ b/app/Http/Controllers/AssignMaterialController.php @@ -130,6 +130,7 @@ class AssignMaterialController extends Controller "m.description as material_name", "assign_material_to_activity.activity_id", "assign_material_to_activity.type", + "assign_material_to_activity.material_id" ) ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->groupBy("m.description") diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index 57ecfe3..5588235 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -29,10 +29,12 @@ class ReportActivityMaterialController extends Controller $data['assign_material_id'] = $request->assign_material_id; $data['qty'] = $this->sanitizeDecimal($data['qty']); - if(!ReportActivityMaterial::create($data)) - return response()->json(['status'=>'failed','message'=>'Input progress report activity failed created','code'=>400]); + $created = ReportActivityMaterial::create($data); - return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200]); + if(!$created) + return response()->json(['status'=>'failed','message'=>'Input progress report activity failed created','code'=>400,'data'=>null]); + + return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200,'data'=>array('report_id'=>$created->id)]); } public function updateStatusStartFinish(Request $request){