Qr icon added, notify me api added & improvements

merge-requests/256/head
Sikander Saleem 5 years ago
parent 8eda45d637
commit 8f37fbf260

@ -36,40 +36,29 @@ const GET_PRIVILEGE = 'Services/Patients.svc/REST/Service_Privilege';
const WIFI_CREDENTIALS = "Services/Patients.svc/Hmg_SMS_Get_By_ProjectID_And_PatientID";
///Doctor
const GET_MY_DOCTOR =
'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
const GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
const GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles';
const GET_DOCTOR_RATING_NOTES =
'Services/Doctors.svc/REST/dr_GetNotesDoctorRating';
const GET_DOCTOR_RATING_DETAILS =
'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails';
const GET_DOCTOR_RATING_NOTES = 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating';
const GET_DOCTOR_RATING_DETAILS = 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails';
const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating';
///Prescriptions
const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList';
const GET_PRESCRIPTIONS_ALL_ORDERS =
'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const GET_PRESCRIPTION_REPORT =
'Services/Patients.svc/REST/INP_GetPrescriptionReport';
const SEND_PRESCRIPTION_EMAIL =
'Services/Notifications.svc/REST/SendPrescriptionEmail';
const GET_PRESCRIPTION_REPORT_ENH =
'Services/Patients.svc/REST/GetPrescriptionReport_enh';
const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/INP_GetPrescriptionReport';
const SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptionEmail';
const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh';
///Lab Order
const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders';
const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults';
const SEND_LAB_RESULT_EMAIL =
'Services/Notifications.svc/REST/SendLabReportEmail';
const GET_Patient_LAB_RESULT =
'Services/Patients.svc/REST/GetPatientLabResults';
const GET_Patient_LAB_ORDERS_RESULT =
'Services/Patients.svc/REST/GetPatientLabOrdersResults';
const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail';
const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults';
const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults';
///
const GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders';
const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT =
'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo';
const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo';
const GET_PATIENT_ORDERS_DETAILS = 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead';
const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL';
@ -134,8 +123,7 @@ const GET_BLOOD_REQUEST = 'services/PatientVarification.svc/REST/BloodDonation_G
///Reports
const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo';
const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport';
const SEND_MEDICAL_REPORT_EMAIL =
'Services/Notifications.svc/REST/SendMedicalReportEmail';
const SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail';
///Rate
const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated';
@ -254,10 +242,8 @@ const GET_PAtIENTS_INSURANCE = "Services/Patients.svc/REST/Get_PatientInsuranceD
const GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory";
const INSURANCE_DETAILS = "Services/Patients.svc/REST/Get_InsuranceCheckList";
const GET_PATIENT_INSURANCE_DETAILS =
"Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails";
const UPLOAD_INSURANCE_CARD =
'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate';
const GET_PATIENT_INSURANCE_DETAILS = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails";
const UPLOAD_INSURANCE_CARD = 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate';
const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID";
const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail";
@ -302,10 +288,10 @@ const SEND_AVERAGE_BLOOD_WEIGHT_REPORT = 'Services/Notifications.svc/REST/SendAv
const SEND_AVERAGE_BLOOD_PRESSURE_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodPressureReport';
const UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult';
const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage';
const GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult';
const ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult';
const UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult';
const DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus';
@ -342,7 +328,9 @@ const GET_PHARMACY_BANNER = "epharmacy/api/promotionbanners";
const GET_PHARMACY_TOP_MANUFACTURER = "epharmacy/api/topmanufacturer";
const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts";
const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/";
const GET_PHARMACY_PRODUCTs_BY_SKU = "epharmacy/api/productbysku/";
const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/";
const SUBSCRIBE_PRODUCT = "epharmacy/api/subscribe?";
const GET_ORDER = "orders?";
const GET_ORDER_DETAILS = "orders/";
const ADD_CUSTOMER_ADDRESS = "epharmacy/api/addcustomeraddress";
@ -354,23 +342,15 @@ const WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8";
const GET_SHOPPING_CART = "epharmacy/api/shopping_cart_items/";
const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/";
const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/";
const DELETE_SHOPPING_CART_ALL =
"epharmacy/api/delete_shopping_cart_item_by_customer/";
const DELETE_SHOPPING_CART_ALL = "epharmacy/api/delete_shopping_cart_item_by_customer/";
const ORDER_SHOPPING_CART = "epharmacy/api/orders";
const GET_LACUM_ACCOUNT_INFORMATION =
"Services/Patients.svc/REST/GetLakumAccountInformation";
const GET_LACUM_GROUP_INFORMATION =
"Services/Patients.svc/REST/GetlakumInQueryInfoGrouping";
const LACUM_ACCOUNT_ACTIVATE =
"Services/Patients.svc/REST/LakumAccountActivation";
const LACUM_ACCOUNT_DEACTIVATE =
"Services/Patients.svc/REST/LakumAccountDeactivation";
const CREATE_LAKUM_ACCOUNT =
"Services/Patients.svc/REST/PHR_CreateLakumAccount";
const TRANSFER_YAHALA_LOYALITY_POINTS =
"Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints";
const LAKUM_GET_USER_TERMS_AND_CONDITIONS =
"Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
const GET_LACUM_ACCOUNT_INFORMATION = "Services/Patients.svc/REST/GetLakumAccountInformation";
const GET_LACUM_GROUP_INFORMATION = "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping";
const LACUM_ACCOUNT_ACTIVATE = "Services/Patients.svc/REST/LakumAccountActivation";
const LACUM_ACCOUNT_DEACTIVATE = "Services/Patients.svc/REST/LakumAccountDeactivation";
const CREATE_LAKUM_ACCOUNT = "Services/Patients.svc/REST/PHR_CreateLakumAccount";
const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints";
const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList';
// Home Health Care
@ -380,14 +360,10 @@ const PATIENT_ER_UPDATE_PRES_ORDER = "Services/Patients.svc/REST/PatientER_Updat
const GET_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder";
const GET_CMC_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder";
const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems";
const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS =
'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications';
const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ =
'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead';
const GET_PATIENT_ALL_PRES_ORD =
'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const PATIENT_ER_INSERT_PRES_ORDER =
'Services/Patients.svc/REST/PatientER_InsertPresOrder';
const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications';
const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead';
const GET_PATIENT_ALL_PRES_ORD = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews';
const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType';
const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation';
@ -404,29 +380,22 @@ const GET_SPECIFICATION = "productspecification/";
const GET_BRAND_ITEMS = "products?ManufacturerId=";
// External API
const ADD_ADDRESS_INFO =
"https://mdlaboratories.com/exacartapi/api/addcustomeraddress";
const GET_CUSTOMER_ADDRESSES =
"https://mdlaboratories.com/exacartapi/api/Customers/";
const GET_CUSTOMER_INFO =
"https://mdlaboratories.com/exacartapi/api/VerifyCustomer";
const ADD_ADDRESS_INFO = "https://mdlaboratories.com/exacartapi/api/addcustomeraddress";
const GET_CUSTOMER_ADDRESSES = "https://mdlaboratories.com/exacartapi/api/Customers/";
const GET_CUSTOMER_INFO = "https://mdlaboratories.com/exacartapi/api/VerifyCustomer";
//Pharmacy
const GET_PHARMACY_CATEGORISE =
'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
const GET_PHARMACY_CATEGORISE = 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
const GET_OFFERS_CATEGORISE = 'epharmacy/api/discountcategories';
const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/';
const GET_CATEGORISE_PARENT =
'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
const GET_CATEGORISE_PARENT = 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
const GET_PARENT_PRODUCTS = 'epharmacy/api/products?categoryid=';
const GET_SUB_CATEGORISE =
'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
const GET_SUB_CATEGORISE = 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
const GET_SUB_PRODUCTS = 'epharmacy/api/products?categoryid=';
const GET_FINAL_PRODUCTS =
'epharmacy/api/products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId=';
const TIMER_MIN = 10;
const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw";

