This commit is contained in:
Mohamed Nouffer
2022-06-14 14:37:59 +05:30
parent 3d9f20fd66
commit ba70fa0080
22 changed files with 640 additions and 115 deletions

View File

@ -1,13 +1,15 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:rogapp/utils/const.dart';
class PerfectureService{
static Future<List<dynamic>?> loadPerfectures() async {
List<dynamic> perfs = [];
//String url = 'http://container.intranet.sumasen.net:8100/api/perf_main/';
String url = 'http://localhost:8100/api/perf_main/';
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/perf_main/';
//String url = 'http://localhost:8100/api/perf_main/';
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -23,8 +25,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
List<dynamic> perfs = [];
//String url = 'http://container.intranet.sumasen.net:8100/api/subperfinmain/?perf=' + sub;
String url = 'http://localhost:8100/api/subperfinmain/?area=' + area;
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/subperfinmain/?area=' + area;
//String url = 'http://localhost:8100/api/subperfinmain/?area=' + area;
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -41,8 +44,9 @@ class PerfectureService{
static Future<List<dynamic>?> getMainPerfExt(String id) async {
List<dynamic> perfs = [];
//String url = 'http://container.intranet.sumasen.net:8100/api/mainperfext/?perf=' + id;
String url = 'http://localhost:8100/api/mainperfext/?perf=' + id;
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/mainperfext/?perf=' + id;
//String url = 'http://localhost:8100/api/mainperfext/?perf=' + id;
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -58,8 +62,27 @@ class PerfectureService{
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
List<dynamic> perfs = [];
//String url = 'http://container.intranet.sumasen.net:8100/api/allgifuareas/?perf' + perf;
String url = 'http://localhost:8100/api/allgifuareas/?perf=' + perf;
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/allgifuareas/?perf=' + perf;
//String url = 'http://localhost:8100/api/allgifuareas/?perf=' + perf;
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
perfs = json.decode(utf8.decode(response.bodyBytes));
}
return perfs;
}
static Future<List<dynamic>?> loadCustomAreas() async {
List<dynamic> perfs = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/customareanames';
//String url = 'http://localhost:8100/api/customareanames';
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -76,8 +99,9 @@ class PerfectureService{
static Future<List<dynamic>?> getSubExt(String id) async {
List<dynamic> perfs = [];
//String url = 'http://container.intranet.sumasen.net:8100/api/perfext/?sub_perf=' + id;
String url = 'http://localhost:8100/api/perfext/?sub_perf=' + id;
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/perfext/?sub_perf=' + id;
//String url = 'http://localhost:8100/api/perfext/?sub_perf=' + id;
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',