diff --git a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart index da848b65..b21d940f 100644 --- a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart +++ b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart @@ -1,68 +1,68 @@ class GetAllSharedRecordsByStatusResponse { - Null date; + dynamic date; int languageID; int serviceName; - Null time; - Null androidLink; - Null authenticationTokenID; - Null data; + dynamic time; + dynamic androidLink; + dynamic authenticationTokenID; + dynamic data; bool dataw; int dietType; - Null errorCode; - Null errorEndUserMessage; - Null errorEndUserMessageN; - Null errorMessage; + dynamic errorCode; + dynamic errorEndUserMessage; + dynamic errorEndUserMessageN; + dynamic errorMessage; int errorType; int foodCategory; - Null iOSLink; + dynamic iOSLink; bool isAuthenticated; int mealOrderStatus; int mealType; int messageStatus; int numberOfResultRecords; - Null patientBlodType; - Null successMsg; - Null successMsgN; - Null doctorInformationList; - Null getAllPendingRecordsList; + dynamic patientBlodType; + dynamic successMsg; + dynamic successMsgN; + dynamic doctorInformationList; + List getAllPendingRecordsList; List getAllSharedRecordsByStatusList; - Null getResponseFileList; + List getResponseFileList; bool isHMGPatient; bool isLoginSuccessfully; bool isNeedUpdateIdintificationNo; bool kioskSendSMS; - Null list; - Null listAskHabibMobileLoginInfo; - Null listAskHabibPatientFile; - Null listMergeFiles; - Null listMobileLoginInfo; - Null listPatientCount; - Null logInTokenID; - Null mohemmPrivilegeList; + dynamic list; + dynamic listAskHabibMobileLoginInfo; + dynamic listAskHabibPatientFile; + dynamic listMergeFiles; + dynamic listMobileLoginInfo; + dynamic listPatientCount; + dynamic logInTokenID; + dynamic mohemmPrivilegeList; int pateintID; - Null patientBloodType; - Null patientERDriverFile; - Null patientERDriverFileList; + dynamic patientBloodType; + dynamic patientERDriverFile; + dynamic patientERDriverFileList; bool patientHasFile; - Null patientMergedIDs; + dynamic patientMergedIDs; bool patientOutSA; int patientShareRequestID; int patientType; int projectIDOut; - Null returnMessage; + dynamic returnMessage; bool sMSLoginRequired; - Null servicePrivilegeList; - Null sharePatientName; - Null verificationCode; - Null email; - Null errorList; + dynamic servicePrivilegeList; + dynamic sharePatientName; + dynamic verificationCode; + dynamic email; + dynamic errorList; bool hasFile; bool isActiveCode; bool isMerged; bool isNeedUserAgreement; bool isSMSSent; - Null memberList; - Null message; + dynamic memberList; + dynamic message; int statusCode; GetAllSharedRecordsByStatusResponse( @@ -133,78 +133,92 @@ class GetAllSharedRecordsByStatusResponse { this.statusCode}); GetAllSharedRecordsByStatusResponse.fromJson(Map json) { - date = json['Date']; - languageID = json['LanguageID']; - serviceName = json['ServiceName']; - time = json['Time']; - androidLink = json['AndroidLink']; - authenticationTokenID = json['AuthenticationTokenID']; - data = json['Data']; - dataw = json['Dataw']; - dietType = json['DietType']; - errorCode = json['ErrorCode']; - errorEndUserMessage = json['ErrorEndUserMessage']; - errorEndUserMessageN = json['ErrorEndUserMessageN']; - errorMessage = json['ErrorMessage']; - errorType = json['ErrorType']; - foodCategory = json['FoodCategory']; - iOSLink = json['IOSLink']; - isAuthenticated = json['IsAuthenticated']; - mealOrderStatus = json['MealOrderStatus']; - mealType = json['MealType']; - messageStatus = json['MessageStatus']; - numberOfResultRecords = json['NumberOfResultRecords']; - patientBlodType = json['PatientBlodType']; - successMsg = json['SuccessMsg']; - successMsgN = json['SuccessMsgN']; - doctorInformationList = json['DoctorInformation_List']; - getAllPendingRecordsList = json['GetAllPendingRecordsList']; - if (json['GetAllSharedRecordsByStatusList'] != null) { - getAllSharedRecordsByStatusList = - new List(); - json['GetAllSharedRecordsByStatusList'].forEach((v) { - getAllSharedRecordsByStatusList - .add(new GetAllSharedRecordsByStatusList.fromJson(v)); - }); + try { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + doctorInformationList = json['DoctorInformation_List']; +// getAllPendingRecordsList = json['GetAllPendingRecordsList']; + + if (json['GetAllPendingRecordsList'] != null) { + getAllSharedRecordsByStatusList = new List(); + json['GetAllPendingRecordsList'].forEach((v) { + getAllSharedRecordsByStatusList + .add(new GetAllSharedRecordsByStatusList.fromJson(v)); + }); + } + + if (json['GetAllSharedRecordsByStatusList'] != null) { + getAllSharedRecordsByStatusList = new List(); + json['GetAllSharedRecordsByStatusList'].forEach((v) { + getAllSharedRecordsByStatusList + .add(new GetAllSharedRecordsByStatusList.fromJson(v)); + }); + } + getResponseFileList = json['GetResponseFileList']; + isHMGPatient = json['IsHMGPatient']; + isLoginSuccessfully = json['IsLoginSuccessfully']; + isNeedUpdateIdintificationNo = json['IsNeedUpdateIdintificationNo']; + kioskSendSMS = json['KioskSendSMS']; + list = json['List']; + listAskHabibMobileLoginInfo = json['List_AskHabibMobileLoginInfo']; + listAskHabibPatientFile = json['List_AskHabibPatientFile']; + listMergeFiles = json['List_MergeFiles']; + listMobileLoginInfo = json['List_MobileLoginInfo']; + listPatientCount = json['List_PatientCount']; + logInTokenID = json['LogInTokenID']; + mohemmPrivilegeList = json['MohemmPrivilege_List']; + pateintID = json['PateintID']; + patientBloodType = json['PatientBloodType']; + patientERDriverFile = json['PatientER_DriverFile']; + patientERDriverFileList = json['PatientER_DriverFileList']; + patientHasFile = json['PatientHasFile']; + patientMergedIDs = json['PatientMergedIDs']; + patientOutSA = json['PatientOutSA']; + patientShareRequestID = json['PatientShareRequestID']; + patientType = json['PatientType']; + projectIDOut = json['ProjectIDOut']; + returnMessage = json['ReturnMessage']; + sMSLoginRequired = json['SMSLoginRequired']; + servicePrivilegeList = json['ServicePrivilege_List']; + sharePatientName = json['SharePatientName']; + verificationCode = json['VerificationCode']; + email = json['email']; + errorList = json['errorList']; + hasFile = json['hasFile']; + isActiveCode = json['isActiveCode']; + isMerged = json['isMerged']; + isNeedUserAgreement = json['isNeedUserAgreement']; + isSMSSent = json['isSMSSent']; + memberList = json['memberList']; + message = json['message']; + statusCode = json['statusCode']; + }catch (e){ + var asd =""; + print(e); + } - getResponseFileList = json['GetResponseFileList']; - isHMGPatient = json['IsHMGPatient']; - isLoginSuccessfully = json['IsLoginSuccessfully']; - isNeedUpdateIdintificationNo = json['IsNeedUpdateIdintificationNo']; - kioskSendSMS = json['KioskSendSMS']; - list = json['List']; - listAskHabibMobileLoginInfo = json['List_AskHabibMobileLoginInfo']; - listAskHabibPatientFile = json['List_AskHabibPatientFile']; - listMergeFiles = json['List_MergeFiles']; - listMobileLoginInfo = json['List_MobileLoginInfo']; - listPatientCount = json['List_PatientCount']; - logInTokenID = json['LogInTokenID']; - mohemmPrivilegeList = json['MohemmPrivilege_List']; - pateintID = json['PateintID']; - patientBloodType = json['PatientBloodType']; - patientERDriverFile = json['PatientER_DriverFile']; - patientERDriverFileList = json['PatientER_DriverFileList']; - patientHasFile = json['PatientHasFile']; - patientMergedIDs = json['PatientMergedIDs']; - patientOutSA = json['PatientOutSA']; - patientShareRequestID = json['PatientShareRequestID']; - patientType = json['PatientType']; - projectIDOut = json['ProjectIDOut']; - returnMessage = json['ReturnMessage']; - sMSLoginRequired = json['SMSLoginRequired']; - servicePrivilegeList = json['ServicePrivilege_List']; - sharePatientName = json['SharePatientName']; - verificationCode = json['VerificationCode']; - email = json['email']; - errorList = json['errorList']; - hasFile = json['hasFile']; - isActiveCode = json['isActiveCode']; - isMerged = json['isMerged']; - isNeedUserAgreement = json['isNeedUserAgreement']; - isSMSSent = json['isSMSSent']; - memberList = json['memberList']; - message = json['message']; - statusCode = json['statusCode']; } Map toJson() { @@ -287,7 +301,7 @@ class GetAllSharedRecordsByStatusList { int responseID; int regionID; int status; - Null isActive; + dynamic isActive; String editedOn; String createdOn; String emaiLAddress; diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index b4024b0a..535c09ce 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -220,20 +220,171 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget myFamilyRequest(context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - children: [ - // SizedBox(height: 20.0), - RoundedContainer( - child: ExpansionTile( + child: SingleChildScrollView( + child: Column( + children: [ + // SizedBox(height: 20.0), + RoundedContainer( + child: ExpansionTile( + title: Text( + TranslationBase.of(context).userViewRequest, + style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), + ), + children: [ + FutureBuilder( + future: getUserViewRequest(), // async work + builder: (BuildContext context, + AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return Padding( + padding: EdgeInsets.only(top: 50), + child: Text('Loading....')); + default: + if (snapshot.hasError) + return Padding( + padding: EdgeInsets.all(10), + child: Text('No data found')); + else + return Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 3, + child: Text(TranslationBase.of(context) + .request)), + Expanded( + flex: 2, + child: Text( + TranslationBase.of(context) + .switchUser, + )), + Expanded( + flex: 1, + child: Text( + TranslationBase.of(context) + .deleteView, + )), + ], + ), + Column(children: [ + Row(children: [ + Expanded(flex: 3, child: AppText('Name')), + Expanded(flex: 1, child: AppText('Allow')), + Expanded(flex: 1, child: AppText('Reject')), + ]), + Column( + children:familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList + .map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: + Text(result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.check_circle, + color: Colors.black, + ), + onPressed: () { + acceptRequest( + result, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deleteRequest( + result, context); + }, + )) + ], + )); + }).toList()) + ]) + ], + ); + } + }) + ], + ), + ), + RoundedContainer( + child: ExpansionTile( title: Text( - TranslationBase.of(context).userViewRequest, + TranslationBase.of(context).sentRequest, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), ), children: [ FutureBuilder( - future: getUserViewRequest(), // async work + future: getSentRequest(), // async work builder: (BuildContext context, - AsyncSnapshot snapshot) { + AsyncSnapshot + snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return Padding( + padding: EdgeInsets.only(top: 50), + child: Text('Loading....')); + default: + if (snapshot.hasError) + return Padding( + padding: EdgeInsets.all(10), + child: Text('No data found')); + else + return SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight * .3, + child: ListView( + children: snapshot + .data.getAllSharedRecordsByStatusList + .map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: + Text(result.patientName)), + Expanded( + flex: 2, + child: AppText( + result.statusDescription, + color: Colors.red, + )), + ], + )); + }).toList(), + ))); + } + }) + ], + )), + RoundedContainer( + child: ExpansionTile( + title: Text( + TranslationBase.of(context).userView, + style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), + ), + children: [ + FutureBuilder( + future: getUserViewRequest(), // async work + builder: + (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: return Padding( @@ -253,31 +404,27 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ Expanded( flex: 3, - child: Text(TranslationBase.of(context) - .request)), + child: Text( + TranslationBase.of(context).request)), Expanded( flex: 2, child: Text( - TranslationBase.of(context) - .switchUser, + TranslationBase.of(context).switchUser, )), Expanded( flex: 1, child: Text( - TranslationBase.of(context) - .deleteView, + TranslationBase.of(context).deleteView, )), ], ), Column(children: [ Row(children: [ Expanded(flex: 3, child: AppText('Name')), - Expanded(flex: 1, child: AppText('Allow')), - Expanded(flex: 1, child: AppText('Reject')), + Expanded(flex: 1, child: AppText('Delete')), ]), Column( - children: snapshot - .data['GetAllPendingRecordsList'] + children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList .map((result) { return Padding( padding: EdgeInsets.all(10), @@ -285,20 +432,7 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ Expanded( flex: 3, - child: - Text(result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.check_circle, - color: Colors.black, - ), - onPressed: () { - acceptRequest( - result, context); - }, - )), + child: Text(result.patientName)), Expanded( flex: 1, child: IconButton( @@ -310,7 +444,7 @@ class _MyFamily extends State with TickerProviderStateMixin { deleteRequest( result, context); }, - )) + )), ], )); }).toList()) @@ -320,143 +454,9 @@ class _MyFamily extends State with TickerProviderStateMixin { } }) ], - ), - ), - RoundedContainer( - child: ExpansionTile( - title: Text( - TranslationBase.of(context).sentRequest, - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), - ), - children: [ - FutureBuilder( - future: getSentRequest(), // async work - builder: (BuildContext context, - AsyncSnapshot - snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.only(top: 50), - child: Text('Loading....')); - default: - if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text('No data found')); - else - return SingleChildScrollView( - child: Container( - height: SizeConfig.screenHeight * .3, - child: ListView( - children: snapshot - .data.getAllSharedRecordsByStatusList - .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: - Text(result.patientName)), - Expanded( - flex: 2, - child: AppText( - result.statusDescription, - color: Colors.red, - )), - ], - )); - }).toList(), - ))); - } - }) - ], - )), - RoundedContainer( - child: ExpansionTile( - title: Text( - TranslationBase.of(context).userView, - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), - ), - children: [ - FutureBuilder( - future: getUserViewRequest(), // async work - builder: - (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.only(top: 50), - child: Text('Loading....')); - default: - if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text('No data found')); - else - return Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 3, - child: Text( - TranslationBase.of(context).request)), - Expanded( - flex: 2, - child: Text( - TranslationBase.of(context).switchUser, - )), - Expanded( - flex: 1, - child: Text( - TranslationBase.of(context).deleteView, - )), - ], - ), - Column(children: [ - Row(children: [ - Expanded(flex: 3, child: AppText('Name')), - Expanded(flex: 1, child: AppText('Delete')), - ]), - Column( - children: snapshot - .data['GetAllPendingRecordsList'] - .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: Text(result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deleteRequest( - result, context); - }, - )), - ], - )); - }).toList()) - ]) - ], - ); - } - }) - ], - )) - ], + )) + ], + ), ), ); } diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index b80ce22e..4e7c95d0 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -42,7 +42,7 @@ class FamilyFilesProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; dynamic authenticatedUser; - + GetAllSharedRecordsByStatusResponse allSharedRecordsByStatusResponse; Future getSharedRecordByStatus() async { try { dynamic localRes; @@ -64,7 +64,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future getUserViewRequest(responseID) async { + Future getUserViewRequest(responseID) async { try { dynamic localRes; Map request = {}; @@ -73,14 +73,17 @@ class FamilyFilesProvider with ChangeNotifier { onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { - return Future.value(error); + return Future.error(error); }, body: request); + if(localRes!=null){ sharedPref.setObject(FAMILY_FILE, localRes); - return Future.value( - GetAllSharedRecordsByStatusResponse.fromJson(localRes)); + allSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(localRes); + return Future.value(allSharedRecordsByStatusResponse);} + else + return Future.error("No Data"); } catch (error) { print(error); - throw error; + return Future.error(error); } }