pharmacy web services

merge-requests/44/head
unknown 6 years ago
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;
}
}
}

@ -30,7 +30,7 @@ const String PATIENTS = 'patients/patients';
const String PATIENTS_PROFILE = 'patients/patients-profile'; const String PATIENTS_PROFILE = 'patients/patients-profile';
const String BLOOD_BANK = 'blood-bank'; const String BLOOD_BANK = 'blood-bank';
const String DOCTOR_REPLY = 'doctor-reply'; const String DOCTOR_REPLY = 'doctor-reply';
const String MEDICINE_SEARCH = 'medicine-search'; const String MEDICINE_SEARCH = 'medicine/medicine-search';
const String SETTINGS = 'settings'; const String SETTINGS = 'settings';
var routes = { var routes = {

@ -25,7 +25,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
return AppScaffold( return AppScaffold(
appBarTitle: 'Home', appBarTitle: 'Home',
body: Container( body: Container(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
@ -45,7 +44,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 2, flex: 2,
child: RoundedContainer(child:CircularPercentIndicator( child: RoundedContainer(
child: CircularPercentIndicator(
radius: 90.0, radius: 90.0,
animation: true, animation: true,
animationDuration: 1200, animationDuration: 1200,
@ -54,17 +54,13 @@ class _DashboardScreenState extends State<DashboardScreen> {
center: Column( center: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
AppText( AppText("38",
"38",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 4 fontSize: SizeConfig.textMultiplier * 4),
), AppText("Out-Patients",
AppText(
"Out-Patients",
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 1.5, fontSize: SizeConfig.textMultiplier * 1.5,
color: Colors.grey[800] color: Colors.grey[800]),
),
], ],
), ),
circularStrokeCap: CircularStrokeCap.butt, circularStrokeCap: CircularStrokeCap.butt,
@ -95,8 +91,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.stretch,
CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: DashboardItemTexts( child: DashboardItemTexts(
@ -184,27 +179,31 @@ class _DashboardScreenState extends State<DashboardScreen> {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 2, flex: 2,
child: InkWell( child: DashboardItemIconText( child: InkWell(
child: DashboardItemIconText(
DoctorApp.home_icon, DoctorApp.home_icon,
"", "",
"Search Patient", "Search Patient",
showBorder: false, showBorder: false,
backgroundColor: Colors.green[200], backgroundColor: Colors.green[200],
), ),
onTap: () { onTap: () {
Navigator.of(context).pushNamed(PATIENT_SEARCH); Navigator.of(context).pushNamed(PATIENT_SEARCH);
}, },
)), )),
Expanded( Expanded(
flex: 2, flex: 2,
child: new DashboardItemIconText( child: InkWell(
child: DashboardItemIconText(
DoctorApp.home_icon, DoctorApp.home_icon,
"", "",
"Out Patient", "Out Patient",
showBorder: false, showBorder: false,
backgroundColor: Colors.deepPurple[300], backgroundColor: Colors.deepPurple[300],
),
onTap: () {
Navigator.of(context).pushNamed(MEDICINE_SEARCH);
},
)), )),
], ],
)), )),

@ -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…
Cancel
Save