fixe order and order details

merge-requests/206/head
Fatimah Alshammari 4 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_ORDER = "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
const HHC_GET_ALL_SERVICES =
"Services/Patients.svc/REST/PatientER_HHC_GetAllServices";

@ -642,6 +642,11 @@ const Map<String, Map<String, String>> localizedValues = {
"cancelled": {"en": "Cancelled", "ar": " ملغي"},
"writeReview": {"en": "Write 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": {
"en": "BACK TO MY ACCOUNT ",
"ar": " الرجوع لحسابي الشخصي"

@ -6,19 +6,19 @@ import '../../../locator.dart';
import '../base_view_model.dart';
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() async {
Future getAddress(address) async {
setState(ViewState.Busy);
await _PharmacyAddressService.getAddress();
if (_PharmacyAddressService.hasError) {
error = _PharmacyAddressService.error;
await _pharmacyAddressService.getAddress(address);
if (_pharmacyAddressService.hasError) {
error = _pharmacyAddressService.error;
setState(ViewState.Error);
} else {
print(address.length);
}
}
}

@ -1,3 +1,5 @@
//import 'dart:html';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
@ -6,6 +8,7 @@ import '../../../locator.dart';
import '../base_view_model.dart';
class OrderModelViewModel extends BaseViewModel {
OrderService _orderService = locator<OrderService>();
List<OrderModel> get order => _orderService.orderList;
@ -22,7 +25,9 @@ class OrderModelViewModel extends BaseViewModel {
error = _orderService.error;
setState(ViewState.Error);
} 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(
onTap: () => Navigator.push(
context, FadePage(page: OrderPage())),
context, FadePage(page: PharmacyProfilePage())),
child: Center(
child: Padding(

@ -8,11 +8,13 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.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 {
// orderList({this.customerId, this.pageId});
var languageID ;
@override
_OrderPageState createState() => _OrderPageState();
}
@ -21,17 +23,19 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
String customerId="";
String page_id="";
List delivered = [] ;
List processing = [];
List cancelled = [];
List pending = [];
List <OrderModel> orderList = [] ;
List <OrderModel> deliveredOrderList = [] ;
List <OrderModel> processingOrderList = [];
List <OrderModel> cancelledOrderList = [];
List <OrderModel> pendingOrderList = [];
TabController _tabController;
AppSharedPreferences sharedPref = AppSharedPreferences();
@override
void initState() {
// WidgetsBinding.instance.addPostFrameCallback((_) => getOrder());
getLanguageID();
super.initState();
_tabController = new TabController(length: 4, vsync: this,);
}
@ -41,11 +45,8 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
return BaseView<OrderModelViewModel>(
onModelReady: (model) => model.getOrder(customerId, page_id),
builder: (_,model, wi )=> AppScaffold(
appBarTitle:(TranslationBase.of(context).order),
// backgroundColor: Colors.green ,
// centerTitle: true,
// title: Text(TranslationBase.of(context).order, style: TextStyle(color:Colors.white)),
// backgroundColor: Colors.green,
appBarTitle:TranslationBase.of(context).order,
baseViewModel: model,
isShowAppBar: true,
isPharmacy:true ,
body: Container(
@ -54,7 +55,6 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
TabBar(
tabs: [
Tab(text: TranslationBase.of(context).delivered),
// Tab(text: model.order.length.toString()),
Tab(text: TranslationBase.of(context).processing),
Tab(text: TranslationBase.of(context).pending),
Tab(text: TranslationBase.of(context).cancelled),
@ -87,10 +87,19 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
);
}
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(
width: MediaQuery.of(context).size.width,
child: model.order.length != 0 && model.order[0].orderStatusId == 30
child: model.order.length != 0
? SingleChildScrollView(
child: Column(
children:<Widget> [
@ -98,7 +107,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 2 ,
itemCount: deliveredOrderList.length,
itemBuilder: (context, index){
return Container(
child: Column(
@ -121,7 +130,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
),
),
Container(
child: Text(model.order[0].id.toString(),
child: Text(deliveredOrderList[index].id.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
@ -140,7 +149,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
),
),
Container(
child: Text(model.order[0].createdOnUtc.toString(),
child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0,
),
),
@ -155,7 +164,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:deliveredOrderList[index])));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
@ -175,27 +184,25 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: 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.blue[700],
style: BorderStyle.solid,
width: 5.0,
),
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.blue[700],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
model.order[0].orderStatus.toString(),
// TranslationBase.of(context).delivered,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
style: BorderStyle.solid,
width: 5.0,
),
color: Colors.blue[700],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context).deliveredOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
@ -208,7 +215,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
children: [
Container(
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,
),
),
@ -227,7 +234,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row(
children: [
Container(
child: Text('12',
child: Text(deliveredOrderList[index].orderItems.length.toString(),
style: TextStyle(fontSize: 14.0,
),
),
@ -267,7 +274,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
SvgPicture.asset(
'assets/images/pharmacy/empty_box.svg'),
Container(
margin: EdgeInsets.only(top: 10.0),
@ -284,189 +291,391 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
}
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(
child: model.order.length != 0 && model.order[0].orderStatusId == 20
? SingleChildScrollView(
child: Column(
width: MediaQuery.of(context).size.width,
child: model.order.length != 0
? SingleChildScrollView(
child: Column(
children:<Widget> [
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(model.order[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,
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: processingOrderList.length,
itemBuilder: (context, index){
return Container(
child: Column(
children:<Widget> [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [
Container(
margin: EdgeInsets.all(8.0),
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[index].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[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
),
Container(
child: Text(model.order[0].createdOnUtc.toString(),
style: TextStyle(fontSize: 14.0,
Container(
margin: EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[index])));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
),
),
],
),
],
),
),
Container(
margin: EdgeInsets.all(8),
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
},
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>[
Expanded(
child: 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(
model.order[0].orderStatus.toString(),
// 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(model.order[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,
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)
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
child: Text('12',
style: TextStyle(fontSize: 14.0,
child: Text(
processingOrderList[index].orderStatus.toString().substring(12),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text(TranslationBase.of(context).itemsNo,
style: TextStyle(fontSize: 14.0,
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[index].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[index].orderItems.length.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,
),
],
),
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>[
Image.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,
)),
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,
)),
),
],
),
),
],
),
),
),
),
);
// 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){
for(int i=0 ; i< model.order.length; i++){
if( model.order[i].orderStatusId == 10){
pendingOrderList.add(model.order[i]);
}
}
return Container(
child: model.order.length != 0 && model.order[0].orderStatusId == 10
child: model.order.length != 0
? SingleChildScrollView(
child: Column(
children:<Widget> [
@ -474,7 +683,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 2 ,
itemCount: pendingOrderList.length ,
itemBuilder: (context, index){
return Container(
child: SingleChildScrollView(
@ -498,7 +707,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
),
),
Container(
child: Text(model.order[0].id.toString(),
child: Text(pendingOrderList[index].id.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
@ -517,7 +726,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
),
),
Container(
child: Text(model.order[0].createdOnUtc.toString(),
child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0,
),
),
@ -532,7 +741,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index])));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
@ -552,28 +761,29 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child:Container(
margin: EdgeInsets.all(8.0),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange[300],
style: BorderStyle.solid,
width: 5.0,
),
color: Colors.orange[300],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
model.order[0].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
Container(
margin: EdgeInsets.all(8.0),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange[300],
style: BorderStyle.solid,
width: 5.0,
),
), ),
color: Colors.orange[300],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
widget.languageID == "ar"
? pendingOrderList[index].orderStatusn.toString()
: pendingOrderList[index].orderStatus.toString().substring(12),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.all(8.0),
child: Column(
@ -583,7 +793,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
children: [
Container(
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,
),
),
@ -602,7 +812,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row(
children: [
Container(
child: Text('12',
child: Text(pendingOrderList[index].orderItems.length.toString(),
style: TextStyle(fontSize: 14.0,
),
),
@ -644,7 +854,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
SvgPicture.asset(
'assets/images/pharmacy/empty_box.svg'),
Container(
margin: EdgeInsets.only(top: 10.0),
@ -662,8 +872,14 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
}
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(
child: model.order.length != 0 && model.order[0].orderStatusId == 40
child: model.order.length != 0
? SingleChildScrollView(
child: Column(
children:<Widget> [
@ -671,7 +887,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 2 ,
itemCount: cancelledOrderList.length,
itemBuilder: (context, index){
return Container(
child: SingleChildScrollView(
@ -695,7 +911,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
),
),
Container(
child: Text(model.order[0].id.toString(),
child: Text(cancelledOrderList[index].id.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
@ -714,7 +930,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
),
),
Container(
child: Text(model.order[0].createdOnUtc.toString(),
child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,11),
style: TextStyle(fontSize: 14.0,
),
),
@ -729,7 +945,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:cancelledOrderList[index])));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
@ -749,28 +965,28 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child:Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 10.0, right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.red[900],
style: BorderStyle.solid,
width: 5.0,
),
color: Colors.red[900],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
model.order[0].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 10.0, right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.red[900],
style: BorderStyle.solid,
width: 5.0,
),
), ),
color: Colors.red[900],
borderRadius: BorderRadius.circular(30.0)
),
child: Text( widget.languageID == "ar"
? cancelledOrderList[index].orderStatusn.toString()
: cancelledOrderList[index].orderStatus.toString().substring(12),
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(
@ -780,7 +996,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
children: [
Container(
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,
),
),
@ -799,7 +1015,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
Row(
children: [
Container(
child: Text('12',
child: Text(cancelledOrderList[index].orderItems.length.toString(),
style: TextStyle(fontSize: 14.0,
),
),
@ -841,7 +1057,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
SvgPicture.asset(
'assets/images/pharmacy/empty_box.svg'),
Container(
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/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:flutter/material.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/uitl/app_shared_preferences.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 {
var languageID ;
OrderModel orderModel;
OrderDetailsPage({
@required this.orderModel
});
@override
_OrderDetailsPageState createState() => _OrderDetailsPageState();
}
@ -23,20 +38,28 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
String customerId="";
String page_id="";
String orderId="3516";
var model;
var isCancel = false;
var isRefund = false;
var dataIsCancel;
var dataIsRefund;
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((_) => getOrderDetails());
super.initState();
getLanguageID();
getCancelOrder(widget.orderModel.id);
// cancelOrderDetail(widget.orderModel.id);
}
@override
Widget build(BuildContext context) {
return BaseView<OrderModelViewModel>(
onModelReady:(model) => model.getOrderDetails(orderId),
onModelReady:(model) => model.getOrderDetails(widget.orderModel.id),
builder: (_,model, wi )=> AppScaffold(
appBarTitle: (TranslationBase.of(context).orderDetail),
// title: Text(TranslationBase.of(context).orderDetail, style: TextStyle(color:Colors.white)),
// backgroundColor: Colors.green,
appBarTitle: TranslationBase.of(context).orderDetail,
isShowAppBar: true,
isPharmacy:true ,
body: Container(
@ -62,39 +85,43 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
],
),
),
Container(
margin: EdgeInsets.only(top: 15.0, right: 10.0),
padding: EdgeInsets.only(left: 11.0, right: 11.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.blue,
style: BorderStyle.solid,
width: 5.0,
Container(
margin: EdgeInsets.only(top: 15.0, right: 10.0),
padding: EdgeInsets.only(left: 11.0, right: 11.0),
decoration: BoxDecoration(
border: Border.all(
color: getStatusBackgroundColor(),
style: BorderStyle.solid,
width: 5.0,
),
color: getStatusBackgroundColor(),
borderRadius: BorderRadius.circular(30.0)
),
child: Text(widget.orderModel.orderStatus.toString().substring(12),
// widget.languageID == "ar"
// ? widget.orderModel.orderStatusn.toString()
// : widget.orderModel.orderStatus.toString().substring(12) ,
// TranslationBase.of(context).delivered,
style: TextStyle(
color: Colors.white,
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
color: Colors.blue,
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
TranslationBase.of(context).delivered,
style: TextStyle(
color: Colors.white,
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
),
],
),
Container(
margin: EdgeInsets.only(left: 10.0, top: 13.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text('NAME',
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
),
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
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,
),
],
),
]
),
),
Container(
@ -102,7 +129,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text('Cloud Solutions',
Text(model.order[0].shippingAddress.address1.toString().substring(9),
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
color: Colors.grey,
),
@ -110,22 +137,37 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
],
),
),
Row(
children:<Widget> [
Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0),
child: SvgPicture.asset(
'assets/images/pharmacy/mobile_number_icon.svg',
height: 13,),
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(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Text('588888778',
style: TextStyle(fontSize: 15.0,
]
),
),
Container(
child: Row(
children:<Widget> [
Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0),
child: SvgPicture.asset(
'assets/images/pharmacy/mobile_number_icon.svg',
height: 13,),
),
Container(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Text(model.order[0].shippingAddress.phoneNumber.toString(),
style: TextStyle(fontSize: 15.0,
),
),
),
),
],
],
),
),
Divider(
color: Colors.grey[350],
@ -151,11 +193,21 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
),
Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: SvgPicture.asset(
'assets/images/pharmacy/hmg_shipping_logo.svg',
height: 25,
width: 25,),
child: model.order[0].shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight"
? Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child: SvgPicture.asset(
'assets/images/pharmacy/hmg_shipping_logo.svg',
height: 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(
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,
),
),
@ -211,10 +263,23 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
],
),
),
Container(
child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00,
productReviews:4, totalPrice: '10.00', qyt: '3',),
ListView.builder(
scrollDirection: Axis.vertical,
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(
padding: EdgeInsets.only(bottom: 10.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,
),
),
@ -287,7 +352,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
),
),
Text('343.55',
Text(model.order[0].orderShippingExclTax.toString(),
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,
),
),
@ -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,
),
),
@ -362,14 +427,16 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
],
),
InkWell(
widget.orderModel.orderStatusId == 10 ? InkWell(
onTap: (){
},
// payOnline link
},
child: Container(
margin: EdgeInsets.only(top: 20.0),
// margin: EdgeInsets.only(top: 20.0),
height: 50.0,
color: Colors.transparent,
child: Container(
padding: EdgeInsets.only(left: 150.0, right: 150.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
@ -390,27 +457,30 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
),
),
),
InkWell(
) : Container(),
// getCancelOrder(canCancel, canRefund),
isCancel ? InkWell(
onTap: () {
// confirmDelete(snapshot.data[index]["id"]);
cancelOrder("id");
Navigator.push(context,
MaterialPageRoute(builder: (context) => presentConfirmDialog()));
},
child: Container(
// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
height: 50.0,
color: Colors.transparent,
child: Center(
child: Text(
TranslationBase.of(context).cancelOrder,
style: TextStyle(
child: Center(
child: Text(
TranslationBase.of(context).cancelOrder,
style: TextStyle(
color: Colors.red[900],
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline
),
),
),
),
),
),
) : 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,
builder: (BuildContext context)=> AlertDialog(
title: Text(TranslationBase.of(context).confirm,
style: TextStyle(
fontWeight: FontWeight.bold,
),),
content: Text(TranslationBase.of(context).confirmCancellation,
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()));
},
),
],
)
);
confirmMessage: TranslationBase.of(context).confirmCancellation,
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {
cancelOrderDetail(widget.orderModel.id),
ConfirmDialog.closeAlertDialog(context)
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
}
cancelOrderDetail(order){
if(widget.orderModel.canCancel && widget.orderModel.canRefund == false){
// setState(() {
cancelOrderDetail(order);
AppToast.showSuccessToast(message: "Request Sent Successfully");
// });
// return OrderPage();
}
else{}
}
getLanguageID() async {
var languageID = await sharedPref.getString(APP_LANGUAGE);
setState(() {
widget.languageID = languageID;
});
}
}
getOrderDetails() {
print("getOrderDetails 5466");
OrderDetailsService service = new OrderDetailsService();
service.getOrderDetails(AppGlobal.context).then((res) {
print(res);
});
}
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:diplomaticquarterapp/uitl/translations_delegate_base.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/pages/pharmacy/profile/profile.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';
class ProductReviewPage extends StatefulWidget {
@ -15,35 +19,45 @@ class ProductReviewPage extends StatefulWidget {
}
class _ProductReviewPageState extends State<ProductReviewPage> {
String orderId ="3516";
var pharmacyUser ="";
var product ="";
var CustomerId ="";
String submitTxt ="";
var doctorRating= "";
var reviewObj = {};
AppSharedPreferences sharedPref = AppSharedPreferences();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(TranslationBase.of(context).writeReview, style: TextStyle(color:Colors.white)),
backgroundColor: Colors.green,
),
return BaseView<OrderModelViewModel>(
onModelReady: (model)=>model.getProductReview(orderId),
builder: (_,model, wi )=> AppScaffold(
appBarTitle: TranslationBase.of(context).writeReview,
isShowAppBar: true,
isPharmacy:true ,
body: Container(
color: Colors.white,
child: SingleChildScrollView(
child: Column(
children: <Widget> [
// Container(
child: Column(
children: <Widget> [
// Container(
// child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00,
// productReviews:4, ),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin: EdgeInsets.only(left: 10),
child: Image(
image:
AssetImage('assets/images/al-habib_onlne_pharmacy_bg.png'),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin: EdgeInsets.only(left: 10),
child: SvgPicture.asset(
// model.order[0].orderItems[0].product.images[0].src.toString(),
'assets/images/al-habib_onlne_pharmacy_bg.png',
fit: BoxFit.cover,
width: 80,
height: 80,
),
),]
),
Container(
margin: EdgeInsets.only(top :15.0, bottom: 15.0),
@ -51,7 +65,7 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
children: <Widget>[
Row(
children: <Widget>[
Text('medication name',
Text(model.order[0].orderItems[0].product.name.toString(),
style: TextStyle(fontSize: 16.0,
),
),
@ -61,14 +75,14 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
children: [
Container(
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,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('SAR',
child: Text(TranslationBase.of(context).sar,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
@ -94,14 +108,15 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
),
),
Container(
child: Text('4.9',
child: Text(model.order[0].orderItems[0].product.approvedRatingSum.toString(),
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold,
),
),
),
Container(
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,
),
),
@ -111,8 +126,6 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
],
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
@ -165,7 +178,8 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
),
InkWell(
onTap: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => ));
},
child: Container(
height: 50.0,
@ -196,11 +210,14 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
),
],
),
),
),
);
),
),),
);
}
//new screen is showing after submitting the review
Widget getReviewedProduct(){
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:diplomaticquarterapp/uitl/translations_delegate_base.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/config/config.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{
@override
@ -17,13 +19,11 @@ class PharmacyAddressesPage extends StatefulWidget{
}
class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
String address="";
int selectedRadio;
bool _value = false;
AppSharedPreferences sharedPref = AppSharedPreferences();
@override
void initState(){
// WidgetsBinding.instance.addPostFrameCallback((_) => getAllAddress());
@ -39,12 +39,10 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
Widget build (BuildContext context){
return BaseView<PharmacyAddressesViewModel>(
onModelReady: (model) => model.getAddress(),
onModelReady: (model) => model.getAddress(address),
builder: (_,model, wi )=> AppScaffold(
appBarTitle: "",
// centerTitle: true,
// title: Text(TranslationBase.of(context).changeAddress, style: TextStyle(color:Colors.white)),
// backgroundColor: Colors.green,
appBarTitle:TranslationBase.of(context).changeAddress,
baseViewModel: model,
isShowAppBar: true,
isPharmacy:true ,
body: Container(
@ -55,7 +53,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 5 ,
itemCount: model.address.length,
itemBuilder: (context, index){
return Container(
child: Padding(
@ -111,14 +109,19 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text('NAME',
Text('name',
// model.address[0].customers[0].addresses[0].firstName,
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 5,),
Text('Address',
style: TextStyle(fontSize: 15.0, color: Colors.grey,
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,
),
),
),
SizedBox(
@ -354,11 +357,6 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage>{
}
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:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.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 {
@override
@ -9,370 +23,411 @@ class PharmacyProfilePage extends StatefulWidget {
}
class _ProfilePageState extends State<PharmacyProfilePage> {
AppSharedPreferences sharedPref = AppSharedPreferences();
String customerId="";
String page_id="";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(TranslationBase.of(context).myAccount, style: TextStyle(color:Colors.white)),
backgroundColor: Colors.green,
),
body: Container(
child:SingleChildScrollView(
child: Column(
children:<Widget>[
Container(
child:Row(
children:<Widget> [
Container(
padding:EdgeInsets.only(top:20.0, left:10.0, right:10.0, bottom:10.0,),
child: LargeAvatar(name: "profile", url:'' ,),
),
Container(
child: Column(
children: [
Text(
TranslationBase.of(context).welcome,
style: TextStyle(fontSize: 14.0,
fontWeight: FontWeight.bold,
color:Colors.grey
),
),
Text(
'NAME',
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
),
],
),
)
],
),
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 15,
),
Container(
return BaseView<OrderModelViewModel>(
onModelReady: (model) => model.getOrder(customerId, page_id),
builder: (_,model, wi )=> AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: true,
isPharmacy:true ,
body: Container(
child:SingleChildScrollView(
child: Column(
children:<Widget>[
Container(
child:Row(
children:<Widget> [
Expanded(
child: InkWell(
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/orders_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
Container(
padding:EdgeInsets.only(top:20.0, left:10.0, right:10.0, bottom:10.0,),
child: LargeAvatar(name: "profile", url:'' ,),
),
Container(
child: Column(
children: [
Text(
TranslationBase.of(context).welcome,
style: TextStyle(fontSize: 14.0,
fontWeight: FontWeight.bold,
color:Colors.grey
),
Text(
TranslationBase.of(context).orders,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
Text("Name",
// model.order[0].customer.firstName.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
],
),
],
),
)
],
),
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 15,
),
Container(
child:Row(
children:<Widget> [
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderPage()));
},
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/orders_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).orders,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
],
),
),
),
),
Expanded(
child: InkWell(
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).lakum,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold
Expanded(
child: InkWell(
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
),
],
Text(
TranslationBase.of(context).lakum,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold
),
),
],
),
),
),
),
Expanded(
child: InkWell(
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).wishlist,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
],
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => WishlistPage()));
},
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).wishlist,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
],
),
),
),
Expanded(
child: InkWell(
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/review_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).reviews,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
],
),
),
),
],
)
),
SizedBox(
height: 15,
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text(
TranslationBase.of(context).myAccount,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
),
Expanded(
child: InkWell(
child: Column(
SizedBox(
height: 10,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => HomePrescriptionsPage()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/review_icon.svg',
width: 50,
height: 50,),
'assets/images/pharmacy/my_prescription_icon.svg',
width: 28,
height: 28,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).reviews,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
width: 15,
),
Text(TranslationBase.of(context).myPrescription,
style: TextStyle(fontSize: 13.0,
),
),
],
),
),
),
],
)
),
SizedBox(
height: 15,
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text(
TranslationBase.of(context).myAccount,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
),
SizedBox(
height: 10,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
child: Row(
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => MyFamily()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/my_prescription_icon.svg',
'assets/images/pharmacy/compare.png',
width: 28,
height: 28,),
SizedBox(
width: 15,
),
Text(TranslationBase.of(context).myPrescriptions,
style: TextStyle(fontSize: 13.0,
),
Text(TranslationBase.of(context).compare,
style: TextStyle(fontSize: 13.0,
),
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/medication_refill_icon.svg',
width: 28,
height: 28,),
SizedBox(
width: 15,
),
Text(TranslationBase.of(context).medicationRefill,
style: TextStyle(fontSize: 13.0,
),
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/pill_reminder_icon.svg',
width: 30,
height: 30,),
SizedBox(
width: 20,
),
Text(TranslationBase.of(context).pillReminder,
style: TextStyle(fontSize: 13.0,
),
),
],
SizedBox(
height: 5,
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/my_family_icon.svg',
width: 20,
height: 20,),
SizedBox(
width: 20,
),
Text(TranslationBase.of(context).family,
style: TextStyle(fontSize: 13.0,
),
),
],
Divider(
color: Colors.grey,
height: 20,
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/shipping_addresses_icon.svg',
width: 30,
height: 30,),
SizedBox(
width: 20,
),
Text(TranslationBase.of(context).shippingAddresses,
style: TextStyle(fontSize: 13.0,
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => HomePrescriptionsPage()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/medication_refill_icon.svg',
width: 30,
height: 30,),
SizedBox(
width: 20,
),
),
],
Text(TranslationBase.of(context).medicationsRefill,
style: TextStyle(fontSize: 13.0,
),
),
],
),
),
),
],
),
),
SizedBox(
height: 10,
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text(
TranslationBase.of(context).reachUs,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
SizedBox(
height: 5,
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
child: Row(
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => MyFamily()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/contact_us_icon.svg',
'assets/images/pharmacy/my_family_icon.svg',
width: 20,
height: 20,),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
Text(TranslationBase.of(context).family,
style: TextStyle(fontSize: 13.0,
),
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/our_locations_icon.svg',
width: 30,
height: 30,),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).ourLocations,
style: TextStyle(fontSize: 13.0),
),
],
),
)
],
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => PharmacyAddressesPage()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/shipping_addresses_icon.svg',
width: 30,
height: 30,),
SizedBox(
width: 20,
),
Text(TranslationBase.of(context).shippingAddresses,
style: TextStyle(fontSize: 13.0,
),
),
],
),
),
],
),
),
)
],
SizedBox(
height: 10,
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 5,
indent: 0,
endIndent: 0,
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Text(
TranslationBase.of(context).reachUs,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => LiveChatPage()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/contact_us_icon.svg',
width: 20,
height: 20,),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
),
],
),
),
SizedBox(
height: 5,
),
Divider(
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => FindUsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/our_locations_icon.svg',
width: 30,
height: 30,),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).ourLocations,
style: TextStyle(fontSize: 13.0),
),
],
),
)
],
),
)
],
),
),
),
),

