You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
4.2 KiB
Dart
122 lines
4.2 KiB
Dart
import 'package:diplomaticquarterapp/config/config.dart';
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
|
import 'package:diplomaticquarterapp/models/Request.dart';
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
class MyInvoicesService extends BaseService {
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
AppGlobal appGlobal = new AppGlobal();
|
|
|
|
AuthenticatedUser authUser = new AuthenticatedUser();
|
|
AuthProvider authProvider = new AuthProvider();
|
|
|
|
Future<Map> getAllDentalAppointments(int projectID, context) async {
|
|
Map<String, dynamic> request;
|
|
var languageID =
|
|
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
|
|
Request req = appGlobal.getPublicRequest();
|
|
request = {
|
|
"LanguageID": languageID == 'ar' ? 1 : 2,
|
|
"IPAdress": "10.20.10.20",
|
|
"VersionID": req.VersionID,
|
|
"Channel": req.Channel,
|
|
"generalid": 'Cs2020@2016\$2958',
|
|
"PatientOutSA": authUser.outSA,
|
|
"DeviceTypeID": req.DeviceTypeID,
|
|
"SessionID": null,
|
|
"PatientID": authUser.patientID,
|
|
"License": true,
|
|
"IsRegistered": true,
|
|
"ProjectID": projectID,
|
|
"PatientTypeID": authUser.patientIdentificationType,
|
|
"PatientType": authUser.patientType,
|
|
"isDentalAllowedBackend": false
|
|
};
|
|
|
|
dynamic localRes;
|
|
|
|
await baseAppClient.post(GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC,
|
|
onSuccess: (response, statusCode) async {
|
|
localRes = response;
|
|
}, onFailure: (String error, int statusCode) {
|
|
throw error;
|
|
}, body: request);
|
|
return Future.value(localRes);
|
|
}
|
|
|
|
Future<Map> getDentalAppointmentInvoice(int projectID, int appoNo, context) async {
|
|
Map<String, dynamic> request;
|
|
var languageID =
|
|
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
|
|
Request req = appGlobal.getPublicRequest();
|
|
request = {
|
|
"LanguageID": languageID == 'ar' ? 1 : 2,
|
|
"IPAdress": "10.20.10.20",
|
|
"VersionID": req.VersionID,
|
|
"Channel": req.Channel,
|
|
"generalid": 'Cs2020@2016\$2958',
|
|
"PatientOutSA": authUser.outSA,
|
|
"DeviceTypeID": req.DeviceTypeID,
|
|
"SessionID": null,
|
|
"PatientID": authUser.patientID,
|
|
"License": true,
|
|
"AppointmentNo": appoNo,
|
|
"IsRegistered": true,
|
|
"ProjectID": projectID,
|
|
"PatientTypeID": authUser.patientIdentificationType,
|
|
"PatientType": authUser.patientType,
|
|
"isDentalAllowedBackend": false
|
|
};
|
|
|
|
dynamic localRes;
|
|
|
|
await baseAppClient.post(GET_DENTAL_APPOINTMENT_INVOICE,
|
|
onSuccess: (response, statusCode) async {
|
|
localRes = response;
|
|
}, onFailure: (String error, int statusCode) {
|
|
throw error;
|
|
}, body: request);
|
|
return Future.value(localRes);
|
|
}
|
|
|
|
Future<Map> sendDentalAppointmentInvoiceEmail(int projectID, int appoNo, context) async {
|
|
Map<String, dynamic> request;
|
|
var languageID =
|
|
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
|
|
Request req = appGlobal.getPublicRequest();
|
|
request = {
|
|
"LanguageID": languageID == 'ar' ? 1 : 2,
|
|
"IPAdress": "10.20.10.20",
|
|
"VersionID": req.VersionID,
|
|
"Channel": req.Channel,
|
|
"generalid": 'Cs2020@2016\$2958',
|
|
"PatientOutSA": authUser.outSA,
|
|
"DeviceTypeID": req.DeviceTypeID,
|
|
"SessionID": null,
|
|
"PatientID": authUser.patientID,
|
|
"License": true,
|
|
"AppointmentNo": appoNo,
|
|
"To": authProvider.authenticatedUserObject.user.emailAddress,
|
|
"IsRegistered": true,
|
|
"ProjectID": projectID,
|
|
"PatientTypeID": authUser.patientIdentificationType,
|
|
"PatientType": authUser.patientType,
|
|
"isDentalAllowedBackend": false
|
|
};
|
|
|
|
dynamic localRes;
|
|
|
|
await baseAppClient.post(SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL,
|
|
onSuccess: (response, statusCode) async {
|
|
localRes = response;
|
|
}, onFailure: (String error, int statusCode) {
|
|
throw error;
|
|
}, body: request);
|
|
return Future.value(localRes);
|
|
}
|
|
|
|
}
|