|
|
|
|
@ -1,21 +1,18 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/rounded_container.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 '../base/base_view.dart';
|
|
|
|
|
import 'my_vaccines_item_screen.dart';
|
|
|
|
|
|
|
|
|
|
//TODO fix by jammal we have a static data
|
|
|
|
|
class MyVaccines extends StatefulWidget {
|
|
|
|
|
@ -40,191 +37,71 @@ class _MyVaccinesState extends State<MyVaccines> {
|
|
|
|
|
ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png')
|
|
|
|
|
],
|
|
|
|
|
body: Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
left: SizeConfig.screenWidth * 0.004,
|
|
|
|
|
right: SizeConfig.screenWidth * 0.004,
|
|
|
|
|
top: SizeConfig.screenWidth * 0.04,
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.only(top: 20.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
child: ExpansionTile(
|
|
|
|
|
title: Container(
|
|
|
|
|
height: 65.0,
|
|
|
|
|
child: Text('2018'),
|
|
|
|
|
),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model.vaccineList == null ? 0 : model.vaccineList.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
model.vaccineList[index].doctorImageURL,
|
|
|
|
|
height: SizeConfig.imageSizeMultiplier * 23,
|
|
|
|
|
width: SizeConfig.imageSizeMultiplier * 20,
|
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
flex: 2,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
model.vaccineList[index].doctorTitle + model.vaccineList[index].doctorName,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
fontSize: 16.6,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 7.0),
|
|
|
|
|
Text(
|
|
|
|
|
model.vaccineList[index].projectName,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 17.0,
|
|
|
|
|
letterSpacing: 0.5,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 7.0),
|
|
|
|
|
Text(
|
|
|
|
|
model.vaccineList[index].vaccineName,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 17.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 7.0),
|
|
|
|
|
Text(
|
|
|
|
|
'Date Taken ' + convertDateFormat(model.vaccineList[index].invoiceDate),
|
|
|
|
|
style: TextStyle(fontSize: 17.0),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
flex: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
AppExpandableNotifier(
|
|
|
|
|
isExpand: true,
|
|
|
|
|
title: "2013",
|
|
|
|
|
bodyWidget: Container(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model.vaccineList == null ? 0 : model.vaccineList.length,
|
|
|
|
|
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
|
|
|
|
|
separatorBuilder: (context, index) => SizedBox(height: 14),
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return DoctorCard(
|
|
|
|
|
onTap: () {},
|
|
|
|
|
isInOutPatient: true,
|
|
|
|
|
isShowInOutPatient: false,
|
|
|
|
|
name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName,
|
|
|
|
|
billNo: "",
|
|
|
|
|
vaccineName: model.vaccineList[index].vaccineName,
|
|
|
|
|
profileUrl: model.vaccineList[index].doctorImageURL,
|
|
|
|
|
subName: model.vaccineList[index].projectName,
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate),
|
|
|
|
|
isSortByClinic: true,
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)),
|
|
|
|
|
// SpaceBetweenTexts(space: 165.0),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model.state == ViewState.Busy
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: model.vaccineList.length > 0
|
|
|
|
|
? Container(
|
|
|
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.25,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Divider(
|
|
|
|
|
height: 2,
|
|
|
|
|
thickness: 1,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
// height: 80.0,
|
|
|
|
|
child: Button(
|
|
|
|
|
disabled: true,
|
|
|
|
|
label: TranslationBase.of(context).checkVaccineAvailability,
|
|
|
|
|
backgroundColor: Color(0xff9EA3A4),
|
|
|
|
|
onTap: () => Navigator.push(context, FadePage(page: MyVaccinesItemPage())),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (projectViewModel.havePrivilege(27))
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).sendEmail,
|
|
|
|
|
() {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: ConfirmSendEmailDialog(
|
|
|
|
|
email: projectViewModel.user.emailAddress,
|
|
|
|
|
onTapSendEmail: () {
|
|
|
|
|
model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// SecondaryButton(
|
|
|
|
|
// label: TranslationBase.of(context).sendEmail,
|
|
|
|
|
// color: Color(0xffF62426),
|
|
|
|
|
// textColor: Colors.white,
|
|
|
|
|
// disabled: model.vaccineList.length == 0,
|
|
|
|
|
// loading: model.state == ViewState.BusyLocal,
|
|
|
|
|
// onTap: () async {
|
|
|
|
|
// showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// child: ConfirmSendEmailDialog(
|
|
|
|
|
// email: projectViewModel.user.emailAddress,
|
|
|
|
|
// onTapSendEmail: () {
|
|
|
|
|
// // generateCovidCertificate(context, isOutsideKSA);
|
|
|
|
|
// model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// // model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
|
|
|
|
|
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).availability,
|
|
|
|
|
() {
|
|
|
|
|
// Navigator.push(context, FadePage(page: MyVaccinesItemPage()));
|
|
|
|
|
},
|
|
|
|
|
color: Color(0xffEAEAEA),
|
|
|
|
|
textColor: Color(0xff000000),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 8),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).sendEmail,
|
|
|
|
|
() {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: ConfirmSendEmailDialog(
|
|
|
|
|
email: projectViewModel.user.emailAddress,
|
|
|
|
|
onTapSendEmail: () {
|
|
|
|
|
model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
])),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
convertDateFormat(String Date) {
|
|
|
|
|
const start = "/Date(";
|
|
|
|
|
const end = "+0300)";
|
|
|
|
|
|
|
|
|
|
final startIndex = Date.indexOf(start);
|
|
|
|
|
final endIndex = Date.indexOf(end, startIndex + start.length);
|
|
|
|
|
|
|
|
|
|
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(Date.substring(startIndex + start.length, endIndex)));
|
|
|
|
|
String newDate = date.year.toString() + "-" + date.month.toString().padLeft(2, '0') + "-" + date.day.toString().padLeft(2, '0');
|
|
|
|
|
|
|
|
|
|
return newDate.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|