|
|
|
|
@ -2,20 +2,18 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import 'lacum-registration-page.dart';
|
|
|
|
|
|
|
|
|
|
class LakumActivationVidaPage extends StatelessWidget {
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
TextEditingController _identificationNumberController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _identificationNumberController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -50,10 +48,7 @@ class LakumActivationVidaPage extends StatelessWidget {
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: TextField(
|
|
|
|
|
controller: _identificationNumberController,
|
|
|
|
|
decoration: new InputDecoration(
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.enterIdentificationNumber,
|
|
|
|
|
),
|
|
|
|
|
decoration: new InputDecoration(hintText: TranslationBase.of(context).enterIdentificationNumber, focusColor: CustomColors.green),
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
@ -67,39 +62,38 @@ class LakumActivationVidaPage extends StatelessWidget {
|
|
|
|
|
margin: EdgeInsets.only(top: 4),
|
|
|
|
|
child: BorderedButton(
|
|
|
|
|
TranslationBase.of(context).accountActivation,
|
|
|
|
|
backgroundColor:
|
|
|
|
|
_identificationNumberController.text != null &&
|
|
|
|
|
_identificationNumberController.text != ""
|
|
|
|
|
? Color(0xff60686b)
|
|
|
|
|
: Color(0xffb0b4b5),
|
|
|
|
|
// backgroundColor: _identificationNumberController.text != null && _identificationNumberController.text != "" ? CustomColors.green : Color(0xffb0b4b5),
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
backgroundColor: CustomColors.green,
|
|
|
|
|
borderColor: CustomColors.green,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
hPadding: 8,
|
|
|
|
|
vPadding: 12,
|
|
|
|
|
handler: _identificationNumberController.text != null ||
|
|
|
|
|
_identificationNumberController.text != ""
|
|
|
|
|
handler: _identificationNumberController.text != null || _identificationNumberController.text != ""
|
|
|
|
|
? () {
|
|
|
|
|
model
|
|
|
|
|
.checkLacumAccountActivation(
|
|
|
|
|
_identificationNumberController.text)
|
|
|
|
|
.then((_) => {
|
|
|
|
|
if (model.state == ViewState.Idle)
|
|
|
|
|
{
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LakumRegistrationPage(
|
|
|
|
|
_identificationNumberController
|
|
|
|
|
.text)))
|
|
|
|
|
.then((status) => {
|
|
|
|
|
if (status == 200)
|
|
|
|
|
{model.makeAccountActivate(projectViewModel.user.patientIdentificationNo)}
|
|
|
|
|
// back to previous page
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
model.checkLacumAccountActivation(_identificationNumberController.text).then((_) {
|
|
|
|
|
if (model.state == ViewState.Idle) {
|
|
|
|
|
if (model.lacumInformation.status != "Hold") {
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).lakumUnhold);
|
|
|
|
|
if (model.lacumInformation.status != "Discontinue") {
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).lakumDiscontinue);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (model.lacumInformation.status == "Hold") {
|
|
|
|
|
model.makeAccountActivate(projectViewModel.user.patientIdentificationNo).then((value) {
|
|
|
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).lakumSuccess);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Navigator.push(context, FadePage(page: LakumRegistrationPage(_identificationNumberController.text))).then((status) => {
|
|
|
|
|
// if (status == 200) {model.makeAccountActivate(projectViewModel.user.patientIdentificationNo)}
|
|
|
|
|
// // back to previous page
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: () {},
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|