|
|
|
@ -1,7 +1,6 @@
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart';
|
|
|
|
import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart';
|
|
|
|
import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/routes.dart';
|
|
|
|
import 'package:diplomaticquarterapp/routes.dart';
|
|
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
|
|
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
|
|
|
|
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
|
|
|
|
@ -17,7 +16,6 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
|
@ -41,6 +39,7 @@ class _AddMember extends State<AddMember> {
|
|
|
|
var familyFileProvider = FamilyFilesProvider();
|
|
|
|
var familyFileProvider = FamilyFilesProvider();
|
|
|
|
|
|
|
|
|
|
|
|
var patientShareRequestID;
|
|
|
|
var patientShareRequestID;
|
|
|
|
|
|
|
|
var patientShareResponseID;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
@ -58,32 +57,22 @@ class _AddMember extends State<AddMember> {
|
|
|
|
? AppCircularProgressIndicator()
|
|
|
|
? AppCircularProgressIndicator()
|
|
|
|
: SingleChildScrollView(
|
|
|
|
: SingleChildScrollView(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
|
|
|
|
padding: EdgeInsets.all(21.0),
|
|
|
|
height: SizeConfig.realScreenHeight * .9,
|
|
|
|
height: SizeConfig.realScreenHeight * .9,
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
width: SizeConfig.realScreenWidth,
|
|
|
|
child: Column(children: <Widget>[
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
flex: 2,
|
|
|
|
flex: 1,
|
|
|
|
child: AppText(
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).enterNationalId,
|
|
|
|
loginType == 1 ? TranslationBase.of(context).enterNationalId : TranslationBase.of(context).enterFile,
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3.5,
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16),
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
flex: 4,
|
|
|
|
flex: 4,
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value),
|
|
|
|
PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value),
|
|
|
|
//MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value),
|
|
|
|
|
|
|
|
// Container(
|
|
|
|
|
|
|
|
// child: TextFields(
|
|
|
|
|
|
|
|
// controller: nationalIDorFile,
|
|
|
|
|
|
|
|
// onChanged: (value) => {validateForm()},
|
|
|
|
|
|
|
|
// prefixIcon: Icon(loginType == 1 ? Icons.chrome_reader_mode : Icons.receipt, color: Colors.red),
|
|
|
|
|
|
|
|
// padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
|
|
|
|
|
|
|
|
// hintText: loginType == 1 ? TranslationBase.of(context).nationalID : TranslationBase.of(context).fileNo,
|
|
|
|
|
|
|
|
// ))
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 12,
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -91,26 +80,40 @@ class _AddMember extends State<AddMember> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
// Expanded(
|
|
|
|
flex: 3,
|
|
|
|
// flex: 3,
|
|
|
|
child: Column(
|
|
|
|
// child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
children: <Widget>[
|
|
|
|
// children: <Widget>[
|
|
|
|
Row(
|
|
|
|
// Row(
|
|
|
|
children: <Widget>[
|
|
|
|
// children: <Widget>[
|
|
|
|
Expanded(
|
|
|
|
// Expanded(
|
|
|
|
|
|
|
|
// child: DefaultButton(
|
|
|
|
|
|
|
|
// TranslationBase.of(context).add,
|
|
|
|
|
|
|
|
// () => {this.addMember()},
|
|
|
|
|
|
|
|
// color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor,
|
|
|
|
|
|
|
|
// textColor: Colors.white,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(21.0),
|
|
|
|
child: DefaultButton(
|
|
|
|
child: DefaultButton(
|
|
|
|
TranslationBase.of(context).add,
|
|
|
|
TranslationBase.of(context).add,
|
|
|
|
() => {this.addMember()},
|
|
|
|
() => {this.addMember()},
|
|
|
|
color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor,
|
|
|
|
color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor,
|
|
|
|
textColor: Colors.white,
|
|
|
|
textColor: Colors.white,
|
|
|
|
))
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void validateForm() {
|
|
|
|
void validateForm() {
|
|
|
|
@ -158,31 +161,30 @@ class _AddMember extends State<AddMember> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
insertFamilyData(addMemberResult) {
|
|
|
|
insertFamilyData(addMemberResult) {
|
|
|
|
var request = InsertSharePatientFileReq();
|
|
|
|
sendActivationCode(addMemberResult);
|
|
|
|
request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID'];
|
|
|
|
// var request = InsertSharePatientFileReq();
|
|
|
|
request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName'];
|
|
|
|
// request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID'];
|
|
|
|
request.status = 2;
|
|
|
|
// request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName'];
|
|
|
|
if (request.patientOutSA == 1) {
|
|
|
|
// request.status = 2;
|
|
|
|
request.regionID = 2;
|
|
|
|
// if (request.patientOutSA == 1) {
|
|
|
|
} else {
|
|
|
|
// request.regionID = 2;
|
|
|
|
request.regionID = 1;
|
|
|
|
// } else {
|
|
|
|
}
|
|
|
|
// request.regionID = 1;
|
|
|
|
loading(true);
|
|
|
|
// }
|
|
|
|
familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err){
|
|
|
|
// loading(true);
|
|
|
|
loading(false);
|
|
|
|
// familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err) {
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
// loading(false);
|
|
|
|
});
|
|
|
|
// AppToast.showErrorToast(message: err);
|
|
|
|
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sendActivationCode(result) {
|
|
|
|
sendActivationCode(result) {
|
|
|
|
// var request = this.getCommonRequest();
|
|
|
|
// var request = this.getCommonRequest();
|
|
|
|
loading(true);
|
|
|
|
loading(true);
|
|
|
|
patientShareRequestID = result['PatientShareRequestID'];
|
|
|
|
patientShareResponseID = result['ShareFamilyFileObj']['ReponseID'];
|
|
|
|
familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text).then((result) => {
|
|
|
|
familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text, patientShareResponseID).then((res) => {
|
|
|
|
if (result != null && result['isSMSSent'] == true) {this.startSMSService(1, result)}
|
|
|
|
patientShareRequestID = res['PatientShareRequestID'],
|
|
|
|
// {loading(false), this.startSMSService(type)}
|
|
|
|
if (res != null && res['isSMSSent'] == true) {this.startSMSService(1, res)}
|
|
|
|
// else
|
|
|
|
|
|
|
|
// {loading(false)}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -207,7 +209,7 @@ class _AddMember extends State<AddMember> {
|
|
|
|
checkActivationCode(value, result) {
|
|
|
|
checkActivationCode(value, result) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo).then((result) {
|
|
|
|
familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo, patientShareRequestID, patientShareResponseID).then((result) {
|
|
|
|
SMSOTP.hideSMSBox(context);
|
|
|
|
SMSOTP.hideSMSBox(context);
|
|
|
|
handleFamilyRequests(this.patientShareRequestID, 3);
|
|
|
|
handleFamilyRequests(this.patientShareRequestID, 3);
|
|
|
|
}).catchError((err) {
|
|
|
|
}).catchError((err) {
|
|
|
|
@ -219,12 +221,12 @@ class _AddMember extends State<AddMember> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleFamilyRequests(id, stauts) {
|
|
|
|
handleFamilyRequests(id, stauts) {
|
|
|
|
familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => {
|
|
|
|
// familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => {
|
|
|
|
sharedPref.remove(FAMILY_FILE),
|
|
|
|
sharedPref.remove(FAMILY_FILE);
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
MY_FAMILIY,
|
|
|
|
MY_FAMILIY,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
loading(flag) {
|
|
|
|
loading(flag) {
|
|
|
|
|