fixe order and order details

merge-update-with-lab-changes
Fatimah Alshammari 5 years ago
parent 8400254020
commit 9b8103bfd6

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

@ -349,7 +349,8 @@ const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/";
const GET_WISHLIST = "epharmacy/api/shopping_cart_items/"; const GET_WISHLIST = "epharmacy/api/shopping_cart_items/";
const GET_ORDER = "orders?"; const GET_ORDER = "orders?";
const GET_ORDER_DETAILS ="epharmacy/api/orders/"; const GET_ORDER_DETAILS ="epharmacy/api/orders/";
const GET_ADDRESS ="epharmacy/api/Customers/272843?fields=addresses"; const GET_ADDRESS ="Customers/";
const GET_Cancel_ORDER ="cancelorder/";
// Home Health Care // Home Health Care
const HHC_GET_ALL_SERVICES = const HHC_GET_ALL_SERVICES =
"Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; "Services/Patients.svc/REST/PatientER_HHC_GetAllServices";

@ -642,6 +642,11 @@ const Map<String, Map<String, String>> localizedValues = {
"cancelled": {"en": "Cancelled", "ar": " ملغي"}, "cancelled": {"en": "Cancelled", "ar": " ملغي"},
"writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"}, "writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"},
"shareReview": {"en": "SHARE REVIEW", "ar": " اكتب تقييمك"}, "shareReview": {"en": "SHARE REVIEW", "ar": " اكتب تقييمك"},
"review": {"en": " reviews", "ar": " تقييمات"},
"deliveredOrder": {"en": " DELIVERED", "ar": " تم التوصيل"},
"compare": {"en": " Compare", "ar": "مقارنه"},
"medicationsRefill": {"en": " Medication Refill", "ar": "اعادة تعبئة الدواء"},
"myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"},
"backMyAccount": { "backMyAccount": {
"en": "BACK TO MY ACCOUNT ", "en": "BACK TO MY ACCOUNT ",
"ar": " الرجوع لحسابي الشخصي" "ar": " الرجوع لحسابي الشخصي"

@ -6,19 +6,19 @@ import '../../../locator.dart';
import '../base_view_model.dart'; import '../base_view_model.dart';
class PharmacyAddressesViewModel extends BaseViewModel { class PharmacyAddressesViewModel extends BaseViewModel {
PharmacyAddressService _PharmacyAddressService = locator<PharmacyAddressService>(); PharmacyAddressService _pharmacyAddressService = locator<PharmacyAddressService>();
List<PharmacyAddressesModel> get address => _pharmacyAddressService.address;
List<PharmacyAddressesModel> get address => _PharmacyAddressService.address;
Future getAddress(address) async {
Future getAddress() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _PharmacyAddressService.getAddress(); await _pharmacyAddressService.getAddress(address);
if (_PharmacyAddressService.hasError) { if (_pharmacyAddressService.hasError) {
error = _PharmacyAddressService.error; error = _pharmacyAddressService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
print(address.length);
} }
} }
} }

@ -1,3 +1,5 @@
//import 'dart:html';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
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';
@ -6,6 +8,7 @@ import '../../../locator.dart';
import '../base_view_model.dart'; import '../base_view_model.dart';
class OrderModelViewModel extends BaseViewModel { class OrderModelViewModel extends BaseViewModel {
OrderService _orderService = locator<OrderService>(); OrderService _orderService = locator<OrderService>();
List<OrderModel> get order => _orderService.orderList; List<OrderModel> get order => _orderService.orderList;
@ -22,7 +25,9 @@ class OrderModelViewModel extends BaseViewModel {
error = _orderService.error; error = _orderService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
//order = _orderService.orderList;
print(order.length);
setState(ViewState.Idle);
} }
} }
@ -36,4 +41,20 @@ class OrderModelViewModel extends BaseViewModel {
} }
} }
Future getProductReview(orderId) async {
setState(ViewState.Busy);
await _orderService.getProductReview(orderId);
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
//order = _orderService.orderList;
print(order.length);
setState(ViewState.Idle);
}
}
} }

