added cancel buypoints
This commit is contained in:
@ -416,9 +416,15 @@ class BuyPointCamera extends StatelessWidget {
|
||||
: const Text("撮影")),
|
||||
const SizedBox(width: 10,),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(
|
||||
context, destination);
|
||||
onPressed: () async {
|
||||
await destinationController.cancelBuyPoint(
|
||||
destination);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value =
|
||||
true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value =
|
||||
false;
|
||||
},
|
||||
child: const Text("買い物なし"))
|
||||
],
|
||||
|
||||
@ -150,6 +150,7 @@ class DestinationController extends GetxController {
|
||||
: false;
|
||||
bool buyPointImageAdded =
|
||||
dss != null && dss.buypoint_image != null ? true : false;
|
||||
bool buyPointCanceled = dss != null && dss.buy_point != null && dss.buy_point == 0 ? true : false;
|
||||
bool locationAlreadyCheckedIn =
|
||||
ds.length > 0 && ds[0].checkedin == true ? true : false;
|
||||
bool isuserLoggedIn = indexController.currentUser.isNotEmpty ? true : false;
|
||||
@ -296,6 +297,7 @@ class DestinationController extends GetxController {
|
||||
buyPointImageAdded == false &&
|
||||
ds.isNotEmpty &&
|
||||
buyPoint == true &&
|
||||
buyPointCanceled == false &&
|
||||
is_in_rog.value == true) {
|
||||
chekcs = 5;
|
||||
is_in_checkin.value = true;
|
||||
@ -616,9 +618,14 @@ class DestinationController extends GetxController {
|
||||
saveGameState();
|
||||
}
|
||||
|
||||
Future<void> cancelBuyPoint(Destination destination) async {
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
await db.updateCancelBuyPoint(destination);
|
||||
PopulateDestinations();
|
||||
}
|
||||
|
||||
Future<void> makeBuyPoint(Destination destination, String imageurl) async {
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
|
||||
await db.updateBuyPoint(destination, imageurl);
|
||||
PopulateDestinations();
|
||||
await GallerySaver.saveImage(imageurl);
|
||||
|
||||
@ -262,6 +262,20 @@ class DatabaseHelper{
|
||||
return res;
|
||||
}
|
||||
|
||||
Future<int> updateCancelBuyPoint(Destination destination)async {
|
||||
print("---- updating puypint image in db -----");
|
||||
Database db = await instance.database;
|
||||
Map<String, dynamic> row = {
|
||||
"buy_point": 0
|
||||
};
|
||||
return await db.update(
|
||||
"destination",
|
||||
row,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [destination.location_id!]
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> updateBuyPoint(Destination destination, String imageUrl)async {
|
||||
print("---- updating puypint image in db -----");
|
||||
Database db = await instance.database;
|
||||
|
||||
Reference in New Issue
Block a user