diff --git a/lib/config/config.dart b/lib/config/config.dart index 75de78f4..d71b2b92 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -544,8 +544,8 @@ const SUBSCRIBE_PRODUCT = "subscribe?"; const GET_ORDER = "orders?"; const GET_ORDER_DETAILS = "orders/"; const ADD_CUSTOMER_ADDRESS = "addcustomeraddress"; -const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress"; -const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress"; +const EDIT_CUSTOMER_ADDRESS = "editcustomeraddress"; +const DELETE_CUSTOMER_ADDRESS = "deletecustomeraddress"; const GET_ADDRESS = "Customers/"; const GET_Cancel_ORDER = "cancelorder/"; const WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8"; diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index bd2e94e4..b66ce951 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -65,12 +65,12 @@ class CustomerAddressesService extends BaseService { class CustomerInfo { bool isRegistered; - String userName; + dynamic userName; dynamic password; - String email; + dynamic email; dynamic errorMessage; - String mobileNumber; - int customerId; + dynamic mobileNumber; + dynamic customerId; CustomerInfo({this.isRegistered, this.userName, this.password, this.email, this.errorMessage, this.mobileNumber, this.customerId}); @@ -103,7 +103,7 @@ class AddressInfo { String lastName; String email; dynamic company; - int countryId; + dynamic countryId; String country; dynamic stateProvinceId; String city; diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index b6420c9c..72342b56 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -75,7 +75,6 @@ class PharmacyAddressesViewModel extends BaseViewModel { sendingAddress.faxNumber = user.faxNumber; sendingAddress.customerAttributes = ""; sendingAddress.createdOnUtc = DateTime.now().toString(); - if (editedAddress == null) { ///TODO Fatima* @@ -83,15 +82,21 @@ class PharmacyAddressesViewModel extends BaseViewModel { } else { await _pharmacyAddressService.editCustomerAddress(sendingAddress); + } if (_pharmacyAddressService.hasError) { - error = _pharmacyAddressService.error; - Utils.showErrorToast(error); - setState(ViewState.Error); + await _pharmacyAddressService.getAddresses(); + setState(ViewState.Idle); + + + // setState(ViewState.Error); } else { setState(ViewState.Idle); } + + + } Future deleteAddresses(AddressInfo sendingAddress) async { diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 21bb77eb..a84f3554 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -34,9 +34,11 @@ class _PharmacyAddressesState extends State { Navigator.push( ctx, FadePage( - page: AddAddressPage(address, (pickResult) { + page: AddAddressPage(address, (pickResult) async { model.addEditAddress(pickResult, address); - }))); + await model.getAddressesList(); + + }))); } Widget build(BuildContext context) { diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index 40d906f3..13583dba 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -71,7 +71,10 @@ class PharmacyAddressService extends BaseService { } Future addCustomerAddress(AddressInfo address) async { - makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); + await makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); + // if(!hasError) { + selectedAddressIndex = addresses.length +1; + // } } Future editCustomerAddress(AddressInfo address) async {