Merge branch 'development_new_design_2.0' into haroon-new-design

merge-update-with-lab-changes
haroon amjad 4 years ago
commit 8c99bba17b

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@ -15,6 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';

@ -1606,6 +1606,7 @@ const Map localizedValues = {
"android-instructions-2": { "en": "Make sure that you have installed your watch related apps from Google PlayStore.", "ar": "تأكد من أنك قمت بتثبيت التطبيقات المتعلقة بالساعات من Google PlayStore." },
"android-instructions-3": { "en": "Make sure that your Smart Watch is connected with the WearOS app & your watch apps.", "ar": "تأكد من أن ساعتك الذكية متصلة بتطبيق WearOS وتطبيقات ساعتك." },
"android-instructions-4": { "en": "Make sure that your smart watch apps are linked/associated with Google Fit App.", "ar": "تأكد من أن تطبيقات ساعتك الذكية مرتبطة / مرتبطة بتطبيق Google Fit." }, "android-instructions-5": { "en": "Make sure that data like heart rate, steps, distance etc. are being shown on your watch app & on Google Fit app & both are in sync.", "ar": "تأكد من عرض بيانات مثل معدل ضربات القلب والخطوات والمسافة وما إلى ذلك على تطبيق الساعة وعلى تطبيق Google Fit وكلاهما في حالة مزامنة." },
"tamaraInstPlan" : { "en": "Select the tamara installment plan", "ar": "حدد خطة تقسيط تمارة" },
"onlineTag": {"en": "Online", "ar": "متصل"},
"offlineTag": {"en": "Offline", "ar": "غير متصل"},
"viewDocList": {"en": "View List of Doctors", "ar": "عرض قائمة الأطباء"},

@ -26,6 +26,7 @@ class COCItem {
String status;
String statusAr;
dynamic statusEn;
int statusId;
COCItem({
this.appointment,
@ -55,6 +56,7 @@ class COCItem {
this.status,
this.statusAr,
this.statusEn,
this.statusId,
});
COCItem.fromJson(Map<String, dynamic> json) {
@ -85,6 +87,7 @@ class COCItem {
status = json['Status'];
statusAr = json['StatusAr'];
statusEn = json['StatusEn'];
statusId = json['StatusId'];
}
Map<String, dynamic> toJson() {

@ -147,6 +147,18 @@ class OffersAndPackagesServices extends BaseService {
var finished = 0;
var totalCalls = 3;
completedAll(){
finished++;
if(completion != null && finished == totalCalls) {
_hideLoading(context, showLoading);
completion();
}
}
_showLoading(context, showLoading);
final auth_token = await baseAppClient.generatePackagesToken();
if(auth_token == null){
throw 'Something went wrong while authentication, Please try again letter';
@ -162,18 +174,6 @@ class OffersAndPackagesServices extends BaseService {
}
}
completedAll(){
finished++;
if(completion != null && finished == totalCalls) {
_hideLoading(context, showLoading);
completion();
}
}
_showLoading(context, showLoading);
// Performing Parallel Request on same time
// # 1
getBestSellers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){
@ -283,7 +283,7 @@ class OffersAndPackagesServices extends BaseService {
var jsonResponse = json.decode(stringResponse);
var jsonCartItem = jsonResponse["shopping_carts"][0];
response = ResponseModel(status: true, data: PackagesCartItemsResponseModel.fromJson(jsonCartItem), error: null);
cartItemCount = response.data.quantity.toString();
cartItemCount = (jsonResponse['count'] ?? 0).toString();
}, onFailure: (String error, int statusCode){
_hideLoading(context, showLoading);
@ -334,19 +334,18 @@ class OffersAndPackagesServices extends BaseService {
// --------------------
// Place Order
// --------------------
Future placeOrder({@required Map paymentParams, @required BuildContext context, bool showLoading = true}) async{
Future placeOrder({@required Map<dynamic,dynamic> paymentParams, @required BuildContext context, bool showLoading = true}) async{
Future errorThrow;
var jsonBody = <String,dynamic>{
"order": {
"customer_id" : customer.id,
"billing_address": {
"email": patientUser.emailAddress,
"phone_number": patientUser.mobileNumber
},
}
Map<dynamic,dynamic> jsonBody = {
"customer_id" : customer.id,
"billing_address": {
"email": patientUser.emailAddress,
"phone_number": patientUser.mobileNumber
},
};
jsonBody.addAll(paymentParams);
jsonBody = {'order' : jsonBody};
int order_id;
_showLoading(context, showLoading);

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_mode
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/feedback/feedback-detail.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -28,10 +29,10 @@ class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
TextEditingController complainNumberController = TextEditingController();
StatusType statusType = StatusType.ComplaintNumber;
int selectedStatusIndex = 3;
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
projectViewModel = Provider.of(context);
return BaseView<FeedbackViewModel>(
allowAny: true,
onModelReady: (model) {
@ -202,38 +203,67 @@ class _StatusFeedbackPageState extends State<StatusFeedbackPage> {
shrinkWrap: isLogin ? false : true,
physics: isLogin ? null : NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => InkWell(
onTap: () {},
onTap: () {
// sss
},
child: Container(
decoration: cardRadius(12),
margin: EdgeInsets.all(10),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text(cOCItemList[index].formType.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))),
MyRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic),
Text(cOCItemList[index].cOCTitle,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(cOCItemList[index].date.split(" ")[0],
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
Text(cOCItemList[index].date.split(" ")[1].substring(0, 4),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
],
),
],
margin: EdgeInsets.only(top: 12),
decoration: BoxDecoration(
color: (cOCItemList[index].statusId==7||cOCItemList[index].statusId==8)?CustomColors.accentColor:(cOCItemList[index].statusId==10||cOCItemList[index].statusId==6||cOCItemList[index].statusId==9)?CustomColors.green:CustomColors.orange,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
child: Container(
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.only(
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
),
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text(cOCItemList[index].formType.toString(),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))),
MyRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic),
Text(cOCItemList[index].cOCTitle,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(cOCItemList[index].date.split(" ")[0],
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
Text(cOCItemList[index].date.split(" ")[1].substring(0, 4),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)),
],
),
],
),
),
),
),

@ -87,7 +87,7 @@ class _PackagesCartPageState extends State<PackagesCartPage>
'Failed to place order, please try again later');
}
}).catchError((error) {
utils.Utils.showErrorToast(error);
utils.Utils.showErrorToast(error.toString());
});
}
@ -217,7 +217,7 @@ class _PackagesCartPageState extends State<PackagesCartPage>
{@required int orderId, @required bool withStatus, dynamic data}) async {
viewModel.service.getOrderById(orderId, context: context).then((value) {
var heading = withStatus ? "Success" : "Failed";
var title = "Your order has been placed successfully";
var title = withStatus ? "Your order has been placed successfully" : "Failed to place your order";
var subTitle = "Order# ${value.data.customOrderNumber}";
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => PackageOrderCompletedPage(
@ -231,7 +231,7 @@ class _PackagesCartPageState extends State<PackagesCartPage>
// /* Payment Footer Widgets */
// ---------------------------
String _selectedPaymentMethod;
Map _selectedPaymentParams;
Map<dynamic,dynamic> _selectedPaymentParams;
Widget _paymentOptions(BuildContext context, Function(String) onSelected, {PackagesViewModel viewModel}) {
double height = 30;
@ -258,7 +258,7 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected, {Packa
Future<String> selectTamaraPaymentOption() async{
final tamara_options = await viewModel.service.getTamaraOptions(context: context, showLoading: true);
final selected = await SingleSelectionDialog<TamaraPaymentOption>(tamara_options, title: 'Select the tamara installment plan').show(context);
final selected = await SingleSelectionDialog<TamaraPaymentOption>(tamara_options, icon: Image.asset('assets/images/new-design/tamara.png'), title: TranslationBase.of(context).tamaraInstPlan).show(context);
return selected.name;
}
@ -271,13 +271,16 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected, {Packa
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
child: buttonContent(_selectedPaymentMethod == "tamara", 'mada.png'),
child: buttonContent(_selectedPaymentMethod == "tamara", 'tamara.png'),
onTap: () async{
final tamara_option = await selectTamaraPaymentOption();
_selectedPaymentParams = {"channel" : "Web", "payment_method_system_name" : "Payments.Tamara", "payment_option" : tamara_option};
onSelected("tamara");
},
),
SizedBox(
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "mada", 'mada.png'),
onTap: () {
@ -305,17 +308,17 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected, {Packa
onSelected("mastercard");
},
),
SizedBox(
width: 5,
),
InkWell(
child: buttonContent(
_selectedPaymentMethod == "installment", 'installment.png'),
onTap: () {
_selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "INSTALLMENT"};
onSelected("installment");
},
),
// SizedBox(
// width: 5,
// ),
// InkWell(
// child: buttonContent(
// _selectedPaymentMethod == "installment", 'installment.png'),
// onTap: () {
// _selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "INSTALLMENT"};
// onSelected("installment");
// },
// ),
],
),
),

@ -98,7 +98,7 @@ class _PackagesHomePageState extends State<PackagesHomePage> with AfterLayoutMix
await viewModel.service.addProductToCart(request, context: context).then((response){
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) {
utils.Utils.showErrorToast(error);
utils.Utils.showErrorToast(error.toString());
});
}
}

