update for reorder and location points

This commit is contained in:
Mohamed Nouffer
2022-09-01 19:14:18 +05:30
parent a4adf24e99
commit 09ac737de5
12 changed files with 196 additions and 143 deletions

View File

@ -4,9 +4,9 @@
class ConstValues{
static const server_uri = "http://container.intranet.sumasen.net:8100";
static const dev_server = "http://localhost:8100";
static const dev_ip_server = "http://192.168.8.100:8100";
static const dev_ip_server = "http://192.168.8.103:8100";
static String currentServer(){
return server_uri;
}
}
}

View File

@ -41,14 +41,17 @@ class DatabaseHelper{
checkin_radious REAL,
auto_checkin INTEGER,
selected INTEGER,
checkedin INTEGER
checkedin INTEGER,
cp REAL,
checkin_point REAL,
buy_point REAL
)
''');
}
Future<List<Destination>> getDestinations() async {
Database db = await instance.database;
var dest = await db.query('destination');
var dest = await db.query('destination', orderBy: 'list_order');
List<Destination> destList = dest.isNotEmpty ?
dest.map((e) => Destination.fromMap(e)).toList() : [];
print("--------- ${destList}");
@ -57,7 +60,7 @@ class DatabaseHelper{
Future<List<Destination>> getDestinationByLatLon(double lat, double lon) async {
Database db = await instance.database;
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}");
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}", orderBy: 'list_order');
List<Destination> destList = dest.isNotEmpty
? dest.map((e) => Destination.fromMap(e)).toList() : [];
return destList;
@ -78,6 +81,10 @@ class DatabaseHelper{
Future<int> insertDestination(Destination dest) async {
Database db = await instance.database;
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination'));
next_order = next_order==null ? 0 : next_order;
next_order = next_order + 1;
dest.list_order = next_order;
int res = await db.insert(
'destination',
dest.toMap(),