pharmacy web services
parent
3f6599eb90
commit
a59a2d5ad3
@ -1,5 +1,10 @@
|
|||||||
const MAX_SMALL_SCREEN = 660;
|
const MAX_SMALL_SCREEN = 660;
|
||||||
const BASE_URL = 'https://hmgwebservices.com/Services/';
|
|
||||||
const ONLY_NUMBERS = "[0-9]";
|
const ONLY_NUMBERS = "[0-9]";
|
||||||
const ONLY_LETTERS = "[a-zA-Z]";
|
const ONLY_LETTERS = "[a-zA-Z]";
|
||||||
const ONLY_DATE = "[0-9/]";
|
const ONLY_DATE = "[0-9/]";
|
||||||
|
|
||||||
|
|
||||||
|
//Ibrahim Albitar
|
||||||
|
|
||||||
|
const BASE_URL = 'https://hmgwebservices.com/Services/';
|
||||||
|
const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems";
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
//Ibrahim Albitar
|
||||||
|
|
||||||
|
class PharmaciesRequestModel {
|
||||||
|
String PHR_itemName;
|
||||||
|
int LanguageID;
|
||||||
|
String stamp;
|
||||||
|
String IPAdress;
|
||||||
|
double VersionID;
|
||||||
|
String TokenID;
|
||||||
|
String SessionID;
|
||||||
|
bool IsLoginForDoctorApp;
|
||||||
|
bool PatientOutSA;
|
||||||
|
int PatientTypeID;
|
||||||
|
|
||||||
|
PharmaciesRequestModel(
|
||||||
|
{this.PHR_itemName,
|
||||||
|
this.PatientTypeID,
|
||||||
|
this.LanguageID,
|
||||||
|
this.stamp,
|
||||||
|
this.IPAdress,
|
||||||
|
this.VersionID,
|
||||||
|
this.TokenID,
|
||||||
|
this.SessionID,
|
||||||
|
this.IsLoginForDoctorApp,
|
||||||
|
this.PatientOutSA});
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:doctor_app_flutter/client/app_client.dart';
|
||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/pharmacies_request_model.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
class MedicineProvider with ChangeNotifier {
|
||||||
|
|
||||||
|
Future<Map> getPharmacyList(PharmaciesRequestModel pharmacy) async {
|
||||||
|
try {
|
||||||
|
final response = await AppClient.post(PHARMACY_ITEMS_URL,
|
||||||
|
body: json.encode({
|
||||||
|
"PHR_itemName": pharmacy.PHR_itemName,
|
||||||
|
"LanguageID": pharmacy.LanguageID,
|
||||||
|
"stamp": pharmacy.stamp,
|
||||||
|
"IPAdress": pharmacy.IPAdress,
|
||||||
|
"VersionID": pharmacy.VersionID,
|
||||||
|
"TokenID": pharmacy.TokenID,
|
||||||
|
"SessionID": pharmacy.SessionID,
|
||||||
|
"IsLoginForDoctorApp": pharmacy.IsLoginForDoctorApp,
|
||||||
|
"PatientOutSA": pharmacy.PatientOutSA,
|
||||||
|
"PatientTypeID": pharmacy.PatientTypeID
|
||||||
|
}));
|
||||||
|
return Future.value(json.decode(response.body));
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +1,67 @@
|
|||||||
|
import 'package:doctor_app_flutter/models/pharmacies_request_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/providers/medicine_provider.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
class MedicineSearchScreen extends StatelessWidget {
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
|
||||||
|
|
||||||
|
class MedicineSearchScreen extends StatefulWidget with DrAppToastMsg {
|
||||||
|
MedicineSearchScreen({this.changeLoadingStata});
|
||||||
|
final Function changeLoadingStata;
|
||||||
|
|
||||||
|
@override
|
||||||
|
_MedicineSearchState createState() => _MedicineSearchState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MedicineSearchState extends State<MedicineSearchScreen> {
|
||||||
|
var _medicineModel = PharmaciesRequestModel(
|
||||||
|
IsLoginForDoctorApp: true,
|
||||||
|
PHR_itemName: "Panadol",
|
||||||
|
PatientOutSA: false,
|
||||||
|
PatientTypeID: 1,
|
||||||
|
LanguageID: 2,
|
||||||
|
IPAdress: "11.11.11.11",
|
||||||
|
VersionID: 1.2,
|
||||||
|
TokenID: "2Fi7HoIHB0eDyekVa6tCJg==",
|
||||||
|
stamp: "2020-04-23T21:01:21.492Z",
|
||||||
|
SessionID: "e29zoooEJ4");
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => MedicineProvider(), //change builder to create
|
||||||
);
|
child: Consumer<MedicineProvider>(
|
||||||
|
builder: (context, provider, child) => AppScaffold(
|
||||||
|
appBarTitle: "Search Medicine",
|
||||||
|
body: RaisedButton(
|
||||||
|
onPressed: () {
|
||||||
|
MedicineProvider medicineProvider =
|
||||||
|
Provider.of<MedicineProvider>(context);
|
||||||
|
searchMedicine(context, medicineProvider);
|
||||||
|
},
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
|
||||||
|
searchMedicine(
|
||||||
|
context, MedicineProvider medicineProvider) {
|
||||||
|
|
||||||
|
medicineProvider.getPharmacyList(_medicineModel).then((res) {
|
||||||
|
|
||||||
|
if (res['MessageStatus'] == 1) {
|
||||||
|
print("ListPharmcy " + res['ListPharmcy'].toString());
|
||||||
|
|
||||||
|
//Navigator.of(context).pushNamed();
|
||||||
|
} else {
|
||||||
|
// handel error
|
||||||
|
// widget.showCenterShortLoadingToast("watting");
|
||||||
|
//helpers.showErrorToast(res['ErrorEndUserMessage']);
|
||||||
|
}
|
||||||
|
// Navigator.of(context).pushNamed(HOME);
|
||||||
|
}).catchError((err) {
|
||||||
|
print('$err');
|
||||||
|
//helpers.showErrorToast();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue