From f3b545ff749ad88f3ddfe5e64548304d251c0253 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 29 Aug 2021 09:45:08 +0300 Subject: [PATCH 1/4] fixed products issues --- .../pharmacies/recommendedProduct_model.dart | 621 +++++---- .../pharmacy_module_view_model.dart | 4 +- lib/models/pharmacy/Wishlist.dart | 76 +- lib/pages/pharmacies/product_detail.dart | 74 +- .../screens/recommended-product-page.dart | 1184 ++++++----------- .../recommendedProduct_service.dart | 23 +- 6 files changed, 907 insertions(+), 1075 deletions(-) diff --git a/lib/core/model/pharmacies/recommendedProduct_model.dart b/lib/core/model/pharmacies/recommendedProduct_model.dart index e1e88cd8..ce0d17ee 100644 --- a/lib/core/model/pharmacies/recommendedProduct_model.dart +++ b/lib/core/model/pharmacies/recommendedProduct_model.dart @@ -1,247 +1,251 @@ 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; + dynamic id; bool visibleIndividually; - String name; - String namen; - String shortDescription; - String shortDescriptionn; - String fullDescription; - String fullDescriptionn; + dynamic name; + dynamic namen; + List localizedNames; + dynamic shortDescription; + dynamic shortDescriptionn; + dynamic fullDescription; + dynamic fullDescriptionn; bool markasNew; bool showOnHomePage; - dynamic metaKeywords; - dynamic metaDescription; - dynamic metaTitle; +// dynamic metaKeywords; +// dynamic metaDescription; +// dynamic metaTitle; bool allowCustomerReviews; - dynamic approvedRatingSum; - dynamic notApprovedRatingSum; - dynamic approvedTotalReviews; - dynamic notApprovedTotalReviews; + int approvedRatingSum; + int notApprovedRatingSum; + int approvedTotalReviews; + int notApprovedTotalReviews; String sku; bool isRx; bool prescriptionRequired; - dynamic rxMessage; - dynamic rxMessagen; - dynamic manufacturerPartNumber; - dynamic gtin; +// dynamic rxMessage; +// dynamic rxMessagen; +// dynamic manufacturerPartNumber; +// dynamic gtin; bool isGiftCard; bool requireOtherProducts; bool automaticallyAddRequiredProducts; bool isDownload; bool unlimitedDownloads; - dynamic maxNumberOfDownloads; - dynamic downloadExpirationDays; + int maxNumberOfDownloads; +// dynamic downloadExpirationDays; bool hasSampleDownload; bool hasUserAgreement; bool isRecurring; - dynamic recurringCycleLength; - dynamic recurringTotalCycles; + int recurringCycleLength; + int recurringTotalCycles; bool isRental; - dynamic rentalPriceLength; + int rentalPriceLength; bool isShipEnabled; bool isFreeShipping; bool shipSeparately; - dynamic additionalShippingCharge; + int additionalShippingCharge; bool isTaxExempt; bool isTelecommunicationsOrBroadcastingOrElectronicServices; bool useMultipleWarehouses; - dynamic manageInventoryMethodId; - dynamic stockQuantity; - String stockAvailability; - String stockAvailabilityn; + int manageInventoryMethodId; + int stockQuantity; + dynamic stockAvailability; + dynamic stockAvailabilityn; bool displayStockAvailability; bool displayStockQuantity; - dynamic minStockQuantity; - dynamic notifyAdminForQuantityBelow; + int minStockQuantity; + int notifyAdminForQuantityBelow; bool allowBackInStockSubscriptions; - dynamic orderMinimumQuantity; - dynamic orderMaximumQuantity; - dynamic allowedQuantities; + int orderMinimumQuantity; + int orderMaximumQuantity; +// Null allowedQuantities; bool allowAddingOnlyExistingAttributeCombinations; bool disableBuyButton; bool disableWishlistButton; bool availableForPreOrder; - dynamic preOrderAvailabilityStartDateTimeUtc; +// dynamic preOrderAvailabilityStartDateTimeUtc; bool callForPrice; - dynamic price; - dynamic oldPrice; - dynamic productCost; - dynamic specialPrice; - dynamic specialPriceStartDateTimeUtc; - dynamic specialPriceEndDateTimeUtc; + double price; + int oldPrice; + double productCost; +// dynamic specialPrice; +// dynamic specialPriceStartDateTimeUtc; +// dynamic specialPriceEndDateTimeUtc; bool customerEntersPrice; - dynamic minimumCustomerEnteredPrice; - dynamic maximumCustomerEnteredPrice; + int minimumCustomerEnteredPrice; + int maximumCustomerEnteredPrice; bool basepriceEnabled; - dynamic basepriceAmount; - dynamic basepriceBaseAmount; + int basepriceAmount; + int basepriceBaseAmount; bool hasTierPrices; bool hasDiscountsApplied; - dynamic discountName; - dynamic discountNamen; - dynamic discountDescription; - dynamic discountDescriptionn; - dynamic discountPercentage; - String currency; - String currencyn; +// dynamic discountName; +// dynamic discountNamen; +// dynamic discountDescription; +// dynamic discountDescriptionn; +// dynamic discountPercentage; + dynamic currency; + dynamic currencyn; double weight; - dynamic length; - dynamic width; - dynamic height; - dynamic availableStartDateTimeUtc; - dynamic availableEndDateTimeUtc; - dynamic displayOrder; + int length; + int width; + int height; +// dynamic availableStartDateTimeUtc; +// dynamic availableEndDateTimeUtc; + int displayOrder; bool published; bool deleted; - String createdOnUtc; - String updatedOnUtc; - String productType; - dynamic parentGroupedProductId; - dynamic vendorId; - String seName; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic productType; + int parentGroupedProductId; +// List roleIds; +// List discountIds; +// List storeIds; + List manufacturerIds; +// List reviews; List images; +// List attributes; + List specifications; +// List associatedProductIds; +// List tags; + int vendorId; + dynamic seName; + bool isinwishlist; - 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, - }); + RecommendedProductModel( + {this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + 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.roleIds, +// this.discountIds, +// this.storeIds, + this.manufacturerIds, +// this.reviews, + this.images, +// this.attributes, + this.specifications, +// this.associatedProductIds, +// this.tags, + this.vendorId, + this.seName, + this.isinwishlist}); - Products.fromJson(Map json) { + RecommendedProductModel.fromJson(Map json) { id = json['id']; visibleIndividually = json['visible_individually']; name = json['name']; namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } 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']; +// 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']; @@ -250,18 +254,18 @@ class Products { 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']; +// 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']; + json['automatically_add_required_products']; isDownload = json['is_download']; unlimitedDownloads = json['unlimited_downloads']; maxNumberOfDownloads = json['max_number_of_downloads']; - downloadExpirationDays = json['download_expiration_days']; +// downloadExpirationDays = json['download_expiration_days']; hasSampleDownload = json['has_sample_download']; hasUserAgreement = json['has_user_agreement']; isRecurring = json['is_recurring']; @@ -275,7 +279,7 @@ class Products { additionalShippingCharge = json['additional_shipping_charge']; isTaxExempt = json['is_tax_exempt']; isTelecommunicationsOrBroadcastingOrElectronicServices = - json['is_telecommunications_or_broadcasting_or_electronic_services']; + json['is_telecommunications_or_broadcasting_or_electronic_services']; useMultipleWarehouses = json['use_multiple_warehouses']; manageInventoryMethodId = json['manage_inventory_method_id']; stockQuantity = json['stock_quantity']; @@ -288,21 +292,21 @@ class Products { allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; orderMinimumQuantity = json['order_minimum_quantity']; orderMaximumQuantity = json['order_maximum_quantity']; - allowedQuantities = json['allowed_quantities']; +// allowedQuantities = json['allowed_quantities']; allowAddingOnlyExistingAttributeCombinations = - json['allow_adding_only_existing_attribute_combinations']; + 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']; +// 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']; +// 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']; @@ -311,19 +315,19 @@ class Products { 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']; +// 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']; +// availableStartDateTimeUtc = json['available_start_date_time_utc']; +// availableEndDateTimeUtc = json['available_end_date_time_utc']; displayOrder = json['display_order']; published = json['published']; deleted = json['deleted']; @@ -331,14 +335,64 @@ class Products { 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['role_ids'] != null) { +// roleIds = new List(); +// json['role_ids'].forEach((v) { +// roleIds.add(new Null.fromJson(v)); +// }); +// } +// if (json['discount_ids'] != null) { +// discountIds = new List(); +// json['discount_ids'].forEach((v) { +// discountIds.add(new Null.fromJson(v)); +// }); +// } +// if (json['store_ids'] != null) { +// storeIds = new List(); +// json['store_ids'].forEach((v) { +// storeIds.add(new Null.fromJson(v)); +// }); +// } + manufacturerIds = json['manufacturer_ids'].cast(); +// if (json['reviews'] != null) { +// reviews = new List(); +// json['reviews'].forEach((v) { +// reviews.add(new Null.fromJson(v)); +// }); +// } if (json['images'] != null) { images = new List(); json['images'].forEach((v) { images.add(new Images.fromJson(v)); }); } +// if (json['attributes'] != null) { +// attributes = new List(); +// json['attributes'].forEach((v) { +// attributes.add(new Null.fromJson(v)); +// }); +// } + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } +// if (json['associated_product_ids'] != null) { +// associatedProductIds = new List(); +// json['associated_product_ids'].forEach((v) { +// associatedProductIds.add(new Null.fromJson(v)); +// }); +// } +// if (json['tags'] != null) { +// tags = new List(); +// json['tags'].forEach((v) { +// tags.add(new Null.fromJson(v)); +// }); +// } + vendorId = json['vendor_id']; + seName = json['se_name']; + isinwishlist = json['isinwishlist']; } Map toJson() { @@ -347,15 +401,19 @@ class Products { data['visible_individually'] = this.visibleIndividually; data['name'] = this.name; data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } 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['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; @@ -364,10 +422,10 @@ class Products { 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['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'] = @@ -375,7 +433,7 @@ class Products { data['is_download'] = this.isDownload; data['unlimited_downloads'] = this.unlimitedDownloads; data['max_number_of_downloads'] = this.maxNumberOfDownloads; - data['download_expiration_days'] = this.downloadExpirationDays; +// data['download_expiration_days'] = this.downloadExpirationDays; data['has_sample_download'] = this.hasSampleDownload; data['has_user_agreement'] = this.hasUserAgreement; data['is_recurring'] = this.isRecurring; @@ -403,22 +461,22 @@ class Products { this.allowBackInStockSubscriptions; data['order_minimum_quantity'] = this.orderMinimumQuantity; data['order_maximum_quantity'] = this.orderMaximumQuantity; - data['allowed_quantities'] = this.allowedQuantities; +// 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['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['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; @@ -427,19 +485,19 @@ class Products { 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['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['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; @@ -447,12 +505,58 @@ class Products { 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.roleIds != null) { +// data['role_ids'] = this.roleIds.map((v) => v.toJson()).toList(); +// } +// if (this.discountIds != null) { +// data['discount_ids'] = this.discountIds.map((v) => v.toJson()).toList(); +// } +// if (this.storeIds != null) { +// data['store_ids'] = this.storeIds.map((v) => v.toJson()).toList(); +// } + data['manufacturer_ids'] = this.manufacturerIds; +// if (this.reviews != null) { +// data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); +// } if (this.images != null) { data['images'] = this.images.map((v) => v.toJson()).toList(); } +// if (this.attributes != null) { +// data['attributes'] = this.attributes.map((v) => v.toJson()).toList(); +// } + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } +// if (this.associatedProductIds != null) { +// data['associated_product_ids'] = +// this.associatedProductIds.map((v) => v.toJson()).toList(); +// } +// if (this.tags != null) { +// data['tags'] = this.tags.map((v) => v.toJson()).toList(); +// } + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + data['isinwishlist'] = this.isinwishlist; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; return data; } } @@ -484,3 +588,40 @@ class Images { return data; } } + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index 07a3781d..79f4bad8 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -34,7 +34,7 @@ class PharmacyModuleViewModel extends BaseViewModel { _pharmacyService.lastVisitedProducts; - List get recommendedProductList => + List> get recommendedProductList => _recommendedProductService.recommendedList; List get prescriptionsList => @@ -137,7 +137,7 @@ class PharmacyModuleViewModel extends BaseViewModel { } } - /////////////RecommendedProducts + //////////////////////////////////////////RecommendedProducts getRecommendedProducts(productId) async { hasError = false; setState(ViewState.Busy); diff --git a/lib/models/pharmacy/Wishlist.dart b/lib/models/pharmacy/Wishlist.dart index 41704ede..86e095ec 100644 --- a/lib/models/pharmacy/Wishlist.dart +++ b/lib/models/pharmacy/Wishlist.dart @@ -61,15 +61,15 @@ class Wishlist { productAttributes: List.from(json["product_attributes"].map((x) => x)), customerEnteredPrice: json["customer_entered_price"], quantity: json["quantity"], - discountAmountInclTax: json["discount_amount_incl_tax"], + discountAmountInclTax: json["discount_amount_incl_tax"] != null ? json["discount_amount_incl_tax"] :0.0, subtotal: json["subtotal"], subtotalWithVat: json["subtotal_with_vat"], subtotalVatAmount: json["subtotal_vat_amount"], subtotalVatRate: json["subtotal_vat_rate"], currency: json["currency"], currencyn: json["currencyn"], - rentalStartDateUtc: json["rental_start_date_utc"], - rentalEndDateUtc: json["rental_end_date_utc"], + rentalStartDateUtc: json["rental_start_date_utc"] != null ? DateTime.parse(json["rental_start_date_utc"]) : DateTime.now(), + rentalEndDateUtc: json["rental_end_date_utc"] != null ? DateTime.parse(json["rental_end_date_utc"]) : DateTime.now(), createdOnUtc: DateTime.parse(json["created_on_utc"]), updatedOnUtc: DateTime.parse(json["updated_on_utc"]), shoppingCartType: json["shopping_cart_type"], @@ -172,7 +172,7 @@ class Customer { systemName: json["system_name"], lastIpAddress: json["last_ip_address"], createdOnUtc: DateTime.parse(json["created_on_utc"]), - lastLoginDateUtc: DateTime.parse(json["last_login_date_utc"]), + lastLoginDateUtc: json["last_login_date_utc"] != null ? DateTime.parse(json["last_login_date_utc"]) : DateTime.now(), lastActivityDateUtc: DateTime.parse(json["last_activity_date_utc"]), registeredInStoreId: json["registered_in_store_id"], roleIds: List.from(json["role_ids"].map((x) => x)), @@ -335,9 +335,9 @@ class Product { this.fullDescriptionn, this.markasNew, this.showOnHomePage, - this.metaKeywords, - this.metaDescription, - this.metaTitle, +// this.metaKeywords, +// this.metaDescription, +// this.metaTitle, this.allowCustomerReviews, this.approvedRatingSum, this.notApprovedRatingSum, @@ -348,15 +348,15 @@ class Product { this.prescriptionRequired, this.rxMessage, this.rxMessagen, - this.manufacturerPartNumber, - this.gtin, +// this.manufacturerPartNumber, +// this.gtin, this.isGiftCard, this.requireOtherProducts, this.automaticallyAddRequiredProducts, this.isDownload, this.unlimitedDownloads, this.maxNumberOfDownloads, - this.downloadExpirationDays, +// this.downloadExpirationDays, this.hasSampleDownload, this.hasUserAgreement, this.isRecurring, @@ -382,7 +382,7 @@ class Product { this.allowBackInStockSubscriptions, this.orderMinimumQuantity, this.orderMaximumQuantity, - this.allowedQuantities, +// this.allowedQuantities, this.allowAddingOnlyExistingAttributeCombinations, this.disableBuyButton, this.disableWishlistButton, @@ -448,9 +448,9 @@ class Product { String fullDescriptionn; bool markasNew; bool showOnHomePage; - dynamic metaKeywords; - dynamic metaDescription; - dynamic metaTitle; +// dynamic metaKeywords; +// dynamic metaDescription; +// dynamic metaTitle; bool allowCustomerReviews; dynamic approvedRatingSum; dynamic notApprovedRatingSum; @@ -461,15 +461,15 @@ class Product { bool prescriptionRequired; dynamic rxMessage; dynamic rxMessagen; - dynamic manufacturerPartNumber; - dynamic gtin; +// dynamic manufacturerPartNumber; +// dynamic gtin; bool isGiftCard; bool requireOtherProducts; bool automaticallyAddRequiredProducts; bool isDownload; bool unlimitedDownloads; dynamic maxNumberOfDownloads; - dynamic downloadExpirationDays; +// dynamic downloadExpirationDays; bool hasSampleDownload; bool hasUserAgreement; bool isRecurring; @@ -495,7 +495,7 @@ class Product { bool allowBackInStockSubscriptions; dynamic orderMinimumQuantity; dynamic orderMaximumQuantity; - dynamic allowedQuantities; +// dynamic allowedQuantities; bool allowAddingOnlyExistingAttributeCombinations; bool disableBuyButton; bool disableWishlistButton; @@ -561,9 +561,9 @@ class Product { 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"], +// 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"], @@ -572,17 +572,17 @@ class Product { 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"], + rxMessage: json["rx_message"] != null ? json["rx_message"] : "" , + rxMessagen: json["rx_messagen"] != null ? 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"], +// downloadExpirationDays: json["download_expiration_days"], hasSampleDownload: json["has_sample_download"], hasUserAgreement: json["has_user_agreement"], isRecurring: json["is_recurring"], @@ -608,19 +608,19 @@ class Product { allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], orderMinimumQuantity: json["order_minimum_quantity"], orderMaximumQuantity: json["order_maximum_quantity"], - allowedQuantities: json["allowed_quantities"], +// 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"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"] != null ? DateTime.parse(json["pre_order_availability_start_date_time_utc"]) : DateTime.now(), callForPrice: json["call_for_price"], price: json["price"].toDouble(), oldPrice: json["old_price"], productCost: json["product_cost"].toDouble(), - specialPrice: json["special_price"], - specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], - specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + specialPrice: json["special_price"] != null ? json["special_price"] : 0.0 , + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"] != null ? DateTime.parse(json["special_price_start_date_time_utc"]) : DateTime.now(), + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"] != null ? DateTime.parse(json["special_price_end_date_time_utc"]) : DateTime.now(), customerEntersPrice: json["customer_enters_price"], minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], @@ -675,9 +675,9 @@ class Product { "full_descriptionn": fullDescriptionn, "markas_new": markasNew, "show_on_home_page": showOnHomePage, - "meta_keywords": metaKeywords, - "meta_description": metaDescription, - "meta_title": metaTitle, +// "meta_keywords": metaKeywords, +// "meta_description": metaDescription, +// "meta_title": metaTitle, "allow_customer_reviews": allowCustomerReviews, "approved_rating_sum": approvedRatingSum, "not_approved_rating_sum": notApprovedRatingSum, @@ -688,15 +688,15 @@ class Product { "prescription_required": prescriptionRequired, "rx_message": rxMessage, "rx_messagen": rxMessagen, - "manufacturer_part_number": manufacturerPartNumber, - "gtin": gtin, +// "manufacturer_part_number": manufacturerPartNumber, +// "gtin": gtin, "is_gift_card": isGiftCard, "require_other_products": requireOtherProducts, "automatically_add_required_products": automaticallyAddRequiredProducts, "is_download": isDownload, "unlimited_downloads": unlimitedDownloads, "max_number_of_downloads": maxNumberOfDownloads, - "download_expiration_days": downloadExpirationDays, +// "download_expiration_days": downloadExpirationDays, "has_sample_download": hasSampleDownload, "has_user_agreement": hasUserAgreement, "is_recurring": isRecurring, @@ -722,7 +722,7 @@ class Product { "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, "order_minimum_quantity": orderMinimumQuantity, "order_maximum_quantity": orderMaximumQuantity, - "allowed_quantities": allowedQuantities, +// "allowed_quantities": allowedQuantities, "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, "disable_buy_button": disableBuyButton, "disable_wishlist_button": disableWishlistButton, diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index 72c2bd2d..87c986c0 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -15,7 +15,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; - +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'screens/cart-order-page.dart'; int price = 0; @@ -28,12 +28,15 @@ String itemID; var customerId; CompareList compareItems = new CompareList(); PharmacyProduct specificationData; +//Products recommendedData; class ProductDetailPage extends StatefulWidget { final PharmacyProduct product; +// final Products recommendedProducts; + + ProductDetailPage(this.product, ); - ProductDetailPage(this.product); @override __ProductDetailPageState createState() => __ProductDetailPageState(); @@ -73,6 +76,7 @@ class __ProductDetailPageState extends State { price = 1; specificationData = widget.product; userInfo(); +// recommendedData= widget.recommendedProducts; super.initState(); } @@ -631,10 +635,11 @@ class __ProductDetailPageState extends State { ), SingleChildScrollView( child: Container( + width: 410, color: Colors.white, child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.start, // mainAxisSize: MainAxisSize.min, children: [ Container( @@ -645,7 +650,7 @@ class __ProductDetailPageState extends State { // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), child: BaseView( - onModelReady: (model) => model.getRecommendedProducts(widget.product.id.toString()), + onModelReady: (model) => model.getRecommendedProducts(widget.product.id), builder: (_, model, wi) => Container( child: // Text(model.recommendedProductList[0].id), @@ -664,7 +669,7 @@ class __ProductDetailPageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.recommendedProductList[index]), + page: ProductDetailPage(widget.product.id), )); }, child: Card( @@ -694,26 +699,40 @@ class __ProductDetailPageState extends State { child: Align( alignment: Alignment.topRight, child: IconButton( - icon: Icon(!isInWishlit ? Icons.favorite_border : Icons.favorite), - color: !isInWishlit ? Colors.grey : Colors.red, + icon: Icon(model.recommendedProductList[index]['isinwishlist'] != true ? Icons.favorite_border : Icons.favorite), + color: model.recommendedProductList[index]['isinwishlist'] != true ? Colors.grey : Colors.red, onPressed: () async { - if (customerId != null) { - if (!isInWishlit) { - await addToWishlistFunction(model.recommendedProductList[index].id); + if (customerId != null ) { + if (!isInWishlit && model.recommendedProductList[index]['isinwishlist'] != true) { + GifLoaderDialogUtils.showMyDialog(context); + await addToWishlistFunction(model.recommendedProductList[index]['id']); +// checkWishlist(); + GifLoaderDialogUtils.hideDialog(context); + setState((){ + model.recommendedProductList[index]['isinwishlist'] = true; + }); + } else { - await deleteFromWishlistFunction(model.recommendedProductList[index].id); + GifLoaderDialogUtils.showMyDialog(context); + await deleteFromWishlistFunction(model.recommendedProductList[index]['id']); + GifLoaderDialogUtils.hideDialog(context); + setState((){ + model.recommendedProductList[index]['isinwishlist'] = false; + }); } } else { - return; + return ; } - setState(() {}); + setState(() { + // checkWishlist(); + }); }, )), // child: Align( // alignment: Alignment.topRight, -// child:itemID.contains(model.recommendedProductList[index].id) +// child:itemID.contains(model.recommendedProductList[index]['id']) // // !isInWishlist // ? IconButton( // icon: Icon(Icons.favorite_border), @@ -751,10 +770,10 @@ class __ProductDetailPageState extends State { alignment: Alignment.center, // padding: EdgeInsets.only(left: 25, bottom: 20), - child: (model.recommendedProductList[index].images != null && - model.recommendedProductList[index].images.length > 0) + child: (model.recommendedProductList[index]['images'] != null && + model.recommendedProductList[index]['images'].length > 0) ? Image.network( - model.recommendedProductList[index].images[0].src.toString(), + model.recommendedProductList[index]['images'][0]['src'].toString(), // item.images[0].src, fit: BoxFit.cover, height: 60, @@ -766,7 +785,7 @@ class __ProductDetailPageState extends State { ), ), Container( - width: model.recommendedProductList[index].rxMessage != + width: model.recommendedProductList[index]['rx_message'] != null ? MediaQuery.of(context).size.width / 5 @@ -782,8 +801,8 @@ class __ProductDetailPageState extends State { ), child: Texts( - model.recommendedProductList[index].rxMessage != null - ? model.recommendedProductList[index].rxMessage + model.recommendedProductList[index]['rx_message'] != null + ? model.recommendedProductList[index]['rx_message'] : "", color: Colors.white, @@ -811,8 +830,8 @@ class __ProductDetailPageState extends State { Text( languageID == "ar" - ? model.recommendedProductList[index].namen - : model.recommendedProductList[index].name, + ? model.recommendedProductList[index]['namen'] + : model.recommendedProductList[index]['name'], style: TextStyle( color: @@ -831,7 +850,7 @@ class __ProductDetailPageState extends State { 5), child: Texts( - "SAR ${model.recommendedProductList[index].price}", + "SAR ${model.recommendedProductList[index]['price']}", bold: true, fontSize: @@ -858,7 +877,7 @@ class __ProductDetailPageState extends State { child: RatingBar.readOnly( initialRating: - model.recommendedProductList[index].approvedRatingSum.toDouble(), + model.recommendedProductList[index]['approved_rating_sum'].toDouble(), // initialRating: productRate, size: 13.0, @@ -878,7 +897,7 @@ class __ProductDetailPageState extends State { ), ), Texts( - "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", + "(${model.recommendedProductList[index]['approved_total_reviews'].toString()})", // bold: true, fontSize: 12, @@ -892,7 +911,7 @@ class __ProductDetailPageState extends State { }), ) : Container( -// child: Text("NO DATA"), + child: Text("There is no product"), ), )), ), @@ -2092,6 +2111,7 @@ addToWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlit = true; await x.addToWishlistData(itemID); + } deleteFromWishlistFunction(itemID) async { diff --git a/lib/pages/pharmacies/screens/recommended-product-page.dart b/lib/pages/pharmacies/screens/recommended-product-page.dart index 28abf661..f1c0fb2e 100644 --- a/lib/pages/pharmacies/screens/recommended-product-page.dart +++ b/lib/pages/pharmacies/screens/recommended-product-page.dart @@ -59,781 +59,451 @@ class _RecommendedProductPageState extends State 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, + return Container(); +// 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), +// ), // ), -// ) -// ), -// ), -// 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(), +// 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: 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, +// 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), -// child: Texts( -// "SAR ${model.recommendedProductList[index].price}", -// bold: true, -// fontSize: 14, -// ), -// ), -// Row( -// crossAxisAlignment: -// CrossAxisAlignment.start, -// children: [ -// Container( -// padding: EdgeInsets.only(right: 10), +// ), +// ), +// 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: -// model.recommendedProductList[index].approvedRatingSum.toDouble(), +// 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( -// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +// 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, +// 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, +// ) +// .toList(), // - 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, +// ]) +// : 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), // ), // ), -// Row( -// crossAxisAlignment: -// CrossAxisAlignment.start, -// children: [ +// padding: EdgeInsets.symmetric(horizontal: 5), +// width: MediaQuery.of(context).size.width / 3, +//// +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Stack(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, -// ), -// ), +// 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); +// }); +// }, +// ) +//// +// ), // ), -// Texts( -// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", -//// bold: true, -// fontSize: 12, +// 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, +// ), +// ]), +// ], +// ), +// ), +// ); +// +// }), +// ), +// ]), +// ), +// ), +// ); } checkWishlist() async { ProductDetailViewModel x = new ProductDetailViewModel(); diff --git a/lib/services/pharmacy_services/recommendedProduct_service.dart b/lib/services/pharmacy_services/recommendedProduct_service.dart index f782855f..3b432c02 100644 --- a/lib/services/pharmacy_services/recommendedProduct_service.dart +++ b/lib/services/pharmacy_services/recommendedProduct_service.dart @@ -16,24 +16,25 @@ class RecommendedProductService extends BaseService{ AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - List _recommendedProductList = List(); - List get recommendedList => _recommendedProductList; - String url =""; + List> _recommendedProductList = List(); + List> get recommendedList => _recommendedProductList; + Future getRecommendedProducts(productId) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; - url =GET_RECOMMENDED_PRODUCT+productId; - await baseAppClient.getPharmacy(url, + + await baseAppClient.getPharmacy(GET_RECOMMENDED_PRODUCT+"$productId/$customerId", onSuccess: (dynamic response, int statusCode) { _recommendedProductList.clear(); response['products'].forEach((item) { - _recommendedProductList.add(PharmacyProduct.fromJson(item)); - print("----------------------------------"); - print("Test data"); - print(_recommendedProductList[0]); - print(item['name']); - print(response); + _recommendedProductList.add(item); + }); + print("---------------------Recommended Product List------------------------"); + print(_recommendedProductList.length); + //print(item['name']); + print(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; From e9c26ee85f68156e06f022b2e64538823d0304f5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 29 Aug 2021 15:12:41 +0300 Subject: [PATCH 2/4] Dental procedures implemented --- lib/config/config.dart | 7 +- lib/config/localized_values.dart | 11 +- .../Appointments/DentalProceduresModel.dart | 76 ++++++ .../BookAppointment/DentalComplaints.dart | 218 ++++++++++++++++-- .../doctor_post_pre_images_page.dart | 125 ++++------ .../appointment_services/GetDoctorsList.dart | 28 ++- lib/uitl/translations_delegate_base.dart | 5 +- 7 files changed, 352 insertions(+), 118 deletions(-) create mode 100644 lib/models/Appointments/DentalProceduresModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 40cd68bb..329d4218 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -338,6 +338,9 @@ const GET_PATIENT_HEALTH_STATS = const SEND_CHECK_IN_NFC_REQUEST = 'Services/Patients.svc/REST/Patient_CheckAppointmentValidation_ForNFC'; +const HAS_DENTAL_PLAN = + 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation'; + //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 682c73d9..f445c8b3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -224,7 +224,7 @@ const Map localizedValues = { "companyName": {"en": "Company Name ", "ar": "اسم الشركة: "}, "receiptOn": {"en": "Receipt on: ", "ar": "تاريخ الفاتورة: "}, "expiryDate": {"en": "Expiry Date: ", "ar": "تاريخ الانتهاء: "}, - "procedureName": {"en": "Procedure Name", "ar": "اسم الاجراء"}, + "procedureName": {"en": "Procedure Name:", "ar": "اسم الاجراء:"}, "procedureStatus": {"en": "Procedure Status: ", "ar": "حالة الاجراء"}, "usageStatus": {"en": "Usage Status", "ar": "جالة الاستخدام"}, "unusedCount": {"en": "Unused Count: ", "ar": "غير مستخدم: "}, @@ -423,10 +423,7 @@ const Map localizedValues = { "en": "Please select treatment start day and time to be notified when it\'s time to take the medicine", "ar": " يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" }, - "pleaseSelectAllQuestionToContinue": { - "en": "Please answer all questions to continue...", - "ar": "يرجى الإجابة على جميع الأسئلة للمتابعة..." - }, + "pleaseSelectAllQuestionToContinue": {"en": "Please answer all questions to continue...", "ar": "يرجى الإجابة على جميع الأسئلة للمتابعة..."}, "StartDay": {"en": "Start Day", "ar": "يوم البداية"}, "EndDay": {"en": "End Day", "ar": "يوم الانتهاء"}, "Days": {"en": "Days ", "ar": "أيام"}, @@ -1354,4 +1351,8 @@ const Map localizedValues = { "passport-number": {"en": "Passport Number", "ar": "رقم جواز السفر"}, "enter-passport-number": {"en": "Please confirm or update your passport number:", "ar": "الرجاء تأكيد أو تحديث رقم جواز السفر الخاص بك:"}, "valid-passport-number": {"en": "Please enter valid passport number", "ar": "الرجاء إدخال رقم جواز سفر صالح"}, + "continue-plan": {"en": "Continue with the treatment plan?", "ar": "إكمال الخطة العلاجية؟"}, + "dental-procedure-list": {"en": "Dental Procedures for this Appointment: ", "ar": "إجراءات الأسنان لهذا الموعد:"}, + "time-needed": {"en": "Time Needed:", "ar": "الوقت اللازم:"}, + "total-time-needed": {"en": "Total Appointment Time:", "ar": "وقت المواعيد الكلي:"}, }; diff --git a/lib/models/Appointments/DentalProceduresModel.dart b/lib/models/Appointments/DentalProceduresModel.dart new file mode 100644 index 00000000..a66be8d1 --- /dev/null +++ b/lib/models/Appointments/DentalProceduresModel.dart @@ -0,0 +1,76 @@ +class DentalProceduresModel { + List listIsPatientHasOnGoingEstimation; + + DentalProceduresModel({this.listIsPatientHasOnGoingEstimation}); + + DentalProceduresModel.fromJson(Map json) { + if (json['List_IsPatientHasOnGoingEstimation'] != null) { + listIsPatientHasOnGoingEstimation = + new List(); + json['List_IsPatientHasOnGoingEstimation'].forEach((v) { + listIsPatientHasOnGoingEstimation + .add(new ListIsPatientHasOnGoingEstimation.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listIsPatientHasOnGoingEstimation != null) { + data['List_IsPatientHasOnGoingEstimation'] = this + .listIsPatientHasOnGoingEstimation + .map((v) => v.toJson()) + .toList(); + } + return data; + } +} + +class ListIsPatientHasOnGoingEstimation { + dynamic setupID; + dynamic estimationNo; + int projectID; + String procedureId; + int patientID; + int sequenceNo; + int neededTime; + String procedureName; + dynamic procedureNameN; + + ListIsPatientHasOnGoingEstimation( + {this.setupID, + this.estimationNo, + this.projectID, + this.procedureId, + this.patientID, + this.sequenceNo, + this.neededTime, + this.procedureName, + this.procedureNameN}); + + ListIsPatientHasOnGoingEstimation.fromJson(Map json) { + setupID = json['SetupID']; + estimationNo = json['EstimationNo']; + projectID = json['ProjectID']; + procedureId = json['ProcedureId']; + patientID = json['PatientID']; + sequenceNo = json['sequenceNo']; + neededTime = json['NeededTime']; + procedureName = json['ProcedureName']; + procedureNameN = json['ProcedureNameN']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['EstimationNo'] = this.estimationNo; + data['ProjectID'] = this.projectID; + data['ProcedureId'] = this.procedureId; + data['PatientID'] = this.patientID; + data['sequenceNo'] = this.sequenceNo; + data['NeededTime'] = this.neededTime; + data['ProcedureName'] = this.procedureName; + data['ProcedureNameN'] = this.procedureNameN; + return data; + } +} diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 614189e0..0fbfa624 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -1,11 +1,18 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DentalProceduresModel.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DentalComplaintCard.dart'; -import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -22,12 +29,18 @@ class _DentalComplaintsState extends State { List complaintsList = []; AppSharedPreferences sharedPref = AppSharedPreferences(); bool isDataLoaded = false; + bool hasDentalPlan = false; var languageID; + int totalAppointmentTime = 0; + + List doctorsList = []; + + DentalProceduresModel dentalProceduresModel; + List patientDoctorAppointmentListHospital = List(); @override void initState() { - WidgetsBinding.instance - .addPostFrameCallback((_) => getChiefComplaintsList()); + WidgetsBinding.instance.addPostFrameCallback((_) => checkIfHasDentalPlan()); super.initState(); } @@ -38,37 +51,206 @@ class _DentalComplaintsState extends State { appBarTitle: "Symptoms", body: Container( margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: ListView.builder( - itemCount: complaintsList.length, - itemBuilder: (BuildContext context, int index) { - return Container( - margin: EdgeInsets.only(bottom: 10.0), - child: DentalComplaintCard( - listDentalChiefComplain: complaintsList[index], - languageID: languageID, + child: !hasDentalPlan + ? ListView.builder( + itemCount: complaintsList.length, + itemBuilder: (BuildContext context, int index) { + return Container( + margin: EdgeInsets.only(bottom: 10.0), + child: DentalComplaintCard( + listDentalChiefComplain: complaintsList[index], + languageID: languageID, + ), + ); + }, + ) + : Container( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).dentalProcedureList, textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold, letterSpacing: 0.5)), + ), + Container( + margin: EdgeInsets.only(top: 20.0), + child: Table( + children: getProceduresData(), + ), + ), + ...List.generate( + patientDoctorAppointmentListHospital.length, + (index) => AppExpandableNotifier( + isExpand: true, + title: patientDoctorAppointmentListHospital[index].filterName + " - " + patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList.map((doctor) { + return DoctorView( + doctor: doctor, + isLiveCareAppointment: false, + ); + }).toList(), + )), + ) + ], + ), ), - ); - }, + ), + ), + ); + } + + List getProceduresData() { + List tableRow = []; + + tableRow.add( + TableRow( + children: [ + Container( + child: Container( + child: Center( + child: Text(TranslationBase.of(context).procedureName, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), + ), + ), + ), + Container( + child: Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Center( + child: Text(TranslationBase.of(context).timeNeeded, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), + ), + ), + ), + ], + ), + ); + dentalProceduresModel.listIsPatientHasOnGoingEstimation.forEach((procedure) { + tableRow.add(TableRow(children: [ + Container( + child: Container( + child: Center( + child: Text(procedure.procedureName, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 14.0)), + ), + ), ), + Container( + child: Container( + child: Center( + child: Text(procedure.neededTime.toString() + " mins", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 14.0)), + ), + ), + ), + ])); + }); + tableRow.add( + TableRow( + children: [ + Container( + child: Container( + child: Center( + child: Text(TranslationBase.of(context).totalTimeNeeded, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), + ), + ), + ), + Container( + child: Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Center( + child: Text(totalAppointmentTime.toString() + " mins", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), + ), + ), + ), + ], ), ); + return tableRow; } getLanguageID() async { languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); } + checkIfHasDentalPlan() { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.checkIfHasDentalPlan(widget.searchInfo.ProjectID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + if (res['List_IsPatientHasOnGoingEstimation'].length != 0) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).continuePlan, + okText: TranslationBase.of(context).yes, + cancelText: TranslationBase.of(context).no, + okFunction: () => {Navigator.of(context).pop(), continueDentalPlan()}, + cancelFunction: () => {getChiefComplaintsList()}); + dialog.showAlertDialog(context); + } else { + getChiefComplaintsList(); + } + } + }).catchError((err) { + print(err); + }); + } + + continueDentalPlan() { + DoctorsListService service = new DoctorsListService(); + + GifLoaderDialogUtils.showMyDialog(context); + int appoTime = 0; + service.getDoctorsList(int.parse("17"), widget.searchInfo.ProjectID, false, context, isContinueDentalPlan: true).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + print(res['List_IsPatientHasOnGoingEstimation']); + dentalProceduresModel = DentalProceduresModel.fromJson(res); + dentalProceduresModel.listIsPatientHasOnGoingEstimation.forEach((procedure) { + appoTime += procedure.neededTime; + }); + setState(() { + hasDentalPlan = true; + totalAppointmentTime = appoTime; + }); + + if (res['DoctorList'].length != 0) { + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + patientDoctorAppointmentListHospital[patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + } + }); + } else {} + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + getChiefComplaintsList() { GifLoaderDialogUtils.showMyDialog(context); getLanguageID(); ClinicListService service = new ClinicListService(); - service - .getChiefComplaintsList( - widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context) - .then((res) { + service.getChiefComplaintsList(widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - print(res['List_DentalChiefComplain']); setState(() { res['List_DentalChiefComplain'].forEach((v) { complaintsList.add(new ListDentalChiefComplain.fromJson(v)); diff --git a/lib/pages/BookAppointment/doctor_post_pre_images_page.dart b/lib/pages/BookAppointment/doctor_post_pre_images_page.dart index b97d58ac..85e37308 100644 --- a/lib/pages/BookAppointment/doctor_post_pre_images_page.dart +++ b/lib/pages/BookAppointment/doctor_post_pre_images_page.dart @@ -1,67 +1,10 @@ -import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class DoctorPostPreImagesPage extends StatefulWidget{ - final DoctorPrePostImages doctorPrePostImages; - - const DoctorPostPreImagesPage({this.doctorPrePostImages}); - - @override - State createState() => DoctorPostPreImagesPageState(); -} - -class DoctorPostPreImagesPageState extends State{ - - @override - Widget build(BuildContext context) { - var images = widget.doctorPrePostImages; - return AppScaffold( - appBarTitle: TranslationBase.of(context).beforeAfterImages, - isShowAppBar: true, - isShowDecPage: false, - body: Padding( - padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10), - child: Row( - children: [ - Expanded( - child: Column( - children: [ - Text("Before Image", style: TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),), - Image.memory(images.getPreBytes(), errorBuilder: (ctx,err, trace){ - return Container( - color: Colors.grey.withOpacity(0.25), - ); - },) - ], - ) - ), - Divider(color: Colors.grey.withOpacity(0.5)), - Expanded( - child: Column( - children: [ - Text("After Image", style: TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),), - Image.memory(images.getPostBytes(),errorBuilder: (ctx,err, trace){ - return Container( - color: Colors.grey.withOpacity(0.25), - ); - },) - ], - ) - ) - ], - ), - ) - ); - } - -} - - -class DoctorPostPreImagesContent extends StatefulWidget{ +class DoctorPostPreImagesContent extends StatefulWidget { final DoctorPrePostImages doctorPrePostImages; const DoctorPostPreImagesContent({this.doctorPrePostImages}); @@ -70,14 +13,13 @@ class DoctorPostPreImagesContent extends StatefulWidget{ DoctorPostPreImagesContentState createState() => DoctorPostPreImagesContentState(); } -class DoctorPostPreImagesContentState extends State{ - +class DoctorPostPreImagesContentState extends State { @override Widget build(BuildContext context) { var images = widget.doctorPrePostImages; - return Material( - color: Colors.transparent, - child: Center( + return Center( + child: Material( + color: Colors.transparent, child: Column( mainAxisSize: MainAxisSize.min, children: [ @@ -85,31 +27,45 @@ class DoctorPostPreImagesContentState extends State{ children: [ Expanded( child: Column( - children: [ - Text("Before", style: TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),), - SizedBox(height: 10,), - Image.memory(images.getPreBytes(), errorBuilder: (ctx,err, trace){ - return Container( - color: Colors.grey.withOpacity(0.25), - ); - },) - ], + children: [ + Text( + "Before", + style: TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1), + ), + SizedBox( + height: 10, + ), + Image.memory( + images.getPreBytes(), + errorBuilder: (ctx, err, trace) { + return Container( + color: Colors.grey.withOpacity(0.25), + ); + }, ) - ), + ], + )), Divider(color: Colors.grey.withOpacity(0.5)), Expanded( child: Column( - children: [ - Text("After", style: TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1),), - SizedBox(height: 10,), - Image.memory(images.getPostBytes(),errorBuilder: (ctx,err, trace){ - return Container( - color: Colors.grey.withOpacity(0.25), - ); - },) - ], + children: [ + Text( + "After", + style: TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, letterSpacing: 1), + ), + SizedBox( + height: 10, + ), + Image.memory( + images.getPostBytes(), + errorBuilder: (ctx, err, trace) { + return Container( + color: Colors.grey.withOpacity(0.25), + ); + }, ) - ) + ], + )) ], ), ], @@ -117,5 +73,4 @@ class DoctorPostPreImagesContentState extends State{ ), ); } - -} \ No newline at end of file +} diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index c691123e..888efd30 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -30,7 +30,7 @@ class DoctorsListService extends BaseService { Future getDoctorsList( int clinicID, int projectID, bool isNearest, BuildContext context, - {doctorId, doctorName}) async { + {doctorId, doctorName, isContinueDentalPlan = false}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -61,20 +61,18 @@ class DoctorsListService extends BaseService { "ClinicID": clinicID, "ProjectID": projectID, "DoctorName": doctorName, //!= null ? doctorId : 0, - "ContinueDentalPlan": false, - "IsSearchAppointmnetByClinicID": true, + "ContinueDentalPlan": isContinueDentalPlan, + "IsSearchAppointmnetByClinicID": isContinueDentalPlan ? false : true, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - // "Latitude": 0, - // "Longitude": 0, - // "License": true, "SearchForVoiceCommand": doctorId != null && doctorId.length > 0 ? true : false, "DoctorIDsList": doctorId, "Latitude": lat != null ? lat.toString() : 0, "Longitude": long != null ? long.toString() : 0, + "isDentalAllowedBackend": isContinueDentalPlan, "IsGetNearAppointment": isNearest, if (isNearest) "SelectedDate": DateUtil.convertDateToString(DateTime.now()), @@ -1483,7 +1481,6 @@ class DoctorsListService extends BaseService { int projectId, BuildContext context) async { Map request; - Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appointmentNo, "NFC_Code": nfcCode, @@ -1498,4 +1495,21 @@ class DoctorsListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future checkIfHasDentalPlan(int projectID, BuildContext context) async { + Map request; + + request = { + "ProjectID": projectID, + }; + dynamic localRes; + await baseAppClient.post(HAS_DENTAL_PLAN, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index cd7a1c7d..7ead312a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1223,7 +1223,10 @@ class TranslationBase { String get passportNumber => localizedValues["passport-number"][locale.languageCode]; String get enterPassportNumber => localizedValues["enter-passport-number"][locale.languageCode]; String get validPassportNumber => localizedValues["valid-passport-number"][locale.languageCode]; - + String get continuePlan => localizedValues["continue-plan"][locale.languageCode]; + String get dentalProcedureList => localizedValues["dental-procedure-list"][locale.languageCode]; + String get timeNeeded => localizedValues["time-needed"][locale.languageCode]; + String get totalTimeNeeded => localizedValues["total-time-needed"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From a2e60e7584d5058f00367eb8659f51a750727e26 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 29 Aug 2021 16:10:01 +0300 Subject: [PATCH 3/4] fix bugs pharmacy --- lib/config/config.dart | 7 ++++--- lib/core/service/parmacyModule/parmacy_module_service.dart | 2 +- lib/core/service/parmacyModule/prescription_service.dart | 2 -- .../pharmacyModule/pharmacy_module_view_model.dart | 1 + lib/pages/login/login.dart | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 40cd68bb..b35e4b3d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -505,7 +505,8 @@ const GET_DOCTOR_LIST_BY_TIME = "Services/Doctors.svc/REST/SearchDoctorsByTime"; const PHARMACY_AUTORZIE_CUSTOMER = "AutorizeCustomer"; const PHARMACY_VERIFY_CUSTOMER = "VerifyCustomer"; const PHARMACY_GET_COUNTRY = "countries"; -const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer"; +// const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer"; +const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/getorcreateCustomer"; const GET_PHARMACY_BANNER = "promotionbanners"; const GET_PHARMACY_TOP_MANUFACTURER = "topmanufacturer"; const GET_PHARMACY_BEST_SELLER_PRODUCT = "bestsellerproducts"; diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 7fa095ca..72bc56c7 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; class PharmacyModuleService extends BaseService { final AppSharedPreferences sharedPref = AppSharedPreferences(); bool isFinished = true; - bool hasError = false; String errorMsg = ''; String url = ""; @@ -114,6 +113,7 @@ class PharmacyModuleService extends BaseService { } Future getTopManufacturerList() async { + hasError = false; Map queryParams = {'page': '1', 'limit': '8'}; try { await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index c2312890..d81c125d 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -45,8 +45,6 @@ class PrescriptionService extends BaseService { _prescriptionsList.add(Prescriptions.fromJson(prescriptions)); }); print(_prescriptionsList.length); - print("response is -------------"+response); - print(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index 07a3781d..ecf3e37f 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -74,6 +74,7 @@ class PharmacyModuleViewModel extends BaseViewModel { setState(ViewState.Idle); } } + Future generatePharmacyToken() async { setState(ViewState.Busy); await _pharmacyService.generatePharmacyToken(); diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 230e5984..448238fd 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -66,8 +66,8 @@ class _Login extends State { super.initState(); if(BASE_URL.contains("uat.")){ - nationalIDorFile.text = "1231755"; - mobileNumberController.text = mobileNo = "537503378"; + nationalIDorFile.text = "2001273"; + mobileNumberController.text = mobileNo = "0555416043"; } } From 2e2f7334d5feb695ab134cd4d6dfe377cc423407 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 30 Aug 2021 16:24:00 +0300 Subject: [PATCH 4/4] fix issues PAP-910,PAP-911 --- .../NewCMC/cmc_location_page.dart | 6 +++- .../NewCMC/new_cmc_step_tow_page.dart | 34 ++++++++++++++----- .../NewHomeHealthCare/location_page.dart | 6 +++- .../new_Home_health_care_step_tow_page.dart | 29 ++++++++++++---- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index 72aa40dc..d7bb61ed 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -33,11 +33,15 @@ class CMCLocationPage extends StatefulWidget { class _CMCLocationPageState extends State { double latitude = 0; double longitude = 0; + bool showCurrentLocation = false; @override void initState() { latitude = widget.latitude; longitude = widget.longitude; + if(latitude == 0.0 && longitude == 0.0) { + showCurrentLocation = true; + } super.initState(); } @@ -149,7 +153,7 @@ class _CMCLocationPageState extends State { ); }, initialPosition: LatLng(latitude, longitude), - useCurrentLocation: false, + useCurrentLocation: showCurrentLocation, ), )); } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 3d969d9e..12e1b622 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/Comprehens import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -44,6 +45,7 @@ class _NewCMCStepTowPageState extends State { double latitude = 0; double longitude = 0; AddressInfo _selectedAddress; + bool showCurrentLocation = false; @override void initState() { @@ -56,14 +58,26 @@ class _NewCMCStepTowPageState extends State { super.initState(); } - setLatitudeAndLongitude({bool isSetState = false, String latLong}) { - if (latLong == null) - latLong = widget - .model.addressesList[widget.model.addressesList.length - 1].latLong; - List latLongArr = latLong.split(','); + setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { + if (latLong == null){ + if(widget.model.addressesList.isEmpty) { - latitude = double.parse(latLongArr[0]); - longitude = double.parse(latLongArr[1]); + setState(() { + showCurrentLocation = true; + }); + } else { + latLong = widget + .model.addressesList[widget.model.addressesList.length - 1].latLong; + } + + } + + if(!showCurrentLocation) { + List latLongArr = latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + } } @override @@ -144,9 +158,11 @@ class _NewCMCStepTowPageState extends State { ); }, initialPosition: LatLng(latitude, longitude), - useCurrentLocation: false, + useCurrentLocation: showCurrentLocation, ), - Container( + if(widget.model.addressesList.isNotEmpty) + + Container( child: InkWell( onTap: () => confirmSelectLocationDialog(widget.model.addressesList), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index c87a3eb5..0e013ebf 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -33,12 +33,16 @@ class _LocationPageState extends State { double latitude = 0; double longitude = 0; + bool showCurrentLocation = false; @override void initState() { latitude = widget.latitude; longitude = widget.longitude; + if(latitude == 0.0 && longitude == 0.0) { + showCurrentLocation = true; + } super.initState(); } @@ -141,7 +145,7 @@ class _LocationPageState ); }, initialPosition: LatLng(latitude, longitude), - useCurrentLocation: false, + useCurrentLocation: showCurrentLocation, ), )); } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index e9ddd2d1..1b96cdc8 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -46,6 +46,8 @@ class _NewHomeHealthCareStepTowPageState double latitude = 0; double longitude = 0; AddressInfo _selectedAddress; + bool showCurrentLocation = false; + @override void initState() { @@ -60,13 +62,25 @@ class _NewHomeHealthCareStepTowPageState } setLatitudeAndLongitude({bool isSetState = false, String latLong}) { - if (latLong == null) - latLong = widget.model.addressesList[widget.model.addressesList - .length - 1].latLong; - List latLongArr = latLong.split(','); + if (latLong == null){ + if(widget.model.addressesList.isEmpty) { + setState(() { + showCurrentLocation = true; + }); + } else { + latLong = widget.model.addressesList[widget.model.addressesList + .length - 1].latLong; + } + + } + + if(!showCurrentLocation) { + List latLongArr = latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + } - latitude = double.parse(latLongArr[0]); - longitude = double.parse(latLongArr[1]); } @override @@ -147,8 +161,9 @@ class _NewHomeHealthCareStepTowPageState ); }, initialPosition: LatLng(latitude, longitude), - useCurrentLocation: false, + useCurrentLocation: showCurrentLocation, ), + if(widget.model.addressesList.isNotEmpty) Container( child: InkWell( onTap: () =>