|
|
|
@@ -64,7 +64,32 @@ class CustomerController extends Controller |
|
|
|
return view('customer-service.view_customer',compact('user','pp','sp','rs','ss','cm','coverage','company')); |
|
|
|
} |
|
|
|
|
|
|
|
public function getAllNewCustomer($type,$building,$dealer){ |
|
|
|
public function getAllNewCustomer(Request $request, $type,$building,$dealer){ |
|
|
|
|
|
|
|
## Read value |
|
|
|
$draw = $request->get('draw'); |
|
|
|
$start = $request->get("start"); |
|
|
|
$rowperpage = $request->get("length"); // Rows display per page |
|
|
|
|
|
|
|
// $columnIndex_arr = $request->get('order'); |
|
|
|
// $columnName_arr = $request->get('columns'); |
|
|
|
// $order_arr = $request->get('order'); |
|
|
|
$search_arr = $request->get('search'); |
|
|
|
|
|
|
|
// $columnIndex = $columnIndex_arr[0]['column']; // Column index |
|
|
|
// $columnName = $columnName_arr[$columnIndex]['data']; // Column name |
|
|
|
// $columnSortOrder = $order_arr[0]['dir']; // asc or desc |
|
|
|
$searchValue = $search_arr['value']; // Search value |
|
|
|
|
|
|
|
// Total records |
|
|
|
$totalRecords = Form::with('Subscriber','PackageDetail','WorkOrder')->select('count(*) as allcount')->count(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$totalRecordswithFilter = Form::whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->select('count(*) as allcount')->count(); |
|
|
|
}else{ |
|
|
|
$totalRecordswithFilter = Form::with('Subscriber','PackageDetail','WorkOrder')->select('count(*) as allcount')->count(); |
|
|
|
} |
|
|
|
|
|
|
|
$id = Auth::guard('cs')->id(); |
|
|
|
$user = Staff::with('StaffDetail')->find($id); |
|
|
|
@@ -74,8 +99,14 @@ class CustomerController extends Controller |
|
|
|
$nested_data = array(); |
|
|
|
|
|
|
|
if($type == 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
|
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(3000)->get(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
}else{ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if($type != 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); |
|
|
|
@@ -218,7 +249,14 @@ class CustomerController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return \DataTables::of($nested_data)->make(true); |
|
|
|
$response = array( |
|
|
|
"draw" => intval($draw), |
|
|
|
"recordsTotal" => $totalRecords, |
|
|
|
"recordsFiltered" => $totalRecordswithFilter, |
|
|
|
"data" => $nested_data |
|
|
|
); |
|
|
|
|
|
|
|
return json_encode($response); |
|
|
|
} |
|
|
|
|
|
|
|
public function getAllNewCustomerss($type,$building,$dealer){ |
|
|
|
@@ -620,7 +658,37 @@ class CustomerController extends Controller |
|
|
|
return view('customer-service.view_subscriber', compact('user','pp','sp','rs','ss','cm','rec','re','bu','coverage','company')); |
|
|
|
} |
|
|
|
|
|
|
|
public function getAllRectification($type,$building,$dealer){ |
|
|
|
public function getAllRectification(Request $request,$type,$building,$dealer){ |
|
|
|
## Read value |
|
|
|
$draw = $request->get('draw'); |
|
|
|
$start = $request->get("start"); |
|
|
|
$rowperpage = $request->get("length"); // Rows display per page |
|
|
|
|
|
|
|
// $columnIndex_arr = $request->get('order'); |
|
|
|
// $columnName_arr = $request->get('columns'); |
|
|
|
// $order_arr = $request->get('order'); |
|
|
|
$search_arr = $request->get('search'); |
|
|
|
|
|
|
|
// $columnIndex = $columnIndex_arr[0]['column']; // Column index |
|
|
|
// $columnName = $columnName_arr[$columnIndex]['data']; // Column name |
|
|
|
// $columnSortOrder = $order_arr[0]['dir']; // asc or desc |
|
|
|
$searchValue = $search_arr['value']; // Search value |
|
|
|
|
|
|
|
// Total records |
|
|
|
$totalRecords = Form::with('Subscriber','PackageDetail','WorkOrder')->whereHas('workorder',function($q){ |
|
|
|
$q->where('nature_work','Rectification'); |
|
|
|
})->select('count(*) as allcount')->count(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$totalRecordswithFilter = Form::whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->whereHas('workorder',function($q){ |
|
|
|
$q->where('nature_work','Rectification'); |
|
|
|
})->select('count(*) as allcount')->count(); |
|
|
|
}else{ |
|
|
|
$totalRecordswithFilter = Form::with('Subscriber','PackageDetail','WorkOrder')->whereHas('workorder',function($q){ |
|
|
|
$q->where('nature_work','Rectification'); |
|
|
|
})->select('count(*) as allcount')->count(); |
|
|
|
} |
|
|
|
|
|
|
|
$id = Auth::guard('cs')->id(); |
|
|
|
$user = Staff::with('StaffDetail')->find($id); |
|
|
|
@@ -630,7 +698,17 @@ class CustomerController extends Controller |
|
|
|
$nested_data = array(); |
|
|
|
|
|
|
|
if($type == 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(2000)->get(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->whereHas('workorder',function($q){ |
|
|
|
$q->where('nature_work','Rectification'); |
|
|
|
})->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
}else{ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->whereHas('workorder',function($q){ |
|
|
|
$q->where('nature_work','Rectification'); |
|
|
|
})->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
} |
|
|
|
}else if($type != 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); |
|
|
|
}else if($type != 'null' && $building != 'null' && $dealer == 'null'){ |
|
|
|
@@ -732,10 +810,42 @@ class CustomerController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return \DataTables::of($nested_data)->make(true); |
|
|
|
$response = array( |
|
|
|
"draw" => intval($draw), |
|
|
|
"recordsTotal" => $totalRecords, |
|
|
|
"recordsFiltered" => $totalRecordswithFilter, |
|
|
|
"data" => $nested_data |
|
|
|
); |
|
|
|
|
|
|
|
return json_encode($response); |
|
|
|
} |
|
|
|
|
|
|
|
public function getAllResidential($type,$building,$dealer){ |
|
|
|
public function getAllResidential(Request $request,$type,$building,$dealer){ |
|
|
|
|
|
|
|
## Read value |
|
|
|
$draw = $request->get('draw'); |
|
|
|
$start = $request->get("start"); |
|
|
|
$rowperpage = $request->get("length"); // Rows display per page |
|
|
|
|
|
|
|
// $columnIndex_arr = $request->get('order'); |
|
|
|
// $columnName_arr = $request->get('columns'); |
|
|
|
// $order_arr = $request->get('order'); |
|
|
|
$search_arr = $request->get('search'); |
|
|
|
|
|
|
|
// $columnIndex = $columnIndex_arr[0]['column']; // Column index |
|
|
|
// $columnName = $columnName_arr[$columnIndex]['data']; // Column name |
|
|
|
// $columnSortOrder = $order_arr[0]['dir']; // asc or desc |
|
|
|
$searchValue = $search_arr['value']; // Search value |
|
|
|
|
|
|
|
// Total records |
|
|
|
$totalRecords = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_application','R')->select('count(*) as allcount')->count(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$totalRecordswithFilter = Form::whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->where('type_application','R')->select('count(*) as allcount')->count(); |
|
|
|
}else{ |
|
|
|
$totalRecordswithFilter = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_application','R')->select('count(*) as allcount')->count(); |
|
|
|
} |
|
|
|
|
|
|
|
$id = Auth::guard('cs')->id(); |
|
|
|
$user = Staff::with('StaffDetail')->find($id); |
|
|
|
@@ -745,7 +855,13 @@ class CustomerController extends Controller |
|
|
|
$nested_data = array(); |
|
|
|
|
|
|
|
if($type == 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(1000)->get(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->where('type_application','R')->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
}else{ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_application','R')->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
} |
|
|
|
}else if($type != 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); |
|
|
|
}else if($type != 'null' && $building != 'null' && $dealer == 'null'){ |
|
|
|
@@ -849,10 +965,42 @@ class CustomerController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return \DataTables::of($nested_data)->make(true); |
|
|
|
$response = array( |
|
|
|
"draw" => intval($draw), |
|
|
|
"recordsTotal" => $totalRecords, |
|
|
|
"recordsFiltered" => $totalRecordswithFilter, |
|
|
|
"data" => $nested_data |
|
|
|
); |
|
|
|
|
|
|
|
return json_encode($response); |
|
|
|
} |
|
|
|
|
|
|
|
public function getAllBusiness($type,$building,$dealer){ |
|
|
|
public function getAllBusiness(Request $request, $type,$building,$dealer){ |
|
|
|
|
|
|
|
## Read value |
|
|
|
$draw = $request->get('draw'); |
|
|
|
$start = $request->get("start"); |
|
|
|
$rowperpage = $request->get("length"); // Rows display per page |
|
|
|
|
|
|
|
// $columnIndex_arr = $request->get('order'); |
|
|
|
// $columnName_arr = $request->get('columns'); |
|
|
|
// $order_arr = $request->get('order'); |
|
|
|
$search_arr = $request->get('search'); |
|
|
|
|
|
|
|
// $columnIndex = $columnIndex_arr[0]['column']; // Column index |
|
|
|
// $columnName = $columnName_arr[$columnIndex]['data']; // Column name |
|
|
|
// $columnSortOrder = $order_arr[0]['dir']; // asc or desc |
|
|
|
$searchValue = $search_arr['value']; // Search value |
|
|
|
|
|
|
|
// Total records |
|
|
|
$totalRecords = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_application','B')->select('count(*) as allcount')->count(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$totalRecordswithFilter = Form::whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->where('type_application','B')->select('count(*) as allcount')->count(); |
|
|
|
}else{ |
|
|
|
$totalRecordswithFilter = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_application','B')->select('count(*) as allcount')->count(); |
|
|
|
} |
|
|
|
|
|
|
|
$id = Auth::guard('cs')->id(); |
|
|
|
$user = Staff::with('StaffDetail')->find($id); |
|
|
|
@@ -862,7 +1010,13 @@ class CustomerController extends Controller |
|
|
|
$nested_data = array(); |
|
|
|
|
|
|
|
if($type == 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->orderBy('created_at', 'desc')->take(1000)->get(); |
|
|
|
if ($searchValue==!null){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->whereHas('subscriber',function($q) use($searchValue){ |
|
|
|
$q->where('name', 'like', '%' .$searchValue . '%')->orWhere('company_name', 'like', '%' .$searchValue . '%'); |
|
|
|
})->where('type_application','B')->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
}else{ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_application','B')->orderBy('created_at', 'desc')->skip(intval($start))->take(intval($rowperpage))->get(); |
|
|
|
} |
|
|
|
}else if($type != 'null' && $building == 'null' && $dealer == 'null'){ |
|
|
|
$form = Form::with('Subscriber','PackageDetail','WorkOrder')->where('type_service',$type)->orderBy('created_at', 'desc')->get(); |
|
|
|
}else if($type != 'null' && $building != 'null' && $dealer == 'null'){ |
|
|
|
@@ -963,7 +1117,14 @@ class CustomerController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return \DataTables::of($nested_data)->make(true); |
|
|
|
$response = array( |
|
|
|
"draw" => intval($draw), |
|
|
|
"recordsTotal" => $totalRecords, |
|
|
|
"recordsFiltered" => $totalRecordswithFilter, |
|
|
|
"data" => $nested_data |
|
|
|
); |
|
|
|
|
|
|
|
return json_encode($response); |
|
|
|
} |
|
|
|
|
|
|
|
|