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.
diplomatic-quarter/lib/core/service/medical/PatientSickLeaveService.dart

51 lines
1.9 KiB
Dart

import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class PatientSickLeaveService extends BaseService {
List<SickLeave> sickLeaveList = [];
String sickLeavePDF = "";
getSickLeave() async {
hasError = false;
super.error = "";
await baseAppClient.post(GET_PATIENT_SICK_LEAVE_STATUS, onSuccess: (response, statusCode) async {
sickLeaveList.clear();
if (response['List_SickLeave'] != null && response['List_SickLeave'].length != 0) {
response['List_SickLeave'].forEach((sickLeave) {
sickLeaveList.add(SickLeave.fromJson(sickLeave));
});
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: Map());
}
sendSickLeaveEmail({required int requestNo, required String projectName, required String doctorName, required int projectID, required String setupID, required bool isDownload}) async {
hasError = false;
super.error = "";
Map<String, dynamic> body = Map();
body['RequestNo'] = requestNo;
body['To'] = user.emailAddress;
body['DateofBirth'] = user.dateofBirth;
body['PatientIditificationNum'] = user.patientIdentificationNo;
body['PatientMobileNumber'] = user.mobileNumber;
body['PatientName'] = user.firstName! + " " + user.firstName!;
body['ProjectName'] = projectName;
body['DoctorName'] = doctorName;
body['ProjectID'] = projectID;
body['SetupID'] = setupID;
body['IsDownload'] = isDownload;
await baseAppClient.post(SendSickLeaveEmail, onSuccess: (response, statusCode) async {
if(isDownload) {
sickLeavePDF = response['Base64Data'];
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}