Updates & fixes

pull/222/head
haroon amjad 3 days ago
parent f472bd49f4
commit 6a687f4ff6

@ -6,6 +6,7 @@ class PatientQueueDetails {
String? roomNo;
String? calledOn;
bool? servingNow;
int? isClinicConfigured;
PatientQueueDetails(
{this.patientID,
@ -14,7 +15,7 @@ class PatientQueueDetails {
this.callType,
this.roomNo,
this.calledOn,
this.servingNow});
this.servingNow, this.isClinicConfigured});
PatientQueueDetails.fromJson(Map<String, dynamic> json) {
patientID = json['patientID'];
@ -24,10 +25,11 @@ class PatientQueueDetails {
roomNo = json['roomNo'];
calledOn = json['calledOn'];
servingNow = json['servingNow'];
isClinicConfigured = json['isClinicConfigured'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
final Map<String, dynamic> data = Map<String, dynamic>();
data['patientID'] = this.patientID;
data['patientName'] = this.patientName;
data['queueNo'] = this.queueNo;
@ -35,6 +37,7 @@ class PatientQueueDetails {
data['roomNo'] = this.roomNo;
data['calledOn'] = this.calledOn;
data['servingNow'] = this.servingNow;
data['isClinicConfigured'] = this.isClinicConfigured;
return data;
}
}

@ -834,7 +834,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
@override
Future<Either<Failure, GenericApiModel<List<PatientQueueDetails>>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, required int clinicID}) async {
Map<String, dynamic> mapDevice = {"appointmentNo": appointmentNo, "patientID": patientID, "ClinicID": clinicID, "apiKey": "EE17D21C7943485D9780223CCE55DCE5"};
Map<String, dynamic> mapDevice = {"appointmentNo": appointmentNo, "patientID": patientID, "clinicID": clinicID, "apiKey": "EE17D21C7943485D9780223CCE55DCE5"};
try {
GenericApiModel<List<PatientQueueDetails>>? apiResponse;
Failure? failure;
@ -842,6 +842,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
// final list = response['data'];
final list = response['data'];
final queueList = list.map((item) => PatientQueueDetails.fromJson(item as Map<String, dynamic>)).toList().cast<PatientQueueDetails>();

@ -929,6 +929,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
//TODO: Discuss With Haroon, Is the User Has no data it return No Element Bad State;
isPatientHasQueueAppointment = false;
isAppointmentQueueDetailsLoading = true;
patientQueueDetailsList.clear();
notifyListeners();
final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails(
@ -949,8 +950,32 @@ class MyAppointmentsViewModel extends ChangeNotifier {
onError!(apiResponse.errorMessage!);
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
isPatientHasQueueAppointment = true;
patientQueueDetailsList = apiResponse.data!;
if (patientQueueDetailsList.first.isClinicConfigured == 1) {
isPatientHasQueueAppointment = true;
for (var element in patientQueueDetailsList) {
if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) {
currentPatientQueueDetails = element;
currentQueueStatus = element.callType!;
// currentQueueStatus = 2;
break;
}
}
// patientQueueDetailsList.first.callType = 1;
patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID);
} else {
isPatientHasQueueAppointment = false;
}
} else {
isPatientHasQueueAppointment = false;
}
if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
patientQueueDetailsList = apiResponse.data!;
// if (patientQueueDetailsList.first.isClinicConfigured == 1) {
isPatientHasQueueAppointment = true;
for (var element in patientQueueDetailsList) {
if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) {
currentPatientQueueDetails = element;
@ -960,8 +985,10 @@ class MyAppointmentsViewModel extends ChangeNotifier {
}
}
// patientQueueDetailsList.first.callType = 1;
patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID);
// } else {
// isPatientHasQueueAppointment = false;
// }
} else {
isPatientHasQueueAppointment = false;
}

@ -104,9 +104,13 @@ class _LandingPageState extends State<LandingPage> {
final ScrollController _horizontalScrollController = ScrollController();
final ScrollController _scrollController = ScrollController();
double _scrollOpacity = 0.0;
@override
void dispose() {
_horizontalScrollController.dispose();
_scrollController.dispose();
super.dispose();
}
@ -122,6 +126,17 @@ class _LandingPageState extends State<LandingPage> {
showQuickLogin(context);
});
}
_scrollController.addListener(() {
final scrollOffset = _scrollController.offset;
final newOpacity = (scrollOffset / 50).clamp(0.0, 1.0);
if (_scrollOpacity != newOpacity) {
setState(() {
_scrollOpacity = newOpacity;
});
}
});
scheduleMicrotask(() async {
if (!appState.isAuthenticated) {
// LoaderBottomSheet.showLoader();
@ -203,6 +218,7 @@ class _LandingPageState extends State<LandingPage> {
}
},
child: SingleChildScrollView(
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.only(
top: (appState.isAuthenticated && !insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown)
@ -701,8 +717,8 @@ class _LandingPageState extends State<LandingPage> {
itemBuilder: (context, index) {
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 1000),
child: SlideAnimation(
duration: const Duration(milliseconds: 500),
child: SlideAnimation(
horizontalOffset: 100.0,
child: FadeInAnimation(
child: SmallServiceCard(
@ -833,6 +849,25 @@ class _LandingPageState extends State<LandingPage> {
),
),
),
AnimatedOpacity(
opacity: _scrollOpacity,
duration: Duration(milliseconds: 200),
child: Container(
height: MediaQuery.paddingOf(context).top + 10.h,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
AppColors.scaffoldBgColor,
AppColors.scaffoldBgColor.withValues(alpha: 0.9),
AppColors.scaffoldBgColor.withValues(alpha: 0.0),
],
stops: [0.0, 0.7, 1.0],
),
),
),
),
(appState.isAuthenticated && !insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown)
? Container(
height: MediaQuery.paddingOf(context).top + 50.h,
@ -1042,7 +1077,7 @@ class _LandingPageState extends State<LandingPage> {
// Queue Card: Currently serving section
Widget _buildServingNowSection() {
if (myAppointmentsViewModel.patientQueueDetailsList.isEmpty) {
return SizedBox(height: 12.h);
return SizedBox(height: 24.h);
}
final servingQueue = myAppointmentsViewModel.patientQueueDetailsList.first;

Loading…
Cancel
Save