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.
RSGDoctorApp/lib/core/service/medicine_service.dart

51 lines
1.7 KiB
Dart

import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/doctor/request_schedule.dart';
import 'package:doctor_app_flutter/models/pharmacies/pharmacies_List_request_model.dart';
import 'package:doctor_app_flutter/models/pharmacies/pharmacies_items_request_model.dart';
class MedicineService extends BaseService {
var _pharmacyItemsList = [];
var _pharmaciesList = [];
get pharmacyItemsList => _pharmacyItemsList;
get pharmaciesList => _pharmaciesList;
PharmaciesItemsRequestModel _itemsRequestModel =
PharmaciesItemsRequestModel();
PharmaciesListRequestModel _listRequestModel = PharmaciesListRequestModel();
RequestSchedule _requestSchedule = RequestSchedule();
Future getMedicineItem(String itemName) async {
_itemsRequestModel.pHRItemName = itemName;
await baseAppClient.post(
PHARMACY_ITEMS_URL,
onSuccess: (dynamic response, int statusCode) {
_pharmacyItemsList.clear();
_pharmacyItemsList = response['ListPharmcy_Region_enh'];
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _itemsRequestModel.toJson(),
);
}
Future getPharmaciesList(int itemId) async {
_listRequestModel.itemID = itemId;
await baseAppClient.post(
PHARMACY_LIST_URL,
onSuccess: (dynamic response, int statusCode) {
_pharmaciesList.clear();
_pharmaciesList = response['PharmList'];
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: _listRequestModel.toJson(),
);
}
}