@ -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> get orderList => _orderList;
String url ="";
String url ="";
Future getOrder(custmerId, page_id) async {
print("step 1");
@ -30,6 +30,7 @@ String url ="";
response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item));
});
print(_orderList.length);
print(response);
}, onFailure: (String error, int statusCode) {
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 {
//
// if (await this.sharedPref.getObject(USER_PROFILE) != null) {

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

@ -764,6 +764,11 @@ class TranslationBase {
String get orderDate => localizedValues['orderDate'][locale.languageCode];
String get itemsNo => localizedValues['itemsNo'][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
// String get medicationRefill => localizedValues['medicationRefill'][locale.languageCode];

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
class productTile extends StatelessWidget {
final String productName;
final String productPrice;
@ -25,7 +26,7 @@ class productTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 150,
height: 180,
width: double.infinity,
color: Colors.white,
child: Column(
@ -115,7 +116,7 @@ class productTile extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
// margin: EdgeInsets.all(5),
margin: EdgeInsets.only(bottom: 5.0),
child: RichText(
text: TextSpan(
text: 'QYT: $qyt',
@ -161,68 +162,72 @@ class productTile extends StatelessWidget {
],
),
): Container(),
this.isOrderDetails == true ?Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
margin: EdgeInsets.all(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,
// this.isOrderDetails == true && model.order[0].orderStatusId == 30?
this.isOrderDetails == true?
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
// margin: EdgeInsets.all(5.0),
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(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: '($productReviews reviews)',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 13),
Container(
// margin: EdgeInsets.all(5),
child: Align(
// alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: '($productReviews reviews)',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 13),
),
),
),
),
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => ProductReviewPage()));
},
child: Container(
padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
height: 30.0,
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange,
style: BorderStyle.solid,
width: 1.0
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => ProductReviewPage()));
},
child: Container(
padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
height: 30.0,
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange,
style: BorderStyle.solid,
width: 1.0
),
color: Colors.transparent,
borderRadius: BorderRadius.circular(5.0)
),
child: Text(
TranslationBase.of(context).writeReview,
style: TextStyle(
fontSize:12,
color: Colors.orange,
),
),
color: Colors.transparent,
borderRadius: BorderRadius.circular(5.0)
),
child: Text(
TranslationBase.of(context).writeReview,
style: TextStyle(
fontSize:12,
color: Colors.orange,
),
),
),
),
],
) : Container(),
],
),
) : Container(),
],
),
);

Loading…
Cancel
Save