@ -6,27 +6,23 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class PharmacyModuleService extends BaseService {
final AppSharedPreferences sharedPref = AppSharedPreferences();
bool isFinished = true;
bool hasError = false;
String errorMsg = '';
String url ="";
String url = "";
List<PharmacyImageObject> bannerItems = List();
List<Manufacturer> manufacturerList = List();
List<PharmacyProduct> bestSellerProducts = List();
List<PharmacyProduct> lastVisitedProducts = List();
Future makeVerifyCustomer(dynamic data) async {
Map<String, String> queryParams = {'FileNumber': data['PatientID'].toString()};
hasError = false;
try {
await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode) {
if (response['UserName'] != null) {
sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString());
print(response);
@ -58,8 +54,7 @@ class PharmacyModuleService extends BaseService {
};
hasError = false;
try {
await baseAppClient.get(PHARMACY_CREATE_CUSTOMER,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) {
if (!response['IsRegistered']) {}
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -73,8 +68,7 @@ class PharmacyModuleService extends BaseService {
Future getBannerListList() async {
hasError = false;
try {
await baseAppClient.get(GET_PHARMACY_BANNER,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.get(GET_PHARMACY_BANNER, onSuccess: (dynamic response, int statusCode) {
bannerItems.clear();
response['images'].forEach((item) {
bannerItems.add(PharmacyImageObject.fromJson(item));
@ -91,12 +85,11 @@ class PharmacyModuleService extends BaseService {
Future getTopManufacturerList() async {
Map<String, String> queryParams = {'page': '1', 'limit': '8'};
try {
await baseAppClient.get(GET_PHARMACY_TOP_MANUFACTURER,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.get(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) {
manufacturerList.clear();
response['manufacturer'].forEach((item) {
Manufacturer manufacturer = Manufacturer.fromJson(item);
if(manufacturer.image != null){
if (manufacturer.image != null) {
manufacturerList.add(Manufacturer.fromJson(item));
}
});
@ -115,8 +108,7 @@ class PharmacyModuleService extends BaseService {
'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews',
};
try {
await baseAppClient.get(GET_PHARMACY_BEST_SELLER_PRODUCT,
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.get(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) {
bestSellerProducts.clear();
response['products'].forEach((item) {
bestSellerProducts.add(PharmacyProduct.fromJson(item));
@ -132,13 +124,10 @@ class PharmacyModuleService extends BaseService {
Future getLastVisitedProducts() async {
String lastVisited = "";
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
null) {
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) {
lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
try {
await baseAppClient.get("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited",
onSuccess: (dynamic response, int statusCode) {
await baseAppClient.get("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) {
lastVisitedProducts.clear();
response['products'].forEach((item) {
lastVisitedProducts.add(PharmacyProduct.fromJson(item));
@ -152,5 +141,4 @@ class PharmacyModuleService extends BaseService {
}
}
}
}

@ -50,6 +50,17 @@ class ProductDetailViewModel extends BaseViewModel{
setState(ViewState.Idle);
}
Future notifyMe(customerId, itemID) async {
hasError = false;
setState(ViewState.Busy);
await _productLocationService.notifyMe(customerId, itemID);
if (_productLocationService.hasError) {
error = _productLocationService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future addToCartData(quantity, itemID) async {
hasError = false;
setState(ViewState.Busy);

@ -1,19 +1,29 @@
import 'dart:convert';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:barcode_scan_fix/barcode_scan.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';
import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/pages/search_products_page.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import '../offers_categorise_page.dart';
class LandingPagePharmacy extends StatefulWidget {
@override
_LandingPagePharmacyState createState() => _LandingPagePharmacyState();
@ -39,8 +49,12 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: currentTab == 0 || currentTab == 1
? AppBar(
appBar:
// currentTab == 0 || currentTab == 1 || currentTab == 2
// ?
AppBar(
backgroundColor: Color(0xff5AB145),
elevation: 0,
title: Container(
@ -70,8 +84,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SearchProductsPage()),
MaterialPageRoute(builder: (context) => SearchProductsPage()),
);
},
),
@ -79,7 +92,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
leading: Builder(
builder: (BuildContext context) {
return InkWell(
onTap: (){
onTap: () {
setState(() {
currentTab = 0;
pageController.jumpToPage(0);
@ -96,48 +109,47 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
},
),
actions: [
// IconButton(
IconButton(
// iconSize: 70,
// icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
// height: 100, width: 100, fit: BoxFit.cover),
// onPressed: () {
// triggerRobot();
// } //do something,
// )
],
centerTitle: true,
)
: currentTab == 4
? null
: AppBar(
backgroundColor: Color(0xff5AB145),
elevation: 0,
textTheme: TextTheme(
headline6: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
icon: Image.asset(
'assets/images/new-design/qr-code.png',
),
title: Text(getText(currentTab).toUpperCase()),
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back),
color: Colors.white,
onPressed: () => Scaffold.of(context).openDrawer(),
);
},
),
actions: [
// IconButton(
// iconSize: 70,
// icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
// height: 100, width: 100, fit: BoxFit.cover),
// onPressed: () {
// triggerRobot();
// } //do something,
// )
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
),
// : currentTab == 4
// ? null:null,
// : AppBar(
// backgroundColor: Color(0xff5AB145),
// elevation: 0,
// textTheme: TextTheme(
// headline6: TextStyle(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// title: Text(getText(currentTab).toUpperCase()),
// leading: Builder(
// builder: (BuildContext context) {
// return IconButton(
// icon: Icon(Icons.arrow_back),
// color: Colors.white,
// onPressed: () => Scaffold.of(context).openDrawer(),
// );
// },
// ),
// actions: [
// // IconButton(
// // iconSize: 70,
// // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
// // height: 100, width: 100, fit: BoxFit.cover),
// // onPressed: () {
// // triggerRobot();
// // } //do something,
// // )
// ],
// centerTitle: true,
// ),
extendBody: false,
body: PageView(
physics: NeverScrollableScrollPhysics(),
@ -162,6 +174,29 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
);
}
void _scanQrAndGetProduct() async {
try {
String result = await BarcodeScanner.scan();
try {
String barcode = result;
GifLoaderDialogUtils.showMyDialog(context);
await BaseAppClient().get("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode",
onSuccess: (dynamic response, int statusCode) {
print(response);
var product = PharmacyProduct.fromJson(response["products"][0]);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: ProductDetailPage(product)));
}, onFailure: (String error, int statusCode) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: "Product not found");
});
} catch (apiEx) {
AppToast.showErrorToast(
message: "Something went wrong, please try again");
}
} catch (barcodeEx) {}
}
getText(currentTab) {
switch (currentTab) {
case 2:

@ -44,11 +44,9 @@ class _Login extends State<Login> {
final authService = new AuthProvider();
var sharedPref = new AppSharedPreferences();
bool isLoading = false;
AppointmentRateViewModel appointmentRateViewModel =
locator<AppointmentRateViewModel>();
AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
ProjectViewModel projectViewModel;
ToDoCountProviderModel toDoProvider;
@ -101,16 +99,9 @@ class _Login extends State<Login> {
fontWeight: FontWeight.normal,
controller: nationalIDorFile,
onChanged: (value) => {validateForm()},
prefixIcon: Icon(
loginType == 1
? Icons.chrome_reader_mode
: Icons.receipt,
color: Color(0xFF40ACC9)),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
hintText: loginType == 1
? TranslationBase.of(context).nationalID
: TranslationBase.of(context).fileNo,
prefixIcon: Icon(loginType == 1 ? Icons.chrome_reader_mode : Icons.receipt, color: Color(0xFF40ACC9)),
padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10),
hintText: loginType == 1 ? TranslationBase.of(context).nationalID : TranslationBase.of(context).fileNo,
)))
],
),
@ -133,9 +124,7 @@ class _Login extends State<Login> {
child: DefaultButton(
TranslationBase.of(context).login,
() => {this.startLogin()},
color: isButtonDisabled == true
? Colors.grey
: Colors.grey[900],
color: isButtonDisabled == true ? Colors.grey : Colors.grey[900],
textColor: Colors.white,
))
],
@ -156,8 +145,7 @@ class _Login extends State<Login> {
}
void validateForm() {
if (util.validateIDBox(nationalIDorFile.text, loginType) == true &&
util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) {
if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) {
setState(() {
isButtonDisabled = false;
});
@ -284,7 +272,6 @@ class _Login extends State<Login> {
print(err);
GifLoaderDialogUtils.hideDialog(context);
});
});
}

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
@ -38,7 +39,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
dynamic wishlistItems;
void initState() {
price = 0;
price = 1;
specificationData = widget.product;
setState(() {
customerId = userInfo(widget.product.id, widget.product);
@ -79,18 +80,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
alignment: Alignment.centerRight,
child: languageID == 'ar'
? Text(
widget.product
.discountDescriptionn,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
widget.product.discountDescriptionn,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
)
: Text(
widget.product
.discountDescription,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
widget.product.discountDescription,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
),
),
),
@ -101,8 +96,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
flex: 0,
child: Container(
child: Image(
image: AssetImage(
'assets/images/offer.png'),
image: AssetImage('assets/images/offer.png'),
),
),
),
@ -180,9 +174,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
TranslationBase.of(context).details,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
color: Colors.white,
),
@ -210,9 +202,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
color: Colors.white,
),
@ -240,9 +230,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
TranslationBase.of(context).availability,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
color: Colors.white,
),
@ -270,10 +258,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Container(
child: Text(
TranslationBase.of(context).description,
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600),
),
),
SizedBox(
@ -281,12 +266,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
Container(
child: Text(
languageID == 'ar'
? widget.product.shortDescriptionn
: widget.product.shortDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
languageID == 'ar' ? widget.product.shortDescriptionn : widget.product.shortDescription ?? "",
style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'),
),
),
SizedBox(
@ -295,10 +276,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Container(
child: Text(
TranslationBase.of(context).howToUse,
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600),
),
),
SizedBox(
@ -306,12 +284,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
Container(
child: Text(
languageID == 'ar'
? widget.product.fullDescriptionn
: widget.product.fullDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription,
style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'),
),
),
],
@ -319,83 +293,41 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
)
: isReviews
? BaseView<ProductDetailViewModel>(
onModelReady: (model) =>
model.getProductReviewsData(
widget.product.id),
builder: (_, model, wi) => model
.productDetailService
.length !=
0 &&
model.productDetailService[0]
.reviews.length !=
0
onModelReady: (model) => model.getProductReviewsData(widget.product.id),
builder: (_, model, wi) =>
model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0
? ListView.builder(
physics: ScrollPhysics(),
itemCount: model
.productDetailService[0]
.reviews
.length,
itemCount: model.productDetailService[0].reviews.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemBuilder: (BuildContext context,
int index) {
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
children: [
Container(
child: Text(
model
.productDetailService[
0]
.reviews[
index]
.customerId
.toString(),
style: TextStyle(
fontSize: 17,
color: Colors
.grey,
fontWeight:
FontWeight
.w600),
model.productDetailService[0].reviews[index].customerId.toString(),
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600),
),
),
Container(
margin:
EdgeInsets.only(
left: 210),
child: RatingBar
.readOnly(
initialRating: model
.productDetailService[
0]
.reviews[
index]
.rating
.toDouble(),
margin: EdgeInsets.only(left: 210),
child: RatingBar.readOnly(
initialRating: model.productDetailService[0].reviews[index].rating.toDouble(),
size: 15.0,
filledColor:
Colors.yellow[
700],
emptyColor: Colors
.grey[500],
isHalfAllowed:
true,
halfFilledIcon:
Icons
.star_half,
filledIcon:
Icons.star,
emptyIcon:
Icons.star,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
],
@ -406,21 +338,14 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
Container(
child: Text(
model
.productDetailService[
0]
.reviews[index]
.reviewText,
style: TextStyle(
fontSize: 20),
model.productDetailService[0].reviews[index].reviewText,
style: TextStyle(fontSize: 20),
),
),
SizedBox(
height: 50,
),
Divider(
height: 1,
color: Colors.grey),
Divider(height: 1, color: Colors.grey),
],
),
);
@ -434,47 +359,32 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
)
: isAvailabilty
? BaseView<ProductDetailViewModel>(
onModelReady: (model) =>
model.getProductLocationData(),
builder: (_, model, wi) => model
.productLocationService
.length ==
0
onModelReady: (model) => model.getProductLocationData(),
builder: (_, model, wi) => model.productLocationService.length == 0
? Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
'No location Available'),
child: Text('No location Available'),
)
: ListView.builder(
physics: ScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model
.productLocationService
.length,
itemBuilder:
(BuildContext context,
int index) {
itemCount: model.productLocationService.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding:
EdgeInsets.all(8.0),
padding: EdgeInsets.all(8.0),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
// crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment
.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Image.network(model
.productLocationService[
index]
.projectImageUrl),
child: Image.network(model.productLocationService[index].projectImageUrl),
),
SizedBox(
width: 10,
@ -482,48 +392,31 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Expanded(
flex: 4,
child: Text(
model
.productLocationService[
index]
.locationDescription +
model.productLocationService[index].locationDescription +
"\n" +
fixingString(model
.productLocationService[
0]
.cityName
.toString()),
style: TextStyle(
fontSize:
12),
fixingString(model.productLocationService[0].cityName.toString()),
style: TextStyle(fontSize: 12),
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons
.location_on),
color:
Colors.red,
onPressed:
() {},
icon: Icon(Icons.location_on),
color: Colors.red,
onPressed: () {},
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons
.phone),
color:
Colors.red,
onPressed:
() {},
icon: Icon(Icons.phone),
color: Colors.red,
onPressed: () {},
),
),
],
),
Divider(
height: 1.2,
color: Colors.grey)
Divider(height: 1.2, color: Colors.grey)
],
),
);
@ -538,12 +431,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
],
),
),
bottomSheet: footerWidget(
widget.product.stockAvailability != 'Out of stock',
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product),
bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product),
)
: AppScaffold(
appBarTitle: 'product detail page',
@ -576,18 +465,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
alignment: Alignment.centerRight,
child: languageID == 'ar'
? Text(
widget.product
.discountDescriptionn,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
widget.product.discountDescriptionn,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
)
: Text(
widget.product
.discountDescription,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
widget.product.discountDescription,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17),
),
),
),
@ -598,8 +481,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
flex: 0,
child: Container(
child: Image(
image: AssetImage(
'assets/images/offer.png'),
image: AssetImage('assets/images/offer.png'),
),
),
),
@ -669,9 +551,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
TranslationBase.of(context).details,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
color: Colors.white,
),
@ -699,9 +579,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
color: Colors.white,
),
@ -729,9 +607,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
TranslationBase.of(context).availability,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
color: Colors.white,
),
@ -759,10 +635,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Container(
child: Text(
TranslationBase.of(context).description,
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600),
),
),
SizedBox(
@ -770,12 +643,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
Container(
child: Text(
languageID == 'ar'
? widget.product.fullDescriptionn
: widget.product.fullDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription,
style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'),
),
),
],
@ -783,83 +652,41 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
)
: isReviews
? BaseView<ProductDetailViewModel>(
onModelReady: (model) =>
model.getProductReviewsData(
widget.product.id),
builder: (_, model, wi) => model
.productDetailService
.length !=
0 &&
model.productDetailService[0]
.reviews.length !=
0
onModelReady: (model) => model.getProductReviewsData(widget.product.id),
builder: (_, model, wi) =>
model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0
? ListView.builder(
physics: ScrollPhysics(),
itemCount: model
.productDetailService[0]
.reviews
.length,
itemCount: model.productDetailService[0].reviews.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemBuilder: (BuildContext context,
int index) {
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
children: [
Container(
child: Text(
model
.productDetailService[
0]
.reviews[
index]
.customerId
.toString(),
style: TextStyle(
fontSize: 17,
color: Colors
.grey,
fontWeight:
FontWeight
.w600),
model.productDetailService[0].reviews[index].customerId.toString(),
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600),
),
),
Container(
margin:
EdgeInsets.only(
left: 210),
child: RatingBar
.readOnly(
initialRating: model
.productDetailService[
0]
.reviews[
index]
.rating
.toDouble(),
margin: EdgeInsets.only(left: 210),
child: RatingBar.readOnly(
initialRating: model.productDetailService[0].reviews[index].rating.toDouble(),
size: 15.0,
filledColor:
Colors.yellow[
700],
emptyColor: Colors
.grey[500],
isHalfAllowed:
true,
halfFilledIcon:
Icons
.star_half,
filledIcon:
Icons.star,
emptyIcon:
Icons.star,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
],
@ -870,21 +697,14 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
Container(
child: Text(
model
.productDetailService[
0]
.reviews[index]
.reviewText,
style: TextStyle(
fontSize: 20),
model.productDetailService[0].reviews[index].reviewText,
style: TextStyle(fontSize: 20),
),
),
SizedBox(
height: 50,
),
Divider(
height: 1,
color: Colors.grey),
Divider(height: 1, color: Colors.grey),
],
),
);
@ -898,17 +718,13 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
)
: isAvailabilty
? BaseView<ProductDetailViewModel>(
onModelReady: (model) =>
model.getProductLocationData(),
builder: (_, model, wi) =>
ListView.builder(
onModelReady: (model) => model.getProductLocationData(),
builder: (_, model, wi) => ListView.builder(
physics: ScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model
.productLocationService.length,
itemBuilder: (BuildContext context,
int index) {
itemCount: model.productLocationService.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
@ -917,15 +733,11 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [
Row(
// crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Image.network(model
.productLocationService[
index]
.projectImageUrl),
child: Image.network(model.productLocationService[index].projectImageUrl),
),
SizedBox(
width: 10,
@ -933,25 +745,16 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Expanded(
flex: 4,
child: Text(
model
.productLocationService[
index]
.locationDescription +
model.productLocationService[index].locationDescription +
"\n" +
fixingString(model
.productLocationService[
0]
.cityName
.toString()),
style: TextStyle(
fontSize: 12),
fixingString(model.productLocationService[0].cityName.toString()),
style: TextStyle(fontSize: 12),
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons
.location_on),
icon: Icon(Icons.location_on),
color: Colors.red,
onPressed: () {},
),
@ -959,17 +762,14 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Expanded(
flex: 1,
child: IconButton(
icon:
Icon(Icons.phone),
icon: Icon(Icons.phone),
color: Colors.red,
onPressed: () {},
),
),
],
),
Divider(
height: 1.2,
color: Colors.grey)
Divider(height: 1.2, color: Colors.grey)
],
),
);
@ -984,12 +784,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
],
),
),
bottomSheet: footerWidget(
widget.product.stockAvailability != 'Out of stock',
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product),
bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product),
);
}
}
@ -1000,8 +796,7 @@ class footerWidget extends StatefulWidget {
final int minQuantity;
final int quantityLimit;
final PharmacyProduct item;
footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item);
footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item);
@override
_footerWidgetState createState() => _footerWidgetState();
}
@ -1031,8 +826,7 @@ class _footerWidgetState extends State<footerWidget> {
padding: const EdgeInsets.all(8.0),
child: Text(
TranslationBase.of(context).quantity,
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
),
// ListView(
@ -1054,9 +848,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'1',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1081,9 +873,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'2',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1108,9 +898,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'3',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1135,9 +923,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'4',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1162,9 +948,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'5',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1189,9 +973,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'6',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1216,9 +998,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'7',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1243,9 +1023,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'8',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1270,9 +1048,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'9',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1297,9 +1073,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white,
child: Text(
'10',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap: () {
@ -1320,8 +1094,7 @@ class _footerWidgetState extends State<footerWidget> {
Container(
width: 50.0,
child: TextField(
decoration:
InputDecoration(labelText: 'quantity #'),
decoration: InputDecoration(labelText: 'quantity #'),
onChanged: (text) {
print(price);
print(widget.quantityLimit);
@ -1400,10 +1173,7 @@ class _footerWidgetState extends State<footerWidget> {
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).addToCart,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15),
),
),
)
@ -1418,10 +1188,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.green,
child: Text(
TranslationBase.of(context).addToCart,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15),
),
),
),
@ -1437,10 +1204,7 @@ class _footerWidgetState extends State<footerWidget> {
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).buyNow,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15),
),
),
)
@ -1450,8 +1214,7 @@ class _footerWidgetState extends State<footerWidget> {
addToCartFunction(price, widget.item.id);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartOrderPage()),
MaterialPageRoute(builder: (context) => CartOrderPage()),
);
},
child: Container(
@ -1461,10 +1224,7 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.blue,
child: Text(
TranslationBase.of(context).buyNow,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15),
),
),
),
@ -1505,30 +1265,30 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
widget.item.stockAvailability,
style: widget.item.stockAvailability == 'Out of stock'
? TextStyle(fontWeight: FontWeight.bold, color: Colors.red)
: TextStyle(
fontWeight: FontWeight.bold, color: Colors.green),
: TextStyle(fontWeight: FontWeight.bold, color: Colors.green),
),
SizedBox(width: 20),
widget.item.stockAvailability == 'Out of stock'
? Text(
widget.item.stockAvailability == 'Out of stock' && customerId != null
? InkWell(
onTap: () => notifyMeWhenAvailable(context, widget.item.id),
child: Row(children: [
Text(
TranslationBase.of(context).notifyMe,
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline,
),
)
: Container(),
widget.item.stockAvailability == 'Out of stock'
? Icon(
),
SizedBox(width: 4),
Icon(
FontAwesomeIcons.bell,
color: Colors.blue,
size: 15.0,
)
: Container(),
Container(
margin: languageID == 'ar'
? EdgeInsets.only(right: 25)
: EdgeInsets.only(left: 25),
]),
)
: Container(
margin: languageID == 'ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25),
width: 40,
height: 40,
decoration: BoxDecoration(
@ -1564,12 +1324,9 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
child: Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment:
languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
child: Text(
languageID == 'ar'
? widget.item.fullDescriptionn
: widget.item.fullDescription,
languageID == 'ar' ? widget.item.fullDescriptionn : widget.item.fullDescription,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
),
@ -1601,9 +1358,7 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
child: Container(
child: widget.item.rxMessage != null
? Text(
languageID == 'ar'
? widget.item.rxMessagen.toString()
: widget.item.rxMessage.toString(),
languageID == 'ar' ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(),
style: TextStyle(color: Colors.red, fontSize: 10),
)
: Container()),
@ -1769,9 +1524,7 @@ slideDetail() {
),
color: Colors.white,
),
child: const Text('1',
textAlign: TextAlign.center,
style: TextStyle(color: Color(0xFF000000))),
child: const Text('1', textAlign: TextAlign.center, style: TextStyle(color: Color(0xFF000000))),
),
)
],
@ -1801,6 +1554,11 @@ addToCartFunction(quantity, itemID) async {
await x.addToCartData(quantity, itemID);
}
notifyMeWhenAvailable(context, itemId) async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.notifyMe(customerId, itemId);
}
addToWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlit = true;
@ -1848,13 +1606,7 @@ settingModalBottomSheet(context) {
leading: new Icon(Icons.shopping_cart),
title: new Text('Add to cart'),
onTap: () => {
if (price > 0)
{addToCartFunction(price, itemID)}
else
{
AppToast.showErrorToast(
message: "you should add quantity")
}
if (price > 0) {addToCartFunction(price, itemID)} else {AppToast.showErrorToast(message: "you should add quantity")}
}),
new ListTile(
leading: new Icon(Icons.favorite_border),
@ -1865,8 +1617,7 @@ settingModalBottomSheet(context) {
leading: new Icon(Icons.compare),
title: new Text('Compare'),
onTap: () => {
Provider.of<CompareList>(context, listen: false)
.addItem(specificationData),
Provider.of<CompareList>(context, listen: false).addItem(specificationData),
},
),
],
@ -1875,13 +1626,14 @@ settingModalBottomSheet(context) {
});
}
userInfo(id, product) async {
Future userInfo(id, product) async {
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId != null) {
itemID = id;
product = product;
checkWishlist();
}
print("customerId:$customerId");
return customerId;
// getSpecificationData(itemID);
}

