PDF report implemented for Lab, Rad, Prescription, SickLeave & Medical Report.

dev_v3.13.6_search_hospital_by_region
haroon amjad 7 months ago
parent 0c3ef15895
commit 1ee86d0813

@ -21,14 +21,14 @@ var PACKAGES_ORDERS = '/api/orders';
var PACKAGES_ORDER_HISTORY = '/api/orders/items';
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:2018/';
var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'http://10.201.204.103/';
// var BASE_URL = 'https://orash.cloudsolutions.com.sa/';
// var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/';
// var BASE_URL = 'https://vidamergeuat.cloudsolutions.com.sa/';
// var BASE_URL = 'https://webservices.hmg.com/';
var BASE_URL = 'https://webservices.hmg.com/';
// var BASE_URL = 'http://10.50.100.198:4422/';

@ -28,6 +28,7 @@ class RequestSendPrescriptionEmail {
int? projectID;
List<PrescriptionReport>? listPrescriptions;
List<PrescriptionReportINP>? listPrescriptionsINP;
bool? isDownload;
RequestSendPrescriptionEmail(
{this.appointmentDate,
@ -53,7 +54,8 @@ class RequestSendPrescriptionEmail {
this.clinicName,
this.doctorName,
this.projectID,
this.doctorID});
this.doctorID,
this.isDownload});
RequestSendPrescriptionEmail.fromJson(Map<String, dynamic> json) {
appointmentDate = json['AppointmentDate'];
@ -114,6 +116,7 @@ class RequestSendPrescriptionEmail {
data['DoctorName'] = this.doctorName;
data['ProjectID'] = this.projectID;
data['DoctorID'] = this.doctorID;
data['IsDownload'] = this.isDownload;
return data;
}
}

@ -28,6 +28,7 @@ class RequestSendRadReportEmail {
String? tokenID;
double? versionID;
int? invoiceLineItemNo;
bool? isDownload;
RequestSendRadReportEmail(
{this.channel,
@ -57,7 +58,7 @@ class RequestSendRadReportEmail {
this.setupID,
this.to,
this.tokenID,
this.versionID});
this.versionID, this.isDownload});
RequestSendRadReportEmail.fromJson(Map<String, dynamic> json) {
channel = json['Channel'];
@ -122,6 +123,7 @@ class RequestSendRadReportEmail {
data['TokenID'] = this.tokenID;
data['VersionID'] = this.versionID;
data['InvoiceLineItemNo'] = this.invoiceLineItemNo;
data['IsDownload'] = this.isDownload;
return data;
}
}

