Merge branch 'pharmacy-Fatima' into 'development'

Pharmacy fatima

See merge request Cloud_Solution/diplomatic-quarter!249
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 405f67be1e

@ -334,7 +334,7 @@ const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts";
const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/"; const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/";
const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/"; const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/";
const GET_ORDER = "orders?"; const GET_ORDER = "orders?";
const GET_ORDER_DETAILS = "epharmacy/api/orders/"; const GET_ORDER_DETAILS = "orders/";
const ADD_CUSTOMER_ADDRESS = "epharmacy/api/addcustomeraddress"; const ADD_CUSTOMER_ADDRESS = "epharmacy/api/addcustomeraddress";
const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress"; const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress";
const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress"; const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress";
@ -361,6 +361,7 @@ const TRANSFER_YAHALA_LOYALITY_POINTS =
"Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints";
const LAKUM_GET_USER_TERMS_AND_CONDITIONS = const LAKUM_GET_USER_TERMS_AND_CONDITIONS =
"Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList';
// Home Health Care // Home Health Care
const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices";

@ -177,6 +177,7 @@ const Map localizedValues = {
'ar': 'ابحث عن الدواء هنا' 'ar': 'ابحث عن الدواء هنا'
}, },
'description': {'en': 'Description', 'ar': 'الوصف'}, 'description': {'en': 'Description', 'ar': 'الوصف'},
'howToUse': {'en': 'How to Use', 'ar': 'طريقة الأستخدام'},
'price': {'en': 'Price', 'ar': 'السعر'}, 'price': {'en': 'Price', 'ar': 'السعر'},
'youCanFindItIn': {'en': 'You can find it in', 'ar': 'يمكنكة ان تجده في'}, 'youCanFindItIn': {'en': 'You can find it in', 'ar': 'يمكنكة ان تجده في'},
'pleaseEnterMedicineName': { 'pleaseEnterMedicineName': {
@ -618,6 +619,7 @@ const Map localizedValues = {
"cancelledOrder": {"en": " CANCELLED", "ar": "ملغي"}, "cancelledOrder": {"en": " CANCELLED", "ar": "ملغي"},
"compare": {"en": " Compare", "ar": "مقارنه"}, "compare": {"en": " Compare", "ar": "مقارنه"},
"medicationsRefill": {"en": " Medication Refill", "ar": "طلب أعادة صرف"}, "medicationsRefill": {"en": " Medication Refill", "ar": "طلب أعادة صرف"},
"recommended": {"en": " Recommended For You", "ar": "موصى لك"},
"myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"}, "myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"},
"quantity": {"en": " QTY ", "ar": "الكمية"}, "quantity": {"en": " QTY ", "ar": "الكمية"},
"backMyAccount": { "backMyAccount": {

@ -0,0 +1,157 @@
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class Prescriptions {
String setupID;
int projectID;
int patientID;
int appointmentNo;
String appointmentDate;
String doctorName;
String clinicDescription;
String name;
int episodeID;
int actualDoctorRate;
int admission;
int clinicID;
String companyName;
String despensedStatus;
DateTime dischargeDate;
int dischargeNo;
int doctorID;
String doctorImageURL;
int doctorRate;
String doctorTitle;
int gender;
String genderDescription;
bool isActiveDoctorProfile;
bool isDoctorAllowVedioCall;
bool isExecludeDoctor;
bool isInOutPatient;
String isInOutPatientDescription;
String isInOutPatientDescriptionN;
bool isInsurancePatient;
String nationalityFlagURL;
int noOfPatientsRate;
String qR;
List<String> speciality;
Prescriptions(
{this.setupID,
this.projectID,
this.patientID,
this.appointmentNo,
this.appointmentDate,
this.doctorName,
this.clinicDescription,
this.name,
this.episodeID,
this.actualDoctorRate,
this.admission,
this.clinicID,
this.companyName,
this.despensedStatus,
this.dischargeDate,
this.dischargeNo,
this.doctorID,
this.doctorImageURL,
this.doctorRate,
this.doctorTitle,
this.gender,
this.genderDescription,
this.isActiveDoctorProfile,
this.isDoctorAllowVedioCall,
this.isExecludeDoctor,
this.isInOutPatient,
this.isInOutPatientDescription,
this.isInOutPatientDescriptionN,
this.isInsurancePatient,
this.nationalityFlagURL,
this.noOfPatientsRate,
this.qR,
this.speciality});
Prescriptions.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
patientID = json['PatientID'];
appointmentNo = json['AppointmentNo'];
appointmentDate = json['AppointmentDate'];
doctorName = json['DoctorName'];
clinicDescription = json['ClinicDescription'];
name = json['Name'];
episodeID = json['EpisodeID'];
actualDoctorRate = json['ActualDoctorRate'];
admission = json['Admission'];
clinicID = json['ClinicID'];
companyName = json['CompanyName'];
despensedStatus = json['Despensed_Status'];
dischargeDate = DateUtil.convertStringToDate(json['DischargeDate']);
dischargeNo = json['DischargeNo'];
doctorID = json['DoctorID'];
doctorImageURL = json['DoctorImageURL'];
doctorRate = json['DoctorRate'];
doctorTitle = json['DoctorTitle'];
gender = json['Gender'];
genderDescription = json['GenderDescription'];
isActiveDoctorProfile = json['IsActiveDoctorProfile'];
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
isExecludeDoctor = json['IsExecludeDoctor'];
isInOutPatient = json['IsInOutPatient'];
isInOutPatientDescription = json['IsInOutPatientDescription'];
isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN'];
isInsurancePatient = json['IsInsurancePatient'];
nationalityFlagURL = json['NationalityFlagURL'];
noOfPatientsRate = json['NoOfPatientsRate'];
qR = json['QR'];
// speciality = json['Speciality'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['ProjectID'] = this.projectID;
data['PatientID'] = this.patientID;
data['AppointmentNo'] = this.appointmentNo;
data['AppointmentDate'] = this.appointmentDate;
data['DoctorName'] = this.doctorName;
data['ClinicDescription'] = this.clinicDescription;
data['Name'] = this.name;
data['EpisodeID'] = this.episodeID;
data['ActualDoctorRate'] = this.actualDoctorRate;
data['Admission'] = this.admission;
data['ClinicID'] = this.clinicID;
data['CompanyName'] = this.companyName;
data['Despensed_Status'] = this.despensedStatus;
data['DischargeDate'] = this.dischargeDate;
data['DischargeNo'] = this.dischargeNo;
data['DoctorID'] = this.doctorID;
data['DoctorImageURL'] = this.doctorImageURL;
data['DoctorRate'] = this.doctorRate;
data['DoctorTitle'] = this.doctorTitle;
data['Gender'] = this.gender;
data['GenderDescription'] = this.genderDescription;
data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile;
data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall;
data['IsExecludeDoctor'] = this.isExecludeDoctor;
data['IsInOutPatient'] = this.isInOutPatient;
data['IsInOutPatientDescription'] = this.isInOutPatientDescription;
data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN;
data['IsInsurancePatient'] = this.isInsurancePatient;
data['NationalityFlagURL'] = this.nationalityFlagURL;
data['NoOfPatientsRate'] = this.noOfPatientsRate;
data['QR'] = this.qR;
data['Speciality'] = this.speciality;
return data;
}
}
//class PrescriptionsList {
// String filterName = "";
// List<Prescriptions> prescriptionsList = List();
//
// PrescriptionsList({this.filterName, Prescriptions prescriptions}) {
// prescriptionsList.add(prescriptions);
// }
//}

@ -32,6 +32,7 @@ class OrderModel {
this.taxRates, this.taxRates,
this.orderTax, this.orderTax,
this.orderDiscount, this.orderDiscount,
this.productCount,
this.orderTotal, this.orderTotal,
this.refundedAmount, this.refundedAmount,
this.rewardPointsWereAdded, this.rewardPointsWereAdded,
@ -96,6 +97,7 @@ class OrderModel {
String taxRates; String taxRates;
double orderTax; double orderTax;
dynamic orderDiscount; dynamic orderDiscount;
dynamic productCount;
double orderTotal; double orderTotal;
dynamic refundedAmount; dynamic refundedAmount;
dynamic rewardPointsWereAdded; dynamic rewardPointsWereAdded;
@ -160,6 +162,7 @@ class OrderModel {
taxRates: json["tax_rates"], taxRates: json["tax_rates"],
orderTax: json["order_tax"].toDouble(), orderTax: json["order_tax"].toDouble(),
orderDiscount: json["order_discount"], orderDiscount: json["order_discount"],
productCount: json["product_count"],
orderTotal: json["order_total"].toDouble(), orderTotal: json["order_total"].toDouble(),
refundedAmount: json["refunded_amount"], refundedAmount: json["refunded_amount"],
rewardPointsWereAdded: json["reward_points_were_added"], rewardPointsWereAdded: json["reward_points_were_added"],

@ -0,0 +1,77 @@
class OrdersModel {
List<Orders> orders;
OrdersModel({this.orders});
OrdersModel.fromJson(Map<String, dynamic> json) {
if (json['orders'] != null) {
orders = new List<Orders>();
json['orders'].forEach((v) {
orders.add(new Orders.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.orders != null) {
data['orders'] = this.orders.map((v) => v.toJson()).toList();
}
return data;
}
}
class Orders {
String id;
int productCount;
double orderTotal;
String createdOnUtc;
int orderStatusId;
String orderStatus;
String orderStatusn;
bool canCancel;
bool canRefund;
dynamic customerId;
Orders(
{this.id,
this.productCount,
this.orderTotal,
this.createdOnUtc,
this.orderStatusId,
this.orderStatus,
this.orderStatusn,
this.canCancel,
this.canRefund,
this.customerId,});
Orders.fromJson(Map<String, dynamic> json) {
try {
id = json['id'];
productCount = json['product_count'];
orderTotal = json['order_total'];
createdOnUtc = json['created_on_utc'];
orderStatusId = json['order_status_id'];
orderStatus = json['order_status'];
orderStatusn = json['order_statusn'];
canCancel = json['can_cancel'];
canRefund = json['can_refund'];
customerId = json['customer_id'];
}catch(e){
print(e);
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['product_count'] = this.productCount;
data['order_total'] = this.orderTotal;
data['created_on_utc'] = this.createdOnUtc;
data['order_status_id'] = this.orderStatusId;
data['order_status'] = this.orderStatus;
data['order_statusn'] = this.orderStatusn;
return data;
}
}

@ -6,17 +6,21 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'
import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class PharmacyModuleService extends BaseService { class PharmacyModuleService extends BaseService {
final AppSharedPreferences sharedPref = AppSharedPreferences(); final AppSharedPreferences sharedPref = AppSharedPreferences();
bool isFinished = true; bool isFinished = true;
bool hasError = false; bool hasError = false;
String errorMsg = ''; String errorMsg = '';
String url ="";
List<PharmacyImageObject> bannerItems = List(); List<PharmacyImageObject> bannerItems = List();
List<Manufacturer> manufacturerList = List(); List<Manufacturer> manufacturerList = List();
List<PharmacyProduct> bestSellerProducts = List(); List<PharmacyProduct> bestSellerProducts = List();
List<PharmacyProduct> lastVisitedProducts = List(); List<PharmacyProduct> lastVisitedProducts = List();
Future makeVerifyCustomer(dynamic data) async { Future makeVerifyCustomer(dynamic data) async {
Map<String, String> queryParams = {'FileNumber': data['PatientID'].toString()}; Map<String, String> queryParams = {'FileNumber': data['PatientID'].toString()};
hasError = false; hasError = false;
@ -148,4 +152,5 @@ class PharmacyModuleService extends BaseService {
} }
} }
} }
} }

@ -0,0 +1,53 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
class PrescriptionService extends BaseService {
final AppSharedPreferences sharedPref = AppSharedPreferences();
bool isFinished = true;
bool hasError = false;
String errorMsg = '';
String url = "";
List<Prescriptions> _prescriptionsList = List();
List<Prescriptions> get prescriptionsList => _prescriptionsList;
Future getPrescription() async {
hasError = false;
url = PRESCRIPTION;
print("Print PRESCRIPTION url" + url);
await baseAppClient.get(url,
onSuccess: (dynamic response, int statusCode) {
_prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((item) {
_prescriptionsList.add(Prescriptions.fromJson(item));
});
print(_prescriptionsList.length);
print(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
// Future getPrescription() async {
// hasError = false;
// Map<String, dynamic> body = Map();
// body['isDentalAllowedBackend'] = false;
// await baseAppClient.post(PRESCRIPTION,
// onSuccess: (dynamic response, int statusCode) {
// prescriptionsList.clear();
// response['PatientPrescriptionList'].forEach((prescriptions) {
// prescriptionsList.add(Prescriptions.fromJson(prescriptions));
// });
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// }, body: body);
// }
}

@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_serv
import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../locator.dart'; import '../../../locator.dart';
@ -17,15 +18,12 @@ import '../base_view_model.dart';
class OrderModelViewModel extends BaseViewModel { class OrderModelViewModel extends BaseViewModel {
OrderService _orderService = locator<OrderService>(); OrderService _orderService = locator<OrderService>();
List<Orders> get orders => _orderService.orderList;
List<OrderModel> get order => _orderService.orderList;
OrderDetailsService _orderDetailsService = locator<OrderDetailsService>(); OrderDetailsService _orderDetailsService = locator<OrderDetailsService>();
List<OrderModel> get orderListModel => _orderDetailsService.orderList;
List<OrderModel> get orderDetails => _orderDetailsService.orderDetails;
CancelOrderService _cancelOrderService = locator<CancelOrderService>(); CancelOrderService _cancelOrderService = locator<CancelOrderService>();
List<OrderModel> get cancelOrder => _cancelOrderService.cancelOrderList; List<OrderModel> get cancelOrder => _cancelOrderService.cancelOrderList;
@ -52,9 +50,9 @@ class OrderModelViewModel extends BaseViewModel {
} }
} }
Future getOrderDetails(orderId) async { Future getOrderDetails(OrderId) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderDetailsService.getOrderDetails(orderId); await _orderDetailsService.getOrderDetails(OrderId);
if (_orderDetailsService.hasError) { if (_orderDetailsService.hasError) {
error = _orderDetailsService.error; error = _orderDetailsService.error;
setState(ViewState.Error); setState(ViewState.Error);

@ -3,7 +3,11 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
//import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart';
//import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart'; import '../../../locator.dart';
@ -11,6 +15,8 @@ import '../../../locator.dart';
class PharmacyModuleViewModel extends BaseViewModel { class PharmacyModuleViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>(); PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<PharmacyImageObject> get bannerList => _pharmacyService.bannerItems; List<PharmacyImageObject> get bannerList => _pharmacyService.bannerItems;
List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList; List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList;
@ -21,6 +27,11 @@ class PharmacyModuleViewModel extends BaseViewModel {
List<PharmacyProduct> get lastVisitedProducts => List<PharmacyProduct> get lastVisitedProducts =>
_pharmacyService.lastVisitedProducts; _pharmacyService.lastVisitedProducts;
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
// List<PharmacyProduct> get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ;
Future getPharmacyHomeData() async { Future getPharmacyHomeData() async {
setState(ViewState.Busy); setState(ViewState.Busy);
var data = await sharedPref.getObject(USER_PROFILE); var data = await sharedPref.getObject(USER_PROFILE);
@ -92,6 +103,17 @@ class PharmacyModuleViewModel extends BaseViewModel {
} }
} }
/////////////RecommendedProducts
// _getRecommendedProducts() async {
// await _pharmacyService.getRecommendedProducts();
// if (_pharmacyService.hasError) {
// error = _pharmacyService.error;
// setState(ViewState.Error);
// } else {
// setState(ViewState.Idle);
// }
// }
Future<bool> checkUserIsActivated() async { Future<bool> checkUserIsActivated() async {
if (authenticatedUserObject.isLogin) { if (authenticatedUserObject.isLogin) {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
@ -105,4 +127,17 @@ class PharmacyModuleViewModel extends BaseViewModel {
return false; return false;
} }
} }
getPrescription() async {
print("Print PRESCRIPTION url");
setState(ViewState.Busy);
await _prescriptionService.getPrescription();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
} }

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart';
import 'package:diplomaticquarterapp/core/service/qr_service.dart'; import 'package:diplomaticquarterapp/core/service/qr_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart';
@ -202,6 +203,8 @@ void setupLocator() {
locator.registerLazySingleton(() => CustomerAddressesService()); locator.registerLazySingleton(() => CustomerAddressesService());
locator.registerLazySingleton(() => TermsConditionService()); locator.registerLazySingleton(() => TermsConditionService());
locator.registerLazySingleton(() => CancelOrderService()); locator.registerLazySingleton(() => CancelOrderService());
locator.registerLazySingleton(() => PrescriptionService());
locator.registerLazySingleton(() => PrivilegeService()); locator.registerLazySingleton(() => PrivilegeService());
locator.registerLazySingleton(() => WeatherService()); locator.registerLazySingleton(() => WeatherService());
@ -259,7 +262,6 @@ void setupLocator() {
locator.registerFactory(() => ProductDetailViewModel()); locator.registerFactory(() => ProductDetailViewModel());
locator.registerFactory(() => WeatherViewModel()); locator.registerFactory(() => WeatherViewModel());
locator.registerFactory(() => OrderPreviewViewModel()); locator.registerFactory(() => OrderPreviewViewModel());
locator.registerFactory(() => LacumViewModel()); locator.registerFactory(() => LacumViewModel());
locator.registerFactory(() => LacumTranferViewModel()); locator.registerFactory(() => LacumTranferViewModel());
@ -271,11 +273,15 @@ void setupLocator() {
// Offer And Packages // Offer And Packages
//---------------------- //----------------------
locator.registerLazySingleton(() => OffersAndPackagesServices()); // offerPackagesServices Service locator.registerLazySingleton(
locator.registerFactory(() => OfferCategoriesViewModel()); // Categories View Model () => OffersAndPackagesServices()); // offerPackagesServices Service
locator.registerFactory(() => OfferProductsViewModel()); // Products View Model locator.registerFactory(
() => OfferCategoriesViewModel()); // Categories View Model
locator
.registerFactory(() => OfferProductsViewModel()); // Products View Model
// Geofencing // Geofencing
// --------------------- // ---------------------
locator.registerLazySingleton(() => GeofencingServices()); // Geofencing Services locator.registerLazySingleton(
() => GeofencingServices()); // Geofencing Services
} }

@ -279,6 +279,31 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container(
child: Text(
languageID == 'ar'
? widget.product.shortDescriptionn
: widget.product.shortDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
),
),
SizedBox(
height: 10,
),
Container(
child: Text(
TranslationBase.of(context).howToUse,
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
),
SizedBox(
height: 10,
),
Container( Container(
child: Text( child: Text(
languageID == 'ar' languageID == 'ar'

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart';
@ -15,11 +16,21 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'lacum-activitaion-vida-page.dart'; import 'lacum-activitaion-vida-page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
class PharmacyPage extends StatelessWidget { class PharmacyPage extends StatelessWidget {
@override
void initState() {
// print("model prescription " + model.prescriptionsList.length);
// cancelOrderDetail(order)
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyModuleViewModel>( return BaseView<PharmacyModuleViewModel>(
@ -37,8 +48,242 @@ class PharmacyPage extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
BannerPager(model), BannerPager(model),
GridViewButtons(model), // GridViewButtons(model),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).myPrescription,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
textColor: Colors.green,
vPadding: 6,
hPadding: 4,
handler: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePrescriptionsPage()));
},
),
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
height: MediaQuery.of(context).size.height * 0.30,
// width: 200.0,
// height: MediaQuery.of(context).size.height / 4 + 20,
margin: EdgeInsets.only(left: 10),
child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => model.getPrescription(),
builder: (_, model, wi) => model.prescriptionsList.length != 0
// model.getPrescription();
? ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(),
// itemCount: 4,
itemCount: model.prescriptionsList.length,
itemBuilder: (context, index) {
return Container(
// width: 160.0,
height: MediaQuery.of(context).size.height * 0.6,
padding: EdgeInsets.only(bottom: 5.0, left: 5.0),
margin: EdgeInsets.only(right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0,
),
color: Colors.white,
borderRadius: BorderRadius.circular(10.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Column(children: [
Container(
padding: EdgeInsets.only(
top: 10.0,
left: 10.0,
right: 3.0,
bottom: 15.0,
),
child: Image.network(
model.prescriptionsList[index]
.doctorImageURL,
width: 60,
height: 60,
),
),
]),
Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(left: 1),
padding: EdgeInsets.only(
left: 15.0, right: 15.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style: BorderStyle.solid,
width: 4.0,
),
color: Colors.green,
borderRadius:
BorderRadius.circular(
30.0)),
child: Text(
model.prescriptionsList[index]
.isInOutPatientDescription
.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
)),
Row(children: <Widget>[
Image.asset(
'assets/images/Icon-awesome-calendar.png',
width: 30,
height: 30,
),
Text(
model.prescriptionsList[index]
.appointmentDate
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
)
]),
],
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Row(children: <Widget>[
Text(
model.prescriptionsList[index]
.doctorTitle
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
Text(
model.prescriptionsList[index]
.doctorName
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
]),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
model.prescriptionsList[index]
.clinicDescription
.toString(),
style: TextStyle(
color: Colors.green,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
// initialRating: productRate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
)
]),
]),
);
})
: Container(),
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).recommended,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
textColor: Colors.green,
vPadding: 6,
hPadding: 4,
handler: () {},
),
],
),
),
Container(
height: MediaQuery.of(context).size.height / 4 + 20,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.bestSellerProduct[i]),
scrollDirection: Axis.horizontal,
itemCount: model.bestSellerProduct.length,
),
),
Container( Container(
margin: EdgeInsets.fromLTRB(10, 0, 10, 0), margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
child: Row( child: Row(
@ -55,8 +300,9 @@ class PharmacyPage extends StatelessWidget {
hPadding: 4, hPadding: 4,
borderColor: Colors.green, borderColor: Colors.green,
textColor: Colors.green, textColor: Colors.green,
handler: () =>{ handler: () => {
Navigator.push(context,FadePage(page: ProductBrandsPage())), Navigator.push(
context, FadePage(page: ProductBrandsPage())),
}, },
), ),
], ],
@ -119,8 +365,9 @@ class PharmacyPage extends StatelessWidget {
textColor: Colors.green, textColor: Colors.green,
vPadding: 6, vPadding: 6,
hPadding: 4, hPadding: 4,
handler: () =>{ handler: () => {
Navigator.push(context,FadePage(page: ProductBrandsPage())), Navigator.push(
context, FadePage(page: ProductBrandsPage())),
}, },
), ),
], ],
@ -180,15 +427,15 @@ class GridViewButtons extends StatelessWidget {
hasColorFilter: false, hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).medicationRefill, child: GridViewCard(TranslationBase.of(context).medicationRefill,
'assets/images/pharmacy_module/medication_icon.png', () { 'assets/images/pharmacy_module/medication_icon.png', () {
model.checkUserIsActivated().then((isActivated) { model.checkUserIsActivated().then((isActivated) {
if (isActivated) { if (isActivated) {
Navigator.push(context, FadePage(page: LakumMainPage())); Navigator.push(context, FadePage(page: LakumMainPage()));
} else { } else {
Navigator.push( Navigator.push(
context, FadePage(page: LakumActivationVidaPage())); context, FadePage(page: LakumActivationVidaPage()));
} }
}); });
}), }),
), ),
DashboardItem( DashboardItem(
imageName: 'pharmacy_module/bg_3.png', imageName: 'pharmacy_module/bg_3.png',
@ -196,8 +443,9 @@ class GridViewButtons extends StatelessWidget {
hasColorFilter: false, hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).myPrescriptions, child: GridViewCard(TranslationBase.of(context).myPrescriptions,
'assets/images/pharmacy_module/prescription_icon.png', () { 'assets/images/pharmacy_module/prescription_icon.png', () {
Navigator.push(context, FadePage(page: PharmacyAddressesPage())); Navigator.push(
}), context, FadePage(page: PharmacyAddressesPage()));
}),
), ),
DashboardItem( DashboardItem(
imageName: 'pharmacy_module/bg_4.png', imageName: 'pharmacy_module/bg_4.png',
@ -206,7 +454,7 @@ class GridViewButtons extends StatelessWidget {
child: GridViewCard( child: GridViewCard(
TranslationBase.of(context).searchAndScanMedication, TranslationBase.of(context).searchAndScanMedication,
'assets/images/pharmacy_module/search_scan_icon.png', 'assets/images/pharmacy_module/search_scan_icon.png',
() {}), () {}),
), ),
], ],
), ),

