update for routing
This commit is contained in:
@ -4,9 +4,10 @@
|
||||
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.103:8100";
|
||||
static const dev_ip_server = "http://192.168.8.100:8100";
|
||||
static const dev_home_ip_server = "http://192.168.1.10:8100";
|
||||
|
||||
static String currentServer(){
|
||||
return dev_ip_server;
|
||||
return server_uri;
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,17 +66,22 @@ class DatabaseHelper{
|
||||
return destList;
|
||||
}
|
||||
|
||||
Future<int> deleteDestination(int location_id) async {
|
||||
Future<int> deleteDestination(int location_id) async {
|
||||
Database db = await instance.database;
|
||||
var dest = await db.delete('destination', where: "location_id = ${location_id}");
|
||||
int ret = dest > 0 ? dest : -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Future<void> deleteAllDestinations() async {
|
||||
Database db = await instance.database;
|
||||
await db.delete('destination');
|
||||
}
|
||||
|
||||
Future<bool>isAlreadyAvailable(int location_id) async{
|
||||
Database db = await instance.database;
|
||||
var dest = await db.delete('destination', where: "location_id = ${location_id}");
|
||||
return dest > 0 ? true : false;
|
||||
var dest = await db.query('destination', where: "location_id = ${location_id}");
|
||||
return dest.length > 0 ? true : false;
|
||||
}
|
||||
|
||||
Future<int> insertDestination(Destination dest) async {
|
||||
@ -108,6 +113,42 @@ class DatabaseHelper{
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updateOrder(Destination d, int dir)async {
|
||||
Database db = await instance.database;
|
||||
var target = await db.query('destination', where: "list_order = ${d.list_order! + dir}");
|
||||
var dest = await db.query('destination', where: "location_id = ${d.location_id}");
|
||||
if(target.isNotEmpty){
|
||||
|
||||
List<Destination> target_indb = target.isNotEmpty
|
||||
? target.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
|
||||
List<Destination> dest_indb = dest.isNotEmpty
|
||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
|
||||
Map<String, dynamic> row_target = {
|
||||
"list_order": d.list_order
|
||||
};
|
||||
|
||||
Map<String, dynamic> row_des = {
|
||||
"list_order": dest_indb[0].list_order
|
||||
};
|
||||
|
||||
await db.update(
|
||||
"destination",
|
||||
row_target,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [target_indb[0]!.location_id]
|
||||
);
|
||||
|
||||
await db.update(
|
||||
"destination",
|
||||
row_des,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [dest_indb[0]!.location_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Future<int?> getPending() async{
|
||||
// Database db = await instance.database;
|
||||
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
||||
|
||||
@ -31,7 +31,11 @@ class StringValues extends Translations{
|
||||
'no_values': 'No Values',
|
||||
'email_and_password_required': 'Email and password required',
|
||||
'rogaining_user_need_tosign_up': "Rogaining participants do need to sign up.",
|
||||
'add_location': 'Add Location'
|
||||
'add_location': 'Add Location',
|
||||
'select_travel_mode':'Select your travel mode',
|
||||
'walking':'Walking',
|
||||
'driving': 'Driving',
|
||||
'transit': 'Transit'
|
||||
},
|
||||
'ja_JP': {
|
||||
'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます',
|
||||
@ -63,7 +67,11 @@ class StringValues extends Translations{
|
||||
'no_values': '値なし',
|
||||
'email_and_password_required': 'メールとパスワードが必要です',
|
||||
'rogaining_user_need_tosign_up': "ロゲイニング参加者はサインアップの必要はありません。",
|
||||
'add_location': '目的地選択'
|
||||
'add_location': '目的地選択',
|
||||
'select_travel_mode':'移動モードを選択してください',
|
||||
'walking':'ウォーキング',
|
||||
'driving': '運転中',
|
||||
'transit': 'トランジット'
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user