|
|
|
|
@ -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));
|
|
|
|
|
|