diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 00000000..4ace459d --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,4 @@ +-keep class tvi.webrtc.** { *; } +-keep class com.twilio.video.** { *; } +-keep class com.twilio.common.** { *; } +-keepattributes InnerClasses \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 433bc8ad..32bda0b1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -3,6 +3,9 @@ buildscript { repositories { google() jcenter() +// maven { +// url "https://dl.bintray.com/kotlin/kotlin-eap/" +// } } dependencies { diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index c935be88..1f9de82f 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip diff --git a/assets/images/pharmacy/Redheart.svg b/assets/images/pharmacy/Redheart.svg new file mode 100644 index 00000000..3bba67fa --- /dev/null +++ b/assets/images/pharmacy/Redheart.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/heart-empty.svg b/assets/images/pharmacy/heart-empty.svg new file mode 100644 index 00000000..a682a44e --- /dev/null +++ b/assets/images/pharmacy/heart-empty.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/sort.png b/assets/images/pharmacy/sort.png new file mode 100644 index 00000000..0143d915 Binary files /dev/null and b/assets/images/pharmacy/sort.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index f896d304..7fdae99d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -292,7 +292,7 @@ const GET_PATIENT_HEALTH_STATS = const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; const IP_ADDRESS = '10.20.10.20'; -const VERSION_ID = 6.1; +const VERSION_ID = 8.8; const SETUP_ID = '91877'; const LANGUAGE = 2; const PATIENT_OUT_SA = 0; @@ -478,6 +478,7 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; // Home Health Care const HHC_GET_ALL_SERVICES = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2042d265..f6257ae8 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1651,10 +1651,8 @@ const Map localizedValues = { "calculate": {"en": "calculate", "ar": "حساب"}, "enterReadingValue": {"en": "Enter the reading value", "ar": "ادخل القيمة"}, "result": {"en": "Result", "ar": "النتيجة"}, - "bloodSugarConversion": { - "en": "Blood Sugar Conversion", - "ar": "السكر في الدم" - }, + "sort": {"en": "Sort", "ar": "فرز"}, + "bloodSugarConversion": {"en": "Blood Sugar Conversion", "ar": "السكر في الدم"}, "convertBloodSugarStatement": { "en": "Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.", diff --git a/lib/core/model/pharmacies/Reviews.dart b/lib/core/model/pharmacies/Reviews.dart index f924dce3..2c767cdd 100644 --- a/lib/core/model/pharmacies/Reviews.dart +++ b/lib/core/model/pharmacies/Reviews.dart @@ -10,13 +10,13 @@ class Reviews { bool isApproved; String title; String reviewText; - Null replyText; + String replyText; int rating; int helpfulYesTotal; int helpfulNoTotal; String createdOnUtc; Customer customer; - Null product; + //Null product; Reviews( {this.id, @@ -34,7 +34,8 @@ class Reviews { this.helpfulNoTotal, this.createdOnUtc, this.customer, - this.product}); + // this.product + }); Reviews.fromJson(Map json) { id = json['id']; @@ -54,7 +55,7 @@ class Reviews { customer = json['customer'] != null ? new Customer.fromJson(json['customer']) : null; - product = json['product']; + // product = json['product']; } Map toJson() { @@ -76,7 +77,7 @@ class Reviews { if (this.customer != null) { data['customer'] = this.customer.toJson(); } - data['product'] = this.product; + // data['product'] = this.product; return data; } } \ No newline at end of file diff --git a/lib/core/model/pharmacies/order_model.dart b/lib/core/model/pharmacies/order_model.dart index 42fc824d..92f4a729 100644 --- a/lib/core/model/pharmacies/order_model.dart +++ b/lib/core/model/pharmacies/order_model.dart @@ -312,7 +312,7 @@ class IngAddress { DateTime createdOnUtc; dynamic province; String latLong; - + LatLng getLocation(){ if(latLong.contains(',')){ var parts = latLong.trim().split(','); @@ -477,10 +477,10 @@ class OrderModelCustomer { }); String id; - Username username; - BillingAddressEmail email; - FirstName firstName; - LastName lastName; + dynamic username; + dynamic email; + dynamic firstName; + dynamic lastName; String languageId; dynamic adminComment; bool isTaxExempt; @@ -489,10 +489,10 @@ class OrderModelCustomer { bool deleted; bool isSystemAccount; dynamic systemName; - LastIpAddress lastIpAddress; - DateTime createdOnUtc; - DateTime lastLoginDateUtc; - DateTime lastActivityDateUtc; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; dynamic registeredInStoreId; List roleIds; @@ -578,6 +578,7 @@ final customerTaxDisplayTypeValues = EnumValues({ "ExcludingTax": CustomerTaxDisplayType.EXCLUDING_TAX }); + class OrderItem { OrderItem({ this.quantity, @@ -868,9 +869,9 @@ class Product { dynamic displayOrder; bool published; bool deleted; - DateTime createdOnUtc; - DateTime updatedOnUtc; - ProductType productType; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic productType; dynamic parentGroupedProductId; dynamic roleIds; dynamic discountIds; @@ -1147,14 +1148,14 @@ class Review { dynamic productId; dynamic storeId; bool isApproved; - Title title; - ReviewText reviewText; + dynamic title; + dynamic reviewText; dynamic replyText; dynamic rating; dynamic helpfulYesTotal; dynamic helpfulNoTotal; - DateTime createdOnUtc; - ReviewCustomer customer; + dynamic createdOnUtc; + dynamic customer; dynamic product; factory Review.fromJson(Map json) => Review( @@ -1236,7 +1237,7 @@ class ReviewCustomer { dynamic isOutSa; dynamic patientType; dynamic gender; - DateTime birthDate; + dynamic birthDate; dynamic phone; dynamic countryCode; dynamic yahalaAccountno; @@ -1245,7 +1246,7 @@ class ReviewCustomer { List addresses; String id; String username; - PurpleEmail email; + dynamic email; dynamic firstName; dynamic lastName; dynamic languageId; diff --git a/lib/core/model/pharmacies/orders_model.dart b/lib/core/model/pharmacies/orders_model.dart index a97bda98..0ad94767 100644 --- a/lib/core/model/pharmacies/orders_model.dart +++ b/lib/core/model/pharmacies/orders_model.dart @@ -32,6 +32,10 @@ class Orders { bool canCancel; bool canRefund; dynamic customerId; + double orderSubtotalExclTax; + dynamic orderShippingExclTax; + double orderTax; + Orders( {this.id, @@ -43,7 +47,10 @@ class Orders { this.orderStatusn, this.canCancel, this.canRefund, - this.customerId,}); + this.customerId, + this.orderShippingExclTax, + this.orderSubtotalExclTax, + this.orderTax,}); Orders.fromJson(Map json) { try { @@ -57,6 +64,9 @@ class Orders { canCancel = json['can_cancel']; canRefund = json['can_refund']; customerId = json['customer_id']; + orderSubtotalExclTax= json["order_subtotal_excl_tax"].toDouble(); + orderShippingExclTax= json["order_shipping_excl_tax"]; + orderTax= json["order_tax"].toDouble(); }catch(e){ print(e); } @@ -72,6 +82,9 @@ class Orders { data['order_status_id'] = this.orderStatusId; data['order_status'] = this.orderStatus; data['order_statusn'] = this.orderStatusn; + data ["order_subtotal_excl_tax"] = this.orderSubtotalExclTax; + data ["order_shipping_excl_tax"]= this.orderShippingExclTax; + data ["order_tax"]= this.orderTax; return data; } } diff --git a/lib/core/model/pharmacies/recommendedProduct_model.dart b/lib/core/model/pharmacies/recommendedProduct_model.dart new file mode 100644 index 00000000..e1e88cd8 --- /dev/null +++ b/lib/core/model/pharmacies/recommendedProduct_model.dart @@ -0,0 +1,486 @@ +class RecommendedProductModel { + List products; + + RecommendedProductModel({this.products}); + + RecommendedProductModel.fromJson(Map json) { + if (json['products'] != null) { + products = new List(); + json['products'].forEach((v) { + products.add(new Products.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.products != null) { + data['products'] = this.products.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Products { + String id; + bool visibleIndividually; + String name; + String namen; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + dynamic vendorId; + String seName; + List images; + + Products({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.vendorId, + this.seName, + this.images, + }); + + Products.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + shortDescription = json['short_description']; + shortDescriptionn = json['short_descriptionn']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + markasNew = json['markas_new']; + showOnHomePage = json['show_on_home_page']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + vendorId = json['vendor_id']; + seName = json['se_name']; + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index ee93de95..abfa7594 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -385,4 +385,175 @@ class BaseAppClient { return params; } + + + pharmacyPost(String endPoint, + {Map body, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + bool isAllowAny = false, + bool isExternal = false}) async { + String url; + if (isExternal) { + url = endPoint; + } else { + url = BASE_PHARMACY_URL + endPoint; + } + try { + //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (!isExternal) { + String token = await sharedPref.getString(TOKEN); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var user = await sharedPref.getObject(USER_PROFILE); + if (body.containsKey('SetupID')) { + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; + } + + body['VersionID'] = VERSION_ID; + body['Channel'] = CHANNEL; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + + body['IPAdress'] = IP_ADDRESS; + body['generalid'] = GENERAL_ID; + body['PatientOutSA'] = body.containsKey('PatientOutSA') + ? body['PatientOutSA'] != null + ? body['PatientOutSA'] + : PATIENT_OUT_SA + : PATIENT_OUT_SA; + + if (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = + body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; + } + + body['DeviceTypeID'] = DeviceTypeID; + + if (!body.containsKey('IsPublicRequest')) { + body['PatientType'] = body.containsKey('PatientType') + ? body['PatientType'] != null + ? body['PatientType'] + : user['PatientType'] != null + ? user['PatientType'] + : PATIENT_TYPE + : PATIENT_TYPE; + + body['PatientTypeID'] = body.containsKey('PatientTypeID') + ? body['PatientTypeID'] != null + ? body['PatientTypeID'] + : user['PatientType'] != null + ? user['PatientType'] + : PATIENT_TYPE_ID + : PATIENT_TYPE_ID; + if (user != null) { + body['TokenID'] = token; + body['PatientID'] = body['PatientID'] != null + ? body['PatientID'] + : user['PatientID']; + body['PatientOutSA'] = user['OutSA']; + body['SessionID'] = SESSION_ID; //getSessionId(token); + } + } + } + + print("URL : $url"); + print("Body : ${json.encode(body)}"); + var ss = json.encode(body); + + if (await Utils.checkConnection()) { + final response = await http.post(url.trim(), + body: json.encode(body), + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', + }); + final int statusCode = response.statusCode; + print("statusCode :$statusCode"); + if (statusCode < 200 || statusCode >= 400 || json == null) { + onFailure('Error While Fetching data', statusCode); + } else { + var parsed = json.decode(response.body.toString()); + if (parsed['Response_Message'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['ErrorType'] == 4) { + navigateToAppUpdate( + AppGlobal.context, parsed['ErrorEndUserMessage']); + } + if (isAllowAny) { + onSuccess(parsed, statusCode); + } else if (parsed['IsAuthenticated'] == null) { + if (parsed['isSMSSent'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else if (parsed['Result'] == 'OK') { + onSuccess(parsed, statusCode); + } else { + if (parsed != null) { + onSuccess(parsed, statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + logout(); + } + } + } else if (parsed['MessageStatus'] == 1 || + parsed['SMSLoginRequired'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 2 && + parsed['IsAuthenticated']) { + if (parsed['message'] == null && + parsed['ErrorEndUserMessage'] == null) { + if(parsed['ErrorSearchMsg'] == null ){ + onFailure("Server Error found with no available message", + statusCode); + }else { + onFailure(parsed['ErrorSearchMsg'], + statusCode); + } + } else { + onFailure( + parsed['message'] ?? + parsed['ErrorEndUserMessage'] ?? + parsed['ErrorMessage'], + statusCode); + } + } else if (!parsed['IsAuthenticated']) { + await logout(); + + //helpers.showErrorToast('Your session expired Please login agian'); + } else { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] != null) { + onFailure(parsed['message'] ?? parsed['message'], statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } + } + } + } + } + } else { + onFailure('Please Check The Internet Connection', -1); + } + } catch (e) { + print(e); + onFailure(e.toString(), -1); + } + } } diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 7fe5ca54..9d2b2f6b 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -20,15 +20,19 @@ class PharmacyModuleService extends BaseService { List lastVisitedProducts = List(); Future makeVerifyCustomer(dynamic data) async { - Map queryParams = {'FileNumber': data['PatientID'].toString()}; + Map queryParams = { + 'FileNumber': data['PatientID'].toString() + }; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode)async { + await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, + onSuccess: (dynamic response, int statusCode) async { if (response['UserName'] != null) { - sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); + sharedPref.setString( + PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); print(response); } else { - await createUser(); + await createUser(); } }, onFailure: (String error, int statusCode) { hasError = true; @@ -55,7 +59,8 @@ class PharmacyModuleService extends BaseService { }; hasError = false; try { - await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async{ + await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, + onSuccess: (dynamic response, int statusCode) async { if (!response['IsRegistered']) {} await generatePharmacyToken(); }, onFailure: (String error, int statusCode) { @@ -68,16 +73,18 @@ class PharmacyModuleService extends BaseService { } Future generatePharmacyToken() async { - await getUser(); + await getUser(); Map queryParams = { - 'Filenumber':user.patientID.toString(), - 'MobileNumber':Utils.getPhoneNumberWithoutZero(user.mobileNumber), + 'Filenumber': user.patientID.toString(), + 'MobileNumber': Utils.getPhoneNumberWithoutZero(user.mobileNumber), }; hasError = false; try { - await baseAppClient.get(PHARMACY_AUTORZIE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async{ + await baseAppClient.get(PHARMACY_AUTORZIE_CUSTOMER, + onSuccess: (dynamic response, int statusCode) async { if (response['Status'] == 200) { - await sharedPref.setString(PHARMACY_AUTORZIE_TOKEN, response['token'].toString()); + await sharedPref.setString( + PHARMACY_AUTORZIE_TOKEN, response['token'].toString()); } }, onFailure: (String error, int statusCode) { hasError = true; @@ -91,7 +98,8 @@ class PharmacyModuleService extends BaseService { Future getBannerListList() async { hasError = false; try { - await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, + onSuccess: (dynamic response, int statusCode) { bannerItems.clear(); response['images'].forEach((item) { bannerItems.add(PharmacyImageObject.fromJson(item)); @@ -108,7 +116,8 @@ class PharmacyModuleService extends BaseService { Future getTopManufacturerList() async { Map queryParams = {'page': '1', 'limit': '8'}; try { - await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, + onSuccess: (dynamic response, int statusCode) { manufacturerList.clear(); response['manufacturer'].forEach((item) { Manufacturer manufacturer = Manufacturer.fromJson(item); @@ -131,7 +140,8 @@ 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.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, + onSuccess: (dynamic response, int statusCode) { bestSellerProducts.clear(); response['products'].forEach((item) { bestSellerProducts.add(PharmacyProduct.fromJson(item)); @@ -147,10 +157,14 @@ 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.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) { + await baseAppClient + .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", + onSuccess: (dynamic response, int statusCode) { lastVisitedProducts.clear(); response['products'].forEach((item) { lastVisitedProducts.add(PharmacyProduct.fromJson(item)); diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index 33c2cfd7..c2312890 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -1,11 +1,9 @@ - import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; - class PrescriptionService extends BaseService { final AppSharedPreferences sharedPref = AppSharedPreferences(); bool isFinished = true; @@ -16,38 +14,42 @@ class PrescriptionService extends BaseService { List _prescriptionsList = List(); List get prescriptionsList => _prescriptionsList; - - Future getPrescription() async { - hasError = false; - url = PRESCRIPTION; - print("Print PRESCRIPTION url" + url); - await baseAppClient.post(url, - onSuccess: (dynamic response, int statusCode) { - _prescriptionsList.clear(); - response['PatientPrescriptionList'].forEach((item) { - _prescriptionsList.add(Prescriptions.fromJson(item)); - }); - print(_prescriptionsList.length); - print(response); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); - } // Future getPrescription() async { // hasError = false; -// Map body = Map(); -// body['isDentalAllowedBackend'] = false; -// await baseAppClient.post(PRESCRIPTION, +// url = PRESCRIPTION; +// print("Print PRESCRIPTION url" + url); +// await baseAppClient.get(url, // onSuccess: (dynamic response, int statusCode) { -// prescriptionsList.clear(); -// response['PatientPrescriptionList'].forEach((prescriptions) { -// prescriptionsList.add(Prescriptions.fromJson(prescriptions)); +// _prescriptionsList.clear(); +// response['PatientPrescriptionList'].forEach((item) { +// _prescriptionsList.add(Prescriptions.fromJson(item)); // }); +// print(_prescriptionsList.length); +// print(response); // }, onFailure: (String error, int statusCode) { // hasError = true; // super.error = error; -// }, body: body); +// }); // } - -} \ No newline at end of file + Future getPrescription() async { + url = PRESCRIPTION; + print("Print PRESCRIPTION url" + url); + hasError = false; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + print("Print PRESCRIPTION url" + url); + await baseAppClient.post(url, + onSuccess: (dynamic response, int statusCode) { + _prescriptionsList.clear(); + response['PatientPrescriptionList'].forEach((prescriptions) { + _prescriptionsList.add(Prescriptions.fromJson(prescriptions)); + }); + print(_prescriptionsList.length); + print("response is -------------"+response); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart index 9348c116..5853cc8f 100644 --- a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart +++ b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index 303dab9e..f38237e3 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -4,11 +4,14 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; //import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; -//import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; + import '../../../locator.dart'; @@ -17,6 +20,9 @@ class PharmacyModuleViewModel extends BaseViewModel { PrescriptionService _prescriptionService = locator(); + + RecommendedProductService _recommendedProductService = locator(); + List get bannerList => _pharmacyService.bannerItems; List get manufacturerList => _pharmacyService.manufacturerList; @@ -27,9 +33,14 @@ class PharmacyModuleViewModel extends BaseViewModel { List get lastVisitedProducts => _pharmacyService.lastVisitedProducts; + + List get recommendedProductList => + _recommendedProductService.recommendedList; + List get prescriptionsList => _prescriptionService.prescriptionsList; + bool hasError = false; // List get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ; Future getPharmacyHomeData() async { @@ -125,15 +136,17 @@ class PharmacyModuleViewModel extends BaseViewModel { } /////////////RecommendedProducts -// _getRecommendedProducts() async { -// await _pharmacyService.getRecommendedProducts(); -// if (_pharmacyService.hasError) { -// error = _pharmacyService.error; -// setState(ViewState.Error); -// } else { -// setState(ViewState.Idle); -// } -// } + getRecommendedProducts(productId) async { + hasError = false; + setState(ViewState.Busy); + await _recommendedProductService.getRecommendedProducts(productId); + if (_recommendedProductService.hasError) { + error = _recommendedProductService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } Future checkUserIsActivated() async { if (authenticatedUserObject.isLogin) { @@ -161,4 +174,19 @@ class PharmacyModuleViewModel extends BaseViewModel { } } + + ///////////////////////or +// getPrescriptions() async { +// setState(ViewState.Busy); +// await _prescriptionsService.getPrescriptions(); +// if (_prescriptionsService.hasError) { +// error = _prescriptionsService.error; +// setState(ViewState.Error); +// } else { +// _filterList(); +// await _getPrescriptionsOrders(); +// setState(ViewState.Idle); +// } +// } + } diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 339afa95..c7ac0a04 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -24,7 +24,6 @@ class ProductDetailViewModel extends BaseViewModel{ Future getProductReviewsData(productID) async { - print('ENAD REview'); hasError = false; setState(ViewState.Busy); await _productDetailService.getProductReviews(productID); @@ -36,7 +35,6 @@ class ProductDetailViewModel extends BaseViewModel{ } Future getProductLocationData() async { - print('ENAD in model view'); hasError = false; setState(ViewState.Busy); await _productDetailService.getProductAvailabiltyDetail(); diff --git a/lib/locator.dart b/lib/locator.dart index 21bc111a..7803b6a9 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_v import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; // import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; // import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; @@ -217,6 +218,8 @@ void setupLocator() { locator.registerLazySingleton(() => TermsConditionService()); locator.registerLazySingleton(() => CancelOrderService()); locator.registerLazySingleton(() => PrescriptionService()); + locator.registerLazySingleton(() => RecommendedProductService()); + locator.registerLazySingleton(() => PrivilegeService()); locator.registerLazySingleton(() => WeatherService()); diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 3dab7c83..04c9bb54 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -147,7 +147,7 @@ class _LandingPagePharmacyState extends State { PharmacyPage(), PharmacyCategorisePage(), // OffersCategorisePage(), - WishlistPage(), + WishlistPage(false), PharmacyProfilePage(), // Container( // child: Text('text'), diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart index d1872187..505533cb 100644 --- a/lib/pages/pharmacies/compare.dart +++ b/lib/pages/pharmacies/compare.dart @@ -196,7 +196,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[0].name, + text: widget.data[index].specifications != null ? + widget.data[index].specifications[0].name : + "No data", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, @@ -211,7 +213,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[1].name, + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].name : + "No data", style: TextStyle( color: Colors.black54, fontSize: 15, @@ -234,7 +238,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[2].name, + text:widget.data[index].specifications != null ? + widget.data[index].specifications[2].name : + "No data", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, @@ -249,7 +255,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[3].name, + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].name : + "No data", style: TextStyle( color: Colors.black54, fontSize: 15, @@ -272,7 +280,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[4].name, + text:widget.data[index].specifications != null ? + widget.data[index].specifications[4].name : + "No data", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, @@ -287,7 +297,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[5].name, + text:widget.data[index].specifications != null ? + widget.data[index].specifications[5].name : + "No data", style: TextStyle( color: Colors.black54, fontSize: 15, diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index 6dbfde46..945fbda1 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -1,3 +1,6 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/pages/final_products_page.dart'; +import 'package:diplomaticquarterapp/pages/login/register-info.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -52,7 +55,7 @@ class _ProductBrandsPageState extends State { height: 220, width: double.infinity, color: Colors.white, - child: topBrand(), + child: topBrand(context), ), SizedBox( height: 10, @@ -93,7 +96,7 @@ class _ProductBrandsPageState extends State { height: 10, ), Container( - height: 230, + height: 290, width: double.infinity, color: Colors.white, child: ListView.builder( @@ -117,7 +120,14 @@ class _ProductBrandsPageState extends State { ), ), onTap: () { - print("ENAD"); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FinalProductsPage( + id: model.brandsListList[index].id + .toString(), + )), + ); }, ); }), @@ -130,7 +140,7 @@ class _ProductBrandsPageState extends State { } } -topBrand() { +topBrand(BuildContext context) { return BaseView( onModelReady: (model) => model.getTopBrandsData(), builder: (_, model, wi) => GridView.count( @@ -173,7 +183,13 @@ topBrand() { ), ), onTap: () { - print("ENAD"); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FinalProductsPage( + id: model.topBrandsListList[index].id.toString(), + )), + ); }, ), ], diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index 7df95d5b..c119f468 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -1,9 +1,13 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_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/login/welcome.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -19,8 +23,7 @@ int price = 0; var languageID; bool isOverQuantity = false; bool isInWishlit = false; -var itemID; -var product; +String itemID; var customerId; CompareList compareItems = new CompareList(); PharmacyProduct specificationData; @@ -38,16 +41,48 @@ class __ProductDetailPageState extends State { bool isReviews = false; bool isAvailabilty = false; dynamic wishlistItems; + var model; + // String ProductId="4561"; + String productId = ""; + checkWishlist() async { + GifLoaderDialogUtils.showMyDialog(context); + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); +// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); + + for (int i = 0; i < x.wishListItems.length; i++) { + if (itemID == x.wishListItems[i].product.id) { + isInWishlit = true; + break; + } else { + isInWishlit = false; + } + } + GifLoaderDialogUtils.hideDialog(context); + setState(() {}); + } void initState() { price = 1; specificationData = widget.product; - setState(() { - customerId = userInfo(widget.product.id, widget.product); - }); + userInfo(); super.initState(); } + void userInfo() async { + print(specificationData); + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = widget.product.id; + checkWishlist(); +// getSpecificationData(itemID); + } + print("customerId:$customerId"); + + setState(() {}); +// getSpecificationData(itemID); + } + Widget build(BuildContext context) { return customerId != null ? DetailPageScafold( @@ -161,7 +196,7 @@ class __ProductDetailPageState extends State { ), Container( width: 500, - margin: EdgeInsets.only(bottom: 100), + margin: EdgeInsets.only(bottom: 6), // height: 350, color: Colors.white, child: Column( @@ -266,60 +301,89 @@ class __ProductDetailPageState extends State { ? Padding( padding: const EdgeInsets.all(8.0), child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Text( - TranslationBase.of(context).description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Text( + TranslationBase.of(context) + .description, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.shortDescriptionn - : widget.product.shortDescription ?? - "", - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), + SizedBox( + height: 10, ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - TranslationBase.of(context).howToUse, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + Divider(height: 1, color: Colors.grey), + SizedBox( + height: 15, ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.fullDescriptionn - : widget.product.fullDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), + Container( + child: Text( + languageID == 'ar' + ? widget.product.fullDescriptionn + : widget.product + .fullDescription ?? + "", + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), ), - ), - ], - ), + SizedBox( + height: 20, + ), + ]), ) + +// Container( +// child: Text( +// languageID == 'ar' +// ? widget.product.fullDescriptionn +// : widget.product.fullDescription, +// style: TextStyle( +// fontSize: 16, +// fontFamily: 'WorkSans-Regular'), +// ), +// ), +// SizedBox( +// height: 10, +// ), +// Container( +// child: Text( +// TranslationBase.of(context).howToUse, +// style: TextStyle( +// fontSize: 17, +// color: Colors.grey, +// fontWeight: FontWeight.w600), +// ), +// ), +// SizedBox( +// height: 6, +// ), +// Divider( +// height: 2, +// color: Colors.grey), +// SizedBox( +// height: 10, +// ), +// Container( +// child: Text( +// languageID == 'ar' +// ? widget.product.shortDescriptionn +// : widget.product.shortDescription, +// style: TextStyle( +// fontSize: 16, +// fontFamily: 'WorkSans-Regular'), +// ), +// ), + // ], + // ), + // ) : isReviews ? BaseView( onModelReady: (model) => @@ -537,7 +601,248 @@ class __ProductDetailPageState extends State { ], ), ), -// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), + Row( + children: [ +// Container( +// width: 500, +// height: 100, +// margin: EdgeInsets.only(bottom: 100), +// color: Colors.white, +// child: Text("ENAD TEST"), +// ), + Container( + width: 410, + height: 50, + // margin: EdgeInsets.only(bottom: 5), + color: Colors.white, + child: Texts( + TranslationBase.of(context).recommended, + bold: true, + ), + ), + + ], + ), + SingleChildScrollView( + child: Container( + color: Colors.white, + child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, +// mainAxisSize: MainAxisSize.min, + children: [ + Container( + color: Colors.white, + height: 210, + margin: EdgeInsets.only(bottom: 75), + padding: EdgeInsets.only(bottom: 5), + // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), + child: BaseView( + onModelReady: (model) => + model.getRecommendedProducts(widget.product.id.toString()), + builder: (_, model, wi) => + Container( + child: +// Text(model.recommendedProductList[0].id), + model.recommendedProductList.length != null + ? Expanded( + child: ListView.builder( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + itemCount: model.recommendedProductList.length, + itemBuilder: (context, index) { + return Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10)), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 0, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric(horizontal: 4), + width: MediaQuery.of(context).size.width / 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: Alignment.topRight, + child: //true + itemID.contains(model.recommendedProductList[index].id) + // !isInWishlist + ? IconButton( + icon: Icon(Icons + .favorite_border), + color: Colors.grey, + iconSize: 30, + onPressed: () { + setState(() { + addToWishlistFunction(itemID); + }); + }, + ) + : IconButton( + icon: Icon( + Icons.favorite), + color: Colors.red, + iconSize: 30, + onPressed: () { + setState(() { + deleteFromWishlistFunction(itemID); + }); + }, + ) +// + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 10, 16), + alignment: Alignment.center, +// padding: EdgeInsets.only(left: 25, bottom: 20), + child: (model.recommendedProductList[index].images != null && + model.recommendedProductList[index].images.length > 0) + ? Image.network( + model.recommendedProductList[index].images[0].src.toString(), +// item.images[0].src, + fit: BoxFit.cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 60, + ), + ), + Container( + width: model + .recommendedProductList[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6)), + ), + child: Texts( + model.recommendedProductList[index] + .rxMessage != + null + ? model + .recommendedProductList[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ), + ]), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + languageID == "ar" + ? model.recommendedProductList[index].namen + : model.recommendedProductList[index].name, + style: TextStyle( + color: Colors.black, + fontSize: 13.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: const EdgeInsets.only( + top: 10, bottom: 5), + child: Texts( + "SAR ${model.recommendedProductList[index].price}", + bold: true, + fontSize: 14, + ), + ), + ], + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.only(right: 10), +// margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model + .recommendedProductList[ + index] + .approvedRatingSum + .toDouble(), +// initialRating: productRate, + size: 13.0, + filledColor: + Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: + Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Texts( + "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), + ), + ); + }), + ) + : Container( +// child: Text("NO DATA"), + ), + ) + + ), + ), + ], + ), + ), + ) ], ), ), @@ -768,6 +1073,39 @@ class __ProductDetailPageState extends State { fontWeight: FontWeight.w600), ), ), + SizedBox( + height: 6, + ), + Divider(height: 1, color: Colors.grey), + SizedBox( + height: 10, + ), + Container( + child: Text( + languageID == 'ar' + ? widget.product.shortDescriptionn + : widget.product.shortDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + TranslationBase.of(context).howToUse, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 6, + ), + Divider(height: 2, color: Colors.grey), SizedBox( height: 10, ), @@ -1394,7 +1732,9 @@ class _footerWidgetState extends State { }, ), ), - !widget.isAvailble && price > 0 || price > widget.quantityLimit + !widget.isAvailble && price > 0 || + price > widget.quantityLimit || + widget.item.rxMessage != null ? Container( width: 190, height: 46, @@ -1431,7 +1771,9 @@ class _footerWidgetState extends State { SizedBox( width: 5, ), - !widget.isAvailble && price > 0 || price > widget.quantityLimit + !widget.isAvailble && price > 0 || + price > widget.quantityLimit || + widget.item.rxMessage != null ? Container( width: 120, height: 46, @@ -1498,7 +1840,7 @@ class _productNameAndPriceState extends State { child: Row( children: [ Text( - widget.item.price.toString(), + widget.item.price.toString() + " " + "SAR", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), ), SizedBox( @@ -1543,27 +1885,24 @@ class _productNameAndPriceState extends State { color: Colors.grey, borderRadius: BorderRadius.circular(30), ), - child: !isInWishlit - ? IconButton( - icon: Icon(Icons.favorite_border), - color: Colors.white, - onPressed: () { - setState(() { - addToWishlistFunction(widget.item.id); - }); -// MyStatelessWidget(); - }, - ) - : IconButton( - icon: Icon(Icons.favorite), - color: Colors.red, - onPressed: () { - setState(() { - deleteFromWishlistFunction(widget.item.id); - }); -// MyStatelessWidget(); - }, - )), + child: IconButton( + icon: Icon(!isInWishlit + ? Icons.favorite_border + : Icons.favorite), + color: !isInWishlit ? Colors.white : Colors.red, + onPressed: () async { + if (customerId != null) { + if (!isInWishlit) { + await addToWishlistFunction(widget.item.id); + } else { + await deleteFromWishlistFunction(widget.item.id); + } + } else { + return; + } + setState(() {}); + }, + )), ], ), ), @@ -1630,135 +1969,6 @@ class _productNameAndPriceState extends State { } } -//productNameAndPrice(BuildContext context, item) { -// return Column( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// Padding( -// padding: const EdgeInsets.all(8.0), -// child: Row( -// children: [ -// Text( -// item.price.toString(), -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), -// ), -// SizedBox( -// width: 40, -// ), -// Text( -// item.stockAvailability, -// style: item.stockAvailability == 'Out of stock' -// ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) -// : TextStyle(fontWeight: FontWeight.bold, color: Colors.green), -// ), -// SizedBox(width: 20), -// item.stockAvailability == 'Out of stock' -// ? Text( -// TranslationBase.of(context).notifyMe, -// style: TextStyle( -// color: Colors.blue, -// decoration: TextDecoration.underline, -// ), -// ) -// : Container(), -// item.stockAvailability == 'Out of stock' -// ? Icon( -// FontAwesomeIcons.bell, -// color: Colors.blue, -// size: 15.0, -// ) -// : Container(), -// -// Container( -// margin: languageID=='ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25), -// width: 40, -// height: 40, -// decoration: BoxDecoration( -// color: Colors.grey, -// borderRadius: BorderRadius.circular(30), -// ), -// child: !isInWishlit ?IconButton( -// icon: Icon(Icons.favorite_border), -// color: Colors.white, -// onPressed: () { -// addToWishlistFunction(item.id); -//// MyStatelessWidget(); -// -// }, -// ):IconButton( -// icon: Icon(Icons.favorite), -// color: Colors.red, -// onPressed: () { -// deleteFromWishlistFunction(item.id); -//// MyStatelessWidget(); -// -// }, -// ) -// ), -// -// ], -// ), -// ), -// Padding( -// padding: const EdgeInsets.all(8.0), -// child: Container( -// margin: EdgeInsets.only(left: 5), -// child: Align( -// alignment: -// languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, -// child: Text( -// languageID == 'ar' ? item.fullDescriptionn : item.fullDescription, -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), -// ), -// ), -// ), -// ), -// Row( -// children: [ -// Expanded( -// flex: 2, -// child: Container( -// margin: EdgeInsets.only(right: 150), -// child: Align( -// alignment: Alignment.bottomLeft, -// child: RatingBar.readOnly( -// initialRating: 3, -// size: 15.0, -// filledColor: Colors.yellow[700], -// emptyColor: Colors.grey[500], -// isHalfAllowed: true, -// halfFilledIcon: Icons.star_half, -// filledIcon: Icons.star, -// emptyIcon: Icons.star, -// ), -// ), -// ), -// ), -// Expanded( -// flex: 1, -// child: Container( -// child: item.rxMessage != null -// ? Text( -// languageID == 'ar' -// ? item.rxMessagen.toString() -// : item.rxMessage.toString(), -// style: TextStyle(color: Colors.red, fontSize: 10), -// ) -// : Container()), -// ), -// item.rxMessage != null -// ? Icon( -// FontAwesomeIcons.questionCircle, -// color: Colors.red, -// size: 15.0, -// ) -// : Container(), -// ], -// ), -// ], -// ); -//} - slideDetail() { return Row( mainAxisAlignment: MainAxisAlignment.start, @@ -1823,22 +2033,21 @@ addToWishlistFunction(itemID) async { deleteFromWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlit = false; - await x.addToWishlistData(itemID); + await x.deletWishlistData(itemID); } checkWishlist() async { ProductDetailViewModel x = new ProductDetailViewModel(); await x.checkWishlistData(); + +// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); + for (int i = 0; i < x.wishListItems.length; i++) { -// print(itemID); -// print(x.wishListItems[i].product.id); if (itemID == x.wishListItems[i].product.id) { isInWishlit = true; -// print('in wishlist'); break; } else { isInWishlit = false; -// print('not in wishlist'); } } } @@ -1858,8 +2067,8 @@ settingModalBottomSheet(context) { child: new Wrap( children: [ new ListTile( - leading: new Icon(Icons.shopping_cart), - title: new Text('Add to cart'), + leading: Icon(Icons.shopping_cart), + title: Text('Add to cart'), onTap: () => { if (price > 0) {addToCartFunction(price, itemID)} @@ -1869,14 +2078,14 @@ settingModalBottomSheet(context) { message: "you should add quantity") } }), - new ListTile( - leading: new Icon(Icons.favorite_border), - title: new Text('Add to wishlist'), + ListTile( + leading: Icon(Icons.favorite_border), + title: Text('Add to wishlist'), onTap: () => {addToWishlistFunction(itemID)}, ), - new ListTile( - leading: new Icon(Icons.compare), - title: new Text('Compare'), + ListTile( + leading: Icon(Icons.compare), + title: Text('Compare'), onTap: () => { Provider.of(context, listen: false) .addItem(specificationData), @@ -1887,15 +2096,3 @@ settingModalBottomSheet(context) { ); }); } - -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); -} diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 394b516b..e4830583 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -1,31 +1,73 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_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/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; - import '../../final_products_page.dart'; import 'lacum-activitaion-vida-page.dart'; -class PharmacyPage extends StatelessWidget { +bool isInWishlist = false; +int price = 0; +var itemID; +var product; +var customerId; +var item; +dynamic languageID; +List wishlistData; + +class PharmacyPage extends StatefulWidget { +// final PharmacyProduct product; +// PharmacyPage(this.product); + + @override + _PharmacyPageState createState() => _PharmacyPageState(); +} + +class _PharmacyPageState extends State { +// dynamic wishlistVar; + + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + + List recommendedProductList = []; + List wishList = []; + + var model; +// String ProductId="4561"; + //String id ="3608"; + String productId = ""; + String id = ""; @override void initState() { -// print("model prescription " + model.prescriptionsList.length); -// cancelOrderDetail(order) + checkWishlist(); + // userInfo(widget.product.id, widget.product); + userInfo(id, product); + print("-------------this--------------"); + print(itemID); } @override @@ -46,7 +88,7 @@ class PharmacyPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), - GridViewButtons(model), + // GridViewButtons(model), Container( margin: EdgeInsets.fromLTRB(10, 10, 10, 10), child: Row( @@ -72,9 +114,12 @@ class PharmacyPage extends StatelessWidget { ), ), Container( + height: model.prescriptionsList.length > 0 + ? MediaQuery.of(context).size.height * 0.28 + : 0, padding: - EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0), - height: MediaQuery.of(context).size.height * 0.30, + EdgeInsets.symmetric(horizontal: 18.0, vertical: 14.0), +// height: MediaQuery.of(context).size.height * 0.28, // width: 200.0, // height: MediaQuery.of(context).size.height / 4 + 20, margin: EdgeInsets.only(left: 10), @@ -88,15 +133,14 @@ class PharmacyPage extends StatelessWidget { shrinkWrap: true, physics: ScrollPhysics(), // physics: NeverScrollableScrollPhysics(), - // itemCount: 4, itemCount: model.prescriptionsList.length, itemBuilder: (context, index) { return Container( // width: 160.0, height: MediaQuery.of(context).size.height * 0.6, - padding: - EdgeInsets.only(bottom: 5.0, left: 5.0), + padding: EdgeInsets.only( + bottom: 5.0, left: 5.0, right: 8.0), margin: EdgeInsets.only(right: 10.0), decoration: BoxDecoration( border: Border.all( @@ -117,17 +161,41 @@ class PharmacyPage extends StatelessWidget { padding: EdgeInsets.only( top: 10.0, left: 10.0, - right: 3.0, + right: 10.0, bottom: 15.0, ), - child: Image.network( - model.prescriptionsList[index] - .doctorImageURL, - width: 60, - height: 60, + child: CircleAvatar( + radius: 30, + backgroundColor: + Colors.transparent, + child: Image.network( + model.prescriptionsList[index] + .doctorImageURL, + width: 60, + height: 60, + ), ), ), ]), +// Column( +// // crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Container( +// margin: EdgeInsets.only(left: 1), +// padding: EdgeInsets.only( +// top: 10.0, +// left: 10.0, +// right: 3.0, +// bottom: 15.0, +// ), +// child: Image.network( +// model.prescriptionsList[index] +// .doctorImageURL, +// width: 60, +// height: 60, +// ), +// ), +// ]), Column( // crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -148,11 +216,17 @@ class PharmacyPage extends StatelessWidget { BorderRadius.circular( 30.0)), child: Text( - model - .prescriptionsList[ - index] - .isInOutPatientDescription - .toString(), + languageID == "ar" + ? model + .prescriptionsList[ + index] + .isInOutPatientDescriptionN + .toString() + : model + .prescriptionsList[ + index] + .isInOutPatientDescription + .toString(), style: TextStyle( color: Colors.white, fontSize: 15.0, @@ -166,9 +240,14 @@ class PharmacyPage extends StatelessWidget { height: 30, ), Text( - model.prescriptionsList[index] - .appointmentDate - .toString(), + DateUtil.convertStringToDate( + model + .prescriptionsList[ + index] + .appointmentDate + .toString()) + .toString() + .substring(0, 10), style: TextStyle( color: Colors.black, fontSize: 15.0, @@ -239,6 +318,10 @@ class PharmacyPage extends StatelessWidget { child: Align( alignment: Alignment.topLeft, child: RatingBar.readOnly( + initialRating: model + .prescriptionsList[index] + .actualDoctorRate + .toDouble(), // initialRating: productRate, size: 15.0, filledColor: @@ -259,36 +342,238 @@ class PharmacyPage extends StatelessWidget { : Container(), ), ), - Container( - margin: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).recommended, - bold: true, - ), - BorderedButton( - TranslationBase.of(context).viewAll, - hasBorder: true, - borderColor: Colors.green, - textColor: Colors.green, - vPadding: 6, - hPadding: 4, - handler: () {}, - ), - ], - ), - ), - Container( - height: MediaQuery.of(context).size.height / 4 + 20, - child: ListView.builder( - itemBuilder: (ctx, i) => - ProductTileItem(model.bestSellerProduct[i]), - scrollDirection: Axis.horizontal, - itemCount: model.bestSellerProduct.length, - ), - ), +// Container( +// margin: EdgeInsets.fromLTRB(10, 10, 10, 10), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts( +// TranslationBase.of(context).recommended, +// bold: true, +// ), +// BorderedButton( +// TranslationBase.of(context).viewAll, +// hasBorder: true, +// borderColor: Colors.green, +// textColor: Colors.green, +// vPadding: 6, +// hPadding: 4, +// handler: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) => +// RecommendedProductPage(productId : "2316"))); +// }, +// ), +// ], +// ), +// ), +// Container( +// height: model.recommendedProductList.length > 0 +// ? MediaQuery.of(context).size.height * 0.32 +// : 0, +// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), +//// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0), +//// margin: EdgeInsets.only(left: 10), +// child: BaseView( +// onModelReady: (model) => +// model.getRecommendedProducts(productId), +// builder: (_, model, wi) => model +// .recommendedProductList.length != +// null +// ? ListView.builder( +// scrollDirection: Axis.horizontal, +// shrinkWrap: true, +// physics: ScrollPhysics(), +// // physics: NeverScrollableScrollPhysics(), +// itemCount: model.recommendedProductList.length, +// itemBuilder: (context, index) { +// return Card( +// elevation: 2, +// shape: RoundedRectangleBorder( +// side: BorderSide( +// color: Colors.grey[300], width: 2), +// borderRadius: BorderRadius.circular(10)), +// margin: EdgeInsets.symmetric( +// horizontal: 8, +// vertical: 0, +// ), +// child: Container( +// decoration: BoxDecoration( +// borderRadius: BorderRadius.all( +// Radius.circular(15), +// ), +// ), +// padding: EdgeInsets.symmetric(horizontal: 4), +// width: MediaQuery.of(context).size.width / 3, +// child: Column( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Stack(children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child: //true +// itemID.contains(model.recommendedProductList[index].id) +// // !isInWishlist +// ? IconButton( +// icon: Icon(Icons +// .favorite_border), +// color: Colors.grey, +// iconSize: 30, +// onPressed: () { +// setState(() { +// addToWishlistFunction( +// itemID); +// }); +// }, +// ) +// : IconButton( +// icon: Icon( +// Icons.favorite), +// color: Colors.red, +// iconSize: 30, +// onPressed: () { +// setState(() { +// deleteFromWishlistFunction( +// itemID); +// }); +// }, +// ) +//// +// ), +// ), +// Container( +// margin: EdgeInsets.fromLTRB( +// 0, 16, 10, 16), +// alignment: Alignment.center, +//// padding: EdgeInsets.only(left: 25, bottom: 20), +// child: (model.recommendedProductList[index].images != null && +// model.recommendedProductList[index].images.length > 0) +// ? Image.network( +// model.recommendedProductList[index].images[0].src.toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 60, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 60, +// ), +// ), +// Container( +// width: model +// .recommendedProductList[ +// index] +// .rxMessage != +// null +// ? MediaQuery.of(context) +// .size +// .width / +// 5 +// : 0, +// padding: EdgeInsets.all(4), +// decoration: BoxDecoration( +// color: Color(0xffb23838), +// borderRadius: BorderRadius.only( +// topLeft: Radius.circular(6)), +// ), +// child: Texts( +// model.recommendedProductList[index] +// .rxMessage != +// null +// ? model +// .recommendedProductList[ +// index] +// .rxMessage +// : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), +// ), +// ]), +// Container( +// margin: EdgeInsets.symmetric( +// horizontal: 6, +// vertical: 0, +// ), +// child: Column( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Text( +// languageID == "ar" +// ? model.recommendedProductList[index].namen +// : model.recommendedProductList[index].name, +// style: TextStyle( +// color: Colors.black, +// fontSize: 13.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +//// padding: const EdgeInsets.only(top: 15, bottom: 10), +// padding: const EdgeInsets.only( +// top: 10, bottom: 5), +// child: Texts( +// "SAR ${model.recommendedProductList[index].price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// ], +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: +// EdgeInsets.only(right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: model +// .recommendedProductList[ +// index] +// .approvedRatingSum +// .toDouble(), +//// initialRating: productRate, +// size: 13.0, +// filledColor: +// Colors.yellow[700], +// emptyColor: Colors.grey[500], +// isHalfAllowed: true, +// halfFilledIcon: +// Icons.star_half, +// filledIcon: Icons.star, +// emptyIcon: Icons.star, +// ), +// ), +// ), +// Texts( +// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), +// ), +// ); +// }) +// : Container( +//// child: Text("NO DATA"), +// ), +// ), +// ), Container( margin: EdgeInsets.fromLTRB(10, 10, 10, 0), child: Row( @@ -411,6 +696,49 @@ class PharmacyPage extends StatelessWidget { ), ); } + + addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = true; + await x.addToWishlistData(itemID); + } + + deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = false; + await x.addToWishlistData(itemID); + } + + checkWishlist() async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + for (int i = 0; i < x.wishListItems.length; i++) { + // itemID = x.wishListItems[i].id; + print("-------------wishlist---------------"); + print(itemID); +// print(product.id); + print(x.wishListItems[i].productId); + if (itemID == x.wishListItems[i].productId) { + isInWishlist = true; +// print('in wishlist'); + break; + } else { + isInWishlist = false; +// print('not in wishlist'); + } + } + } + + 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; + } } class GridViewButtons extends StatelessWidget { @@ -544,4 +872,41 @@ class GridViewCard extends StatelessWidget { ), ); } + + String getDate(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString(); + } } + +class test extends StatefulWidget { + @override + _testState createState() => _testState(); +} + +class _testState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +} +//addWishlistData() async { +// ProductDetailViewModel x = new ProductDetailViewModel(); +// await wishlistData.add(x.checkWishlistData()); +// print("-------------testWishlist---------------"); +// +//} + +// checkWishlist() async { +// ProductDetailViewModel x = new ProductDetailViewModel(); +// wishlistVar = await x.checkWishlistData(); +// print("wishlistVar>>>>>>>>>>>>>>>"); +// print(wishlistVar); +// +// } diff --git a/lib/pages/pharmacies/screens/recommended-product-page.dart b/lib/pages/pharmacies/screens/recommended-product-page.dart new file mode 100644 index 00000000..28e3cce3 --- /dev/null +++ b/lib/pages/pharmacies/screens/recommended-product-page.dart @@ -0,0 +1,997 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_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/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; + +dynamic languageID; +bool isInWishlist = false; +int price = 0; +var itemID; +var product; +var customerId; + +class RecommendedProductPage extends StatefulWidget { + String productId ; + RecommendedProductPage({this.productId}); + + @override + _RecommendedProductPageState createState() => _RecommendedProductPageState(productId: productId); +} + +class _RecommendedProductPageState extends State + with SingleTickerProviderStateMixin { + List recommendedProductList = []; + String productId; + _RecommendedProductPageState({this.productId}); + String id = ""; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + + // String productId = "4561"; + // String productId = ""; + + @override + void initState() { + checkWishlist(); + userInfo(id, product); + print("-------------this--------------"); + print(itemID); + } + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.80) / 2; + final double itemWidth = size.width / 2; + return BaseView( + onModelReady: (model) => model.getRecommendedProducts(productId), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).recommended, + baseViewModel: model, + isShowAppBar: true, + isPharmacy: true, + backgroundColor: Colors.white, + body: SingleChildScrollView( + child: Column(children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + top: 8, + bottom: 10, + left: 10, + ), + child: Text( + model.recommendedProductList.length.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(top: 8, bottom: 10, left: 8), + child: Text( + TranslationBase.of(context).result, + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey, + ), + ), + ), + Container( + child: Image.asset( + 'assets/images/pharmacy/sort.png', + width: 20, + height: 20, +// color: Colors.red, + ), + ), + Container( + child: Text( + TranslationBase.of(context).sort, + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey, + ), + ), + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ]), + SizedBox( + height: 2, + ), + Divider( + color: Colors.grey[350], + height: 10, + thickness: 6, + indent: 0, + endIndent: 0, + ), + styleOne == true + ? Container( + margin: EdgeInsets.all(5.0), + child: model.recommendedProductList.length != null + ? CustomScrollView( + primary: false, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + slivers: [ + SliverPadding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), + sliver: SliverGrid.count( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + children: model.recommendedProductList + .map((e) => Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Colors.grey[300], + width: 2), + borderRadius: + BorderRadius.circular( + 10)), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 11, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric( + horizontal: 4), + width: MediaQuery.of(context) + .size.width / 3, +// + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: + Alignment + .topRight, + child: + itemID.contains(e.id) + // !isInWishlist + ? IconButton( + icon: + Icon(Icons.favorite_border), + color: + Colors.grey, + iconSize: + 30, + onPressed: + () { + setState(() { + addToWishlistFunction(itemID); + }); + }, + ) + : + IconButton( + icon: + Icon(Icons.favorite), + color: + Colors.red, + iconSize: + 30, + onPressed: + () { + setState(() { + deleteFromWishlistFunction(itemID); + }); + }, + ) +// + ), + ), + Container( + margin: EdgeInsets + .fromLTRB(0, 16, + 10, 16), + alignment: + Alignment.center, +// padding: EdgeInsets.only(left: 25, bottom: 20), + child: (e.images != + null && + e.images.length > + 0) + ? Image.network( + e.images[0] + .src + .toString(), +// item.images[0].src, + fit: BoxFit + .cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit + .cover, + height: 60, + ), + ), + Container( + width: e.rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + e.rxMessage != null + ? e.rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ]), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + languageID == "ar" + ? e.namen + : e.name, + style: TextStyle( + color: Colors + .black, + fontSize: 13.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: + const EdgeInsets + .only( + top: 10, + bottom: + 5), + child: Texts( + "SAR ${e.price}", + bold: true, + fontSize: 14, + ), + ), + ], + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Container( + padding: EdgeInsets + .only( + right: + 10), +// margin: EdgeInsets.only(left: 5), + child: Align( + alignment: + Alignment + .topLeft, + child: RatingBar + .readOnly( + initialRating: e + .approvedRatingSum + .toDouble(), +// initialRating: productRate, + size: 13.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: + Colors.grey[ + 500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons + .star, + emptyIcon: + Icons + .star, + ), + ), + ), + Texts( + "(${e.approvedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), + ), + ) +// Column( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child: !isInWishlist +// ? IconButton( +// icon: Icon(Icons.favorite_border), +// color: Colors.grey, +// iconSize: 30, +// onPressed: () { +// setState(() { +// addToWishlistFunction(itemID); +// }); +// }, +// ) +// : IconButton( +// icon: Icon(Icons.favorite), +// color: Colors.red, +// iconSize: 30, +// onPressed: () { +// setState(() { +// deleteFromWishlistFunction(itemID); +// }); +// }, +// ) +//// +// ),), +// Container( +// padding: EdgeInsets.only( +// left: 25, bottom: 20), +//// margin: EdgeInsets.fromLTRB(0, 16, 0, 0), +//// alignment: Alignment.centerLeft, +// child: (e.images != null && +// e.images.length > 0) +// ? Image.network( +// e.images[0].src +// .toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 80, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 80, +// ), +// ), +// Text( +// e.name, +//// model.recommendedProduct[0].products[index].shortDescription +//// .toString(), +// style: TextStyle( +// color: Colors.black, +// fontSize: 15.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +// padding: const EdgeInsets.only( +// top: 15, bottom: 10), +// child: Texts( +// "SAR ${e.price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: EdgeInsets.only( +// right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: +// Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: e +// .approvedRatingSum +// .toDouble(), +//// initialRating: productRate, +// size: 15.0, +// filledColor: +// Colors.yellow[700], +// emptyColor: +// Colors.grey[500], +// isHalfAllowed: true, +// halfFilledIcon: +// Icons.star_half, +// filledIcon: Icons.star, +// emptyIcon: Icons.star, +// ), +// ), +// ), +// Texts( +// "(${e.approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), + ) + .toList(), +// children:[ +// ListView.builder( +// scrollDirection: Axis.vertical, +// shrinkWrap: true, +// physics: ScrollPhysics(), +// itemCount: model.recommendedProductList.length, +// itemBuilder: (context, index) { +// return Container( +// height: 30, +// padding: EdgeInsets.only( left: 15.0, top: 10, right: 10), +// margin: EdgeInsets.only(right: 10.0), +// decoration: BoxDecoration( +// border: Border.all( +// color: Colors.grey, +// style: BorderStyle.solid, +// width: 1.0, +// ), +// color: Colors.white, +// borderRadius: BorderRadius.circular(10.0)), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child:!isInWishlist +// ? InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/heart-empty.svg', +// width: 20, +// height: 20, +// color: Colors.grey, +// ), +// ) +// : InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/Redheart.svg', +// width: 20, +// height: 20, +//// color: Colors.red, +// ), +// ) +// ), +// ), +// Container( +// padding: EdgeInsets.only(left: 25, bottom: 20), +//// margin: EdgeInsets.fromLTRB(0, 16, 0, 0), +//// alignment: Alignment.centerLeft, +// child: (model.recommendedProductList[index].images != null && +// model.recommendedProductList[index].images.length > 0) +// ? Image.network( +// model.recommendedProductList[index].images[0].src.toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 80, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 80, +// ), +// ), +// Text( +// model.recommendedProductList[index].name, +//// model.recommendedProduct[0].products[index].shortDescription +//// .toString(), +// style: TextStyle( +// color: Colors.black, +// fontSize: 15.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), +// child: Texts( +// "SAR ${model.recommendedProductList[index].price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: EdgeInsets.only(right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: +// model.recommendedProductList[index].approvedRatingSum.toDouble(), +//// initialRating: productRate, +// size: 15.0, +// filledColor: Colors.yellow[700], +// emptyColor: Colors.grey[500], +// isHalfAllowed: true, +// halfFilledIcon: Icons.star_half, +// filledIcon: Icons.star, +// emptyIcon: Icons.star, +// ), +// ), +// ), +// Texts( +// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), +// ); +// } +// ), +// ] + ), + ), + ]) + : Container(), + ) + : Container( + height: model.recommendedProductList.length > 0 + ? MediaQuery.of(context).size.height * 0.60 + : 0, + child: ListView.builder( + physics: ScrollPhysics(), +// physics: NeverScrollableScrollPhysics(), + itemCount: model.recommendedProductList.length, + itemBuilder: (context, index) { + return Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: + BorderSide(color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10)), +// + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric(horizontal: 5), + width: MediaQuery.of(context).size.width / 3, +// + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: Alignment.topRight, + child: //true + //wishlistVar[index].id.contains(model.recommendedProductList[index].id) + !isInWishlist + ? IconButton( + icon: Icon( + Icons.favorite_border), + color: Colors.grey, + iconSize: 30, + onPressed: () { + setState(() { + addToWishlistFunction( + itemID); + }); + }, + ) + : IconButton( + icon: Icon(Icons.favorite), + color: Colors.red, + iconSize: 30, + onPressed: () { + setState(() { + deleteFromWishlistFunction( + itemID); + }); + }, + ) +// + ), + ), + Container( + margin: EdgeInsets.fromLTRB(0, 16, 10, 16), + alignment: Alignment.center, +// padding: EdgeInsets.only(left: 25, bottom: 20), + child: (model.recommendedProductList[index] + .images != + null && + model.recommendedProductList[index] + .images.length > + 0) + ? Image.network( + model.recommendedProductList[index] + .images[0].src + .toString(), +// item.images[0].src, + fit: BoxFit.cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 60, + ), + ), + Container( + width: model.recommendedProductList[index] + .rxMessage != + null + ? MediaQuery.of(context).size.width / 5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6)), + ), + child: Texts( + model.recommendedProductList[index] + .rxMessage != + null + ? model.recommendedProductList[index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ), + ]), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 2, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + model + .recommendedProductList[index].name, + style: TextStyle( + color: Colors.black, + fontSize: 13.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: const EdgeInsets.only( + top: 10, bottom: 5), + child: Texts( + "SAR ${model.recommendedProductList[index].price}", + bold: true, + fontSize: 14, + ), + ), + ], + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + right: 10, bottom: 10), +// margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model + .recommendedProductList[index] + .approvedRatingSum + .toDouble(), +// initialRating: productRate, + size: 13.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Texts( + "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), + ), + ); +// Container( +// height: 30, +// padding: EdgeInsets.only( left: 10.0, top: 10, right: 10), +//// margin: EdgeInsets.only(right: 10.0), +// decoration: BoxDecoration( +// border: Border.all( +// color: Colors.grey, +// style: BorderStyle.solid, +// width: 1.0, +// ), +// color: Colors.white, +// borderRadius: BorderRadius.circular(10.0)), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child:!isInWishlist +// ? InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/heart-empty.svg', +// width: 20, +// height: 20, +// color: Colors.grey, +// ), +// ) +// : InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/Redheart.svg', +// width: 20, +// height: 20, +//// color: Colors.red, +// ), +// ) +// ), +// ), +// Container( +// padding: EdgeInsets.only(left: 25, bottom: 20), +//// margin: EdgeInsets.fromLTRB(0, 16, 0, 0), +//// alignment: Alignment.centerLeft, +// child: (model.recommendedProductList[index].images != null && +// model.recommendedProductList[index].images.length > 0) +// ? Image.network( +// model.recommendedProductList[index].images[0].src.toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 80, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 80, +// ), +// ), +// Text( +// model.recommendedProductList[index].name, +//// model.recommendedProduct[0].products[index].shortDescription +//// .toString(), +// style: TextStyle( +// color: Colors.black, +// fontSize: 15.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), +// child: Texts( +// "SAR ${model.recommendedProductList[index].price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: EdgeInsets.only(right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: +// model.recommendedProductList[index].approvedRatingSum.toDouble(), +//// initialRating: productRate, +// size: 15.0, +// filledColor: Colors.yellow[700], +// emptyColor: Colors.grey[500], +// isHalfAllowed: true, +// halfFilledIcon: Icons.star_half, +// filledIcon: Icons.star, +// emptyIcon: Icons.star, +// ), +// ), +// ), +// Texts( +// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), +// ); + }), + ), + ]), + ), + ), + ); + } + checkWishlist() async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + for (int i = 0; i < x.wishListItems.length; i++) { + // itemID = x.wishListItems[i].id; + print("-------------wishlist---------------"); + print(itemID); +// print(product.id); + print(x.wishListItems[i].productId); + if (itemID == x.wishListItems[i].productId) { + isInWishlist = true; +// print('in wishlist'); + break; + } else { + isInWishlist = false; +// print('not in wishlist'); + } + } + } + + 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; + } + + + addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = true; + await x.addToWishlistData(itemID); + } + + deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = false; + await x.addToWishlistData(itemID); + } +} + diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index 822dfe89..000e8404 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -5,6 +5,8 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; class WishlistPage extends StatefulWidget { + bool showBar; + WishlistPage(this.showBar); @override _WishlistPageState createState() => _WishlistPageState(); } @@ -17,9 +19,9 @@ class _WishlistPageState extends State { onModelReady: (model) => model.getWishlistData(), builder: (_, model, wi) => AppScaffold( appBarTitle: 'Wishlist page', - isShowAppBar: false, + isShowAppBar: widget.showBar, isShowDecPage: false, - isPharmacy: false, + isPharmacy: true, baseViewModel: model, body: model.wishListList.length == 0 ? Container( diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 6488b421..2ba92674 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -69,6 +69,7 @@ class _OrderPageState extends State children: [ TabBar( labelPadding: EdgeInsets.only(left: 3.0, right: 3.0), + labelColor: Colors.black, tabs: [ Tab(text: TranslationBase.of(context).delivered), Tab(text: TranslationBase.of(context).processing), diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index ea74ed23..b0fb974f 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -47,7 +47,7 @@ class _OrderDetailsPageState extends State { var model; var isCancel = false; var isRefund = false; - var isActiveDelivery = true; + var isActiveDelivery = false; var dataIsCancel; var dataIsRefund; BuildContext context; @@ -69,7 +69,14 @@ class _OrderDetailsPageState extends State { Widget build(BuildContext context) { this.context = context; return BaseView( - onModelReady: (model) => model.getOrderDetails(widget.orderModel.id), + onModelReady: (model) { + model.getOrderDetails(widget.orderModel.id).then((value) { + setState(() { + isActiveDelivery = (value.orderStatusId == 995 && + (value.driverID != null && value.driverID.isNotEmpty)); + }); + }); + }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).orderDetail, isShowAppBar: true, @@ -150,7 +157,7 @@ class _OrderDetailsPageState extends State { Text( model.orderListModel[0].shippingAddress.address1 .toString() - .substring(9), + , style: TextStyle( fontSize: 10.0, fontWeight: FontWeight.bold, @@ -167,7 +174,7 @@ class _OrderDetailsPageState extends State { Text( model.orderListModel[0].shippingAddress.address2 .toString() - .substring(9) + + + ' ' + model.orderListModel[0].shippingAddress .country @@ -332,43 +339,18 @@ class _OrderDetailsPageState extends State { itemBuilder: (context, index) { return Container( child: productTile( - productName: model.orderListModel[0] - .orderItems[index].product.name - .toString(), - productPrice: model.orderListModel[0] - .orderItems[index].product.price - .toString(), - productRate: model.orderListModel[0] - .orderItems[index].product.approvedRatingSum - .toDouble(), - productReviews: model - .orderListModel[0] - .orderItems[index] - .product - .approvedTotalReviews, - totalPrice: - "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", - qyt: model.orderListModel[0].orderItems[index] - .quantity - .toString(), + productName: model.orderListModel[0].orderItems[index].product.name.toString(), + productPrice: model.orderListModel[0].orderItems[index].product.price.toString(), + productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum.toDouble(), + productReviews: model.orderListModel[0].orderItems[index].product.approvedTotalReviews, + totalPrice: "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", + qyt: model.orderListModel[0].orderItems[index].quantity.toString(), isOrderDetails: true, - imgs: model.orderListModel[0].orderItems[index] - .product.images != - null && - model - .orderListModel[0] - .orderItems[index] - .product - .images - .length != - 0 - ? model.orderListModel[0].orderItems[index] - .product.images[0].src - .toString() - : null, + imgs: model.orderListModel[0].orderItems[index].product.images != null && + model.orderListModel[0].orderItems[index].product.images.length != 0 + ? model.orderListModel[0].orderItems[index].product.images[0].src.toString() : null, status: model.orderListModel[0].orderStatusId, - product: model.orderListModel[0] - .orderItems[index].product, + product: model.orderListModel[0].orderItems[index].product, ), ); }), diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 9c32b23f..cd5c6ec7 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -115,22 +115,39 @@ class _ProfilePageState extends State { bottom: 10.0, ), child: LargeAvatar( - name: "profile", + name: user.firstName.toString(), url: '', ), ), - Text( - languageID == "ar" - ? user.firstNameN.toString() + - " " + - user.lastNameN.toString() - : user.firstName.toString() + - " " + - user.lastName.toString(), - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold), - ), + Column(children: [ + Row(children: [ + Text( + TranslationBase.of(context) + .welcome, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.grey), + ), + ]), + SizedBox( + height: 10, + ), + Row(children: [ + Text( + languageID == "ar" + ? user.firstNameN.toString() + + " " + + user.lastNameN.toString() + : user.firstName.toString() + + " " + + user.lastName.toString(), + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold), + ), + ]), + ]), ], ), ) @@ -215,8 +232,11 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: WishlistPage())); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + WishlistPage(true))); }, child: Column( children: [ diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index e3e8403e..276151a7 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -88,7 +88,7 @@ class ProductDetailService extends BaseService { "language_id": 1 } }; - await baseAppClient.post(GET_SHOPPING_CART, + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, onSuccess: (dynamic response, int statusCode) { _addToCartModel.clear(); response['shopping_carts'].forEach((item) { @@ -121,7 +121,7 @@ class ProductDetailService extends BaseService { request = { "shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1} }; - await baseAppClient.post(GET_SHOPPING_CART, + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, onSuccess: (dynamic response, int statusCode) { _wishListProducts.clear(); response['shopping_carts'].forEach((item) { @@ -172,6 +172,7 @@ class ProductDetailService extends BaseService { _productSpecification.clear(); response['specification'].forEach((item) { _productSpecification.add(SpecificationModel.fromJson(item)); + print(_productSpecification); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/services/pharmacy_services/recommendedProduct_service.dart b/lib/services/pharmacy_services/recommendedProduct_service.dart new file mode 100644 index 00000000..ad7222f8 --- /dev/null +++ b/lib/services/pharmacy_services/recommendedProduct_service.dart @@ -0,0 +1,40 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; + + + + +class RecommendedProductService extends BaseService{ + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List _recommendedProductList = List(); + List get recommendedList => _recommendedProductList; + String url =""; + + Future getRecommendedProducts(productId) async { + hasError = false; + url =GET_RECOMMENDED_PRODUCT+productId; + await baseAppClient.getPharmacy(url, + onSuccess: (dynamic response, int statusCode) { + _recommendedProductList.clear(); + response['products'].forEach((item) { + _recommendedProductList.add(Products.fromJson(item)); + print("----------------------------------"); + print("Test data"); + print(_recommendedProductList[0]); + print(item['name']); + print(response); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + }} \ No newline at end of file diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 9b52b54d..47c78b79 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1393,13 +1393,10 @@ class TranslationBase { localizedValues["convertBloodSugarStatement"][locale.languageCode]; String get convertFrom => localizedValues["convertFrom"][locale.languageCode]; String get result => localizedValues["result"][locale.languageCode]; - String get bloodSugarConversion => - localizedValues["bloodSugarConversion"][locale.languageCode]; - String get convertCholesterolStatement => - localizedValues["convertCholesterolStatement"][locale.languageCode]; - String get triglyceridesConvertStatement => - localizedValues["triglyceridesConvertStatement"][locale.languageCode]; - + String get sort => localizedValues["sort"][locale.languageCode]; + String get bloodSugarConversion => localizedValues["bloodSugarConversion"][locale.languageCode]; + String get convertCholesterolStatement => localizedValues["convertCholesterolStatement"][locale.languageCode]; + String get triglyceridesConvertStatement => localizedValues["triglyceridesConvertStatement"][locale.languageCode]; String get bloodDEnterDesc => localizedValues["bloodD-enter-desc"][locale.languageCode]; String get viewTermsConditions => diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index bcd74ed1..6619de79 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -172,7 +173,10 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { icon: Icon(Icons.shopping_cart), color: Theme.of(context).textTheme.headline1.color, onPressed: () { - Navigator.of(context).popUntil(ModalRoute.withName('/')); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => CartOrderPage()), + ); }) : Container(), IconButton( diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 23eb0f0e..ee6c1d81 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -66,8 +66,8 @@ class productTile extends StatelessWidget { ) : Container( margin: EdgeInsets.only(left: 10), - child: Image.asset( - "assets/images/no_image.png", + child: Image.network( + productImage, width: 80, height: 80, ) diff --git a/pubspec.yaml b/pubspec.yaml index 4bdf1476..d84fb953 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: #Dependency Injection get_it: ^4.0.2 - + #chart fl_chart: ^0.12.1 @@ -166,10 +166,11 @@ dependencies: after_layout: ^1.0.7 twilio_programmable_video: ^0.5.0+3 cached_network_image: ^2.4.1 - flutter_tts: + flutter_tts: path: flutter_tts-voice_enhancement # flutter_tts: ^1.2.6 sms_otp_auto_verify: ^1.2.2 + wifi: ^0.1.5 vibration: ^1.7.3