Merge branch 'development_new_design_2.0' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into hussam_pharmacy_fix

merge-update-with-lab-changes
hussam al-habibeh 4 years ago
commit b2b786d157

@ -1631,11 +1631,40 @@ const Map localizedValues = {
"RRTTitle": {"en": "RRT", "ar": "خدمة فريق"},
"RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"},
"transportation": {"en": "Transportation", "ar": "النقل"},
"neck": {"en": "Neck", "ar": "رقبه"},
"waist": {"en": "Waist", "ar": "وسط"},
"hip": {"en": "Hip", "ar": "ورك او نتوء"},
"carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"},
"myCart": {"en": "Cart", "ar": "عربة التسوق"},
"browseOffers": {"en": "Browse offers by clinic", "ar": "تصفح العروض حسب العيادة"},
"inactiveAct":{"en":"Almost inactive (little or no exercise)","ar":"غير نشط تقريبا (ممارسة الرياضة قليلة أو منعدمة)"},
"light":{"en":"Lightly active (1-3) days per week","ar":"خفيف النشاط (1-3 أيام في الأسبوع)"},
"moderate":{"en":"Moderately active (3-5) days per week)","ar":"معتدل النشاط (3-5 أيام في الأسبوع)"},
"very":{"en":"Very active (6-7) days per week)","ar":"نشط جداُ (6-7 أيام في الأسبوع)"},
"super":{"en":"Super active (very hard exercise)","ar":"عالي النشاط (ممارسة الرياضة الصعبة)"},
"resultCalories": {"en": "Daily intake is (#) calories", "ar": "الإحتياج اليومي (#) سعرة حرارية"},
"bmrDesc": {"en": "Calculates the amount of energy that the persons body expends in a day", "ar": "معدل الأيض القاعدي: هو حساب كمية الطاقة التي يحتاجها الجسم في اليوم الواحد"},
"idealWeightDesc": {"en": "Calculates the ideal body weight based on height, Weight, and Body Size", "ar": "حساب الوزن المثالي والوزن الصحي للجسم على أساس الطول، والوزن ،والجسم"},
"bodyFrame": {"en": "Body Frame Size", "ar": "مقاس هيكل الجسم"},
"bodyFrameSmall": {"en": "Small (fingers overlap)", "ar": "رفيع (الأصابع تتداخل)"},
"bodyFrameMedium": {"en": "Medium (fingers touch)", "ar": "متوسط (الأصابع تتلامس)"},
"bodyFrameLarge": {"en": "Large (fingers don't touch)", "ar": "عريض (الأصابع لا تتلامس)"},
"bodyFatDesc": {"en": "Estimates the total body fat based on the size", "ar": "حساب الدهون في الجسم بناءاً على الحجم"},
"essential":{"en":"The category falls under Essential Fat.","ar":"تندرج تحت فئة دهون أساسية"},
"athlete":{"en":" The category falls under Athlete.","ar":"تندرج تحت فئة دهون جسم رياضي"},
"fitness":{"en":" The category falls under Fitness.","ar":"تندرج تحت فئة دهون جسم صحي"},
"acceptable":{"en":"The category falls under Acceptable","ar":"تندرج تحت فئة دهون مقبولة"},
"obeseBodyFat":{"en":"The category falls under Obese.","ar":"تندرج تحت فئة دهون جسم سمين"},
"invalid":{"en":"Invalid input for calculation.","ar":"البيانات المدخلة غير صالحة للحساب"},
"more":{"en":"Please check the value you have entered, since the body fat percentage has crossed the limits.","ar":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم قد تجاوزت الحدود"},
"less":{"en":"Please check the value you have entered, since the body fat percentage cannot be this low.","ar":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم لا يمكن أن تكون منخفضة"},
"carbProteinDesc": {"en": "Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio", "ar": "حساب نسب الكربوهيدرات و البروتينات و الدهون بالسعرات الحرارية والغرامات وفقا لنسب محددة مسبقا"},
"calDay": {"en": "Calories Per Day", "ar": "السعرات الحرارية في اليوم الواحد"},
"notSure": {"en": "Not sure? click here", "ar": "غير متأكد؟ اضغط هنا"},
"selectDiet": {"en": "Select Diet Type", "ar": "حدد نوع النظام الغذائي"},
"dietVeryLow":{"en":"Very Low Carb","ar":"حمية منخفضة جدا في الكربوهيدرات"},
"dietLow":{"en":"Low Carb","ar":"حمية منخفضة الكربوهيدرات"},
"dietModerate":{"en":"Moderate Carb","ar":"حمية معتدلة الكربوهيدرات"},
"dietUSDA":{"en":"USDA Guidelines","ar":"ارشادات وزارة الزراعة الأمريكية"},
"dietZone":{"en":"Zone Diet","ar":"حمية زون"},
};

@ -481,7 +481,7 @@ class BaseAppClient {
simplePost(
String fullUrl, {
Map<String, dynamic> body,
Map<dynamic, dynamic> body,
Map<String, String> headers,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,
@ -496,7 +496,6 @@ class BaseAppClient {
body: json.encode(body),
headers: headers,
);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers);

@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/ResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/CreateCustomerRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
@ -15,13 +16,11 @@ import 'package:diplomaticquarterapp/core/model/packages_offers/responses/Packag
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/order_response_model.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/tamara_payment_option.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:flutter/cupertino.dart';
var packagesAuthHeader = <String, String>{'Authorization': ''};
Map<String, String> packagesAuthHeader = {};
class OffersAndPackagesServices extends BaseService {
AuthenticatedUser patientUser;
@ -32,64 +31,52 @@ class OffersAndPackagesServices extends BaseService {
List<PackagesResponseModel> bestSellerList = List();
List<PackagesResponseModel> bannersList = List();
List<PackagesCartItemsResponseModel> cartItemList = List();
List<HospitalsModel> _hospitals = List();
List<HospitalsModel> get hospitals => _hospitals;
String cartItemCount = "";
PackagesCustomerResponseModel customer;
Future<List<PackagesCategoriesResponseModel>> getAllCategories(
OffersCategoriesRequestModel request) async {
Future<List<PackagesCategoriesResponseModel>> getAllCategories(OffersCategoriesRequestModel request) async {
Future errorThrow;
var url = EXA_CART_API_BASE_URL + PACKAGES_CATEGORIES;
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['categories'].forEach((json) {
categoryList.add(PackagesCategoriesResponseModel().fromJson(json));
});
}
},
onFailure: (String error, int statusCode) {},
queryParams: request.toFlatMap());
}, onFailure: (String error, int statusCode) {}, queryParams: request.toFlatMap());
return categoryList;
}
Future<List<PackagesResponseModel>> getAllProducts(
{@required OffersProductsRequestModel request,
@required BuildContext context,
@required bool showLoading = true}) async {
Future<List<PackagesResponseModel>> getAllProducts({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
Future errorThrow;
request.sinceId = (productList.isNotEmpty) ? productList.last.id : 0;
productList = List();
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
productList.add(PackagesResponseModel().fromJson(json));
});
}
},
onFailure: (String error, int statusCode) {},
queryParams: request.toFlatMap());
}, onFailure: (String error, int statusCode) {}, queryParams: request.toFlatMap());
return productList;
}
Future<List<TamaraPaymentOption>> getTamaraOptions(
{@required BuildContext context,
@required bool showLoading = true}) async {
if (tamaraPaymentOptions != null && tamaraPaymentOptions.isNotEmpty)
return tamaraPaymentOptions;
Future<List<TamaraPaymentOption>> getTamaraOptions({@required BuildContext context, @required bool showLoading = true}) async {
if (tamaraPaymentOptions != null && tamaraPaymentOptions.isNotEmpty) return tamaraPaymentOptions;
var url = EXA_CART_API_BASE_URL + PACKAGES_TAMARA_OPT;
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['payment_option'].forEach((json) {
@ -103,14 +90,10 @@ class OffersAndPackagesServices extends BaseService {
return tamaraPaymentOptions;
}
Future<List<PackagesResponseModel>> getLatestOffers(
{@required OffersProductsRequestModel request,
@required BuildContext context,
@required bool showLoading = true}) async {
Future<List<PackagesResponseModel>> getLatestOffers({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
latestOffersList.clear();
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
latestOffersList.clear();
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
@ -124,14 +107,10 @@ class OffersAndPackagesServices extends BaseService {
return latestOffersList;
}
Future<List<PackagesResponseModel>> getBestSellers(
{@required OffersProductsRequestModel request,
@required BuildContext context,
@required bool showLoading = true}) async {
Future<List<PackagesResponseModel>> getBestSellers({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
bestSellerList.clear();
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
bestSellerList.clear();
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
@ -145,13 +124,9 @@ class OffersAndPackagesServices extends BaseService {
return bestSellerList;
}
Future<List<PackagesResponseModel>> getBanners(
{@required OffersProductsRequestModel request,
@required BuildContext context,
@required bool showLoading = true}) async {
Future<List<PackagesResponseModel>> getBanners({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
@ -165,10 +140,7 @@ class OffersAndPackagesServices extends BaseService {
return bannersList;
}
Future loadOffersPackagesDataForMainPage(
{@required BuildContext context,
bool showLoading = true,
Function completion}) async {
Future loadOffersPackagesDataForMainPage({@required BuildContext context, bool showLoading = true, Function completion}) async {
var finished = 0;
var totalCalls = 2;
@ -190,30 +162,20 @@ class OffersAndPackagesServices extends BaseService {
// Check and Create Customer
if (patientUser != null) {
customer =
await getCurrentCustomer(context: context, showLoading: showLoading);
customer = await getCurrentCustomer(context: context, showLoading: showLoading);
if (customer == null) {
createCustomer(PackagesCustomerRequestModel.fromUser(patientUser),
context: context);
createCustomer(PackagesCustomerRequestModel.fromUser(patientUser), context: context);
}
}
// Performing Parallel Request on same time
// # 1
getBestSellers(
request: OffersProductsRequestModel(),
context: context,
showLoading: false)
.then((value) {
getBestSellers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value) {
completedAll();
});
// # 2
getLatestOffers(
request: OffersProductsRequestModel(),
context: context,
showLoading: false)
.then((value) {
getLatestOffers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value) {
completedAll();
});
@ -230,10 +192,7 @@ class OffersAndPackagesServices extends BaseService {
// --------------------
// Create Customer
// --------------------
Future createCustomer(PackagesCustomerRequestModel request,
{@required BuildContext context,
bool showLoading = true,
Function(bool) completion}) async {
Future createCustomer(PackagesCustomerRequestModel request, {@required BuildContext context, bool showLoading = true, Function(bool) completion}) async {
if (customer != null) return Future.value(customer);
customer = null;
@ -241,9 +200,7 @@ class OffersAndPackagesServices extends BaseService {
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_CUSTOMER;
await baseAppClient
.simplePost(url, headers: packagesAuthHeader, body: request.json(),
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode) {
var jsonResponse = json.decode(stringResponse);
var customerJson = jsonResponse['customers'].first;
customer = PackagesCustomerResponseModel.fromJson(customerJson);
@ -258,16 +215,12 @@ class OffersAndPackagesServices extends BaseService {
return errorThrow ?? customer;
}
Future<PackagesCustomerResponseModel> getCurrentCustomer(
{@required BuildContext context, bool showLoading = true}) async {
Future<PackagesCustomerResponseModel> getCurrentCustomer({@required BuildContext context, bool showLoading = true}) async {
if (customer != null) return Future.value(customer);
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL +
PACKAGES_CUSTOMER +
"/username/${patientUser.patientID}";
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
var url = EXA_CART_API_BASE_URL + PACKAGES_CUSTOMER + "/username/${patientUser.patientID}";
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
var jsonResponse = json.decode(stringResponse);
var customerJson = jsonResponse['customers'].first;
customer = PackagesCustomerResponseModel.fromJson(customerJson);
@ -282,17 +235,14 @@ class OffersAndPackagesServices extends BaseService {
// --------------------
// Shopping Cart
// --------------------
Future<Map<String, dynamic>> cartItems(
{@required BuildContext context, bool showLoading = true}) async {
Future<Map<String, dynamic>> cartItems({@required BuildContext context, bool showLoading = true}) async {
Future errorThrow;
cartItemList.clear();
_showLoading(context, showLoading);
var url =
EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/${customer.id}';
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/${customer.id}';
Map<String, dynamic> jsonResponse;
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
jsonResponse = json.decode(stringResponse);
@ -308,10 +258,7 @@ class OffersAndPackagesServices extends BaseService {
return errorThrow ?? jsonResponse;
}
Future<ResponseModel<PackagesCartItemsResponseModel>> addProductToCart(
AddProductToCartRequestModel request,
{@required BuildContext context,
bool showLoading = true}) async {
Future<ResponseModel<PackagesCartItemsResponseModel>> addProductToCart(AddProductToCartRequestModel request, {@required BuildContext context, bool showLoading = true}) async {
Future errorThrow;
ResponseModel<PackagesCartItemsResponseModel> response;
@ -319,38 +266,27 @@ class OffersAndPackagesServices extends BaseService {
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART;
await baseAppClient
.simplePost(url, headers: packagesAuthHeader, body: request.json(),
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
var jsonCartItem = jsonResponse["shopping_carts"][0];
response = ResponseModel(
status: true,
data: PackagesCartItemsResponseModel.fromJson(jsonCartItem),
error: null);
response = ResponseModel(status: true, data: PackagesCartItemsResponseModel.fromJson(jsonCartItem), error: null);
cartItemCount = (jsonResponse['count'] ?? 0).toString();
}, onFailure: (String error, int statusCode) {
_hideLoading(context, showLoading);
errorThrow =
Future.error(ResponseModel(status: true, data: null, error: error));
errorThrow = Future.error(ResponseModel(status: true, data: null, error: error));
});
return errorThrow ?? response;
}
Future updateProductToCart(int cartItemID,
{UpdateProductToCartRequestModel request,
@required BuildContext context,
bool showLoading = true}) async {
Future updateProductToCart(int cartItemID, {UpdateProductToCartRequestModel request, @required BuildContext context, bool showLoading = true}) async {
Future errorThrow;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/$cartItemID';
await baseAppClient
.simplePut(url, headers: packagesAuthHeader, body: request.json(),
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simplePut(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
@ -363,16 +299,13 @@ class OffersAndPackagesServices extends BaseService {
return errorThrow ?? bannersList;
}
Future<bool> deleteProductFromCart(int cartItemID,
{@required BuildContext context, bool showLoading = true}) async {
Future<bool> deleteProductFromCart(int cartItemID, {@required BuildContext context, bool showLoading = true}) async {
Future errorThrow;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/$cartItemID';
await baseAppClient.simpleDelete(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simpleDelete(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
// var jsonResponse = json.decode(stringResponse);
}, onFailure: (String error, int statusCode) {
_hideLoading(context, showLoading);
log(error);
@ -385,28 +318,23 @@ class OffersAndPackagesServices extends BaseService {
// --------------------
// Place Order
// --------------------
Future placeOrder(
{@required Map<dynamic, dynamic> paymentParams,
@required BuildContext context,
bool showLoading = true}) async {
Future placeOrder({@required Map<dynamic, dynamic> paymentParams, @required int projectID, @required BuildContext context, bool showLoading = true}) async {
Future errorThrow;
Map<dynamic, dynamic> jsonBody = {
"customer_id": customer.id,
"billing_address": {
"email": patientUser.emailAddress,
"phone_number": patientUser.mobileNumber
},
"project_id": projectID,
"billing_address": {"email": patientUser.emailAddress, "phone_number": patientUser.mobileNumber},
};
jsonBody.addAll(paymentParams);
jsonBody = {'order': jsonBody};
print(jsonBody);
int order_id;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_ORDERS;
await baseAppClient.simplePost(url,
headers: packagesAuthHeader,
body: jsonBody, onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: jsonBody, onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
@ -420,21 +348,18 @@ class OffersAndPackagesServices extends BaseService {
return errorThrow ?? order_id;
}
Future<ResponseModel<PackagesOrderResponseModel>> getOrderById(int id,
{@required BuildContext context, bool showLoading = true}) async {
Future<ResponseModel<PackagesOrderResponseModel>> getOrderById(int id, {@required BuildContext context, bool showLoading = true}) async {
Future errorThrow;
ResponseModel<PackagesOrderResponseModel> response;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_ORDERS + '/$id';
await baseAppClient.simpleGet(url, headers: packagesAuthHeader,
onSuccess: (dynamic stringResponse, int statusCode) {
await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
var jsonOrder = jsonResponse['orders'][0];
response = ResponseModel(
status: true, data: PackagesOrderResponseModel.fromJson(jsonOrder));
response = ResponseModel(status: true, data: PackagesOrderResponseModel.fromJson(jsonOrder));
}, onFailure: (String error, int statusCode) {
_hideLoading(context, showLoading);
errorThrow = Future.error(ResponseModel(status: false, error: error));
@ -442,6 +367,26 @@ class OffersAndPackagesServices extends BaseService {
return errorThrow ?? response;
}
Future getHospitals({bool isResBasedOnLoc = true}) async {
Map<String, dynamic> body = Map();
body['Latitude'] = await this.sharedPref.getDouble(USER_LAT);
body['Longitude'] = await this.sharedPref.getDouble(USER_LONG);
body['IsOnlineCheckIn'] = isResBasedOnLoc;
body['PatientOutSA'] = 0;
await baseAppClient.post(GET_PROJECT,
onSuccess: (dynamic response, int statusCode) {
_hospitals.clear();
response['ListProject'].forEach((hospital) {
_hospitals.add(HospitalsModel.fromJson(hospital));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}
_showLoading(BuildContext context, bool flag) {

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
@ -22,6 +23,7 @@ class PackagesViewModel extends BaseViewModel {
List<PackagesResponseModel> get bestSellerList => service.bestSellerList;
List<PackagesResponseModel> get bannersList => service.bannersList;
List<PackagesCartItemsResponseModel> get cartItemList => service.cartItemList;
List<HospitalsModel> get hospitals => service.hospitals;
String _cartItemCount = "";

@ -1,21 +1,20 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../locator.dart';
class ProductDetailViewModel extends BaseViewModel{
class ProductDetailViewModel extends BaseViewModel {
ProductDetailService _productDetailService = locator<ProductDetailService>();
List<ProductDetail> get productDetailService => _productDetailService.productDetailList;
@ -28,6 +27,11 @@ class ProductDetailViewModel extends BaseViewModel{
bool hasError = false;
num get stockQuantity => _productDetailService.stockQuantity;
String get stockAvailability => _productDetailService.stockAvailability;
bool get isStockAvailable => _productDetailService.isStockAvailable;
Future getProductReviewsData(productID) async {
hasError = false;
@ -72,8 +76,7 @@ class ProductDetailViewModel extends BaseViewModel{
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
Provider.of<OrderPreviewViewModel>(locator<NavigationService>().navigatorKey.currentContext, listen: false)
.setShoppingCartResponse( object);
Provider.of<OrderPreviewViewModel>(locator<NavigationService>().navigatorKey.currentContext, listen: false).setShoppingCartResponse(object);
}
}
@ -103,11 +106,9 @@ class ProductDetailViewModel extends BaseViewModel{
Future addToWishlistData(itemID) async {
hasError = false;
setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(
locator<NavigationService>().navigatorKey.currentContext);
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.addToWishlist(itemID);
GifLoaderDialogUtils.hideDialog(
locator<NavigationService>().navigatorKey.currentContext);
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
if (_productDetailService.hasError) {
error = _productDetailService.error;
@ -127,15 +128,12 @@ class ProductDetailViewModel extends BaseViewModel{
setState(ViewState.Idle);
}
Future deleteWishlistData(itemID) async {
hasError = false;
setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(
locator<NavigationService>().navigatorKey.currentContext);
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.deleteItemFromWishlist(itemID);
GifLoaderDialogUtils.hideDialog(
locator<NavigationService>().navigatorKey.currentContext);
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
if (_productDetailService.hasError) {
error = _productDetailService.error;
@ -144,7 +142,6 @@ class ProductDetailViewModel extends BaseViewModel{
setState(ViewState.Idle);
}
Future productSpecificationData(itemID) async {
hasError = false;
setState(ViewState.Busy);
@ -156,10 +153,7 @@ class ProductDetailViewModel extends BaseViewModel{
setState(ViewState.Idle);
}
clearReview(){
clearReview() {
productDetailService.clear();
}
}
}

@ -1,7 +1,3 @@
// To parse this JSON data, do
//
// final productDetail = productDetailFromJson(jsonString);
import 'dart:convert';
List<ProductDetail> productDetailFromJson(String str) => List<ProductDetail>.from(json.decode(str).map((x) => ProductDetail.fromJson(x)));
@ -16,12 +12,12 @@ class ProductDetail {
List<Review> reviews;
factory ProductDetail.fromJson(Map<String, dynamic> json) => ProductDetail(
reviews: List<Review>.from(json["reviews"].map((x) => Review.fromJson(x))),
);
reviews: List<Review>.from(json["reviews"].map((x) => Review.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"reviews": List<dynamic>.from(reviews.map((x) => x.toJson())),
};
"reviews": List<dynamic>.from(reviews.map((x) => x.toJson())),
};
}
class Review {
@ -62,42 +58,42 @@ class Review {
dynamic product;
factory Review.fromJson(Map<String, dynamic> json) => Review(
id: json["id"],
position: json["position"],
reviewId: json["review_id"],
customerId: json["customer_id"],
productId: json["product_id"],
storeId: json["store_id"],
isApproved: json["is_approved"],
title: json["title"],
reviewText: json["review_text"],
replyText: json["reply_text"],
rating: json["rating"],
helpfulYesTotal: json["helpful_yes_total"],
helpfulNoTotal: json["helpful_no_total"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
customer: Customer.fromJson(json["customer"]),
product: json["product"],
);
id: json["id"],
position: json["position"],
reviewId: json["review_id"],
customerId: json["customer_id"],
productId: json["product_id"],
storeId: json["store_id"],
isApproved: json["is_approved"],
title: json["title"],
reviewText: json["review_text"],
replyText: json["reply_text"],
rating: json["rating"],
helpfulYesTotal: json["helpful_yes_total"],
helpfulNoTotal: json["helpful_no_total"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
customer: Customer.fromJson(json["customer"]),
product: json["product"],
);
Map<String, dynamic> toJson() => {
"id": id,
"position": position,
"review_id": reviewId,
"customer_id": customerId,
"product_id": productId,
"store_id": storeId,
"is_approved": isApproved,
"title": title,
"review_text": reviewText,
"reply_text": replyText,
"rating": rating,
"helpful_yes_total": helpfulYesTotal,
"helpful_no_total": helpfulNoTotal,
"created_on_utc": createdOnUtc.toIso8601String(),
"customer": customer.toJson(),
"product": product,
};
"id": id,
"position": position,
"review_id": reviewId,
"customer_id": customerId,
"product_id": productId,
"store_id": storeId,
"is_approved": isApproved,
"title": title,
"review_text": reviewText,
"reply_text": replyText,
"rating": rating,
"helpful_yes_total": helpfulYesTotal,
"helpful_no_total": helpfulNoTotal,
"created_on_utc": createdOnUtc.toIso8601String(),
"customer": customer.toJson(),
"product": product,
};
}
class Customer {
@ -164,75 +160,73 @@ class Customer {
dynamic registeredInStoreId;
factory Customer.fromJson(Map<String, dynamic> json) => Customer(
fileNumber: json["file_number"],
iqamaNumber: json["iqama_number"],
isOutSa: json["is_out_sa"],
patientType: json["patient_type"],
gender: json["gender"],
birthDate: DateTime.parse(json["birth_date"]),
phone: json["phone"],
countryCode: json["country_code"],
yahalaAccountno: json["yahala_accountno"],
billingAddress: json["billing_address"],
shippingAddress: json["shipping_address"],
id: json["id"],
username: emailValues.map[json["username"]],
email: emailValues.map[json["email"]],
firstName: json["first_name"],
lastName: json["last_name"],
languageId: json["language_id"],
adminComment: json["admin_comment"],
isTaxExempt: json["is_tax_exempt"],
hasShoppingCartItems: json["has_shopping_cart_items"],
active: json["active"],
deleted: json["deleted"],
isSystemAccount: json["is_system_account"],
systemName: json["system_name"],
lastIpAddress: json["last_ip_address"],
createdOnUtc: json["created_on_utc"],
lastLoginDateUtc: json["last_login_date_utc"],
lastActivityDateUtc: json["last_activity_date_utc"],
registeredInStoreId: json["registered_in_store_id"],
);
fileNumber: json["file_number"],
iqamaNumber: json["iqama_number"],
isOutSa: json["is_out_sa"],
patientType: json["patient_type"],
gender: json["gender"],
birthDate: DateTime.parse(json["birth_date"]),
phone: json["phone"],
countryCode: json["country_code"],
yahalaAccountno: json["yahala_accountno"],
billingAddress: json["billing_address"],
shippingAddress: json["shipping_address"],
id: json["id"],
username: emailValues.map[json["username"]],
email: emailValues.map[json["email"]],
firstName: json["first_name"],
lastName: json["last_name"],
languageId: json["language_id"],
adminComment: json["admin_comment"],
isTaxExempt: json["is_tax_exempt"],
hasShoppingCartItems: json["has_shopping_cart_items"],
active: json["active"],
deleted: json["deleted"],
isSystemAccount: json["is_system_account"],
systemName: json["system_name"],
lastIpAddress: json["last_ip_address"],
createdOnUtc: json["created_on_utc"],
lastLoginDateUtc: json["last_login_date_utc"],
lastActivityDateUtc: json["last_activity_date_utc"],
registeredInStoreId: json["registered_in_store_id"],
);
Map<String, dynamic> toJson() => {
"file_number": fileNumber,
"iqama_number": iqamaNumber,
"is_out_sa": isOutSa,
"patient_type": patientType,
"gender": gender,
"birth_date": birthDate.toIso8601String(),
"phone": phone,
"country_code": countryCode,
"yahala_accountno": yahalaAccountno,
"billing_address": billingAddress,
"shipping_address": shippingAddress,
"id": id,
"username": emailValues.reverse[username],
"email": emailValues.reverse[email],
"first_name": firstName,
"last_name": lastName,
"language_id": languageId,
"admin_comment": adminComment,
"is_tax_exempt": isTaxExempt,
"has_shopping_cart_items": hasShoppingCartItems,
"active": active,
"deleted": deleted,
"is_system_account": isSystemAccount,
"system_name": systemName,
"last_ip_address": lastIpAddress,
"created_on_utc": createdOnUtc,
"last_login_date_utc": lastLoginDateUtc,
"last_activity_date_utc": lastActivityDateUtc,
"registered_in_store_id": registeredInStoreId,
};
"file_number": fileNumber,
"iqama_number": iqamaNumber,
"is_out_sa": isOutSa,
"patient_type": patientType,
"gender": gender,
"birth_date": birthDate.toIso8601String(),
"phone": phone,
"country_code": countryCode,
"yahala_accountno": yahalaAccountno,
"billing_address": billingAddress,
"shipping_address": shippingAddress,
"id": id,
"username": emailValues.reverse[username],
"email": emailValues.reverse[email],
"first_name": firstName,
"last_name": lastName,
"language_id": languageId,
"admin_comment": adminComment,
"is_tax_exempt": isTaxExempt,
"has_shopping_cart_items": hasShoppingCartItems,
"active": active,
"deleted": deleted,
"is_system_account": isSystemAccount,
"system_name": systemName,
"last_ip_address": lastIpAddress,
"created_on_utc": createdOnUtc,
"last_login_date_utc": lastLoginDateUtc,
"last_activity_date_utc": lastActivityDateUtc,
"registered_in_store_id": registeredInStoreId,
};
}
enum Email { STEVE_GATES_NOP_COMMERCE_COM }
final emailValues = EnumValues({
"steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM
});
final emailValues = EnumValues({"steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM});
class EnumValues<T> {
Map<String, T> map;

@ -4,13 +4,11 @@ import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
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/services.dart';
import '../health_calc_desc.dart';
import 'result_page.dart';
const activeCardColor = Color(0xff70777A);
@ -47,9 +45,10 @@ class _BMICalculatorState extends State<BMICalculator> {
}
double calculateBMI() {
if (_isHeightCM) {
convertToCm(_heightValue.toDouble());
}
if (!_isHeightCM) _heightValue = convertToCm(_heightValue.toDouble());
if (!_isWeightKG) _weightValue = convertToKg(_weightValue);
bmiResult = _weightValue / pow(_heightValue / 100, 2);
return bmiResult;

@ -78,7 +78,7 @@ class _ResultPageState extends State<ResultPage> {
mainAxisSize: MainAxisSize.min,
children: [
Text(
TranslationBase.of(context).bodyMassIndex + widget.finalResult.toString(),
TranslationBase.of(context).bodyMassIndex + widget.finalResult.toStringAsFixed(2),
style: TextStyle(
fontSize: 16,
letterSpacing: -0.64,

@ -48,7 +48,7 @@ class _BmrCalculatorState extends State<BmrCalculator> {
// int height = 0;
// int weight = 0;
double bmrResult = 0;
String dropdownValue = 'Lighty Active (1-3) days per week';
String dropdownValue = '';
double calories = 0;
void updateColor(int type) {
@ -122,13 +122,13 @@ class _BmrCalculatorState extends State<BmrCalculator> {
}
void calculateCalories() {
if (dropdownValue == "Almost Inactive(Little or no exercises)") {
if (dropdownValue == TranslationBase.of(context).inactiveAct) {
calories = bmrResult * 1.2;
} else if (dropdownValue == "Lighty Active (1-3) days per week") {
} else if (dropdownValue == TranslationBase.of(context).light) {
calories = bmrResult * 1.375;
} else if (dropdownValue == "very Active(6-7) days per week") {
} else if (dropdownValue == TranslationBase.of(context).very) {
calories = bmrResult * 1.55;
} else if (dropdownValue == "Super Active(very hard exercises)") {
} else if (dropdownValue == TranslationBase.of(context).superAct) {
calories = bmrResult * 1.725;
} else if (dropdownValue == "") {
calories = bmrResult * 10.725;
@ -137,6 +137,7 @@ class _BmrCalculatorState extends State<BmrCalculator> {
@override
Widget build(BuildContext context) {
dropdownValue = TranslationBase.of(context).light;
ProjectViewModel projectViewModel = Provider.of(context);
_weightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
@ -161,7 +162,7 @@ class _BmrCalculatorState extends State<BmrCalculator> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Calculates the amount of energy that the persons body expends in a day',
TranslationBase.of(context).bmrDesc,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
@ -362,14 +363,14 @@ class _BmrCalculatorState extends State<BmrCalculator> {
});
},
items: <String>[
'Almost Inactive(Little or no exercises)',
'Lighty Active (1-3) days per week',
'very Active(6-7) days per week',
'Super Active(very hard exercises)'
TranslationBase.of(context).inactiveAct,
TranslationBase.of(context).light,
TranslationBase.of(context).very,
TranslationBase.of(context).superAct,
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
);
}).toList(),
),

@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
@ -23,7 +22,6 @@ class BodyFat extends StatefulWidget {
}
class _BodyFatState extends State<BodyFat> {
final GlobalKey clinicDropdownKey = GlobalKey();
bool _isHeightCM = true;
bool _isNeckKG = true;
@ -34,7 +32,6 @@ class _BodyFatState extends State<BodyFat> {
double _waistValue = 0;
double _hipValue = 0;
TextEditingController _heightController = new TextEditingController();
TextEditingController _neckController = TextEditingController();
TextEditingController _waistController = TextEditingController();
@ -45,12 +42,12 @@ class _BodyFatState extends State<BodyFat> {
List<PopupMenuItem> _waistPopupList = List();
List<PopupMenuItem> _hipPopupList = List();
bool isMale = false;
// bool isHeightCm = true;
Color maleCard = activeCardColorGender;
Color femaleCard = inactiveCardColorGender;
// Color neckCmCard = activeCardColor;
// Color neckFtCard = inactiveCardColor;
Color waistCmCard = activeCardColor;
@ -59,6 +56,7 @@ class _BodyFatState extends State<BodyFat> {
Color hipFtCard = inactiveCardColor;
Color cmCard = activeCardColor;
Color ftCard = inactiveCardColor;
// int neck = 10;
// int heightCm = 0;
// int heightFt = 0;
@ -67,6 +65,7 @@ class _BodyFatState extends State<BodyFat> {
double minRange;
double maxRange;
double overWeightBy;
// int waist = 5;
double bodyFat = 0;
double fat = 0;
@ -74,8 +73,6 @@ class _BodyFatState extends State<BodyFat> {
double calories = 0;
String textResult = '';
@override
void initState() {
_neckController.text = _neckValue.toString();
@ -105,8 +102,6 @@ class _BodyFatState extends State<BodyFat> {
}
}
void updateColorWaist(int type) {
//MG/DLT card
if (type == 1) {
@ -183,33 +178,33 @@ class _BodyFatState extends State<BodyFat> {
void showTextResult() {
if (isMale == false) {
if (bodyFat > 9 && bodyFat <= 13) {
textResult = 'The category falls under essential';
textResult = TranslationBase.of(context).essential;
} else if (bodyFat > 13 && bodyFat <= 20) {
textResult = 'The category falls under athlete';
textResult = TranslationBase.of(context).athlete;
} else if (bodyFat > 20 && bodyFat <= 24) {
textResult = 'The category falls under fitness';
textResult = TranslationBase.of(context).fitness;
} else if (bodyFat > 24 && bodyFat <= 31) {
textResult = 'The category falls under acceptable';
textResult = TranslationBase.of(context).acceptable;
} else if (bodyFat > 31 && bodyFat <= 60) {
textResult = 'The category falls under obese';
textResult = TranslationBase.of(context).obeseBodyFat;
} else if (bodyFat > 60) {
textResult = 'Please check the value you have entered, since the body fat percentage has crosed the limits.';
textResult = TranslationBase.of(context).more;
} else if (bodyFat <= 9) {
textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.';
textResult = TranslationBase.of(context).less;
}
} else {
if (bodyFat > 5 && fat <= 13) {
textResult = 'The category falls under essential';
textResult = TranslationBase.of(context).essential;
} else if (bodyFat > 13 && bodyFat <= 17) {
textResult = 'The category falls under athlete';
textResult = TranslationBase.of(context).athlete;
} else if (bodyFat > 17 && bodyFat <= 24) {
textResult = 'The category falls under fitness';
textResult = TranslationBase.of(context).fitness;
} else if (bodyFat > 24 && bodyFat <= 45) {
textResult = 'The category falls under obese';
textResult = TranslationBase.of(context).obeseBodyFat;
} else if (bodyFat > 45) {
textResult = 'Please check the value you have entered, since the body fat percentage has crosed the limits.';
textResult = TranslationBase.of(context).more;
} else if (bodyFat <= 5) {
textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.';
textResult = TranslationBase.of(context).less;
}
}
}
@ -234,12 +229,12 @@ class _BodyFatState extends State<BodyFat> {
Expanded(
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(20),
padding: EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Estimates the total body fat based on\nthe size',
TranslationBase.of(context).bodyFatDesc,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
@ -346,14 +341,14 @@ class _BodyFatState extends State<BodyFat> {
1,
270,
_heightValue,
(text) {
(text) {
_heightController.text = text;
},
(value) {
(value) {
_heightValue = value;
},
_isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
(value) {
(value) {
if (_isHeightCM != value) {
setState(() {
_isHeightCM = value;
@ -371,14 +366,14 @@ class _BodyFatState extends State<BodyFat> {
1,
270,
_neckValue,
(text) {
_neckController.text = text;
(text) {
_neckController.text = text;
},
(value) {
_neckValue = value;
(value) {
_neckValue = value;
},
_isNeckKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
(value) {
(value) {
if (_isNeckKG != value) {
setState(() {
_isNeckKG = value;
@ -387,7 +382,6 @@ class _BodyFatState extends State<BodyFat> {
},
_neckPopupList,
),
SizedBox(
height: 12.0,
),
@ -397,14 +391,14 @@ class _BodyFatState extends State<BodyFat> {
1,
270,
_waistValue,
(text) {
_waistController.text = text;
(text) {
_waistController.text = text;
},
(value) {
(value) {
_waistValue = value;
},
_isWaistKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
(value) {
(value) {
if (_isWaistKG != value) {
setState(() {
_isWaistKG = value;
@ -422,14 +416,14 @@ class _BodyFatState extends State<BodyFat> {
1,
270,
_hipValue,
(text) {
(text) {
_hipController.text = text;
},
(value) {
(value) {
_hipValue = value;
},
_isHipKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
(value) {
(value) {
if (_isHipKG != value) {
setState(() {
_isHipKG = value;
@ -438,7 +432,6 @@ class _BodyFatState extends State<BodyFat> {
},
_hipPopupList,
),
SizedBox(
height: 12.0,
),
@ -463,10 +456,10 @@ class _BodyFatState extends State<BodyFat> {
context,
FadePage(
page: FatResult(
bodyFat: bodyFat,
fat: fat,
textResult: textResult,
)),
bodyFat: bodyFat,
fat: fat,
textResult: textResult,
)),
);
}
});
@ -477,6 +470,7 @@ class _BodyFatState extends State<BodyFat> {
),
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
@ -534,15 +528,15 @@ class _BodyFatState extends State<BodyFat> {
prefixIcon: prefix == null
? null
: Text(
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
"+" + prefix,
style: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w500,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@ -683,5 +677,3 @@ class CommonDropDownView extends StatelessWidget {
);
}
}

@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
@ -296,14 +295,15 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
});
},
items: <String>[
'Almost Inactive(Little or no exercises)',
'Lighty Active (1-3) days per week',
'very Active(6-7) days per week',
'Super Active(very hard exercises)'
TranslationBase.of(context).inactiveAct,
TranslationBase.of(context).light,
TranslationBase.of(context).very,
TranslationBase.of(context).superAct,
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
child: Text(value,
style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
);
}).toList(),
),

@ -35,7 +35,7 @@ class CalorieResultPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Calories",
TranslationBase.of(context).calories,
style: TextStyle(
fontSize: 19,
letterSpacing: -1.34,
@ -63,7 +63,7 @@ class CalorieResultPage extends StatelessWidget {
height: 5.0,
),
Text(
'Calories',
TranslationBase.of(context).calories,
style: TextStyle(
fontSize: 18,
letterSpacing: -1.08,
@ -78,7 +78,8 @@ class CalorieResultPage extends StatelessWidget {
),
mHeight(20),
Text(
'Daily intake is ${calorie.toStringAsFixed(1)} calories',
TranslationBase.of(context).resultCalories.replaceAll("(#)", calorie.toStringAsFixed(1)),
// 'Daily intake is ${calorie.toStringAsFixed(1)} calories',
style: TextStyle(fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600, color: CustomColors.textColor),
),
],

@ -1,13 +1,13 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
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/services.dart';
import 'package:provider/provider.dart';
import 'carbs_result_page.dart';
@ -38,27 +38,27 @@ class _CarbsState extends State<Carbs> {
double fCalMeal;
void calculateDietRatios() {
if (dropdownValue == 'Very Low Carb') {
if (dropdownValue == TranslationBase.of(context).dietVeryLow) {
meals = 3;
protein = 45;
carbs = 10;
fat = 45;
} else if (dropdownValue == 'Low Carb') {
} else if (dropdownValue == TranslationBase.of(context).dietLow) {
meals = 3;
protein = 40;
carbs = 30;
fat = 30;
} else if (dropdownValue == 'Moderate Carb') {
} else if (dropdownValue == TranslationBase.of(context).dietModerate) {
meals = 3;
protein = 25;
carbs = 50;
fat = 25;
} else if (dropdownValue == 'USDA Gudilines') {
} else if (dropdownValue == TranslationBase.of(context).dietUSDA) {
meals = 3;
protein = 15;
carbs = 55;
fat = 30;
} else if (dropdownValue == 'Zone Diet') {
} else if (dropdownValue == TranslationBase.of(context).dietZone) {
meals = 3;
protein = 30;
carbs = 40;
@ -82,6 +82,7 @@ class _CarbsState extends State<Carbs> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@ -107,7 +108,7 @@ class _CarbsState extends State<Carbs> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio',
TranslationBase.of(context).carbProteinDesc,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
@ -122,7 +123,7 @@ class _CarbsState extends State<Carbs> {
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
inputWidget("The Calories per day", "0", textController),
inputWidget(TranslationBase.of(context).calDay, "0", textController),
InkWell(
onTap: () {
Navigator.push(
@ -133,7 +134,7 @@ class _CarbsState extends State<Carbs> {
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
'NOT SURE? CLICK HERE',
TranslationBase.of(context).notSure,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline),
),
),
@ -159,7 +160,7 @@ class _CarbsState extends State<Carbs> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Select Diet Type",
TranslationBase.of(context).selectDiet,
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
@ -186,10 +187,16 @@ class _CarbsState extends State<Carbs> {
calculateDietRatios();
});
},
items: <String>['Very Low Carb', 'Low Carb', 'Moderate Carb', 'USDA Gudilines', 'Zone Diet'].map<DropdownMenuItem<String>>((String value) {
items: <String>[
TranslationBase.of(context).dietVeryLow,
TranslationBase.of(context).dietLow,
TranslationBase.of(context).dietModerate,
TranslationBase.of(context).dietUSDA,
TranslationBase.of(context).dietZone
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
);
}).toList(),
),

@ -1,11 +1,13 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
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/services.dart';
import 'package:provider/provider.dart';
import 'ideal_body_result_page.dart';
@ -34,7 +36,7 @@ class _IdealBodyState extends State<IdealBody> {
double overWeightBy;
int weight = 0;
double idealWeight = 0;
String dropdownValue = 'Medium(fingers touch)';
String dropdownValue = TranslationBase.of(AppGlobal.context).bodyFrameMedium;
double calories = 0;
String textResult = '';
double maxIdealWeight;
@ -52,17 +54,15 @@ class _IdealBodyState extends State<IdealBody> {
List<PopupMenuItem> _heightPopupList = List();
List<PopupMenuItem> _weightPopupList = List();
void calculateIdealWeight() {
heightInches = int.parse(_heightController.text) * .39370078740157477;
heightFeet = heightInches / 12;
idealWeight = (50 + 2.3 * (heightInches - 60));
if (dropdownValue == 'Small(fingers overlap)') {
if (dropdownValue == TranslationBase.of(context).bodyFrameSmall) {
idealWeight = idealWeight - 10;
} else if (dropdownValue == 'Medium(fingers touch)') {
} else if (dropdownValue == TranslationBase.of(context).bodyFrameMedium) {
idealWeight = idealWeight;
} else if (dropdownValue == 'Large(fingers don\'n touch)') {
} else if (dropdownValue == TranslationBase.of(context).bodyFrameLarge) {
idealWeight = idealWeight + 10;
}
@ -75,6 +75,7 @@ class _IdealBodyState extends State<IdealBody> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
_weightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
@ -94,7 +95,7 @@ class _IdealBodyState extends State<IdealBody> {
child: Column(
children: [
Text(
'Calculates the ideal body weight based on height, Weight, and Body Size',
TranslationBase.of(context).idealWeightDesc,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
@ -177,7 +178,7 @@ class _IdealBodyState extends State<IdealBody> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Body Frame Size",
TranslationBase.of(context).bodyFrame,
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
@ -204,13 +205,14 @@ class _IdealBodyState extends State<IdealBody> {
});
},
items: <String>[
'Small(fingers overlap)',
'Medium(fingers touch)',
'Large(fingers don\'n touch)',
TranslationBase.of(context).bodyFrameSmall,
TranslationBase.of(context).bodyFrameMedium,
TranslationBase.of(context).bodyFrameLarge,
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
child: Text(value,
style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)),
);
}).toList(),
),
@ -498,5 +500,3 @@ class CommonDropDownView extends StatelessWidget {
);
}
}

@ -59,13 +59,6 @@ class _BillAmountState extends State<BillAmount> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Text(TranslationBase.of(context).testFee,
// style: TextStyle(
// color: Colors.black,
// fontSize: 16.0,
// fontWeight: FontWeight.w600,
// letterSpacing: -0.64,
// )),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 10, bottom: 3),

@ -1,19 +1,23 @@
import 'package:after_layout/after_layout.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/ResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/tamara_payment_option.dart';
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesCartItemCard.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/single_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -22,6 +26,9 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
dynamic languageID;
const _columnCount = 1;
bool _agreeTerms = false;
String _selectedPaymentMethod;
Map<dynamic, dynamic> _selectedPaymentParams;
AnimationController _animationController;
@ -38,6 +45,8 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
}
double subtotal, tax, total;
int _selectedHospitalIndex = -1;
HospitalsModel _selectedHospital;
@override
void initState() {
@ -67,9 +76,8 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
}
onPayNowClick() async {
await viewModel.service.placeOrder(context: context, paymentParams: _selectedPaymentParams).then((orderId) {
await viewModel.service.placeOrder(context: context, projectID: _selectedHospital.iD, paymentParams: _selectedPaymentParams).then((orderId) {
if (orderId.runtimeType == int) {
// result == order_id
var browser = MyInAppBrowser(context: context, onExitCallback: (data, isDone) => paymentClosed(orderId: orderId, withStatus: isDone, data: data));
browser.openPackagesPaymentBrowser(customer_id: viewModel.service.customer.id, order_id: orderId);
} else {
@ -83,100 +91,248 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
@override
void afterFirstLayout(BuildContext context) {
fetchData();
viewModel.service.getHospitals();
}
@override
Widget build(BuildContext context) {
return BaseView<PackagesViewModel>(
allowAny: true,
onModelReady: (model) => viewModel = model,
builder: (_, model, wi) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).offerAndPackages,
isShowAppBar: true,
isPharmacy: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
isOfferPackages: true,
showOfferPackagesCart: false,
isShowDecPage: false,
showNewAppBar: true,
showNewAppBarTitle: true,
body: Column(
children: [
Expanded(
child: StaggeredGridView.countBuilder(
crossAxisCount: (_columnCount * _columnCount),
itemCount: viewModel.cartItemList.length,
itemBuilder: (BuildContext context, int index) {
var item = viewModel.cartItemList[index];
return Dismissible(
key: Key(index.toString()),
direction: DismissDirection.startToEnd,
background: _cartItemDeleteContainer(),
secondaryBackground: _cartItemDeleteContainer(),
confirmDismiss: (direction) async {
bool status = await viewModel.service.deleteProductFromCart(item.id, context: context, showLoading: false);
return status;
},
onDismissed: (direction) {
viewModel.cartItemList.removeAt(index);
},
child: PackagesCartItemCard(
itemModel: item,
viewModel: viewModel,
getCartItems: fetchData,
shouldStepperChangeApply: (apply, total) async {
var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply);
ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) {
utils.Utils.showErrorToast(error);
});
if (response.status) {
fetchData();
}
return response.status ?? false;
},
));
},
staggeredTileBuilder: (int index) => StaggeredTile.fit(_columnCount),
mainAxisSpacing: 0,
crossAxisSpacing: 10,
),
),
Container(
height: 0.25,
color: Theme.of(context).primaryColor,
),
Container(
allowAny: true,
onModelReady: (model) => viewModel = model,
builder: (_, model, wi) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).offerAndPackages,
isShowAppBar: true,
isPharmacy: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
isOfferPackages: true,
showOfferPackagesCart: false,
isShowDecPage: false,
showNewAppBar: true,
showNewAppBarTitle: true,
body: viewModel.cartItemList.length > 0
? Column(
children: [
Expanded(
child: StaggeredGridView.countBuilder(
crossAxisCount: (_columnCount * _columnCount),
itemCount: viewModel.cartItemList.length,
itemBuilder: (BuildContext context, int index) {
var item = viewModel.cartItemList[index];
return Dismissible(
key: Key(index.toString()),
direction: DismissDirection.startToEnd,
background: _cartItemDeleteContainer(),
secondaryBackground: _cartItemDeleteContainer(),
confirmDismiss: (direction) async {
bool status = await viewModel.service.deleteProductFromCart(item.id, context: context, showLoading: false);
return status;
},
onDismissed: (direction) {
viewModel.cartItemList.removeAt(index);
},
child: PackagesCartItemCard(
itemModel: item,
viewModel: viewModel,
getCartItems: fetchData,
shouldStepperChangeApply: (apply, total) async {
var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply);
ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) {
utils.Utils.showErrorToast(error);
});
if (response.status) {
fetchData();
}
return response.status ?? false;
},
));
},
staggeredTileBuilder: (int index) => StaggeredTile.fit(_columnCount),
mainAxisSpacing: 0,
crossAxisSpacing: 10,
),
),
Container(
height: 0.25,
color: Theme.of(context).primaryColor,
),
],
)
: getNoDataWidget(context),
bottomSheet: viewModel.cartItemList.length > 0
? Container(
padding: EdgeInsets.all(21.0),
width: double.infinity,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Texts(TranslationBase.of(context).selectPaymentOption, fontSize: 10, fontWeight: FontWeight.bold),
Container(
height: 0.25,
width: 100,
color: Colors.grey[300],
margin: EdgeInsets.only(bottom: 12.0),
child: InkWell(
onTap: () => confirmSelectHospitalDialog(model.hospitals),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 50,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(color: CustomColors.devider), color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
getHospitalName(),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
),
Icon(Icons.arrow_drop_down),
],
),
),
),
),
Container(
margin: EdgeInsets.fromLTRB(0.0, 0.0, 20.0, 0.0),
child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600)),
),
Container(
width: MediaQuery.of(context).size.width * 0.75,
margin: EdgeInsets.fromLTRB(0.0, 8.0, 20.0, 5.0),
child: getPaymentMethods(),
),
Container(
margin: EdgeInsets.only(top: 14.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 24.0,
width: 24.0,
child: Checkbox(
value: _agreeTerms,
onChanged: (v) {
setState(() => _agreeTerms = v);
}),
),
Expanded(
child: Text(
TranslationBase.of(context).iAcceptTermsConditions,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.textColor, letterSpacing: -0.48),
),
),
],
),
),
_paymentOptions(context, (paymentMethod) {
setState(() => _selectedPaymentMethod = paymentMethod);
}, viewModel: viewModel),
Container(
height: 0.25,
color: Colors.grey[300],
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 12, bottom: 3),
child: Row(
children: [
Expanded(
child: _getNormalText(TranslationBase.of(context).patientShareToDo),
),
Expanded(
child: _getNormalText(TranslationBase.of(context).sar + " " + (subtotal ?? 0.0).toStringAsFixed(2), isBold: true),
)
],
),
),
mDivider(Colors.grey[200]),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 3, bottom: 3),
child: Row(
children: [
Expanded(
child: _getNormalText(TranslationBase.of(context).patientTaxToDo),
),
Expanded(
child: _getNormalText(TranslationBase.of(context).sar + ' ' + (tax ?? 0.0).toStringAsFixed(2), isBold: true),
)
],
),
),
mDivider(Colors.grey[200]),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 3, bottom: 3),
child: Row(
children: [
Expanded(
child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo),
),
Expanded(
child: _getNormalText(TranslationBase.of(context).sar + ' ' + (total ?? 0.0).toStringAsFixed(2), isBold: true, isTotal: true),
)
],
),
),
],
),
),
Container(height: 40, child: _termsAndCondition(context, onSelected: onTermsClick, onInfoClick: onTermsInfoClick)),
Container(
height: 0.25,
color: Colors.grey[300],
padding: EdgeInsets.only(top: 21, bottom: 21),
child: DefaultButton(
TranslationBase.of(context).payNow,
(_agreeTerms && _selectedHospital != null)
? () {
Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) {
setState(() {});
}))).then((value) {
print(value);
if (value != null) {
_selectedPaymentMethod = value;
_selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": value};
onPayNowClick();
}
});
}
: null,
color: CustomColors.green,
disabledColor: CustomColors.grey2,
),
),
_payNow(context, subtotal: subtotal, tax: tax, total: total, onPayNowClick: onPayNowClick)
],
),
)
],
),
);
});
: SizedBox(),
);
},
);
}
void confirmSelectHospitalDialog(List<HospitalsModel> hospitals) {
List<RadioSelectionDialogModel> list = [
for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i),
];
showDialog(
context: context,
child: RadioSelectionDialog(
listData: list,
selectedIndex: _selectedHospitalIndex,
isScrollable: true,
onValueSelected: (index) {
_selectedHospitalIndex = index;
_selectedHospital = hospitals[index];
setState(() {});
},
),
);
}
String getHospitalName() {
if (_selectedHospital != null)
return _selectedHospital.name;
else
return TranslationBase.of(context).selectHospital;
}
fetchData() async {
@ -201,196 +357,73 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
}
}
// /* Payment Footer Widgets */
// ---------------------------
String _selectedPaymentMethod;
Map<dynamic, dynamic> _selectedPaymentParams;
// Widget _payNow(BuildContext context, {double subtotal, double tax, double total, @required VoidCallback onPayNowClick}) {
// bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null));
//
// String _subtotal = (subtotal ?? 0.0).toStringAsFixed(2);
// String _tax = (tax ?? 0.0).toStringAsFixed(2);
// String _total = (total ?? 0).toStringAsFixed(2);
//
// return Padding(
// padding: const EdgeInsets.all(5),
// child: Container(
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Padding(
// padding: const EdgeInsets.all(5),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Texts('${TranslationBase.of(context).subtotal}: $_subtotal ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
// Texts('${TranslationBase.of(context).vat}: $_tax ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
// Padding(
// padding: const EdgeInsets.all(3),
// child: Container(
// height: 0.25,
// width: 120,
// color: Colors.grey[300],
// ),
// ),
// Texts('${TranslationBase.of(context).total}: $_total ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.black54, fontSize: 15)
// ],
// ),
// ),
// Expanded(child: Container()),
// RaisedButton(
// elevation: 0,
// child: Texts(
// TranslationBase.of(context).payNow,
// fontSize: 15,
// color: Colors.white,
// fontWeight: FontWeight.bold,
// ),
// padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5), side: BorderSide(color: Theme.of(context).primaryColor, width: 0.5)),
// color: Theme.of(context).primaryColor,
// onPressed: isPayNowAQctive ? onPayNowClick : null,
// ),
// ],
// )),
// );
// }
Widget _paymentOptions(BuildContext context, Function(String) onSelected, {PackagesViewModel viewModel}) {
double height = 30;
Widget buttonContent(bool isSelected, String imageName) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: isSelected ? Colors.green[50] : Colors.grey[200],
blurRadius: 1,
spreadRadius: 2,
),
],
borderRadius: BorderRadius.all(Radius.circular(5)),
border: Border.all(color: isSelected ? Colors.green : Colors.grey, width: isSelected ? 1 : 0.5)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Image.asset('assets/images/new-design/$imageName'),
));
}
Future<String> selectTamaraPaymentOption() async {
final tamara_options = await viewModel.service.getTamaraOptions(context: context, showLoading: true);
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;
}
return Padding(
padding: const EdgeInsets.all(5),
child: Container(
height: height,
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
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: () {
_selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": "MADA"};
onSelected("mada");
},
),
SizedBox(
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "visa", 'visa.png'),
onTap: () {
_selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": "VISA"};
onSelected("visa");
},
),
SizedBox(
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "mastercard", 'mastercard.png'),
onTap: () {
_selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": "MASTERCARD"};
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");
// },
// ),
],
),
_getNormalText(text, {bool isBold = false, bool isTotal = false}) {
return Text(
text,
style: TextStyle(
fontSize: isBold
? isTotal
? 16
: 12
: 10,
letterSpacing: -0.5,
color: isBold ? Colors.black : Colors.grey[700],
fontWeight: FontWeight.w600,
),
);
}
bool _agreeTerms = false;
Widget _termsAndCondition(BuildContext context, {@required Function(bool) onSelected, @required VoidCallback onInfoClick}) {
return Padding(
padding: const EdgeInsets.all(5),
child: Row(
children: [
InkWell(
child: Icon(
_agreeTerms ? Icons.check_circle : Icons.radio_button_unchecked_sharp,
size: 20,
color: _agreeTerms ? Colors.green[600] : Colors.grey[400],
),
onTap: () {
onSelected(!_agreeTerms);
},
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Texts(
TranslationBase.of(context).pharmacyServiceTermsCondition,
fontWeight: FontWeight.normal,
fontSize: 13,
),
)),
InkWell(
child: Icon(
Icons.info,
size: 20,
color: Colors.grey[600],
),
onTap: () {
onInfoClick();
},
),
],
),
);
}
Widget _payNow(BuildContext context, {double subtotal, double tax, double total, @required VoidCallback onPayNowClick}) {
bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null));
String _subtotal = (subtotal ?? 0.0).toStringAsFixed(2);
String _tax = (tax ?? 0.0).toStringAsFixed(2);
String _total = (total ?? 0).toStringAsFixed(2);
return Padding(
padding: const EdgeInsets.all(5),
child: Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts('${TranslationBase.of(context).subtotal}: $_subtotal ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
Texts('${TranslationBase.of(context).vat}: $_tax ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
Padding(
padding: const EdgeInsets.all(3),
child: Container(
height: 0.25,
width: 120,
color: Colors.grey[300],
),
),
Texts('${TranslationBase.of(context).total}: $_total ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.black54, fontSize: 15)
],
),
),
Expanded(child: Container()),
RaisedButton(
elevation: 0,
child: Texts(
TranslationBase.of(context).payNow,
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.bold,
),
padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5), side: BorderSide(color: Theme.of(context).primaryColor, width: 0.5)),
color: Theme.of(context).primaryColor,
onPressed: isPayNowAQctive ? onPayNowClick : null,
),
],
)),
);
}
// -------------------
Widget _cartItemDeleteContainer() {
_animationController.duration = Duration(milliseconds: 500);
_animationController.repeat(reverse: true);

@ -68,7 +68,7 @@ class _FooterWidgetState extends State<FooterWidget> {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Quantity",
TranslationBase.of(context).quantity,
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
),
@ -157,17 +157,19 @@ class _FooterWidgetState extends State<FooterWidget> {
),
],
),
onPressed: () {
setState(() {
if (showUI) {
quantityUI = 80;
showUI = false;
} else {
quantityUI = 160;
showUI = true;
}
});
},
onPressed: widget.isAvailable && !widget.item.isRx
? () {
setState(() {
if (showUI) {
quantityUI = 80;
showUI = false;
} else {
quantityUI = 160;
showUI = true;
}
});
}
: null,
),
),
SizedBox(
@ -207,20 +209,20 @@ class _FooterWidgetState extends State<FooterWidget> {
);
} else {
await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model);
Navigator.of(context).pushNamed(
CART_ORDER_PAGE,
);
// Navigator.push(
// context,
// FadePage(page: CartOrderPage()),
// Navigator.of(context).pushNamed(
// CART_ORDER_PAGE,
// );
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
}
},
fontWeight: FontWeight.w600,
borderColor: Colors.grey[800],
borderRadius: 3,
disableColor: Colors.grey[700],
color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.rxMessage != null ? Colors.grey : Colors.grey[800],
color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.isRx ? Colors.grey : Colors.grey[800],
),
),
],

@ -87,6 +87,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>(
allowAny: true,
onModelReady: (model) {
model.getProductReviewsData(widget.product.id);
},
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true,
@ -152,6 +155,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
model: model);
},
isInWishList: isInWishList,
isStockAvailable: model.isStockAvailable,
),
),
SizedBox(
@ -328,10 +332,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
),
bottomSheet: FooterWidget(
widget.product.stockAvailability != 'Out of stock',
model.isStockAvailable,
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
model.stockQuantity,
widget.product,
quantity: quantity,
isOverQuantity: isOverQuantity,

@ -1,7 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
@ -20,16 +19,12 @@ class ProductNameAndPrice extends StatefulWidget {
final Function notifyMeWhenAvailable;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
final bool isStockAvailable;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
ProductNameAndPrice(this.context, this.item,
{this.customerId,
this.isInWishList,
this.notifyMeWhenAvailable,
this.addToWishlistFunction,
this.deleteFromWishlistFunction});
{this.customerId, this.isInWishList, this.notifyMeWhenAvailable, this.addToWishlistFunction, this.deleteFromWishlistFunction, @required this.isStockAvailable});
@override
_ProductNameAndPriceState createState() => _ProductNameAndPriceState();
@ -51,25 +46,18 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(widget.item.price.toString() + " " + "SR",
fontWeight: FontWeight.bold, fontSize: 20),
Texts(widget.item.price.toString() + " " + TranslationBase.of(context).sar, fontWeight: FontWeight.bold, fontSize: 20),
Texts(
projectViewModel.isArabic
? widget.item.stockAvailabilityn
: widget.item.stockAvailability,
projectViewModel.isArabic ? widget.item.stockAvailabilityn : widget.item.stockAvailability,
fontWeight: FontWeight.bold,
fontSize: 15,
color: widget.item.stockAvailability == 'Out of stock'
? Colors.red
: Colors.green,
color: widget.isStockAvailable ? Colors.green : Colors.red,
),
// SizedBox(width: 20),
if (widget.authenticatedUserObject.isLogin)
widget.item.stockAvailability == 'Out of stock' &&
widget.customerId != null
widget.isStockAvailable && widget.customerId != null
? InkWell(
onTap: () => widget.notifyMeWhenAvailable(
context, widget.item.id),
onTap: () => widget.notifyMeWhenAvailable(context, widget.item.id),
child: Row(children: [
Texts(
TranslationBase.of(context).notifyMe,
@ -85,23 +73,15 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
]),
)
: IconWithBg(
icon: !widget.isInWishList
? Icons.favorite_border
: Icons.favorite,
color: !widget.isInWishList
? Colors.white
: Colors.red[800],
icon: !widget.isInWishList ? Icons.favorite_border : Icons.favorite,
color: !widget.isInWishList ? Colors.white : Colors.red[800],
onPress: () async {
{
if (widget.customerId != null) {
if (!widget.isInWishList) {
await widget
.addToWishlistFunction(widget.item.id);
await widget.addToWishlistFunction(widget.item.id);
} else {
await widget
.deleteFromWishlistFunction(widget.item.id);
await widget.deleteFromWishlistFunction(widget.item.id);
}
} else {
return;
@ -118,13 +98,9 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
child: Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment: projectViewModel.isArabic
? Alignment.topRight
: Alignment.topLeft,
alignment: projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft,
child: Text(
projectViewModel.isArabic
? widget.item.namen
: widget.item.name,
projectViewModel.isArabic ? widget.item.namen : widget.item.name,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
),
@ -140,8 +116,7 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
child: Row(
children: [
RatingBar.readOnly(
initialRating: double.parse(
widget.item.approvedRatingSum.toString()),
initialRating: double.parse(widget.item.approvedRatingSum.toString()),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[400],
@ -172,19 +147,9 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
Row(
children: [
Text(
projectViewModel.isArabic
? widget.item.rxMessagen.toString()
: widget.item.rxMessage.toString(),
projectViewModel.isArabic ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(),
style: TextStyle(color: Colors.red, fontSize: 10),
),
SizedBox(
width: 5,
),
Icon(
FontAwesomeIcons.questionCircle,
color: Colors.red,
size: 15.0,
)
],
)
],

@ -15,36 +15,53 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
class ProductDetailService extends BaseService {
bool isLogin = false;
num _stockQuantity;
num get stockQuantity => _stockQuantity;
String _stockAvailability;
String get stockAvailability => _stockAvailability;
bool _isStockAvailable;
bool get isStockAvailable => _isStockAvailable;
List<ProductDetail> _productDetailList = List();
List<ProductDetail> get productDetailList => _productDetailList;
List<LocationModel> _productLocationList = List();
List<LocationModel> get productLocationList => _productLocationList;
List<Wishlist> _addToCartModel = List();
List<Wishlist> get addToCartModel => _addToCartModel;
List<Wishlist> _wishListProducts = List();
List<Wishlist> get wishListProducts => _wishListProducts;
List<SpecificationModel> _productSpecification = List();
List<SpecificationModel> get productSpecification => _productSpecification;
List<SpecificationModel> get productSpecification => _productSpecification;
Future getProductReviews(productID) async {
hasError = false;
await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+productID+"?fields=reviews",
onSuccess: (dynamic response, int statusCode) {
_productDetailList.clear();
response['products'].forEach((item) {
_productDetailList.add(ProductDetail.fromJson(item));
print(response);
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL + productID + "?fields=reviews,stock_quantity,stock_availability,IsStockAvailable", onSuccess: (dynamic response, int statusCode) {
_productDetailList.clear();
response['products'].forEach((item) {
_productDetailList.add(ProductDetail.fromJson(item));
print(response);
});
_stockQuantity = response['products'][0]['stock_quantity'];
_stockAvailability = response['products'][0]['stock_availability'];
_isStockAvailable = response['products'][0]['IsStockAvailable'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
Future getProductAvailabiltyDetail() async {
@ -52,29 +69,28 @@ class ProductDetailService extends BaseService {
Map<String, dynamic> request;
request = {
"Channel": 3,
"DeviceTypeID": 2,
"IPAdress": "10.20.10.20",
"LanguageID": 2,
"PatientOutSA": 0,
"SKU": "6720020025",
"SessionID": null,
"VersionID": 5.6,
"generalid": "Cs2020@2016\$2958",
"isDentalAllowedBackend": false
// "Channel": 3,
// "DeviceTypeID": 2,
// "IPAdress": "10.20.10.20",
// "LanguageID": 2,
// "PatientOutSA": 0,
// "SKU": "6720020025",
// "SessionID": null,
// "VersionID": 5.6,
// "generalid": "Cs2020@2016\$2958",
// "isDentalAllowedBackend": false
};
await baseAppClient.post(GET_LOCATION,
onSuccess: (dynamic response, int statusCode) {
_productLocationList.clear();
response['PharmList'].forEach((item) {
_productLocationList.add(LocationModel.fromJson(item));
print(_productLocationList);
print(response);
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
await baseAppClient.post(GET_LOCATION, onSuccess: (dynamic response, int statusCode) {
_productLocationList.clear();
response['PharmList'].forEach((item) {
_productLocationList.add(LocationModel.fromJson(item));
print(_productLocationList);
print(response);
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
Future<Map> addToCart(quantity, itemID) async {
@ -83,30 +99,22 @@ class ProductDetailService extends BaseService {
Map<String, dynamic> request;
request = {
"shopping_cart_item":
{
"quantity": quantity,
"shopping_cart_type": "1",
"product_id": itemID,
"customer_id": customerId,
"language_id": 1
}
"shopping_cart_item": {"quantity": quantity, "shopping_cart_type": "1", "product_id": itemID, "customer_id": customerId, "language_id": 1}
};
dynamic localRes;
await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false,
onSuccess: (dynamic response, int statusCode) {
_addToCartModel.clear();
response['shopping_carts'].forEach((item) {
_addToCartModel.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have added a product to the cart');
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
}, body: request);
await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false, onSuccess: (dynamic response, int statusCode) {
_addToCartModel.clear();
response['shopping_carts'].forEach((item) {
_addToCartModel.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have added a product to the cart');
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage());
}, body: request);
return Future.value(localRes);
}
@ -118,7 +126,7 @@ class ProductDetailService extends BaseService {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage());
});
}
@ -130,67 +138,61 @@ class ProductDetailService extends BaseService {
request = {
"shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1}
};
await baseAppClient.pharmacyPost(GET_SHOPPING_CART,
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have added a product to the Wishlist');
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
}, body: request);
await baseAppClient.pharmacyPost(GET_SHOPPING_CART, onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have added a product to the Wishlist');
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage());
}, body: request);
}
Future getWishlistItems() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2",
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
await baseAppClient.getPharmacy(GET_WISHLIST + customerId + "?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
Future deleteItemFromWishlist(itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist",
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have removed a product from the Wishlist');
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
});
await baseAppClient.getPharmacy(DELETE_WISHLIST + customerId + "+&product_id=" + itemID + "&cart_type=Wishlist", onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have removed a product from the Wishlist');
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage());
});
}
Future productSpecificationData(itemID) async {
hasError = false;
await baseAppClient.getPharmacy(GET_SPECIFICATION+itemID,
onSuccess: (dynamic response, int statusCode) {
_productSpecification.clear();
response['specification'].forEach((item) {
_productSpecification.add(SpecificationModel.fromJson(item));
print(_productSpecification);
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
await baseAppClient.getPharmacy(GET_SPECIFICATION + itemID, onSuccess: (dynamic response, int statusCode) {
_productSpecification.clear();
response['specification'].forEach((item) {
_productSpecification.add(SpecificationModel.fromJson(item));
print(_productSpecification);
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
}

@ -2624,10 +2624,74 @@ class TranslationBase {
String get browseOffers => localizedValues["browseOffers"][locale.languageCode];
String get myCart => localizedValues["myCart"][locale.languageCode];
String get neck => localizedValues["neck"][locale.languageCode];
String get waist => localizedValues["waist"][locale.languageCode];
String get hip => localizedValues["hip"][locale.languageCode];
String get carbsProtin => localizedValues["carbsProtin"][locale.languageCode];
String get inactiveAct => localizedValues["inactiveAct"][locale.languageCode];
String get light => localizedValues["light"][locale.languageCode];
String get moderate => localizedValues["moderate"][locale.languageCode];
String get very => localizedValues["very"][locale.languageCode];
String get superAct => localizedValues["super"][locale.languageCode];
String get resultCalories => localizedValues["resultCalories"][locale.languageCode];
String get bmrDesc => localizedValues["bmrDesc"][locale.languageCode];
String get idealWeightDesc => localizedValues["idealWeightDesc"][locale.languageCode];
String get bodyFrame => localizedValues["bodyFrame"][locale.languageCode];
String get bodyFrameSmall => localizedValues["bodyFrameSmall"][locale.languageCode];
String get bodyFrameMedium => localizedValues["bodyFrameMedium"][locale.languageCode];
String get bodyFrameLarge => localizedValues["bodyFrameLarge"][locale.languageCode];
String get bodyFatDesc => localizedValues["bodyFatDesc"][locale.languageCode];
String get essential => localizedValues["essential"][locale.languageCode];
String get athlete => localizedValues["athlete"][locale.languageCode];
String get fitness => localizedValues["fitness"][locale.languageCode];
String get acceptable => localizedValues["acceptable"][locale.languageCode];
String get obeseBodyFat => localizedValues["obeseBodyFat"][locale.languageCode];
String get invalid => localizedValues["invalid"][locale.languageCode];
String get more => localizedValues["more"][locale.languageCode];
String get less => localizedValues["less"][locale.languageCode];
String get carbProteinDesc => localizedValues["carbProteinDesc"][locale.languageCode];
String get calDay => localizedValues["calDay"][locale.languageCode];
String get notSure => localizedValues["notSure"][locale.languageCode];
String get selectDiet => localizedValues["selectDiet"][locale.languageCode];
String get dietVeryLow => localizedValues["dietVeryLow"][locale.languageCode];
String get dietLow => localizedValues["dietLow"][locale.languageCode];
String get dietModerate => localizedValues["dietModerate"][locale.languageCode];
String get dietUSDA => localizedValues["dietUSDA"][locale.languageCode];
String get dietZone => localizedValues["dietZone"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save