@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
@ -31,11 +32,11 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
String customerId = ""; String customerId = "";
String order =""; String order ="";
List <OrderModel> orderList = [] ; List <Orders> orderList = [] ;
List <OrderModel> deliveredOrderList = [] ; List <Orders> deliveredOrderList = [] ;
List <OrderModel> processingOrderList = []; List <Orders> processingOrderList = [];
List <OrderModel> cancelledOrderList = []; List <Orders> cancelledOrderList = [];
List <OrderModel> pendingOrderList = []; List <Orders> pendingOrderList = [];
TabController _tabController; TabController _tabController;
// AppSharedPreferences sharedPref = AppSharedPreferences(); // AppSharedPreferences sharedPref = AppSharedPreferences();
@ -66,6 +67,8 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: Column( child: Column(
children: [ children: [
TabBar( TabBar(
labelPadding:
EdgeInsets.only(left: 3.0, right: 3.0),
tabs: [ tabs: [
Tab(text: TranslationBase.of(context).delivered), Tab(text: TranslationBase.of(context).delivered),
Tab(text: TranslationBase.of(context).processing), Tab(text: TranslationBase.of(context).processing),
@ -103,16 +106,16 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Widget getDeliveredOrder(OrderModelViewModel model){ Widget getDeliveredOrder(OrderModelViewModel model){
for(int i=0 ; i< model.order.length; i++){ for(int i=0 ; i< model.orders.length; i++){
if( model.order[i].orderStatusId == 30 || model.order[i].orderStatusId == 997 if( model.orders[i].orderStatusId == 30 || model.orders[i].orderStatusId == 997
|| model.order[i].orderStatusId == 994 || model.orders[i].orderStatusId == 994
){ ){
deliveredOrderList.add(model.order[i]); deliveredOrderList.add(model.orders[i]);
} }
} }
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: model.order.length != 0 child: model.orders.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
@ -162,7 +165,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,11), child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,10),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -177,7 +180,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:deliveredOrderList[index]))); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel: deliveredOrderList[index]),));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
languageID == "ar" languageID == "ar"
@ -260,7 +263,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text(deliveredOrderList[index].orderItems.length.toString(), child: Text(deliveredOrderList[index].productCount.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -317,15 +320,15 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
} }
Widget getProcessingOrder(OrderModelViewModel model){ Widget getProcessingOrder(OrderModelViewModel model){
for(int i=0 ; i< model.order.length; i++){ for(int i=0 ; i< model.orders.length; i++){
if( model.order[i].orderStatusId == 20 || model.order[i].orderStatusId == 995 || if( model.orders[i].orderStatusId == 20 || model.orders[i].orderStatusId == 995 ||
model.order[i].orderStatusId == 998 || model.order[i].orderStatusId == 999){ model.orders[i].orderStatusId == 998 || model.orders[i].orderStatusId == 999){
processingOrderList.add(model.order[i]); processingOrderList.add(model.orders[i]);
} }
} }
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: model.order.length != 0 child: model.orders.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
@ -375,7 +378,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,11), child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,10),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -390,8 +393,9 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[index]))); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel :processingOrderList[index])));
},
},
child: SvgPicture.asset( child: SvgPicture.asset(
languageID == "ar" languageID == "ar"
? 'assets/images/pharmacy/arrow_left.svg' ? 'assets/images/pharmacy/arrow_left.svg'
@ -473,7 +477,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text(processingOrderList[index].orderItems.length.toString(), child: Text(processingOrderList[index].productCount.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -709,13 +713,13 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
} }
Widget getPendingOrder(OrderModelViewModel model){ Widget getPendingOrder(OrderModelViewModel model){
for(int i=0 ; i< model.order.length; i++){ for(int i=0 ; i< model.orders.length; i++){
if( model.order[i].orderStatusId == 10){ if( model.orders[i].orderStatusId == 10){
pendingOrderList.add(model.order[i]); pendingOrderList.add(model.orders[i]);
} }
} }
return Container( return Container(
child: model.order.length != 0 child: model.orders.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
@ -766,7 +770,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,11), child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,10),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -782,7 +786,8 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index]))); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index])));
},
},
child: SvgPicture.asset( child: SvgPicture.asset(
languageID == "ar" languageID == "ar"
? 'assets/images/pharmacy/arrow_left.svg' ? 'assets/images/pharmacy/arrow_left.svg'
@ -864,7 +869,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text(pendingOrderList[index].orderItems.length.toString(), child: Text(pendingOrderList[index].productCount.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -924,15 +929,14 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
} }
Widget getCancelledOrder(OrderModelViewModel model){ Widget getCancelledOrder(OrderModelViewModel model){
for(int i=0 ; i< model.orders.length; i++){
for(int i=0 ; i< model.order.length; i++){ if( model.orders[i].orderStatusId == 40 || model.orders[i].orderStatus == 996
if( model.order[i].orderStatusId == 40 || model.order[i].orderStatusId == 996 || model.orders[i].orderStatusId == 200){
|| model.order[i].orderStatusId == 200){ cancelledOrderList.add(model.orders[i]);
cancelledOrderList.add(model.order[i]);
} }
} }
return Container( return Container(
child: model.order.length != 0 child: model.orders.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
@ -983,7 +987,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,11), child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,10),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -998,7 +1002,8 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:cancelledOrderList[index]))); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel: cancelledOrderList[index])));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
languageID == "ar" languageID == "ar"
@ -1081,7 +1086,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text(cancelledOrderList[index].orderItems.length.toString(), child: Text(cancelledOrderList[index].productCount.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
@ -18,15 +19,16 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
dynamic languageID; dynamic languageID;
class OrderDetailsPage extends StatefulWidget {
OrderModel orderModel;
class OrderDetailsPage extends StatefulWidget {
Orders orderModel;
OrderDetailsPage({@required this.orderModel}); OrderDetailsPage({@required this.orderModel});
// Orders orderModel;
// OrderModel orderModelDetails;
// OrderDetailsPage({@required this.orderModel, this.orderModelDetails});
@override @override
_OrderDetailsPageState createState() => _OrderDetailsPageState(); _OrderDetailsPageState createState() => _OrderDetailsPageState();
} }
@ -37,9 +39,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
} }
// AppSharedPreferences sharedPref = AppSharedPreferences(); // AppSharedPreferences sharedPref = AppSharedPreferences();
String orderId = "";
String customerId; String customerId;
List<OrderModel> orderList = []; List<OrderModel> ordersList = [];
List<OrderModel> cancelledOrderList = []; List<OrderModel> cancelledOrderList = [];
@ -55,8 +56,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
void initState() { void initState() {
getLanguageID(); getLanguageID();
super.initState(); super.initState();
print(widget.orderModel.orderItems.length); // print(widget.orderModel.orderItems.length);
getCancelOrder(widget.orderModel.id); getCancelOrder(widget.orderModel.id);
print("ID is" + widget.orderModel.id);
// cancelOrderDetail(order) // cancelOrderDetail(order)
} }
@ -108,8 +111,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
borderRadius: BorderRadius.circular(30.0)), borderRadius: BorderRadius.circular(30.0)),
child: Text( child: Text(
languageID == "ar" languageID == "ar"
? widget.orderModel.orderStatusn.toString(): ? model.orderListModel[0].orderStatusn.toString()
widget.orderModel.orderStatus.toString().substring(12) , : model.orderListModel[0].orderStatus
.toString()
.substring(12),
// TranslationBase.of(context).delivered, // TranslationBase.of(context).delivered,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
@ -126,11 +131,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
widget.orderModel.shippingAddress.firstName model.orderListModel[0].shippingAddress.firstName
.toString() .toString()
.substring(10) + .substring(10) +
' ' + ' ' +
widget.orderModel.shippingAddress.lastName model.orderListModel[0].shippingAddress.lastName
.toString() .toString()
.substring(9), .substring(9),
style: TextStyle( style: TextStyle(
@ -146,7 +151,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
widget.orderModel.shippingAddress.address1 model.orderListModel[0].shippingAddress.address1
.toString() .toString()
.substring(9), .substring(9),
style: TextStyle( style: TextStyle(
@ -154,8 +159,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.grey, color: Colors.grey,
), ),
),] ),
), ]),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
@ -163,14 +168,15 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
widget.orderModel.shippingAddress.address2 model.orderListModel[0].shippingAddress.address2
.toString() .toString()
.substring(9) + .substring(9) +
' ' + ' ' +
widget.orderModel.shippingAddress.country model.orderListModel[0].shippingAddress.country
.toString() + .toString() +
' ' + ' ' +
widget.orderModel.shippingAddress.zipPostalCode model.orderListModel[0].shippingAddress
.zipPostalCode
.toString(), .toString(),
style: TextStyle( style: TextStyle(
fontSize: 10.0, fontSize: 10.0,
@ -193,7 +199,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
Container( Container(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0), margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Text( child: Text(
widget.orderModel.shippingAddress.phoneNumber model.orderListModel[0].shippingAddress.phoneNumber
.toString(), .toString(),
style: TextStyle( style: TextStyle(
fontSize: 15.0, fontSize: 15.0,
@ -232,8 +238,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
Container( Container(
child: flutterImage.Image.asset( child: flutterImage.Image.asset(
widget.orderModel.shippingRateComputationMethodSystemName != model.orderListModel[0]
"Shipping.Aramex" .shippingRateComputationMethodSystemName !=
"Shipping.Aramex"
? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png"
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
fit: BoxFit.contain, fit: BoxFit.contain,
@ -284,7 +291,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
Container( Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0), margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: Text( child: Text(
widget.orderModel.paymentName.toString().substring(12), model.orderListModel[0].paymentName
.toString()
.substring(12),
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -320,23 +329,40 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: ScrollPhysics(), physics: ScrollPhysics(),
itemCount:widget.orderModel.orderItems.length, itemCount: model.orderListModel[0].orderItems.length,
itemBuilder: (context, index){ itemBuilder: (context, index) {
return Container( return Container(
child: productTile(productName: widget.orderModel.orderItems[index].product.name.toString(), child: productTile(
productPrice: widget.orderModel.orderItems[index].product.price.toString(), productName: model
productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(), .orderListModel[0].orderItems[index].product.name
productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews, .toString(),
totalPrice: "${(widget.orderModel.orderItems[index].product.price productPrice: model
* widget.orderModel.orderItems[index].quantity).toStringAsFixed(2)}", .orderListModel[0].orderItems[index].product.price
qyt: widget.orderModel.orderItems[index].quantity.toString(), .toString(),
isOrderDetails:true, productRate: model.orderListModel[0].orderItems[index]
imgs: widget.orderModel.orderItems[index].product.images != null && .product.approvedRatingSum
widget.orderModel.orderItems[index].product.images.length != 0 .toDouble(),
? widget.orderModel.orderItems[index].product.images [0].src.toString() productReviews: model.orderListModel[0]
.orderItems[index].product.approvedTotalReviews,
totalPrice:
"${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}",
qyt: model
.orderListModel[0].orderItems[index].quantity
.toString(),
isOrderDetails: true,
imgs: model.orderListModel[0].orderItems[index]
.product.images !=
null &&
model.orderListModel[0].orderItems[index]
.product.images.length !=
0
? model.orderListModel[0].orderItems[index]
.product.images[0].src
.toString()
: null, : null,
status: widget.orderModel.orderStatusId, status: model.orderListModel[0].orderStatusId,
product: widget.orderModel.orderItems[index].product, product:
model.orderListModel[0].orderItems[index].product,
), ),
); );
}), }),
@ -385,7 +411,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
Text( Text(
widget.orderModel.orderSubtotalExclTax.toString(), model.orderListModel[0].orderSubtotalExclTax
.toString(),
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -423,7 +450,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
Text( Text(
widget.orderModel.orderShippingExclTax.toString(), model.orderListModel[0].orderShippingExclTax
.toString(),
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -461,7 +489,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
Text( Text(
widget.orderModel.orderTax.toString(), model.orderListModel[0].orderTax.toString(),
style: TextStyle( style: TextStyle(
fontSize: 13.0, fontSize: 13.0,
), ),
@ -499,7 +527,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
Text( Text(
widget.orderModel.orderTotal.toString(), model.orderListModel[0].orderTotal.toString(),
style: TextStyle( style: TextStyle(
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -510,83 +538,83 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
], ],
), ),
widget.orderModel.orderStatusId == 10 model.orderListModel[0].orderStatusId == 10
? InkWell( ? InkWell(
onTap: () { onTap: () {
model.makeOrder(); model.makeOrder();
}, },
child: Container( child: Container(
// margin: EdgeInsets.only(top: 20.0), // margin: EdgeInsets.only(top: 20.0),
height: 50.0, height: 50.0,
color: Colors.transparent, color: Colors.transparent,
child: Container( child: Container(
padding: EdgeInsets.only(left: 130.0, right: 130.0), padding: EdgeInsets.only(left: 130.0, right: 130.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Colors.green, color: Colors.green,
style: BorderStyle.solid, style: BorderStyle.solid,
width: 4.0), width: 4.0),
color: Colors.green, color: Colors.green,
borderRadius: BorderRadius.circular(5.0)), borderRadius: BorderRadius.circular(5.0)),
child: Center( child: Center(
child: Text( child: Text(
TranslationBase.of(context).payOnline, TranslationBase.of(context).payOnline,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
),
),
),
), ),
), ),
), )
),
),
)
: Container(), : Container(),
// getCancelOrder(canCancel, canRefund), // getCancelOrder(canCancel, canRefund),
isCancel isCancel
? InkWell( ? InkWell(
onTap: () { onTap: () {
presentConfirmDialog(model, presentConfirmDialog(model, widget.orderModel.id);
widget.orderModel.id); //(widget.orderModel.id)); // model.orderListModel[0].id//(widget.orderModel.id));
// //
}, },
child: Container( child: Container(
// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), // padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
height: 50.0, height: 50.0,
color: Colors.transparent, color: Colors.transparent,
child: Center( child: Center(
child: Text( child: Text(
TranslationBase.of(context).cancelOrder, TranslationBase.of(context).cancelOrder,
style: TextStyle( style: TextStyle(
color: Colors.red[900], color: Colors.red[900],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
decoration: TextDecoration.underline), decoration: TextDecoration.underline),
), ),
), ),
), ),
) )
: Container(), : Container(),
isActiveDelivery isActiveDelivery
? InkWell( ? InkWell(
onTap: () { onTap: () {
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute(builder: (context) => TrackDriver(order: widget.orderModel), // MaterialPageRoute(builder: (context) => TrackDriver(order: widget.orderModel),
)); // ));
}, },
child: Container( child: Container(
height: 50.0, height: 50.0,
color: Colors.transparent, color: Colors.transparent,
child: Center( child: Center(
child: Text( child: Text(
TranslationBase.of(context).trackDeliveryDriver, TranslationBase.of(context).trackDeliveryDriver,
style: TextStyle( style: TextStyle(
color: Colors.green[900], color: Colors.green[900],
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
decoration: TextDecoration.none), decoration: TextDecoration.none),
), ),
), ),
), ),
) )
: Container(), : Container(),
], ],
), ),
@ -655,6 +683,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => OrderPage( builder: (context) => OrderPage(
// customerID: model.ordersList[0].customerId.toString()
customerID: widget.orderModel.customerId.toString())), customerID: widget.orderModel.customerId.toString())),
); );
}), }),

