Updates & fixes

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

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

@ -834,7 +834,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
@override @override
Future<Either<Failure, GenericApiModel<List<PatientQueueDetails>>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, required int clinicID}) async { 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 { try {
GenericApiModel<List<PatientQueueDetails>>? apiResponse; GenericApiModel<List<PatientQueueDetails>>? apiResponse;
Failure? failure; Failure? failure;
@ -842,6 +842,7 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
failure = failureType; failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try { try {
// final list = response['data'];
final list = response['data']; final list = response['data'];
final queueList = list.map((item) => PatientQueueDetails.fromJson(item as Map<String, dynamic>)).toList().cast<PatientQueueDetails>(); 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; //TODO: Discuss With Haroon, Is the User Has no data it return No Element Bad State;
isPatientHasQueueAppointment = false; isPatientHasQueueAppointment = false;
isAppointmentQueueDetailsLoading = true; isAppointmentQueueDetailsLoading = true;
patientQueueDetailsList.clear();
notifyListeners(); notifyListeners();
final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails( final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails(
@ -949,8 +950,32 @@ class MyAppointmentsViewModel extends ChangeNotifier {
onError!(apiResponse.errorMessage!); onError!(apiResponse.errorMessage!);
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
if (apiResponse.data != null && apiResponse.data!.isNotEmpty) { if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
isPatientHasQueueAppointment = true;
patientQueueDetailsList = apiResponse.data!; 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) { for (var element in patientQueueDetailsList) {
if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) { if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) {
currentPatientQueueDetails = element; currentPatientQueueDetails = element;
@ -960,8 +985,10 @@ class MyAppointmentsViewModel extends ChangeNotifier {
} }
} }
// patientQueueDetailsList.first.callType = 1; // patientQueueDetailsList.first.callType = 1;
patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID); patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID);
// } else {
// isPatientHasQueueAppointment = false;
// }
} else { } else {
isPatientHasQueueAppointment = false; isPatientHasQueueAppointment = false;
} }

@ -104,9 +104,13 @@ class _LandingPageState extends State<LandingPage> {
final ScrollController _horizontalScrollController = ScrollController(); final ScrollController _horizontalScrollController = ScrollController();
final ScrollController _scrollController = ScrollController();
double _scrollOpacity = 0.0;
@override @override
void dispose() { void dispose() {
_horizontalScrollController.dispose(); _horizontalScrollController.dispose();
_scrollController.dispose();
super.dispose(); super.dispose();
} }
@ -122,6 +126,17 @@ class _LandingPageState extends State<LandingPage> {
showQuickLogin(context); 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 { scheduleMicrotask(() async {
if (!appState.isAuthenticated) { if (!appState.isAuthenticated) {
// LoaderBottomSheet.showLoader(); // LoaderBottomSheet.showLoader();
@ -203,6 +218,7 @@ class _LandingPageState extends State<LandingPage> {
} }
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: (appState.isAuthenticated && !insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown) top: (appState.isAuthenticated && !insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown)
@ -701,8 +717,8 @@ class _LandingPageState extends State<LandingPage> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return AnimationConfiguration.staggeredList( return AnimationConfiguration.staggeredList(
position: index, position: index,
duration: const Duration(milliseconds: 1000), duration: const Duration(milliseconds: 500),
child: SlideAnimation( child: SlideAnimation(
horizontalOffset: 100.0, horizontalOffset: 100.0,
child: FadeInAnimation( child: FadeInAnimation(
child: SmallServiceCard( 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) (appState.isAuthenticated && !insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown)
? Container( ? Container(
height: MediaQuery.paddingOf(context).top + 50.h, height: MediaQuery.paddingOf(context).top + 50.h,
@ -1042,7 +1077,7 @@ class _LandingPageState extends State<LandingPage> {
// Queue Card: Currently serving section // Queue Card: Currently serving section
Widget _buildServingNowSection() { Widget _buildServingNowSection() {
if (myAppointmentsViewModel.patientQueueDetailsList.isEmpty) { if (myAppointmentsViewModel.patientQueueDetailsList.isEmpty) {
return SizedBox(height: 12.h); return SizedBox(height: 24.h);
} }
final servingQueue = myAppointmentsViewModel.patientQueueDetailsList.first; final servingQueue = myAppointmentsViewModel.patientQueueDetailsList.first;

Loading…
Cancel
Save