|
|
|
|
@ -63,7 +63,7 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
authProv = Provider.of<AuthViewModel>(context);
|
|
|
|
|
projectsProv = Provider.of<HospitalViewModel>(context);
|
|
|
|
|
getProjects();
|
|
|
|
|
|
|
|
|
|
return Form(
|
|
|
|
|
key: loginFormKey,
|
|
|
|
|
child: Container(
|
|
|
|
|
@ -88,9 +88,13 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
userInfo.userID = value.trim();
|
|
|
|
|
},
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
userInfo.userID = value.trim();
|
|
|
|
|
},
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
focusPass.nextFocus();
|
|
|
|
|
},
|
|
|
|
|
onEditingComplete: () {},
|
|
|
|
|
autofocus: false,
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
@ -113,8 +117,11 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
},
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
focusPass.nextFocus();
|
|
|
|
|
helpers.showCupertinoPicker(
|
|
|
|
|
context, projectsList, 'Name', onSelectProject);
|
|
|
|
|
// helpers.showCupertinoPicker(
|
|
|
|
|
// context, projectsList, 'facilityName', onSelectProject);
|
|
|
|
|
},
|
|
|
|
|
onTap: () {
|
|
|
|
|
this.getProjects(userInfo.userID);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
@ -123,8 +130,8 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
focusNode: focusProject,
|
|
|
|
|
controller: projectIdController,
|
|
|
|
|
onTap: () {
|
|
|
|
|
helpers.showCupertinoPicker(
|
|
|
|
|
context, projectsList, 'Name', onSelectProject);
|
|
|
|
|
// helpers.showCupertinoPicker(context, projectsList,
|
|
|
|
|
// 'facilityName', onSelectProject);
|
|
|
|
|
},
|
|
|
|
|
showCursor: false,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
@ -143,7 +150,7 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
readOnly: true,
|
|
|
|
|
decoration: buildInputDecoration(
|
|
|
|
|
context,
|
|
|
|
|
TranslationBase.of(context).loading,
|
|
|
|
|
TranslationBase.of(context).pleaseEnterYourProject,
|
|
|
|
|
'assets/images/password_icon.png')),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
Row(
|
|
|
|
|
@ -322,13 +329,15 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getProjectsList() {
|
|
|
|
|
getProjectsList(memberID) {
|
|
|
|
|
//showLoading();
|
|
|
|
|
projectsProv.getProjectsList().then((res) {
|
|
|
|
|
projectsProv.getProjectsList(memberID).then((res) {
|
|
|
|
|
//hideLoading();
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
projectsList = res['ProjectInfo'];
|
|
|
|
|
setState(() {
|
|
|
|
|
projectsList = res['ListProject'];
|
|
|
|
|
userInfo.projectID = projectsList[0]["facilityId"];
|
|
|
|
|
projectIdController.text = projectsList[0]['facilityName'];
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// handel error
|
|
|
|
|
@ -350,8 +359,8 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
|
|
|
|
|
onSelectProject(index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
userInfo.projectID = projectsList[index]["ID"];
|
|
|
|
|
projectIdController.text = projectsList[index]['Name'];
|
|
|
|
|
userInfo.projectID = projectsList[index]["facilityId"];
|
|
|
|
|
projectIdController.text = projectsList[index]['facilityName'];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
primaryFocus.unfocus();
|
|
|
|
|
@ -371,10 +380,10 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getProjects() {
|
|
|
|
|
if (_isInit) {
|
|
|
|
|
getProjects(value) {
|
|
|
|
|
if (value != null && value != '') {
|
|
|
|
|
if (projectsList.length == 0) {
|
|
|
|
|
getProjectsList();
|
|
|
|
|
getProjectsList(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_isInit = false;
|
|
|
|
|
|