@ -489,7 +489,7 @@ class _HomePageState extends State<HomePage> {
), ),
DashboardItem( DashboardItem(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, FadePage(page: OrderPage())), context, FadePage(page: PharmacyProfilePage())),
child: Center( child: Center(
child: Padding( child: Padding(

@ -8,11 +8,13 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; 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/config/shared_pref_kay.dart';
class OrderPage extends StatefulWidget { class OrderPage extends StatefulWidget {
// orderList({this.customerId, this.pageId}); // orderList({this.customerId, this.pageId});
var languageID ;
@override @override
_OrderPageState createState() => _OrderPageState(); _OrderPageState createState() => _OrderPageState();
} }
@ -21,17 +23,19 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
String customerId=""; String customerId="";
String page_id=""; String page_id="";
List delivered = [] ; List <OrderModel> orderList = [] ;
List processing = []; List <OrderModel> deliveredOrderList = [] ;
List cancelled = []; List <OrderModel> processingOrderList = [];
List pending = []; List <OrderModel> cancelledOrderList = [];
List <OrderModel> pendingOrderList = [];
TabController _tabController; TabController _tabController;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
@override @override
void initState() { void initState() {
// WidgetsBinding.instance.addPostFrameCallback((_) => getOrder()); // WidgetsBinding.instance.addPostFrameCallback((_) => getOrder());
getLanguageID();
super.initState(); super.initState();
_tabController = new TabController(length: 4, vsync: this,); _tabController = new TabController(length: 4, vsync: this,);
} }
@ -41,11 +45,8 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
return BaseView<OrderModelViewModel>( return BaseView<OrderModelViewModel>(
onModelReady: (model) => model.getOrder(customerId, page_id), onModelReady: (model) => model.getOrder(customerId, page_id),
builder: (_,model, wi )=> AppScaffold( builder: (_,model, wi )=> AppScaffold(
appBarTitle:(TranslationBase.of(context).order), appBarTitle:TranslationBase.of(context).order,
// backgroundColor: Colors.green , baseViewModel: model,
// centerTitle: true,
// title: Text(TranslationBase.of(context).order, style: TextStyle(color:Colors.white)),
// backgroundColor: Colors.green,
isShowAppBar: true, isShowAppBar: true,
isPharmacy:true , isPharmacy:true ,
body: Container( body: Container(
@ -54,7 +55,6 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
TabBar( TabBar(
tabs: [ tabs: [
Tab(text: TranslationBase.of(context).delivered), Tab(text: TranslationBase.of(context).delivered),
// Tab(text: model.order.length.toString()),
Tab(text: TranslationBase.of(context).processing), Tab(text: TranslationBase.of(context).processing),
Tab(text: TranslationBase.of(context).pending), Tab(text: TranslationBase.of(context).pending),
Tab(text: TranslationBase.of(context).cancelled), Tab(text: TranslationBase.of(context).cancelled),
@ -87,10 +87,19 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
); );
} }
Widget getDeliveredOrder(OrderModelViewModel model){ Widget getDeliveredOrder(OrderModelViewModel model){
for(int i=0 ; i< model.order.length; i++){
if( model.order[i].orderStatusId == 30 || model.order[i].orderStatusId == 997
|| model.order[i].orderStatusId == 994
){
deliveredOrderList.add(model.order[i]);
}
}
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: model.order.length != 0 && model.order[0].orderStatusId == 30 child: model.order.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
@ -98,7 +107,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: ScrollPhysics(), physics: ScrollPhysics(),
itemCount: 2 , itemCount: deliveredOrderList.length,
itemBuilder: (context, index){ itemBuilder: (context, index){
return Container( return Container(
child: Column( child: Column(
@ -121,7 +130,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].id.toString(), child: Text(deliveredOrderList[index].id.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -140,7 +149,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].createdOnUtc.toString(), child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -155,7 +164,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage())); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:deliveredOrderList[index])));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg', 'assets/images/pharmacy/arrow_right.svg',
@ -175,8 +184,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Container(
child: Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 13.0, right: 13.0), padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -189,8 +197,8 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
borderRadius: BorderRadius.circular(30.0) borderRadius: BorderRadius.circular(30.0)
), ),
child: Text( child: Text(
model.order[0].orderStatus.toString(), // deliveredOrderList[0].orderStatus.toString().substring(12),
// TranslationBase.of(context).delivered, TranslationBase.of(context).deliveredOrder,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,
@ -198,7 +206,6 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
), ),
),
Container( Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column( child: Column(
@ -208,7 +215,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
children: [ children: [
Container( Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Text(model.order[0].orderTotal.toString(), child: Text(deliveredOrderList[index].orderTotal.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -227,7 +234,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text('12', child: Text(deliveredOrderList[index].orderItems.length.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -267,7 +274,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Image.asset( SvgPicture.asset(
'assets/images/pharmacy/empty_box.svg'), 'assets/images/pharmacy/empty_box.svg'),
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
@ -284,16 +291,32 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
} }
Widget getProcessingOrder(OrderModelViewModel model){ Widget getProcessingOrder(OrderModelViewModel model){
for(int i=0 ; i< model.order.length; i++){
if( model.order[i].orderStatusId == 20 || model.order[i].orderStatusId == 995 ||
model.order[i].orderStatusId == 998 || model.order[i].orderStatusId == 999){
processingOrderList.add(model.order[i]);
}
}
return Container( return Container(
child: model.order.length != 0 && model.order[0].orderStatusId == 20 width: MediaQuery.of(context).size.width,
child: model.order.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column(
children:<Widget> [
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: processingOrderList.length,
itemBuilder: (context, index){
return Container(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [ children:<Widget> [
Container( Container(
margin: EdgeInsets.all(8), margin: EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [ children:<Widget> [
@ -307,7 +330,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].id.toString(), child: Text(processingOrderList[index].id.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -326,7 +349,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].createdOnUtc.toString(), child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -337,11 +360,11 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
margin: EdgeInsets.all(8), margin: EdgeInsets.all(8.0),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage())); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[index])));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg', 'assets/images/pharmacy/arrow_right.svg',
@ -361,8 +384,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Container(
child: Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 13.0, right: 13.0), padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -375,8 +397,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
borderRadius: BorderRadius.circular(30.0) borderRadius: BorderRadius.circular(30.0)
), ),
child: Text( child: Text(
model.order[0].orderStatus.toString(), processingOrderList[index].orderStatus.toString().substring(12),
// TranslationBase.of(context).processing,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,
@ -384,7 +405,6 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
), ),
),
Container( Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column( child: Column(
@ -394,7 +414,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
children: [ children: [
Container( Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Text(model.order[0].orderTotal.toString(), child: Text(processingOrderList[index].orderTotal.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -413,7 +433,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text('12', child: Text(processingOrderList[index].orderItems.length.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -441,6 +461,11 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
], ],
), ),
);
}
)
],
),
) )
: Container( : Container(
child: Center( child: Center(
@ -448,7 +473,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Image.asset( SvgPicture.asset(
'assets/images/pharmacy/empty_box.svg'), 'assets/images/pharmacy/empty_box.svg'),
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
@ -462,11 +487,195 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
); );
// return Container(
// child: model.order.length != 0
// ? SingleChildScrollView(
// child: Column(
// children:<Widget> [
// ListView.builder(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children:<Widget> [
// Container(
// margin: EdgeInsets.all(8),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children:<Widget> [
// Row(
// children: [
// Container(
// margin: EdgeInsets.only(right: 5),
// child: Text(TranslationBase.of(context).orderNumber,
// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
// ),
// ),
// ),
// Container(
// child: Text(processingOrderList[0].id.toString(),
// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ],
// ),
// SizedBox(
// height: 5,),
// Row(
// children: [
// Container(
// margin: EdgeInsets.only(right: 5),
// child: Text(TranslationBase.of(context).orderDate,
// style: TextStyle(fontSize: 14.0,
// ),
// ),
// ),
// Container(
// child: Text(processingOrderList[0].createdOnUtc.toString().substring(0,11),
// style: TextStyle(fontSize: 14.0,
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// ),
// Container(
// margin: EdgeInsets.all(8),
// child: InkWell(
// onTap: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[0])));
// },
// child: SvgPicture.asset(
// 'assets/images/pharmacy/arrow_right.svg',
// height: 20,
// width: 20,),
// ),
// ),
// ],
// ),
// ),
// Divider(
// color: Colors.grey[350],
// height: 20,
// thickness: 1,
// indent: 0,
// endIndent: 0,
// ),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: <Widget>[
// Container(
// margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
// padding: EdgeInsets.only(left: 13.0, right: 13.0),
// decoration: BoxDecoration(
// border: Border.all(
// color: Colors.green,
// style: BorderStyle.solid,
// width: 5.0,
// ),
// color: Colors.green,
// borderRadius: BorderRadius.circular(30.0)
// ),
// child: Text( widget.languageID == "ar"
// ? processingOrderList[0].orderStatusn.toString()
// : processingOrderList[0].orderStatus.toString().substring(12),
//// TranslationBase.of(context).processing,
// style: TextStyle(
// color: Colors.white,
// fontSize: 15.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// Container(
// margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
// child: Column(
//// crossAxisAlignment: CrossAxisAlignment.end,
// children:<Widget> [
// Row(
// children: [
// Container(
// margin: EdgeInsets.only(left: 5),
// child: Text(processingOrderList[0].orderTotal.toString(),
// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
// ),
// ),
// ),
// Container(
// margin: EdgeInsets.only(left: 5),
// child: Text(TranslationBase.of(context).sar,
// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ],
// ),
// SizedBox(
// height: 5,),
// Row(
// children: [
// Container(
// child: Text(processingOrderList[0].orderItems[0].quantity.toString(),
// style: TextStyle(fontSize: 14.0,
// ),
// ),
// ),
// Container(
// margin: EdgeInsets.only(left: 5),
// child: Text(TranslationBase.of(context).itemsNo,
// style: TextStyle(fontSize: 14.0,
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// ),
// ],
// ),
// Divider(
// color: Colors.grey[350],
// height: 20,
// thickness: 8,
// indent: 0,
// endIndent: 0,
// ),
// ],
// ),
// )
// : Container(
// child: Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// SvgPicture.asset(
// 'assets/images/pharmacy/empty_box.svg'),
// Container(
// margin: EdgeInsets.only(top: 10.0),
// child: Text(TranslationBase.of(context).noOrder,
// style: TextStyle(
// fontSize: 16.0,
// )),
// ),
// ],
// ),
// ),
// ),
// );
} }
Widget getPendingOrder(OrderModelViewModel model){ Widget getPendingOrder(OrderModelViewModel model){
for(int i=0 ; i< model.order.length; i++){
if( model.order[i].orderStatusId == 10){
pendingOrderList.add(model.order[i]);
}
}
return Container( return Container(
child: model.order.length != 0 && model.order[0].orderStatusId == 10 child: model.order.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
@ -474,7 +683,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: ScrollPhysics(), physics: ScrollPhysics(),
itemCount: 2 , itemCount: pendingOrderList.length ,
itemBuilder: (context, index){ itemBuilder: (context, index){
return Container( return Container(
child: SingleChildScrollView( child: SingleChildScrollView(
@ -498,7 +707,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].id.toString(), child: Text(pendingOrderList[index].id.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -517,7 +726,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].createdOnUtc.toString(), child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -532,7 +741,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage())); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index])));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg', 'assets/images/pharmacy/arrow_right.svg',
@ -552,8 +761,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Container(
child:Container(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
padding: EdgeInsets.only(left: 13.0, right: 13.0), padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -566,14 +774,16 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
borderRadius: BorderRadius.circular(30.0) borderRadius: BorderRadius.circular(30.0)
), ),
child: Text( child: Text(
model.order[0].orderStatus.toString(), widget.languageID == "ar"
? pendingOrderList[index].orderStatusn.toString()
: pendingOrderList[index].orderStatus.toString().substring(12),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), ), ),
Container( Container(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
child: Column( child: Column(
@ -583,7 +793,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
children: [ children: [
Container( Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Text(model.order[0].orderTotal.toString(), child: Text(pendingOrderList[index].orderTotal.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -602,7 +812,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text('12', child: Text(pendingOrderList[index].orderItems.length.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -644,7 +854,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Image.asset( SvgPicture.asset(
'assets/images/pharmacy/empty_box.svg'), 'assets/images/pharmacy/empty_box.svg'),
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
@ -662,8 +872,14 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
} }
Widget getCancelledOrder(OrderModelViewModel model){ Widget getCancelledOrder(OrderModelViewModel model){
for(int i=0 ; i< model.order.length; i++){
if( model.order[i].orderStatusId == 40 || model.order[i].orderStatusId == 996
|| model.order[i].orderStatusId == 200){
cancelledOrderList.add(model.order[i]);
}
}
return Container( return Container(
child: model.order.length != 0 && model.order[0].orderStatusId == 40 child: model.order.length != 0
? SingleChildScrollView( ? SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
@ -671,7 +887,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: ScrollPhysics(), physics: ScrollPhysics(),
itemCount: 2 , itemCount: cancelledOrderList.length,
itemBuilder: (context, index){ itemBuilder: (context, index){
return Container( return Container(
child: SingleChildScrollView( child: SingleChildScrollView(
@ -695,7 +911,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].id.toString(), child: Text(cancelledOrderList[index].id.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -714,7 +930,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
), ),
Container( Container(
child: Text(model.order[0].createdOnUtc.toString(), child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -729,7 +945,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage())); MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:cancelledOrderList[index])));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg', 'assets/images/pharmacy/arrow_right.svg',
@ -749,8 +965,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Container(
child:Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 10.0, right: 10.0), padding: EdgeInsets.only(left: 10.0, right: 10.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -762,15 +977,16 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
color: Colors.red[900], color: Colors.red[900],
borderRadius: BorderRadius.circular(30.0) borderRadius: BorderRadius.circular(30.0)
), ),
child: Text( child: Text( widget.languageID == "ar"
model.order[0].orderStatus.toString(), ? cancelledOrderList[index].orderStatusn.toString()
: cancelledOrderList[index].orderStatus.toString().substring(12),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), ), ),
Container( Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column( child: Column(
@ -780,7 +996,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
children: [ children: [
Container( Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Text(model.order[0].orderTotal.toString(), child: Text(cancelledOrderList[index].orderTotal.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -799,7 +1015,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row( Row(
children: [ children: [
Container( Container(
child: Text('12', child: Text(cancelledOrderList[index].orderItems.length.toString(),
style: TextStyle(fontSize: 14.0, style: TextStyle(fontSize: 14.0,
), ),
), ),
@ -841,7 +1057,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Image.asset( SvgPicture.asset(
'assets/images/pharmacy/empty_box.svg'), 'assets/images/pharmacy/empty_box.svg'),
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
@ -856,26 +1072,17 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
); );
} }
}
getLanguageID() async {
var languageID = await sharedPref.getString(APP_LANGUAGE);
setState(() {
widget.languageID = languageID;
});
}
}
// filterOrders() {
// for () {
// if (order.order_status_id === 30 || order.order_status_id === 997 || order.order_status_id === 994) { // complete
// this.delivered.push(order);
// } else if (order.order_status_id === 40 || order.order_status_id === 200 || order.order_status_id === 996) { // cancelled & order refunded
// this.cancelled.push(order);
// } else if (order.order_status_id === 10) { // Pending
// this.pending.push(order);
// } else if (order.order_status_id === 20 || order.order_status_id === 995 || order.order_status_id === 998 || order.order_status_id === 999) { // Processing
// this.processing.push(order);
// } else { // Processing & other all other status
// this.other.push(order);
// }
// }
//}

@ -1,6 +1,8 @@
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/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -9,11 +11,24 @@ import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
class OrderDetailsPage extends StatefulWidget { class OrderDetailsPage extends StatefulWidget {
var languageID ;
OrderModel orderModel;
OrderDetailsPage({
@required this.orderModel
});
@override @override
_OrderDetailsPageState createState() => _OrderDetailsPageState(); _OrderDetailsPageState createState() => _OrderDetailsPageState();
} }
@ -23,20 +38,28 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
String customerId=""; String customerId="";
String page_id=""; String page_id="";
String orderId="3516"; String orderId="3516";
var model;
var isCancel = false;
var isRefund = false;
var dataIsCancel;
var dataIsRefund;
@override @override
void initState() { void initState() {
WidgetsBinding.instance.addPostFrameCallback((_) => getOrderDetails());
super.initState(); super.initState();
getLanguageID();
getCancelOrder(widget.orderModel.id);
// cancelOrderDetail(widget.orderModel.id);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<OrderModelViewModel>( return BaseView<OrderModelViewModel>(
onModelReady:(model) => model.getOrderDetails(orderId), onModelReady:(model) => model.getOrderDetails(widget.orderModel.id),
builder: (_,model, wi )=> AppScaffold( builder: (_,model, wi )=> AppScaffold(
appBarTitle: (TranslationBase.of(context).orderDetail), appBarTitle: TranslationBase.of(context).orderDetail,
// title: Text(TranslationBase.of(context).orderDetail, style: TextStyle(color:Colors.white)),
// backgroundColor: Colors.green,
isShowAppBar: true, isShowAppBar: true,
isPharmacy:true , isPharmacy:true ,
body: Container( body: Container(
@ -63,19 +86,23 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.only(top: 15.0, right: 10.0), margin: EdgeInsets.only(top: 15.0, right: 10.0),
padding: EdgeInsets.only(left: 11.0, right: 11.0), padding: EdgeInsets.only(left: 11.0, right: 11.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Colors.blue, color: getStatusBackgroundColor(),
style: BorderStyle.solid, style: BorderStyle.solid,
width: 5.0, width: 5.0,
), ),
color: Colors.blue, color: getStatusBackgroundColor(),
borderRadius: BorderRadius.circular(30.0) borderRadius: BorderRadius.circular(30.0)
), ),
child: Text( child: Text(widget.orderModel.orderStatus.toString().substring(12),
TranslationBase.of(context).delivered, // widget.languageID == "ar"
// ? widget.orderModel.orderStatusn.toString()
// : widget.orderModel.orderStatus.toString().substring(12) ,
// TranslationBase.of(context).delivered,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 13.0, fontSize: 13.0,
@ -90,11 +117,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [ children:<Widget> [
Text('NAME', Text(model.order[0].shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9),
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
), ),
), ),
], ]
), ),
), ),
Container( Container(
@ -102,7 +129,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [ children:<Widget> [
Text('Cloud Solutions', Text(model.order[0].shippingAddress.address1.toString().substring(9),
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
color: Colors.grey, color: Colors.grey,
), ),
@ -110,7 +137,21 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
], ],
), ),
), ),
Row( Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text(model.order[0].shippingAddress.address2.toString().substring(9),
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
color: Colors.grey,
),
),
]
),
),
Container(
child: Row(
children:<Widget> [ children:<Widget> [
Container( Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0),
@ -120,13 +161,14 @@ 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('588888778', child: Text(model.order[0].shippingAddress.phoneNumber.toString(),
style: TextStyle(fontSize: 15.0, style: TextStyle(fontSize: 15.0,
), ),
), ),
), ),
], ],
), ),
),
Divider( Divider(
color: Colors.grey[350], color: Colors.grey[350],
height: 20, height: 20,
@ -151,11 +193,21 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
Container( Container(
child: model.order[0].shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight"
? Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0), margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/hmg_shipping_logo.svg', 'assets/images/pharmacy/hmg_shipping_logo.svg',
height: 25, height: 25,
width: 25,), width: 25,),
)
: Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: SvgPicture.asset(
'assets/images/pharmacy/aramex_shipping_logo.svg',
height: 25,
width: 25,),
),
), ),
], ],
), ),
@ -184,7 +236,7 @@ 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('Mada', child:Text(model.order[0].paymentName.toString().substring(12),
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -211,10 +263,23 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
], ],
), ),
), ),
Container( ListView.builder(
child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00, scrollDirection: Axis.vertical,
productReviews:4, totalPrice: '10.00', qyt: '3',), shrinkWrap: true,
physics: ScrollPhysics(),
itemCount:widget.orderModel.orderItems.length,
itemBuilder: (context, index){
return Container(
child: productTile(productName: widget.orderModel.orderItems[index].product.name.toString(),
productPrice: widget.orderModel.orderItems[index].product.price.toString(),
productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(),
productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews,
totalPrice: widget.orderModel.orderItems[index].priceExclTax.toString(),
qyt: widget.orderModel.orderItems[index].quantity.toString(),),
);
}
), ),
Container( Container(
padding: EdgeInsets.only(bottom: 10.0), padding: EdgeInsets.only(bottom: 10.0),
margin: EdgeInsets.only(left: 10.0, top: 5.0), margin: EdgeInsets.only(left: 10.0, top: 5.0),
@ -253,7 +318,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
), ),
Text('343.55', Text(model.order[0].orderSubtotalExclTax.toString(),
style: TextStyle(fontSize: 13.0, style: TextStyle(fontSize: 13.0,
), ),
), ),
@ -287,7 +352,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
), ),
Text('343.55', Text(model.order[0].orderShippingExclTax.toString(),
style: TextStyle(fontSize: 13.0, style: TextStyle(fontSize: 13.0,
), ),
), ),
@ -321,7 +386,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
), ),
Text('343.55', Text(model.order[0].orderTax.toString(),
style: TextStyle(fontSize: 13.0, style: TextStyle(fontSize: 13.0,
), ),
), ),
@ -353,7 +418,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
), ),
Text('343.55', Text(model.order[0].orderTotal.toString(),
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -362,14 +427,16 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
], ],
), ),
InkWell( widget.orderModel.orderStatusId == 10 ? InkWell(
onTap: (){ onTap: (){
// payOnline link
}, },
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: 150.0, right: 150.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Colors.green, color: Colors.green,
@ -390,13 +457,16 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
), ),
), ) : Container(),
InkWell(
// getCancelOrder(canCancel, canRefund),
isCancel ? InkWell(
onTap: () { onTap: () {
// confirmDelete(snapshot.data[index]["id"]); Navigator.push(context,
cancelOrder("id"); MaterialPageRoute(builder: (context) => presentConfirmDialog()));
}, },
child: Container( child: Container(
// 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(
@ -410,7 +480,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
), ),
), ) : Container(),
], ],
), ),
), ),
@ -418,58 +488,88 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
); );
} }
cancelOrder(id){
showDialog(
Color getStatusBackgroundColor() {
print(widget.orderModel.orderStatusId);
// if(orderStatus == 'delivered')
if(widget.orderModel.orderStatusId == 30 ||widget.orderModel.orderStatusId == 997
||widget.orderModel.orderStatusId == 994)
return Colors.blue[700];
else if (widget.orderModel.orderStatusId == 20 ||widget.orderModel.orderStatusId == 995
||widget.orderModel.orderStatusId == 998 ||widget.orderModel.orderStatusId == 999)
return Colors.green;
else if (widget.orderModel.orderStatusId == 10)
return Colors.orange[300];
else if (widget.orderModel.orderStatusId == 40 ||widget.orderModel.orderStatusId == 996
||widget.orderModel.orderStatusId == 200)
return Colors.red[900];
}
getCancelOrder(dataIsCancel){
if(widget.orderModel.canCancel && widget.orderModel.canRefund)
{
setState(() {
isCancel = true;
isRefund = false;
});
}
else if (widget.orderModel.canCancel ){
setState(() {
isCancel = true;
isRefund = false;
});
}
else if (widget.orderModel.canRefund){
setState(() {
isCancel = false;
isRefund = true;
});
}
else {
setState(() {
isCancel = false;
isRefund = false;
});
}
}
presentConfirmDialog(){
ConfirmDialog dialog = new ConfirmDialog(
context: context, context: context,
builder: (BuildContext context)=> AlertDialog( confirmMessage: TranslationBase.of(context).confirmCancellation,
title: Text(TranslationBase.of(context).confirm, okText: TranslationBase.of(context).confirm,
style: TextStyle( cancelText: TranslationBase.of(context).cancel_nocaps,
fontWeight: FontWeight.bold, okFunction: () => {
),), cancelOrderDetail(widget.orderModel.id),
content: Text(TranslationBase.of(context).confirmCancellation, ConfirmDialog.closeAlertDialog(context)
style: TextStyle(
color: Colors.grey,
),),
actions:[
FlatButton(
child: Text(TranslationBase.of(context).cancel,
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
fontSize: 16,
),),
onPressed: (){
Navigator.pop(context);
},
),
FlatButton(
child: Text(TranslationBase.of(context).ok,
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 16,
),),
onPressed: (){
// http.delete(""https://uat.hmgwebservices.com/epharmacy/api/orders/$id");
Navigator.push(context,
MaterialPageRoute(builder: (context)=> OrderDetailsPage()));
}, },
), cancelFunction: () => {});
], dialog.showAlertDialog(context);
)
);
} }
}
getOrderDetails() { cancelOrderDetail(order){
print("getOrderDetails 5466"); if(widget.orderModel.canCancel && widget.orderModel.canRefund == false){
OrderDetailsService service = new OrderDetailsService(); // setState(() {
service.getOrderDetails(AppGlobal.context).then((res) { cancelOrderDetail(order);
print(res); AppToast.showSuccessToast(message: "Request Sent Successfully");
// });
// return OrderPage();
}
else{}
}
getLanguageID() async {
var languageID = await sharedPref.getString(APP_LANGUAGE);
setState(() {
widget.languageID = languageID;
}); });
} }
}
getPayOrder(){
}

