Browse Source

update new response

pull/1/head
farhantock 1 year ago
parent
commit
fb55b6d14e
  1. 14
      app/Http/Controllers/VersionGanttController.php

14
app/Http/Controllers/VersionGanttController.php

@ -14,7 +14,8 @@ use App\Models\ActivityProgressLog;
class VersionGanttController extends Controller class VersionGanttController extends Controller
{ {
public function add(Request $request){ public function add(Request $request)
{
$this->validate($request, [ $this->validate($request, [
'name_version' => 'required', 'name_version' => 'required',
'proyek_id' => 'required' 'proyek_id' => 'required'
@ -24,13 +25,14 @@ class VersionGanttController extends Controller
$result = VersionGantt::create($data); $result = VersionGantt::create($data);
if ($result) { if ($result) {
return response()->json(['status'=>'success','message'=>'version gantt Project successfull created','code'=>200]); return response()->json(['status' => 'success', 'message' => 'version gantt Project successfull created', 'code' => 200, 'id' => $result->id]);
} else { } else {
return response()->json(['status' => 'failed', 'message' => 'version gantt Project failed created', 'code' => 400]); return response()->json(['status' => 'failed', 'message' => 'version gantt Project failed created', 'code' => 400]);
} }
} }
public function update(Request $request, $id){ public function update(Request $request, $id)
{
if (!$id || (int) $id < 0 || $id == "") { if (!$id || (int) $id < 0 || $id == "") {
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
@ -81,7 +83,8 @@ class VersionGanttController extends Controller
ActivityProgressLog::where('version_gantt_id', $version_gantt_id)->delete(); ActivityProgressLog::where('version_gantt_id', $version_gantt_id)->delete();
} }
public function edit($id){ public function edit($id)
{
if (!$id || (int) $id < 0 || $id == "") { if (!$id || (int) $id < 0 || $id == "") {
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
die(); die();
@ -109,7 +112,8 @@ class VersionGanttController extends Controller
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet], 200); return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet], 200);
} }
public function ganttProgress($column, $value){ public function ganttProgress($column, $value)
{
$progress = VersionGantt::select('m_version_gantt.id', 'm_activity.persentase_progress', 'm_activity.bobot_planning') $progress = VersionGantt::select('m_version_gantt.id', 'm_activity.persentase_progress', 'm_activity.bobot_planning')
->join('m_activity', 'm_version_gantt.id', '=', 'm_activity.version_gantt_id') ->join('m_activity', 'm_version_gantt.id', '=', 'm_activity.version_gantt_id')
->where("m_version_gantt." . $column, $value) ->where("m_version_gantt." . $column, $value)

Loading…
Cancel
Save