@ -63,11 +63,11 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
color: Color(0xFFF1F1F1),
child: Column(
children: [
SelectAddressWidget(model, widget.addresses),
SelectAddressWidget(model, widget.addresses,changeMainState),
SizedBox(
height: 10,
),
SelectPaymentOptionWidget(model),
SelectPaymentOptionWidget(model, changeMainState),
SizedBox(
height: 10,
),
@ -235,4 +235,9 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
),
);
}
changeMainState(){
setState(() {
});
}
}

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -25,39 +26,35 @@ import 'package:provider/provider.dart';
class SelectAddressWidget extends StatefulWidget {
final OrderPreviewViewModel model;
final List<Addresses> addresses;
final Function changeMainState;
SelectAddressWidget(this.model, this.addresses);
SelectAddressWidget(this.model, this.addresses, this.changeMainState);
@override
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
}
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Addresses address;
AddressInfo address;
_navigateToAddressPage() {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
.then((result) {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.paymentCheckoutData.address =
Addresses.fromJson(address.toJson());
widget.model.getInformationsByAddress();
widget.changeMainState();
}
/* setState(() {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
})*/
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.address != null) {
address = widget.model.paymentCheckoutData.address;
address = AddressInfo.fromJson(
widget.model.paymentCheckoutData.address.toJson());
}
super.initState();
}

