From c05772c63a6d8e16d1aec521399833c7fa944b62 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 21 Dec 2021 10:52:13 +0300 Subject: [PATCH] pharmacy fixes --- .../model/pharmacies/PointsAmountPerday.dart | 4 ++-- lib/core/model/pharmacies/PointsDetails.dart | 6 ++--- .../service/parmacyModule/lacum-service.dart | 8 +++++-- .../PharmacyAddressesViewModel.dart | 5 ++++- .../pharmacyAddresses/PharmacyAddresses.dart | 22 +++++++++---------- .../pharmacyAddress_service.dart | 2 +- lib/uitl/translations_delegate_base.dart | 2 +- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/lib/core/model/pharmacies/PointsAmountPerday.dart b/lib/core/model/pharmacies/PointsAmountPerday.dart index e78e87b7..634233b9 100644 --- a/lib/core/model/pharmacies/PointsAmountPerday.dart +++ b/lib/core/model/pharmacies/PointsAmountPerday.dart @@ -1,10 +1,10 @@ import 'PointsDetails.dart'; class PointsAmountPerday { - double amountPerDay; + num amountPerDay; String day; List pointsDetails; - double pointsPerDay; + num pointsPerDay; String transationDate; PointsAmountPerday( diff --git a/lib/core/model/pharmacies/PointsDetails.dart b/lib/core/model/pharmacies/PointsDetails.dart index 7b342af9..9a251d83 100644 --- a/lib/core/model/pharmacies/PointsDetails.dart +++ b/lib/core/model/pharmacies/PointsDetails.dart @@ -1,11 +1,11 @@ class PointsDetails { int accNumber; String accountStatus; - double amount; + num amount; int lineItemNo; String operationType; - double points; - double purchasePoints; + num points; + num purchasePoints; int subTransactionType; String subTransactionTypeDescription; String transactionDate; diff --git a/lib/core/service/parmacyModule/lacum-service.dart b/lib/core/service/parmacyModule/lacum-service.dart index 122bafd6..1401df17 100644 --- a/lib/core/service/parmacyModule/lacum-service.dart +++ b/lib/core/service/parmacyModule/lacum-service.dart @@ -39,8 +39,12 @@ class LacumService extends BaseService{ super.error = ""; Map body = Map(); - body['IdentificationNo'] = user.patientIdentificationNo; - body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; + // body['IdentificationNo'] = user.patientIdentificationNo; + // body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; + + body['IdentificationNo'] = "2076117163"; + body['AccountNumber'] = "2019000006"; + body['IsDetailsRequired'] = true; try { diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index 2e883e5e..c1f8f1d1 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -77,7 +77,6 @@ class PharmacyAddressesViewModel extends BaseViewModel { await _pharmacyAddressService.addCustomerAddress(sendingAddress); } else { await _pharmacyAddressService.editCustomerAddress(sendingAddress).then((value) async { - // await _pharmacyAddressService.getAddresses(); }); } @@ -85,6 +84,8 @@ class PharmacyAddressesViewModel extends BaseViewModel { setState(ViewState.Idle); } else { setState(ViewState.Idle); + await Future.delayed(Duration(milliseconds: 800)); + getAddressesList(); } } @@ -96,6 +97,8 @@ class PharmacyAddressesViewModel extends BaseViewModel { setState(ViewState.Error); } else { setState(ViewState.Idle); + await Future.delayed(Duration(milliseconds: 800)); + getAddressesList(); } } diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 3a9c4da4..69986350 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -314,26 +314,24 @@ class _AddressItemWidgetState extends State { textColor: Color(0x99FF0000), handler: () { ConfirmDialog dialog = new ConfirmDialog( - // context: context, + context: context, title: TranslationBase.of(context).deleteAddress, - //"Are you sure want to delete", confirmMessage: "${widget.address.address1} ${widget.address.address2}", okText: TranslationBase.of(context).delete, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - widget.model.deleteAddresses(widget.address).then((_) { - ConfirmDialog.closeAlertDialog(context); - AppToast.showErrorToast( - message: TranslationBase.of(context).deletedAddress, - // "Address has been deleted" - ); - }) + ConfirmDialog.closeAlertDialog(context), + setState(() { + widget.model.deleteAddresses(widget.address).then((_) { + AppToast.showSuccessToast( + message: TranslationBase.of(context).deletedAddress, + ); + // widget.model.getAddressesList(); + }); + }), }, cancelFunction: () => {}); dialog.showAlertDialog(context); - setState(() { - widget.model.deleteAddresses(widget.address); - }); }, icon: Icon( Icons.delete, diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index 352473e4..17428438 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -104,7 +104,7 @@ class PharmacyAddressService extends BaseService { response['customers'][0]['addresses'].forEach((item) { addresses.add(AddressInfo.fromJson(item)); }); - getAddresses(); + // getAddresses(); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index eebe7b8c..22282832 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1011,7 +1011,7 @@ class TranslationBase { String get deleteAddress => localizedValues['deleteAddress'][locale.languageCode]; - String get deletedAddress => localizedValues['deletedAddress'][locale.languageCode]; + String get deletedAddress => localizedValues['deletedAddres'][locale.languageCode]; String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode];