update for reorder and location points
This commit is contained in:
@ -60,7 +60,7 @@ class AuthService{
|
||||
|
||||
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
|
||||
print("---- cat url is ${url}");
|
||||
print("---- UserDetails url is ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -15,7 +15,7 @@ class CatService{
|
||||
|
||||
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
|
||||
print("---- cat url is ${url}");
|
||||
print("---- loadCats url is ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -38,7 +38,7 @@ class CatService{
|
||||
|
||||
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
|
||||
print("---- cat url is ${url}");
|
||||
print("---- loadCatByCity url is ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -1,14 +1,25 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
|
||||
class LocationService{
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location/';
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "";
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/location/?is_rog=True';
|
||||
}
|
||||
else {
|
||||
url = '${server_url}/api/location/';
|
||||
}
|
||||
//String url = 'http://localhost:8100/api/location/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -24,18 +35,27 @@ class LocationService{
|
||||
}
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
|
||||
if(cat.isNotEmpty){
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/inperf/?rog=True&perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
else {
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/inperf/?rog=True&perf=' + perfecture;
|
||||
}
|
||||
else {
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
||||
}
|
||||
}
|
||||
//print("----- url ---- ${url} --- ${cat}");
|
||||
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
print("----loadLocationsFor url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -52,17 +72,26 @@ class LocationService{
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
if(cat.isNotEmpty){
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/insubperf?rog=True&subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
print("------ loading location in sub----");
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/insubperf?rog=True&subperf=' + subperfecture;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||
}
|
||||
}
|
||||
print("----loadLocationsSubFor url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -78,19 +107,27 @@ class LocationService{
|
||||
}
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("cat is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/inbound?rog=True&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
//url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/inbound?rog=True&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
}
|
||||
}
|
||||
print("----url --- ${url}");
|
||||
print("----loadLocationsBound url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -115,21 +152,30 @@ class LocationService{
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String name, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
if(cat == "-all-"){
|
||||
cat = "";
|
||||
}
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("cat is ----- ${cat}");
|
||||
print("loadCustomLocations url is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
url = '${server_url}/api/custom_area/?&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/customarea?name=${name}&cat=' + cat;
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/custom_area/?rog=True&&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/custom_area/?&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/customarea?name=${name}&';
|
||||
//url = 'http://localhost:8100/api/customarea?name=${name}&';
|
||||
if(indexController.currentUser.length > 0){
|
||||
url = '${server_url}/api/customarea?rog=True&name=${name}&';
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/customarea?name=${name}&';
|
||||
}
|
||||
}
|
||||
print("----url --- ${url}");
|
||||
print("----loadCustomLocations url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
Reference in New Issue
Block a user