Merge branch 'bug_fixing' into 'development'

Bug fixing

See merge request Cloud_Solution/diplomatic-quarter!319
merge-update-with-lab-changes
Sultan khan 5 years ago
commit 924f9bedc0

@ -39,6 +39,9 @@ class BloodSugarViewMode extends BaseViewModel {
element.dailyAverageResult.toDouble(), element.dailyAverageResult.toDouble(),
)); ));
}); });
if (bloodWeekTimeSeriesData.isEmpty) {
bloodWeekTimeSeriesData.add(TimeSeriesSales2(DateTime.now(), 0));
}
for (int index = 0; for (int index = 0;
index < bloodSugarService.monthDiabtectResultAverageList.length; index < bloodSugarService.monthDiabtectResultAverageList.length;

@ -14,6 +14,10 @@ class ReportsMonthlyViewModel extends BaseViewModel {
ReportsService _reportsService = locator<ReportsService>(); ReportsService _reportsService = locator<ReportsService>();
String get userAgreementContent => _reportsService.userAgreementContent; String get userAgreementContent => _reportsService.userAgreementContent;
bool get receiveHealthSummaryReport => _reportsService?.user?.receiveHealthSummaryReport ?? false;
set receiveHealthSummaryReport(bool val) {
_reportsService?.user?.receiveHealthSummaryReport = val;
}
getUserTermsAndConditions() async { getUserTermsAndConditions() async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -26,14 +30,9 @@ class ReportsMonthlyViewModel extends BaseViewModel {
} }
} }
updatePatientHealthSummaryReport( updatePatientHealthSummaryReport({String message, bool isSummary, bool isUpdateEmail = false, String email}) async {
{String message,
bool isSummary,
bool isUpdateEmail = false,
String email}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _reportsService.updatePatientHealthSummaryReport( await _reportsService.updatePatientHealthSummaryReport(isSummary: isSummary);
isSummary: isSummary);
if (_reportsService.hasError) { if (_reportsService.hasError) {
error = _reportsService.error; error = _reportsService.error;
AppToast.showErrorToast(message: error); AppToast.showErrorToast(message: error);

@ -1,12 +1,18 @@
import 'dart:ui'; import 'dart:ui';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -18,14 +24,16 @@ class H2OPage extends StatefulWidget {
_H2OPageState createState() => _H2OPageState(); _H2OPageState createState() => _H2OPageState();
} }
class _H2OPageState extends State<H2OPage> class _H2OPageState extends State<H2OPage> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: 3, vsync: this,); _tabController = TabController(
length: 3,
vsync: this,
);
} }
@override @override
@ -43,6 +51,7 @@ class _H2OPageState extends State<H2OPage>
appBarTitle: TranslationBase.of(context).waterTracker, appBarTitle: TranslationBase.of(context).waterTracker,
showHomeAppBarIcon: false, showHomeAppBarIcon: false,
baseViewModel: model, baseViewModel: model,
isHelp: true,
appBarIcons: [ appBarIcons: [
IconButton( IconButton(
icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), icon: Image.asset("assets/images/new-design/setting_gear_icon.png"),
@ -129,6 +138,39 @@ class _H2OPageState extends State<H2OPage>
) )
], ],
), ),
bottomNavigationBar: BottomNavBar(
changeIndex: (index) {
if (index == 0) {
IS_VOICE_COMMAND_CLOSED = false;
} else if (index == 1) {
Navigator.push(
context,
FadePage(
page: AppScaffold(
appBarTitle: TranslationBase.of(context).medicalProfile,
isShowAppBar: true,
showHomeAppBarIcon: false,
appBarIcons: [
IconButton(
icon: Image.asset("assets/images/new-design/setting_gear_icon.png"),
color: Colors.white,
onPressed: () => Navigator.of(context).pushNamed(
SETTINGS,
),
),
],
body: MedicalProfilePage())));
} else if (index == 2) {
Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route<dynamic> route) => false);
} else if (index == 3) {
Navigator.of(context).pushNamed(MY_FAMILIY);
} else if (index == 4) {
Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false)));
}
},
showHomeIcon: true,
index: 0,
),
), ),
), ),
); );

@ -31,42 +31,47 @@ class BloodSugarWeeklyPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
body:timeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),): ListView( body: timeSeriesData.isEmpty
children: [ ? Container(
Container( child: Center(
margin: EdgeInsets.only(top: 12, left: 8, right: 8), child: Texts(TranslationBase.of(context).noDataAvailable),
color: Colors.white, ),
child: LineChartCurved( )
title: 'Sugar', : ListView(
timeSeries: timeSeriesData, children: [
indexes: timeSeriesData.length ~/ 5.5, Container(
), margin: EdgeInsets.only(top: 12, left: 8, right: 8),
), color: Colors.white,
SizedBox( child: LineChartCurved(
height: 12, title: 'Sugar',
), timeSeries: timeSeriesData,
Padding( indexes: timeSeriesData.length ~/ 5.5,
padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
), ),
children:
fullData(context, projectViewModel, bloodSugarViewMode),
), ),
SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(context, projectViewModel, bloodSugarViewMode),
),
],
),
)
], ],
), ),
)
],
),
); );
} }