@ -3,15 +3,16 @@ 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 =[];
List<SickLeave> sickLeaveList = [];
String sickLeavePDF = "";
getSickLeave() async {
hasError = false;
super.error = "";
await baseAppClient.post(GET_PATIENT_SICK_LEAVE_STATUS,
onSuccess: (response, statusCode) async {
await baseAppClient.post(GET_PATIENT_SICK_LEAVE_STATUS, onSuccess: (response, statusCode) async {
sickLeaveList.clear();
if(response['List_SickLeave'] != null && response['List_SickLeave'].length != 0) {
if (response['List_SickLeave'] != null && response['List_SickLeave'].length != 0) {
response['List_SickLeave'].forEach((sickLeave) {
sickLeaveList.add(SickLeave.fromJson(sickLeave));
});
@ -22,12 +23,7 @@ class PatientSickLeaveService extends BaseService {
}, body: Map());
}
sendSickLeaveEmail(
{required int requestNo,
required String projectName,
required String doctorName,
required int projectID,
required String setupID}) async {
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();
@ -41,9 +37,12 @@ class PatientSickLeaveService extends BaseService {
body['DoctorName'] = doctorName;
body['ProjectID'] = projectID;
body['SetupID'] = setupID;
await baseAppClient
.post(SendSickLeaveEmail, onSuccess: (response, statusCode) async {},
onFailure: (String error, int statusCode) {
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);

@ -16,12 +16,14 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:flutter/cupertino.dart';
class PrescriptionsService extends BaseService {
List<Prescriptions> prescriptionsList =[];
List<PrescriptionReportINP> prescriptionReportListINP =[];
List<GetCMCAllOrdersResponseModel> prescriptionsOrderList =[];
List<PrescriptionInfoRCModel> prescriptionsOrderListRC =[];
List<Prescriptions> prescriptionsList = [];
List<PrescriptionReportINP> prescriptionReportListINP = [];
List<GetCMCAllOrdersResponseModel> prescriptionsOrderList = [];
List<PrescriptionInfoRCModel> prescriptionsOrderListRC = [];
var isMedDeliveryAllowed;
String prescriptionReportPDF = "";
Future getPrescriptions() async {
hasError = false;
Map<String, dynamic> body = Map();
@ -80,7 +82,7 @@ class PrescriptionsService extends BaseService {
}
RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false);
List<PrescriptionReport> prescriptionReportList =[];
List<PrescriptionReport> prescriptionReportList = [];
Future getPrescriptionReport({required Prescriptions prescriptions}) async {
hasError = false;
@ -121,7 +123,7 @@ class PrescriptionsService extends BaseService {
isDentalAllowedBackend: false,
);
Future sendPrescriptionEmail(String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID, bool isInOutPatient) async {
Future sendPrescriptionEmail(String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID, bool isInOutPatient, bool isDownload) async {
_requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList;
_requestSendPrescriptionEmail.listPrescriptionsINP = prescriptionReportListINP;
_requestSendPrescriptionEmail.appointmentDate = appointmentDate;
@ -137,8 +139,13 @@ class PrescriptionsService extends BaseService {
_requestSendPrescriptionEmail.patientName = user.firstName! + " " + user.lastName!;
_requestSendPrescriptionEmail.setupID = user.setupID;
_requestSendPrescriptionEmail.to = user.emailAddress;
_requestSendPrescriptionEmail.isDownload = isDownload;
hasError = false;
await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {}, onFailure: (String error, int statusCode) {
await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {
if (isDownload) {
prescriptionReportPDF = response["Base64Data"];
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestSendPrescriptionEmail.toJson());
@ -149,7 +156,7 @@ class PrescriptionsService extends BaseService {
longitude: 0,
isDentalAllowedBackend: false,
);
List<PharmacyPrescriptions> pharmacyPrescriptionsList =[];
List<PharmacyPrescriptions> pharmacyPrescriptionsList = [];
Future getListPharmacyForPrescriptions({required int itemId}) async {
hasError = false;
@ -177,7 +184,7 @@ class PrescriptionsService extends BaseService {
isDentalAllowedBackend: false,
);
List<PrescriptionReportEnh> prescriptionReportEnhList =[];
List<PrescriptionReportEnh> prescriptionReportEnhList = [];
Future getPrescriptionReportEnh({required PrescriptionsOrder prescriptionsOrder}) async {
bool isInPatient = false;

@ -10,6 +10,8 @@ class RadiologyService extends BaseService {
bool isRadiologyVIDAPlus = false;
String radReportPDF = "";
Future getRadImageURL({int? invoiceNo, String? invoiceType, int? lineItem, int? projectId, bool? isVidaPlus}) async {
hasError = false;
final Map<String, dynamic> body = new Map<String, dynamic>();
@ -64,7 +66,7 @@ class RadiologyService extends BaseService {
RequestSendRadReportEmail _requestSendRadReportEmail = RequestSendRadReportEmail();
Future sendRadReportEmail({FinalRadiology? finalRadiology, AuthenticatedUser? userObj}) async {
Future sendRadReportEmail({FinalRadiology? finalRadiology, AuthenticatedUser? userObj, required bool isDownload}) async {
_requestSendRadReportEmail.projectID = finalRadiology!.projectID;
_requestSendRadReportEmail.clinicName = finalRadiology.clinicDescription;
_requestSendRadReportEmail.invoiceNo = finalRadiology.invoiceNo;
@ -81,9 +83,14 @@ class RadiologyService extends BaseService {
_requestSendRadReportEmail.to = userObj.emailAddress;
_requestSendRadReportEmail.dateofBirth = userObj.dateofBirth;
_requestSendRadReportEmail.invoiceType = finalRadiology.invoiceType;
_requestSendRadReportEmail.isDownload = isDownload;
hasError = false;
await baseAppClient.post(SEND_RAD_REPORT_EMAIL, isAllowAny: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) {
await baseAppClient.post(SEND_RAD_REPORT_EMAIL, isAllowAny: true, onSuccess: (dynamic response, int statusCode) {
if(isDownload) {
radReportPDF = response["Base64Data"];
}
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _requestSendRadReportEmail.toJson());

@ -5,11 +5,19 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:open_filex/open_filex.dart';
import 'package:path_provider/path_provider.dart';
class PatientSickLeaveViewMode extends BaseViewModel {
PatientSickLeaveService _patientSickLeaveService = locator<PatientSickLeaveService>();
List<SickLeave> get sickLeaveList => _patientSickLeaveService.sickLeaveList;
String get sickLeavePDF => _patientSickLeaveService.sickLeavePDF;
getSickLeave() async {
setState(ViewState.Busy);
await _patientSickLeaveService.getSickLeave();
@ -21,16 +29,36 @@ class PatientSickLeaveViewMode extends BaseViewModel {
}
}
Future sendSickLeaveEmail({required String message, required int requestNo, required String projectName, required String doctorName, required int projectID, required String setupID}) async {
Future sendSickLeaveEmail(
{required String message, required int requestNo, required String projectName, required String doctorName, required int projectID, required String setupID, required bool isDownload}) async {
setState(ViewState.Busy);
await _patientSickLeaveService.sendSickLeaveEmail(requestNo: requestNo, projectName: projectName, doctorName: doctorName, projectID: projectID, setupID: setupID);
await _patientSickLeaveService.sendSickLeaveEmail(requestNo: requestNo, projectName: projectName, doctorName: doctorName, projectID: projectID, setupID: setupID, isDownload: isDownload);
if (_patientSickLeaveService.hasError) {
error = _patientSickLeaveService.error!;
setState(ViewState.ErrorLocal);
AppToast.showErrorToast(message: error);
} else {
AppToast.showSuccessToast(message: message);
if (isDownload) {
if (sickLeavePDF.isNotEmpty) {
String path = await _createFileFromString(sickLeavePDF, "pdf");
try {
OpenFilex.open(path);
} catch (ex) {
AppToast.showErrorToast(message: "Cannot open file.");
}
}
} else {
AppToast.showSuccessToast(message: message);
}
setState(ViewState.Idle);
}
}
Future<String> _createFileFromString(String encodedStr, String ext) async {
Uint8List bytes = base64.decode(encodedStr);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext);
await file.writeAsBytes(bytes);
return file.path;
}
}

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:open_filex/open_filex.dart';
import '../../../core/enum/filter_type.dart';
import '../../../core/enum/viewstate.dart';
@ -15,17 +16,20 @@ import '../../../core/service/medical/prescriptions_service.dart';
import '../../../locator.dart';
import '../base_view_model.dart';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:path_provider/path_provider.dart';
class PrescriptionsViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic;
PrescriptionsService _prescriptionsService = locator<PrescriptionsService>();
List<PrescriptionsList> _prescriptionsOrderListClinic =[];
List<PrescriptionsList> _prescriptionsOrderListHospital =[];
List<PrescriptionsList> _prescriptionsOrderListClinic = [];
List<PrescriptionsList> _prescriptionsOrderListHospital = [];
List<PrescriptionReport> get prescriptionReportList => _prescriptionsService.prescriptionReportList;
List<PrescriptionReportINP> get prescriptionReportListINP => _prescriptionsService.prescriptionReportListINP;
List<Prescriptions> get prescriptionsList => _prescriptionsService.prescriptionsList;
@ -45,6 +49,9 @@ class PrescriptionsViewModel extends BaseViewModel {
}
get isMedDeliveryAllowed => _prescriptionsService.isMedDeliveryAllowed;
String get prescriptionReportPDF => _prescriptionsService.prescriptionReportPDF;
getPrescriptions() async {
setState(ViewState.Busy);
await _prescriptionsService.getPrescriptions();
@ -114,15 +121,36 @@ class PrescriptionsViewModel extends BaseViewModel {
}
}
sendPrescriptionEmail({required String appointmentDate, required int patientID, required String clinicName, required String doctorName, required int doctorID, required String mes, required int projectID, required bool isInOutPatient}) async {
sendPrescriptionEmail(
{required String appointmentDate,
required int patientID,
required String clinicName,
required String doctorName,
required int doctorID,
required String mes,
required int projectID,
required bool isInOutPatient,
required bool isDownload}) async {
setState(ViewState.BusyLocal);
await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID, isInOutPatient);
await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID, isInOutPatient, isDownload);
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error!;
setState(ViewState.ErrorLocal);
AppToast.showErrorToast(message: error);
} else {
AppToast.showSuccessToast(message: mes);
if (isDownload) {
if (prescriptionReportPDF.isNotEmpty) {
String path = await _createFileFromString(prescriptionReportPDF, "pdf");
try {
OpenFilex.open(path);
} catch (ex) {
AppToast.showErrorToast(message: "Cannot open file.");
}
}
} else {
AppToast.showSuccessToast(message: mes);
}
// AppToast.showSuccessToast(message: mes);
setState(ViewState.Idle);
}
}
@ -160,6 +188,14 @@ class PrescriptionsViewModel extends BaseViewModel {
}
}
Future<String> _createFileFromString(String encodedStr, String ext) async {
Uint8List bytes = base64.decode(encodedStr);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext);
await file.writeAsBytes(bytes);
return file.path;
}
Future updatePressOrder({required int presOrderID}) async {
setState(ViewState.Busy);
// await _prescriptionsService.updatePressOrder(presOrderID: presOrderID);

@ -9,12 +9,18 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import '../../../locator.dart';
import '../base_view_model.dart';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:open_filex/open_filex.dart';
import 'package:path_provider/path_provider.dart';
class RadiologyViewModel extends BaseViewModel {
FilterType filterType = FilterType.Clinic;
RadiologyService _radiologyService = locator<RadiologyService>();
List<FinalRadiologyList> _finalRadiologyListClinic =[];
List<FinalRadiologyList> _finalRadiologyListHospital =[];
List<FinalRadiologyList> _finalRadiologyListClinic = [];
List<FinalRadiologyList> _finalRadiologyListHospital = [];
List<FinalRadiologyList> get finalRadiologyList => filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital;
@ -22,6 +28,8 @@ class RadiologyViewModel extends BaseViewModel {
bool get isRadiologyVIDAPlus => _isRadiologyVIDAPlus;
String get radReportPDF => _radiologyService.radReportPDF;
void getPatientRadOrders() async {
setState(ViewState.Busy);
await _radiologyService.getPatientRadOrders();
@ -58,18 +66,38 @@ class RadiologyViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
sendRadReportEmail({required FinalRadiology finalRadiology, required String mes, required AuthenticatedUser userObj}) async {
sendRadReportEmail({required FinalRadiology finalRadiology, required String mes, required AuthenticatedUser userObj, required isDownload}) async {
setState(ViewState.BusyLocal);
await _radiologyService.sendRadReportEmail(finalRadiology: finalRadiology, userObj: userObj);
await _radiologyService.sendRadReportEmail(finalRadiology: finalRadiology, userObj: userObj, isDownload: isDownload);
if (_radiologyService.hasError) {
error = _radiologyService.error!;
AppToast.showErrorToast(message: error);
} else {
AppToast.showSuccessToast(message: mes);
if (isDownload) {
if (radReportPDF.isNotEmpty) {
String path = await _createFileFromString(radReportPDF, "pdf");
try {
OpenFilex.open(path);
} catch (ex) {
AppToast.showErrorToast(message: "Cannot open file.");
}
}
} else {
AppToast.showSuccessToast(message: mes);
}
// AppToast.showSuccessToast(message: mes);
}
setState(ViewState.Idle);
}
Future<String> _createFileFromString(String encodedStr, String ext) async {
Uint8List bytes = base64.decode(encodedStr);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext);
await file.writeAsBytes(bytes);
return file.path;
}
setFilterType(FilterType filterType) {
this.filterType = filterType;
notifyListeners();

@ -96,7 +96,7 @@ class _PrescriptionReportState extends State<PrescriptionReportPage> {
child: Button(
label: 'Send Copy',
onTap: () {
sendPrescriptionReportEmail();
sendPrescriptionReportEmail(true);
},
),
),
@ -112,10 +112,10 @@ class _PrescriptionReportState extends State<PrescriptionReportPage> {
);
}
sendPrescriptionReportEmail() {
sendPrescriptionReportEmail(bool isDownload) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.sendPrescriptionEmail(widget.appo.appointmentDate!, widget.appo.setupID!, projectViewModel!.isArabic ? 1 : 2, widget.listPres, context).then((res) {
service.sendPrescriptionEmail(widget.appo.appointmentDate!, widget.appo.setupID!, projectViewModel!.isArabic ? 1 : 2, widget.listPres, isDownload, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail');
}).catchError((err) {

@ -711,9 +711,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
checkIfUserAgreedBefore(CheckActivationCode result) {
if (projectViewModel.havePrivilege(109)) {
this.authService.checkIfUserAgreed().then((result) {
// if (result['IsPatientAlreadyAgreed']) {
// goToHome();
// } else {
if (result['IsPatientAlreadyAgreed']) {
goToHome();
} else {
this.authService.getUserAgreementContent().then((result) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
Navigator.pushAndRemoveUntil(
@ -732,7 +732,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
// }
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);

@ -26,7 +26,7 @@ class PatientSickLeavePage extends StatefulWidget {
}
class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
List<ImagesInfo> imagesInfo =[];
List<ImagesInfo> imagesInfo = [];
@override
void initState() {
@ -37,7 +37,6 @@ class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PatientSickLeaveViewMode>(
onModelReady: (model) => model.getSickLeave(),
builder: (_, model, w) => AppScaffold(
@ -50,27 +49,29 @@ class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
backgroundColor: Color(0xffF7F7F7),
imagesInfo: imagesInfo,
baseViewModel: model,
body: model.sickLeaveList.isNotEmpty ? ListView.separated(
physics: BouncingScrollPhysics(),
itemCount: model.sickLeaveList.length,
padding: EdgeInsets.all(21),
separatorBuilder: (context, index) => SizedBox(height: 14),
itemBuilder: (context, index) => DoctorCard(
isLiveCareAppointment: model.sickLeaveList[index].isLiveCareAppointment,
name: model.sickLeaveList[index].doctorName,
date: model.sickLeaveList[index].appointmentDate,
profileUrl: model.sickLeaveList[index].doctorImageURL,
rating: model.sickLeaveList[index].actualDoctorRate!.toDouble(),
subName: model.sickLeaveList[index].clinicName,
isSortByClinic: false,
isInOutPatient: model.sickLeaveList[index].isInOutPatient,
isSickLeave: true,
sickLeaveStatus: model.sickLeaveList[index].status ?? 0,
onEmailTap: () {
showConfirmMessage(model, index);
},
),
) : getNoDataWidget(context),
body: model.sickLeaveList.isNotEmpty
? ListView.separated(
physics: BouncingScrollPhysics(),
itemCount: model.sickLeaveList.length,
padding: EdgeInsets.all(21),
separatorBuilder: (context, index) => SizedBox(height: 14),
itemBuilder: (context, index) => DoctorCard(
isLiveCareAppointment: model.sickLeaveList[index].isLiveCareAppointment,
name: model.sickLeaveList[index].doctorName,
date: model.sickLeaveList[index].appointmentDate,
profileUrl: model.sickLeaveList[index].doctorImageURL,
rating: model.sickLeaveList[index].actualDoctorRate!.toDouble(),
subName: model.sickLeaveList[index].clinicName,
isSortByClinic: false,
isInOutPatient: model.sickLeaveList[index].isInOutPatient,
isSickLeave: true,
sickLeaveStatus: model.sickLeaveList[index].status ?? 0,
onEmailTap: () {
showConfirmMessage(model, index);
},
),
)
: getNoDataWidget(context),
),
);
}
@ -79,7 +80,15 @@ class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
if (model.sickLeaveList[index].status == 1) {
openWorkPlaceUpdatePage(model.sickLeaveList[index].requestNo!, model.sickLeaveList[index]!.setupID!, model, index, model.sickLeaveList[index]!.projectID!);
} else if (model.sickLeaveList[index].status == 2) {
showEmailDialog(model, index);
// showEmailDialog(model, index);
model.sendSickLeaveEmail(
message: TranslationBase.of(context).emailSentSuccessfully,
requestNo: model.sickLeaveList[index].requestNo!,
doctorName: model.sickLeaveList[index].doctorName!,
projectName: model.sickLeaveList[index].projectName!,
setupID: model.sickLeaveList[index].setupID!,
projectID: model.sickLeaveList[index].projectID!,
isDownload: true);
} else {
showApprovalDialog();
}
@ -110,7 +119,8 @@ class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
doctorName: model.sickLeaveList[index].doctorName!,
projectName: model.sickLeaveList[index].projectName!,
setupID: model.sickLeaveList[index].setupID!,
projectID: model.sickLeaveList[index].projectID!);
projectID: model.sickLeaveList[index].projectID!,
isDownload: true);
model.getSickLeave();
},
),
@ -169,7 +179,15 @@ class _PatientSickLeavePageState extends State<PatientSickLeavePage> {
print(value);
if (value != null && value == true) {
model.getSickLeave();
showEmailDialog(model, index);
// showEmailDialog(model, index);
model.sendSickLeaveEmail(
message: TranslationBase.of(context).emailSentSuccessfully,
requestNo: model.sickLeaveList[index].requestNo!,
doctorName: model.sickLeaveList[index].doctorName!,
projectName: model.sickLeaveList[index].projectName!,
setupID: model.sickLeaveList[index].setupID!,
projectID: model.sickLeaveList[index].projectID!,
isDownload: true);
}
},
);

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_de
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
@ -74,9 +75,24 @@ class PrescriptionItemsPage extends StatelessWidget {
projectViewModel.user.emailAddress!,
),
isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false,
buttonTitle: TranslationBase.of(context).download,
buttonIcon: "assets/images/new/download_1.svg",
showConfirmMessageDialog: false,
onTap: () {
showConfirmMessage(context, model);
isDownload: true,
onTap: () async {
// showConfirmMessage(context, model);
GifLoaderDialogUtils.showMyDialog(context);
await model.sendPrescriptionEmail(
appointmentDate: prescriptions.appointmentDate!,
patientID: prescriptions.patientID!,
clinicName: prescriptions.companyName!,
doctorName: prescriptions.doctorName!,
doctorID: prescriptions.doctorID!,
mes: TranslationBase.of(context).sendSuc,
projectID: prescriptions.projectID!,
isInOutPatient: prescriptions.isInOutPatient!,
isDownload: true);
GifLoaderDialogUtils.hideDialog(context);
},
),
if (!prescriptions.isInOutPatient!)
@ -436,9 +452,8 @@ class PrescriptionItemsPage extends StatelessWidget {
doctorID: prescriptions.doctorID!,
mes: TranslationBase.of(context).sendSuc,
projectID: prescriptions.projectID!,
isInOutPatient: prescriptions.isInOutPatient!
);
isInOutPatient: prescriptions.isInOutPatient!,
isDownload: true);
},
),
);

@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -18,7 +19,7 @@ import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class RadiologyDetailsPage extends StatelessWidget {
final FinalRadiology? finalRadiology;
final FinalRadiology? finalRadiology;
bool? isRadiologyVidaPlus;
RadiologyDetailsPage({Key? key, this.finalRadiology, this.isRadiologyVidaPlus});
@ -33,7 +34,6 @@ class RadiologyDetailsPage extends StatelessWidget {
lineItem: finalRadiology!.invoiceLineItemNo!,
invoiceNo: Utils.isVidaPlusProject(projectViewModel, finalRadiology!.projectID!) ? finalRadiology!.invoiceNo_VP : finalRadiology!.invoiceNo,
isVidaPlus: Utils.isVidaPlusProject(projectViewModel, finalRadiology!.projectID!)),
builder: (_, model, widget) => AppScaffold(
appBarTitle: TranslationBase.of(context).report,
isShowAppBar: true,
@ -62,12 +62,18 @@ class RadiologyDetailsPage extends StatelessWidget {
finalRadiology!.noOfPatientsRate,
projectViewModel.user.emailAddress!,
),
onTap: () {
showConfirmMessage(finalRadiology: finalRadiology!, model: model, userObj: projectViewModel.user!);
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology!, userObj: projectViewModel.user, isDownload: true);
GifLoaderDialogUtils.hideDialog(context);
// showConfirmMessage(finalRadiology: finalRadiology!, model: model, userObj: projectViewModel.user!, isDownload: true);
},
buttonTitle: TranslationBase.of(context).sendCopyRad,
isNeedToShowButton: projectViewModel.havePrivilege(8),
buttonTitle: TranslationBase.of(context).download,
buttonIcon: "assets/images/new/download_1.svg",
showConfirmMessageDialog: false,
isDownload: true,
isNeedToShowButton: projectViewModel.havePrivilege(8),
// showConfirmMessageDialog: false,
),
Container(
margin: EdgeInsets.all(24),
@ -117,13 +123,13 @@ class RadiologyDetailsPage extends StatelessWidget {
);
}
void showConfirmMessage({FinalRadiology? finalRadiology, RadiologyViewModel? model, AuthenticatedUser? userObj}) {
void showConfirmMessage({FinalRadiology? finalRadiology, RadiologyViewModel? model, AuthenticatedUser? userObj, required bool isDownload}) {
showDialog(
context: AppGlobal.context,
builder: (cxt) => ConfirmSendEmailDialog(
email: model!.user!.emailAddress,
onTapSendEmail: () {
model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology!, userObj: userObj!);
model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology!, userObj: userObj!, isDownload: isDownload);
},
),
);

@ -1392,7 +1392,7 @@ class DoctorsListService extends BaseService {
return Future.value(localRes);
}
Future<Map> sendPrescriptionEmail(String appoDate, String setupId, int languageID, dynamic prescriptionReportEnhList, BuildContext context) async {
Future<Map> sendPrescriptionEmail(String appoDate, String setupId, int languageID, dynamic prescriptionReportEnhList, bool isDownload, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
@ -1420,7 +1420,9 @@ class DoctorsListService extends BaseService {
"PatientID": authUser.patientID,
"PatientTypeID": authUser.patientType,
"LanguageID": authUser.patientType,
"PatientType": authUser.patientType
"PatientType": authUser.patientType,
"IsDownload": isDownload,
};
dynamic localRes;

@ -257,10 +257,21 @@ class DoctorCard extends StatelessWidget {
child: (onEmailTap != null && projectViewModel!.havePrivilege(17))
? InkWell(
onTap: onEmailTap,
child: Icon(
Icons.email,
color: sickLeaveStatus != 3 ? Theme.of(context).primaryColor : Colors.grey[400],
child: Text(
TranslationBase.of(context).download,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
fontStyle: FontStyle.italic,
color: CustomColors.accentColor,
letterSpacing: -0.48,
height: 18 / 12,
decoration: TextDecoration.underline),
),
// Icon(
// Icons.email,
// color: sickLeaveStatus != 3 ? Theme.of(context).primaryColor : Colors.grey[400],
// ),
)
: onTap != null
? Icon(

Loading…
Cancel
Save