File diff suppressed because it is too large Load Diff

@ -16,20 +16,20 @@ class OrderDetailsService extends BaseService{
AuthenticatedUser authUser = new AuthenticatedUser(); AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider(); AuthProvider authProvider = new AuthProvider();
// String url ="";
List<OrderModel> get orderDetails => orderDetails; // List<OrderModel> get orderDetails => ordeDetails;
List<OrderModel> _orderList = List(); List<OrderModel> _orderList = List();
List<OrderModel> get orderList => _orderList; List<OrderModel> get orderList => _orderList;
Future getOrderDetails(orderId) async { Future getOrderDetails(OrderId) async {
print("step 2" + orderId);
hasError = false; hasError = false;
await baseAppClient.getPharmacy(GET_ORDER_DETAILS+orderId, await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_orderList.clear(); _orderList.clear();
response['orders'].forEach((item) { response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item)); _orderList.add(OrderModel.fromJson(item));
print(response);
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;

@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart';
class OrderService extends BaseService{ class OrderService extends BaseService{
@ -14,21 +14,23 @@ class OrderService extends BaseService{
AuthenticatedUser authUser = new AuthenticatedUser(); AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider(); AuthProvider authProvider = new AuthProvider();
List<OrderModel> _orderList = List(); List<Orders> _orderList = List();
List<OrderModel> get orderList => _orderList; List<Orders> get orderList => _orderList;
String url =""; String url ="";
Future getOrder(customerId, pageId) async { Future getOrder(customerId, pageId) async {
hasError = false; hasError = false;
// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368";
url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId";
url =GET_ORDER+"customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId";
print(url); print(url);
await baseAppClient.getPharmacy(url, await baseAppClient.getPharmacy(url,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_orderList.clear(); _orderList.clear();
response['orders'].forEach((item) { response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item)); _orderList.add(Orders.fromJson(item));
}); });
print(_orderList.length); print(_orderList.length);
print(response); print(response);
@ -39,25 +41,27 @@ class OrderService extends BaseService{
} }
Future getProductReview(orderId) async { // Future getProductReview(orderId) async {
print("step 1"); // print("step 1");
hasError = false; // hasError = false;
url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368";
// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$page_id&limit=200&customer_id=$custmerId"; //// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$page_id&limit=200&customer_id=$custmerId";
print(url); // print(url);
await baseAppClient.getPharmacy(url, // await baseAppClient.getPharmacy(url,
onSuccess: (dynamic response, int statusCode) { // onSuccess: (dynamic response, int statusCode) {
_orderList.clear(); // _orderList.clear();
response['orders'].forEach((item) { // response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item)); // _orderList.add(OrderModel.fromJson(item));
}); // });
print(_orderList.length); // print(_orderList.length);
print(response); // print(response);
}, onFailure: (String error, int statusCode) { // }, onFailure: (String error, int statusCode) {
hasError = true; // hasError = true;
super.error = error; // super.error = error;
}); // });
} // }
// Future<Map> getOrder(BuildContext context ) async { // Future<Map> getOrder(BuildContext context ) async {
// //
// if (await this.sharedPref.getObject(USER_PROFILE) != null) { // if (await this.sharedPref.getObject(USER_PROFILE) != null) {

@ -264,6 +264,7 @@ class TranslationBase {
localizedValues['pharmaciesList'][locale.languageCode]; localizedValues['pharmaciesList'][locale.languageCode];
String get description => localizedValues['description'][locale.languageCode]; String get description => localizedValues['description'][locale.languageCode];
String get howToUse => localizedValues['howToUse'][locale.languageCode];
String get price => localizedValues['price'][locale.languageCode]; String get price => localizedValues['price'][locale.languageCode];
@ -783,6 +784,7 @@ class TranslationBase {
String get recentlyViewed => String get recentlyViewed =>
localizedValues['recentlyViewed'][locale.languageCode]; localizedValues['recentlyViewed'][locale.languageCode];
String get bestSellers => localizedValues['bestSellers'][locale.languageCode]; String get bestSellers => localizedValues['bestSellers'][locale.languageCode];
String get recommended => localizedValues['recommended'][locale.languageCode];
String get deleteAllItems => String get deleteAllItems =>
localizedValues['deleteAllItems'][locale.languageCode]; localizedValues['deleteAllItems'][locale.languageCode];
String get selectAddress => String get selectAddress =>

Loading…
Cancel
Save