diff --git a/lib/config/config.dart b/lib/config/config.dart index be4ad2e2..8a77fd5e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -17,12 +17,12 @@ const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs -//const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; -//const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // Pharmacy Production URLs -const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; -const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; +// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; +// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 685339d2..65eb641a 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -833,6 +833,7 @@ const Map localizedValues = { "failedToAccessHmgServices": {"en": "Connected with HMG Network,\n\nBut failed to access HMG services", "ar": "Connected with HMG Network,\n\nBut failed to access HMG services"}, "offerAndPackages": {"en": "Offers And Packages", "ar": "العروض والباقات"}, "InvoiceNo": {"en": "Invoice No", "ar": "رقم الفاتورة"}, + "InvoiceDate": {"en": "Invoice Date", "ar": "تاريخ الفاتورة"}, "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, "GeneralResult": {"en": "General Result", "ar": "نتيجة عامة"}, "show-more-btn": {"en": "Flow Chart", "ar": "النتائج التراكمية"}, diff --git a/lib/core/service/ancillary_orders_service.dart b/lib/core/service/ancillary_orders_service.dart index b9d14a06..8d9d3b31 100644 --- a/lib/core/service/ancillary_orders_service.dart +++ b/lib/core/service/ancillary_orders_service.dart @@ -20,6 +20,8 @@ class AncillaryOrdersService extends BaseService { _ancillaryLists = []; response['AncillaryOrderList'].forEach((item) { ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + print("response of ancillary Lists__________"); + print(response); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -27,175 +29,25 @@ class AncillaryOrdersService extends BaseService { }, body: body); } - Future getOrdersDetails(appointmentNo, orderNo) async { + Future getOrdersDetails(appointmentNo, orderNo, projectID) async { Map body = Map(); - + body['AppointmentNo_Vida'] = appointmentNo; + body['OrderNo'] = orderNo; + body['ProjectID'] = projectID; +// "OrderNo=$orderNo&AppointmentNo_Vida=$appointmentNo&ProjectID=$projectID" hasError = false; - await baseAppClient.post(GET_ANCILLARY_ORDERS_DETAILS, onSuccess: (dynamic response, int statusCode) { - _ancillaryProcLists = []; - response['AncillaryOrderProcList'] = [ - { - "AncillaryOrderProcList": [ - { - "ApprovalLineItemNo": 0, - "ApprovalNo": 0, - "ApprovalStatus": "", - "ApprovalStatusID": 0, - "CompanyShare": 501.3, - "CompanyShareWithTax": 576.5, - "CompanyTaxAmount": 75.19, - "DiscountAmount": 55.7, - "DiscountCategory": 1, - "DiscountType": "P", - "DiscountTypeValue": 10, - "IsApprovalCreated": false, - "IsApprovalRequired": false, - "IsCovered": false, - "OrderDate": "/Date(1601758800000+0300)/", - "OrderLineItemNo": 1, - "OrderNo": 2020000001, - "PartnerID": 0, - "PartnerShare": 0, - "PartnerShareType": "P", - "PatientShare": 0, - "PatientShareWithTax": 0, - "PatientTaxAmount": 0, - "ProcPrice": 557, - "ProcedureCategoryID": 2, - "ProcedureCategoryName": "LABORATORY", - "ProcedureID": "02013001", - "ProcedureName": "11-DESOXYCORTISOL (COMPOUND S) - S.O", - "TaxAmount": 75.19, - "TaxPct": 15 - }, - { - "ApprovalLineItemNo": 0, - "ApprovalNo": 0, - "ApprovalStatus": "", - "ApprovalStatusID": 0, - "CompanyShare": 90, - "CompanyShareWithTax": 103.5, - "CompanyTaxAmount": 13.5, - "DiscountAmount": 10, - "DiscountCategory": 1, - "DiscountType": "P", - "DiscountTypeValue": 10, - "IsApprovalCreated": false, - "IsApprovalRequired": true, - "IsCovered": false, - "OrderDate": "/Date(1601758800000+0300)/", - "OrderLineItemNo": 4, - "OrderNo": 2020000001, - "PartnerID": 0, - "PartnerShare": 0, - "PartnerShareType": "P", - "PatientShare": 0, - "PatientShareWithTax": 0, - "PatientTaxAmount": 0, - "ProcPrice": 100, - "ProcedureCategoryID": 2, - "ProcedureCategoryName": "LABORATORY", - "ProcedureID": "02014011", - "ProcedureName": "CBC (COMPLETE BLOOD COUNT PROFILE)", - "TaxAmount": 13.5, - "TaxPct": 15 - }, - { - "ApprovalLineItemNo": 0, - "ApprovalNo": 0, - "ApprovalStatus": "", - "ApprovalStatusID": 0, - "CompanyShare": 347.76, - "CompanyShareWithTax": 399.92, - "CompanyTaxAmount": 52.16, - "DiscountAmount": 38.64, - "DiscountCategory": 1, - "DiscountType": "P", - "DiscountTypeValue": 10, - "IsApprovalCreated": false, - "IsApprovalRequired": false, - "IsCovered": false, - "OrderDate": "/Date(1601758800000+0300)/", - "OrderLineItemNo": 3, - "OrderNo": 2020000001, - "PartnerID": 0, - "PartnerShare": 0, - "PartnerShareType": "P", - "PatientShare": 0, - "PatientShareWithTax": 0, - "PatientTaxAmount": 0, - "ProcPrice": 386.4, - "ProcedureCategoryID": 2, - "ProcedureCategoryName": "LABORATORY", - "ProcedureID": "02019302", - "ProcedureName": "21-HYDROXYLASE ABS - S.O", - "TaxAmount": 52.16, - "TaxPct": 15 - }, - { - "ApprovalLineItemNo": 0, - "ApprovalNo": 0, - "ApprovalStatus": "", - "ApprovalStatusID": 0, - "CompanyShare": 1323, - "CompanyShareWithTax": 1521.45, - "CompanyTaxAmount": 198.45, - "DiscountAmount": 147, - "DiscountCategory": 1, - "DiscountType": "P", - "DiscountTypeValue": 10, - "IsApprovalCreated": false, - "IsApprovalRequired": true, - "IsCovered": false, - "OrderDate": "/Date(1601758800000+0300)/", - "OrderLineItemNo": 5, - "OrderNo": 2020000001, - "PartnerID": 0, - "PartnerShare": 0, - "PartnerShareType": "P", - "PatientShare": 0, - "PatientShareWithTax": 0, - "PatientTaxAmount": 0, - "ProcPrice": 1470, - "ProcedureCategoryID": 3, - "ProcedureCategoryName": "RADIOLOGY", - "ProcedureID": "03033065", - "ProcedureName": "CT SCAN - ABDOMEN (WITH CONTRAST)", - "TaxAmount": 198.45, - "TaxPct": 15 - } - ], - "AppointmentDate": "/Date(1601499600000+0300)/", - "AppointmentNo": 2016053756, - "ClinicID": 1, - "ClinicName": "INTERNAL MEDICINE CLINIC", - "CompanyID": 0, - "CompanyName": "Blood Donation Investigation", - "DoctorID": 1485, - "DoctorName": "ANAS ABDULLAH", - "ErrCode": null, - "GroupID": 2, - "InsurancePolicyNo": "45976500", - "Message": "Success", - "PatientCardID": "232332323", - "PatientID": 3072055, - "PatientName": "MAYA KHALED SADDIQ", - "PatientType": 1, - "PolicyID": 2, - "PolicyName": "Test", - "ProjectID": 15, - "SetupID": "010266", - "StatusCode": 1, - "SubCategoryID": 2, - "SubPolicyNo": "234234" - } - ]; + _ancillaryProcLists = []; response['AncillaryOrderProcList'].forEach((item) { ancillaryProcLists.add(AncillaryOrdersListProcListModel.fromJson(item)); +// ancillaryProcLists.add(AncillaryOrdersListProcListModel.fromJson(response['AncillaryOrderProcList'])); + print("----------------------------------"); + print("Test data"); + print(response); }); + //Future.value(_ancillaryProcLists); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/ancillary_orders_view_model.dart b/lib/core/viewModels/ancillary_orders_view_model.dart index 77eb4237..4a140004 100644 --- a/lib/core/viewModels/ancillary_orders_view_model.dart +++ b/lib/core/viewModels/ancillary_orders_view_model.dart @@ -12,8 +12,10 @@ class AnciallryOrdersViewModel extends BaseViewModel { AncillaryOrdersService _ancillaryService = locator(); List get ancillaryLists => _ancillaryService.ancillaryLists; + List get ancillaryListsDetails => _ancillaryService.ancillaryProcLists; + Future getOrders() async { hasError = false; setState(ViewState.Busy); @@ -25,10 +27,10 @@ class AnciallryOrdersViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getOrdersDetails(appointmentNo, orderNo) async { + Future getOrdersDetails(appointmentNo, orderNo, projectID) async { hasError = false; setState(ViewState.Busy); - await _ancillaryService.getOrdersDetails(appointmentNo, orderNo); + await _ancillaryService.getOrdersDetails(appointmentNo, orderNo, projectID ); if (_ancillaryService.hasError) { error = _ancillaryService.error; setState(ViewState.ErrorLocal); diff --git a/lib/models/anicllary-orders/ancillary_order_proc_model.dart b/lib/models/anicllary-orders/ancillary_order_proc_model.dart index 7322d11a..5524f58a 100644 --- a/lib/models/anicllary-orders/ancillary_order_proc_model.dart +++ b/lib/models/anicllary-orders/ancillary_order_proc_model.dart @@ -1,60 +1,61 @@ class AncillaryOrdersListProcListModel { - List ancillaryOrderProcList; + List ancillaryOrderProcDetailsList; String appointmentDate; - dynamic appointmentNo; - dynamic clinicID; + int appointmentNo; + int clinicID; String clinicName; - dynamic companyID; + int companyID; String companyName; - dynamic doctorID; + int doctorID; String doctorName; Null errCode; - dynamic groupID; + int groupID; String insurancePolicyNo; String message; String patientCardID; - dynamic patientID; + int patientID; String patientName; - dynamic patientType; - dynamic policyID; + int patientType; + int policyID; String policyName; - dynamic projectID; + int projectID; String setupID; - dynamic statusCode; - dynamic subCategoryID; + int statusCode; + int subCategoryID; String subPolicyNo; AncillaryOrdersListProcListModel( - {this.ancillaryOrderProcList, - this.appointmentDate, - this.appointmentNo, - this.clinicID, - this.clinicName, - this.companyID, - this.companyName, - this.doctorID, - this.doctorName, - this.errCode, - this.groupID, - this.insurancePolicyNo, - this.message, - this.patientCardID, - this.patientID, - this.patientName, - this.patientType, - this.policyID, - this.policyName, - this.projectID, - this.setupID, - this.statusCode, - this.subCategoryID, - this.subPolicyNo}); + {this.ancillaryOrderProcDetailsList, + this.appointmentDate, + this.appointmentNo, + this.clinicID, + this.clinicName, + this.companyID, + this.companyName, + this.doctorID, + this.doctorName, + this.errCode, + this.groupID, + this.insurancePolicyNo, + this.message, + this.patientCardID, + this.patientID, + this.patientName, + this.patientType, + this.policyID, + this.policyName, + this.projectID, + this.setupID, + this.statusCode, + this.subCategoryID, + this.subPolicyNo}); AncillaryOrdersListProcListModel.fromJson(Map json) { - if (json['AncillaryOrderProcList'] != null) { - ancillaryOrderProcList = new List(); - json['AncillaryOrderProcList'].forEach((v) { - ancillaryOrderProcList.add(new AncillaryOrderProcList.fromJson(v)); + if (json['AncillaryOrderProcDetailsList'] != null) { + ancillaryOrderProcDetailsList = new List(); + json['AncillaryOrderProcDetailsList'].forEach((v) { + ancillaryOrderProcDetailsList + .add(new AncillaryOrderProcDetailsList.fromJson(v)); }); } appointmentDate = json['AppointmentDate']; @@ -84,9 +85,9 @@ class AncillaryOrdersListProcListModel { Map toJson() { final Map data = new Map(); - if (this.ancillaryOrderProcList != null) { - data['AncillaryOrderProcList'] = - this.ancillaryOrderProcList.map((v) => v.toJson()).toList(); + if (this.ancillaryOrderProcDetailsList != null) { + data['AncillaryOrderProcDetailsList'] = + this.ancillaryOrderProcDetailsList.map((v) => v.toJson()).toList(); } data['AppointmentDate'] = this.appointmentDate; data['AppointmentNo'] = this.appointmentNo; @@ -115,7 +116,7 @@ class AncillaryOrdersListProcListModel { } } -class AncillaryOrderProcList { +class AncillaryOrderProcDetailsList { dynamic approvalLineItemNo; dynamic approvalNo; String approvalStatus; @@ -147,39 +148,39 @@ class AncillaryOrderProcList { dynamic taxAmount; dynamic taxPct; - AncillaryOrderProcList( + AncillaryOrderProcDetailsList( {this.approvalLineItemNo, - this.approvalNo, - this.approvalStatus, - this.approvalStatusID, - this.companyShare, - this.companyShareWithTax, - this.companyTaxAmount, - this.discountAmount, - this.discountCategory, - this.discountType, - this.discountTypeValue, - this.isApprovalCreated, - this.isApprovalRequired, - this.isCovered, - this.orderDate, - this.orderLineItemNo, - this.orderNo, - this.partnerID, - this.partnerShare, - this.partnerShareType, - this.patientShare, - this.patientShareWithTax, - this.patientTaxAmount, - this.procPrice, - this.procedureCategoryID, - this.procedureCategoryName, - this.procedureID, - this.procedureName, - this.taxAmount, - this.taxPct}); + this.approvalNo, + this.approvalStatus, + this.approvalStatusID, + this.companyShare, + this.companyShareWithTax, + this.companyTaxAmount, + this.discountAmount, + this.discountCategory, + this.discountType, + this.discountTypeValue, + this.isApprovalCreated, + this.isApprovalRequired, + this.isCovered, + this.orderDate, + this.orderLineItemNo, + this.orderNo, + this.partnerID, + this.partnerShare, + this.partnerShareType, + this.patientShare, + this.patientShareWithTax, + this.patientTaxAmount, + this.procPrice, + this.procedureCategoryID, + this.procedureCategoryName, + this.procedureID, + this.procedureName, + this.taxAmount, + this.taxPct}); - AncillaryOrderProcList.fromJson(Map json) { + AncillaryOrderProcDetailsList.fromJson(Map json) { approvalLineItemNo = json['ApprovalLineItemNo']; approvalNo = json['ApprovalNo']; approvalStatus = json['ApprovalStatus']; diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart index eccc1309..4cb2b658 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart @@ -95,7 +95,7 @@ class _AnicllaryOrdersState extends State .map( (item) => InkWell( onTap: () { - ancillaryOrdersDetails(item); + ancillaryOrdersDetails(item, model.ancillaryLists[0].projectID); }, child: Container( decoration: BoxDecoration( @@ -166,11 +166,11 @@ class _AnicllaryOrdersState extends State .toList()); } - ancillaryOrdersDetails(item) { + ancillaryOrdersDetails(item, projectId) { Navigator.push( context, FadePage( - page: AnicllaryOrdersDetails(item.appointmentNo, item.orderNo), + page: AnicllaryOrdersDetails(item.appointmentNo, item.orderNo,projectId ), ), ); } diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 20d2966b..6f3ef552 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -8,11 +8,15 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart'; class AnicllaryOrdersDetails extends StatefulWidget { final dynamic appoNo; final dynamic orderNo; - AnicllaryOrdersDetails(this.appoNo, this.orderNo); + final dynamic projectID; + + AnicllaryOrdersDetails(this.appoNo, this.orderNo, this.projectID); @override _AnicllaryOrdersState createState() => _AnicllaryOrdersState(); } @@ -31,7 +35,7 @@ class _AnicllaryOrdersState extends State Widget build(BuildContext context) { return BaseView( onModelReady: (model) => - model.getOrdersDetails(widget.appoNo, widget.orderNo), + model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, baseViewModel: model, @@ -64,7 +68,12 @@ class _AnicllaryOrdersState extends State children: [ Button( label: TranslationBase.of(context).payNow, - onTap: () {}, + backgroundColor: Colors.red[800], + onTap: () { + Navigator.push(context, + FadePage(page: OrdersPayment(), + ),); + }, ) ], ) @@ -89,7 +98,7 @@ class _AnicllaryOrdersState extends State fontSize: 20, ), Texts( - model.ancillaryListsDetails[0].patientID.toString(), + model.ancillaryLists[0].patientID.toString(), ) ], ), @@ -126,7 +135,8 @@ class _AnicllaryOrdersState extends State children: [ Texts( TranslationBase.of(context).invoiceNo, - fontWeight: FontWeight.bold, +// fontWeight: FontWeight.bold, + color: Colors.red[500], ), Texts(" : "), Texts( @@ -137,8 +147,9 @@ class _AnicllaryOrdersState extends State Row( children: [ Texts( - TranslationBase.of(context).date, - fontWeight: FontWeight.bold, + TranslationBase.of(context).invoiceDate, +// fontWeight: FontWeight.bold, + color: Colors.red[500], ), Texts(" : "), Texts( @@ -152,8 +163,9 @@ class _AnicllaryOrdersState extends State Row( children: [ Texts( - TranslationBase.of(context).date, - fontWeight: FontWeight.bold, + TranslationBase.of(context).doctorName, +// fontWeight: FontWeight.bold, + color: Colors.red[500], ), Texts(" : "), Texts( @@ -206,13 +218,49 @@ class _AnicllaryOrdersState extends State Divider( color: Colors.red[800], thickness: 3, - ) + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Row( + children: [ + + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + + children: [ + Texts( + TranslationBase.of(context).price, + color: Colors.grey[500], + fontSize: 14, + ), + SizedBox(width: 15), + Texts( + TranslationBase.of(context).vat, + color: Colors.grey[500], + fontSize: 14, + ), + SizedBox(width: 15), + Texts( + TranslationBase.of(context).total, + color: Colors.grey[500], + fontSize: 14, + ), + ] ), + ], + ), + Divider( + color: Colors.black26, + ), + ], )); } Widget getAncillaryDetails(model) { - Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcList, + Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); print(newMap); @@ -247,7 +295,7 @@ class _AnicllaryOrdersState extends State String getTotalValue(value) { double total = 0.0; - value.ancillaryListsDetails[0].ancillaryOrderProcList + value.ancillaryListsDetails[0].ancillaryOrderProcDetailsList .forEach((result) => {total += result.companyShareWithTax}); return total.toStringAsFixed(2); } @@ -277,4 +325,6 @@ class _AnicllaryOrdersState extends State }).toList(), ); } + + } diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart new file mode 100644 index 00000000..fee4ff40 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart @@ -0,0 +1,20 @@ +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; + +class OrdersPayment extends StatefulWidget { + @override + _OrdersPaymentState createState() => _OrdersPaymentState(); +} + +class _OrdersPaymentState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index 7f0d0c5c..44a3dc9e 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -50,6 +50,15 @@ class _BodyFatState extends State { TextEditingController waistController = TextEditingController(); TextEditingController hipController = TextEditingController(); + @override + void initState() { + neckController.text = neck.toString(); + hipController.text = hip.toString(); + waistController.text = waist.toString(); + heightController.text = heightCm.toString(); + super.initState(); + } + void updateColorHeight(int type) { //MG/DLT card if (type == 1) { @@ -319,11 +328,6 @@ class _BodyFatState extends State { child: TextFormField( keyboardType: TextInputType.number, controller: heightController, - decoration: InputDecoration( - labelText: heightCm.toString(), - labelStyle: TextStyle( - color: Colors.black, - )), ), ), ), @@ -350,6 +354,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (heightCm < 250) heightCm++; + heightController.text = heightCm.toString(); }); }, ), @@ -362,6 +367,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (heightCm > 0) heightCm--; + heightController.text = heightCm.toString(); }); }, ), @@ -381,6 +387,7 @@ class _BodyFatState extends State { onChanged: (double newValue) { setState(() { heightCm = newValue.round(); + heightController.text = heightCm.toString(); }); }, activeColor: Color(0xffC5272D), @@ -492,15 +499,10 @@ class _BodyFatState extends State { Expanded( child: Center( child: Padding( - padding: const EdgeInsets.only(left: 10.0), + padding: const EdgeInsets.only(left: 15.0, bottom: 0), child: TextFormField( keyboardType: TextInputType.number, controller: neckController, - decoration: InputDecoration( - labelText: neck.toString(), - labelStyle: TextStyle( - color: Colors.black, - )), ), ), ), @@ -527,6 +529,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (neck < 60) neck++; + neckController.text = neck.toString(); }); }, ), @@ -539,6 +542,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (neck > 5) neck--; + neckController.text = neck.toString(); }); }, ), @@ -558,6 +562,7 @@ class _BodyFatState extends State { onChanged: (double newValue) { setState(() { neck = newValue.round(); + neckController.text = neck.toString(); }); }, activeColor: Color(0xffC5272D), @@ -673,11 +678,6 @@ class _BodyFatState extends State { child: TextFormField( keyboardType: TextInputType.number, controller: waistController, - decoration: InputDecoration( - labelText: waist.toString(), - labelStyle: TextStyle( - color: Colors.black, - )), ), ), ), @@ -704,6 +704,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (waist < 200) waist++; + waistController.text = waist.toString(); }); }, ), @@ -716,6 +717,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (waist > 5) waist--; + waistController.text = waist.toString(); }); }, ), @@ -735,6 +737,7 @@ class _BodyFatState extends State { onChanged: (double newValue) { setState(() { waist = newValue.round(); + waistController.text = waist.toString(); }); }, activeColor: Color(0xffC5272D), @@ -850,11 +853,6 @@ class _BodyFatState extends State { child: TextFormField( keyboardType: TextInputType.number, controller: hipController, - decoration: InputDecoration( - labelText: hip.toString(), - labelStyle: TextStyle( - color: Colors.black, - )), ), ), ), @@ -881,6 +879,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (hip < 140) hip++; + hipController.text = hip.toString(); }); }, ), @@ -893,6 +892,7 @@ class _BodyFatState extends State { onTap: () { setState(() { if (hip > 5) hip--; + hipController.text = hip.toString(); }); }, ), @@ -912,6 +912,7 @@ class _BodyFatState extends State { onChanged: (double newValue) { setState(() { hip = newValue.round(); + hipController.text = hip.toString(); }); }, activeColor: Color(0xffC5272D), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart index b05637bc..a6708855 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -19,6 +19,7 @@ class OvulationPeriod extends StatefulWidget { class _OvulationPeriodState extends State { DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); + DateTime selectedDateTime = DateTime.now(); int cycleLength = 0; int lutealPhaseLength = 0; String selectedDate; @@ -37,13 +38,30 @@ class _OvulationPeriodState extends State { } String getDate() { - return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}"; + return "${DateUtil.getMonth(selectedDateTime.month)} ${selectedDateTime.day}, ${selectedDateTime.year}"; } // void calculate() {} // // void calculateFertility(DateTime selectedDate) {const diff = Date.} + calculateBabyInformation() { + setState(() { + bloodSugarDate = selectedDateTime; + dateFrom = selectedDateTime.add(Duration(days: 10)); + updatedDt = DateFormat.yMMMEd().format(dateFrom); + dateTo = selectedDateTime.add(Duration(days: 20)); + conceivedDate = selectedDateTime.add(Duration(days: 14)); + deliveryDue = selectedDateTime.add(Duration(days: 280)); + + // babyAge = Jiffy([DateTime.now()]).diff(Jiffy([date]), Units.WEEK); + babyAgeWeeks = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]) + .diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.WEEK); + babyAgeDays = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]) + .diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.DAY); + }); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -78,18 +96,7 @@ class _OvulationPeriodState extends State { onConfirm: (date) { print('confirm $date'); setState(() { - bloodSugarDate = date; - dateFrom = date.add(Duration(days: 10)); - updatedDt = DateFormat.yMMMEd().format(dateFrom); - dateTo = date.add(Duration(days: 20)); - conceivedDate = date.add(Duration(days: 14)); - deliveryDue = date.add(Duration(days: 280)); - - // babyAge = Jiffy([DateTime.now()]).diff(Jiffy([date]), Units.WEEK); - babyAgeWeeks = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]) - .diff(Jiffy([date.year, date.month, dateTo.day]), Units.WEEK); - babyAgeDays = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]) - .diff(Jiffy([date.year, date.month, dateTo.day]), Units.DAY); + selectedDateTime = date; }); }, currentTime: DateTime.now(), @@ -321,22 +328,19 @@ class _OvulationPeriodState extends State { child: SecondaryButton( label: 'CALCULATE', onTap: () { - setState(() { - { - Navigator.push( - context, - FadePage( - page: OvulationResult( - conceivedDate: conceivedDate, - dateFrom: dateFrom, - dateTo: dateTo, - deliveryDue: deliveryDue, - babyAge: babyAgeWeeks, - babyAgeDays: babyAgeDays, - )), - ); - } - }); + calculateBabyInformation(); + Navigator.push( + context, + FadePage( + page: OvulationResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + babyAge: babyAgeWeeks, + babyAgeDays: babyAgeDays, + )), + ); }, ), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart index 855e5af7..53ccb664 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart @@ -78,7 +78,7 @@ class OvulationResult extends StatelessWidget { fontWeight: FontWeight.w400, ), Texts( - babyAge.toString() + " Weeks," + "2", + babyAge <= 0 ? "baby age is not available" : babyAge.toString() + " Weeks," + "3", fontWeight: FontWeight.w800, fontSize: 21.0, ), diff --git a/lib/pages/AlHabibMedicalService/parking_page.dart b/lib/pages/AlHabibMedicalService/parking_page.dart index 19f06a56..f3620917 100644 --- a/lib/pages/AlHabibMedicalService/parking_page.dart +++ b/lib/pages/AlHabibMedicalService/parking_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/qr_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -9,11 +10,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:provider/provider.dart'; import '../../d_q_icons_icons.dart'; class ParkingPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getIsSaveParking(), builder: (_, model, widget) => AppScaffold( @@ -21,10 +24,7 @@ class ParkingPage extends StatelessWidget { appBarTitle: TranslationBase.of(context).parking, description: TranslationBase.of(context).parkingDescription, imagesInfo: [ - ImagesInfo( - imageAr: 'assets/images/bc_parking.png', - imageEn: 'assets/images/bc_parking.png', - isAsset: true) + ImagesInfo(imageAr: 'assets/images/bc_parking.png', imageEn: 'assets/images/bc_parking.png', isAsset: true) ], body: SingleChildScrollView( padding: EdgeInsets.all(12), @@ -50,7 +50,9 @@ class ParkingPage extends StatelessWidget { Row( children: [ Expanded( - child: Container(child: Icon(/*Icons.landscape*/DQIcons.parking_icon,size: 130),), + child: Container( + child: Icon(/*Icons.landscape*/ DQIcons.parking_icon, size: 130), + ), ), SizedBox( width: 15, @@ -85,15 +87,15 @@ class ParkingPage extends StatelessWidget { padding: EdgeInsets.all(8), width: double.infinity, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - shape: BoxShape.rectangle), + borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), height: 70, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).showMyPark), - Texts(model.qrParkingModel.floorDescriptionN), + Texts(projectViewModel.isArabic + ? model.qrParkingModel.floorDescriptionN + : model.qrParkingModel.floorDescription), ], ), ), @@ -102,9 +104,7 @@ class ParkingPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - shape: BoxShape.rectangle), + borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), padding: EdgeInsets.all(8), width: double.infinity, height: 70, @@ -112,7 +112,9 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).gate), - Texts(model.qrParkingModel.gateDescriptionN), + Texts(projectViewModel.isArabic + ? model.qrParkingModel.gateDescriptionN + : model.qrParkingModel.gateDescription), ], ), ), @@ -121,9 +123,7 @@ class ParkingPage extends StatelessWidget { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - shape: BoxShape.rectangle), + borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), padding: EdgeInsets.all(8), width: double.infinity, height: 70, @@ -131,7 +131,9 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).building), - Texts(model.qrParkingModel.buildingDescriptionN), + Texts(projectViewModel.isArabic + ? model.qrParkingModel.buildingDescriptionN + : model.qrParkingModel.buildingDescription), ], ), ), @@ -141,16 +143,16 @@ class ParkingPage extends StatelessWidget { Container( padding: EdgeInsets.all(8), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - shape: BoxShape.rectangle), + borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), width: double.infinity, height: 70, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).branch), - Texts(model.qrParkingModel.branchDescriptionN), + Texts(projectViewModel.isArabic + ? model.qrParkingModel.branchDescriptionN + : model.qrParkingModel.branchDescription), ], ), ), diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index 2c71ab14..0c7fea59 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -42,7 +42,8 @@ class AddBloodPressurePage extends StatefulWidget { class _AddBloodPressurePageState extends State { TextEditingController _bloodSystolicValueController = TextEditingController(); - TextEditingController _bloodDiastolicValueController = TextEditingController(); + TextEditingController _bloodDiastolicValueController = + TextEditingController(); DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); int measuredArm = 1; @@ -80,7 +81,9 @@ class _AddBloodPressurePageState extends State { return AppScaffold( isShowAppBar: true, - appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, + appBarTitle: widget.isUpdate + ? TranslationBase.of(context).update + : TranslationBase.of(context).add, appBarIcons: widget.isUpdate ? [ IconButton( @@ -96,10 +99,14 @@ class _AddBloodPressurePageState extends State { ConfirmDialog.closeAlertDialog(context); GifLoaderDialogUtils.showMyDialog(context); - widget.model.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { + widget.model + .deactivateDiabeticStatus( + lineItemNo: widget.lineItemNo) + .then((value) { GifLoaderDialogUtils.hideDialog(context); if (widget.model.state == ViewState.ErrorLocal) - AppToast.showErrorToast(message: widget.model.error); + AppToast.showErrorToast( + message: widget.model.error); else Navigator.pop(context); }).catchError((e) { @@ -144,13 +151,17 @@ class _AddBloodPressurePageState extends State { ), InkWell( onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList); + 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), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -177,13 +188,17 @@ class _AddBloodPressurePageState extends State { bloodSugarDate = date; }, ); - }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); + }, + 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), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -198,22 +213,30 @@ class _AddBloodPressurePageState extends State { ), InkWell( onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { + DatePicker.showTimePicker(context, showTitleActions: true, + onConfirm: (date) { setState( () { timeSugarDate = date; }, ); - }, currentTime: timeSugarDate, locale: projectViewModel.localeType); + }, + 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), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + children: [ + Texts(TranslationBase.of(context).time), + Texts(getTime()) + ], ), ), ), @@ -229,38 +252,44 @@ class _AddBloodPressurePageState extends State { widthFactor: 0.9, child: Column( children: [ - SecondaryButton( - loading: widget.model.state == ViewState.BusyLocal, - label: TranslationBase.of(context).save.toUpperCase(), - textColor: Colors.white, - color: isButtonDisabled ? Colors.grey[900] : Colors.grey, - onTap: () async { - if (_bloodSystolicValueController.text.isNotEmpty && - _bloodDiastolicValueController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); + Container( + height: 50, + child: SecondaryButton( + loading: widget.model.state == ViewState.BusyLocal, + label: TranslationBase.of(context).save.toUpperCase(), + textColor: Colors.white, + color: isButtonDisabled ? Colors.grey[900] : Colors.grey, + onTap: () async { + if (_bloodSystolicValueController.text.isNotEmpty && + _bloodDiastolicValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); - widget.model - .addORUpdateDiabtecResult( - isUpdate: widget.isUpdate, - bloodPressureDate: - '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - diastolicPressure: _bloodDiastolicValueController.text.toString(), - systolicePressure: _bloodSystolicValueController.text.toString(), - measuredArm: measuredArm, - ) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.BusyLocal) + widget.model + .addORUpdateDiabtecResult( + isUpdate: widget.isUpdate, + bloodPressureDate: + '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + diastolicPressure: + _bloodDiastolicValueController.text.toString(), + systolicePressure: + _bloodSystolicValueController.text.toString(), + measuredArm: measuredArm, + ) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.BusyLocal) + AppToast.showErrorToast( + message: widget.model.error); + else + Navigator.pop(context); + ; + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: widget.model.error); - else - Navigator.pop(context); - ; - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - } - }), + }); + } + }), + ), ], ), ), @@ -295,7 +324,8 @@ class _AddBloodPressurePageState extends State { } void validateForm() { - print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString()); + print("_bloodSystolicValueController " + + _bloodSystolicValueController.text.length.toString()); if (measureTimeSelectedType != 'Left Arm' && _bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) { diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index 5134c8f9..72509222 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -254,7 +254,8 @@ class _MobileNo extends State { controller: widget.controller, keyboardType: TextInputType.number, maxLength: 10, - inputFormatters: [ + inputFormatters: + [ FilteringTextInputFormatter.allow(RegExp("[0-9]")), ], // maxLengthEnforced: true,