@ -184,7 +184,7 @@ class LineChartCurved extends StatelessWidget {
} }
double getMinY() { double getMinY() {
double min = timeSeries[0].sales; double min = timeSeries.isEmpty ? 0 : timeSeries.first.sales;
timeSeries.forEach((element) { timeSeries.forEach((element) {
double resultValueDouble = element.sales; double resultValueDouble = element.sales;
if (resultValueDouble < min) min = resultValueDouble; if (resultValueDouble < min) min = resultValueDouble;

@ -19,15 +19,24 @@ class MonthlyReportsPage extends StatefulWidget {
} }
class _MonthlyReportsPageState extends State<MonthlyReportsPage> { class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
bool isAgree = false; bool isAgree;
bool isSummary = false; bool isSummary;
String email = ""; String email;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<ReportsMonthlyViewModel>( return BaseView<ReportsMonthlyViewModel>(builder: (_, model, w) {
builder: (_, model, w) => AppScaffold( if (isSummary == null) {
isSummary = model.receiveHealthSummaryReport;
}
if (isAgree == null) {
isAgree = model.receiveHealthSummaryReport;
}
if (email == null) {
email = model?.user?.emailAddress ?? "";
}
return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).monthlyReports, appBarTitle: TranslationBase.of(context).monthlyReports,
body: SingleChildScrollView( body: SingleChildScrollView(
@ -41,15 +50,10 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
Container( Container(
padding: EdgeInsets.all(9), padding: EdgeInsets.all(9),
height: 55, height: 55,
decoration: BoxDecoration( decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(8)), shape: BoxShape.rectangle, border: Border.all(color: Colors.grey)),
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
shape: BoxShape.rectangle,
border: Border.all(color: Colors.grey)),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts( Texts(
TranslationBase.of(context).patientHealthSummaryReport, TranslationBase.of(context).patientHealthSummaryReport,
bold: true, bold: true,
@ -62,12 +66,12 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
setState(() { setState(() {
isSummary = !isSummary; isSummary = !isSummary;
}); });
if(!isSummary) { if (!isSummary) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.updatePatientHealthSummaryReport( await model.updatePatientHealthSummaryReport(message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary);
message: TranslationBase model.receiveHealthSummaryReport = isSummary;
.of(context) isAgree = isSummary;
.updateSuccessfully, isSummary: isSummary); model.user.emailAddress = "";
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
}, },
@ -80,11 +84,11 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
), ),
Container( Container(
margin: EdgeInsets.all(8), margin: EdgeInsets.all(8),
child: TextFields( child: TextFields(
fillColor: Colors.red, fillColor: Colors.red,
hintText: 'email@email.com', hintText: 'email@email.com',
fontSize: 20, fontSize: 20,
initialValue: model.user.emailAddress, initialValue: email,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
onChanged: (text) { onChanged: (text) {
email = text; email = text;
@ -111,8 +115,7 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: Texts(TranslationBase.of(context) child: Texts(TranslationBase.of(context).toViewTheTermsAndConditions),
.toViewTheTermsAndConditions),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
@ -156,19 +159,15 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
child: SecondaryButton( child: SecondaryButton(
textColor: Colors.white, textColor: Colors.white,
label: TranslationBase.of(context).save, label: TranslationBase.of(context).save,
disabled: (!isAgree || !isSummary ), disabled: (!isAgree || !isSummary),
onTap: () async { onTap: () async {
final form = formKey.currentState; final form = formKey.currentState;
if (form.validate()) { if (form.validate()) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.updatePatientHealthSummaryReport( await model.updatePatientHealthSummaryReport(
message: TranslationBase message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary, isUpdateEmail: true, email: email.isNotEmpty ? email : model.user.emailAddress);
.of(context) model.receiveHealthSummaryReport = isSummary;
.updateSuccessfully, model.user.emailAddress = email.isNotEmpty ? email : model.user.emailAddress;
isSummary: isSummary,
isUpdateEmail: true,
email: email.isNotEmpty ? email : model.user
.emailAddress);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
}, },
@ -177,8 +176,7 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
Padding( Padding(
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.all(5.0),
child: Texts( child: Texts(
TranslationBase.of(context) TranslationBase.of(context).instructionAgree,
.instructionAgree,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
), ),
@ -191,7 +189,7 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
), ),
), ),
), ),
), );
); });
} }
} }

@ -21,7 +21,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
class BottomNavBar extends StatefulWidget { class BottomNavBar extends StatefulWidget {
final ValueChanged<int> changeIndex; final ValueChanged<int> changeIndex;
final int index; final int index;
BottomNavBar({Key key, this.changeIndex, this.index}) : super(key: key); final bool showHomeIcon;
BottomNavBar({Key key, this.changeIndex, this.index, this.showHomeIcon = false}) : super(key: key);
@override @override
_BottomNavBarState createState() => _BottomNavBarState(); _BottomNavBarState createState() => _BottomNavBarState();
@ -33,7 +34,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
var event = RobotProvider(); var event = RobotProvider();
_changeIndex(int index) async { _changeIndex(int index) async {
widget.changeIndex(index); widget.changeIndex(index);
if (_index == 0) { if (index == 0) {
event.setValue({'isRobotVisible': 'true'}); event.setValue({'isRobotVisible': 'true'});
} }
} }
@ -72,16 +73,27 @@ class _BottomNavBarState extends State<BottomNavBar> {
), ),
if (widget.index == 0) if (widget.index == 0)
Expanded( Expanded(
child: SizedBox( child: (widget.showHomeIcon)
height: 50, ? SizedBox(
child: Column( child: BottomNavigationItem(
mainAxisSize: MainAxisSize.min, icon: Icons.home_outlined,
mainAxisAlignment: MainAxisAlignment.center, activeIcon: Icons.home_outlined,
children: <Widget>[ changeIndex: _changeIndex,
SizedBox(height: 22), index: widget.index,
], currentIndex: 2,
), name: TranslationBase.of(context).home,
), ),
)
: SizedBox(
height: 50,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 22),
],
),
),
), ),
if (widget.index != 0 && projectViewModel.havePrivilege(34)) if (widget.index != 0 && projectViewModel.havePrivilege(34))
BottomNavigationItem( BottomNavigationItem(

Loading…
Cancel
Save