permission fixes

This commit is contained in:
Suriya
2026-07-23 15:59:24 +05:30
parent 14fffa40c6
commit 4270122229
3 changed files with 198 additions and 2 deletions

View File

@@ -52,6 +52,48 @@ class CustomerRequestProvider with ChangeNotifier {
}
}
/// Submit an account deletion request (reuses the same request pipeline
/// used for support tickets, tagged so the backend/support team can
/// identify and action it as a deletion instead of general support).
Future<bool> sendAccountDeletionRequest() async {
isLoading = true;
notifyListeners();
SharedPreferences prefs = await SharedPreferences.getInstance();
int? customerId = prefs.getInt('customerId');
if (customerId == null) {
isLoading = false;
notifyListeners();
throw Exception("Something went wrong");
}
final model = CustomerRequestModel(
referencedate: DateTime.now().toUtc().toIso8601String().split('.').first + 'Z',
referencetype: "account_deletion",
customerid: customerId,
tenantid: 0,
locationid: 0,
subject: "Account Deletion Request",
remarks: "Customer has requested deletion of their account and associated data.",
status: 0,
apptypeid: 98,
);
final result = await _repository.createCustomerRequest(model);
isLoading = false;
notifyListeners();
if (result != null && result is Map<String, dynamic> && result["status"] != false) {
debugPrint("✅ Account deletion request submitted: $result");
return true;
} else {
debugPrint("❌ Account deletion request failed: $result");
return false;
}
}
/// Fetch customer requests (status)
Future<void> fetchCustomerRequests({int pageNo = 1, int pageSize = 10}) async {
isLoading = true;