49 lines
1.1 KiB
Dart
49 lines
1.1 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:get/get.dart';
|
|
import 'package:Intaleq/constant/box_name.dart';
|
|
import 'package:Intaleq/constant/links.dart';
|
|
import 'package:Intaleq/controller/functions/crud.dart';
|
|
import 'package:Intaleq/main.dart';
|
|
|
|
import '../../views/widgets/mydialoug.dart';
|
|
|
|
class PassengerWalletHistoryController extends GetxController {
|
|
bool isLoading = false;
|
|
List archive = [];
|
|
|
|
Future<void> getArchivePayment() async {
|
|
try {
|
|
isLoading = true;
|
|
update();
|
|
|
|
var res = await CRUD().getWallet(
|
|
link: AppLink.getPassengerWalletArchive,
|
|
payload: {'passenger_id': box.read(BoxName.passengerID)},
|
|
);
|
|
|
|
if (res != 'failure') {
|
|
archive = jsonDecode(res)['message'];
|
|
} else {
|
|
MyDialog().getDialog('No wallet record found'.tr, '', () {
|
|
Get.back();
|
|
Get.back();
|
|
});
|
|
}
|
|
} catch (e) {
|
|
// MyDialog().getDialog('An error occurred'.tr, '', () {
|
|
// Get.back();
|
|
// });
|
|
} finally {
|
|
isLoading = false;
|
|
update();
|
|
}
|
|
}
|
|
|
|
@override
|
|
void onInit() {
|
|
getArchivePayment();
|
|
super.onInit();
|
|
}
|
|
}
|