You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
219 lines
9.9 KiB
Dart
219 lines
9.9 KiB
Dart
import 'package:diplomaticquarterapp/config/config.dart';
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
import 'package:diplomaticquarterapp/locator.dart';
|
|
import 'package:diplomaticquarterapp/models/patient_appointment_journey_model.dart';
|
|
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart';
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
import 'package:diplomaticquarterapp/pages/landing/patient_appointment_arrival_journey.dart';
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
|
|
|
import 'fragments/home_page_fragment2.dart';
|
|
import 'landing_page_pharmcy.dart';
|
|
|
|
class HomePage2 extends StatefulWidget {
|
|
final Function goToMyProfile;
|
|
Function onLoginClick, onMedicalFileClick;
|
|
|
|
HomePage2({Key key, this.goToMyProfile, this.onLoginClick, this.onMedicalFileClick});
|
|
|
|
@override
|
|
_HomePageState2 createState() => _HomePageState2();
|
|
}
|
|
|
|
class _HomePageState2 extends State<HomePage2> {
|
|
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
|
|
ProjectViewModel projectViewModel;
|
|
final authService = new AuthProvider();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
projectViewModel = Provider.of(context);
|
|
return BaseView<DashboardViewModel>(
|
|
onModelReady: (model) => model.getPatientRadOrders(),
|
|
builder: (_, model, wi) => Container(
|
|
color: CustomColors.backgroudGreyColor,
|
|
// color: Colors.yellow,
|
|
child: Stack(
|
|
children: [
|
|
SingleChildScrollView(
|
|
physics: BouncingScrollPhysics(),
|
|
child: Column(
|
|
children: [
|
|
HomePageFragment2(
|
|
model,
|
|
onLoginClick: () {
|
|
widget.onLoginClick();
|
|
},
|
|
onPharmacyClick: () {
|
|
// getPharmacyToken(model);
|
|
Uri uri = Uri.parse(PHARMACY_REDIRECT_URL);
|
|
launchUrl(uri, mode: LaunchMode.externalApplication);
|
|
},
|
|
onMedicalFileClick: () {
|
|
widget.onMedicalFileClick();
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
projectViewModel.isShowQueueWidget
|
|
? Positioned(
|
|
bottom: 10,
|
|
child: InkWell(
|
|
onTap: () {
|
|
getPatientAppointmentJourneyDetails();
|
|
},
|
|
child: SizedBox(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: 110,
|
|
child: Container(
|
|
margin: EdgeInsets.only(left: 16.0, right: 16.0),
|
|
decoration: cardRadius(12),
|
|
padding: EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"Approximate waiting time: ",
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
// fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.3,
|
|
height: 13 / 10,
|
|
),
|
|
),
|
|
Text(
|
|
"${projectViewModel.getPatientQueueNoModel.data.approxWaitingTimeMin} minutes",
|
|
maxLines: 1,
|
|
style: TextStyle(fontSize: SizeConfig.textMultiplier * 1.5, fontWeight: FontWeight.bold, letterSpacing: -0.3, height: 13 / 10, color: Color(0xFFFBF2E31)),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 5),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Your Queue Number",
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
fontSize: SizeConfig.textMultiplier * 1.4,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.3,
|
|
height: 13 / 10,
|
|
),
|
|
),
|
|
Text(
|
|
projectViewModel.getPatientQueueNoModel.data.queueNo,
|
|
maxLines: 1,
|
|
style: TextStyle(fontSize: SizeConfig.textMultiplier * 3.0, fontWeight: FontWeight.bold, letterSpacing: -0.3, height: 13 / 10, color: Color(0xFFFBF2E31)),
|
|
),
|
|
],
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Current Queue Number",
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
fontSize: SizeConfig.textMultiplier * 1.4,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.3,
|
|
height: 13 / 10,
|
|
),
|
|
),
|
|
Text(
|
|
projectViewModel.getPatientQueueNoModel.data.queueNoCurServing.isNotEmpty ? projectViewModel.getPatientQueueNoModel.data.queueNoCurServing : "-",
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
fontSize: SizeConfig.textMultiplier * 3.0,
|
|
fontWeight: FontWeight.bold,
|
|
letterSpacing: -0.3,
|
|
height: 13 / 10,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
: Container(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void getPatientAppointmentJourneyDetails() {
|
|
PatientAppointmentJourneyModel patientAppointmentJourneyModel;
|
|
authService.getPatientAppointmentJourneyDetails(2016066248).then((value) async {
|
|
if (value != null) {
|
|
patientAppointmentJourneyModel = PatientAppointmentJourneyModel.fromJson(value);
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: PatientAppointmentArrivalJourney(
|
|
patientAppointmentJourneyModel: patientAppointmentJourneyModel,
|
|
),
|
|
),
|
|
);
|
|
// getPatientQueueNoModel = GetPatientQueueNoModel.fromJson(value);
|
|
// if(getPatientQueueNoModel.data.hasQueue) {
|
|
// projectViewModel.setPatientQueueModel(getPatientQueueNoModel);
|
|
// projectViewModel.setIsShowQueueWidget(true);
|
|
// } else {
|
|
// projectViewModel.setIsShowQueueWidget(false);
|
|
// }
|
|
}
|
|
});
|
|
}
|
|
|
|
getPharmacyToken(DashboardViewModel model) async {
|
|
if (!model.isLogin) {
|
|
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
|
} else {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
await pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
|
|
if (!pharmacyModuleViewModel.error.isNotEmpty) {
|
|
await pharmacyModuleViewModel.createUser().then((value) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
|
});
|
|
} else {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
navigateToCovidDriveThru() {
|
|
Navigator.push(context, FadePage(page: CovidDrivethruLocation()));
|
|
}
|
|
}
|