@ -1,3 +1,6 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@ -6,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/profile/profile.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart';
class ProductReviewPage extends StatefulWidget { class ProductReviewPage extends StatefulWidget {
@ -15,14 +19,23 @@ class ProductReviewPage extends StatefulWidget {
} }
class _ProductReviewPageState extends State<ProductReviewPage> { class _ProductReviewPageState extends State<ProductReviewPage> {
String orderId ="3516";
var pharmacyUser ="";
var product ="";
var CustomerId ="";
String submitTxt ="";
var doctorRating= "";
var reviewObj = {};
AppSharedPreferences sharedPref = AppSharedPreferences();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return BaseView<OrderModelViewModel>(
appBar: AppBar( onModelReady: (model)=>model.getProductReview(orderId),
centerTitle: true, builder: (_,model, wi )=> AppScaffold(
title: Text(TranslationBase.of(context).writeReview, style: TextStyle(color:Colors.white)), appBarTitle: TranslationBase.of(context).writeReview,
backgroundColor: Colors.green, isShowAppBar: true,
), isPharmacy:true ,
body: Container( body: Container(
color: Colors.white, color: Colors.white,
child: SingleChildScrollView( child: SingleChildScrollView(
@ -37,13 +50,14 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
children: [ children: [
Container( Container(
margin: EdgeInsets.only(left: 10), margin: EdgeInsets.only(left: 10),
child: Image( child: SvgPicture.asset(
image: // model.order[0].orderItems[0].product.images[0].src.toString(),
AssetImage('assets/images/al-habib_onlne_pharmacy_bg.png'), 'assets/images/al-habib_onlne_pharmacy_bg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
width: 80, width: 80,
height: 80, height: 80,
), ),
),]
), ),
Container( Container(
margin: EdgeInsets.only(top :15.0, bottom: 15.0), margin: EdgeInsets.only(top :15.0, bottom: 15.0),
@ -51,7 +65,7 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
Text('medication name', Text(model.order[0].orderItems[0].product.name.toString(),
style: TextStyle(fontSize: 16.0, style: TextStyle(fontSize: 16.0,
), ),
), ),
@ -61,14 +75,14 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
children: [ children: [
Container( Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Text('90.00', child: Text(model.order[0].orderItems[0].product.price.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
), ),
Container( Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Text('SAR', child: Text(TranslationBase.of(context).sar,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
), ),
), ),
@ -94,14 +108,15 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
), ),
), ),
Container( Container(
child: Text('4.9', child: Text(model.order[0].orderItems[0].product.approvedRatingSum.toString(),
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold,
), ),
), ),
), ),
Container( Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Text('10 (reviews)', child: Text("(" + model.order[0].orderItems[0].product.approvedTotalReviews.toString()
+ ' ' + TranslationBase.of(context).review +")",
style: TextStyle(fontSize: 12.0, style: TextStyle(fontSize: 12.0,
), ),
), ),
@ -111,8 +126,6 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
], ],
), ),
), ),
],
),
Divider( Divider(
color: Colors.grey[350], color: Colors.grey[350],
height: 20, height: 20,
@ -165,7 +178,8 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => ));
}, },
child: Container( child: Container(
height: 50.0, height: 50.0,
@ -197,10 +211,13 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
], ],
), ),
), ),
), ),),
); );
} }
//new screen is showing after submitting the review //new screen is showing after submitting the review
Widget getReviewedProduct(){ Widget getReviewedProduct(){
return Column( return Column(
@ -309,4 +326,24 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
], ],
); );
} }
// submit(){
// this.orderId.id = "0";
// this.reviewObj.position = 0;
// this.reviewObj.customerId = this.pharmacyUser.CustomerId;
// this.reviewObj.productId = this.product.id;
// this.reviewObj.storeId = 2;
// this.reviewObj.isApproved = false;
// this.reviewObj.title ='';
// this.reviewObj.reviewText = this.submitTxt;
// this.reviewObj.rating = this.doctorRating;
// this.reviewObj.replyText = null;
// this.reviewObj.helpfulYesTotal = 0;
// this.reviewObj.helpfulNoTotal = 0;
// this.reviewObj.createdOnUtc = new Date().toString();
// this.submitProductReview();
// }
submitProductReview(){
}
} }

