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