Merge branch 'development_new_design_2.0' into development_v2.5

merge-requests/570/merge
Sikander Saleem 4 years ago
commit 3ad90f1a01

@ -232,7 +232,7 @@ class BaseAppClient {
Map<String, String> headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': token ?? '',
'Authorization': pharmacyToken ?? '',
'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "",
@ -291,20 +291,21 @@ class BaseAppClient {
body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID'];
body['PatientOutSA'] = user['OutSA'];
body['SessionID'] = SESSION_ID; //getSe
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': pharmacyToken,
'Mobilenumber': user['MobileNumber'].toString(),
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user['PatientID'].toString(),
};
// headers = {
// 'Content-Type': 'application/json',
// 'Accept': 'application/json',
// 'Authorization': pharmacyToken,
// 'Mobilenumber': user['MobileNumber'].toString(),
// 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
// 'Username': user['PatientID'].toString(),
// };
}
}
}
print("URL : $url");
print("Body : ${json.encode(body)}");
print("Headers : ${json.encode(headers)}");
if (await Utils.checkConnection()) {
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
@ -709,7 +710,6 @@ class BaseAppClient {
body['PatientTypeID'] = body.containsKey('PatientTypeID')
? body['PatientTypeID'] != null
? body['PatientTypeID']
: user['PatientType'] != null
? user['PatientType']

@ -1,11 +1,9 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import '../../../locator.dart';
@ -76,27 +74,18 @@ class PharmacyAddressesViewModel extends BaseViewModel {
sendingAddress.customerAttributes = "";
sendingAddress.createdOnUtc = DateTime.now().toString();
if (editedAddress == null) {
///TODO Fatima*
await _pharmacyAddressService.addCustomerAddress(sendingAddress);
} else {
await _pharmacyAddressService.editCustomerAddress(sendingAddress);
await _pharmacyAddressService.editCustomerAddress(sendingAddress).then((value) async {
// await _pharmacyAddressService.getAddresses();
});
}
if (_pharmacyAddressService.hasError) {
await _pharmacyAddressService.getAddresses();
setState(ViewState.Idle);
// setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
Future deleteAddresses(AddressInfo address) async {

@ -37,10 +37,10 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
ctx,
FadePage(
page: AddAddressPage(address, (pickResult) async {
model.addEditAddress(pickResult, address);
await model.getAddressesList();
})));
await model.addEditAddress(pickResult, address);
}))).then((value) async {
// await model.getAddressesList();
});
}
Widget build(BuildContext context) {
@ -314,7 +314,7 @@ class _AddressItemWidgetState extends State<AddressItemWidget> {
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}",
@ -323,8 +323,9 @@ class _AddressItemWidgetState extends State<AddressItemWidget> {
okFunction: () => {
widget.model.deleteAddresses(widget.address).then((_) {
ConfirmDialog.closeAlertDialog(context);
AppToast.showErrorToast(message: TranslationBase.of(context).deletedAddress,
// "Address has been deleted"
AppToast.showErrorToast(
message: TranslationBase.of(context).deletedAddress,
// "Address has been deleted"
);
})
},

@ -104,6 +104,7 @@ class PharmacyAddressService extends BaseService {
response['customers'][0]['addresses'].forEach((item) {
addresses.add(AddressInfo.fromJson(item));
});
getAddresses();
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;

Loading…
Cancel
Save