Browse Source

fix search task mobile

pull/3/head
wahyu 1 year ago
parent
commit
22748a5b5a
  1. 21
      app/Http/Controllers/UserToActivityController.php

21
app/Http/Controllers/UserToActivityController.php

@ -129,9 +129,30 @@ class UserToActivityController extends Controller
public function search(Request $request)
{
$payload = $request->all();
if (isset($payload['join_column'])) {
$join_column = $payload['join_column'];
$startDate = $join_column['start_date'];
$endDate = $join_column['end_date'];
$startDate = date("Y-m-d H:i:sO", strtotime($startDate));
$endDate = date("Y-m-d H:i:sO", strtotime($endDate));
unset($payload['join_column']);
}
$dataBuilder = $this->setUpPayload($payload, 'assign_hr_to_activity');
$builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count'];
if (isset($join_column)) {
$builder->where(function ($query) use ($startDate, $endDate) {
$query
->where('m_proyek.mulai_proyek', '<=', $startDate)
->where('m_proyek.akhir_proyek', '>=', $endDate)
->where(function ($query) use ($endDate, $startDate) {
$query
->where('m_activity.start_date', '<=', $startDate)
->where('m_activity.end_date', '>=', $endDate);
});
});
}
$dataGet = $builder->get();
$totalRecord = $countBuilder->count();
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);

Loading…
Cancel
Save