Complete Offline Wallet Display & Edit

This commit is contained in:
yaso 2026-06-30 16:21:47 +02:00
parent 6ad1ea613c
commit 04f034971f
21 changed files with 973 additions and 507 deletions

View file

@ -40,6 +40,25 @@ class MihMzansiCalendarApis {
}
}
static Future<int> getPersonalAppointmentsV2(
String app_id,
String date,
MihCalendarProvider mihCalendarProvider,
) async {
final response = await http.get(Uri.parse(
"${AppEnviroment.baseApiUrl}/appointments/personal/$app_id?date=$date"));
if (response.statusCode == 200) {
Iterable l = jsonDecode(response.body);
List<Appointment> personalAppointments =
List<Appointment>.from(l.map((model) => Appointment.fromJson(model)));
mihCalendarProvider.setPersonalAppointments(
appointments: personalAppointments);
return response.statusCode;
} else {
throw Exception('failed to fatch personal appointments');
}
}
/// This function is used to fetch a list of appointment for a personal user.
///
/// Patameters:

View file

@ -127,6 +127,32 @@ class MIHMzansiWalletApis {
// }
}
/// This function is used to Delete loyalty card from users mzansi wallet.
///
/// Patameters:-
/// AppUser signedInUser,
/// int idloyalty_cards,
/// BuildContext context,
///
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
static Future<int?> deleteLoyaltyCardAPICallV2(
int idloyalty_cards,
) async {
try {
var response = await http.delete(
Uri.parse(
"${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/delete/"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
body: jsonEncode(<String, dynamic>{"idloyalty_cards": idloyalty_cards}),
);
return response.statusCode;
} catch (error) {
return null;
}
}
/// This function is used to add a lopyalty card to users mzansi wallet.
///
/// Patameters:-
@ -187,6 +213,48 @@ class MIHMzansiWalletApis {
// }
}
/// This function is used to add a lopyalty card to users mzansi wallet.
///
/// Patameters:-
/// AppUser signedInUser,
/// String app_id,
/// String shop_name,
/// String card_number,
/// BuildContext context,
///
/// Returns VOID (TRIGGERS SUCCESS pop up)
static Future<int?> addLoyaltyCardAPICallV2(
String app_id,
String shop_name,
String card_number,
String favourite,
int priority_index,
String nickname,
) async {
try {
var response = await http
.post(
Uri.parse(
"${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/insert/"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
body: jsonEncode(<String, dynamic>{
"app_id": app_id,
"shop_name": shop_name,
"card_number": card_number,
"favourite": favourite,
"priority_index": priority_index,
"nickname": nickname,
}),
)
.timeout(const Duration(seconds: 5));
return response.statusCode;
} catch (error) {
return null;
}
}
/// This function is used to Update loyalty card from users mzansi wallet.
///
/// Patameters:-
@ -238,6 +306,42 @@ class MIHMzansiWalletApis {
return response.statusCode;
}
/// This function is used to Update loyalty card from users mzansi wallet.
///
/// Patameters:-
/// AppUser signedInUser,
/// int idloyalty_cards,
/// BuildContext context,
///
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
static Future<int?> updateLoyaltyCardAPICallV2(
int idloyalty_cards,
String favourite,
int priority_index,
String nickname,
String card_number,
) async {
try {
var response = await http.put(
Uri.parse(
"${AppEnviroment.baseApiUrl}/mzasni-wallet/loyalty-cards/update/"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
body: jsonEncode(<String, dynamic>{
"idloyalty_cards": idloyalty_cards,
"favourite": favourite,
"priority_index": priority_index,
"nickname": nickname,
"card_number": card_number,
}),
);
return response.statusCode;
} catch (error) {
return null;
}
}
//================== POP UPS ==========================================================================
static void loadingPopUp(BuildContext context) {