@ -27,7 +27,7 @@ class CartOrderPage extends StatelessWidget {
value: model.cartResponse,
child: AppScaffold(
appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true,
isShowAppBar: false,
isPharmacy: true,
baseViewModel: model,
backgroundColor: Colors.white,

@ -1,5 +1,7 @@
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
@ -39,7 +41,11 @@ class _BannerPagerState extends State<BannerPager> {
items: widget._model
.getBannerImagesUrl()
.mapIndexed(
(item, index) => Container(
(item, index) => InkWell(
onTap: () {
Navigator.push(context, FadePage(page: OffersCategorisePage()));
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 1.0),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
@ -56,6 +62,7 @@ class _BannerPagerState extends State<BannerPager> {
),
),
),
),
)
.toList(),
),

@ -29,9 +29,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategorise(),
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
AppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold(
isShowDecPage: false,
baseViewModel: model,
body: Column(
@ -59,9 +57,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? model.categorise[index].namen
: model.categorise[index].name,
projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name,
fontWeight: FontWeight.w600,
),
),
@ -70,8 +66,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
model.categorise[index].id != '12'
builder: (context) => model.categorise[index].id != '12'
? ParentCategorisePage(
id: model.categorise[index].id,
titleName: model.categorise[index].name,
@ -91,10 +86,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 140,
child: Column(
children: [
Divider(
height: 2.0,
thickness: 1.0,
color: Colors.black12.withOpacity(0.14)),
Divider(height: 2.0, thickness: 1.0, color: Colors.black12.withOpacity(0.14)),
SizedBox(
height: 10.0,
),
@ -103,6 +95,8 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
Expanded(
child: Padding(
padding: EdgeInsets.all(4.0),
child: InkWell(
onTap: () {},
child: Container(
height: 50.0,
width: 55.0,
@ -113,15 +107,14 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'الاكثر مبيعا'
: 'Best Sellers',
projectViewModel.isArabic ? 'الاكثر مبيعا' : 'Best Sellers',
fontWeight: FontWeight.w600,
),
),
),
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(4.0),
@ -129,16 +122,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 50.0,
width: 55.0,
decoration: BoxDecoration(
color: Colors.orangeAccent.shade200
.withOpacity(0.34),
color: Colors.orangeAccent.shade200.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0),
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'الاكثر مشاهدة'
: 'Most Viewed',
projectViewModel.isArabic ? 'الاكثر مشاهدة' : 'Most Viewed',
fontWeight: FontWeight.w600,
),
),
@ -162,9 +152,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'منتجات جديدة'
: 'New Products',
projectViewModel.isArabic ? 'منتجات جديدة' : 'New Products',
fontWeight: FontWeight.w600,
),
),
@ -182,17 +170,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 50.0,
width: 55.0,
decoration: BoxDecoration(
color:
Colors.purple.shade200.withOpacity(0.34),
color: Colors.purple.shade200.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0),
),
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 10.0),
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'شوهد مؤخرا'
: 'Recently Viewed',
projectViewModel.isArabic ? 'شوهد مؤخرا' : 'Recently Viewed',
fontWeight: FontWeight.w600,
),
),
@ -220,7 +204,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
/// int patientID = get from qr result
String result = await BarcodeScanner.scan();
var data = json.decode(result);
if (data!=null) {
if (data != null) {
var qRParkingID = data['QRParkingID'];
await model.scanQr();
if (model.state == ViewState.ErrorLocal) {

@ -102,20 +102,24 @@ class ProductDetailService extends BaseService {
}, body: request);
}
Future notifyMe(customerId, itemID) async {
hasError = false;
await baseAppClient.get(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) {
AppToast.showSuccessToast(message: 'You will be notified when product available');
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: 'something went wrong please try again');
});
}
Future addToWishlist(itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
Map<String, dynamic> request;
request = {
"shopping_cart_item":
{
"quantity": 1,
"shopping_cart_type": "Wishlist",
"product_id": itemID,
"customer_id": customerId,
"language_id": 1
}
"shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1}
};
await baseAppClient.post(GET_SHOPPING_CART,
onSuccess: (dynamic response, int statusCode) {

Loading…
Cancel
Save