diff --git a/android/app/build.gradle b/android/app/build.gradle index 9640ea61..bfba384a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -65,6 +65,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "com.google.firebase:firebase-messaging:20.1.0" implementation 'pub.devrel:easypermissions:0.4.0' + implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' } diff --git a/lib/config/config.dart b/lib/config/config.dart index a3ce19e9..48695fc1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; @@ -57,9 +57,12 @@ const GET_NEAREST_HOSPITAL = 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; ///Er Nearest -const GET_AMBULANCE_REQUEST = 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; -const GET_PATIENT_ALL_PRES_ORDERS= 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID= 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; +const GET_AMBULANCE_REQUEST = + 'Services/Patients.svc/REST/PatientER_RRT_GetAllTransportationMethod'; +const GET_PATIENT_ALL_PRES_ORDERS = + 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID = + 'Services/Patients.svc/REST/PatientER_RRT_GetPickUpRequestByPresOrderID'; ///FindUs const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; @@ -139,7 +142,8 @@ const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; //URL to get patient appointment history -const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; +const GET_PATIENT_APPOINTMENT_HISTORY = + "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; //URL to get patient appointment curfew history const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = @@ -262,13 +266,14 @@ const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; +const GET_COVID_DRIVETHRU_PROJECT_LIST = + 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; -const GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; - -const GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; - -const GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; +const GET_COVID_DRIVETHRU_PAYMENT_INFO = + 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; +const GET_COVID_DRIVETHRU_FREE_SLOTS = + 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; ///My Trackers const GET_DIABETIC_RESULT_AVERAGE = @@ -323,6 +328,12 @@ const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; +//Pharmacy + +const GET_PHARMACY_CATEGORISE = + 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; +const GET_OFFERS_CATEGORISE = 'epharmacy/api/discountcategories'; +const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/12'; const TIMER_MIN = 10; diff --git a/lib/core/model/pharmacy/offer_products_model.dart b/lib/core/model/pharmacy/offer_products_model.dart new file mode 100644 index 00000000..f41b731b --- /dev/null +++ b/lib/core/model/pharmacy/offer_products_model.dart @@ -0,0 +1,579 @@ +class OfferProductsModel { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + String discountName; + String discountNamen; + String discountDescription; + String discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + dynamic weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + OfferProductsModel( + {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}); + + OfferProductsModel.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']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + + discountIds = json['discount_ids'].cast(); + + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + 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['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v.toJson()).toList(); + } + data['discount_ids'] = this.discountIds; + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v.toJson()).toList(); + } + if (this.manufacturerIds != null) { + data['manufacturer_ids'] = + this.manufacturerIds.map((v) => v.toJson()).toList(); + } + 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; + 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; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +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; + } +} diff --git a/lib/core/model/pharmacy/offers_model.dart b/lib/core/model/pharmacy/offers_model.dart new file mode 100644 index 00000000..3add1d3d --- /dev/null +++ b/lib/core/model/pharmacy/offers_model.dart @@ -0,0 +1,175 @@ +class OffersModel { + String id; + String name; + String namen; + List localizedNames; + Null description; + int categoryTemplateId; + String metaKeywords; + String metaDescription; + String metaTitle; + int parentCategoryId; + int pageSize; + String pageSizeOptions; + Null priceRanges; + bool showOnHomePage; + bool includeInTopMenu; + Null hasDiscountsApplied; + bool published; + bool deleted; + int displayOrder; + String createdOnUtc; + String updatedOnUtc; + List roleIds; + List discountIds; + List storeIds; + Image image; + String seName; + bool isLeaf; + + OffersModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.categoryTemplateId, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.parentCategoryId, + this.pageSize, + this.pageSizeOptions, + this.priceRanges, + this.showOnHomePage, + this.includeInTopMenu, + this.hasDiscountsApplied, + this.published, + this.deleted, + this.displayOrder, + this.createdOnUtc, + this.updatedOnUtc, + this.roleIds, + this.discountIds, + this.storeIds, + this.image, + this.seName, + this.isLeaf}); + + OffersModel.fromJson(Map json) { + id = json['id']; + 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)); + }); + } + description = json['description']; + categoryTemplateId = json['category_template_id']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + parentCategoryId = json['parent_category_id']; + pageSize = json['page_size']; + pageSizeOptions = json['page_size_options']; + priceRanges = json['price_ranges']; + showOnHomePage = json['show_on_home_page']; + includeInTopMenu = json['include_in_top_menu']; + hasDiscountsApplied = json['has_discounts_applied']; + published = json['published']; + deleted = json['deleted']; + displayOrder = json['display_order']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + + image = json['image'] != null ? new Image.fromJson(json['image']) : null; + seName = json['se_name']; + isLeaf = json['is_leaf']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['category_template_id'] = this.categoryTemplateId; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['parent_category_id'] = this.parentCategoryId; + data['page_size'] = this.pageSize; + data['page_size_options'] = this.pageSizeOptions; + data['price_ranges'] = this.priceRanges; + data['show_on_home_page'] = this.showOnHomePage; + data['include_in_top_menu'] = this.includeInTopMenu; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['display_order'] = this.displayOrder; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + 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(); + } + if (this.image != null) { + data['image'] = this.image.toJson(); + } + data['se_name'] = this.seName; + data['is_leaf'] = this.isLeaf; + 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; + } +} + +class Image { + String src; + Null thumb; + Null attachment; + + Image({this.src, this.thumb, this.attachment}); + + Image.fromJson(Map json) { + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacy/pharmacy_categorise.dart b/lib/core/model/pharmacy/pharmacy_categorise.dart new file mode 100644 index 00000000..33ac26f1 --- /dev/null +++ b/lib/core/model/pharmacy/pharmacy_categorise.dart @@ -0,0 +1,103 @@ +class PharmacyCategorise { + dynamic id; + String name; + dynamic namen; + List localizedNames; + dynamic description; + dynamic parentCategoryId; + dynamic displayOrder; + dynamic image; + dynamic isLeaf; + + PharmacyCategorise( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.parentCategoryId, + this.displayOrder, + this.image, + this.isLeaf}); + + PharmacyCategorise.fromJson(Map json) { + try { + id = json['id']; + 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)); + }); + } + description = json['description']; + parentCategoryId = json['parent_category_id']; + displayOrder = json['display_order']; + image = json['image'] != null ? new Image.fromJson(json['image']) : null; + isLeaf = json['is_leaf']; + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['parent_category_id'] = this.parentCategoryId; + data['display_order'] = this.displayOrder; + if (this.image != null) { + data['image'] = this.image.toJson(); + } + data['is_leaf'] = this.isLeaf; + 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; + } +} + +class Image { + String src; + Null thumb; + Null attachment; + + Image({this.src, this.thumb, this.attachment}); + + Image.fromJson(Map json) { + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 237245f8..e1f69dba 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -77,7 +77,7 @@ class BaseAppClient { body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; - body['SessionID'] = SESSION_ID;//getSessionId(token); + body['SessionID'] = SESSION_ID; //getSessionId(token); } } @@ -138,6 +138,32 @@ class BaseAppClient { } } + get(String endPoint, + {Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + bool isAllowAny = false}) async { + String url = BASE_URL + endPoint; + print("URL : $url"); + + if (await Utils.checkConnection()) { + final response = await http.get(url.trim(), headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }); + final int statusCode = response.statusCode; + print("statusCode :$statusCode"); + + if (statusCode < 200 || statusCode >= 400 || json == null) { + onFailure('Error While Fetching data', statusCode); + } else { + var parsed = json.decode(response.body.toString()); + onSuccess(parsed, statusCode); + } + } else { + onFailure('Please Check The Internet Connection', -1); + } + } + logout() async { await sharedPref.remove(LOGIN_TOKEN_ID); Navigator.of(AppGlobal.context).pushReplacementNamed(LOGIN_TYPE); diff --git a/lib/core/service/offers_service.dart b/lib/core/service/offers_service.dart new file mode 100644 index 00000000..ebcbd9a2 --- /dev/null +++ b/lib/core/service/offers_service.dart @@ -0,0 +1,46 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offer_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offers_model.dart'; + +import 'base_service.dart'; + +class OffersCategoriseService extends BaseService { + List _offersList = List(); + List get offersList => _offersList; + List _offerProducts = List(); + List get offersProducts => _offerProducts; + + Future getOffersCategorise() async { + hasError = false; + _offersList.clear(); + await baseAppClient.get( + GET_OFFERS_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _offersList.add(OffersModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getOffersProducts() async { + hasError = false; + _offerProducts.clear(); + await baseAppClient.get( + GET_OFFERS_PRODUCTS, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _offerProducts.add(OfferProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } +} diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart new file mode 100644 index 00000000..676f900b --- /dev/null +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; + +import 'base_service.dart'; + +class PharmacyCategoriseService extends BaseService { + List _categoriseList = List(); + List get categoriseList => _categoriseList; + + Future getCategorise() async { + hasError = false; + _categoriseList.clear(); + await baseAppClient.get( + GET_PHARMACY_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _categoriseList.add(PharmacyCategorise.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } +} diff --git a/lib/core/viewModels/offers_Categorise_view_model.dart b/lib/core/viewModels/offers_Categorise_view_model.dart new file mode 100644 index 00000000..3bb67ab7 --- /dev/null +++ b/lib/core/viewModels/offers_Categorise_view_model.dart @@ -0,0 +1,48 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offer_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offers_model.dart'; +import 'package:diplomaticquarterapp/core/service/offers_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +import 'base_view_model.dart'; + +class OffersCategoriseViewModel extends BaseViewModel { + bool hasError = false; + + OffersCategoriseService _offersCategoriseService = + locator(); + List get categorise => _offersCategoriseService.offersList; + + List get products => + _offersCategoriseService.offersProducts; + + Future getOffersCategorise() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _offersCategoriseService.getOffersCategorise(); + if (_offersCategoriseService.hasError) { + error = _offersCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + await getOffersProducts(); + } + + Future getOffersProducts() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + // setState(ViewState.Busy); + await _offersCategoriseService.getOffersProducts(); + if (_offersCategoriseService.hasError) { + error = _offersCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} +// await _offersCategoriseService.getOffersProducts(); +// if (_offersCategoriseService.hasError) { +// error = _offersCategoriseService.error; +// setState(ViewState.ErrorLocal); +// } else +// setState(ViewState.Idle); diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart new file mode 100644 index 00000000..62b658aa --- /dev/null +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +import 'base_view_model.dart'; + +class PharmacyCategoriseViewModel extends BaseViewModel { + bool hasError = false; + PharmacyCategoriseService _pharmacyCategoriseService = + locator(); + List get categorise => + _pharmacyCategoriseService.categoriseList; + + Future getCategorise() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getCategorise(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index e6140ce1..a23cc0e2 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -39,6 +39,8 @@ import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; import 'core/service/medical/reports_monthly_service.dart'; import 'core/service/medical/vital_sign_service.dart'; +import 'core/service/offers_service.dart'; +import 'core/service/pharmacy_categorise_service.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; import 'core/viewModels/blooddonation/blood_details_view_model.dart'; @@ -70,10 +72,12 @@ import 'core/viewModels/medical/reports_monthly_view_model.dart'; import 'core/viewModels/medical/vital_sign_view_model.dart'; import 'core/viewModels/medical/reports_view_model.dart'; import 'core/viewModels/medical/weight_pressure_view_model.dart'; +import 'core/viewModels/offers_Categorise_view_model.dart'; import 'core/viewModels/pharmacies_view_model.dart'; import 'core/service/pharmacies_service.dart'; import 'core/service/insurance_service.dart'; import 'core/viewModels/insurance_card_View_model.dart'; +import 'core/viewModels/pharmacy_categorise_view_model.dart'; import 'core/viewModels/qr_view_model.dart'; import 'core/viewModels/vaccine_view_model.dart'; import 'core/service/vaccine_service.dart'; @@ -105,7 +109,6 @@ void setupLocator() { locator.registerLazySingleton(() => AmService()); locator.registerLazySingleton(() => EReferralService()); - locator.registerLazySingleton(() => PatientSickLeaveService()); locator.registerLazySingleton(() => MyBalanceService()); locator.registerLazySingleton(() => BloodSugarService()); @@ -126,10 +129,11 @@ void setupLocator() { locator.registerLazySingleton(() => CreteNewBabyService()); locator.registerLazySingleton(() => DeleteBabyService()); - - locator.registerLazySingleton(() => VaccinationTableService()); + //pharmacy + locator.registerLazySingleton(() => PharmacyCategoriseService()); + locator.registerLazySingleton(() => OffersCategoriseService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -161,8 +165,6 @@ void setupLocator() { locator.registerFactory(() => UserInformationViewModel()); locator.registerFactory(() => VaccinationTableViewModel()); - - locator.registerFactory(() => AddNewChildViewModel()); locator.registerFactory(() => H2OViewModel()); @@ -173,4 +175,8 @@ void setupLocator() { locator.registerFactory(() => ActiveMedicationsViewModel()); locator.registerFactory(() => AskDoctorViewModel()); locator.registerFactory(() => AllergiesViewModel()); + + //pharmacy + locator.registerFactory(() => PharmacyCategoriseViewModel()); + locator.registerFactory(() => OffersCategoriseViewModel()); } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index cafd1f06..108e9b52 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -19,6 +19,8 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'landing_page_pharmcy.dart'; + class HomePage extends StatefulWidget { final Function goToMyProfile; @@ -95,7 +97,9 @@ class _HomePageState extends State { children: [ Container( margin: EdgeInsets.only( - top: 15.0, left: 3.5, right: 3.5), + top: 15.0, + left: 3.5, + right: 3.5), // child: SvgPicture.asset( // 'assets/images/new-design/covid-19-car.svg', // width: 45.0, @@ -494,6 +498,8 @@ class _HomePageState extends State { ), height: MediaQuery.of(context).size.width * 0.4, imageName: 'al-habib_onlne_pharmacy_bg.png', + onTap: () => Navigator.push( + context, FadePage(page: LandingPagePharmacy())), ), DashboardItem( child: Center( diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart new file mode 100644 index 00000000..37b52f6e --- /dev/null +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -0,0 +1,152 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; +import 'package:flutter/material.dart'; + +import '../offers_categorise_page.dart'; + +class LandingPagePharmacy extends StatefulWidget { + @override + _LandingPagePharmacyState createState() => _LandingPagePharmacyState(); +} + +class _LandingPagePharmacyState extends State { + int currentTab = 0; + PageController pageController; + ProjectViewModel projectProvider; + + _changeCurrentTab(int tab) { + setState(() { + currentTab = tab; + pageController.jumpToPage(tab); + }); + } + + void initState() { + super.initState(); + pageController = PageController(keepPage: true); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: currentTab == 0 || currentTab == 1 + ? AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + title: Container( + height: 30, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 16.0), + SizedBox( + width: 5.0, + ), + Text( + 'Search your Medicine', + style: TextStyle( + fontSize: 13.0, fontWeight: FontWeight.w300), + ) + ], + ), + ), + ), + ), + leading: Builder( + builder: (BuildContext context) { + return Container( + height: 2.0, + width: 10.0, + child: Image.asset( + 'assets/images/pharmacy_logo.png', + ), + ); + }, + ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], + centerTitle: true, + ) + : AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(getText(currentTab).toUpperCase()), + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back), + color: Colors.white, + onPressed: () => Scaffold.of(context).openDrawer(), + ); + }, + ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], + centerTitle: true, + ), + extendBody: true, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + Container( + child: Text('text'), + ), + PharmacyCategorisePage(), + OffersCategorisePage(), + Container( + child: Center(child: Text('This Is My Account Page')), + ), + Container( + child: Center(child: Text('This Is Cart Page')), + ), + ], // Please do not remove the BookingOptions from this array + ), + bottomNavigationBar: BottomNavPharmacyBar( + changeIndex: _changeCurrentTab, + index: currentTab, + ), + ); + } + + getText(currentTab) { + switch (currentTab) { + case 2: + return 'Wishlist'; + case 3: + return 'My Account'; + case 4: + return 'Shopping Cart'; + } + } +} diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart new file mode 100644 index 00000000..94130fa3 --- /dev/null +++ b/lib/pages/offers_categorise_page.dart @@ -0,0 +1,170 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/offers_Categorise_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +import 'base/base_view.dart'; + +class OffersCategorisePage extends StatefulWidget { + @override + _OffersCategorisePageState createState() => _OffersCategorisePageState(); +} + +class _OffersCategorisePageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getOffersCategorise(), + builder: (BuildContext context, OffersCategoriseViewModel model, + Widget child) => + AppScaffold( + isShowDecPage: false, + baseViewModel: model, + body: Container( + height: MediaQuery.of(context).size.height * 0.58, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts('Categories'), + ), + ), + Divider( + thickness: 2.0, + color: Colors.grey.shade400, + ), + Expanded( + child: Container( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categorise.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + InkWell( + child: Column( + children: [ + Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.orange.shade200 + .withOpacity(0.45), + ), + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.2, + height: MediaQuery.of(context) + .size + .height * + 0.08, + child: Center( + child: Texts(model + .categorise[index].name), + ), + ), + ], + ), + onTap: () { + model.getOffersProducts(); + }), + ], + ), + ); + }), + ), + ), + Divider( + thickness: 2.0, + color: Colors.grey.shade400, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('Parsonal Care'), + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.5, + //width: 0.3, + // indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ), + ), + ], + ), + ], + ), + Divider( + thickness: 2.0, + color: Colors.grey.shade400, + ), + Expanded( + child: Container( + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.2, + mainAxisSpacing: 7.0, + childAspectRatio: 3.2, + ), + itemCount: model.products.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(4.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1), + color: Colors.grey.withOpacity(0.24), + ), + child: Column( + children: [ + Container( + child: Image.network(model + .products[index].images.isNotEmpty + ? model + .products[index].images[0].thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png'), + ), + ], + ), + ), + ); + }, + ), + ), + ), + ], + ), + ), + )); + } +} +// diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart new file mode 100644 index 00000000..04e1c105 --- /dev/null +++ b/lib/pages/pharmacy_categorise.dart @@ -0,0 +1,139 @@ +import 'package:charts_flutter/flutter.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +import 'base/base_view.dart'; + +class PharmacyCategorisePage extends StatefulWidget { + @override + _PharmacyCategorisePageState createState() => _PharmacyCategorisePageState(); +} + +class _PharmacyCategorisePageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getCategorise(), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( + isShowDecPage: false, + baseViewModel: model, + body: Column( + children: [ + Container( + height: 400, + margin: EdgeInsets.only(bottom: 22), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 1.0, + childAspectRatio: 3.2, + ), + itemCount: model.categorise.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(4.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Colors.grey.withOpacity(0.24), + ), + child: Center( + child: Texts(model.categorise[index].name), + ), + ), + ); + }, + ), + ), + Container( + height: 200, + child: Column( + children: [ + Divider( + height: 2.0, + thickness: 2.0, + color: Colors.black12.withOpacity(0.14)), + SizedBox( + height: 15.0, + ), + Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.green.shade300.withOpacity(0.34), + ), + child: Center( + child: Texts( + 'best sellers', + )), + ), + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: Colors.orangeAccent.shade200 + .withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Center(child: Texts('Most Viewed')), + ), + ), + ), + ], + ), + Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: Colors.blue.shade200.withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Center(child: Texts('New Proudcts')), + ), + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: Colors.purple.shade200.withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Center(child: Texts('Recently Viewed')), + ), + ), + ), + ], + ), + ], + )), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart new file mode 100644 index 00000000..7012b392 --- /dev/null +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart @@ -0,0 +1,108 @@ +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; + +import 'bottom_nav_pharmacy_home_item.dart'; +import 'bottom_nav_pharmacy_item.dart'; + +class BottomNavPharmacyBar extends StatefulWidget { + final ValueChanged changeIndex; + final int index; + BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) + : super(key: key); + + @override + _BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState(); +} + +class _BottomNavPharmacyBarState extends State { + int _index = 0; + + _changeIndex(int index) { + widget.changeIndex(index); + } + + @override + Widget build(BuildContext context) { + return BottomAppBar( + elevation: 4, + shape: CircularNotchedRectangle(), + color: Colors.white, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + BottomNavHomeItem( + icon: EvaIcons.image, + activeIcon: EvaIcons.image, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 0, + ), + + Container( + height: 65.0, + child: Center( + child: VerticalDivider( + color: Colors.grey, + thickness: 0.5, + width: 0.3, + indent: 25.5, + ), + ), + ), + + BottomNavPharmacyItem( + icon: EvaIcons.list, + activeIcon: EvaIcons.list, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 1, + title: 'Categorise', + ), +// Expanded( +// child: SizedBox( +// height: 50, +// child: Column( +// mainAxisSize: MainAxisSize.min, +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// SizedBox(height: 22), +// ], +// ), +// ), +// ), + + // Added Calendar Icon to access book appointment flow + BottomNavPharmacyItem( + icon: EvaIcons.heart, + activeIcon: EvaIcons.heart, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 2, + title: 'Wishlist'), + + BottomNavPharmacyItem( + icon: EvaIcons.person, + activeIcon: EvaIcons.person, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 3, + title: 'My Account', + ), + BottomNavPharmacyItem( + icon: EvaIcons.shoppingCart, + activeIcon: EvaIcons.shoppingCart, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 4, + title: 'Cart') + ], + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart new file mode 100644 index 00000000..c5c3519b --- /dev/null +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart @@ -0,0 +1,74 @@ +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class BottomNavHomeItem extends StatelessWidget { + final IconData icon; + final Image image; + + final ValueChanged changeIndex; + final int index; + final int currentIndex; + final Function onTap; + final IconData activeIcon; + + BottomNavHomeItem( + {this.icon, + this.changeIndex, + this.index, + this.currentIndex, + this.activeIcon, + this.onTap, + this.image}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SizedBox( + // height: 72.0, + child: Material( + type: MaterialType.transparency, + child: InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + onTap: () => { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + ), + }, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 15, + ), + currentIndex == index + ? Divider( + // color: Color(0xff5AB145), + thickness: 0.5, + ) + : Divider( + thickness: 0, + ), + Container( + child: Image.asset( + 'assets/images/habib-logo.png', + height: 35.0, + ), + ), + SizedBox( + height: 11, + ), + + // Added TextAlign Property + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart new file mode 100644 index 00000000..9d46e2eb --- /dev/null +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -0,0 +1,76 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class BottomNavPharmacyItem extends StatelessWidget { + final String title; + final IconData icon; + + final ValueChanged changeIndex; + final int index; + final int currentIndex; + final Function onTap; + + final IconData activeIcon; + BottomNavPharmacyItem( + {this.icon, + this.changeIndex, + this.index, + this.currentIndex, + this.activeIcon, + this.title, + this.onTap}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SizedBox( + // height: 72.0, + child: Material( + type: MaterialType.transparency, + child: InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + onTap: () => changeIndex(currentIndex), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 15, + ), + currentIndex == index + ? Divider( + color: Color(0xff5AB145), + thickness: 3.5, + ) + : Divider( + thickness: 0, + ), + Container( + child: Icon(currentIndex == index ? activeIcon : icon, + color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).primaryColor, + size: 22.0), + ), + SizedBox( + height: 11, + ), + + // Added TextAlign Property + Texts( + title, + textAlign: TextAlign.center, + color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).primaryColor, + fontSize: 11, + ), + ], + ), + ), + ), + ), + ); + } +}