@ -8,8 +8,9 @@ import 'package:flutter/material.dart';
class SelectPaymentOptionWidget extends StatefulWidget {
final OrderPreviewViewModel model;
final Function changeMainState;
SelectPaymentOptionWidget(this.model);
SelectPaymentOptionWidget(this.model, this.changeMainState);
@override
_SelectPaymentOptionWidgetState createState() => _SelectPaymentOptionWidgetState();
@ -19,14 +20,17 @@ class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
PaymentOption paymentOption;
_navigateToPaymentOption() {
Navigator.push(context, FadePage(page: PaymentMethodSelectPage())).then((result) => {
setState(() {
if (result != null) {
paymentOption = result;
widget.model.paymentCheckoutData.paymentOption = paymentOption;
}
})
});
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
.then((result) => {
setState(() {
if (result != null) {
paymentOption = result;
widget.model.paymentCheckoutData.paymentOption =
paymentOption;
}
widget.changeMainState();
})
});
}
@override

@ -2570,6 +2570,8 @@ class TranslationBase {
String get androidInstructions4 => localizedValues["android-instructions-4"][locale.languageCode];
String get tamaraInstPlan => localizedValues["tamaraInstPlan"][locale.languageCode];
String get onlineTag => localizedValues["onlineTag"][locale.languageCode];
String get offlineTag => localizedValues["offlineTag"][locale.languageCode];

@ -110,7 +110,7 @@ class RadioSelectionDialogState extends State<RadioSelectionDialog> {
Expanded(
child: DefaultButton(
TranslationBase.of(context).save,
() {
(){
Navigator.pop(context);
widget.onValueSelected(selectedIndex);
},

@ -13,8 +13,9 @@ import 'package:permission_handler/permission_handler.dart';
class SingleSelectionDialog<T> extends StatefulWidget {
final List<T> items;
final String title;
final Widget icon;
SingleSelectionDialog(this.items, {Widget icon, @required this.title});
SingleSelectionDialog(this.items, {@required this.icon, @required this.title});
Future<T> show(BuildContext context) async {
return showDialog<T>(
@ -32,6 +33,7 @@ class SingleSelectionDialog<T> extends StatefulWidget {
@override
_SingleSelectionDialogState createState() => _SingleSelectionDialogState();
}
class _SingleSelectionDialogState extends State<SingleSelectionDialog> {
@ -51,11 +53,12 @@ class _SingleSelectionDialogState extends State<SingleSelectionDialog> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.notifications_active,
color: Color(0xff2B353E),
size: 50,
SizedBox(
height: 40,
child: widget.icon,
),
IconButton(
icon: Icon(Icons.clear),
color: Color(0xff2B353E),
@ -95,33 +98,33 @@ class _SingleSelectionDialogState extends State<SingleSelectionDialog> {
}
Widget optionList(List<dynamic> options){
return ListView(
shrinkWrap: true,
children: List.generate(options.length, (index){
final opt = options[index];
return Row(
children: [
Radio<int>(
value: index,
groupValue: i,
onChanged: (int value) {
setState(() {
i = value;
});
},
),
Text(
opt.toString(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
return ListView.builder(
shrinkWrap: true,
itemCount: options.length,
itemBuilder: (ctx,idx){
final opt = options[idx];
return Row(
children: [
Radio<int>(
value: idx,
groupValue: i,
onChanged: (int value) {
setState(() {
i = value;
});
},
),
),
],
);
}),
Text(
opt.toString(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
),
],
);
}
);
}
}

Loading…
Cancel
Save