|
|
@ -59,6 +59,14 @@ class ReportActivityMaterialController extends Controller |
|
|
|
"updated_by" => $this->currentName |
|
|
|
"updated_by" => $this->currentName |
|
|
|
); |
|
|
|
); |
|
|
|
Activity::where('id', $request->activity_id)->update($dataUpdate); |
|
|
|
Activity::where('id', $request->activity_id)->update($dataUpdate); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$sumAssignMaterial = AssignMaterial::where('activity_id', $request->activity_id)->sum('qty_planning'); |
|
|
|
|
|
|
|
$sumReportActivityMaterial = ReportActivityMaterial::where('activity_id', $request->activity_id)->sum('qty'); |
|
|
|
|
|
|
|
$dataUpdate = array( |
|
|
|
|
|
|
|
"persentase_progress" => $sumReportActivityMaterial/$sumAssignMaterial*100, |
|
|
|
|
|
|
|
"updated_by" => $this->currentName |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
Activity::where('id', $request->activity_id)->update($dataUpdate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return response()->json(['status'=>'success','message'=>'Update data status successfully ', 'code'=>200]); |
|
|
|
return response()->json(['status'=>'success','message'=>'Update data status successfully ', 'code'=>200]); |
|
|
@ -114,12 +122,14 @@ class ReportActivityMaterialController extends Controller |
|
|
|
->addIndexColumn() |
|
|
|
->addIndexColumn() |
|
|
|
->addColumn('action', function($row){ |
|
|
|
->addColumn('action', function($row){ |
|
|
|
$actionBtn = '<a href="javascript:void(0)" data-id="'.$row->id.'" class="info btn btn-info btn-sm btn-ram-image" data-toggle="tooltip" title="Lihat Foto Report" data-placement="top"><i class="fa fa-image"></i></a>'; |
|
|
|
$actionBtn = '<a href="javascript:void(0)" data-id="'.$row->id.'" class="info btn btn-info btn-sm btn-ram-image" data-toggle="tooltip" title="Lihat Foto Report" data-placement="top"><i class="fa fa-image"></i></a>'; |
|
|
|
$actionBtn .= '<a href="javascript:void(0)" data-id="'.$row->id.'" class="delete btn btn-danger btn-sm btn-ram-delete" data-toggle="tooltip" title="Hapus Report" data-placement="top"><i class="fa fa-trash"></i></a>'; |
|
|
|
if ($row->status_activity != 'done') { |
|
|
|
|
|
|
|
$actionBtn .= '<a href="javascript:void(0)" data-id="'.$row->id.'" class="delete btn btn-danger btn-sm btn-ram-delete" data-toggle="tooltip" title="Hapus Report" data-placement="top"><i class="fa fa-trash"></i></a>'; |
|
|
|
|
|
|
|
} |
|
|
|
return $actionBtn; |
|
|
|
return $actionBtn; |
|
|
|
}) |
|
|
|
}) |
|
|
|
->rawColumns(['action'])->make(true); |
|
|
|
->rawColumns(['action'])->make(true); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
$data = ReportActivityMaterial::select("report_activity_material.*", "u.name as human_resource") |
|
|
|
$data = ReportActivityMaterial::select("report_activity_material.*", "u.name as human_resource", "amta.status_activity") |
|
|
|
->join("assign_material_to_activity as amta", "amta.id", "=", "report_activity_material.assign_material_id") |
|
|
|
->join("assign_material_to_activity as amta", "amta.id", "=", "report_activity_material.assign_material_id") |
|
|
|
->join("m_req_material as m", "m.id", "=", "amta.material_id") |
|
|
|
->join("m_req_material as m", "m.id", "=", "amta.material_id") |
|
|
|
->join("m_users as u", "u.id", "=", "report_activity_material.user_id") |
|
|
|
->join("m_users as u", "u.id", "=", "report_activity_material.user_id") |
|
|
@ -131,7 +141,9 @@ class ReportActivityMaterialController extends Controller |
|
|
|
->addIndexColumn() |
|
|
|
->addIndexColumn() |
|
|
|
->addColumn('action', function($row){ |
|
|
|
->addColumn('action', function($row){ |
|
|
|
$actionBtn = '<a href="javascript:void(0)" data-id="'.$row->id.'" class="info btn btn-info btn-sm btn-ram-image" data-toggle="tooltip" title="Lihat Foto Report" data-placement="top"><i class="fa fa-image"></i></a>'; |
|
|
|
$actionBtn = '<a href="javascript:void(0)" data-id="'.$row->id.'" class="info btn btn-info btn-sm btn-ram-image" data-toggle="tooltip" title="Lihat Foto Report" data-placement="top"><i class="fa fa-image"></i></a>'; |
|
|
|
$actionBtn .= '<a href="javascript:void(0)" data-id="'.$row->id.'" class="delete btn btn-danger btn-sm btn-ram-delete" data-toggle="tooltip" title="Hapus Report" data-placement="top"><i class="fa fa-trash"></i></a>'; |
|
|
|
if ($row->status_activity != 'done') { |
|
|
|
|
|
|
|
$actionBtn .= '<a href="javascript:void(0)" data-id="'.$row->id.'" class="delete btn btn-danger btn-sm btn-ram-delete" data-toggle="tooltip" title="Hapus Report" data-placement="top"><i class="fa fa-trash"></i></a>'; |
|
|
|
|
|
|
|
} |
|
|
|
return $actionBtn; |
|
|
|
return $actionBtn; |
|
|
|
}) |
|
|
|
}) |
|
|
|
->rawColumns(['action'])->make(true); |
|
|
|
->rawColumns(['action'])->make(true); |
|
|
|