Updates & fixes

CR-20974-PDF-Results-In-Lab
haroon amjad 4 weeks ago
parent 3f00dec522
commit 15ff97e8e1

@ -211,7 +211,7 @@ class ApiClientImp implements ApiClient {
}
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 1307867;
// body['PatientID'] = 4774985;
// body['PatientID'] = 53320;
// body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0;

@ -615,7 +615,9 @@ class LabViewModel extends ChangeNotifier {
StringBuffer htmlbuffer = StringBuffer("");
apiResponse.data?.forEach((element) {
if (element.resultDataHTML != null && element.resultDataHTML?.isNotEmpty == true) htmlbuffer.write("${element.resultDataHTML} <br/> <br/>");
if (element.resultDataHTML != null && element.resultDataHTML?.isNotEmpty == true) {
htmlbuffer.write("${element.resultDataHTML} <br/> <br/>");
}
});
labSpecialResult = htmlbuffer.toString();
@ -1080,34 +1082,48 @@ class LabViewModel extends ChangeNotifier {
}
void openSpecialLabResultsAttachmentSheet({required PatientLabSpecialResult specialLabResult, required projectID, required setupID}) {
LabResult labResult = LabResult(
projectID: projectID,
setupID: setupID,
accessionNo: specialLabResult.accessionNo,
uploadedDocuments: specialLabResult.uploadedDocuments,
fileNameWithExtensionList: specialLabResult.fileNameWithExtensionList,
);
final bool isVP = Utils.isVidaPlusProject(int.parse(projectID.toString()));
final List<({LabResult labResult, int index, String name})> attachments = [];
for (var labRes in patientSpecialLabResultsList) {
final lr = LabResult(
projectID: projectID,
setupID: setupID,
accessionNo: labRes.accessionNo,
uploadedDocuments: labRes.uploadedDocuments,
fileNameWithExtensionList: labRes.fileNameWithExtensionList,
);
if (isVP) {
final docs = labRes.uploadedDocuments ?? [];
for (int i = 0; i < docs.length; i++) {
attachments.add((labResult: lr, index: i, name: docs[i].fileName ?? ""));
}
} else {
final files = labRes.fileNameWithExtensionList ?? [];
for (int i = 0; i < files.length; i++) {
attachments.add((labResult: lr, index: i, name: files[i].fileNameWithExtension ?? ""));
}
}
}
showCommonBottomSheetWithoutHeight(
getIt.get<NavigationService>().navigatorKey.currentContext!,
title: LocaleKeys.selectAttachment.tr(),
child: (Utils.isVidaPlusProject(int.parse(projectID)) ? (specialLabResult.uploadedDocuments ?? []).isNotEmpty : (specialLabResult.fileNameWithExtensionList ?? []).isNotEmpty)
child: attachments.isNotEmpty
? Column(
children: [
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: Utils.isVidaPlusProject(int.parse(projectID)) ? (specialLabResult.uploadedDocuments ?? []).length : (specialLabResult.fileNameWithExtensionList ?? []).length,
itemCount: attachments.length,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(right: 12.h, bottom: 12.h),
child:
"${Utils.isVidaPlusProject(int.parse(projectID)) ? specialLabResult.uploadedDocuments![index].fileName : specialLabResult.fileNameWithExtensionList![index].fileNameWithExtension}"
.toText16(color: AppColors.primaryRedColor, isBold: true, isUnderLine: true),
child: attachments[index].name.toText16(color: AppColors.primaryRedColor, isBold: true, isUnderLine: true),
).onPress(() {
LoaderBottomSheet.showLoader();
getLabResultAttachmentPDF(
labResult: labResult,
labResult: attachments[index].labResult,
selectedIndex: index,
onError: (err) {
LoaderBottomSheet.hideLoader();

Loading…
Cancel
Save