updates & fixes

merge-update-with-lab-changes
haroon amjad 4 years ago
parent a7ccc73c36
commit 259581c4f8

@ -21,6 +21,7 @@ const THEME_VALUE = 'is_vibration';
const MAIN_USER = 'main-user';
const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited';
const PHARMACY_CUSTOMER_ID = 'costumer-id';
const PHARMACY_CUSTOMER_OBJECT = 'pharmacy-customer-object';
const IS_ROBOT_VISIBLE = 'robot-visible';
const IS_ROBOT_INIT = 'robot-init';
const HMG_GEOFENCES = 'hmg-geo-fences';

@ -1,16 +1,14 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:intl/intl.dart';
import '../../../locator.dart';
import '../base_service.dart';
class CustomerAddressesService extends BaseService {
List<AddressInfo> addressesList = List();
CustomerInfo customerInfo;
CustomerInfo customerInfo = new CustomerInfo();
Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async {
addNewAddressRequestModel.customer.email = customerInfo.email;
@ -40,7 +38,8 @@ class CustomerAddressesService extends BaseService {
Future getCustomerAddresses() async {
Map<String, String> queryParams = {'fields': 'addresses'};
hasError = false;
await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", onSuccess: (dynamic response, int statusCode) {
var customerID = await sharedPref.getObject(PHARMACY_CUSTOMER_ID);
await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID", onSuccess: (dynamic response, int statusCode) {
addressesList.clear();
response["customers"][0]["addresses"].forEach((data) {
addressesList.add(AddressInfo.fromJson(data));

@ -57,6 +57,7 @@ class PharmacyModuleService extends BaseService {
} else {
customerInfo = CustomerInfo.fromJson(response);
await sharedPref.setObject(PHARMACY_CUSTOMER_ID, customerInfo.customerId);
}
// await generatePharmacyToken();
}, onFailure: (String error, int statusCode) {

@ -122,16 +122,13 @@ class CMCViewModel extends BaseViewModel {
Future getCustomerInfo() async {
setState(ViewState.Busy);
await _pharmacyModuleService.generatePharmacyToken();
// await _pharmacyModuleService.createUser();
if (_customerAddressesService.hasError) {
error = _customerAddressesService.error;
await _pharmacyModuleService.createUser();
// await _customerAddressesService.getCustomerInfo();
setState(ViewState.ErrorLocal);
} else {
await _pharmacyModuleService.createUser();
// await _customerAddressesService.getCustomerInfo();
await getCustomerAddresses();
}
}

@ -105,16 +105,13 @@ class HomeHealthCareViewModel extends BaseViewModel {
Future getCustomerInfo() async {
setState(ViewState.Busy);
await _pharmacyModuleService.generatePharmacyToken();
// await _pharmacyModuleService.createUser();
if (_customerAddressesService.hasError) {
error = _customerAddressesService.error;
await _pharmacyModuleService.createUser();
// await _customerAddressesService.getCustomerInfo();
setState(ViewState.ErrorLocal);
} else {
await _pharmacyModuleService.createUser();
// await _customerAddressesService.getCustomerInfo();
await getCustomerAddresses();
}
}

@ -152,14 +152,27 @@ class RRTViewModel extends BaseViewModel {
Future getCustomerInfo() async {
setState(ViewState.Busy);
await _pharmacy_service.generatePharmacyToken();
if (_customerAddressesService.hasError) {
error = _customerAddressesService.error;
await _pharmacy_service.createUser();
await getCustomerAddresses();
setState(ViewState.ErrorLocal);
} else {
await _customerAddressesService.getCustomerInfo();
await _pharmacy_service.createUser();
await getCustomerAddresses();
}
// setState(ViewState.Busy);
// await _pharmacy_service.generatePharmacyToken();
// if (_customerAddressesService.hasError) {
// error = _customerAddressesService.error;
// await _pharmacy_service.createUser();
// await getCustomerAddresses();
// setState(ViewState.ErrorLocal);
// } else {
// await _customerAddressesService.getCustomerInfo();
// await getCustomerAddresses();
// }
}
}

@ -116,9 +116,7 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
}
void loadAddresses() async {
// GifLoaderDialogUtils.showMyDialog(context);
await viewModel.getCustomerInfo();
// GifLoaderDialogUtils.hideDialog(context);
if (viewModel.addressesList.isNotEmpty) setState(() {});
}

@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-ord
import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -190,7 +191,7 @@ class RRTRequestPageState extends State<RRTRequestPage> {
else
AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms);
},
color: acceptTerms ? Colors.red[600] : Colors.grey,
color: acceptTerms ? CustomColors.accentColor : Colors.grey,
),
),
],

Loading…
Cancel
Save