update for permission and destination ordering

This commit is contained in:
Mohamed Nouffer
2023-01-19 16:39:25 +05:30
parent 07653e9b9e
commit cf14a85eaf
5 changed files with 99 additions and 40 deletions

View File

@ -98,6 +98,35 @@ class DatabaseHelper{
return roglist;
}
Future clearSelection() async {
Database db = await instance.database;
Map<String, dynamic> row_clear = {
"selected": false
};
return await db.update(
"destination",
row_clear
);
}
Future<int> toggleSelecttion(Destination dest) async {
Database db = await instance.database;
bool val = !dest.selected!;
Map<String, dynamic> row_target = {
"selected": val
};
await clearSelection();
return await db.update(
"destination",
row_target,
where: 'location_id = ?',
whereArgs: [dest.location_id!]
);
}
Future<int> deleteRogaining(int id) async {
Database db = await instance.database;
var rog = await db.delete('rog', where: "id = ${id}");