You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.0 KiB
Dart
62 lines
2.0 KiB
Dart
import 'package:diplomaticquarterapp/config/config.dart';
|
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
|
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
|
|
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
class ProductDetailService extends BaseService {
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
bool isLogin = false;
|
|
|
|
List<ProductDetail> _productDetailList = List();
|
|
List<ProductDetail> get productDetailList => _productDetailList;
|
|
|
|
List<LocationModel> _productLocationList = List();
|
|
List<LocationModel> get productLocationList => _productLocationList;
|
|
|
|
|
|
Future getProductReviews() async {
|
|
hasError = false;
|
|
await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+"1480?fields=reviews",
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
_productDetailList.clear();
|
|
response['products'].forEach((item) {
|
|
_productDetailList.add(ProductDetail.fromJson(item));
|
|
print(response);
|
|
});
|
|
}, onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error;
|
|
});
|
|
}
|
|
|
|
Future getProductAvailabiltyDetail() async {
|
|
hasError = false;
|
|
Map<String, dynamic> request;
|
|
|
|
request = {
|
|
"Channel": 3,
|
|
"DeviceTypeID": 2,
|
|
"IPAdress": "10.20.10.20",
|
|
"LanguageID": 2,
|
|
"PatientOutSA": 0,
|
|
"SKU": "6720020025",
|
|
"SessionID": null,
|
|
"VersionID": 5.6,
|
|
"generalid": "Cs2020@2016\$2958",
|
|
"isDentalAllowedBackend": false
|
|
};
|
|
await baseAppClient.post(GET_LOCATION,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
_productLocationList.clear();
|
|
response['PharmList'].forEach((item) {
|
|
_productLocationList.add(LocationModel.fromJson(item));
|
|
});
|
|
}, onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error;
|
|
}, body: request);
|
|
}
|
|
|
|
}
|