89 lines
2.7 KiB
PHP
89 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
use App\Utilities\ApiCalls;
|
|
use Session;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AdminController extends Controller
|
|
{
|
|
public function index(){
|
|
$users_url = "user_mgt/get_all_users.php";
|
|
$data = ['api_token' => env('LUPMISAPIKEY')];
|
|
$result = ApiCalls::CurlPost(json_encode($data), $users_url);
|
|
$users_arr = json_decode($result, true);
|
|
if ($users_arr['success'] == false) {
|
|
return redirect->back();
|
|
}
|
|
|
|
$regions_url = "user_mgt/get_all_regions.php";
|
|
$data = ['api_token' => env('LUPMISAPIKEY')];
|
|
$result = ApiCalls::CurlPost(json_encode($data), $regions_url);
|
|
$regions_arr = json_decode($result, true);
|
|
if ($regions_arr['success'] == false) {
|
|
return redirect->back();
|
|
}
|
|
|
|
$user_type_arr = [
|
|
'district_user' => 'District User',
|
|
'regional_user' => 'Regional User',
|
|
'national_user' => 'National User'
|
|
];
|
|
|
|
$data = [
|
|
'page_title' => 'User Admin',
|
|
'users_arr' => $users_arr['data'],
|
|
'regions_arr' => $regions_arr['data'],
|
|
'user_type_arr' => $user_type_arr
|
|
];
|
|
return view('admin.home', $data);
|
|
}
|
|
public function districtparams(){
|
|
|
|
$url = "user_mgt/get_district_parameters.php";
|
|
$data = json_encode([
|
|
'district_id' => 171,
|
|
'api_token' => env('LUPMISAPIKEY')
|
|
]);
|
|
$result = ApiCalls::CurlPost($data, $url);
|
|
$result = json_decode($result, true);
|
|
// dd($result);
|
|
$data = [
|
|
'page_title' => "Page Under Development"
|
|
];
|
|
return view('common.notready', $data);
|
|
}
|
|
public function luspaparams(){
|
|
$data = [
|
|
'page_title' => "Page Under Development"
|
|
];
|
|
return view('common.notready', $data);
|
|
}
|
|
public function districts($reqion_id){
|
|
// return response()->json(['request' => $reqion_id]);
|
|
$url = "user_mgt/get_district_by_region_id.php";
|
|
$data = json_encode([
|
|
'region_id' => $reqion_id,
|
|
'api_token' => env('LUPMISAPIKEY')
|
|
]);
|
|
$result = ApiCalls::CurlPost($data, $url);
|
|
$results = json_decode($result, true);
|
|
|
|
$result = ['code' => 1, 'districts' => $results['data']];
|
|
if (request()->expectsJson()) {
|
|
return response()->json($result);
|
|
}
|
|
$data = [
|
|
'page_title' => 'Not Ready'
|
|
];
|
|
return view('common.notready', $data);
|
|
}
|
|
|
|
public function reports(){
|
|
$data = [
|
|
'page_title' => "Page Under Development"
|
|
];
|
|
return view('common.notready', $data);
|
|
}
|
|
}
|