@ -7,9 +7,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyAddressesModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart';
class PharmacyAddressesPage extends StatefulWidget{ class PharmacyAddressesPage extends StatefulWidget{
@override @override
@ -17,13 +19,11 @@ class PharmacyAddressesPage extends StatefulWidget{
} }
class _PharmacyAddressesState extends State<PharmacyAddressesPage>{ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
String address="";
int selectedRadio; int selectedRadio;
bool _value = false; bool _value = false;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
@override @override
void initState(){ void initState(){
// WidgetsBinding.instance.addPostFrameCallback((_) => getAllAddress()); // WidgetsBinding.instance.addPostFrameCallback((_) => getAllAddress());
@ -39,12 +39,10 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
Widget build (BuildContext context){ Widget build (BuildContext context){
return BaseView<PharmacyAddressesViewModel>( return BaseView<PharmacyAddressesViewModel>(
onModelReady: (model) => model.getAddress(), onModelReady: (model) => model.getAddress(address),
builder: (_,model, wi )=> AppScaffold( builder: (_,model, wi )=> AppScaffold(
appBarTitle: "", appBarTitle:TranslationBase.of(context).changeAddress,
// centerTitle: true, baseViewModel: model,
// title: Text(TranslationBase.of(context).changeAddress, style: TextStyle(color:Colors.white)),
// backgroundColor: Colors.green,
isShowAppBar: true, isShowAppBar: true,
isPharmacy:true , isPharmacy:true ,
body: Container( body: Container(
@ -55,7 +53,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: ScrollPhysics(), physics: ScrollPhysics(),
itemCount: 5 , itemCount: model.address.length,
itemBuilder: (context, index){ itemBuilder: (context, index){
return Container( return Container(
child: Padding( child: Padding(
@ -111,16 +109,21 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [ children:<Widget> [
Text('NAME', Text('name',
// model.address[0].customers[0].addresses[0].firstName,
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
), ),
), ),
SizedBox( SizedBox(
height: 5,), height: 5,),
Text('Address', Expanded(
child: Text(model.address[0].customers[0].addresses[0].address1+ ''+
model.address[0].customers[0].addresses[0].address2+ '' +
model.address[0].customers[0].addresses[0].zipPostalCode,
style: TextStyle(fontSize: 15.0, color: Colors.grey, style: TextStyle(fontSize: 15.0, color: Colors.grey,
), ),
), ),
),
SizedBox( SizedBox(
height: 5,), height: 5,),
Row( Row(
@ -354,11 +357,6 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
} }
getAllAddress() { getAllAddress() {
// print("ADDRESSES");
// PharmacyAddressService service = new PharmacyAddressService();
// service.getAddress(AppGlobal.context).then((res) {
// print(res);
// });
} }

@ -1,7 +1,21 @@
import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart';
import 'package:diplomaticquarterapp/pages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class PharmacyProfilePage extends StatefulWidget { class PharmacyProfilePage extends StatefulWidget {
@override @override
@ -9,14 +23,18 @@ class PharmacyProfilePage extends StatefulWidget {
} }
class _ProfilePageState extends State<PharmacyProfilePage> { class _ProfilePageState extends State<PharmacyProfilePage> {
AppSharedPreferences sharedPref = AppSharedPreferences();
String customerId="";
String page_id="";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return BaseView<OrderModelViewModel>(
appBar: AppBar( onModelReady: (model) => model.getOrder(customerId, page_id),
centerTitle: true, builder: (_,model, wi )=> AppScaffold(
title: Text(TranslationBase.of(context).myAccount, style: TextStyle(color:Colors.white)), appBarTitle: TranslationBase.of(context).myAccount,
backgroundColor: Colors.green, isShowAppBar: true,
), isPharmacy:true ,
body: Container( body: Container(
child:SingleChildScrollView( child:SingleChildScrollView(
child: Column( child: Column(
@ -38,8 +56,8 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
color:Colors.grey color:Colors.grey
), ),
), ),
Text( Text("Name",
'NAME', // model.order[0].customer.firstName.toString(),
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.bold fontWeight: FontWeight.bold
@ -66,6 +84,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
children:<Widget> [ children:<Widget> [
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderPage()));
},
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
@ -107,6 +129,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => WishlistPage()));
},
child: Column( child: Column(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
@ -181,6 +207,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => HomePrescriptionsPage()));
},
child: Row( child: Row(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
@ -190,7 +220,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
SizedBox( SizedBox(
width: 15, width: 15,
), ),
Text(TranslationBase.of(context).myPrescriptions, Text(TranslationBase.of(context).myPrescription,
style: TextStyle(fontSize: 13.0, style: TextStyle(fontSize: 13.0,
), ),
), ),
@ -205,16 +235,20 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => MyFamily()));
},
child: Row( child: Row(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
'assets/images/pharmacy/medication_refill_icon.svg', 'assets/images/pharmacy/compare.png',
width: 28, width: 28,
height: 28,), height: 28,),
SizedBox( SizedBox(
width: 15, width: 15,
), ),
Text(TranslationBase.of(context).medicationRefill, Text(TranslationBase.of(context).compare,
style: TextStyle(fontSize: 13.0, style: TextStyle(fontSize: 13.0,
), ),
), ),
@ -229,16 +263,20 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => HomePrescriptionsPage()));
},
child: Row( child: Row(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
'assets/images/pharmacy/pill_reminder_icon.svg', 'assets/images/pharmacy/medication_refill_icon.svg',
width: 30, width: 30,
height: 30,), height: 30,),
SizedBox( SizedBox(
width: 20, width: 20,
), ),
Text(TranslationBase.of(context).pillReminder, Text(TranslationBase.of(context).medicationsRefill,
style: TextStyle(fontSize: 13.0, style: TextStyle(fontSize: 13.0,
), ),
), ),
@ -253,6 +291,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => MyFamily()));
},
child: Row( child: Row(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
@ -277,6 +319,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => PharmacyAddressesPage()));
},
child: Row( child: Row(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
@ -329,6 +375,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => LiveChatPage()));
},
child: Row( child: Row(
children:<Widget> [ children:<Widget> [
SvgPicture.asset( SvgPicture.asset(
@ -353,6 +403,10 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 20, height: 20,
), ),
InkWell( InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => FindUsPage()));
},
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SvgPicture.asset( SvgPicture.asset(
@ -376,6 +430,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
), ),
), ),
), ),
),
); );
}} }}

@ -0,0 +1,39 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
class CancelOrderService extends BaseService{
AppSharedPreferences sharedPref = AppSharedPreferences();
AppGlobal appGlobal = new AppGlobal();
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
List<OrderModel> get orderDetails => orderDetails;
List<OrderModel> _orderList = List();
List<OrderModel> get orderList => _orderList;
String url ="";
Future cancelOrderDetail(order) async {
print("step 1");
hasError = false;
await baseAppClient.getPharmacy(GET_Cancel_ORDER+order,
onSuccess: (dynamic response, int statusCode) {
_orderList.clear();
response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
}

@ -16,7 +16,7 @@ class OrderService extends BaseService{
List<OrderModel> _orderList = List(); List<OrderModel> _orderList = List();
List<OrderModel> get orderList => _orderList; List<OrderModel> get orderList => _orderList;
String url =""; String url ="";
Future getOrder(custmerId, page_id) async { Future getOrder(custmerId, page_id) async {
print("step 1"); print("step 1");
@ -30,6 +30,7 @@ String url ="";
response['orders'].forEach((item) { response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item)); _orderList.add(OrderModel.fromJson(item));
}); });
print(_orderList.length);
print(response); print(response);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -38,6 +39,25 @@ String url ="";
} }
Future getProductReview(orderId) async {
print("step 1");
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=$page_id&limit=200&customer_id=$custmerId";
print(url);
await baseAppClient.getPharmacy(url,
onSuccess: (dynamic response, int statusCode) {
_orderList.clear();
response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item));
});
print(_orderList.length);
print(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
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) {

@ -9,21 +9,23 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyAddressesMode
class PharmacyAddressService extends BaseService{ class PharmacyAddressService extends BaseService{
List<PharmacyAddressesModel> get address => address;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
AppGlobal appGlobal = new AppGlobal(); AppGlobal appGlobal = new AppGlobal();
AuthenticatedUser authUser = new AuthenticatedUser(); AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider(); AuthProvider authProvider = new AuthProvider();
List<PharmacyAddressesModel> get address => address;
List<PharmacyAddressesModel> _addressList = List(); List<PharmacyAddressesModel> _addressList = List();
List<PharmacyAddressesModel> get reviewList => _addressList; List<PharmacyAddressesModel> get reviewList => _addressList;
String url ="";
Future getAddress(address) async {
Future getAddress() async {
print("step 1"); print("step 1");
hasError = false; hasError = false;
await baseAppClient.getPharmacy(GET_ORDER, url =GET_ADDRESS+"272843?fields=addresses";
print(url);
await baseAppClient.getPharmacy(url,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_addressList.clear(); _addressList.clear();
response['customers'].forEach((item) { response['customers'].forEach((item) {

@ -764,6 +764,11 @@ class TranslationBase {
String get orderDate => localizedValues['orderDate'][locale.languageCode]; String get orderDate => localizedValues['orderDate'][locale.languageCode];
String get itemsNo => localizedValues['itemsNo'][locale.languageCode]; String get itemsNo => localizedValues['itemsNo'][locale.languageCode];
String get noOrder => localizedValues['noOrder'][locale.languageCode]; String get noOrder => localizedValues['noOrder'][locale.languageCode];
String get review => localizedValues['review'][locale.languageCode];
String get deliveredOrder => localizedValues['deliveredOrder'][locale.languageCode];
String get compare => localizedValues['compare'][locale.languageCode];
String get medicationsRefill => localizedValues['medicationsRefill'][locale.languageCode];
String get myPrescription => localizedValues['myPrescription'][locale.languageCode];
// pharmacy module // pharmacy module
// String get medicationRefill => localizedValues['medicationRefill'][locale.languageCode]; // String get medicationRefill => localizedValues['medicationRefill'][locale.languageCode];

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
class productTile extends StatelessWidget { class productTile extends StatelessWidget {
final String productName; final String productName;
final String productPrice; final String productPrice;
@ -25,7 +26,7 @@ class productTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: 150, height: 180,
width: double.infinity, width: double.infinity,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
@ -115,7 +116,7 @@ class productTile extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Container( Container(
// margin: EdgeInsets.all(5), margin: EdgeInsets.only(bottom: 5.0),
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: 'QYT: $qyt', text: 'QYT: $qyt',
@ -161,11 +162,14 @@ class productTile extends StatelessWidget {
], ],
), ),
): Container(), ): Container(),
this.isOrderDetails == true ?Row( // this.isOrderDetails == true && model.order[0].orderStatusId == 30?
this.isOrderDetails == true?
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Container( Container(
margin: EdgeInsets.all(5), // margin: EdgeInsets.all(5.0),
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RatingBar.readOnly( child: RatingBar.readOnly(
@ -181,9 +185,9 @@ class productTile extends StatelessWidget {
), ),
), ),
Container( Container(
margin: EdgeInsets.all(5), // margin: EdgeInsets.all(5),
child: Align( child: Align(
alignment: Alignment.topLeft, // alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: '($productReviews reviews)', text: '($productReviews reviews)',
@ -222,6 +226,7 @@ class productTile extends StatelessWidget {
), ),
), ),
], ],
),
) : Container(), ) : Container(),
], ],
), ),

Loading…
Cancel
Save