Merge branch 'development' into development_new_design_2.0
# Conflicts: # lib/pages/login/login.dart # lib/uitl/translations_delegate_base.dart # lib/widgets/data_display/medical/LabResult/LabResultWidget.dart # lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dartmerge-requests/390/head
commit
6191377914
@ -0,0 +1,85 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"questionEN": "Is the test intended for travel?",
|
||||
"questionAR": "هل تجري التحليل بغرض السفر؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"questionEN": "Coming from outside KSA within last 2 weeks?",
|
||||
"questionAR": "هل قدمت من خارج المملكة خلال الأسبوعين الماضيين؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"questionEN": "Do you currently have fever?",
|
||||
"questionAR": "هل تعاني حاليا من حرارة؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"questionEN": "Did you have fever in last 2 weeks?",
|
||||
"questionAR": "هل عانيت من حرارة في الأسبوعين الماضيين؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"questionEN": "Do you have a sore throat?",
|
||||
"questionAR": "هل لديك التهاب في الحلق؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"questionEN": "Do you have a runny nose?",
|
||||
"questionAR": "هل لديك سيلان بالأنف؟"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"questionEN": "Do you have a cough?",
|
||||
"questionAR": "هل لديك سعال؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"questionEN": "Do you have shortness of breath?",
|
||||
"questionAR": "هل تعانين من ضيق في التنفس؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"questionEN": "Do you have nausea?",
|
||||
"questionAR": "هل تعانين من غثيان؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"questionEN": "Do you have vomiting?",
|
||||
"questionAR": "هل تعاني من القيء؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"questionEN": "Do you have a headache?",
|
||||
"questionAR": "هل تعاني من صداع في الرأس؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"questionEN": "Do you have muscle pain?",
|
||||
"questionAR": "هل تعانين من آلام عضلية؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"questionEN": "Do you have joint pain?",
|
||||
"questionAR": "هل تعانين من آلام المفاصل؟",
|
||||
"ans": 2
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"questionEN": "Do you have diarrhea?",
|
||||
"questionAR": "هل لديك اسهال؟",
|
||||
"ans": 2
|
||||
}
|
||||
]
|
@ -1 +1 @@
|
||||
269226e53e3ba1b1460fd3df51f89f77
|
||||
e52eba3667a38bec777870899c15ae7d
|
@ -0,0 +1,168 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart';
|
||||
import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/labs/passport_update_page.dart';
|
||||
import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'covid-payment-details.dart';
|
||||
|
||||
class CovidDirveThruQuestions extends StatefulWidget {
|
||||
final String projectId;
|
||||
final List<CovidTestProceduresResponse> proceduresList;
|
||||
|
||||
CovidDirveThruQuestions({@required this.projectId, @required this.proceduresList});
|
||||
|
||||
@override
|
||||
CovidDirveThruQuestionsState createState() => CovidDirveThruQuestionsState();
|
||||
}
|
||||
|
||||
class CovidDirveThruQuestionsState extends State<CovidDirveThruQuestions> {
|
||||
List qa;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
qa = getQuestionsFromJson();
|
||||
}
|
||||
|
||||
TranslationBase localize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
localize = TranslationBase.of(context);
|
||||
var isArabic = localize.isArabic();
|
||||
return AppScaffold(
|
||||
appBarTitle: TranslationBase.of(context).covidTest,
|
||||
isShowAppBar: true,
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Text(localize.covidSelectProcedure, style: TextStyle(fontSize: 17, letterSpacing: 1, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
itemCount: qa.length,
|
||||
itemBuilder: (ctx, idx) {
|
||||
var obj = qa[idx];
|
||||
var qtext = isArabic ? obj["questionAR"] : obj["questionEN"];
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(qtext, style: TextStyle(fontSize: 15, letterSpacing: 1.5)),
|
||||
Row(
|
||||
children: [
|
||||
Radio<int>(
|
||||
value: 1,
|
||||
groupValue: obj["ans"],
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
obj["ans"] = newValue;
|
||||
});
|
||||
}),
|
||||
Text(localize.yes),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Radio<int>(
|
||||
value: 0,
|
||||
groupValue: obj["ans"],
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
obj["ans"] = newValue;
|
||||
});
|
||||
}),
|
||||
Text(localize.no),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (ctx, idx) => Divider(height: 0.25, color: Colors.grey.withOpacity(0.5)),
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: 1,
|
||||
child: MaterialButton(
|
||||
height: 50,
|
||||
color: Theme.of(context).appBarTheme.color,
|
||||
disabledColor: Theme.of(context).appBarTheme.color.withOpacity(0.25),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Text(
|
||||
localize.next,
|
||||
style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),
|
||||
),
|
||||
onPressed: next),
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
next() async {
|
||||
bool all = true;
|
||||
qa.forEach((element) {
|
||||
all = all && (element["ans"] == 1 || element["ans"] == 0);
|
||||
});
|
||||
if (all) if (qa[0]["ans"] == 1) {
|
||||
openPassportUpdatePage();
|
||||
} else {
|
||||
getPaymentInfo(context, widget.projectId);
|
||||
}
|
||||
else
|
||||
AppToast.showErrorToast(message: localize.pleaseSelectAllQuestionToContinue);
|
||||
}
|
||||
|
||||
openPassportUpdatePage() {
|
||||
Navigator.push(context, FadePage(page: PassportUpdatePage())).then((value) {
|
||||
print(value);
|
||||
if(value != null && value == true) {
|
||||
getPaymentInfo(context, widget.projectId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
List getQuestionsFromJson() {
|
||||
var questionsJson = """
|
||||
[{"id":1,"questionEN":"Is the test intended for travel?","questionAR":"هل تجري التحليل بغرض السفر؟","ans":2},{"id":2,"questionEN":"Coming from outside KSA within last 2 weeks?","questionAR":"هل قدمت من خارج المملكة خلال الأسبوعين الماضيين؟","ans":2},{"id":3,"questionEN":"Do you currently have fever?","questionAR":"هل تعاني حاليا من حرارة؟","ans":2},{"id":4,"questionEN":"Did you have fever in last 2 weeks?","questionAR":"هل عانيت من حرارة في الأسبوعين الماضيين؟","ans":2},{"id":5,"questionEN":"Do you have a sore throat?","questionAR":"هل لديك التهاب في الحلق؟","ans":2},{"id":6,"questionEN":"Do you have a runny nose?","questionAR":"هل لديك سيلان بالأنف؟"},{"id":7,"questionEN":"Do you have a cough?","questionAR":"هل لديك سعال؟","ans":2},{"id":8,"questionEN":"Do you have shortness of breath?","questionAR":"هل تعانين من ضيق في التنفس؟","ans":2},{"id":9,"questionEN":"Do you have nausea?","questionAR":"هل تعانين من غثيان؟","ans":2},{"id":10,"questionEN":"Do you have vomiting?","questionAR":"هل تعاني من القيء؟","ans":2},{"id":11,"questionEN":"Do you have a headache?","questionAR":"هل تعاني من صداع في الرأس؟","ans":2},{"id":12,"questionEN":"Do you have muscle pain?","questionAR":"هل تعانين من آلام عضلية؟","ans":2},{"id":13,"questionEN":"Do you have joint pain?","questionAR":"هل تعانين من آلام المفاصل؟","ans":2},{"id":14,"questionEN":"Do you have diarrhea?","questionAR":"هل لديك اسهال؟","ans":2}]""";
|
||||
var map = json.decode(questionsJson) as List;
|
||||
return map;
|
||||
}
|
||||
|
||||
getPaymentInfo(BuildContext context, String projectID) {
|
||||
CovidDriveThruService service = new CovidDriveThruService();
|
||||
CovidPaymentInfoResponse covidPaymentInfoResponse = new CovidPaymentInfoResponse();
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
service.getCovidPaymentInformation(context, int.parse(projectID), widget.proceduresList[0].procedureID).then((res) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
if (res['MessageStatus'] == 1) {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: CovidPaymentDetails(
|
||||
covidPaymentInfoResponse: covidPaymentInfoResponse,
|
||||
projectID: int.parse(projectID),
|
||||
proceduresList: widget.proceduresList,
|
||||
)));
|
||||
} else {}
|
||||
}).catchError((err) {
|
||||
print(err);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class PassportUpdatePage extends StatefulWidget {
|
||||
@override
|
||||
_PassportUpdatePageState createState() => _PassportUpdatePageState();
|
||||
}
|
||||
|
||||
class _PassportUpdatePageState extends State<PassportUpdatePage> {
|
||||
TextEditingController passportNumber = new TextEditingController();
|
||||
bool _isButtonDisabled;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => getPassportNumber());
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: TranslationBase.of(context).passportNumber,
|
||||
isShowAppBar: true,
|
||||
isBottomBar: true,
|
||||
body: Container(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.all(45.0),
|
||||
child: Text(TranslationBase.of(context).enterPassportNumber, textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold, color: Colors.black)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
||||
child: SvgPicture.asset("assets/images/new-design/passport.svg", width: 250.0, fit: BoxFit.fill),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 50.0, right: 50.0, top: 25.0),
|
||||
child: TextFields(
|
||||
keyboardType: TextInputType.text,
|
||||
fontWeight: FontWeight.normal,
|
||||
controller: passportNumber,
|
||||
onChanged: (value) => {_onPassportTextChanged(value)},
|
||||
padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
|
||||
hintText: TranslationBase.of(context).passportNumber,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
margin: EdgeInsets.only(top: 10.0, left: 30.0, right: 30.0, bottom: 10.0),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
minWidth: MediaQuery.of(context).size.width,
|
||||
height: 45.0,
|
||||
child: RaisedButton(
|
||||
color: new Color(0xFFc5272d),
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: Colors.red[300],
|
||||
onPressed: () {
|
||||
if (_isButtonDisabled == false)
|
||||
updatePassportNumber();
|
||||
else
|
||||
AppToast.showErrorToast(message: TranslationBase.of(context).validPassportNumber);
|
||||
},
|
||||
child: Text(TranslationBase.of(context).submit, style: TextStyle(fontSize: 18.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_onPassportTextChanged(content) {
|
||||
if (content.length >= 1) {
|
||||
setState(() {
|
||||
_isButtonDisabled = false;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isButtonDisabled = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void updatePassportNumber() {
|
||||
LabsService service = new LabsService();
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
|
||||
service.updateCovidPassportNumber(passportNumber.text).then((res) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
Navigator.of(context).pop(true);
|
||||
}).catchError((err) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(err);
|
||||
});
|
||||
}
|
||||
|
||||
void getPassportNumber() {
|
||||
LabsService service = new LabsService();
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
|
||||
service.getCovidPassportNumber().then((res) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(res['Covid19_Certificate_GetPassportList'][0]['PassportNo']);
|
||||
passportNumber.text = res['Covid19_Certificate_GetPassportList'][0]['PassportNo'];
|
||||
if(res['Covid19_Certificate_GetPassportList'][0]['PassportNo'] != "") {
|
||||
_isButtonDisabled = false;
|
||||
}
|
||||
}).catchError((err) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(err);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue