Qr icon added, notify me api added & improvements

merge-update-with-lab-changes
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"; const WIFI_CREDENTIALS = "Services/Patients.svc/Hmg_SMS_Get_By_ProjectID_And_PatientID";
///Doctor ///Doctor
const GET_MY_DOCTOR = const GET_MY_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
const GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles'; const GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles';
const GET_DOCTOR_RATING_NOTES = const GET_DOCTOR_RATING_NOTES = 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating';
'Services/Doctors.svc/REST/dr_GetNotesDoctorRating'; const GET_DOCTOR_RATING_DETAILS = 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails';
const GET_DOCTOR_RATING_DETAILS =
'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails';
const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating'; const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating';
///Prescriptions ///Prescriptions
const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList';
const GET_PRESCRIPTIONS_ALL_ORDERS = const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; const GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/INP_GetPrescriptionReport';
const GET_PRESCRIPTION_REPORT = const SEND_PRESCRIPTION_EMAIL = 'Services/Notifications.svc/REST/SendPrescriptionEmail';
'Services/Patients.svc/REST/INP_GetPrescriptionReport'; const GET_PRESCRIPTION_REPORT_ENH = 'Services/Patients.svc/REST/GetPrescriptionReport_enh';
const SEND_PRESCRIPTION_EMAIL =
'Services/Notifications.svc/REST/SendPrescriptionEmail';
const GET_PRESCRIPTION_REPORT_ENH =
'Services/Patients.svc/REST/GetPrescriptionReport_enh';
///Lab Order ///Lab Order
const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders'; const GET_Patient_LAB_ORDERS = 'Services/Patients.svc/REST/GetPatientLabOrders';
const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults'; const GET_Patient_LAB_SPECIAL_RESULT = 'Services/Patients.svc/REST/GetPatientLabSpecialResults';
const SEND_LAB_RESULT_EMAIL = const SEND_LAB_RESULT_EMAIL = 'Services/Notifications.svc/REST/SendLabReportEmail';
'Services/Notifications.svc/REST/SendLabReportEmail'; const GET_Patient_LAB_RESULT = 'Services/Patients.svc/REST/GetPatientLabResults';
const GET_Patient_LAB_RESULT = const GET_Patient_LAB_ORDERS_RESULT = 'Services/Patients.svc/REST/GetPatientLabOrdersResults';
'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_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders';
const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = const GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT = 'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo';
'Services/Patients.svc/REST/GetPatientLabResultsByAppointmentNo';
const GET_PATIENT_ORDERS_DETAILS = 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead'; const GET_PATIENT_ORDERS_DETAILS = 'Services/Patients.svc/REST/Rad_UpdatePatientRadOrdersToRead';
const GET_RAD_IMAGE_URL = 'Services/Patients.svc/Rest/GetRadImageURL'; 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 ///Reports
const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo';
const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport';
const SEND_MEDICAL_REPORT_EMAIL = const SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail';
'Services/Notifications.svc/REST/SendMedicalReportEmail';
///Rate ///Rate
const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; 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 GET_PAtIENTS_INSURANCE_UPDATED = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceCardUpdateHistory";
const INSURANCE_DETAILS = "Services/Patients.svc/REST/Get_InsuranceCheckList"; const INSURANCE_DETAILS = "Services/Patients.svc/REST/Get_InsuranceCheckList";
const GET_PATIENT_INSURANCE_DETAILS = const GET_PATIENT_INSURANCE_DETAILS = "Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails";
"Services/Patients.svc/REST/PatientER_GetPatientInsuranceDetails"; const UPLOAD_INSURANCE_CARD = 'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate';
const UPLOAD_INSURANCE_CARD =
'Services/Patients.svc/REST/PatientER_PatientInfoForInsuranceCardUpdate';
const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID";
const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; 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 SEND_AVERAGE_BLOOD_PRESSURE_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodPressureReport';
const UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; 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_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage';
const GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult'; const GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult';
const ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; const ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult';
const UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult'; const UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult';
const DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus'; 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_TOP_MANUFACTURER = "epharmacy/api/topmanufacturer";
const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts"; const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts";
const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/"; 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 GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/";
const SUBSCRIBE_PRODUCT = "epharmacy/api/subscribe?";
const GET_ORDER = "orders?"; const GET_ORDER = "orders?";
const GET_ORDER_DETAILS = "orders/"; const GET_ORDER_DETAILS = "orders/";
const ADD_CUSTOMER_ADDRESS = "epharmacy/api/addcustomeraddress"; 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_SHOPPING_CART = "epharmacy/api/shopping_cart_items/";
const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/"; const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/";
const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/"; const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/";
const DELETE_SHOPPING_CART_ALL = const DELETE_SHOPPING_CART_ALL = "epharmacy/api/delete_shopping_cart_item_by_customer/";
"epharmacy/api/delete_shopping_cart_item_by_customer/";
const ORDER_SHOPPING_CART = "epharmacy/api/orders"; const ORDER_SHOPPING_CART = "epharmacy/api/orders";
const GET_LACUM_ACCOUNT_INFORMATION = const GET_LACUM_ACCOUNT_INFORMATION = "Services/Patients.svc/REST/GetLakumAccountInformation";
"Services/Patients.svc/REST/GetLakumAccountInformation"; const GET_LACUM_GROUP_INFORMATION = "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping";
const GET_LACUM_GROUP_INFORMATION = const LACUM_ACCOUNT_ACTIVATE = "Services/Patients.svc/REST/LakumAccountActivation";
"Services/Patients.svc/REST/GetlakumInQueryInfoGrouping"; const LACUM_ACCOUNT_DEACTIVATE = "Services/Patients.svc/REST/LakumAccountDeactivation";
const LACUM_ACCOUNT_ACTIVATE = const CREATE_LAKUM_ACCOUNT = "Services/Patients.svc/REST/PHR_CreateLakumAccount";
"Services/Patients.svc/REST/LakumAccountActivation"; const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints";
const LACUM_ACCOUNT_DEACTIVATE = const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
"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'; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList';
// Home Health Care // 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_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_CMC_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder";
const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems"; const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems";
const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications';
'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead';
const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = const GET_PATIENT_ALL_PRES_ORD = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead'; const PATIENT_ER_INSERT_PRES_ORDER = 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
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 PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews';
const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType';
const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; 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="; const GET_BRAND_ITEMS = "products?ManufacturerId=";
// External API // External API
const ADD_ADDRESS_INFO = const ADD_ADDRESS_INFO = "https://mdlaboratories.com/exacartapi/api/addcustomeraddress";
"https://mdlaboratories.com/exacartapi/api/addcustomeraddress"; const GET_CUSTOMER_ADDRESSES = "https://mdlaboratories.com/exacartapi/api/Customers/";
const GET_CUSTOMER_ADDRESSES = const GET_CUSTOMER_INFO = "https://mdlaboratories.com/exacartapi/api/VerifyCustomer";
"https://mdlaboratories.com/exacartapi/api/Customers/";
const GET_CUSTOMER_INFO =
"https://mdlaboratories.com/exacartapi/api/VerifyCustomer";
//Pharmacy //Pharmacy
const GET_PHARMACY_CATEGORISE = 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';
'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_CATEGORISE = 'epharmacy/api/discountcategories';
const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/'; const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/';
const GET_CATEGORISE_PARENT = const GET_CATEGORISE_PARENT = 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
'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_PARENT_PRODUCTS = 'epharmacy/api/products?categoryid=';
const GET_SUB_CATEGORISE = const GET_SUB_CATEGORISE = 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
'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_SUB_PRODUCTS = 'epharmacy/api/products?categoryid=';
const GET_FINAL_PRODUCTS = 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='; '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 TIMER_MIN = 10;
const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; 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/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class PharmacyModuleService extends BaseService { class PharmacyModuleService extends BaseService {
final AppSharedPreferences sharedPref = AppSharedPreferences(); final AppSharedPreferences sharedPref = AppSharedPreferences();
bool isFinished = true; bool isFinished = true;
bool hasError = false; bool hasError = false;
String errorMsg = ''; String errorMsg = '';
String url =""; String url = "";
List<PharmacyImageObject> bannerItems = List(); List<PharmacyImageObject> bannerItems = List();
List<Manufacturer> manufacturerList = List(); List<Manufacturer> manufacturerList = List();
List<PharmacyProduct> bestSellerProducts = List(); List<PharmacyProduct> bestSellerProducts = List();
List<PharmacyProduct> lastVisitedProducts = List(); List<PharmacyProduct> lastVisitedProducts = List();
Future makeVerifyCustomer(dynamic data) async { Future makeVerifyCustomer(dynamic data) async {
Map<String, String> queryParams = {'FileNumber': data['PatientID'].toString()}; Map<String, String> queryParams = {'FileNumber': data['PatientID'].toString()};
hasError = false; hasError = false;
try { try {
await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER, await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
if (response['UserName'] != null) { if (response['UserName'] != null) {
sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString());
print(response); print(response);
@ -58,8 +54,7 @@ class PharmacyModuleService extends BaseService {
}; };
hasError = false; hasError = false;
try { try {
await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
if (!response['IsRegistered']) {} if (!response['IsRegistered']) {}
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -73,8 +68,7 @@ class PharmacyModuleService extends BaseService {
Future getBannerListList() async { Future getBannerListList() async {
hasError = false; hasError = false;
try { try {
await baseAppClient.get(GET_PHARMACY_BANNER, await baseAppClient.get(GET_PHARMACY_BANNER, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
bannerItems.clear(); bannerItems.clear();
response['images'].forEach((item) { response['images'].forEach((item) {
bannerItems.add(PharmacyImageObject.fromJson(item)); bannerItems.add(PharmacyImageObject.fromJson(item));
@ -91,12 +85,11 @@ class PharmacyModuleService extends BaseService {
Future getTopManufacturerList() async { Future getTopManufacturerList() async {
Map<String, String> queryParams = {'page': '1', 'limit': '8'}; Map<String, String> queryParams = {'page': '1', 'limit': '8'};
try { try {
await baseAppClient.get(GET_PHARMACY_TOP_MANUFACTURER, await baseAppClient.get(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
manufacturerList.clear(); manufacturerList.clear();
response['manufacturer'].forEach((item) { response['manufacturer'].forEach((item) {
Manufacturer manufacturer = Manufacturer.fromJson(item); Manufacturer manufacturer = Manufacturer.fromJson(item);
if(manufacturer.image != null){ if (manufacturer.image != null) {
manufacturerList.add(Manufacturer.fromJson(item)); 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', '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 { try {
await baseAppClient.get(GET_PHARMACY_BEST_SELLER_PRODUCT, await baseAppClient.get(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
bestSellerProducts.clear(); bestSellerProducts.clear();
response['products'].forEach((item) { response['products'].forEach((item) {
bestSellerProducts.add(PharmacyProduct.fromJson(item)); bestSellerProducts.add(PharmacyProduct.fromJson(item));
@ -132,13 +124,10 @@ class PharmacyModuleService extends BaseService {
Future getLastVisitedProducts() async { Future getLastVisitedProducts() async {
String lastVisited = ""; String lastVisited = "";
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) {
null) { lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
try { try {
await baseAppClient.get("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", await baseAppClient.get("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
lastVisitedProducts.clear(); lastVisitedProducts.clear();
response['products'].forEach((item) { response['products'].forEach((item) {
lastVisitedProducts.add(PharmacyProduct.fromJson(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); 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 { Future addToCartData(quantity, itemID) async {
hasError = false; hasError = false;
setState(ViewState.Busy); 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/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/parent_categorise_page.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/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_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/profile/profile.dart';
import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/pages/search_products_page.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/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.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/pharmacy/bottom_nav_pharmacy_bar.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import '../offers_categorise_page.dart';
class LandingPagePharmacy extends StatefulWidget { class LandingPagePharmacy extends StatefulWidget {
@override @override
_LandingPagePharmacyState createState() => _LandingPagePharmacyState(); _LandingPagePharmacyState createState() => _LandingPagePharmacyState();
@ -39,8 +49,12 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: currentTab == 0 || currentTab == 1 appBar:
? AppBar(
// currentTab == 0 || currentTab == 1 || currentTab == 2
// ?
AppBar(
backgroundColor: Color(0xff5AB145), backgroundColor: Color(0xff5AB145),
elevation: 0, elevation: 0,
title: Container( title: Container(
@ -70,8 +84,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => SearchProductsPage()),
builder: (context) => SearchProductsPage()),
); );
}, },
), ),
@ -79,7 +92,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
leading: Builder( leading: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return InkWell( return InkWell(
onTap: (){ onTap: () {
setState(() { setState(() {
currentTab = 0; currentTab = 0;
pageController.jumpToPage(0); pageController.jumpToPage(0);
@ -96,48 +109,47 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
}, },
), ),
actions: [ actions: [
// IconButton( IconButton(
// iconSize: 70, // iconSize: 70,
// icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', icon: Image.asset(
// height: 100, width: 100, fit: BoxFit.cover), 'assets/images/new-design/qr-code.png',
// 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),
), ),
title: Text(getText(currentTab).toUpperCase()), onPressed: _scanQrAndGetProduct //do something,
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, 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, extendBody: false,
body: PageView( body: PageView(
physics: NeverScrollableScrollPhysics(), 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) { getText(currentTab) {
switch (currentTab) { switch (currentTab) {
case 2: case 2:

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

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

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

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

@ -102,20 +102,24 @@ class ProductDetailService extends BaseService {
}, body: request); }, 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 { Future addToWishlist(itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false; hasError = false;
Map<String, dynamic> request; Map<String, dynamic> request;
request = { request = {
"shopping_cart_item": "shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1}
{
"quantity": 1,
"shopping_cart_type": "Wishlist",
"product_id": itemID,
"customer_id": customerId,
"language_id": 1
}
}; };
await baseAppClient.post(GET_SHOPPING_CART, await baseAppClient.post(GET_SHOPPING_CART,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {

Loading…
Cancel
Save