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