Dental appointment booking flow implementation contd.

pull/72/head
haroon amjad 4 weeks ago
parent 415c0eb3c7
commit 2b21086cc1

@ -173,8 +173,8 @@ class ApiClientImp implements ApiClient {
body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken; body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken;
} }
// body['TokenID'] = "@dm!n"; body['TokenID'] = "@dm!n";
// body['PatientID'] = 4767884; body['PatientID'] = 4767884;
// body['PatientTypeID'] = 1; // body['PatientTypeID'] = 1;
// //
// body['PatientOutSA'] = 0; // body['PatientOutSA'] = 0;

@ -196,6 +196,11 @@ class BookAppointmentsViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
setIsContinueDentalPlan(bool value) {
isContinueDentalPlan = value;
notifyListeners();
}
void onTabChanged(int index) { void onTabChanged(int index) {
selectedTabIndex = index; selectedTabIndex = index;
notifyListeners(); notifyListeners();

@ -58,7 +58,7 @@ class LabViewModel extends ChangeNotifier {
List<String> get labSuggestions => _labSuggestionsList; List<String> get labSuggestions => _labSuggestionsList;
Set<TestDetails> uniqueTests = {}; Set<TestDetails> uniqueTests = {};
double maxY = 0.0; double maxY = 0.0;
double maxX = double.infinity; double maxX = double.infinity;
@ -78,6 +78,11 @@ class LabViewModel extends ChangeNotifier {
} }
Future<void> getPatientLabOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> getPatientLabOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async {
patientLabOrders.clear();
uniqueTests.clear();
uniqueTests = {};
notifyListeners();
final result = await labRepo.getPatientLabOrders(); final result = await labRepo.getPatientLabOrders();
result.fold( result.fold(
@ -132,11 +137,12 @@ class LabViewModel extends ChangeNotifier {
} }
getUniqueTestDescription() { getUniqueTestDescription() {
uniqueTests = {
uniqueTests = {
for (var item in patientLabOrders) for (var item in patientLabOrders)
if (item.testDetails != null) if (item.testDetails != null)
...?item.testDetails?.map<TestDetails>((test) => TestDetails( ...?item.testDetails?.map<TestDetails>((test) => TestDetails(
testDescriptionEn: test.testDescriptionEn.toString(),
testDescriptionAr: test.testDescriptionAr.toString(),
description: test.description.toString(), description: test.description.toString(),
testCode: test.testCode.toString(), testCode: test.testCode.toString(),
testID: test.testID, testID: test.testID,
@ -170,8 +176,7 @@ class LabViewModel extends ChangeNotifier {
); );
} }
Future<void> getPatientLabResult( Future<void> getPatientLabResult(PatientLabOrdersResponseModel laborder, String procedureName, String testDescription) async {
PatientLabOrdersResponseModel laborder, String procedureName) async {
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader();
mainLabResults.clear(); mainLabResults.clear();
filteredGraphValues.clear(); filteredGraphValues.clear();
@ -223,8 +228,9 @@ class LabViewModel extends ChangeNotifier {
recentResult.verifiedOn = resultDate(DateUtil.convertStringToDate(recentResult.verifiedOnDateTime!)); recentResult.verifiedOn = resultDate(DateUtil.convertStringToDate(recentResult.verifiedOnDateTime!));
// filteredGraphValues = [filteredGraphValues.first]; // filteredGraphValues = [filteredGraphValues.first];
navigationService.push(MaterialPageRoute( navigationService.push(MaterialPageRoute(
builder: (_) => builder: (_) => LabResultDetails(recentLabResult: recentResult, testDescription: testDescription),
LabResultDetails(recentLabResult: recentResult))); ),
);
notifyListeners(); notifyListeners();
} }
}, },

@ -224,21 +224,26 @@ class PatientLabOrdersResponseModel {
class TestDetails { class TestDetails {
String? description; String? description;
String? testDescriptionEn;
String? testDescriptionAr;
String? testCode; String? testCode;
String? testID; String? testID;
String? createdOn; String? createdOn;
PatientLabOrdersResponseModel? model; PatientLabOrdersResponseModel? model;
TestDetails({this.description, this.testCode, this.testID, this.createdOn, this.model});
TestDetails({this.description, this.testDescriptionEn, this.testDescriptionAr, this.testCode, this.testID, this.createdOn, this.model});
TestDetails.fromJson(Map<String, dynamic> json) { TestDetails.fromJson(Map<String, dynamic> json) {
description = json['Description']; description = json['Description'];
testDescriptionEn = json['TestDescriptionEn'] ?? "";
testDescriptionAr = json['TestDescriptionAr'] ?? "";
testCode = json['TestCode']; testCode = json['TestCode'];
testID = json['TestID']; testID = json['TestID'];
createdOn = json['CreatedOn']; createdOn = json['CreatedOn'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = <String, dynamic>{};
data['Description'] = this.description; data['Description'] = this.description;
data['TestCode'] = this.testCode; data['TestCode'] = this.testCode;
data['TestID'] = this.testID; data['TestID'] = this.testID;

@ -296,6 +296,7 @@ class _SelectClinicPageState extends State<SelectClinicPage> {
child: CustomButton( child: CustomButton(
text: LocaleKeys.cancel.tr(), text: LocaleKeys.cancel.tr(),
onPressed: () { onPressed: () {
bookAppointmentsViewModel.setIsContinueDentalPlan(false);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
backgroundColor: AppColors.primaryRedColor, backgroundColor: AppColors.primaryRedColor,
@ -309,7 +310,14 @@ class _SelectClinicPageState extends State<SelectClinicPage> {
Expanded( Expanded(
child: CustomButton( child: CustomButton(
text: LocaleKeys.confirm.tr(), text: LocaleKeys.confirm.tr(),
onPressed: () async {}, onPressed: () async {
bookAppointmentsViewModel.setIsContinueDentalPlan(true);
Navigator.of(context).push(
CustomPageRoute(
page: SelectDoctorPage(),
),
);
},
backgroundColor: AppColors.bgGreenColor, backgroundColor: AppColors.bgGreenColor,
borderColor: AppColors.bgGreenColor, borderColor: AppColors.bgGreenColor,
textColor: Colors.white, textColor: Colors.white,

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
@ -19,8 +20,9 @@ class LabOrderByTest extends StatelessWidget {
final TestDetails? tests; final TestDetails? tests;
final bool isLoading; final bool isLoading;
final bool isExpanded; final bool isExpanded;
final AppState appState;
const LabOrderByTest({super.key, required this.onTap, this.tests, required this.index, this.isLoading = false, this.isExpanded = false}); const LabOrderByTest({super.key, required this.onTap, required this.appState, this.tests, required this.index, this.isLoading = false, this.isExpanded = false});
@override @override
build(BuildContext context) { build(BuildContext context) {
@ -37,8 +39,7 @@ class LabOrderByTest extends StatelessWidget {
children: [ children: [
'${tests!.description}'.toText16(isBold: true), '${tests!.description}'.toText16(isBold: true),
SizedBox(height: 4.h), SizedBox(height: 4.h),
//TODO: Add test long description from the Lab Order API (appState.isArabic() ? tests!.testDescriptionAr : tests!.testDescriptionEn)!.toText12(fontWeight: FontWeight.w500),
"Measurement of ALT (alanine aminotransferase) level in blood used to assess liver functions".toText12(fontWeight: FontWeight.w500),
SizedBox(height: 8.h), SizedBox(height: 8.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

File diff suppressed because one or more lines are too long

@ -26,8 +26,8 @@ class LabResultList extends StatelessWidget {
shrinkWrap: true,itemCount: list.length,itemBuilder: (____, index) { shrinkWrap: true,itemCount: list.length,itemBuilder: (____, index) {
var labItem = list[index]; var labItem = list[index];
return LabOrderResultItem(onTap: () { return LabOrderResultItem(onTap: () {
model.getPatientLabResult(model.currentlySelectedPatientOrder!, labItem.description??""); model.getPatientLabResult(model.currentlySelectedPatientOrder!, labItem.description ?? "", labItem.packageShortDescription!);
}, },
tests: labItem, tests: labItem,
index: index, index: index,
iconColor: model.getColor(labItem.calculatedResultFlag ?? "N"), iconColor: model.getColor(labItem.calculatedResultFlag ?? "N"),

@ -54,14 +54,7 @@ class LabOrderResultItem extends StatelessWidget {
spacing: 6.h, spacing: 6.h,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
severityText.tr().toText10(weight: FontWeight.w500, color: AppColors.greyTextColor),
Text(severityText.tr(),
style: TextStyle(
fontFamily: 'Poppins',
fontSize: 10.fSize,
fontWeight: FontWeight.w500,
color: AppColors.greyTextColor
)),
Utils.buildSvgWithAssets( Utils.buildSvgWithAssets(
icon: AppAssets.lab_result_indicator, icon: AppAssets.lab_result_indicator,
width: 21, width: 21,
@ -82,7 +75,7 @@ class LabOrderResultItem extends StatelessWidget {
borderColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor,
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w500,
borderRadius: 12, borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h, height: 40.h,

@ -25,8 +25,9 @@ class LabResultDetails extends StatelessWidget {
// final List<DataPoint> graphPoint; // final List<DataPoint> graphPoint;
late LabViewModel model; late LabViewModel model;
String? testDescription;
LabResultDetails({super.key, required this.recentLabResult}); LabResultDetails({super.key, required this.recentLabResult, required this.testDescription});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

Loading…
Cancel
Save