|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
@ -8,6 +9,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
dynamic languageID;
|
|
|
|
|
|
|
|
|
|
@ -15,8 +17,9 @@ class OrderPage extends StatefulWidget {
|
|
|
|
|
// orderList({this.customerId, this.pageId});
|
|
|
|
|
|
|
|
|
|
String customerID;
|
|
|
|
|
String customerGUID;
|
|
|
|
|
|
|
|
|
|
OrderPage({@required this.customerID});
|
|
|
|
|
OrderPage({@required this.customerID, this.customerGUID});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_OrderPageState createState() => _OrderPageState();
|
|
|
|
|
@ -51,13 +54,16 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
_tabController = new TabController(
|
|
|
|
|
length: 4,
|
|
|
|
|
vsync: this,
|
|
|
|
|
|
|
|
|
|
// initialIndex: 1
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<OrderModelViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getOrder(widget.customerID, pageID),
|
|
|
|
|
onModelReady: (model) =>
|
|
|
|
|
model.getOrder(widget.customerID, widget.customerGUID, pageID),
|
|
|
|
|
builder: (_, model, wi) => AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).order,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
@ -105,6 +111,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getDeliveredOrder(OrderModelViewModel model) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
deliveredOrderList.clear();
|
|
|
|
|
for (int i = 0; i < model.orders.length; i++) {
|
|
|
|
|
if (model.orders[i].orderStatusId == 30 ||
|
|
|
|
|
model.orders[i].orderStatusId == 997 ||
|
|
|
|
|
@ -134,9 +142,12 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OrderDetailsPage(
|
|
|
|
|
orderModel:
|
|
|
|
|
deliveredOrderList[
|
|
|
|
|
index]),
|
|
|
|
|
));
|
|
|
|
|
deliveredOrderList[index]),
|
|
|
|
|
)).then((value) {
|
|
|
|
|
model.getOrder(widget.customerID,
|
|
|
|
|
widget.customerGUID, pageID);
|
|
|
|
|
getDeliveredOrder(model);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
@ -151,7 +162,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(right: 5),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.orderNumber,
|
|
|
|
|
@ -180,7 +192,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(right: 5),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.orderDate,
|
|
|
|
|
@ -208,7 +221,7 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(8.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? 'assets/images/pharmacy/arrow_left.svg'
|
|
|
|
|
: 'assets/images/pharmacy/arrow_right.svg',
|
|
|
|
|
height: 20,
|
|
|
|
|
@ -241,11 +254,18 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
width: 5.0,
|
|
|
|
|
),
|
|
|
|
|
color: Colors.blue[700],
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(30.0)),
|
|
|
|
|
child: deliveredOrderList[index].orderStatusId == 30 ||
|
|
|
|
|
deliveredOrderList[index].orderStatusId == 997 ||
|
|
|
|
|
deliveredOrderList[index].orderStatusId == 994
|
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
|
30.0)),
|
|
|
|
|
child: deliveredOrderList[
|
|
|
|
|
index]
|
|
|
|
|
.orderStatusId ==
|
|
|
|
|
30 ||
|
|
|
|
|
deliveredOrderList[index]
|
|
|
|
|
.orderStatusId ==
|
|
|
|
|
997 ||
|
|
|
|
|
deliveredOrderList[index]
|
|
|
|
|
.orderStatusId ==
|
|
|
|
|
994
|
|
|
|
|
// deliveredOrderList[index].orderStatusId == 30
|
|
|
|
|
? Text(
|
|
|
|
|
// deliveredOrderList[0].orderStatus.toString().substring(12),
|
|
|
|
|
@ -371,6 +391,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getProcessingOrder(OrderModelViewModel model) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
processingOrderList.clear();
|
|
|
|
|
for (int i = 0; i < model.orders.length; i++) {
|
|
|
|
|
if (model.orders[i].orderStatusId == 20 ||
|
|
|
|
|
model.orders[i].orderStatusId == 995 ||
|
|
|
|
|
@ -379,6 +401,7 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
processingOrderList.add(model.orders[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_tabController.index = 1;
|
|
|
|
|
return Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: processingOrderList.length != 0
|
|
|
|
|
@ -397,12 +420,20 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OrderDetailsPage(
|
|
|
|
|
orderModel:
|
|
|
|
|
processingOrderList[
|
|
|
|
|
index])));
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OrderDetailsPage(
|
|
|
|
|
orderModel:
|
|
|
|
|
processingOrderList[
|
|
|
|
|
index])))
|
|
|
|
|
.then((value) {
|
|
|
|
|
model
|
|
|
|
|
.getOrder(widget.customerID,
|
|
|
|
|
widget.customerGUID, pageID)
|
|
|
|
|
.then((value) {
|
|
|
|
|
getProcessingOrder(model);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
@ -417,7 +448,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(right: 5),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.orderNumber,
|
|
|
|
|
@ -446,7 +478,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(right: 5),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.orderDate,
|
|
|
|
|
@ -474,7 +507,7 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(8.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? 'assets/images/pharmacy/arrow_left.svg'
|
|
|
|
|
: 'assets/images/pharmacy/arrow_right.svg',
|
|
|
|
|
height: 20,
|
|
|
|
|
@ -507,12 +540,21 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
width: 5.0,
|
|
|
|
|
),
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(30.0)),
|
|
|
|
|
child: processingOrderList[index].orderStatusId == 20 ||
|
|
|
|
|
processingOrderList[index].orderStatusId == 995 ||
|
|
|
|
|
processingOrderList[index].orderStatusId == 998 ||
|
|
|
|
|
processingOrderList[index].orderStatusId == 999
|
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
|
30.0)),
|
|
|
|
|
child: processingOrderList[
|
|
|
|
|
index]
|
|
|
|
|
.orderStatusId ==
|
|
|
|
|
20 ||
|
|
|
|
|
processingOrderList[index]
|
|
|
|
|
.orderStatusId ==
|
|
|
|
|
995 ||
|
|
|
|
|
processingOrderList[index]
|
|
|
|
|
.orderStatusId ==
|
|
|
|
|
998 ||
|
|
|
|
|
processingOrderList[index]
|
|
|
|
|
.orderStatusId ==
|
|
|
|
|
999
|
|
|
|
|
// processingOrderList[index].orderStatusId == 20
|
|
|
|
|
? Text(
|
|
|
|
|
// deliveredOrderList[0].orderStatus.toString().substring(12),
|
|
|
|
|
@ -817,6 +859,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getPendingOrder(OrderModelViewModel model) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
pendingOrderList.clear();
|
|
|
|
|
for (int i = 0; i < model.orders.length; i++) {
|
|
|
|
|
if (model.orders[i].orderStatusId == 10) {
|
|
|
|
|
pendingOrderList.add(model.orders[i]);
|
|
|
|
|
@ -840,12 +884,20 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OrderDetailsPage(
|
|
|
|
|
orderModel:
|
|
|
|
|
pendingOrderList[
|
|
|
|
|
index])));
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OrderDetailsPage(
|
|
|
|
|
orderModel:
|
|
|
|
|
pendingOrderList[
|
|
|
|
|
index])))
|
|
|
|
|
.then((value) {
|
|
|
|
|
model
|
|
|
|
|
.getOrder(widget.customerID,
|
|
|
|
|
widget.customerGUID, pageID)
|
|
|
|
|
.then((value) {
|
|
|
|
|
getPendingOrder(model);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
@ -867,7 +919,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
.orderNumber,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -878,7 +931,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -919,7 +973,7 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(8.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? 'assets/images/pharmacy/arrow_left.svg'
|
|
|
|
|
: 'assets/images/pharmacy/arrow_right.svg',
|
|
|
|
|
height: 20,
|
|
|
|
|
@ -1084,6 +1138,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getCancelledOrder(OrderModelViewModel model) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
cancelledOrderList.clear();
|
|
|
|
|
for (int i = 0; i < model.orders.length; i++) {
|
|
|
|
|
if (model.orders[i].orderStatusId == 40 ||
|
|
|
|
|
model.orders[i].orderStatus == 996 ||
|
|
|
|
|
@ -1109,12 +1165,20 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OrderDetailsPage(
|
|
|
|
|
orderModel:
|
|
|
|
|
cancelledOrderList[
|
|
|
|
|
index])));
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OrderDetailsPage(
|
|
|
|
|
orderModel:
|
|
|
|
|
cancelledOrderList[
|
|
|
|
|
index])))
|
|
|
|
|
.then((value) {
|
|
|
|
|
model
|
|
|
|
|
.getOrder(widget.customerID,
|
|
|
|
|
widget.customerGUID, pageID)
|
|
|
|
|
.then((value) {
|
|
|
|
|
getCancelledOrder(model);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
@ -1136,7 +1200,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
.orderNumber,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -1147,7 +1212,8 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -1188,7 +1254,7 @@ class _OrderPageState extends State<OrderPage>
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(8.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? 'assets/images/pharmacy/arrow_left.svg'
|
|
|
|
|
: 'assets/images/pharmacy/arrow_right.svg',
|
|
|
|
|
height: 20,
|
|
|
|
|
|