diff --git a/lib/config/config.dart b/lib/config/config.dart index 73b92daa..1e1bae3b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -292,6 +292,8 @@ const ADD_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_AddDiabtecResult' const GET_BLOOD_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage'; const GET_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult'; const ADD_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult'; +const UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; + const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage'; const GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 34781055..221b481a 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1489,6 +1489,14 @@ const Map localizedValues = { "en": "Request ID:", "ar": " رقم الطلب" }, + "RRT-orders-log": { + "en": "Orders Log", + "ar": "سجل الطلبات" + }, + "blood-sugar": { + "en": "Blood Sugar", + "ar": "سكر الدم" + }, "covid19_driveThrueTest": { "en": "'Covid-19- Drive-Thru Test'", @@ -1515,4 +1523,43 @@ const Map localizedValues = { "send-child-email-msg": {"en" : "Send the child's schedule to the email", "ar": "أرسل جدول الطفل إلى البريد الإلكتروني"}, "vaccination-add-child-msg": {"en" : "Add the child's information below to receive the schedule of vaccinations.", "ar": "أضف معلومات الطفل أدناه للحصول على جدول التطعيمات."}, "child_added_successfully": {"en" : "Child added successfully", "ar": "تمت إضافة الطفل بنجاح"}, + "my-tracker": { + "en": "My Tracker", + "ar": "قراءاتي" + }, + "weekly": { + "en": "Weekly", + "ar": "أسبوعي" + }, + "monthly": { + "en": "Monthly", + "ar": "شهري" + }, + "yearly": { + "en": "Yearly", + "ar": "سنوي" + }, + "measured": { + "en": "Measured", + "ar": "قياس" + }, + "sugar-add": { + "en": "Enter Blood Sugar Value", + "ar": "أدخل قيمة قراءة السكر" + }, + "other": { + "en": "Other", + "ar": "آخر" + }, + "measure-unit": { + "en": "Measure unit", + "ar": "وحدة القياس" + }, + "measure-time": { + "en": "Measure time", + "ar": "وقت القياس" + },"update": { + "en": "Update", + "ar": "تعديل" + }, }; diff --git a/lib/core/enum/Ambulate.dart b/lib/core/enum/Ambulate.dart index f8b2e8be..e4714cb2 100644 --- a/lib/core/enum/Ambulate.dart +++ b/lib/core/enum/Ambulate.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; enum Ambulate { Wheelchair, Walker, Stretcher, None } @@ -6,19 +7,19 @@ extension SelectedAmbulate on Ambulate { String getAmbulateTitle(BuildContext context) { switch (this) { case Ambulate.Wheelchair: - return 'Wheelchair'; + return TranslationBase.of(context).wheelchair; break; case Ambulate.Walker: - return 'Walker'; + return TranslationBase.of(context).walker; break; case Ambulate.Stretcher: - return 'Stretcher'; + return TranslationBase.of(context).stretcher; break; case Ambulate.None: - return 'None'; + return TranslationBase.of(context).none; break; } - return 'None'; + return TranslationBase.of(context).none; } int selectAmbulateNumber() { diff --git a/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart b/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart index 5b95409e..86263155 100644 --- a/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart +++ b/lib/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart @@ -17,7 +17,7 @@ class DiabtecPatientResult { int patientID; var remark; var resultDesc; - int resultValue; + dynamic resultValue; String unit; var weekAverageResult; String weekDesc; diff --git a/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart b/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart index c18e5433..3b1a8d9c 100644 --- a/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart +++ b/lib/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class WeekDiabtectResultAverage { - int dailyAverageResult; + dynamic dailyAverageResult; DateTime dateChart; WeekDiabtectResultAverage({this.dailyAverageResult, this.dateChart}); diff --git a/lib/core/service/medical/BloodSugarService.dart b/lib/core/service/medical/BloodSugarService.dart index 09fe9fe9..e0c5007c 100644 --- a/lib/core/service/medical/BloodSugarService.dart +++ b/lib/core/service/medical/BloodSugarService.dart @@ -69,25 +69,34 @@ class BloodSugarService extends BaseService { }, body: Map()); } - addDiabtecResult( - {String bloodSugerDateChart, - String bloodSugerResult, - String diabtecUnit, - int measuredTime}) async { + addDiabtecResult({String bloodSugerDateChart, String bloodSugerResult, String diabtecUnit, int measuredTime}) async { hasError = false; super.error = ""; - Map body = Map(); body['BloodSugerDateChart'] = bloodSugerDateChart; body['BloodSugerResult'] = bloodSugerResult; body['DiabtecUnit'] = diabtecUnit; - body['MeasuredTime'] =2;// measuredTime; + body['MeasuredTime'] = measuredTime; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(ADD_BLOOD_PRESSURE_RESULT, - onSuccess: (response, statusCode) async { - var asd =""; - }, + onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + updateDiabtecResult({DateTime month,DateTime hour,String bloodSugerResult,String diabtecUnit, int measuredTime,int lineItemNo}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['BloodSugerResult'] = bloodSugerResult; + body['DiabtecUnit'] = diabtecUnit; + body['BloodSugerDateChart'] = '${month.year}-${month.month}-${month.day} ${hour.hour}:${hour.minute}:00'; + body['isDentalAllowedBackend'] = false; + body['MeasuredTime'] = measuredTime; + body['LineItemNo'] = lineItemNo; + await baseAppClient.post(UPDATE_DIABETIC_RESULT, + onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/medical/blood_sugar_view_model.dart b/lib/core/viewModels/medical/blood_sugar_view_model.dart index fb00f80e..29cc3249 100644 --- a/lib/core/viewModels/medical/blood_sugar_view_model.dart +++ b/lib/core/viewModels/medical/blood_sugar_view_model.dart @@ -45,7 +45,6 @@ class BloodSugarViewMode extends BaseViewModel { x: index, y: bloodSugarService .monthDiabtectResultAverageList[index].weekAverageResult)); - var asd=""; } bloodSugarService.yearDiabtecResultAverageList.forEach((element) { @@ -94,11 +93,7 @@ class BloodSugarViewMode extends BaseViewModel { ]; } - addDiabtecResult( - {String bloodSugerDateChart, - String bloodSugerResult, - String diabtecUnit, - int measuredTime}) async { + Future addDiabtecResult({String bloodSugerDateChart, String bloodSugerResult, String diabtecUnit, int measuredTime}) async { setState(ViewState.BusyLocal); await bloodSugarService.addDiabtecResult( bloodSugerDateChart: bloodSugerDateChart, @@ -113,7 +108,25 @@ class BloodSugarViewMode extends BaseViewModel { setState(ViewState.Idle); } } - + + Future updateDiabtecResult({DateTime month,DateTime hour,String bloodSugerResult,String diabtecUnit, int measuredTime,int lineItemNo}) async { + setState(ViewState.BusyLocal); + await bloodSugarService.updateDiabtecResult( + bloodSugerResult: bloodSugerResult , + diabtecUnit: diabtecUnit, + hour: hour, + measuredTime: measuredTime, + lineItemNo: lineItemNo, + month: month); + if (bloodSugarService.hasError) { + error = bloodSugarService.error; + setState(ViewState.Error); + } else { + await getBloodSugar(); + setState(ViewState.Idle); + } + } + } diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index fe245133..1d4e78ee 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -107,7 +107,7 @@ class _AmbulanceReqState extends State Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: Texts("Orders Log"), + child: Texts(TranslationBase.of(context).ordersLog), ), ), ], diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index c07adabc..1fb47cec 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -46,7 +46,7 @@ class _AmbulanceRequestIndexPageState extends State { @override Widget build(BuildContext context) { return AppScaffold( - body: false + body: widget.amRequestViewModel.pickUpRequestPresOrder != null ? Column( children: [ SizedBox( diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart index aeb61609..051f672e 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -45,306 +46,309 @@ class _BillAmountState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).billAmount), - SizedBox( - height: 10, - ), - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 1.0, color: Colors.grey[300]), - outside: BorderSide(width: 1.0, color: Colors.grey[300])), - children: [ - TableRow( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + return AppScaffold( + isShowDecPage: false, + isShowAppBar: false, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).billAmount), + SizedBox( + height: 10, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 1.0, color: Colors.grey[300]), + outside: BorderSide(width: 1.0, color: Colors.grey[300])), + children: [ + TableRow( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), + ), ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareB, - textAlign: TextAlign.start, - color: Colors.black, - fontSize: 15, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).patientShareB, + textAlign: TextAlign.start, + color: Colors.black, + fontSize: 15, + ), ), ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(10.0), + ), ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.price}', - color: Colors.black, - textAlign: TextAlign.start, - fontSize: 15, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.price}', + color: Colors.black, + textAlign: TextAlign.start, + fontSize: 15, + ), ), ), - ), - ], - ), - TableRow( - children: [ - Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 0.09, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareTax, - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.vAT}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, + ], + ), + TableRow( + children: [ + Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.09, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).patientShareTax, + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), ), ), - ), - ], - ), - TableRow( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( + Container( + height: MediaQuery.of(context).size.height * 0.09, color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(10.0), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.vAT}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), ), ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareTotal, - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - bold: true, + ], + ), + TableRow( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.0), + ), ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10.0), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).patientShareTotal, + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + bold: true, + ), ), ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.totalPrice}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, + Container( + height: MediaQuery.of(context).size.height * 0.09, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10.0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.totalPrice}', + color: Colors.black, + fontSize: 15, + textAlign: TextAlign.start, + ), ), ), - ), - ], - ), - ], - ), - SizedBox( - height: 10, - ), - Texts(TranslationBase.of(context).selectAmbulate,bold: true,), - SizedBox(height: 5,), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Wheelchair; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).wheelchair), - leading: Radio( - value: Ambulate.Wheelchair, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Texts(TranslationBase.of(context).selectAmbulate,bold: true,), + SizedBox(height: 5,), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Wheelchair; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).wheelchair), + leading: Radio( + value: Ambulate.Wheelchair, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Walker; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).walker), - leading: Radio( - value: Ambulate.Walker, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Walker; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).walker), + leading: Radio( + value: Ambulate.Walker, + groupValue: _ambulate, + + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - ], - ), - SizedBox(height: 5,), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Stretcher; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).stretcher), - leading: Radio( - value: Ambulate.Stretcher, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + ], + ), + SizedBox(height: 5,), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Stretcher; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).stretcher), + leading: Radio( + value: Ambulate.Stretcher, + groupValue: _ambulate, + + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.None; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).none), - leading: Radio( - value: Ambulate.None, - groupValue: _ambulate, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.None; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Text(TranslationBase.of(context).none), + leading: Radio( + value: Ambulate.None, + groupValue: _ambulate, + + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), ), ), ), ), - ), - ], - ), - SizedBox(height: 12,), - NewTextFields( - hintText: TranslationBase.of(context).notes, - initialValue: note, - onChanged: (value){ - setState(() { - note = value; - }); - }, - ), - - SizedBox( - height: 15, - ), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { + ], + ), + SizedBox(height: 12,), + NewTextFields( + hintText: TranslationBase.of(context).notes, + initialValue: note, + onChanged: (value){ setState(() { - widget.patientER.ambulate = _ambulate; - widget.patientER.requesterNote = note; - widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); - widget.changeCurrentTab(3); + note = value; }); }, - label: TranslationBase.of(context).next, ), - ) - ], + + SizedBox( + height: 15, + ), + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.ambulate = _ambulate; + widget.patientER.requesterNote = note; + widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); + widget.changeCurrentTab(3); + }); + }, + label: TranslationBase.of(context).next, ), ), ); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index f6ebfde9..1ea0f7f5 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -5,23 +5,20 @@ import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.da import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/Blood/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart'; -import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -import '../AmbulanceReq.dart'; import '../AvailableAppointmentsPage.dart'; enum HaveAppointment { YES, NO } @@ -68,370 +65,397 @@ class _PickupLocationState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (widget.patientER.direction == 1) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).pickupLocation), - SizedBox( - height: 15, - ), - InkWell( - onTap: (){ - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, - onPick: (value) { + return AppScaffold( + isShowAppBar: false, + isShowDecPage: false, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.patientER.direction == 1) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).pickupLocation), + SizedBox( + height: 15, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), + ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getSelectFromMapName(context))), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).pickupSpot), + SizedBox( + height: 5, + ), + InkWell( + onTap: () { + setState(() { + _isInsideHome = !_isInsideHome; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).insideHome), + leading: Checkbox( + value: _isInsideHome, + onChanged: (value) { setState(() { - _result = value; + _isInsideHome = value; }); }, ), ), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getSelectFromMapName(context)), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) - ], ), ), - ), - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).pickupSpot), - SizedBox( - height: 5, - ), - InkWell( - onTap: () { - setState(() { - _isInsideHome = !_isInsideHome; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Texts(TranslationBase.of(context).insideHome), - leading: Checkbox( - activeColor: Colors.red[800], - value: _isInsideHome, - onChanged: (value) { - setState(() { - _isInsideHome = value; - }); - }, - ), - ), + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).haveAppo), + SizedBox( + height: 5, ), - ), - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).haveAppo), - SizedBox( - height: 5, - ), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - if (myAppointment == null) { - getAppointment(); + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = HaveAppointment.YES; + }); + } + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).yes), + leading: Radio( + value: HaveAppointment.YES, + groupValue: _haveAppointment, + onChanged: (value) { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = value; + }); + } + }, + ), + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { setState(() { - _haveAppointment = HaveAppointment.YES; + _haveAppointment = HaveAppointment.NO; + myAppointment = null; }); - } - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Texts(TranslationBase.of(context).yes), - leading: Radio( - value: HaveAppointment.YES, - groupValue: _haveAppointment, - activeColor: Colors.red[800], - onChanged: (value) { - if (myAppointment == null) { - getAppointment(); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).no), + leading: Radio( + value: HaveAppointment.NO, + groupValue: _haveAppointment, + onChanged: (value) { setState(() { _haveAppointment = value; + myAppointment = null; }); - } - }, + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _haveAppointment = HaveAppointment.NO; - myAppointment = null; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Texts(TranslationBase.of(context).no), - leading: Radio( - value: HaveAppointment.NO, - groupValue: _haveAppointment, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _haveAppointment = value; - myAppointment = null; - }); - }, - ), - ), - ), - ), - ), - ], - ), - if (myAppointment != null) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - AppointmentCard( - appointment: myAppointment, - ) ], ), - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).dropoffLocation), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectHospitalDialog( - widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + if (myAppointment != null) + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(getHospitalName(TranslationBase.of(context).pickupLocation)), - Icon( - Icons.arrow_drop_down, - size: 24, - color: Colors.black, + SizedBox( + height: 12, + ), + AppointmentCard( + appointment: myAppointment, ) ], ), + SizedBox( + height: 12, ), - ), - ], - ), - if (widget.patientER.direction == 0) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).pickupLocation), - SizedBox( - height: 15, - ), - InkWell( - onTap: () { - confirmSelectHospitalDialog( - widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Texts(TranslationBase.of(context).dropoffLocation), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectHospitalDialog( + widget.amRequestViewModel.hospitals); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName( + TranslationBase.of(context).pickupLocation)), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getHospitalName(TranslationBase.of(context).pickupLocation)), - Icon( - Icons.arrow_drop_down, - size: 24, - color: Colors.black, - ) - ], + ), + ], + ), + if (widget.patientER.direction == 0) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).pickupLocation), + SizedBox( + height: 15, + ), + InkWell( + onTap: () { + confirmSelectHospitalDialog( + widget.amRequestViewModel.hospitals); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName( + TranslationBase.of(context).pickupLocation)), + Icon( + Icons.arrow_drop_down, + size: 24, + color: Colors.black, + ) + ], + ), ), ), - ), - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).dropoffLocation), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, - onPick: (value) { - setState(() { - _result = value; - }); - }, + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).dropoffLocation), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getSelectFromMapName(context))), + Icon( + FontAwesomeIcons.mapMarkerAlt, + size: 24, + color: Colors.black, + ) + ], ), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getSelectFromMapName(context)), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) - ], ), ), - ), - ], + ], + ), + SizedBox( + height: 45, ), - SizedBox( - height: 45, - ), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - if (_result == null || _selectedHospital == null) - AppToast.showErrorToast( - message: TranslationBase.of(context).selectAll); - else - setState(() { - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; - if (widget.patientER.direction == 0) { - widget.patientER.pickupLocationLattitude = _result.geometry.location.lat.toString(); - widget.patientER.pickupLocationLongitude = _result.geometry.location.lng.toString(); - widget.patientER.dropoffLocationLattitude = _selectedHospital.latitude; - widget.patientER.dropoffLocationLongitude = _selectedHospital.longitude; - } else { - widget.patientER.pickupLocationLattitude = _selectedHospital.latitude; - widget.patientER.pickupLocationLongitude = _selectedHospital.longitude; - widget.patientER.dropoffLocationLattitude = _result.geometry.location.lat.toString(); - widget.patientER.dropoffLocationLongitude = _result.geometry.location.lng.toString(); - } + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + if (_result == null || _selectedHospital == null) + AppToast.showErrorToast( + message: TranslationBase.of(context).selectAll); + else + setState(() { + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + if (widget.patientER.direction == 0) { + widget.patientER.pickupLocationLattitude = + _result.geometry.location.lat.toString(); + widget.patientER.pickupLocationLongitude = + _result.geometry.location.lng.toString(); + widget.patientER.dropoffLocationLattitude = + _selectedHospital.latitude; + widget.patientER.dropoffLocationLongitude = + _selectedHospital.longitude; + } else { + widget.patientER.pickupLocationLattitude = + _selectedHospital.latitude; + widget.patientER.pickupLocationLongitude = + _selectedHospital.longitude; + widget.patientER.dropoffLocationLattitude = + _result.geometry.location.lat.toString(); + widget.patientER.dropoffLocationLongitude = + _result.geometry.location.lng.toString(); + } - widget.patientER.latitude = widget.patientER.pickupLocationLattitude; - widget.patientER.longitude = widget.patientER.pickupLocationLongitude; - widget.patientER.dropoffLocationName = _selectedHospital.name; - widget.patientER.createdBy = widget.amRequestViewModel.user.patientID; - widget.patientER.isOutPatient = widget.amRequestViewModel.user.outSA; - widget.patientER.patientIdentificationID = widget.amRequestViewModel.user.patientIdentificationNo; - widget.patientER.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now()); - widget.patientER.pickupLocationName = _result.formattedAddress; - widget.patientER.projectID = widget.amRequestViewModel.user.projectID; - widget.patientER.requesterFileNo = widget.amRequestViewModel.user.patientID; - widget.patientER.requesterIsOutSA = false; - widget.patientER.lineItemNo =0; - widget.patientER.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber; + widget.patientER.latitude = + widget.patientER.pickupLocationLattitude; + widget.patientER.longitude = + widget.patientER.pickupLocationLongitude; + widget.patientER.dropoffLocationName = + _selectedHospital.name; + widget.patientER.createdBy = + widget.amRequestViewModel.user.patientID; + widget.patientER.isOutPatient = + widget.amRequestViewModel.user.outSA; + widget.patientER.patientIdentificationID = widget + .amRequestViewModel.user.patientIdentificationNo; + widget.patientER.pickupDateTime = + DateUtil.convertDateToStringLocation(DateTime.now()); + widget.patientER.pickupLocationName = + _result.formattedAddress; + widget.patientER.projectID = + widget.amRequestViewModel.user.projectID; + widget.patientER.requesterFileNo = + widget.amRequestViewModel.user.patientID; + widget.patientER.requesterIsOutSA = false; + widget.patientER.lineItemNo = 0; + widget.patientER.requesterMobileNo = + widget.amRequestViewModel.user.mobileNumber; - if (_haveAppointment == HaveAppointment.YES) { - widget.patientER.appointmentNo = myAppointment.appointmentNo.toString(); - widget.patientER.appointmentClinicName = myAppointment.clinicName; - widget.patientER.appointmentDoctorName = myAppointment.doctorNameObj; - widget.patientER.appointmentBranch = myAppointment.projectName; - widget.patientER.appointmentTime = myAppointment.appointmentDate; - widget.patientER.haveAppointment = true; - } else { - widget.patientER.appointmentNo = "0"; - widget.patientER.appointmentClinicName = null; - widget.patientER.appointmentDoctorName = null; - widget.patientER.appointmentBranch = null; - widget.patientER.appointmentTime = null; - widget.patientER.haveAppointment = false; - } + if (_haveAppointment == HaveAppointment.YES) { + widget.patientER.appointmentNo = + myAppointment.appointmentNo.toString(); + widget.patientER.appointmentClinicName = + myAppointment.clinicName; + widget.patientER.appointmentDoctorName = + myAppointment.doctorNameObj; + widget.patientER.appointmentBranch = + myAppointment.projectName; + widget.patientER.appointmentTime = + myAppointment.appointmentDate; + widget.patientER.haveAppointment = true; + } else { + widget.patientER.appointmentNo = "0"; + widget.patientER.appointmentClinicName = null; + widget.patientER.appointmentDoctorName = null; + widget.patientER.appointmentBranch = null; + widget.patientER.appointmentTime = null; + widget.patientER.haveAppointment = false; + } - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; - widget.changeCurrentTab(2); - }); - }, - label: TranslationBase.of(context).next, - ), - ) - ], + widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + widget.changeCurrentTab(2); + }); + }, + label: TranslationBase.of(context).next, ), ), ); @@ -457,11 +481,13 @@ class _PickupLocationState extends State { } String getSelectFromMapName(context) { - return _result != null ? _result.formattedAddress : TranslationBase.of(context).selectMap; + return _result != null + ? _result.formattedAddress + : TranslationBase.of(context).selectMap; } getAppointment() { - ProgressDialogUtil.showProgressDialog(context); + GifLoaderDialogUtils.showMyDialog(context); widget.amRequestViewModel.getAppointmentHistory().then((value) { if (widget.amRequestViewModel.state == ViewState.Error || widget.amRequestViewModel.state == ViewState.ErrorLocal) { @@ -469,7 +495,7 @@ class _PickupLocationState extends State { } else if (widget .amRequestViewModel.appoitmentAllHistoryResultList.length > 0) { - ProgressDialogUtil.hideProgressDialog(context); + GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, MaterialPageRoute( @@ -491,14 +517,15 @@ class _PickupLocationState extends State { } }); } else { - ProgressDialogUtil.hideProgressDialog(context); + GifLoaderDialogUtils.hideDialog(context); setState(() { _haveAppointment = HaveAppointment.NO; }); - AppToast.showErrorToast(message: TranslationBase.of(context).noAppointment); + AppToast.showErrorToast( + message: TranslationBase.of(context).noAppointment); } }).catchError((e) { - ProgressDialogUtil.hideProgressDialog(context); + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: e); }); } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index 69669ed3..0770448e 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -1,15 +1,15 @@ import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; -import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; -import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; -import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; enum Direction { ToHospital, FromHospital } enum Way { OneWay, TwoWays } @@ -58,251 +58,267 @@ class _SelectTransportationMethodState @override Widget build(BuildContext context) { - return SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).transportHeading), - ...List.generate( - widget.amRequestViewModel.amRequestModeList.length, - (index) => InkWell( - onTap: () { - setState(() { - _erTransportationMethod = - widget.amRequestViewModel.amRequestModeList[index]; - }); - }, - child: Container( - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - children: [ - Expanded( - flex: 3, - child: ListTile( - title: Text(widget.amRequestViewModel - .amRequestModeList[index].title), - leading: Radio( - value: widget - .amRequestViewModel.amRequestModeList[index], - groupValue: _erTransportationMethod, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _erTransportationMethod = value; - }); - }, + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: false, + isShowDecPage: false, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).transportHeading), + ...List.generate( + widget.amRequestViewModel.amRequestModeList.length, + (index) => InkWell( + onTap: () { + setState(() { + _erTransportationMethod = + widget.amRequestViewModel.amRequestModeList[index]; + }); + }, + child: Container( + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: Row( + children: [ + Expanded( + flex: 3, + child: ListTile( + title: Texts(projectViewModel.isArabic + ? widget.amRequestViewModel + .amRequestModeList[index].titleAR + : widget.amRequestViewModel + .amRequestModeList[index].title), + leading: Radio( + value: widget + .amRequestViewModel.amRequestModeList[index], + groupValue: _erTransportationMethod, + onChanged: (value) { + setState(() { + _erTransportationMethod = value; + }); + }, + ), ), ), - ), - Expanded( - flex: 1, - child: Texts( - TranslationBase.of(context).sar+' ${widget.amRequestViewModel.amRequestModeList[index].price}'), - ) - ], + Expanded( + flex: 1, + child: Texts(TranslationBase.of(context).sar + + ' ${widget.amRequestViewModel.amRequestModeList[index].price}'), + ) + ], + ), ), ), ), - ), - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).directionHeading), - SizedBox( - height: 5, - ), - Container( - width: double.maxFinite, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _direction = Direction.ToHospital; - }); - }, - child: Container( - width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).toHospital), - leading: Radio( - value: Direction.ToHospital, - groupValue: _direction, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).directionHeading), + SizedBox( + height: 5, + ), + Container( + width: double.maxFinite, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.ToHospital; + }); + }, + child: Container( + width: double.maxFinite, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: Texts(TranslationBase.of(context).toHospital), + leading: Radio( + value: Direction.ToHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _direction = Direction.FromHospital; - }); - }, - child: Container( - width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).fromHospital), - leading: Radio( - value: Direction.FromHospital, - groupValue: _direction, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _direction = Direction.FromHospital; + }); + }, + child: Container( + width: double.maxFinite, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: + Texts(TranslationBase.of(context).fromHospital), + leading: Radio( + value: Direction.FromHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), ), ), ), ), - ), - ], + ], + ), ), - ), - if (_direction == Direction.ToHospital) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - Texts(TranslationBase.of(context).directionHeading), - SizedBox( - height: 5, - ), - Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _way = Way.OneWay; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).oneDirec), - leading: Radio( - value: Way.OneWay, - groupValue: _way, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _way = value; - }); - }, + if (_direction == Direction.ToHospital) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + Texts(TranslationBase.of(context).directionHeading), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.OneWay; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: + Texts(TranslationBase.of(context).oneDirec), + leading: Radio( + value: Way.OneWay, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), ), ), ), ), - ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _way = Way.TwoWays; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).twoDirec), - leading: Radio( - value: Way.TwoWays, - groupValue: _way, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - _way = value; - }); - }, + Expanded( + child: InkWell( + onTap: () { + setState(() { + _way = Way.TwoWays; + }); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: + Border.all(color: Colors.grey, width: 0.5), + color: Colors.white, + ), + child: ListTile( + title: + Texts(TranslationBase.of(context).twoDirec), + leading: Radio( + value: Way.TwoWays, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), ), ), ), ), - ), - ], - ), - ], - ), - SizedBox( - height: 15, - ), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.patientER.transportationMethodId =(widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); - widget.patientER.direction = _direction == Direction.ToHospital ? 1 : 0; - widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; - widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); - widget.patientER.patientERTransportationMethod = _erTransportationMethod; - widget.patientER.orderServiceID = _orderService.getIdOrderService(); - widget.patientER.pickupUrgency = 1; - widget.patientER.lineItemNo = 1; - widget.patientER.cost = _erTransportationMethod.price; - widget.patientER.vAT = _erTransportationMethod.vAT ?? 0; - widget.patientER.totalPrice = _erTransportationMethod.totalPrice; - widget.changeCurrentTab(1); - }); - }, - label: TranslationBase.of(context).next, + ], + ), + ], + ), + SizedBox( + height: 15, ), - ) - ], + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child: SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientER.transportationMethodId = (widget + .amRequestViewModel.amRequestModeList + .indexOf(_erTransportationMethod) + + 1); + widget.patientER.direction = + _direction == Direction.ToHospital ? 1 : 0; + widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; + widget.patientER.selectedAmbulate = (widget + .amRequestViewModel.amRequestModeList + .indexOf(_erTransportationMethod) + + 1); + widget.patientER.patientERTransportationMethod = + _erTransportationMethod; + widget.patientER.orderServiceID = + _orderService.getIdOrderService(); + widget.patientER.pickupUrgency = 1; + widget.patientER.lineItemNo = 1; + widget.patientER.cost = _erTransportationMethod.price; + widget.patientER.vAT = _erTransportationMethod.vAT ?? 0; + widget.patientER.totalPrice = + _erTransportationMethod.totalPrice; + widget.changeCurrentTab(1); + }); + }, + label: TranslationBase.of(context).next, ), ), ); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart index 8fd72b8f..6140dc62 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.da import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; @@ -18,89 +19,93 @@ class Summary extends StatefulWidget { _SummaryState createState() => _SummaryState(); } -//TODO it should be dynamic class _SummaryState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).RRTSummary), - SizedBox(height: 5,), - Container( - width: double.infinity, - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).transportMethod,color: Colors.grey,), - Texts('${widget.patientER.patientERTransportationMethod.title}',bold: true,), - SizedBox(height: 8,), + return AppScaffold( + isShowDecPage: false, + isShowAppBar: false, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).RRTSummary), + SizedBox(height: 5,), + Container( + width: double.infinity, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).transportMethod,color: Colors.grey,), + Texts('${widget.patientER.patientERTransportationMethod.title}',bold: true,), + SizedBox(height: 8,), - Texts(TranslationBase.of(context).directions,color: Colors.grey,), - Texts('From Hospital',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).directions,color: Colors.grey,), + Texts(widget.patientER.direction ==0? TranslationBase.of(context).toHospital:TranslationBase.of(context).fromHospital,bold: true,), + SizedBox(height: 8,), - Texts('Pickup Location',color: Colors.grey,), - Texts('SZR Medical Center',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).pickupLocation,color: Colors.grey,), + Texts('${widget.patientER.pickupLocationName}',bold: true,), + SizedBox(height: 8,), - Texts('Drop off location',color: Colors.grey,), - Texts('6199, Al Ameen wlfn nif',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).dropoffLocation,color: Colors.grey,), + Texts('${widget.patientER.dropoffLocationName}',bold: true,), + SizedBox(height: 8,), - Texts('Select Ambulate',color: Colors.grey,), - Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), - SizedBox(height: 8,), + Texts(TranslationBase.of(context).selectAmbulate,color: Colors.grey,), + Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), + SizedBox(height: 8,), - Texts('Note',color: Colors.grey,), - Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), - SizedBox(height: 8,), - ], - ), - ), - SizedBox(height: 20,), - Texts('Bill Amount',textAlign: TextAlign.start,), - SizedBox(height: 5,), - Container( - height: 55, - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8) + Texts(TranslationBase.of(context).notes,color: Colors.grey,), + Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), + SizedBox(height: 8,), + ], + ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Total amount payable:'), - Texts('SR ${widget.patientER.patientERTransportationMethod.totalPrice}') - ], + SizedBox(height: 20,), + Texts(TranslationBase.of(context).billAmount,textAlign: TextAlign.start,), + SizedBox(height: 5,), + Container( + height: 55, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).patientShareTotal+':'), + Texts(TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.totalPrice}') + ], + ), ), - ), - SizedBox(height: 45,), - Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 76, - child:SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - label: TranslationBase.of(context).send, - onTap: () async { - await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER); + SizedBox(height: 45,), - } - ), - ) - ], + ], + ), + ), + ), + bottomSheet: Container( + padding: EdgeInsets.all(15), + width: double.maxFinite, + height: 90, + child:SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + label: TranslationBase.of(context).send, + onTap: () async { + await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER); + + } ), ), ); diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 6929cd0b..7d2a4a5b 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -30,28 +30,28 @@ class OrderLogPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ OrderLogItem( - title: 'Request ID', + title: TranslationBase.of(context).reqId, value: amRequestViewModel.patientAllPresOrdersList[index].iD .toString(), ), OrderLogItem( - title: 'Status', + title: TranslationBase.of(context).orderStatus, value: amRequestViewModel .patientAllPresOrdersList[index].description, ), OrderLogItem( - title: 'Pickup Date', + title: TranslationBase.of(context).pickupDate, value: DateUtil.getDayMonthYearDateFormatted( DateUtil.convertStringToDate(amRequestViewModel .patientAllPresOrdersList[index].createdOn)), ), OrderLogItem( - title: 'Pickup Location', + title: TranslationBase.of(context).pickupLocation, value: amRequestViewModel .patientAllPresOrdersList[index].pickupLocationName, ), OrderLogItem( - title: 'Drop off Location', + title: TranslationBase.of(context).dropoffLocation, value: amRequestViewModel .patientAllPresOrdersList[index].dropoffLocationName, ), diff --git a/lib/pages/ErService/widgets/StepsWidget.dart b/lib/pages/ErService/widgets/StepsWidget.dart index c5864710..56b3de6b 100644 --- a/lib/pages/ErService/widgets/StepsWidget.dart +++ b/lib/pages/ErService/widgets/StepsWidget.dart @@ -13,7 +13,8 @@ class StepsWidget extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return projectViewModel.isArabic? Stack( + return projectViewModel.isArabic? + Stack( children: [ Container( height: 50, @@ -29,7 +30,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: 0, + right: 0, child: InkWell( onTap: () => changeCurrentTab(0), child: Container( @@ -51,7 +52,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: MediaQuery.of(context).size.width * 0.3, + right: MediaQuery.of(context).size.width * 0.3, child: InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Container( @@ -73,7 +74,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: MediaQuery.of(context).size.width * 0.6, + right: MediaQuery.of(context).size.width * 0.6, child: InkWell( onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Container( @@ -95,7 +96,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: 0, + left: 0, child: InkWell( onTap: () => index == 2 ?changeCurrentTab(3):null, child: Container( @@ -117,7 +118,8 @@ class StepsWidget extends StatelessWidget { ), ), ], - ):Stack( + ): + Stack( children: [ Container( height: 50, @@ -133,7 +135,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: 0, + left: 0, child: InkWell( onTap: () => changeCurrentTab(0), child: Container( @@ -155,7 +157,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: MediaQuery.of(context).size.width * 0.3, + left: MediaQuery.of(context).size.width * 0.3, child: InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Container( @@ -177,7 +179,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - right: MediaQuery.of(context).size.width * 0.6, + left: MediaQuery.of(context).size.width * 0.6, child: InkWell( onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Container( @@ -199,7 +201,7 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: 10, - left: 0, + right: 0, child: InkWell( onTap: () => index == 2 ?changeCurrentTab(3):null, child: Container( diff --git a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart index 00f06a25..f39479ac 100644 --- a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart @@ -3,18 +3,37 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_mo import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:feather_icons_flutter/feather_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:provider/provider.dart'; class AddBloodSugarPage extends StatefulWidget { + final DateTime bloodSugarDate; + final String measureUnitSelectedType; + final bool isUpdate; + final String measuredTime; + final String bloodSugarValue; + final int lineItemNo; + final BloodSugarViewMode bloodSugarViewMode; + + AddBloodSugarPage( + {Key key, + this.bloodSugarDate, + this.measureUnitSelectedType, + this.isUpdate = false, + this.measuredTime, + this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode}) + : super(key: key); + @override _AddBloodSugarPageState createState() => _AddBloodSugarPageState(); } @@ -24,7 +43,7 @@ class _AddBloodSugarPageState extends State { DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); String measureUnitSelectedType = 'mg/dlt'; - int measuredTime=1; + int measuredTime = 1; final List measureUnitList = ['mg/dlt', 'mol/L']; final List measureTimeEnList = [ 'Before Breakfast', @@ -39,270 +58,229 @@ class _AddBloodSugarPageState extends State { 'Other', ]; final List measureTimeArList = [ - 'Before Breakfast', - 'After Breakfast', - 'Before Lunch', - 'After Lunch', - 'Before Dinner', - 'After Dinner', - 'Before Sleep', - 'After Sleep', - 'Fasting', - 'Other', + "قبل الإفطار", + "بعد الإفطار", + "بعد الغداء", + "بعد الغداء", + "قبل العشاء", + "بعد العشاء", + "قبل النوم", + "بعد النوم", + "صائم", + "آخر", ]; String measureTimeSelectedType; + @override + void initState() { + super.initState(); + if (widget.isUpdate) { + bloodSugarDate = widget.bloodSugarDate; + timeSugarDate = widget.bloodSugarDate; + measureUnitSelectedType = widget.measureUnitSelectedType; + if (measureTimeEnList.contains(widget.measuredTime)) + measuredTime = measureTimeEnList.indexOf(widget.measuredTime); + else if (measureTimeArList.contains(widget.measuredTime)) + measuredTime = measureTimeArList.indexOf(widget.measuredTime); + _bloodSugarValueController.text = widget.bloodSugarValue; + } + } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - showTaskOptions() { - showModalBottomSheet( - backgroundColor: Colors.white, - context: context, - builder: (BuildContext bc) { - return Container( - padding: EdgeInsets.symmetric(vertical: 12.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0))), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(3.0)), - width: 40.0, - height: 6.0, - ), - InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 18.0), - child: Row( - children: [ - Icon( - FeatherIcons.share, - color: Theme - .of(context) - .primaryColor, - size: 18.0, - ), - SizedBox(width: 24.0), - Texts('Share Task', - variant: "body2Link", color: Colors.grey[800]), - ], - ), - ), - ), - InkWell( - onTap: () { - Navigator.pop(context); - // Navigator.of(context).push(SlideUpPageRoute(widget: PostTaskIndex(task: new Task(category: task?.category, description: task?.description, title: task?.title)))); - }, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 18.0), - child: Row( - children: [ - Icon( - FeatherIcons.copy, - color: Theme - .of(context) - .primaryColor, - size: 18.0, - ), - SizedBox(width: 24.0), - Texts('Post Similar Task', - variant: "body2Link", color: Colors.grey[800]), - ], - ), - ), + return AppScaffold( + isShowAppBar: true, + appBarTitle: widget.isUpdate + ? TranslationBase.of(context).update + : TranslationBase.of(context).add, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + SizedBox( + height: 15, + ), + NewTextFields( + hintText: TranslationBase.of(context).sugarAdd, + controller: _bloodSugarValueController, + keyboardType: TextInputType.number, + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureUnitDialog(); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureUnitSelectedType), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], ), - ], + ), ), - ); - }); - } - - return BaseView( - builder: (_, model, w) => - AppScaffold( - isShowAppBar: true, - appBarTitle: 'Add', - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: 'Enter Blood Sugar Value', - controller: _bloodSugarValueController, - keyboardType: TextInputType.number, - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureUnitDialog(); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureUnitSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], - ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime - .now() - .year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - bloodSugarDate = date; - }); - }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Date'), - Texts(getDate()), - ], - ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker( - context, showTitleActions: true, - onConfirm: (date) { - print('confirm $date'); - setState(() { - timeSugarDate = date; - }); - }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), onConfirm: (date) { + setState(() { + bloodSugarDate = date; + }); }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts('Time'), Texts(getTime())], - ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureTimeEnList - : measureTimeArList); + currentTime: bloodSugarDate, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), + ), + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, + onConfirm: (date) { + setState(() { + timeSugarDate = date; + }); }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType ?? 'Others'), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], - ), - ), - ), - ], + currentTime: timeSugarDate, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).time), + Texts(getTime()) + ], + ), ), ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery - .of(context) - .size - .width * 0.2, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: SecondaryButton( - loading: model.state == ViewState.BusyLocal, - label: 'SAVE', textColor: Colors.white, onTap: () { - if (_bloodSugarValueController.text.isNotEmpty) { - model.addDiabtecResult(diabtecUnit: measureUnitSelectedType, - measuredTime: measuredTime, - bloodSugerResult:_bloodSugarValueController.text.toString(), - bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - - ); - } - }), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic + ? measureTimeArList + : measureTimeEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? + TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), + ), ), - ), + ], ), + ), + ), + bottomSheet: Container( + color: Colors.transparent, + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.2, + child: Padding( + padding: const EdgeInsets.all(15.0), + child: SecondaryButton( + label: TranslationBase.of(context).save, + textColor: Colors.white, + onTap: () { + if (_bloodSugarValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + if (widget.isUpdate) + widget.bloodSugarViewMode.updateDiabtecResult( + month: bloodSugarDate, + hour: timeSugarDate, + diabtecUnit: measureUnitSelectedType, + measuredTime: measuredTime, + lineItemNo: widget.lineItemNo, + bloodSugerResult: + _bloodSugarValueController.text.toString()).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if(widget.bloodSugarViewMode.state == ViewState.Error) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + + }); + else + widget.bloodSugarViewMode.addDiabtecResult( + diabtecUnit: measureUnitSelectedType, + measuredTime: measuredTime, + bloodSugerResult: + _bloodSugarValueController.text.toString(), + bloodSugerDateChart: + '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + ).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if(widget.bloodSugarViewMode.state == ViewState.Error) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + }); + } + }), + ), + ), ); } String getDate() { - return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate - .day}, ${bloodSugarDate.year}"; + return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}"; } String getTime() { @@ -314,7 +292,7 @@ class _AddBloodSugarPageState extends State { context: context, child: RadioStringDialog( radioList: measureUnitList, - title: 'Measure unit', + title: TranslationBase.of(context).measureUnit, selectedValue: measureUnitSelectedType, onValueSelected: (value) { setState(() { @@ -330,7 +308,7 @@ class _AddBloodSugarPageState extends State { context: context, child: RadioStringDialog( radioList: list, - title: 'Measure time', + title: TranslationBase.of(context).measureTime, selectedValue: measureTimeSelectedType, onValueSelected: (value) { setState(() { diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index fdd7b348..fa49382f 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -1,13 +1,16 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class BloodMonthlyPage extends StatelessWidget { final List> data; @@ -17,6 +20,7 @@ class BloodMonthlyPage extends StatelessWidget { : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( body: ListView( children: [ @@ -34,7 +38,7 @@ class BloodMonthlyPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -46,7 +50,7 @@ class BloodMonthlyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context,projectViewModel), ), ], ), @@ -56,7 +60,7 @@ class BloodMonthlyPage extends StatelessWidget { ); } - List fullData() { + List fullData(BuildContext context,ProjectViewModel projectViewModel) { List tableRow = []; tableRow.add( TableRow( @@ -64,14 +68,15 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -82,11 +87,11 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -96,11 +101,11 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -110,20 +115,22 @@ class BloodMonthlyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), ), height: 40), ), + ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index 47f87847..69f00e61 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -1,12 +1,15 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class BloodYearPage extends StatelessWidget { final List> data; @@ -17,6 +20,7 @@ class BloodYearPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( body: ListView( children: [ @@ -34,7 +38,7 @@ class BloodYearPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -46,7 +50,7 @@ class BloodYearPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context,projectViewModel), ), ], ), @@ -56,7 +60,7 @@ class BloodYearPage extends StatelessWidget { ); } - List fullData() { + List fullData(BuildContext context,ProjectViewModel projectViewModel) { List tableRow = []; tableRow.add( TableRow( @@ -64,14 +68,15 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), + topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -82,11 +87,11 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -96,11 +101,11 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -110,20 +115,22 @@ class BloodYearPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0), + topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), ), height: 40), ), + ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart index 71df9a3a..70cdea0f 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart @@ -43,7 +43,7 @@ class _BloodSugarHomePageState extends State onModelReady: (model) => model.getBloodSugar(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Blood Sugar', + appBarTitle: TranslationBase.of(context).bloodSugar, baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, @@ -81,21 +81,21 @@ class _BloodSugarHomePageState extends State unselectedLabelColor: Colors.grey[800], tabs: [ Container( - width: MediaQuery.of(context).size.width * 0.27, + width: MediaQuery.of(context).size.width * 0.33, child: Center( - child: Texts('Weekly'), + child: Texts(TranslationBase.of(context).weekly), ), ), Container( - width: MediaQuery.of(context).size.width * 0.27, + width: MediaQuery.of(context).size.width * 0.33, child: Center( - child: Texts('Monthly'), + child: Texts(TranslationBase.of(context).monthlyT), ), ), Container( - width: MediaQuery.of(context).size.width * 0.27, + width: MediaQuery.of(context).size.width * 0.34, child: Center( - child: Texts('Yearly'), + child: Texts(TranslationBase.of(context).yearly), ), ), ], @@ -116,6 +116,7 @@ class _BloodSugarHomePageState extends State BloodSugarWeeklyPage( data: model.getBloodWeeklySeries(), diabtecPatientResult: model.weekDiabtecPatientResult, + bloodSugarViewMode: model, ), BloodMonthlyPage( data: model.getBloodMonthlyTimeSeriesSales(), @@ -132,13 +133,13 @@ class _BloodSugarHomePageState extends State ), floatingActionButton: InkWell( onTap: () { - Navigator.push(context, FadePage(page: AddBloodSugarPage())); + Navigator.push(context, FadePage(page: AddBloodSugarPage(bloodSugarViewMode: model,))); }, child: Container( width: 55, height: 55, decoration: BoxDecoration( - shape: BoxShape.circle, color: HexColor('515B5D')), + shape: BoxShape.circle, color:Theme.of(context).primaryColor), child: Center( child: Icon( Icons.add, diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart index 4b007929..139548e1 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart @@ -1,22 +1,31 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import 'AddBloodSugarPage.dart'; class BloodSugarWeeklyPage extends StatelessWidget { final List> data; final List diabtecPatientResult; + final BloodSugarViewMode bloodSugarViewMode; - const BloodSugarWeeklyPage({Key key, this.data, this.diabtecPatientResult}) + const BloodSugarWeeklyPage({Key key, this.data, this.diabtecPatientResult, this.bloodSugarViewMode}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( body: ListView( children: [ @@ -34,7 +43,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('Details'), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -46,7 +55,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), - children: fullData(), + children: fullData(context, projectViewModel,bloodSugarViewMode), ), ], ), @@ -56,7 +65,8 @@ class BloodSugarWeeklyPage extends StatelessWidget { ); } - List fullData() { + List fullData( + BuildContext context, ProjectViewModel projectViewModel, BloodSugarViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( @@ -64,14 +74,19 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), + topRight: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), ), ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -82,11 +97,11 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -96,11 +111,11 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Measured', + TranslationBase.of(context).measured, color: Colors.white, fontSize: 15, ), @@ -110,11 +125,11 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, ), child: Center( child: Texts( - 'Value', + TranslationBase.of(context).value, color: Colors.white, fontSize: 15, ), @@ -124,14 +139,19 @@ class BloodSugarWeeklyPage extends StatelessWidget { Container( child: Container( decoration: BoxDecoration( - color: HexColor('#515B5D'), + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), + topLeft: projectViewModel.isArabic + ? Radius.circular(10.0) + : Radius.circular(0.0), + topRight: projectViewModel.isArabic + ? Radius.circular(0.0) + : Radius.circular(10.0), ), ), child: Center( child: Texts( - 'Edit', + TranslationBase.of(context).edit, color: Colors.white, fontSize: 15, ), @@ -203,12 +223,30 @@ class BloodSugarWeeklyPage extends StatelessWidget { ), ), Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodSugarPage( + isUpdate: true, + bloodSugarDate: diabtec.dateChart, + measuredTime: diabtec.measuredDesc, + bloodSugarValue: diabtec.resultValue.toString(), + lineItemNo: diabtec.lineItemNo, + measureUnitSelectedType: diabtec.unit, + bloodSugarViewMode: bloodSugarViewMode, + ), + ), + ); + }, + child: Container( + height: 70, + padding: EdgeInsets.all(10), + color: Colors.white, + child: Center( + child: Icon(Icons.edit), + ), ), ), ), diff --git a/lib/pages/medical/my_trackers/my_trackers.dart b/lib/pages/medical/my_trackers/my_trackers.dart index ecdf5a53..5e5c4527 100644 --- a/lib/pages/medical/my_trackers/my_trackers.dart +++ b/lib/pages/medical/my_trackers/my_trackers.dart @@ -1,3 +1,5 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/cupertino.dart'; @@ -11,7 +13,7 @@ class MyTrackers extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: 'My Tracker', + appBarTitle: TranslationBase.of(context).myTracker, isShowAppBar: true, body: SingleChildScrollView( child: Container( @@ -41,7 +43,7 @@ class MyTrackers extends StatelessWidget { children: [ Image.asset('assets/tracker/blood-suger.png',width: 60.0,), SizedBox(height: 15,), - Text('Blood Sugar'), + Texts(TranslationBase.of(context).bloodSugar), ], ), ), @@ -65,7 +67,7 @@ class MyTrackers extends StatelessWidget { children: [ Image.asset('assets/tracker/blood-pressure.png',width: 60.0,), SizedBox(height: 15,), - Text('Blood Pressure'), + Texts(TranslationBase.of(context).bloodPressure), ], ), ), @@ -94,7 +96,7 @@ class MyTrackers extends StatelessWidget { children: [ Image.asset('assets/tracker/weight.png',width: 60.0,), SizedBox(height: 15,), - Text('Weight'), + Texts(TranslationBase.of(context).weight), ], ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index c4ac7190..db5457f7 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1253,6 +1253,18 @@ class TranslationBase { String get infoCMC => localizedValues['infoCMC'][locale.languageCode]; String get instructionAgree => localizedValues['instructionAgree'][locale.languageCode]; String get reqId => localizedValues['reqId'][locale.languageCode]; + String get ordersLog => localizedValues['RRT-orders-log'][locale.languageCode]; + String get bloodSugar => localizedValues['blood-sugar'][locale.languageCode]; + String get myTracker => localizedValues['my-tracker'][locale.languageCode]; + String get weekly => localizedValues['weekly'][locale.languageCode]; + String get monthlyT => localizedValues['monthly'][locale.languageCode]; + String get yearly => localizedValues['yearly'][locale.languageCode]; + String get measured => localizedValues['measured'][locale.languageCode]; + String get sugarAdd => localizedValues['sugar-add'][locale.languageCode]; + String get other => localizedValues['other'][locale.languageCode]; + String get measureUnit => localizedValues['measure-unit'][locale.languageCode]; + String get measureTime => localizedValues['measure-time'][locale.languageCode]; + String get update => localizedValues['update'][locale.languageCode]; String get covid19_driveThrueTest => localizedValues['covid19_driveThrueTest'][locale.languageCode]; String get eReferral => localizedValues['E-Referral'][locale.languageCode];