diff --git a/assets/images/pharmacy_module/bg_1.png b/assets/images/pharmacy_module/bg_1.png new file mode 100644 index 00000000..9505e556 Binary files /dev/null and b/assets/images/pharmacy_module/bg_1.png differ diff --git a/assets/images/pharmacy_module/bg_2.png b/assets/images/pharmacy_module/bg_2.png new file mode 100644 index 00000000..96cfd3bc Binary files /dev/null and b/assets/images/pharmacy_module/bg_2.png differ diff --git a/assets/images/pharmacy_module/bg_3.png b/assets/images/pharmacy_module/bg_3.png new file mode 100644 index 00000000..127c2669 Binary files /dev/null and b/assets/images/pharmacy_module/bg_3.png differ diff --git a/assets/images/pharmacy_module/bg_4.png b/assets/images/pharmacy_module/bg_4.png new file mode 100644 index 00000000..423ab421 Binary files /dev/null and b/assets/images/pharmacy_module/bg_4.png differ diff --git a/assets/images/pharmacy_module/medication_icon.png b/assets/images/pharmacy_module/medication_icon.png new file mode 100644 index 00000000..95851e4e Binary files /dev/null and b/assets/images/pharmacy_module/medication_icon.png differ diff --git a/assets/images/pharmacy_module/offer_icon.png b/assets/images/pharmacy_module/offer_icon.png new file mode 100644 index 00000000..64db2b76 Binary files /dev/null and b/assets/images/pharmacy_module/offer_icon.png differ diff --git a/assets/images/pharmacy_module/pharmacy_logo_green.png b/assets/images/pharmacy_module/pharmacy_logo_green.png new file mode 100644 index 00000000..13c076b0 Binary files /dev/null and b/assets/images/pharmacy_module/pharmacy_logo_green.png differ diff --git a/assets/images/pharmacy_module/prescription_icon.png b/assets/images/pharmacy_module/prescription_icon.png new file mode 100644 index 00000000..740004c7 Binary files /dev/null and b/assets/images/pharmacy_module/prescription_icon.png differ diff --git a/assets/images/pharmacy_module/search_scan_icon.png b/assets/images/pharmacy_module/search_scan_icon.png new file mode 100644 index 00000000..d168b0e6 Binary files /dev/null and b/assets/images/pharmacy_module/search_scan_icon.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 447a23e1..a911598e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -85,8 +85,11 @@ const GET_BABYINFORMATION_REQUEST = const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID'; ///userInformation -const GET_USERINFORMATION_REQUEST = - 'Services/Community.svc/REST/GetUserInformation_New'; +const GET_USERINFORMATION_REQUEST = 'Services/Community.svc/REST/GetUserInformation_New'; + +///Update email +const UPDATE_PATENT_EMAIL = 'Services/Patients.svc/REST/UpdatePateintEmail'; +const UPDATE_PATENT_INFO = 'Services/Community.svc/REST/UpdateUserInfo_New'; ///addNewChild const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby'; @@ -94,8 +97,8 @@ const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby'; ///newUserId const GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New'; -///delteChild -const DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby'; +///delete Child +const DELETE_CHILD_REQUEST = '/Services/Community.svc/REST/DeleteBaby'; ///addNewTABLE const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; @@ -355,6 +358,13 @@ 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_BANNER = "epharmacy/api/promotionbanners"; +const GET_PHARMACY_TOP_MANUFACTURER = "epharmacy/api/topmanufacturer"; +const GET_PHARMACY_BEST_SELLER_PRODUCT = "epharmacy/api/bestsellerproducts"; +const GET_PHARMACY_PRODUCTs_BY_IDS = "epharmacy/api/productsbyids/"; +const GET_CUSTOMERS_ADDRESSES = "epharmacy/api/Customers/"; + // Home Health Care const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; @@ -371,6 +381,16 @@ const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; const PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ = 'Services/MobileNotifications.svc/REST/PushNotification_SetMessagesFromPoolAsRead'; +const GET_PATIENT_ALL_PRES_ORD= 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const PATIENT_ER_INSERT_PRES_ORDER= 'Services/Patients.svc/REST/PatientER_InsertPresOrder'; + + +// External API +const ADD_ADDRESS_INFO= "https://mdlaboratories.com/exacartapi/api/addcustomeraddress"; +const GET_CUSTOMER_ADDRESSES= "https://mdlaboratories.com/exacartapi/api/Customers/"; +const GET_CUSTOMER_INFO = "https://mdlaboratories.com/exacartapi/api/VerifyCustomer"; + + const TIMER_MIN = 10; const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 232c92df..1745b20b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -360,7 +360,7 @@ const Map localizedValues = { "en": "Home Health Care Service", 'ar': 'الرعاية الصحية المنزلية' }, - "OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'صيدلايات الحبيب'}, + "OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'صيدليات الحبيب'}, "EmergencyService": {"en": "Emergency Service", 'ar': 'الفحص الطبي الشامل'}, "OnlinePaymentService": { "en": "Online Payment Service", @@ -679,6 +679,39 @@ const Map localizedValues = { "ar": "هذة الخدمة تتطلب تسجيل الدخول" }, + // pharmacy module + "medicationRefill": { + "en": "MEDICATION REFILL", + "ar": "إعادة تعبئة الدواء" + }, + "offersAndPromotions": { + "en": "OFFERS & SPECIAL PROMOTIONS", + "ar": "العروض والترقيات الخاصة" + }, + "myPrescriptions": { + "en": "MY PRESCRIPTIONS", + "ar": "وصفاتي" + }, + "searchAndScanMedication": { + "en": "SEARCH & SCAN FOR MEDICATION", + "ar": "البحث والمسح للأدوية" + }, + "shopByBrands": { + "en": "Shop By Brands", + "ar": "تسوق حسب الماركات" + }, + "recentlyViewed": { + "en": "Recently Viewed", + "ar": "شوهدت مؤخرا" + }, + "bestSellers": { + "en": "Best Sellers", + "ar": "أفضل البائعين" + }, + "deleteAllItems": { + "en": "Delete All Items", + "ar": "حذف كافة العناصر" + }, "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, "select-age": {"en": "Select Your Age", "ar": "حدد العمر"}, @@ -687,6 +720,9 @@ const Map localizedValues = { "drag-point": { "en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك" + },"HHCNotAuthMsg": { + "en": "This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.", + "ar": "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" }, "email": {"en": "Email", "ar": "البريد الالكتروني"}, "Book": {"en": "Book", "ar": "احجز"}, @@ -1056,4 +1092,96 @@ const Map localizedValues = { "ar": "إستبيان" }, + "vaccination": { + "en": "Vaccination", + "ar": "جدول التطعيمات" + }, + "welcomeBack": { + "en": "Welcome back", + "ar": "مرحبا مرة أخرى" + }, + "instructions": { + "en": "Please ensure that the email address is up-to-date and process to view the schedule", + "ar": "يرجى التأكد من صحة عنوان البريد الالكتروني و المتابعة لعرض الجدول " + }, + "update-email": { + "en": "Update Email", + "ar": "تحديث البريد الالكتروني" + }, + + "updated-email": { + "en": "Updated email successfully", + "ar": "تم تحديث البريد الالكتروني" + }, + + "view-list-children": { + "en": "View List of Children", + "ar": "عرض قائمة الأطفال" + }, + + "add-child": { + "en": "Add New Child", + "ar": "اضافة طفل" + }, + "child-name": { + "en": "Child Name", + "ar": "اسم الطفل" + }, + "childDob": { + "en": "Birth Date", + "ar": "تاريخ الولادة" + }, + "delete": { + "en": "Delete", + "ar": "حذف" + }, + "deleted-child-mes": { + "en": "The request was successful. The children have removed from the vaccination schedule subscription service.", + "ar": "تم حذف الطفل بنجاح" + }, + "deleted-child":{ + "en":"Delete child", + "ar":"إالغاء الطفل" + }, + "visit": { + "en": "Visit", + "ar": "زيارة" + }, + "description-vaccination": { + "en": "Description", + "ar": "وصف" + }, + "due-date": { + "en": "Due date", + "ar": "تاريخ الاستحقاق" + }, + "valid-email": { + "en": "Please enter valid email", + "ar": "الرجاء إدخال عنوان بريد صحيح" + }, + "confirm-send": { + "en": "Send the child's schedule to the email?", + "ar": "ارسال جدول التطعيمات الى بريدك الالكتروني؟" + }, + "email-success": { + "en": " The request was successful. You will receive the Schedule in moments.", + "ar": "تم ارسال جدول التطعيمات " + }, + "add-instructions": { + "en": "Add the child's information below to recieve the schedule of vaccinations.", + "ar": "أضف معلومات الطفل لاستلام جدول التطعيمات" + }, + "added-child": { + "en": "The request was successful. You have added a child to the vaccination schedule subscription service.", + "ar": "تمت الاضافة بنجاح." + }, + "appUpdate": { + "en": "UPDATE THE APP", + "ar": "تحديث التطبيق" + }, + "ereferralSaveSuccess": { + "en": "The referral request has been submitted successfully, you will be contacted ASAP to complete the process. Referral request no is ", + "ar": " تم إرسال طلب الإحالة بنجاح ، وسيتم الاتصال بك في أسرع وقت ممكن لإكمال العملية. رقم طلب الإحالة" + }, + }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index bcd7195b..e5c5c965 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -19,4 +19,5 @@ const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; const IS_VIBRATION = 'is_vibration'; const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; -const WEATHER = 'weather'; \ No newline at end of file +const WEATHER = 'weather'; +const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited'; diff --git a/lib/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart new file mode 100644 index 00000000..438f1630 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart @@ -0,0 +1,76 @@ +class GetAllProjectsResponseModel { + String desciption; + Null desciptionN; + int iD; + String legalName; + String legalNameN; + String name; + Null nameN; + String phoneNumber; + String setupID; + int distanceInKilometers; + bool isActive; + String latitude; + String longitude; + int mainProjectID; + Null projectOutSA; + bool usingInDoctorApp; + + GetAllProjectsResponseModel( + {this.desciption, + this.desciptionN, + this.iD, + this.legalName, + this.legalNameN, + this.name, + this.nameN, + this.phoneNumber, + this.setupID, + this.distanceInKilometers, + this.isActive, + this.latitude, + this.longitude, + this.mainProjectID, + this.projectOutSA, + this.usingInDoctorApp}); + + GetAllProjectsResponseModel.fromJson(Map json) { + desciption = json['Desciption']; + desciptionN = json['DesciptionN']; + iD = json['ID']; + legalName = json['LegalName']; + legalNameN = json['LegalNameN']; + name = json['Name']; + nameN = json['NameN']; + phoneNumber = json['PhoneNumber']; + setupID = json['SetupID']; + distanceInKilometers = json['DistanceInKilometers']; + isActive = json['IsActive']; + latitude = json['Latitude']; + longitude = json['Longitude']; + mainProjectID = json['MainProjectID']; + projectOutSA = json['ProjectOutSA']; + usingInDoctorApp = json['UsingInDoctorApp']; + } + + Map toJson() { + final Map data = new Map(); + data['Desciption'] = this.desciption; + data['DesciptionN'] = this.desciptionN; + data['ID'] = this.iD; + data['LegalName'] = this.legalName; + data['LegalNameN'] = this.legalNameN; + data['Name'] = this.name; + data['NameN'] = this.nameN; + data['PhoneNumber'] = this.phoneNumber; + data['SetupID'] = this.setupID; + data['DistanceInKilometers'] = this.distanceInKilometers; + data['IsActive'] = this.isActive; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['MainProjectID'] = this.mainProjectID; + data['ProjectOutSA'] = this.projectOutSA; + data['UsingInDoctorApp'] = this.usingInDoctorApp; + return data; + } +} diff --git a/lib/core/model/pharmacies/Addresses.dart b/lib/core/model/pharmacies/Addresses.dart new file mode 100644 index 00000000..74d5a591 --- /dev/null +++ b/lib/core/model/pharmacies/Addresses.dart @@ -0,0 +1,85 @@ +class Addresses { + String id; + String firstName; + String lastName; + String email; + String company; + int countryId; + String country; + String stateProvinceId; + String city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + String faxNumber; + String customerAttributes; + String createdOnUtc; + String province; + String latLong; + + Addresses( + {this.id, + this.firstName, + this.lastName, + this.email, + this.company, + this.countryId, + this.country, + this.stateProvinceId, + this.city, + this.address1, + this.address2, + this.zipPostalCode, + this.phoneNumber, + this.faxNumber, + this.customerAttributes, + this.createdOnUtc, + this.province, + this.latLong}); + + Addresses.fromJson(Map json) { + id = json['id']; + firstName = json['first_name']; + lastName = json['last_name']; + email = json['email']; + company = json['company']; + countryId = json['country_id']; + country = json['country']; + stateProvinceId = json['state_province_id']; + city = json['city']; + address1 = json['address1']; + address2 = json['address2']; + zipPostalCode = json['zip_postal_code']; + phoneNumber = json['phone_number']; + faxNumber = json['fax_number']; + customerAttributes = json['customer_attributes']; + createdOnUtc = json['created_on_utc']; + province = json['province']; + latLong = json['lat_long']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['first_name'] = this.firstName; + data['last_name'] = this.lastName; + data['email'] = this.email; + data['company'] = this.company; + data['country_id'] = this.countryId; + data['country'] = this.country; + data['state_province_id'] = this.stateProvinceId; + data['city'] = this.city; + data['address1'] = this.address1; + data['address2'] = this.address2; + data['zip_postal_code'] = this.zipPostalCode; + data['phone_number'] = this.phoneNumber; + data['fax_number'] = this.faxNumber; + data['customer_attributes'] = this.customerAttributes; + data['created_on_utc'] = this.createdOnUtc; + data['province'] = this.province; + data['lat_long'] = this.latLong; + return data; + } + +} diff --git a/lib/core/model/pharmacies/Customer.dart b/lib/core/model/pharmacies/Customer.dart new file mode 100644 index 00000000..a5311489 --- /dev/null +++ b/lib/core/model/pharmacies/Customer.dart @@ -0,0 +1,128 @@ +class Customer { + String fileNumber; + String iqamaNumber; + int isOutSa; + int patientType; + String gender; + String birthDate; + String phone; + String countryCode; + String yahalaAccountno; + String billingAddress; + String shippingAddress; + String id; + String username; + String email; + String firstName; + String lastName; + String languageId; + String adminComment; + String isTaxExempt; + String hasShoppingCartItems; + String active; + String deleted; + String isSystemAccount; + String systemName; + String lastIpAddress; + String createdOnUtc; + String lastLoginDateUtc; + String lastActivityDateUtc; + String registeredInStoreId; + + Customer( + {this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + this.billingAddress, + this.shippingAddress, + this.id, + this.username, + this.email, + this.firstName, + this.lastName, + this.languageId, + this.adminComment, + this.isTaxExempt, + this.hasShoppingCartItems, + this.active, + this.deleted, + this.isSystemAccount, + this.systemName, + this.lastIpAddress, + this.createdOnUtc, + this.lastLoginDateUtc, + this.lastActivityDateUtc, + this.registeredInStoreId}); + + Customer.fromJson(Map json) { + fileNumber = json['file_number']; + iqamaNumber = json['iqama_number']; + isOutSa = json['is_out_sa']; + patientType = json['patient_type']; + gender = json['gender']; + birthDate = json['birth_date']; + phone = json['phone']; + countryCode = json['country_code']; + yahalaAccountno = json['yahala_accountno']; + billingAddress = json['billing_address']; + shippingAddress = json['shipping_address']; + id = json['id']; + username = json['username']; + email = json['email']; + firstName = json['first_name']; + lastName = json['last_name']; + languageId = json['language_id']; + adminComment = json['admin_comment']; + isTaxExempt = json['is_tax_exempt']; + hasShoppingCartItems = json['has_shopping_cart_items']; + active = json['active']; + deleted = json['deleted']; + isSystemAccount = json['is_system_account']; + systemName = json['system_name']; + lastIpAddress = json['last_ip_address']; + createdOnUtc = json['created_on_utc']; + lastLoginDateUtc = json['last_login_date_utc']; + lastActivityDateUtc = json['last_activity_date_utc']; + registeredInStoreId = json['registered_in_store_id']; + } + + Map toJson() { + final Map data = new Map(); + data['file_number'] = this.fileNumber; + data['iqama_number'] = this.iqamaNumber; + data['is_out_sa'] = this.isOutSa; + data['patient_type'] = this.patientType; + data['gender'] = this.gender; + data['birth_date'] = this.birthDate; + data['phone'] = this.phone; + data['country_code'] = this.countryCode; + data['yahala_accountno'] = this.yahalaAccountno; + data['billing_address'] = this.billingAddress; + data['shipping_address'] = this.shippingAddress; + data['id'] = this.id; + data['username'] = this.username; + data['email'] = this.email; + data['first_name'] = this.firstName; + data['last_name'] = this.lastName; + data['language_id'] = this.languageId; + data['admin_comment'] = this.adminComment; + data['is_tax_exempt'] = this.isTaxExempt; + data['has_shopping_cart_items'] = this.hasShoppingCartItems; + data['active'] = this.active; + data['deleted'] = this.deleted; + data['is_system_account'] = this.isSystemAccount; + data['system_name'] = this.systemName; + data['last_ip_address'] = this.lastIpAddress; + data['created_on_utc'] = this.createdOnUtc; + data['last_login_date_utc'] = this.lastLoginDateUtc; + data['last_activity_date_utc'] = this.lastActivityDateUtc; + data['registered_in_store_id'] = this.registeredInStoreId; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/Manufacturer.dart b/lib/core/model/pharmacies/Manufacturer.dart new file mode 100644 index 00000000..3b16337b --- /dev/null +++ b/lib/core/model/pharmacies/Manufacturer.dart @@ -0,0 +1,98 @@ +import 'PharmacyImageObject.dart'; + +class Manufacturer { + String id; + String name; + String namen; + // List localizedNames; + String description; + int manufacturerTemplateId; + String metaKeywords; + String metaDescription; + String metaTitle; + int pageSize; + String pageSizeOptions; + String priceRanges; + bool published; + bool deleted; + int displayOrder; + String createdOnUtc; + String updatedOnUtc; + PharmacyImageObject image; + + Manufacturer( + {this.id, + this.name, + this.namen, + // this.localizedNames, + this.description, + this.manufacturerTemplateId, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.pageSize, + this.pageSizeOptions, + this.priceRanges, + this.published, + this.deleted, + this.displayOrder, + this.createdOnUtc, + this.updatedOnUtc, + this.image}); + + Manufacturer.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']; + manufacturerTemplateId = json['manufacturer_template_id']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + pageSize = json['page_size']; + pageSizeOptions = json['page_size_options']; + priceRanges = json['price_ranges']; + 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 PharmacyImageObject.fromJson(json['image']) + : null; + } + + 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['manufacturer_template_id'] = this.manufacturerTemplateId; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['page_size'] = this.pageSize; + data['page_size_options'] = this.pageSizeOptions; + data['price_ranges'] = this.priceRanges; + 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.image != null) { + data['image'] = this.image.toJson(); + } + return data; + } +} diff --git a/lib/core/model/pharmacies/PharmacyImageObject.dart b/lib/core/model/pharmacies/PharmacyImageObject.dart new file mode 100644 index 00000000..d3db634b --- /dev/null +++ b/lib/core/model/pharmacies/PharmacyImageObject.dart @@ -0,0 +1,27 @@ +class PharmacyImageObject { + int id; + int position; + String src; + String thumb; + String attachment; + + PharmacyImageObject({this.id, this.position, this.src, this.thumb, this.attachment}); + + PharmacyImageObject.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacies/PharmacyProduct.dart b/lib/core/model/pharmacies/PharmacyProduct.dart new file mode 100644 index 00000000..cd461ae5 --- /dev/null +++ b/lib/core/model/pharmacies/PharmacyProduct.dart @@ -0,0 +1,149 @@ +import 'PharmacyImageObject.dart'; +import 'Reviews.dart'; + +class PharmacyProduct { + String id; + String name; + String namen; + String shortDescription; + String fullDescription; + String fullDescriptionn; + int approvedRatingSum; + int approvedTotalReviews; + String sku; + bool isRx; + String rxMessage; + String rxMessagen; + int stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool allowBackInStockSubscriptions; + int orderMinimumQuantity; + int orderMaximumQuantity; + double price; + double oldPrice; + String discountName; + String discountNamen; + String discountPercentage; + int displayOrder; + List discountIds; + List reviews; + List images; + + PharmacyProduct( + {this.id, + this.name, + this.namen, + this.shortDescription, + this.fullDescription, + this.fullDescriptionn, + this.approvedRatingSum, + this.approvedTotalReviews, + this.sku, + this.isRx, + this.rxMessage, + this.rxMessagen, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.price, + this.oldPrice, + this.discountName, + this.discountNamen, + this.discountPercentage, + this.displayOrder, + this.discountIds, + this.reviews, + this.images}); + + PharmacyProduct.fromJson(Map json) { + try { + id = json['id']; + name = json['name']; + namen = json['namen']; + shortDescription = json['short_description']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + approvedRatingSum = json['approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + price = json['price']; + oldPrice = json['old_price']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountPercentage = json['discount_percentage']; + displayOrder = json['display_order']; + if (json['discount_ids'] != null) { + discountIds = new List(); + json['discount_ids'].forEach((v) { + discountIds.add(v); + }); + } + if (json['reviews'] != null) { + reviews = new List(); + json['reviews'].forEach((v) { + reviews.add(new Reviews.fromJson(v)); + }); + } + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new PharmacyImageObject.fromJson(v)); + }); + } + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + data['short_description'] = this.shortDescription; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['approved_rating_sum'] = this.approvedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_percentage'] = this.discountPercentage; + data['display_order'] = this.displayOrder; + if (this.discountIds != String) { + data['discount_ids'] = this.discountIds.map((v) => v).toList(); + } + if (this.reviews != String) { + data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); + } + if (this.images != String) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + return data; + } +} diff --git a/lib/core/model/pharmacies/Reviews.dart b/lib/core/model/pharmacies/Reviews.dart new file mode 100644 index 00000000..f924dce3 --- /dev/null +++ b/lib/core/model/pharmacies/Reviews.dart @@ -0,0 +1,82 @@ +import '../pharmacies/Customer.dart'; + +class Reviews { + int id; + int position; + int reviewId; + int customerId; + int productId; + int storeId; + bool isApproved; + String title; + String reviewText; + Null replyText; + int rating; + int helpfulYesTotal; + int helpfulNoTotal; + String createdOnUtc; + Customer customer; + Null product; + + Reviews( + {this.id, + this.position, + this.reviewId, + this.customerId, + this.productId, + this.storeId, + this.isApproved, + this.title, + this.reviewText, + this.replyText, + this.rating, + this.helpfulYesTotal, + this.helpfulNoTotal, + this.createdOnUtc, + this.customer, + this.product}); + + Reviews.fromJson(Map json) { + id = json['id']; + position = json['position']; + reviewId = json['review_id']; + customerId = json['customer_id']; + productId = json['product_id']; + storeId = json['store_id']; + isApproved = json['is_approved']; + title = json['title']; + reviewText = json['review_text']; + replyText = json['reply_text']; + rating = json['rating']; + helpfulYesTotal = json['helpful_yes_total']; + helpfulNoTotal = json['helpful_no_total']; + createdOnUtc = json['created_on_utc']; + customer = json['customer'] != null + ? new Customer.fromJson(json['customer']) + : null; + product = json['product']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['review_id'] = this.reviewId; + data['customer_id'] = this.customerId; + data['product_id'] = this.productId; + data['store_id'] = this.storeId; + data['is_approved'] = this.isApproved; + data['title'] = this.title; + data['review_text'] = this.reviewText; + data['reply_text'] = this.replyText; + data['rating'] = this.rating; + data['helpful_yes_total'] = this.helpfulYesTotal; + data['helpful_no_total'] = this.helpfulNoTotal; + data['created_on_utc'] = this.createdOnUtc; + if (this.customer != null) { + data['customer'] = this.customer.toJson(); + } + data['product'] = this.product; + return data; + } +} \ No newline at end of file diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index dffa6683..9e99f3ad 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; @@ -47,8 +48,9 @@ class CMCService extends BaseService { await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { cmcAllPresOrdersList.clear(); + cmcAllOrderDetail.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == 3) + if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); @@ -104,7 +106,7 @@ class CMCService extends BaseService { Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, + await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart new file mode 100644 index 00000000..cb457735 --- /dev/null +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -0,0 +1,211 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; +import 'package:intl/intl.dart'; + +import '../base_service.dart'; + +class CustomerAddressesService extends BaseService { + + List addressesList = List(); + CustomerInfo customerInfo; + + Future addAddressInfo({ AddNewAddressRequestModel + addNewAddressRequestModel }) async { + + addNewAddressRequestModel.customer.email = customerInfo.email; + addNewAddressRequestModel.customer.id = customerInfo.customerId; + addNewAddressRequestModel.customer.roleIds = [3]; + addNewAddressRequestModel.customer.addresses[0].email = customerInfo.email; + addNewAddressRequestModel.customer.addresses[0].phoneNumber = customerInfo.mobileNumber; + addNewAddressRequestModel.customer.addresses[0].firstName = user.firstName; + addNewAddressRequestModel.customer.addresses[0].lastName = user.lastName; + addNewAddressRequestModel.customer.addresses[0].countryId = 69; + + var f = DateFormat('E, d MMM yyyy HH:mm:ss'); + var date = f.format(DateTime.now().toUtc()) + " GMT"; + addNewAddressRequestModel.customer.addresses[0].createdOnUtc = date; + hasError = false; + await baseAppClient.post(ADD_ADDRESS_INFO, + onSuccess: (dynamic response, int statusCode) { + addressesList.clear(); + response["customers"][0]["addresses"].forEach((data) { + addressesList + .add(AddressInfo.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: addNewAddressRequestModel.toJson(), isExternal: true, isAllowAny: true); + } + + Future getCustomerAddresses() async { + Map queryParams = { + 'fields':'addresses' + }; + hasError = false; + await baseAppClient.get("$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", + onSuccess: (dynamic response, int statusCode) { + addressesList.clear(); + response["customers"][0]["addresses"].forEach((data) { + addressesList + .add(AddressInfo.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams, isExternal: true); + } + + + Future getCustomerInfo() async { + Map queryParams = { + 'FileNumber':'${user.patientID}' + }; + + hasError = false; + await baseAppClient.get(GET_CUSTOMER_INFO, + onSuccess: (dynamic response, int statusCode) { + customerInfo= CustomerInfo.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams, isExternal: true); + } +} + + +class CustomerInfo { + bool isRegistered; + String userName; + Null password; + String email; + Null errorMessage; + String mobileNumber; + int customerId; + + CustomerInfo( + {this.isRegistered, + this.userName, + this.password, + this.email, + this.errorMessage, + this.mobileNumber, + this.customerId}); + + CustomerInfo.fromJson(Map json) { + isRegistered = json['IsRegistered']; + userName = json['UserName']; + password = json['Password']; + email = json['Email']; + errorMessage = json['ErrorMessage']; + mobileNumber = json['MobileNumber']; + customerId = json['CustomerId']; + } + + Map toJson() { + final Map data = new Map(); + data['IsRegistered'] = this.isRegistered; + data['UserName'] = this.userName; + data['Password'] = this.password; + data['Email'] = this.email; + data['ErrorMessage'] = this.errorMessage; + data['MobileNumber'] = this.mobileNumber; + data['CustomerId'] = this.customerId; + return data; + } +} + + +class AddressInfo { + String id; + String firstName; + String lastName; + String email; + Null company; + int countryId; + String country; + Null stateProvinceId; + String city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + Null faxNumber; + String customerAttributes; + String createdOnUtc; + Null province; + String latLong; + + AddressInfo( + {this.id, + this.firstName, + this.lastName, + this.email, + this.company, + this.countryId, + this.country, + this.stateProvinceId, + this.city, + this.address1, + this.address2, + this.zipPostalCode, + this.phoneNumber, + this.faxNumber, + this.customerAttributes, + this.createdOnUtc, + this.province, + this.latLong}); + + AddressInfo.fromJson(Map json) { + id = json['id']; + firstName = json['first_name']; + lastName = json['last_name']; + email = json['email']; + company = json['company']; + countryId = json['country_id']; + country = json['country']; + stateProvinceId = json['state_province_id']; + city = json['city']; + address1 = json['address1']; + address2 = json['address2']; + zipPostalCode = json['zip_postal_code']; + phoneNumber = json['phone_number']; + faxNumber = json['fax_number']; + customerAttributes = json['customer_attributes']; + createdOnUtc = json['created_on_utc']; + province = json['province']; + latLong = json['lat_long']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['first_name'] = this.firstName; + data['last_name'] = this.lastName; + data['email'] = this.email; + data['company'] = this.company; + data['country_id'] = this.countryId; + data['country'] = this.country; + data['state_province_id'] = this.stateProvinceId; + data['city'] = this.city; + data['address1'] = this.address1; + data['address2'] = this.address2; + data['zip_postal_code'] = this.zipPostalCode; + data['phone_number'] = this.phoneNumber; + data['fax_number'] = this.faxNumber; + data['customer_attributes'] = this.customerAttributes; + data['created_on_utc'] = this.createdOnUtc; + data['province'] = this.province; + data['lat_long'] = this.latLong; + return data; + } +} diff --git a/lib/core/service/AlHabibMedicalService/e_referral_service.dart b/lib/core/service/AlHabibMedicalService/e_referral_service.dart index 6c356f5c..6e8da51b 100644 --- a/lib/core/service/AlHabibMedicalService/e_referral_service.dart +++ b/lib/core/service/AlHabibMedicalService/e_referral_service.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; @@ -14,6 +15,9 @@ class EReferralService extends BaseService { List _allCities = List(); List get allCities => _allCities; + List _allProjects = List(); + List get allProjects => _allProjects; + List _allReferral = List(); List get allReferral => _allReferral; String _activationCode; @@ -53,6 +57,20 @@ class EReferralService extends BaseService { }, body: {}); } + Future getAllProjects() async { + await baseAppClient.post(GET_PROJECT, + onSuccess: (dynamic response, int statusCode) { + _allProjects.clear(); + response['ListProject'].forEach((city) { + _allProjects + .add(GetAllProjectsResponseModel.fromJson(city)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {}); + } + Future sendActivationCodeForEReferral( SendActivationCodeForEReferralRequestModel @@ -60,6 +78,7 @@ class EReferralService extends BaseService { hasError = false; await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_E_REFERRAL, onSuccess: (dynamic response, int statusCode) { + print(response["VerificationCode"]); _activationCode = response["VerificationCode"]; _logInTokenID = response["LogInTokenID"]; @@ -86,19 +105,20 @@ class EReferralService extends BaseService { }, body: checkActivationCodeForEReferralRequestModel.toJson()); } - Future createEReferral( + Future createEReferral( CreateEReferralRequestModel createEReferralRequestModel ) async { hasError = false; + dynamic localRes; await baseAppClient.post(CREATE_E_REFERRAL/*'Services/Patients.svc/REST/CreateEReferral'*/, onSuccess: (dynamic response, int statusCode) { // TODO Waiting for fix service - var asd= ("EEEEEE"); - + localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: createEReferralRequestModel.toJson()); + return Future.value(localRes); } Future getEReferrals( diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index e636321b..2ec1e310 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; @@ -7,6 +8,8 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import '../base_service.dart'; @@ -15,9 +18,10 @@ class HomeHealthCareService extends BaseService { List hhcAllPresOrdersList = List(); List hhcAllOrderDetail = List(); + List addressesList = List(); bool isOrderUpdated; - + CustomerInfo customerInfo; Future getHHCAllServices( HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; @@ -37,11 +41,11 @@ class HomeHealthCareService extends BaseService { GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, onSuccess: (dynamic response, int statusCode) { hhcAllPresOrdersList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == 2) + if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) hhcAllPresOrdersList .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); @@ -91,3 +95,5 @@ class HomeHealthCareService extends BaseService { }, body: order.toJson()); } } + + diff --git a/lib/core/service/childvaccines/add_new_child_service.dart b/lib/core/service/childvaccines/add_new_child_service.dart index 5e4a4d86..98e87100 100644 --- a/lib/core/service/childvaccines/add_new_child_service.dart +++ b/lib/core/service/childvaccines/add_new_child_service.dart @@ -14,19 +14,12 @@ class CreteNewBabyService extends BaseService { Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { hasError = false; - await getUser(); Map body = Map.from(newChild.toJson()); body['CreatedBy'] = 102; body['EditedBy'] = 102; body['UserID'] = userID; body['AlertBy'] = 2; - body['EmailAddress'] = user.emailAddress; body['IsLogin'] = true; - body['LogInTokenID'] = await sharedPref.getString(TOKEN); - body['MobileNumber'] = user.mobileNumber; - body['NationalID'] = user.nationalityID; - body['ZipCode'] = user.zipCode; - body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_NEWCHILD_REQUEST, diff --git a/lib/core/service/childvaccines/delete_baby_service.dart b/lib/core/service/childvaccines/delete_baby_service.dart index 115d13c5..49cbd29e 100644 --- a/lib/core/service/childvaccines/delete_baby_service.dart +++ b/lib/core/service/childvaccines/delete_baby_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart'; @@ -17,22 +18,13 @@ class DeleteBabyService extends BaseService{ List deleteBabyModelList= List(); - Future getDeleteBabyOrder({DeleteBaby deleteChild,int babyID}) async { + Future getDeleteBabyOrder({List_BabyInformationModel babyInfo}) async { hasError = false; await getUser(); - Map body = Map.from(deleteChild.toJson()); - // body['CreatedBy'] = 102; + Map body = Map(); body['EditedBy'] = 102; - //body['BabyID'] = babyID; - //body['BabyID'] = createNewBabyModelList ; - // body['AlertBy'] = 2; - // body['EmailAddress'] = user.emailAddress; body['IsLogin'] = true; - body['LogInTokenID'] = await sharedPref.getString(TOKEN); - body['MobileNumber'] = user.mobileNumber; - body['NationalID'] = user.nationalityID; - body['ZipCode'] = user.zipCode; - + body['BabyID'] = babyInfo.babyID; body['isDentalAllowedBackend'] = false; await baseAppClient.post(DELETE_CHILD_REQUEST, @@ -45,31 +37,6 @@ class DeleteBabyService extends BaseService{ }, body: body); } - // Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { - // hasError = false; - // await getUser(); - // Map body = Map.from(newChild.toJson()); - // body['CreatedBy'] = 102; - // body['EditedBy'] = 102; - // body['UserID'] = userID; - // body['AlertBy'] = 2; - // body['EmailAddress'] = user.emailAddress; - // body['IsLogin'] = true; - // body['LogInTokenID'] = await sharedPref.getString(TOKEN); - // body['MobileNumber'] = user.mobileNumber; - // body['NationalID'] = user.nationalityID; - // body['ZipCode'] = user.zipCode; - // - // body['isDentalAllowedBackend'] = false; - // - // await baseAppClient.post(GET_NEWCHILD_REQUEST, - // onSuccess: (dynamic response, int statusCode) { - // var asd =""; - // }, - // onFailure: (String error, int statusCode) { - // hasError = true; - // super.error = error; - // }, body: body); - // } + } \ No newline at end of file diff --git a/lib/core/service/childvaccines/get_vaccinations_item_services.dart b/lib/core/service/childvaccines/get_vaccinations_item_services.dart deleted file mode 100644 index 5ff936af..00000000 --- a/lib/core/service/childvaccines/get_vaccinations_item_services.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/get_vacainations_itemsmodel.dart'; - -import '../base_service.dart'; - -class GetVccinationsItemsService extends BaseService { - List getVaccinationsItemModelList = List(); - Map body = Map(); - - - - Future getaccinationsitemOrders() async { - hasError = false; - await baseAppClient.post(GET_TABLE_REQUEST, - onSuccess: (dynamic response, int statusCode) { - getVaccinationsItemModelList.clear(); - response['List_CreateVaccinationTableModel'].forEach((vital) { - getVaccinationsItemModelList.add( - GET_VACCINATIONS_ITEMSMODEL.fromJson(vital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); - } - -} \ No newline at end of file diff --git a/lib/core/service/childvaccines/user_information_service.dart b/lib/core/service/childvaccines/user_information_service.dart index 0628920c..55ddc259 100644 --- a/lib/core/service/childvaccines/user_information_service.dart +++ b/lib/core/service/childvaccines/user_information_service.dart @@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_m import '../base_service.dart'; class UserInformationService extends BaseService { - List userInformationModelList = List(); - Map body = Map(); + List_UserInformationModel userInformationModel = List_UserInformationModel(); Future getUserInformationOrders() async { hasError = false; + Map body = Map(); await getUser(); body['CreatedBy'] = 102; body['EditedBy'] = 102; @@ -22,14 +22,44 @@ class UserInformationService extends BaseService { await baseAppClient.post(GET_USERINFORMATION_REQUEST, onSuccess: (dynamic response, int statusCode) { - userInformationModelList.clear(); - response['List_UserInformationModel_New'].forEach((vital) { - userInformationModelList.add(List_UserInformationModel.fromJson(vital)); + userInformationModel = List_UserInformationModel.fromJson(vital); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } + + Future updateEmail(String email) async { + hasError = false; + Map body = Map(); + body['IsInternalRequest'] = true; + body['EmailAddress'] = email; + body['IsLogin'] = true; + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(UPDATE_PATENT_EMAIL, + onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future updateUserInfo(String email) async { + hasError = false; + Map body = Map(); + body['IsInternalRequest'] = true; + body['EmailAddress'] = email; + body['IsLogin'] = true; + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(UPDATE_PATENT_INFO, + onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/service/childvaccines/vaccination_table_service.dart b/lib/core/service/childvaccines/vaccination_table_service.dart index 7f987b76..da3c8518 100644 --- a/lib/core/service/childvaccines/vaccination_table_service.dart +++ b/lib/core/service/childvaccines/vaccination_table_service.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import '../base_service.dart'; class VaccinationTableService extends BaseService { @@ -10,19 +12,16 @@ class VaccinationTableService extends BaseService { - Future getCreateVaccinationTableOrders() async { + Future getCreateVaccinationTableOrders({List_BabyInformationModel babyInfo, List_UserInformationModel informationModel, bool isSendEmail=false}) async { hasError = false; await getUser(); - body['BabyName']="fffffffffff eeeeeeeeeeeeee"; - body['DOB'] = "/Date(1585774800000+0300)/"; - body['EmailAddress'] = user.emailAddress; + body['BabyName']=babyInfo.babyName; + body['DOB'] = DateUtil.convertDateToString(babyInfo.dOB); + body['EmailAddress'] = informationModel.emailAddress; body['isDentalAllowedBackend'] = false; - body['SendEmail'] = false; + body['SendEmail'] = isSendEmail; body['IsLogin'] =true; - - - await baseAppClient.post(GET_TABLE_REQUEST, onSuccess: (dynamic response, int statusCode) { createVaccinationTableModelList.clear(); diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 60142fc6..23d40a21 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -4,9 +4,11 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:provider/provider.dart'; @@ -31,74 +33,82 @@ class BaseAppClient { {Map body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, - bool isAllowAny = false}) async { - String url = BASE_URL + endPoint; + bool isAllowAny = false, + bool isExternal = false}) async { + String url; + if (isExternal) { + url = endPoint; + } else { + url = BASE_URL + endPoint; + } try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getString(APP_LANGUAGE); - var user = await sharedPref.getObject(USER_PROFILE); - if (body.containsKey('SetupID')) { - body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null - ? body['SetupID'] - : SETUP_ID - : SETUP_ID; - } - body['VersionID'] = VERSION_ID; - body['Channel'] = CHANNEL; - body['LanguageID'] = body.containsKey('LanguageID') - ? body['LanguageID'] != null - ? body['LanguageID'] - : languageID == 'ar' - ? 1 - : 2 - : languageID == 'ar' - ? 1 - : 2; - - body['IPAdress'] = IP_ADDRESS; - body['generalid'] = GENERAL_ID; - body['PatientOutSA'] = body.containsKey('PatientOutSA') - ? body['PatientOutSA'] != null - ? body['PatientOutSA'] - : PATIENT_OUT_SA - : PATIENT_OUT_SA; - - if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; - } + if (!isExternal) { + String token = await sharedPref.getString(TOKEN); + var languageID = await sharedPref.getString(APP_LANGUAGE); + var user = await sharedPref.getObject(USER_PROFILE); + if (body.containsKey('SetupID')) { + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; + } + body['VersionID'] = VERSION_ID; + body['Channel'] = CHANNEL; + body['LanguageID'] = body.containsKey('LanguageID') + ? body['LanguageID'] != null + ? body['LanguageID'] + : languageID == 'ar' + ? 1 + : 2 + : languageID == 'en' + ? 2 + : 1; + + body['IPAdress'] = IP_ADDRESS; + body['generalid'] = GENERAL_ID; + body['PatientOutSA'] = body.containsKey('PatientOutSA') + ? body['PatientOutSA'] != null + ? body['PatientOutSA'] + : PATIENT_OUT_SA + : PATIENT_OUT_SA; + + if (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = + body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; + } + + body['DeviceTypeID'] = DeviceTypeID; + + if (!body.containsKey('IsPublicRequest')) { + body['PatientType'] = body.containsKey('PatientType') + ? body['PatientType'] != null + ? body['PatientType'] + : user['PatientType'] != null + ? user['PatientType'] + : PATIENT_TYPE + : PATIENT_TYPE; - body['DeviceTypeID'] = DeviceTypeID; - - if (!body.containsKey('IsPublicRequest')) { - body['PatientType'] = body.containsKey('PatientType') - ? body['PatientType'] != null - ? body['PatientType'] - : user['PatientType'] != null - ? user['PatientType'] - : PATIENT_TYPE - : PATIENT_TYPE; - - body['PatientTypeID'] = body.containsKey('PatientTypeID') - ? body['PatientTypeID'] != null - ? body['PatientTypeID'] - :user['PatientType'] != null - ? user['PatientType'] - : PATIENT_TYPE_ID - : PATIENT_TYPE_ID; - if (user != null) { - body['TokenID'] = token; - body['PatientID'] = - body['PatientID'] != null ? body['PatientID'] : user['PatientID']; - body['PatientOutSA'] = user['OutSA']; - body['SessionID'] = SESSION_ID; //getSessionId(token); + body['PatientTypeID'] = body.containsKey('PatientTypeID') + ? body['PatientTypeID'] != null + ? body['PatientTypeID'] + : user['PatientType'] != null + ? user['PatientType'] + : PATIENT_TYPE_ID + : PATIENT_TYPE_ID; + if (user != null) { + body['TokenID'] = token; + body['PatientID'] = body['PatientID'] != null + ? body['PatientID'] + : user['PatientID']; + body['PatientOutSA'] = user['OutSA']; + body['SessionID'] = SESSION_ID; //getSessionId(token); + } } } @@ -122,6 +132,10 @@ class BaseAppClient { if (parsed['Response_Message'] != null) { onSuccess(parsed, statusCode); } else { + if (parsed['ErrorType'] == 4) { + navigateToAppUpdate( + AppGlobal.context, parsed['ErrorEndUserMessage']); + } if (isAllowAny) { onSuccess(parsed, statusCode); } else if (parsed['IsAuthenticated'] == null) { @@ -163,12 +177,60 @@ class BaseAppClient { } } + Future navigateToAppUpdate(context, String text) async { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => AppUpdatePage(appUpdateText: text))); + } + + get(String endPoint, + {Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + Map queryParams, + bool isExternal = false}) async { + String url; + if (isExternal) { + url = endPoint; + } else { + url = BASE_URL + endPoint; + } + if (queryParams != null) { + String queryString = Uri(queryParameters: queryParams).query; + url += '?' + queryString; + } + + 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); await authenticatedUserObject.getUser(); - Provider.of(AppGlobal.context, listen: false).isLogin = false; - _vitalSignService.weightKg =""; - _vitalSignService.heightCm=""; + Provider.of(AppGlobal.context, listen: false).isLogin = + false; + _vitalSignService.weightKg = ""; + _vitalSignService.heightCm = ""; Navigator.of(AppGlobal.context).pushReplacementNamed(HOME); } diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart new file mode 100644 index 00000000..1f3f9ddd --- /dev/null +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -0,0 +1,29 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class OrderPreviewService extends BaseService{ + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + + List addresses = List(); + + Future getBannerListList() async { + hasError = false; + try { + await baseAppClient.get(GET_CUSTOMERS_ADDRESSES, + onSuccess: (dynamic response, int statusCode) { + addresses.clear(); + response['customers'][0]['addresses'].forEach((item) { + addresses.add(Addresses.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } catch (error) { + throw error; + } + } +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart new file mode 100644 index 00000000..8584e140 --- /dev/null +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -0,0 +1,97 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class PharmacyModuleService extends BaseService { + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + + List bannerItems = List(); + List manufacturerList = List(); + List bestSellerProducts = List(); + List lastVisitedProducts = List(); + + Future getBannerListList() async { + hasError = false; + try { + await baseAppClient.get(GET_PHARMACY_BANNER, + onSuccess: (dynamic response, int statusCode) { + bannerItems.clear(); + response['images'].forEach((item) { + bannerItems.add(PharmacyImageObject.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } catch (error) { + throw error; + } + } + + Future getTopManufacturerList() async { + Map queryParams = {'page': '1', 'limit': '8'}; + try { + await baseAppClient.get(GET_PHARMACY_TOP_MANUFACTURER, + onSuccess: (dynamic response, int statusCode) { + manufacturerList.clear(); + response['manufacturer'].forEach((item) { + manufacturerList.add(Manufacturer.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future getBestSellerProducts() async { + Map queryParams = { + 'fields': + 'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews', + }; + try { + await baseAppClient.get(GET_PHARMACY_BEST_SELLER_PRODUCT, + onSuccess: (dynamic response, int statusCode) { + bestSellerProducts.clear(); + response['products'].forEach((item) { + bestSellerProducts.add(PharmacyProduct.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future getLastVisitedProducts() async { + String lastVisited = ""; + if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != + null) { + lastVisited = + await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + try { + await baseAppClient.get("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", + onSuccess: (dynamic response, int statusCode) { + lastVisitedProducts.clear(); + response['products'].forEach((item) { + lastVisitedProducts.add(PharmacyProduct.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } catch (error) { + throw error; + } + } + } +} diff --git a/lib/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart b/lib/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart new file mode 100644 index 00000000..5bde5a5f --- /dev/null +++ b/lib/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart @@ -0,0 +1,136 @@ +class AddNewAddressRequestModel { + Customer customer; + + AddNewAddressRequestModel({this.customer}); + + AddNewAddressRequestModel.fromJson(Map json) { + customer = json['customer'] != null + ? new Customer.fromJson(json['customer']) + : null; + } + + Map toJson() { + final Map data = new Map(); + if (this.customer != null) { + data['customer'] = this.customer.toJson(); + } + return data; + } +} + +class Customer { + List addresses; + int id; + String email; + List roleIds; + + Customer({this.addresses, this.id, this.email, this.roleIds}); + + Customer.fromJson(Map json) { + if (json['addresses'] != null) { + addresses = new List(); + json['addresses'].forEach((v) { + addresses.add(new Addresses.fromJson(v)); + }); + } + id = json['id']; + email = json['email']; + roleIds = json['role_ids'].cast(); + } + + Map toJson() { + final Map data = new Map(); + if (this.addresses != null) { + data['addresses'] = this.addresses.map((v) => v.toJson()).toList(); + } + data['id'] = this.id; + data['email'] = this.email; + data['role_ids'] = this.roleIds; + return data; + } +} + +class Addresses { + int id; + String firstName; + String lastName; + String email; + Null company; + int countryId; + String country; + Null stateProvinceId; + String city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + Null faxNumber; + String customerAttributes; + String createdOnUtc; + Null province; + String latLong; + + Addresses( + {this.id, + this.firstName, + this.lastName, + this.email, + this.company, + this.countryId, + this.country, + this.stateProvinceId, + this.city, + this.address1, + this.address2, + this.zipPostalCode, + this.phoneNumber, + this.faxNumber, + this.customerAttributes, + this.createdOnUtc, + this.province, + this.latLong}); + + Addresses.fromJson(Map json) { + id = json['id']; + firstName = json['first_name']; + lastName = json['last_name']; + email = json['email']; + company = json['company']; + countryId = json['country_id']; + country = json['country']; + stateProvinceId = json['state_province_id']; + city = json['city']; + address1 = json['address1']; + address2 = json['address2']; + zipPostalCode = json['zip_postal_code']; + phoneNumber = json['phone_number']; + faxNumber = json['fax_number']; + customerAttributes = json['customer_attributes']; + createdOnUtc = json['created_on_utc']; + province = json['province']; + latLong = json['lat_long']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['first_name'] = this.firstName; + data['last_name'] = this.lastName; + data['email'] = this.email; + data['company'] = this.company; + data['country_id'] = this.countryId; + data['country'] = this.country; + data['state_province_id'] = this.stateProvinceId; + data['city'] = this.city; + data['address1'] = this.address1; + data['address2'] = this.address2; + data['zip_postal_code'] = this.zipPostalCode; + data['phone_number'] = this.phoneNumber; + data['fax_number'] = this.faxNumber; + data['customer_attributes'] = this.customerAttributes; + data['created_on_utc'] = this.createdOnUtc; + data['province'] = this.province; + data['lat_long'] = this.latLong; + return data; + } +} diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index bf3404a9..0774e5a7 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -9,14 +9,19 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/cmc_service.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import '../../../locator.dart'; +import 'add_new_address_Request_Model.dart'; class CMCViewModel extends BaseViewModel { CMCService _cMCService = locator(); - + CustomerAddressesService _customerAddressesService = + locator(); + List get addressesList => + _customerAddressesService.addressesList; List get cmcAllServicesList => _cMCService.cmcAllServicesList; @@ -94,7 +99,6 @@ class CMCViewModel extends BaseViewModel { await _cMCService .getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); } - //TODO check it in uat Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { setState(ViewState.Busy); order.createdBy = user.patientID; @@ -107,4 +111,44 @@ class CMCViewModel extends BaseViewModel { getCmcAllPresOrders(); } } + + Future getCustomerAddresses() async { + setState(ViewState.Busy); + await _customerAddressesService.getCustomerAddresses( + ); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future getCustomerInfo() async { + setState(ViewState.Busy); + await _customerAddressesService.getCustomerInfo( + ); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + await getCustomerAddresses(); + } + } + + Future addAddressInfo( + {AddNewAddressRequestModel addNewAddressRequestModel}) async { + + + setState(ViewState.Busy); + await _customerAddressesService.addAddressInfo( + addNewAddressRequestModel: addNewAddressRequestModel + ); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } \ No newline at end of file diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index 031d0a0c..20a19b23 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -8,18 +8,28 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/home_health_care_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:intl/intl.dart'; import '../../../locator.dart'; +import 'add_new_address_Request_Model.dart'; class HomeHealthCareViewModel extends BaseViewModel { HomeHealthCareService _homeHealthCareService = locator(); + CustomerAddressesService _customerAddressesService = + locator(); + List get hhcAllServicesList => _homeHealthCareService.hhcAllServicesList; + + List get addressesList => + _customerAddressesService.addressesList; + List get hhcAllPresOrders => _homeHealthCareService.hhcAllPresOrdersList; @@ -93,5 +103,44 @@ class HomeHealthCareViewModel extends BaseViewModel { } + Future getCustomerAddresses() async { + setState(ViewState.Busy); + await _customerAddressesService.getCustomerAddresses( + ); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future getCustomerInfo() async { + setState(ViewState.Busy); + await _customerAddressesService.getCustomerInfo( + ); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + await getCustomerAddresses(); + } + } + + Future addAddressInfo( + {AddNewAddressRequestModel addNewAddressRequestModel}) async { + + setState(ViewState.Busy); + await _customerAddressesService.addAddressInfo( + addNewAddressRequestModel: addNewAddressRequestModel + ); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + } \ No newline at end of file diff --git a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart index 1972e08f..45adb6d3 100644 --- a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart +++ b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; @@ -18,64 +19,92 @@ class EReferralViewModel extends BaseViewModel { List get relationTypes => _eReferralService.relationTypes; + List get allCities => _eReferralService.allCities; - List get allReferral => _eReferralService.allReferral; + List get allHospitals => + _eReferralService.allProjects; + List get allReferral => + _eReferralService.allReferral; - void getRelationTypes() async { + void getRelationTypes() async { setState(ViewState.Busy); await _eReferralService.getRelationTypes(); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.Error); - } else{ + } else { setState(ViewState.Idle); } } - void getAllCities() async { + + void getAllCities() async { setState(ViewState.Busy); await _eReferralService.getAllCities(); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.Error); - } else{ + } else { setState(ViewState.Idle); } } - void sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { + void getAllProjects() async { + setState(ViewState.Busy); + await _eReferralService.getAllProjects(); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + void sendActivationCodeForEReferral( + SendActivationCodeForEReferralRequestModel + sendActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); - await _eReferralService.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + await _eReferralService.sendActivationCodeForEReferral( + sendActivationCodeForEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); - } else{ + } else { setState(ViewState.Idle); } } - checkActivationCodeForEReferral(CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel) async { + checkActivationCodeForEReferral( + CheckActivationCodeForEReferralResponseModel + checkActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); - await _eReferralService.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); + await _eReferralService.checkActivationCodeForEReferral( + checkActivationCodeForEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); - } else{ + } else { setState(ViewState.Idle); } } - void createEReferral( + Future createEReferral( CreateEReferralRequestModel createEReferralRequestModel) async { + dynamic localRes; setState(ViewState.BusyLocal); - await _eReferralService.createEReferral(createEReferralRequestModel); + await _eReferralService + .createEReferral(createEReferralRequestModel) + .then((response) { + localRes = response; + }); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } + return Future.value(localRes); } getEReferrals(SearchEReferralRequestModel searchEReferralRequestModel) async { diff --git a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart index eebaca02..2559c074 100644 --- a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart +++ b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart @@ -13,7 +13,6 @@ class AddNewChildViewModel extends BaseViewModel { CreteNewBabyService _creteNewBabyService = locator(); ChildVaccinesService _childVaccinesService = locator(); - // DeleteBabyService _deleteBabyService = locator(); bool isAdded = false; ///create new baby createNewBabyOrders({ CreateNewBaby newChild}) async { @@ -25,13 +24,7 @@ class AddNewChildViewModel extends BaseViewModel { } else { isAdded = true; setState(ViewState.Idle); - await _childVaccinesService.getAllBabyInformationOrders(); - if (_childVaccinesService.hasError) { - error = _childVaccinesService.error; - setState(ViewState.Error); - } else{ - } } } diff --git a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart index 7c4af285..a713b6ec 100644 --- a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart +++ b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart @@ -16,14 +16,11 @@ class ChildVaccinesViewModel extends BaseViewModel{ List get babyInformationModelList=> _childVaccinesService.babyInformationModelList; - -//=========== CreteNewBabyService _creteNewBabyService = locator(); DeleteBabyService _deleteBabyService = locator(); bool isAdded = false; bool isDeleted = false; - //============ getNewUserOrders() async { @@ -48,25 +45,15 @@ class ChildVaccinesViewModel extends BaseViewModel{ ///delete baby - deleteBabyOrders({ DeleteBaby newChild}) async { + deleteBabyOrders({ List_BabyInformationModel babyInfo}) async { setState(ViewState.Busy); - //await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID); - await _deleteBabyService.getDeleteBabyOrder(deleteChild: newChild,babyID: newChild.babyID); - //getDeleteBabyOrder(deleteChild: newChild,); - // getDeleteBabyOrder - if (_creteNewBabyService.hasError) { - error = _creteNewBabyService.error; + await _deleteBabyService.getDeleteBabyOrder(babyInfo: babyInfo); + if (_deleteBabyService.hasError) { + error = _deleteBabyService.error; setState(ViewState.Error); } else { isDeleted = true; - setState(ViewState.Idle); - await _childVaccinesService.getAllBabyInformationOrders(); - if (_childVaccinesService.hasError) { - error = _childVaccinesService.error; - setState(ViewState.Error); - } else{ - - } + getBabyInformatioRequestOrders(); } } diff --git a/lib/core/viewModels/child_vaccines/user_information_view_model.dart b/lib/core/viewModels/child_vaccines/user_information_view_model.dart index 43269f42..e183ee42 100644 --- a/lib/core/viewModels/child_vaccines/user_information_view_model.dart +++ b/lib/core/viewModels/child_vaccines/user_information_view_model.dart @@ -8,8 +8,7 @@ class UserInformationViewModel extends BaseViewModel { UserInformationService _userInformationService = locator(); - List get userInformationModelList => - _userInformationService.userInformationModelList; + List_UserInformationModel get userInformationModelList => _userInformationService.userInformationModel; getUserInformationRequestOrders() async { setState(ViewState.Busy); @@ -20,4 +19,15 @@ class UserInformationViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + updateEmail(String email)async{ + setState(ViewState.Busy); + await _userInformationService.updateEmail(email); + await _userInformationService.updateUserInfo(email); + if (_userInformationService.hasError) { + error = _userInformationService.error; + setState(ViewState.Error); + } else + await getUserInformationRequestOrders(); + } } diff --git a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart index 3b72dd50..25559b81 100644 --- a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart +++ b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart @@ -1,30 +1,27 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; -import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; +class VaccinationTableViewModel extends BaseViewModel { + VaccinationTableService _creteVaccinationTableService = + locator(); -class VaccinationTableViewModel extends BaseViewModel{ + List get creteVaccinationTableModelList => + _creteVaccinationTableService.createVaccinationTableModelList; - VaccinationTableService _creteVaccinationTableService = locator(); - - // String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent; - //String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent; - List get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList; - getCreateVaccinationTable() async { + getCreateVaccinationTable({List_BabyInformationModel babyInfo, List_UserInformationModel informationModel, bool isSendEmail =false}) async { setState(ViewState.Busy); - await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders(); - - if ( _creteVaccinationTableService.hasError) { - error = _creteVaccinationTableService.error; + await _creteVaccinationTableService.getCreateVaccinationTableOrders(babyInfo: babyInfo,informationModel: informationModel,isSendEmail: isSendEmail); + if (_creteVaccinationTableService.hasError) { + error = _creteVaccinationTableService.error; setState(ViewState.Error); } else setState(ViewState.Idle); } - } diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart new file mode 100644 index 00000000..00f4819b --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -0,0 +1,8 @@ +import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class OrderPreviewViewModel extends BaseViewModel { + OrderPreviewService _orderService = locator(); +} diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart new file mode 100644 index 00000000..f8c574f7 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -0,0 +1,73 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + +import '../../../locator.dart'; + +class PharmacyModuleViewModel extends BaseViewModel { + PharmacyModuleService _pharmacyService = locator(); + + List get bannerList => _pharmacyService.bannerItems; + + List get manufacturerList => _pharmacyService.manufacturerList; + + List get bestSellerProduct => + _pharmacyService.bestSellerProducts; + + List get lastVisitedProducts => + _pharmacyService.lastVisitedProducts; + + Future getPharmacyHomeData() async { + setState(ViewState.Busy); + await _pharmacyService.getBannerListList(); + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.Error); + } else { + _getTopManufacturerList(); + } + } + + List getBannerImagesUrl() { + List images = List(); + images.add('assets/images/pharmacy_module/pharmacy_logo_green.png'); + _pharmacyService.bannerItems.forEach((element) { + images.add(element.src); + }); + + return images; + } + + _getTopManufacturerList() async { + await _pharmacyService.getTopManufacturerList(); + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.Error); + } else { + _getBestSellerProducts(); + } + } + + _getBestSellerProducts() async { + await _pharmacyService.getBestSellerProducts(); + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.Error); + } else { + _getLastVisitedProducts(); + } + } + + _getLastVisitedProducts() async { + await _pharmacyService.getLastVisitedProducts(); + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 310558f2..bccf8f22 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:get_it/get_it.dart'; import 'core/service/AlHabibMedicalService/cmc_service.dart'; +import 'core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'core/service/AlHabibMedicalService/e_referral_service.dart'; import 'core/service/AlHabibMedicalService/home_health_care_service.dart'; import 'core/service/AuthenticatedUserObject.dart'; @@ -44,8 +45,11 @@ 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/parmacyModule/order-preview-service.dart'; import 'core/service/notifications_service.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; +import 'core/service/parmacyModule/parmacy_module_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'; @@ -82,6 +86,8 @@ 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/pharmacyModule/OrderPreviewViewModel.dart'; +import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'core/viewModels/qr_view_model.dart'; import 'core/viewModels/vaccine_view_model.dart'; import 'core/service/vaccine_service.dart'; @@ -135,6 +141,9 @@ void setupLocator() { locator.registerLazySingleton(() => VaccinationTableService()); locator.registerLazySingleton(() => NotificationService()); locator.registerLazySingleton(() => WeatherService()); + locator.registerLazySingleton(() => PharmacyModuleService()); + locator.registerLazySingleton(() => OrderPreviewService()); + locator.registerLazySingleton(() => CustomerAddressesService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -174,8 +183,12 @@ void setupLocator() { locator.registerFactory(() => EyeViewModel()); locator.registerFactory(() => ActiveMedicationsViewModel()); locator.registerFactory(() => AskDoctorViewModel()); + locator.registerFactory(() => AllergiesViewModel()); locator.registerFactory(() => HomeHealthCareViewModel()); locator.registerFactory(() => CMCViewModel()); locator.registerFactory(() => NotificationViewModel()); + + locator.registerFactory(() => PharmacyModuleViewModel()); + locator.registerFactory(() => OrderPreviewViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index b93aa83e..218fbf07 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -63,7 +63,7 @@ class MyApp extends StatelessWidget { const Locale('ar', ''), // Arabic const Locale('en', ''), // English ], - //theme: themeNotifier.getTheme(), + // theme: themeNotifier.getTheme(), theme:ThemeData( fontFamily:projectProvider.isArabic ? 'Cairo' : 'WorkSans', primarySwatch: Colors.blue, @@ -76,26 +76,31 @@ class MyApp extends StatelessWidget { }, ), hintColor: Colors.grey[400], + textTheme: TextTheme( + headline1: TextStyle( + color: Color(0xffB8382C), + ), + ), disabledColor: Colors.grey[300], errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffEEEEEE), + scaffoldBackgroundColor: Color(0xffE9E9E9), // Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, - backgroundColor: Colors.white, + backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Color(0xff40ACC9), - bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + primaryColor: Colors.grey, + bottomSheetTheme: BottomSheetThemeData( + backgroundColor: HexColor('#E0E0E0')), cursorColor: Colors.grey, - cardColor: Colors.white, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( - color: Color(0xff40ACC9), - brightness: Brightness.dark, - elevation: 10.0, + color: Colors.grey[700], + brightness: Brightness.light, + elevation: 0.0, actionsIconTheme: IconThemeData( - color: Color(0xff40ACC9), + color: Colors.grey[800], ), ), ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart new file mode 100644 index 00000000..ee32bcb6 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -0,0 +1,147 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:provider/provider.dart'; + +class CMCLocationPage extends StatefulWidget { + final Function(PickResult) onPick; + final double latitude; + final double longitude; + final dynamic model; + + const CMCLocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) + : super(key: key); + + @override + _CMCLocationPageState createState() => + _CMCLocationPageState(); +} + +class _CMCLocationPageState + extends State { + double latitude = 0; + double longitude = 0; + + @override + void initState() { + + latitude = widget.latitude; + longitude = widget.longitude; + super.initState(); + } + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) {}, + builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + print(selectedPlace); + AddNewAddressRequestModel + addNewAddressRequestModel = + new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: + selectedPlace.formattedAddress, + address2: selectedPlace + .formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "$latitude,$longitude", + email: "") + ]), + ); + + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer + .addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer + .addresses[0].zipPostalCode = + e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer + .addresses[0].city = + e.longName; + } + }); + + await model.addAddressInfo( + addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast( + message: "Address Added Successfully"); + } + Navigator.of(context).pop(); + }, + label: " Add New Address ", + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + )); + } +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index 532396cc..cedd4018 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -134,7 +134,7 @@ class _NewCMCPageState extends State children: [ widget.model.cmcAllOrderDetail.length != 0 ? FractionallySizedBox( - heightFactor: 0.8, + heightFactor: 0.9, widthFactor: 0.9, child: Container( width: double.infinity, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index 02d099b4..7da00dee 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -199,26 +201,42 @@ class _NewCMCStepOnePageState extends State { child: SecondaryButton( label: "Next", textColor: Theme.of(context).backgroundColor, - onTap: () { - if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length = null) { + color: Colors.grey[800], + onTap: () async { + if (widget.cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList.length != + 0 || + widget.cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList == + null) { int index = widget.model.cmcAllServicesList.length; PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( - price: widget.model.cmcAllServicesList[index-1].price, - serviceID: widget.model.cmcAllServicesList[index-1].serviceID.toString(), - selectedServiceName: widget.model.cmcAllServicesList[index-1].description, - selectedServiceNameAR: widget.model.cmcAllServicesList[index-1].description, + price: widget + .model.cmcAllServicesList[index - 1].price, + serviceID: widget + .model.cmcAllServicesList[index - 1].serviceID + .toString(), + selectedServiceName: widget.model + .cmcAllServicesList[index - 1].description, + selectedServiceNameAR: widget.model + .cmcAllServicesList[index - 1].description, recordID: 1, - totalPrice: widget.model.cmcAllServicesList[index-1].totalPrice, + totalPrice: widget + .model.cmcAllServicesList[index - 1].totalPrice, vAT: widget.model.cmcAllServicesList[index-1].vAT); widget.cMCInsertPresOrderRequestModel .patientERCMCInsertServicesList = [ patientERCMCInsertServicesList ]; - - widget.changePageViewIndex(1); + await widget.model.getCustomerInfo(); + if(widget.model.state == ViewState.ErrorLocal){ + Utils.showErrorToast(); + } else { + widget.changePageViewIndex(1); + } } }, ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index e48bb5d5..893fbfa9 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -149,6 +149,7 @@ class _NewCMCStepThreePageState width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( label: "Confirm", + color: Colors.grey[800], onTap: () async { await widget.model.insertPresPresOrder(order: widget.cmcInsertPresOrderRequestModel); if (widget.model.state != ViewState.ErrorLocal) { 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 27cddfe3..c1ec952f 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 @@ -1,19 +1,22 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; +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/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/close_back.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; +import 'cmc_location_page.dart'; + class NewCMCStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; @@ -41,12 +44,13 @@ class _NewCMCStepTowPageState extends State { double latitude = 0; double longitude = 0; + AddressInfo _selectedAddress; + @override void initState() { if (widget.cmcInsertPresOrderRequestModel.latitude == null) { - latitude = widget.latitude; - longitude = widget.longitude; + setLatitudeAndLongitude(); } else { latitude = widget.cmcInsertPresOrderRequestModel.latitude; longitude = widget.cmcInsertPresOrderRequestModel.longitude; @@ -54,60 +58,152 @@ class _NewCMCStepTowPageState 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(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + } @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( + return AppScaffold( isShowDecPage: false, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.cmcInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.cmcInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).next, - ), + body: Stack( + children: [ + PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + + onPlacePicked: (PickResult result) { + print(result.adrAddress); + widget.changePageViewIndex(3); + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + CMCLocationPage( + latitude: latitude, + longitude: longitude, + + ), + ), + ); + }, + label: " Add New Address ", + ), + SizedBox(height: 10,), + SecondaryButton( + color: Colors.red + [800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.cmcInsertPresOrderRequestModel + .latitude = + selectedPlace.geometry.location.lat; + widget.cmcInsertPresOrderRequestModel + .longitude = + selectedPlace.geometry.location.lng; + }); + widget.changePageViewIndex(3); + }, + label: TranslationBase.of(context).confirm, ), - ); + ], + ) + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + Container( + child: InkWell( + onTap: () => + confirmSelectLocationDialog(widget.model.addressesList), + child: Container( + padding: EdgeInsets.all(10), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getAddressName(), fontSize: 14,),), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + height: 56, width: double.infinity, color: Theme + .of(context) + .scaffoldBackgroundColor, + + ) + ], + ), + ); + + + } + + + void confirmSelectLocationDialog(List addresses) { + showDialog( + context: context, + child: SelectLocationDialog( + addresses: addresses, + selectedAddress: _selectedAddress + , + onValueSelected: (value) { + setLatitudeAndLongitude(latLong: value.latLong); + setState(() { + _selectedAddress = value; + }); }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: true, ), ); } + + String getAddressName() { + if (_selectedAddress != null) + return _selectedAddress.address1; + else + return "Select Address" /*TranslationBase.of(context).selectHospital*/; + } } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart deleted file mode 100644 index e8e9eccc..00000000 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_index_page.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'cmc_page.dart'; - -class CMCIndexPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).serviceInformation, - body: SingleChildScrollView( - padding: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "CMC", - fontWeight: FontWeight.normal, - fontSize: 25, - color: Color(0xff60686b), - ), - SizedBox( - height: 12, - ), - Texts( - "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.", - fontWeight: FontWeight.normal, - fontSize: 17, - ), - SizedBox( - height: 22, - ), - Center( - child: Image.asset( - 'assets/images/AlHabibMedicalService/Wifi-AR.png')), - SizedBox( - height: 77, - ), - ], - )), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () => Navigator.push( - context, - FadePage( - page: CMCPage(), - ), - ), - label: "CMC", - textColor: Theme.of(context).backgroundColor), - ), - ], - ), - )); - } -} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index 385d0da3..04d8ea36 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -40,7 +40,8 @@ class _CMCPageState extends State }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).homeHealthCare, + description: TranslationBase.of(context).HHCNotAuthMsg, + appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart index fb2b94c6..2cb179b8 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart @@ -40,34 +40,32 @@ class _StartIndexForNewEReferralState extends State @override Widget build(BuildContext context) { return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.9, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - NewEReferralStepOnePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepTowPage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepThreePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - ], - ), + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.9, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + NewEReferralStepOnePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepTowPage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepThreePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + ], ), ), ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index 62799c6d..db549626 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -6,28 +6,29 @@ import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - class NewEReferralStepOnePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepOnePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); + const NewEReferralStepOnePage( + {Key key, this.createEReferralRequestModel, this.changePageViewIndex}) + : super(key: key); @override - _NewEReferralStepOnePageState createState() => _NewEReferralStepOnePageState(); + _NewEReferralStepOnePageState createState() => + _NewEReferralStepOnePageState(); } class _NewEReferralStepOnePageState extends State { @@ -64,27 +65,25 @@ class _NewEReferralStepOnePageState extends State { context: context, barrierDismissible: false, child: EReferralConfirmSMSDialog( - phoneNumber: _selectedCountry['code']+_mobileTextController.text, - onSucces: (){ - Navigator.of(context).pop(); - widget.changePageViewIndex(1); - widget.createEReferralRequestModel.requesterName=_nameTextController.text; - widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text; - widget.createEReferralRequestModel.requesterRelationship=_selectedRelation.iD; - - - } - - - ), + phoneNumber: _selectedCountry['code'] + _mobileTextController.text, + onSucces: () { + Navigator.of(context).pop(); + widget.changePageViewIndex(1); + widget.createEReferralRequestModel.requesterName = + _nameTextController.text; + widget.createEReferralRequestModel.requesterContactNo = + _selectedCountry['code'].toString().substring(1) + + _mobileTextController.text; + widget.createEReferralRequestModel.requesterRelationship = + _selectedRelation.iD; + }), ).then((value) { print("dialog dismissed"); print(value); - if (value != null && value) { - - } + if (value != null && value) {} }); } + return BaseView( onModelReady: (model) => model.getRelationTypes(), builder: (_, model, widget) => AppScaffold( @@ -92,7 +91,7 @@ class _NewEReferralStepOnePageState extends State { body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.all(12), + margin: EdgeInsets.all(10), child: Center( child: FractionallySizedBox( widthFactor: 0.9, @@ -100,11 +99,10 @@ class _NewEReferralStepOnePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 20, + height: 80, ), Center( child: Texts( -// TranslationBase.of(context).advancePaymentLabel, "Referral requester information", textAlign: TextAlign.center, ), @@ -185,34 +183,30 @@ class _NewEReferralStepOnePageState extends State { ), ), bottomSheet: Container( - height: MediaQuery - .of(context) - .size - .height * 0.1, + height: MediaQuery.of(context).size.height * 0.1, width: double.infinity, padding: EdgeInsets.all(9), child: SecondaryButton( textColor: Colors.white, label: "Next", - onTap: () async { - SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel = - SendActivationCodeForEReferralRequestModel( + onTap: () async { + SendActivationCodeForEReferralRequestModel + sendActivationCodeForEReferralRequestModel = + SendActivationCodeForEReferralRequestModel( zipCode: _selectedCountry['code'], - patientMobileNumber: int.parse( - _mobileTextController.text),); - await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + patientMobileNumber: int.parse(_mobileTextController.text), + ); + await model.sendActivationCodeForEReferral( + sendActivationCodeForEReferralRequestModel); showSMSDialog(); }, loading: model.state == ViewState.BusyLocal, - disabled: - _nameTextController.text.isEmpty || + disabled: _nameTextController.text.isEmpty || _selectedRelation == null || _mobileTextController.text.isEmpty, ), ))); - - } void confirmSelectRelationTypeDialog( @@ -261,12 +255,8 @@ class _NewEReferralStepOnePageState extends State { } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled({ - Key key, - this.controller, - this.code - }) : super(key: key); - + const MobileNumberTextFiled({Key key, this.controller, this.code}) + : super(key: key); final TextEditingController controller; final String code; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart index d84b9d61..cb9f03df 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -1,21 +1,23 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import '../dialogs/select_city_dialog.dart'; - class NewEReferralStepThreePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; @@ -32,7 +34,8 @@ class NewEReferralStepThreePage extends StatefulWidget { class _NewEReferralStepThreePageState extends State { TextEditingController _nameTextController = TextEditingController(); TextEditingController _mobileTextController = TextEditingController(); - GetAllCitiesResponseModel _selectedCity; + + GetAllProjectsResponseModel _selectedHospital; GetAllSharedRecordsByStatusList selectedPatientFamily; List medicalReportImages = []; @@ -50,6 +53,7 @@ class _NewEReferralStepThreePageState extends State { @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model) => model.getAllProjects(), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( @@ -64,7 +68,7 @@ class _NewEReferralStepThreePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 20, + height: 80, ), Center( child: Texts( @@ -103,8 +107,13 @@ class _NewEReferralStepThreePageState extends State { ImageOptions.showImageOptions(context, (String image) { setState(() { - EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${ medicalReportImages.length +1}.png',base64String: image ); - medicalReportImages.add(eReferralAttachment); + EReferralAttachment eReferralAttachment = + new EReferralAttachment( + fileName: + 'image ${medicalReportImages.length + 1}.png', + base64String: image); + medicalReportImages + .add(eReferralAttachment); }); }); }, @@ -158,15 +167,17 @@ class _NewEReferralStepThreePageState extends State { width: 8, ), Texts( - medicalReportImages[index].fileName, + medicalReportImages[index] + .fileName, ), ], ), InkWell( onTap: () { setState(() { - medicalReportImages - .remove(medicalReportImages[index]); + medicalReportImages.remove( + medicalReportImages[ + index]); }); }, child: Icon( @@ -205,7 +216,7 @@ class _NewEReferralStepThreePageState extends State { ), InkWell( onTap: () => - confirmSelectCityDialog(model.allCities), + confirmSelectHospital(model.allHospitals), child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -262,12 +273,12 @@ class _NewEReferralStepThreePageState extends State { ], ), ), - if(isPatientInsured) - SizedBox( - height: 12, - ), + if (isPatientInsured) + SizedBox( + height: 12, + ), Opacity( - opacity: isPatientInsured?1:0, + opacity: isPatientInsured ? 1 : 0, child: Container( padding: EdgeInsets.only(top: 10), decoration: BoxDecoration( @@ -276,16 +287,21 @@ class _NewEReferralStepThreePageState extends State { ), child: Column( children: [ - InkWell( onTap: () { ImageOptions.showImageOptions(context, (String image) { setState(() { + EReferralAttachment + eReferralAttachment = + new EReferralAttachment( + fileName: + 'image ${medicalReportImages.length + 1}.png', + base64String: image); - EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${ medicalReportImages.length +1}.png',base64String: image ); - - insuredPatientImages=[eReferralAttachment]; + insuredPatientImages = [ + eReferralAttachment + ]; }); }); }, @@ -333,8 +349,8 @@ class _NewEReferralStepThreePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - FontAwesomeIcons.paperclip), + Icon(FontAwesomeIcons + .paperclip), SizedBox( width: 8, ), @@ -346,8 +362,9 @@ class _NewEReferralStepThreePageState extends State { InkWell( onTap: () { setState(() { - insuredPatientImages - .remove(insuredPatientImages[index]); + insuredPatientImages.remove( + insuredPatientImages[ + index]); }); }, child: Icon( @@ -378,50 +395,72 @@ class _NewEReferralStepThreePageState extends State { textColor: Colors.white, label: "Submit", onTap: () async { - this.widget.createEReferralRequestModel.medicalReportAttachment = medicalReportImages; - this.widget.createEReferralRequestModel.insuranceCardAttachment = insuredPatientImages.length !=0?insuredPatientImages[0]:null; - this.widget.createEReferralRequestModel.isInsuredPatient = isPatientInsured; + this + .widget + .createEReferralRequestModel + .medicalReportAttachment = medicalReportImages; + this + .widget + .createEReferralRequestModel + .insuranceCardAttachment = + insuredPatientImages.length != 0 + ? insuredPatientImages[0] + : null; + this.widget.createEReferralRequestModel.isInsuredPatient = + isPatientInsured; // ToDo make the preferred Branch info dynamic - this.widget.createEReferralRequestModel.preferredBranchCode = 15; - this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; - + this.widget.createEReferralRequestModel.preferredBranchCode = + _selectedHospital.iD; + this.widget.createEReferralRequestModel.preferredBranchName = + _selectedHospital.desciption; + this.widget.createEReferralRequestModel.otherRelationship = + ""; - // this.widget.createEReferralRequestModel.fullName= ""; - this.widget.createEReferralRequestModel.otherRelationship= ""; - // this.widget.createEReferralRequestModel.; - // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; - // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; - - await model.createEReferral(this.widget.createEReferralRequestModel); + await model + .createEReferral(this.widget.createEReferralRequestModel) + .then((value) { + AlertDialogBox( + context: context, + confirmMessage: + TranslationBase.of(context).ereferralSaveSuccess + + value['ReferralNumber'].toString(), + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + navigateToHome(context); + }).showAlertDialog(context); + }); }, loading: model.state == ViewState.BusyLocal, - disabled: medicalReportImages.length == 0 , + disabled: medicalReportImages.length == 0, ), ))); } - void confirmSelectCityDialog(List cities) { + Future navigateToHome(context) async { + Navigator.of(context).popAndPushNamed(HOME); + } + + void confirmSelectHospital(List projects) { showDialog( context: context, - child: SelectCityDialog( - cities: cities, - selectedCity: _selectedCity, + child: SelectHospitalDialog( + hospitals: projects, + selectedHospital: _selectedHospital, onValueSelected: (value) { setState(() { - _selectedCity = value; + _selectedHospital = value; }); }, ), ); } - String getRelationName() { - if (_selectedCity != null) - return _selectedCity.description; + if (_selectedHospital != null) + return _selectedHospital.desciption; else - return "Select Relationship" /*TranslationBase.of(context).selectHospital*/; + return "Select Hospital*" /*TranslationBase.of(context).selectHospital*/; } - } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index 5f85fe12..34616def 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -71,7 +71,7 @@ class _NewEReferralStepTowPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 30, + height: 80, ), Center( child: Texts( diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart new file mode 100644 index 00000000..3a3cc083 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class SelectHospitalDialog extends StatefulWidget { + + final List hospitals; + final Function(GetAllProjectsResponseModel) onValueSelected; + GetAllProjectsResponseModel selectedHospital; + + SelectHospitalDialog( + {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + + @override + _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); +} + +class _SelectHospitalDialogState extends State { + + @override + void initState() { + super.initState(); + widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.hospitals.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedHospital = widget.hospitals[index]; + }); + }, + child: ListTile( + title: Text(widget.hospitals[index].desciption), + leading: Radio( + value: widget.hospitals[index], + groupValue: widget.selectedHospital, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedHospital = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedHospital); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart index 9f836860..f50e67fa 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -88,13 +88,13 @@ class _EReferralPageState extends State Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts("New Referral"), + child: Texts("New Referral", fontSize: 14.0), ), ), Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts("Search for Referrals"), + child: Texts("Search for Referrals", fontSize: 14.0), ), ), ], diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart new file mode 100644 index 00000000..8592cb34 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -0,0 +1,145 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:provider/provider.dart'; + +class LocationPage extends StatefulWidget { + final Function(PickResult) onPick; + final double latitude; + final double longitude; + final dynamic model; + + const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) + : super(key: key); + + @override + _LocationPageState createState() => + _LocationPageState(); +} + +class _LocationPageState + extends State { + double latitude = 0; + double longitude = 0; + + @override + void initState() { + + latitude = widget.latitude; + longitude = widget.longitude; + super.initState(); + } + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) {}, + builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + AddNewAddressRequestModel + addNewAddressRequestModel = + new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: + selectedPlace.formattedAddress, + address2: selectedPlace + .formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "$latitude,$longitude", + email: "") + ]), + ); + + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer + .addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer + .addresses[0].zipPostalCode = + e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer + .addresses[0].city = + e.longName; + } + }); + + await model.addAddressInfo( + addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast( + message: "Address Added Successfully"); + } + Navigator.of(context).pop(); + }, + label: " Add New Address ", + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + )); + } +} diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 1dbee1b5..bc5a4a99 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -138,9 +139,17 @@ class _NewHomeHealthCareStepOnePageState extends State { double latitude = 0; double longitude = 0; + AddressInfo _selectedAddress; @override void initState() { if (widget.patientERInsertPresOrderRequestModel.latitude == null) { - latitude = widget.latitude; - longitude = widget.longitude; + setLatitudeAndLongitude(); } else { latitude = widget.patientERInsertPresOrderRequestModel.latitude; longitude = widget.patientERInsertPresOrderRequestModel.longitude; } + 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(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.patientERInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.patientERInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).next, - ), - ), - ); + body: Stack( + children: [ + PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + + onPlacePicked: (PickResult result) { + print(result.adrAddress); + widget.changePageViewIndex(3); + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + LocationPage( + latitude: latitude, + longitude: longitude, + ), + ), + ); + }, + label: " Add New Address ", + ), + SizedBox(height: 10,), + SecondaryButton( + color: Colors.red[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientERInsertPresOrderRequestModel + .latitude = + selectedPlace.geometry.location.lat; + widget.patientERInsertPresOrderRequestModel + .longitude = + selectedPlace.geometry.location.lng; + }); + widget.changePageViewIndex(3); + }, + label: " Continue ", + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + Container( + child: InkWell( + onTap: () => + confirmSelectLocationDialog(widget.model.addressesList), + child: Container( + padding: EdgeInsets.all(10), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Texts(getAddressName(), fontSize: 14,),), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + height: 56, width: double.infinity, color: Theme + .of(context) + .scaffoldBackgroundColor, + + ) + ], + ), + ); + } + + + void confirmSelectLocationDialog(List addresses) { + showDialog( + context: context, + child: SelectLocationDialog( + addresses: addresses, + selectedAddress: _selectedAddress + , + onValueSelected: (value) { + setLatitudeAndLongitude(latLong: value.latLong); + setState(() { + _selectedAddress = value; + }); }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: true, ), ); } + + String getAddressName() { + if (_selectedAddress != null) + return _selectedAddress.address1; + else + return "Select Address" /*TranslationBase.of(context).selectHospital*/; + } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart deleted file mode 100644 index fa0799f9..00000000 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart +++ /dev/null @@ -1,69 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -import 'home_health_care_page.dart'; - -class HomeHealthCareIndexPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).serviceInformation, - body: SingleChildScrollView( - padding: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).homeHealthCare, - fontWeight: FontWeight.normal, - fontSize: 25, - color: Color(0xff60686b), - ), - SizedBox( - height: 12, - ), - Texts( - TranslationBase.of(context).homeHealthCareText, - fontWeight: FontWeight.normal, - fontSize: 17, - ), - SizedBox( - height: 22, - ), - Center( - child: Image.asset( - 'assets/images/AlHabibMedicalService/Wifi-AR.png')), - SizedBox( - height: 77, - ), - ], - )), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () => Navigator.push( - context, - FadePage( - page: HomeHealthCarePage(), - ), - ), - label: TranslationBase.of(context).loginRegister, - textColor: Theme.of(context).backgroundColor), - ), - ], - ), - )); - } -} diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart index 8f4821f6..c249362b 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -42,7 +42,9 @@ class _HomeHealthCarePageState extends State }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + description: TranslationBase.of(context).HHCNotAuthMsg, appBarTitle: TranslationBase.of(context).homeHealthCare, + // appBarTitle: TranslationBase.of(context).homeHealthCare, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 766bd616..77d536e1 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -152,6 +152,16 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/my_file_bottom_bar.png', title: TranslationBase.of(context).myMedicalFile, ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: LiveCareHome(), + ), + ), + imageLocation: 'assets/images/new-design/liveCare_ar_bg.png', + title: TranslationBase.of(context).livecare, + ), ServicesContainer( onTap: () => Navigator.push( context, @@ -176,6 +186,15 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).onlinePaymentService, ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(), + ), + imageLocation: + 'assets/images/al-habib_online_payment_service_icon.png', + title: 'Covid-19- Drive-Thru Test', + ), ServicesContainer( onTap: () { Navigator.push( @@ -190,6 +209,37 @@ class _AllHabibMedicalServiceState extends State { imageLocation: 'assets/images/emergency_service_image.png', title: TranslationBase.of(context).emergencyService, ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: ParkingPage(), + ), + ), + imageLocation: 'assets/images/pharmacy_logo.png', + title: 'Pharmacy'), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: InsuranceUpdate(), + ), + ), + imageLocation: + 'assets/images/medical/insurance_card_icon.png', + title: TranslationBase.of(context).updateInsurance, + ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: authUser.patientID == null + ? EReferralIndexPage() + : EReferralPage()), + ), + imageLocation: 'assets/images/ereferral_service_icon.png', + title: 'E-Referral', + ), ServicesContainer( onTap: () => Navigator.push( context, @@ -201,6 +251,15 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/family_menu_icon_red.png', title: 'My Family', ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: ChildVaccinesPage()), + ), + imageLocation: + 'assets/images/new-design/children_vaccines_icon.png', + title: 'Child Vaccines', + ), ServicesContainer( onTap: () => Navigator.push( context, @@ -212,6 +271,61 @@ class _AllHabibMedicalServiceState extends State { 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: SymptomInfo()), + ), + imageLocation: 'assets/images/new-design/body_icon.png', + title: 'Symptom Checker'), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: BloodDonationPage()), + ), + imageLocation: 'assets/images/new-design/blood_icon.png', + title: 'Blood Donation', + ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: (HealthCalculators()), + ), + ), + imageLocation: + 'assets/images/new-design/health_calculator_icon.png', + title: 'Health Calculators', + ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: HealthConverter(), + ), + ), + imageLocation: + 'assets/images/new-design/health_convertor_icon.png', + title: 'Health Converter', + ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: H2OPageIndexPage(), + ), + ), + imageLocation: 'assets/images/new-design/water_icon.png', + title: 'H2O', + ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(), + ), + imageLocation: 'assets/images/new-design/smartwatch_icon.png', + title: TranslationBase.of(context).smartWatches, + ), ServicesContainer( onTap: () => Navigator.push( context, diff --git a/lib/pages/ChildVaccines/ChidDetailsWidget.dart b/lib/pages/ChildVaccines/ChidDetailsWidget.dart new file mode 100644 index 00000000..c06c5422 --- /dev/null +++ b/lib/pages/ChildVaccines/ChidDetailsWidget.dart @@ -0,0 +1,120 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; + +import 'dialogs/delete_child.dart'; + +class ChildDetailsWidget extends StatelessWidget { + final ChildVaccinesViewModel model; + final List_BabyInformationModel babyInfo; + final List_UserInformationModel informationModel; + final Function onTapDelete; + + ChildDetailsWidget({this.model, this.babyInfo, this.informationModel, this.onTapDelete}); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: (){ + Navigator.push( + context, + FadePage( + page: VaccinationTablePage( + babyInfo: babyInfo, + informationModel: informationModel, + ), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(left: 5, right: 5, bottom: 10), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(color: Colors.white, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.white, + ), + padding: EdgeInsets.all(12), + width: 200, + //double.infinity, + child: Column( + children: [ + Row(children: [ + Texts(TranslationBase.of(context).childName), + ]), + Row(children: [ + Texts(babyInfo.babyName.trim()), + ]), + Row(children: [ + IconButton( + icon: Image.asset(babyInfo.gender == 1 + ? 'assets/images/new-design/male.png' + : 'assets/images/new-design/female.png'), + tooltip: '', + onPressed: () { + }, + ), + Texts(babyInfo.genderDescription), + IconButton( + icon: Icon( + Icons.remove_red_eye, + color: Colors.red, + ), + tooltip: '', + onPressed: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage( + babyInfo: babyInfo, + informationModel: informationModel, + ), + ), + ); + }, + ) + ]), + Row(children: [ + Texts(TranslationBase.of(context).childDob), + ]), + Row( + children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/calender-secondary.png'), + tooltip: '', + ), + Texts( + DateUtil.yearMonthDay(babyInfo.dOB), + ), + ], + ), + Row(children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: () async { + onTapDelete(); + }, + ), + Texts(TranslationBase.of(context).delete), + ]), + SizedBox( + height: 12, + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index 51b89f98..10dea666 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -21,39 +22,16 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; enum Gender { Male, Female, NON } -enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } class AddNewChildPage extends StatefulWidget { - final int frequency; - final int days; - final String itemDescription; String dateAdd; - List _scheduleList = List(); - List daysOfWeek = [ - DayOfWeek.Monday, - DayOfWeek.Tuesday, - DayOfWeek.Wednesday, - DayOfWeek.Thursday, - DayOfWeek.Friday, - DayOfWeek.Saturday, - DayOfWeek.Sunday - ]; - DateTime startDay; DateTime endDay; - //AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key); - AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) { + AddNewChildPage() { startDay = DateTime.now(); - endDay = - DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); - int hour = 24; //(24 / frequency).round(); - int durations = 24 ~/ hour; - for (int count = 0; count < durations; count++) { - _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, (hour * count))); - } + endDay = DateTime.now(); } @override @@ -61,150 +39,140 @@ class AddNewChildPage extends StatefulWidget { } class _AddNewChildPageState extends State { - int tappedIndex; int checkedValue; - @override - void initState() { - super.initState(); - tappedIndex = -1; - } - TextEditingController _firstTextController = TextEditingController(); TextEditingController _secondTextController = TextEditingController(); - TextEditingController _notesTextController = TextEditingController(); - BeneficiaryType beneficiaryType = BeneficiaryType.NON; Gender gender = Gender.Male; CreateNewUser_New newUserChild = CreateNewUser_New(); - //ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel(); - List_BabyInformationModel addvancedModel = List_BabyInformationModel(); CreateNewBaby newChild = CreateNewBaby(); - List_UserInformationModel informationModel = List_UserInformationModel(); + + String firstName = ""; + String secondName = ""; @override Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: "Vaccintion", + appBarTitle: TranslationBase.of(context).vaccination, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( margin: EdgeInsets.all(12), child: Column( - // crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 50, - ), - Texts( - "Add the child's information below to recieve the schedule of vaccinations.", - //+model.user.firstName, - textAlign: TextAlign.center, + height: 25, ), + Texts(TranslationBase.of(context).addInstructions), SizedBox( - height: 12, + height: 20, ), NewTextFields( - hintText: "First Name", + hintText: TranslationBase.of(context).firstName, controller: _firstTextController, + onChanged: (value) { + setState(() { + firstName = value; + }); + }, ), SizedBox( height: 12, ), NewTextFields( - hintText: "Second Name", + hintText: TranslationBase.of(context).lastName, controller: _secondTextController, + onChanged: (value) { + secondName = value; + }, ), SizedBox( - height: 12, + height: 20, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Gender:", + TranslationBase.of(context).gender + " :", textAlign: TextAlign.end, ), ], ), + SizedBox( + height: 15, + ), Container( - height: MediaQuery.of(context).size.height * 0.12, + height: 60, width: double.infinity, - padding: EdgeInsets.all(12), - - child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: 175, - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 1 ? Colors.white : Colors.black, - color: checkedValue == 1 ? Colors.red : Colors.white, - - label: "Male", - // - onTap: () { - - setState(() { - checkedValue = 1; - print("checkedValue=" + checkedValue.toString()); - }); - - // bloodDetails. - }, + Expanded( + child: AnimatedContainer( + duration: Duration(milliseconds: 400), + height: 60, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 1 ? Colors.white : Colors.black, + color: + checkedValue == 1 ? Colors.red : Colors.white, + label: TranslationBase.of(context).male, + onTap: () { + setState(() { + checkedValue = 1; + }); + }, + ), ), ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: 175, - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 2 ? Colors.white : Colors.black, - color: checkedValue == 2 ? Colors.red : Colors.white, - label: "Female", - // - onTap: () { - setState(() { - checkedValue = 2; - print("checkedValue=" + checkedValue.toString()); - }); - // bloodDetails.city=_selectedHospital.toString(); - - // bloodDetails. - }, + Expanded( + child: AnimatedContainer( + duration: Duration(milliseconds: 400), + height: 60, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 2 ? Colors.white : Colors.black, + color: + checkedValue == 2 ? Colors.red : Colors.white, + label: TranslationBase.of(context).female, + onTap: () { + setState(() { + checkedValue = 2; + }); + }, + ), ), ) ], ), ), - //========== SizedBox( - height: 6, + height: 20, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Date Of Birth::", + TranslationBase.of(context).dob + " :", textAlign: TextAlign.end, ), ], ), + SizedBox( + height: 8, + ), InkWell( onTap: () { DatePicker.showDatePicker( context, showTitleActions: true, - // minTime: DateTime( - // DateTime.now().year, DateTime.now().month - 1, 1), minTime: DateTime(1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { @@ -213,7 +181,6 @@ class _AddNewChildPageState extends State { }); }, currentTime: widget.startDay, - // locale: projectViewModel.localeType ); }, child: Container( @@ -224,99 +191,63 @@ class _AddNewChildPageState extends State { borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(//getStartDay() - // DateUtil.yearMonthDay(DateTime.now()) - getStartDay()), Icon( Icons.calendar_today, color: Colors.black, - ) + ), + SizedBox( + width: 25, + ), + Expanded(child: Texts(getStartDay())), ], ), ), ), SizedBox( - height: 12, + height: 25, ), Container( - height: MediaQuery.of(context).size.height * 0.12, + height: 60, width: double.infinity, - padding: EdgeInsets.all(15), child: SecondaryButton( textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: "Add", - // - onTap: () async{ - newChild.babyName = _firstTextController.text + " " + _secondTextController.text; + color: Colors.grey[800], + disabled: (checkedValue == null || + firstName.isEmpty || + secondName.isEmpty), + label: TranslationBase.of(context).add, + onTap: () async { + newChild.babyName = _firstTextController.text + + " " + + _secondTextController.text; newChild.gender = checkedValue.toString(); - newChild.strDOB = getStartDay(); + newChild.strDOB = widget.startDay.toIso8601String(); newChild.tempValue = true; newChild.isLogin = true; await model.createNewBabyOrders(newChild: newChild); - if(model.isAdded){ - AppToast.showSuccessToast(message: "Record Added"); - Navigator.pop(context,model.isAdded); - }else{ - - //TODO handling error + if (model.isAdded) { + AppToast.showSuccessToast( + message: TranslationBase.of(context).addedChild); + Navigator.pop(context, model.isAdded); + } else { + AppToast.showSuccessToast(message: model.error); } - }, ), ), - //========= ], ), ), ), - // bottomSheet: + // bottomSheet: ), ); } String getStartDay() { - return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; - } - - String getEndDay() { - return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}"; - } - - String getDateTime(DateTime dateTime) { - return '${dateTime.hour}:${dateTime.minute}'; - } - - String getDays() { - String days = ""; - widget.daysOfWeek.forEach((element) { - days += "${DateUtil.getDay(element)},"; - }); - return days; - } - - void confirmSelectDayDialog() { - showDialog( - context: context, - child: DayCheckBoxDialog( - title: 'Select Day', - selectedDaysOfWeek: widget.daysOfWeek, - onValueSelected: (value) { - setState(() { - widget.daysOfWeek = value; - }); - }, - ), - ); + return "${widget.startDay.day}-${widget.startDay.month}-${widget.startDay.year}"; } } diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart index 806a5b71..45020f79 100644 --- a/lib/pages/ChildVaccines/child_page.dart +++ b/lib/pages/ChildVaccines/child_page.dart @@ -1,10 +1,12 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -12,191 +14,109 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; +import 'ChidDetailsWidget.dart'; import 'dialogs/delete_child.dart'; class ChildPage extends StatefulWidget { + final List_UserInformationModel informationModel; + + const ChildPage({Key key, this.informationModel}) : super(key: key); + @override _ChildPageState createState() => _ChildPageState(); } class _ChildPageState extends State with SingleTickerProviderStateMixin { - DeleteBaby deleteBaby = DeleteBaby(); @override Widget build(BuildContext context) { var checkedValue = true; return BaseView( - onModelReady: (model) => model.getNewUserOrders(), - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: " Vaccination", - baseViewModel: model, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 15, right: 15, top: 70), - child: Column( - children: [ - ...List.generate( - model.babyInformationModelList.length, - (index) => Container( - margin: EdgeInsets.only( - left: 0, right: 0, bottom: 20), - - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.white, width: 0.5), - borderRadius: - BorderRadius.all(Radius.circular(5)), - color: Colors.white, - ), - padding: EdgeInsets.all(12), - width: 200,//double.infinity, - child: Column( - children: [ - Row(children: [ - Texts("CHILD NAME"), - ]), - Row(children: [ - Texts(model - .babyInformationModelList[index] - .babyName - .trim()), - ]), - Row(children: [ - IconButton( - icon: Image.asset(model - .babyInformationModelList[ - index] - .gender == - 1 - ? 'assets/images/new-design/male.png' - : 'assets/images/new-design/female.png'), - tooltip: '', - onPressed: () { - setState(() { - // _volume += 10; - // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); - }); - }, - ), - Texts(model - .babyInformationModelList[index] - .genderDescription), - IconButton( - icon: Icon( - Icons.remove_red_eye, - color: Colors.red, - ), - tooltip: '', - onPressed: () { - Navigator.push( - context, - FadePage( - - - page: VaccinationTablePage(), - - - ), - ); - - }, - ) - ]), - Row(children: [ - Texts("Birthday"), - ]), - Row(children: [ - IconButton( - icon: new Image.asset( - 'assets/images/new-design/calender-secondary.png'), - tooltip: '', - onPressed: () { - setState(() { - - }); - }, - ), - Texts(DateUtil.yearMonthDay(model - .babyInformationModelList[index] - .dOB)), - ]), - Row(children: [ - IconButton( - icon: new Image.asset( - 'assets/images/new-design/garbage.png'), - tooltip: '', - onPressed: ()async { - - //===================== - await model.deleteBabyOrders(newChild:deleteBaby ); - - - deleteBaby.babyID=model.babyInformationModelList[index] - .babyID; - - await model.deleteBabyOrders(newChild:deleteBaby ); - if(model.isDeleted){ - AppToast.showSuccessToast(message: "Record Deleted"); - Navigator.pop(context,model.isDeleted); - }else{ - - //TODO handling error - } - - - - - - }, - ), - Texts("Delete"), - ]), - SizedBox( - height: 12, - ), - ], - ), - - ), - - - ) - ], - )) - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: "ADD NEW CHILD ", - // - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddNewChildPage(), - ), - ).then((value) { - if (value) model.getNewUserOrders(); - }); + onModelReady: (model) => model.getNewUserOrders(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).vaccination, + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 10), + child: Column( + children: [ + GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: MediaQuery.of(context).size.width / + (MediaQuery.of(context).size.height / 1.45), + ), + itemCount: model.babyInformationModelList.length, + itemBuilder: (BuildContext context, int index) { + return ChildDetailsWidget( + model: model, + babyInfo: model.babyInformationModelList[index], + informationModel: widget.informationModel, + onTapDelete: () { + showDialog( + context: context, + child: DeleteChild(onTap: () async { + await model.deleteBabyOrders(babyInfo: model.babyInformationModelList[index]); + if (model.isDeleted) { + AppToast.showSuccessToast( + message: + TranslationBase.of(context).emailSuccess, + toastLength: Toast.LENGTH_LONG); + } else { + AppToast.showSuccessToast(message: model.error); + } + }), + ); + }, + ); }, ), - ), - )); + SizedBox( + height: 15, + ), + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: TranslationBase.of(context).addChild, + // + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddNewChildPage(), + ), + ).then((value) { + if (value!=null) + model.getNewUserOrders(); + }); + }, + ), + ), + ), + ); } } diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart index 92f3a0be..e3503894 100644 --- a/lib/pages/ChildVaccines/child_vaccines_page.dart +++ b/lib/pages/ChildVaccines/child_vaccines_page.dart @@ -1,10 +1,10 @@ - import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; @@ -13,214 +13,142 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - - class ChildVaccinesPage extends StatefulWidget { @override _ChildVaccinesPageState createState() => _ChildVaccinesPageState(); } class _ChildVaccinesPageState extends State - with SingleTickerProviderStateMixin{ + with SingleTickerProviderStateMixin { TextEditingController titleController = TextEditingController(); - var checkedValue=false; - String addEmail=""; + var checkedValue = false; + String addEmail = ""; + final updateEmailFormKey = GlobalKey(); + @override Widget build(BuildContext context) { - return BaseView( onModelReady: (model) => model.getUserInformationRequestOrders(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - baseViewModel: model, - appBarTitle: " Vaccination",//TranslationBase.of(context).advancePayment, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - SizedBox( - height: 20, - ), - - Padding( - padding: const EdgeInsets.all(10.0), - child:Container( - child: Texts("Welcome back",fontSize: 20,), - ) , - ), - Divider(color:Colors.black , indent: 10, - endIndent: 10,), - SizedBox( - height: 20, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child:Container( - child: Texts("Please ensure that the email address is up-to-date and process to view the schedule",fontSize: 20,), - ) , + isShowAppBar: true, + baseViewModel: model, + appBarTitle: TranslationBase.of(context).vaccination, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context).welcomeBackV, + fontSize: 20, ), - - Divider(color:Colors.black , indent: 10, - endIndent: 10,), - Padding( - padding: const EdgeInsets.all(10.0), - child:Container( - - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - fillColor: Colors.red, - - hintText: model.user.emailAddress, - controller: titleController, - fontSize: 20, - hintColor: Colors.black, - fontWeight: FontWeight.w600, - onChanged: (text) { - addEmail=text; - model.user.emailAddress==addEmail?checkedValue=false:checkedValue=true; - - - }, - validator: (value) { - - if (value == null) - { - return model.user.emailAddress; - - } - else - - { - return model.user.emailAddress;} - }, - ), - ), + ), + ), + Divider( + color: Colors.black, + indent: 10, + endIndent: 10, + ), + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context).instructions, + fontSize: 20, ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), - label: "UPDATE EMAIL", - // - onTap: (){ - model.user.emailAddress=addEmail.toString(); - AppToast.showSuccessToast( - message: "Email updated"); - // bloodDetails.city=_selectedHospital.toString(); - - // bloodDetails. + ), + ), + Divider( + color: Colors.black, + indent: 10, + endIndent: 10, + ), + Form( + key: updateEmailFormKey, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + fillColor: Colors.red, + initialValue: model.userInformationModelList.emailAddress, + fontSize: 20, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + onChanged: (text) { + setState(() { + addEmail = text; + }); + }, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context).enterEmail; + else if (!RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(value)) + return TranslationBase.of(context).validEmail; + return null; }, - - - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: Color.fromRGBO(63, 72, 74, 1,), - label: " VIEW LIST OF CHILDREN", - // - onTap: () => Navigator.push( - context, - FadePage( - page: ChildPage(), - - - - ), - ), - - ), ), - - // Texts( - // // TranslationBase.of(context).advancePaymentLabel, - // model.user.emailAddress, - // textAlign: TextAlign.center, - // ), - SizedBox( - height: 12, - ), - SizedBox( - height: 12, - ), - SizedBox( - height: 12, - ), - - SizedBox( - height: 12, - ), - - SizedBox( - height: 12, + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: model.userInformationModelList.emailAddress == addEmail ? Colors.white24 : Color.fromRGBO(63, 72, 74, 1,), + disabled: addEmail.isEmpty, + label: TranslationBase.of(context).updateEmail, + onTap: () async{ + final form = updateEmailFormKey.currentState; + if (form.validate()) { + form.save(); + await model.updateEmail(addEmail); + AppToast.showSuccessToast(message: TranslationBase.of(context).updatedEmail); + } + + }, + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + padding: EdgeInsets.all(15), + child: SecondaryButton( + textColor: Colors.white, + color: Color.fromRGBO( + 63, + 72, + 74, + 1, ), - - SizedBox( - height: 10, + label: TranslationBase.of(context).viewListChildren, + onTap: () => Navigator.push( + context, + FadePage( + page: ChildPage(informationModel: model.userInformationModelList,), + ), ), - // Row( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // Center( - // child: Container( - // color: Colors.white, - // width: 350, - // child: InkWell( - // onTap: () { - // showDialog( - // context: context, - // builder: (_) => - // AssetGiffyDialog( - // title: Text( - // "", - // style: TextStyle( - // fontSize: 22.0, - // fontWeight: - // FontWeight - // .w600), - // ), - // image: Image.asset( - // 'assets/images/BloodChrt_EN.png'), - // buttonCancelText: - // Text('cancel'), - // buttonCancelColor: - // Colors.grey, - // onlyCancelButton: true, - // )); - // }, - // child: Container( - // width: 250, - // height: 200, - // child:Image.asset( - // 'assets/images/BloodChrt_EN.png')), - // ), - // ), - // ), - // ], - // ), - - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + ), ), - - ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], ), + ), + ), ); } } - diff --git a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart b/lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart similarity index 70% rename from lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart rename to lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart index 259bbdb7..2279dd51 100644 --- a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart +++ b/lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart @@ -5,15 +5,18 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class SelectGenderDialog extends StatefulWidget { - final Email; +class ConfirmSendEmailDialog extends StatefulWidget { + final email; + final Function onTap; + + const ConfirmSendEmailDialog({Key key, this.email, this.onTap}) + : super(key: key); - const SelectGenderDialog({Key key, this.Email}) : super(key: key); @override - _SelectGenderDialogState createState() => _SelectGenderDialogState(); + _ConfirmSendEmailDialogState createState() => _ConfirmSendEmailDialogState(); } -class _SelectGenderDialogState extends State { +class _ConfirmSendEmailDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( @@ -21,22 +24,15 @@ class _SelectGenderDialogState extends State { Container( child: Column( children: [ + Texts(TranslationBase.of(context).confirm), Divider(), Row( children: [ Expanded( flex: 1, - child: InkWell( - onTap: () { - setState(() { - //beneficiaryType = Gender.Male; - }); - }, - child: ListTile( - title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "), - - - ), + child: ListTile( + title: Text(TranslationBase.of(context).confirmSend + + "\n ${widget.email} "), ), ) ], @@ -44,15 +40,7 @@ class _SelectGenderDialogState extends State { SizedBox( height: 5.0, ), - - SizedBox( - height: 5.0, - ), - SizedBox( - height: 5.0, - ), Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 1, @@ -82,8 +70,7 @@ class _SelectGenderDialogState extends State { flex: 1, child: InkWell( onTap: () { - AppToast.showSuccessToast(message: "Email Sended"); - // widget.onValueSelected(beneficiaryType); + widget.onTap(); Navigator.pop(context); }, child: Padding( @@ -105,7 +92,4 @@ class _SelectGenderDialogState extends State { ], ); } - - - } diff --git a/lib/pages/ChildVaccines/dialogs/delete_child.dart b/lib/pages/ChildVaccines/dialogs/delete_child.dart index 250f40d3..41b02bd5 100644 --- a/lib/pages/ChildVaccines/dialogs/delete_child.dart +++ b/lib/pages/ChildVaccines/dialogs/delete_child.dart @@ -6,6 +6,10 @@ import 'package:flutter/material.dart'; class DeleteChild extends StatefulWidget { + final Function onTap; + + const DeleteChild({Key key, this.onTap}) : super(key: key); + @override _DeleteChildState createState() => _DeleteChildState(); } @@ -18,21 +22,14 @@ class _DeleteChildState extends State { Container( child: Column( children: [ + Texts(TranslationBase.of(context).confirm), Divider(), Row( children: [ Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - //beneficiaryType = Gender.Male; - }); - }, - child: ListTile( - title: Text("Delete the child "), + child: ListTile( + title: Texts(TranslationBase.of(context).deletedChild), - ), ), ) ], @@ -40,15 +37,7 @@ class _DeleteChildState extends State { SizedBox( height: 5.0, ), - - SizedBox( - height: 5.0, - ), - SizedBox( - height: 5.0, - ), Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 1, @@ -78,7 +67,7 @@ class _DeleteChildState extends State { flex: 1, child: InkWell( onTap: () { - // widget.onValueSelected(beneficiaryType); + widget.onTap(); Navigator.pop(context); }, child: Padding( diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart index c160acfb..68734c9a 100644 --- a/lib/pages/ChildVaccines/vaccinationtable_page.dart +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -1,101 +1,181 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; - -import 'dialogs/SelectGenderDialog.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'dialogs/ConfirmSendEmailDialog.dart'; class VaccinationTablePage extends StatelessWidget { + final List_BabyInformationModel babyInfo; + final List_UserInformationModel informationModel; + + const VaccinationTablePage({Key key, this.babyInfo, this.informationModel}) + : super(key: key); + @override Widget build(BuildContext context) { var checkedValue; return BaseView( - onModelReady: (model) => model.getCreateVaccinationTable(),//getUserTermsAndConditions(), + onModelReady: (model) => model.getCreateVaccinationTable(babyInfo: babyInfo, informationModel: informationModel), builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, - appBarTitle: "Vaccination", + appBarTitle: TranslationBase.of(context).vaccination, body: SingleChildScrollView( - child:Container( - margin: EdgeInsets.only(left: 15,right: 15,top: 70), + child: Container( + margin: EdgeInsets.only(left: 15, right: 15, top: 10), child: Column( - children: [//babyInformationModelList.length - ...List.generate(model.creteVaccinationTableModelList.length, (index) => - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, - + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Column( + children: [ + Texts(TranslationBase.of(context).childName), + Texts( + babyInfo.babyName ?? '', + fontWeight: FontWeight.w600, + ), + ], + ), + ), + Expanded( + child: Column( + children: [ + Texts(TranslationBase.of(context).childDob), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + FontAwesomeIcons.calendarCheck, + color: Colors.red, + ), + SizedBox( + width: 15, + ), + Texts(DateUtil.yearMonthDay(babyInfo.dOB) ?? ''), + ], + ), + ], + ), + ), + ], + ), + SizedBox( + height: 15, + ), + Divider(), + Column( + children: [ + Row( + children: [ + Texts(TranslationBase.of(context).visit), + SizedBox( + width: 10, ), - padding: EdgeInsets.all(12), - width: double.infinity, - child: Column( - + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts(TranslationBase.of(context) + .descriptionVaccination), + ], + ), + ), + Texts(TranslationBase.of(context).dueDate), + ], + ), + ], + ), + ...List.generate( + model.creteVaccinationTableModelList.length, + (index) => Container( + padding: EdgeInsets.all(12), + width: double.infinity, + child: Column( + children: [ + Row( children: [ - Row(children: [ - Text(model.creteVaccinationTableModelList[index].visit), - SizedBox(width: 10,), - - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Html( - // data:"
BCG
HEPATITIS B
"//model.creteVaccinationTableModelList[index].vaccinesDescription - data:model.creteVaccinationTableModelList[index].vaccinesDescription, - - ), - ],), - ), - Text(model.creteVaccinationTableModelList[index].givenAt), - - - ],), - Divider(color:Colors.black ,), - + Texts(model + .creteVaccinationTableModelList[index].visit), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Html( + data: model + .creteVaccinationTableModelList[index] + .vaccinesDescription, + ), + ], + ), + ), + Texts(model + .creteVaccinationTableModelList[index].givenAt), ], - ) - - - ) - + ), + Divider( + color: Colors.white, + height: 3, + thickness: 1.0, + ), + ], + ), + ), ) ], ), - + ), ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), - label: "Send Email ", - // - onTap: () { - //SelectGenderDialog(); -//=============== - showDialog( - context: context, - child: SelectGenderDialog( - ), - ); - //========= - } - - + bottomSheet: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: TranslationBase.of(context).sendEmail, + onTap: () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: informationModel.emailAddress, + onTap: () async { + await model.getCreateVaccinationTable(babyInfo: babyInfo, informationModel: informationModel,isSendEmail: true); + AppToast.showSuccessToast(message: TranslationBase.of(context).emailSuccess,toastLength: Toast.LENGTH_LONG); + + }, + ), + ); + }, + ), ), ), ), diff --git a/lib/pages/appUpdatePage/app_update_page.dart b/lib/pages/appUpdatePage/app_update_page.dart new file mode 100644 index 00000000..7bcf2388 --- /dev/null +++ b/lib/pages/appUpdatePage/app_update_page.dart @@ -0,0 +1,109 @@ +import 'dart:io'; + +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class AppUpdatePage extends StatefulWidget { + String appUpdateText; + + AppUpdatePage({@required this.appUpdateText}); + + @override + _AppUpdatePageState createState() => _AppUpdatePageState(); +} + +class _AppUpdatePageState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "App Update", + backgroundColor: Colors.white, + isShowAppBar: false, + isShowDecPage: false, + body: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SvgPicture.asset( + "assets/images/new-design/update_rocket_image.svg", + fit: BoxFit.fill), + ]), + Container( + margin: EdgeInsets.only(top: 40.0), + width: MediaQuery.of(context).size.width, + child: Text(TranslationBase.of(context).appUpdate, + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xff2d6c90).withOpacity(1.0), + fontSize: 22.0, + fontWeight: FontWeight.bold))), + ], + ), + Container( + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + child: SvgPicture.asset("assets/images/new-design/HMG_logo.svg", + fit: BoxFit.fill), + ), + Container( + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), + width: MediaQuery.of(context).size.width, + child: Text(widget.appUpdateText, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.grey[600], + fontSize: 16.0, + height: 1.5, + fontWeight: FontWeight.bold))), + Container( + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: Colors.red[800], + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + openAppUpdateLink(); + }, + child: Text(TranslationBase.of(context).appUpdate, + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ], + ), + ), + ), + ); + } + + openAppUpdateLink() { + if (Platform.isAndroid) { + _launchURL("https://play.google.com/store/apps/details?id=com.ejada.hmg"); + } + if (Platform.isIOS) { + _launchURL("https://itunes.apple.com/app/id733503978"); + } + } + + _launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } + } +} diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index fbdaf906..321ca179 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -2,34 +2,29 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; +import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; -import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; -import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; -import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; -import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; -import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart'; -import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -import '../../locator.dart'; - class HomePage extends StatefulWidget { final Function goToMyProfile; @@ -49,13 +44,12 @@ class _HomePageState extends State { // }); // super.initState(); // } - AuthenticatedUserObject authenticatedUserObject = locator(); - + AuthenticatedUserObject authenticatedUserObject = + locator(); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - toDoProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( @@ -72,11 +66,11 @@ class _HomePageState extends State { children: [ Container( width: double.infinity, - height: 100, + height: 210, decoration: BoxDecoration( image: DecorationImage( image: ExactAssetImage( - 'assets/images/dq_home_page_bg_image.png'), + 'assets/images/dashboard_top_bg.png'), fit: BoxFit.cover), ), child: Stack( @@ -88,18 +82,137 @@ class _HomePageState extends State { child: Container( width: MediaQuery.of(context).size.width * 0.8, - child: Container(), + child: Row( + children: [ + Expanded( + child: Container( + height: 120, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/new-design/covid_bg_transparent.png"), + fit: BoxFit.fill, + ), + color: + Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all( + Radius.circular(5))), + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Column( + children: [ + Text("COVID-19 TEST", + style: TextStyle( + color: Colors.white, + fontWeight: + FontWeight.bold, + fontSize: 18.0)), + Row( + children: [ + Container( + margin: EdgeInsets.only( + top: 15.0, + left: 3.5, + right: 3.5), + child: SvgPicture.asset( + 'assets/images/new-design/covid-19-car.svg', + width: 45.0, + height: 45.0), + ), + Container( + margin: EdgeInsets.only( + left: 10.0, + top: 10.0), + child: Column( + children: [ + Text("Drive-Thru", + style: TextStyle( + color: Colors + .white, + fontWeight: + FontWeight + .bold, + fontSize: + 16.0)), + ButtonTheme( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 5.0), + ), + minWidth: MediaQuery.of( + context) + .size + .width * + 0.15, + height: 25.0, + child: RaisedButton( + color: Colors + .red[800], + textColor: + Colors.white, + disabledTextColor: + Colors.white, + disabledColor: + new Color( + 0xFFbcc2c4), + onPressed: () { + navigateToCovidDriveThru(); + }, + child: Text( + "BOOK NOW", + style: TextStyle( + fontSize: + 12.0)), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () => Navigator.push(context, + FadePage(page: LiveCareHome())), + child: Container( + height: 120, + padding: EdgeInsets.all(15), + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + color: Colors.white + .withOpacity(0.3), + borderRadius: BorderRadius.all( + Radius.circular(5))), + child: SvgPicture.asset( + projectViewModel.isArabic + ? 'assets/images/new-design/livecare_arabic_logo.svg' + : 'assets/images/new-design/liveCare_white_logo.svg', + ), + ), + ), + ), + ], + ), ), ) ], ), - ), - Container(width: double.infinity, height:projectViewModel.isArabic ? 120:110), + Container(width: double.infinity, height: 80) ], ), Positioned( - top: 40, + top: 155, left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape @@ -110,12 +223,12 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!model.isLogin ) + child: (!model.isLogin && projectViewModel.user == null) ? Container( width: double.infinity, - height: 160, + height: 125, decoration: BoxDecoration( - color: Theme.of(context).primaryColor, + color: HexColor('#A59E9E'), shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, width: 0.5), @@ -135,7 +248,7 @@ class _HomePageState extends State { ), Texts( TranslationBase.of(context).myMedicalFile, - color: Colors.white, + color: Colors.black87, bold: true, fontSize: 23, ), @@ -145,41 +258,36 @@ class _HomePageState extends State { Texts( TranslationBase.of(context) .myMedicalFileSubTitle, - color: Colors.white, + color: Colors.black, fontSize: 16, ), Align( alignment: projectViewModel.isArabic - ? Alignment.bottomLeft - : Alignment.bottomRight, + ? Alignment.bottomRight + : Alignment.bottomLeft, child: InkWell( onTap: () { widget.goToMyProfile(); }, child: Container( margin: EdgeInsets.all(2), - width: MediaQuery.of(context) - .size - .width * - 0.30, + width: 90, height: 30, decoration: BoxDecoration( - color: Colors.white, + color: HexColor('#D81A2E'), shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all( - Radius.circular(4)), + Radius.circular(9)), ), child: Center( child: Texts( TranslationBase.of(context) .viewMore, - color: Theme.of(context) - .primaryColor, - fontSize: 14, - + color: Colors.white, + fontSize: 12, ), ), ), @@ -191,9 +299,9 @@ class _HomePageState extends State { ) : Container( width: double.infinity, - height: projectViewModel.isArabic ? 180 : 150, + height: 130, decoration: BoxDecoration( - color: Theme.of(context).primaryColor, + color: HexColor('#A59E9E'), shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, width: 0.5), @@ -204,183 +312,140 @@ class _HomePageState extends State { 'assets/images/bg_graphic.png'), fit: BoxFit.cover), ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - margin: EdgeInsets.all(5), - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - if (model.user != null) - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - Texts( - model.user.firstName + - " " + - model.user.lastName, - color: Colors.grey[100], - bold: true, - fontSize: 15, - ), - Texts( - '${model.user.patientID}', - color: Colors.white, - fontSize: 14, - ), - SizedBox( - height: 5, - ), - Texts( - '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', - color: Colors.grey[100], - fontWeight: - FontWeight.normal, - fontSize: 14, - ), - ], - ), - ), - InkWell( - onTap: () { - widget.goToMyProfile(); - }, - child: Container( - margin: EdgeInsets.all(2), - width: MediaQuery.of(context) - .size - .width * - 0.30, - height: 30, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, - width: 0.5), - borderRadius: BorderRadius.all( - Radius.circular(5), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context) - .viewMore, - color: Theme.of(context) - .primaryColor, - fontSize: 12, - bold: true, - ), - ), - ), - ) - ], - ), - Row( - children: [ + child: Container( + margin: EdgeInsets.all(5), + child: Column( + children: [ + Row( + children: [ + if (model.user != null) Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, + child: Column( crossAxisAlignment: - CrossAxisAlignment.center, + CrossAxisAlignment.start, children: [ - Image.asset( - 'assets/images/height_icon.png', - width: 30, - height: 55, + SizedBox( + height: 8, + ), + Texts( + model.user.firstName + + " " + + model.user.lastName, + color: Colors.grey[100], + bold: true, + fontSize: 15, + ), + Texts( + '${model.user.patientID}', + color: Colors.white, + fontSize: 14, + ), + SizedBox( + height: 5, + ), + Texts( + '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', + color: Colors.grey[100], + fontWeight: FontWeight.normal, + fontSize: 14, ), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - "${model.heightCm}", - color: Colors.white, - bold: true, - ), - Texts( - TranslationBase.of(context).height, - color: Colors.white, - fontSize: 10, - ), - ], - ) ], ), ), - SizedBox( - width: 3, - ), - Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/test-weight.png', - width: 30, - height: 55, - ), - Column( - children: [ - Texts( - '${model.weightKg}', - color: Colors.white, - bold: true, - ), - Texts( - TranslationBase.of(context).weight, - color: Colors.white, - fontSize: 10, - ) - ], - ) - ], + InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.all(2), + width: 90, + height: 30, + decoration: BoxDecoration( + color: HexColor('#D81A2E'), + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, + width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(5), + ), + ), + child: Center( + child: Texts( + TranslationBase.of(context) + .viewMore, + color: Colors.white, + fontSize: 12, + ), ), ), - SizedBox( - width: 3, + ) + ], + ), + Row( + //crossAxisAlignment: CrossAxisAlignment.center, + //mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Image.asset( + 'assets/images/height_icon.png', + width: 35, + height: 40, + ), + Texts( + "${model.heightCm}", + color: Colors.white, + ) + ], ), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/blood-drop.png', - width: 35, - height: 40, - ), - Column( - children: [ - Texts( - '${model.bloadType}', - color: Colors.white, - ), - Texts( - TranslationBase.of(context).bloodType, - color: Colors.white, - fontSize: 10, - ) - ], - ) - ], - ), + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Image.asset( + 'assets/images/weight_icon.png', + width: 25, + height: 40, + ), + Texts( + '${model.weightKg}', + color: Colors.white, + ) + ], ), - ], - ) - ], - ), + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Image.asset( + 'assets/images/blood_icon.png', + width: 35, + height: 40, + ), + Texts( + '${model.bloadType}', + color: Colors.white, + ) + ], + ), + ), + ], + ) + ], ), ), ), @@ -392,143 +457,110 @@ class _HomePageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: DashboardItem( - onTap: () { - Navigator.push( - context, - FadePage( - page: VitalSignDetailsScreen(), - ), - ); - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - SizedBox(height: 15,), - - Container( - width: 60, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/vital_sign_icon.png', - width: 80, - height: 50, - fit: BoxFit.contain,)), - ), - SizedBox(height: 20,), - Texts( - TranslationBase.of(context) - .vitalSigns, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, - ) - ], - ), + DashboardItem( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomeHealthCarePage(), + ), + ); + }, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/home_health_care_icon.png', + width: 50, + height: 50, + ), + SizedBox( + height: 3, + ), + Texts( + TranslationBase.of(context) + .homeHealthCareService, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), ), - margin: 4, - height: 170, - imageName: 'home_healthcare_service_bg.png', - opacity: 1.0, ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'home_healthcare_service_bg.png', + opacity: 0.5, ), - Expanded( - child: DashboardItem( - onTap: () { - Navigator.push( - context, - FadePage( - page: MedicineSearch(), - ), - ); - }, - opacity: 1.0, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - SizedBox(height: 15,), - Container( - width: 50, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/search_medicine_icon.png', - width: 50, - height: 50, - fit: BoxFit.contain,)), - ), - SizedBox(height: 20,), - Texts( - TranslationBase.of(context).searchMedicine, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, - ) - ], - ), + DashboardItem( + onTap: () => Navigator.push( + context, FadePage(page: PharmacyPage())), + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/pharmacy_logo.png', + width: 40, + height: 40, + ), + SizedBox( + height: 20, + ), + Texts( + TranslationBase.of(context).onlinePharmacy, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), ), - margin: 4, - height: 170, - imageName: 'al-habib_onlne_pharmacy_bg.png', ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'al-habib_onlne_pharmacy_bg.png', ), - Expanded( - child: DashboardItem(opacity: 1.0, - onTap: (){ - Navigator.push( - context, - FadePage( - page: PaymentService(), - ), - ); - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - SizedBox(height: 15,), - Container( - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/online_payment_icon.png', - width: 80, - height: 50, - fit: BoxFit.contain,)), - ), - SizedBox(height: 15,), - Texts( - TranslationBase.of(context).onlinePaymentService, - textAlign: TextAlign.center, - color: Colors.white, - bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, - ) - ], - ), + DashboardItem( + onTap: () { + Navigator.push( + context, + FadePage( + page: CMCPage(), + ), + ); + }, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/comprehensive_medical_checkup_logo.png', + width: 50, + height: 50, + ), + SizedBox( + height: 3, + ), + Texts( + TranslationBase.of(context).emergencyService, + textAlign: TextAlign.center, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), ), - margin: 4, - height: 170, - imageName: 'online_payments_bg.png', ), + height: MediaQuery.of(context).size.width * 0.4, + color: HexColor("#747C80"), + imageName: 'emergency_service_image.png', ), ], ), @@ -536,123 +568,121 @@ class _HomePageState extends State { SizedBox( height: 8, ), - Container( - margin: EdgeInsets.only(left: 10, right: 10), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - //flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: MyAppointments(), + InkWell( + onTap: () => + Navigator.push(context, FadePage(page: PaymentService())), + child: Container( + margin: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/al-habib_online_payment_service_icon.png', + height: 55, ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: LabsHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).lab, - imagePath: 'lab_result_icon.png', - subTitle: - TranslationBase.of(context).lab, + SizedBox( + height: 5, + ), + Texts( + TranslationBase.of(context) + .onlinePaymentService, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], ), ), ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: RadiologyHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context) - .radiology, - imagePath: 'radiology_icon.png', - subTitle: TranslationBase.of(context) - .radiologySubtitle, - ), - ), + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .medicines, - imagePath: 'prescription_icon.png', - subTitle: TranslationBase.of(context) - .medicinesSubtitle, + ), + Container( + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/ereferral_service_icon.png', + width: 50, + height: 55, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context) + .offersAndPackages, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], + ), ), ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: DoctorHomePage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .myDoctor, - imagePath: 'doctor_icon.png', - subTitle: TranslationBase.of(context) - .myDoctorSubtitle, + width: MediaQuery.of(context).size.width * 0.29, + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, + )), + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: ErOptions( + isAppbar: true, + ))), + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/Dr_Schedule_report.png', + width: 50, + height: 50, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context) + .emergencyServices, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], + ), ), ), ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceCard())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context) - .insurance, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context) - .insuranceSubtitle, - ), - ), + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, ), - ], - ), - - ], + ), + ], + ), ), ), SizedBox( @@ -664,7 +694,6 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ DashboardItem( - opacity:1.0, child: Container( width: double.infinity, padding: EdgeInsets.all(10), @@ -674,10 +703,11 @@ class _HomePageState extends State { Texts( TranslationBase.of(context).hMGService, color: Colors.white, - bold: true, + fontWeight: FontWeight.normal, ), Texts( - TranslationBase.of(context).viewAllHabibMedicalService, + TranslationBase.of(context) + .viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, @@ -686,23 +716,25 @@ class _HomePageState extends State { child: Container(), ), Texts( - TranslationBase.of(context).viewAll, + TranslationBase.of(context).viewMore, color: Colors.white, - bold: true, + //fontWeight: FontWeight.normal, ) ], ), ), height: 100, - imageName: 'ask_doctor_bg.png', - //color: Colors.grey[700], + imageName: 'contact_us_bg.png', + opacity: 0.5, + color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, onTap: () => Navigator.push( - context, FadePage(page: AllHabibMedicalService(goToMyProfile: widget.goToMyProfile,))), + context, FadePage(page: AllHabibMedicalService())), ), DashboardItem( - opacity:1.0, onTap: () { + // Navigator.push( + // context, FadePage(page: FeedbackHomePage())); Navigator.push( context, FadePage(page: ContactUsPage())); }, @@ -715,27 +747,28 @@ class _HomePageState extends State { Texts( TranslationBase.of(context).contactUs, color: Colors.white, - bold: true, + fontWeight: FontWeight.normal, ), Texts( TranslationBase.of(context).viewAllWaysReachUs, color: Colors.white, fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.0 , + fontSize: 10, ), Expanded( child: Container(), ), Texts( - TranslationBase.of(context).viewAll, + TranslationBase.of(context).viewMore, color: Colors.white, - bold: true, + fontWeight: FontWeight.normal, ) ], ), ), height: 106, imageName: 'rectangle.png', + opacity: 0.5, color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, ), @@ -757,23 +790,6 @@ class _HomePageState extends State { Navigator.push(context, MaterialPageRoute(builder: (context) => CovidDrivethruLocation())); } - - getToDoCount() { - toDoProvider.setState(0); - ClinicListService service = new ClinicListService(); - service.getActiveAppointmentNo(context).then((res) { - print(res['AppointmentActiveNumber']); - if (res['MessageStatus'] == 1) { - setState(() { - toDoProvider.setState(res['AppointmentActiveNumber']); - }); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - }); - } } class DashboardItem extends StatelessWidget { @@ -786,7 +802,8 @@ class DashboardItem extends StatelessWidget { this.width, this.height, this.color, - this.opacity = 1.0,this.icon,this.margin=0}) + this.opacity = 0.4, + this.hasColorFilter = true}) : super(key: key); final bool hasBorder; final String imageName; @@ -796,8 +813,7 @@ class DashboardItem extends StatelessWidget { final double height; final Color color; final double opacity; - final double margin; - final Widget icon; + final bool hasColorFilter; @override Widget build(BuildContext context) { @@ -814,7 +830,7 @@ class DashboardItem extends StatelessWidget { color: !hasBorder ? color != null ? color - : Colors.black.withOpacity(opacity) + : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), border: hasBorder @@ -824,12 +840,13 @@ class DashboardItem extends StatelessWidget { ? DecorationImage( image: ExactAssetImage('assets/images/$imageName'), fit: BoxFit.cover, - colorFilter: new ColorFilter.mode( - Colors.black.withOpacity(opacity), BlendMode.dstIn), + colorFilter: hasColorFilter + ? new ColorFilter.mode( + Colors.black.withOpacity(0.2), BlendMode.dstIn) + : null, ) - : icon, + : null, ), - margin: EdgeInsets.all(margin), child: Center( child: child, ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 826c8b76..b47a1e75 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -155,122 +155,124 @@ class _LandingPageState extends State with WidgetsBindingObserver { }).catchError((err) { print(err); }); + // + // //_firebase Background message handler Future.delayed(Duration.zero, () => setTheme()); //_firebase Background message handler // _firebaseMessaging.configure( - // onMessage: (Map message) async { - // showDialog("onMessage: $message"); - // print("onMessage: $message"); - // print(message); - // print(message['name']); - // print(message['appointmentdate']); - // - // if (Platform.isIOS) { - // if (message['is_call'] == "true") { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = new Map.from(message); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // - // if (Platform.isAndroid) { - // if (message['data'].containsKey("is_call")) { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = - // new Map.from(message['data']); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found Android"); - // } - // } else { - // print("Is Call Not Found Android"); - // } - // }, - // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, - // onLaunch: (Map message) async { - // print("onLaunch: $message"); - // showDialog("onLaunch: $message"); - // }, - // onResume: (Map message) async { - // print("onResume: $message"); - // print(message); - // print(message['name']); - // print(message['appointmentdate']); - // - // showDialog("onResume: $message"); - // - // if (Platform.isIOS) { - // if (message['is_call'] == "true") { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = - // new Map.from(message); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // }, - // ); + // // onMessage: (Map message) async { + // // showDialog("onMessage: $message"); + // // print("onMessage: $message"); + // // print(message); + // // print(message['name']); + // // print(message['appointmentdate']); + // // + // // if (Platform.isIOS) { + // // if (message['is_call'] == "true") { + // // var route = ModalRoute.of(context); + // // + // // if (route != null) { + // // print(route.settings.name); + // // } + // // + // // Map myMap = new Map.from(message); + // // print(myMap); + // // LandingPage.isOpenCallPage = true; + // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // // if (!isPageNavigated) { + // // isPageNavigated = true; + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (context) => IncomingCall( + // // incomingCallData: LandingPage.incomingCallData))) + // // .then((value) { + // // isPageNavigated = false; + // // }); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // + // // if (Platform.isAndroid) { + // // if (message['data'].containsKey("is_call")) { + // // var route = ModalRoute.of(context); + // // + // // if (route != null) { + // // print(route.settings.name); + // // } + // // + // // Map myMap = + // // new Map.from(message['data']); + // // print(myMap); + // // LandingPage.isOpenCallPage = true; + // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // // if (!isPageNavigated) { + // // isPageNavigated = true; + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (context) => IncomingCall( + // // incomingCallData: LandingPage.incomingCallData))) + // // .then((value) { + // // isPageNavigated = false; + // // }); + // // } + // // } else { + // // print("Is Call Not Found Android"); + // // } + // // } else { + // // print("Is Call Not Found Android"); + // // } + // // }, + // // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, + // // onLaunch: (Map message) async { + // // print("onLaunch: $message"); + // // showDialog("onLaunch: $message"); + // // }, + // // onResume: (Map message) async { + // // print("onResume: $message"); + // // print(message); + // // print(message['name']); + // // print(message['appointmentdate']); + // // + // // showDialog("onResume: $message"); + // // + // // if (Platform.isIOS) { + // // if (message['is_call'] == "true") { + // // var route = ModalRoute.of(context); + // // + // // if (route != null) { + // // print(route.settings.name); + // // } + // // + // // Map myMap = + // // new Map.from(message); + // // print(myMap); + // // LandingPage.isOpenCallPage = true; + // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // // if (!isPageNavigated) { + // // isPageNavigated = true; + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (context) => IncomingCall( + // // incomingCallData: LandingPage.incomingCallData))) + // // .then((value) { + // // isPageNavigated = false; + // // }); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // }, + // ); } showDialogs(String message) { @@ -460,9 +462,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { case 2: return TranslationBase.of(context).bookAppo; case 3: - return TranslationBase.of(context).myFamily; - case 4: return TranslationBase.of(context).services; + case 4: + return TranslationBase.of(context).bookAppo; } } setTheme() async{ diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 41746f3c..052b196e 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -1,14 +1,19 @@ +import 'dart:math'; + import 'package:badges/badges.dart'; +import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; -import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; +import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -16,14 +21,24 @@ import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profil import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'package:provider/provider.dart'; - +import '../../locator.dart'; +import 'active_medications/ActiveMedicationsPage.dart'; import 'allergies_page.dart'; +import 'ask_doctor/ask_doctor_home_page.dart'; +import 'balance/my_balance_page.dart'; import 'doctor/doctor_home_page.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; +import 'eye/EyeHomePage.dart'; +import 'eye/EyeMeasurementsPage.dart'; import 'labs/labs_home_page.dart'; +import 'my_trackers/my_trackers.dart'; class MedicalProfilePage extends StatefulWidget { @override @@ -119,8 +134,8 @@ class _MedicalProfilePageState extends State { position: BadgePosition.topEnd(), shape: BadgeShape.circle, - badgeColor: Color(0xFF40ACC9) - .withOpacity(1.0), + badgeColor: Colors + .red[800].withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( @@ -185,52 +200,48 @@ class _MedicalProfilePageState extends State { Navigator.push( context, FadePage( - page: DoctorHomePage(), + page: HomePrescriptionsPage(), ), ); }, child: MedicalProfileItem( title: TranslationBase.of(context) - .myDoctor, - imagePath: 'doctor_icon.png', + .medicines, + imagePath: 'prescription_icon.png', subTitle: TranslationBase.of(context) - .myDoctorSubtitle, + .medicinesSubtitle, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage(), - ), - ); - }, + onTap: () => Navigator.push( + context, + FadePage( + page: VitalSignDetailsScreen(), + ), + ), child: MedicalProfileItem( title: TranslationBase.of(context) - .medicines, - imagePath: 'prescription_icon.png', + .vitalSigns, + imagePath: 'vital_signs.png', subTitle: TranslationBase.of(context) - .medicinesSubtitle, + .vitalSignsSubtitle, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceCard())); - }, + onTap: () => Navigator.push(context, + FadePage(page: ActiveMedicationsPage())), child: MedicalProfileItem( title: TranslationBase.of(context) - .insurance, - imagePath: 'insurance_card_icon.png', + .myMedical, + imagePath: 'active_medications.png', subTitle: TranslationBase.of(context) - .insuranceSubtitle, + .myMedicalSubtitle, ), ), ), @@ -241,14 +252,20 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: AllergiesPage())), + onTap: () { + Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ); + }, child: MedicalProfileItem( title: TranslationBase.of(context) - .allergies, - imagePath: 'my_allergies_icon.png', + .myDoctor, + imagePath: 'doctor_icon.png', subTitle: TranslationBase.of(context) - .allergiesSubtitle, + .myDoctorSubtitle, ), ), ), @@ -259,13 +276,13 @@ class _MedicalProfilePageState extends State { Navigator.push( context, FadePage( - page: PatientSickLeavePage())); + page: EyeMeasurementsPage())); }, child: MedicalProfileItem( - title: TranslationBase.of(context).sick, - imagePath: 'sick_leaves_icons.png', + title: TranslationBase.of(context).eye, + imagePath: 'eye_measurement_icon.png', subTitle: TranslationBase.of(context) - .sickSubtitle, + .eyeSubtitle, ), ), ), @@ -273,24 +290,83 @@ class _MedicalProfilePageState extends State { flex: 1, child: InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: InsuranceApproval())); + Navigator.push(context, + FadePage(page: InsuranceCard())); }, child: MedicalProfileItem( title: TranslationBase.of(context) - .insuranceApproval, - imagePath: - 'insurance_approvals_icon.png', + .insurance, + imagePath: 'insurance_card_icon.png', subTitle: TranslationBase.of(context) - .insuranceApprovalSubtitle, + .insuranceSubtitle, ), ), ), ], ), Row(children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: InsuranceUpdate())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context) + .updateInsurance, + imagePath: 'insurance_update_icon_.png', + subTitle: TranslationBase.of(context) + .updateInsuranceSubtitle, + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: InsuranceApproval())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context) + .insuranceApproval, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context) + .insuranceApprovalSubtitle, + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap:()=> Navigator.push(context, FadePage(page: AllergiesPage())) , + child: MedicalProfileItem( + title: TranslationBase.of(context).allergies, + imagePath: 'my_allergies_icon.png', + subTitle: TranslationBase.of(context) + .allergiesSubtitle, + ), + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: MyVaccines())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context) + .myVaccines, + imagePath: 'my_vaccines_icon.png', + subTitle: TranslationBase.of(context) + .myVaccinesSubtitle, + ), + ), + ), Expanded( flex: 1, child: InkWell( @@ -308,9 +384,153 @@ class _MedicalProfilePageState extends State { ), ), Expanded( - child: Container(), + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: MonthlyReportsPage())); + }, + child: MedicalProfileItem( + title: + TranslationBase.of(context).monthly, + imagePath: 'monthly_reports_icon.png', + subTitle: TranslationBase.of(context) + .monthlySubtitle, + ), + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PatientSickLeavePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).sick, + imagePath: 'sick_leaves_icons.png', + subTitle: TranslationBase.of(context) + .sickSubtitle, + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: MyBalancePage())); + }, + child: MedicalProfileItem( + title: + TranslationBase.of(context).myBalance, + imagePath: 'check-in.png', + subTitle: TranslationBase.of(context) + .myBalanceSubtitle, + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: + TranslationBase.of(context).patientCall, + imagePath: 'medical_history_icon.png', + subTitle: TranslationBase.of(context) + .patientCallSubtitle, + ), ), + ]), + Row(children: [ Expanded( + flex: 1, + child: InkWell( + //TODO + onTap: () { + Navigator.push( + context, FadePage(page: SmartWatchInstructions())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context) + .smartWatches, + imagePath: 'smartwatch_icon.png', + subTitle: TranslationBase.of(context) + .smartWatchesSubtitle, + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: MyTrackers())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context) + .myTrackers, + imagePath: 'my_tracker_icon.png', + subTitle: TranslationBase.of(context) + .myTrackersSubtitle, + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: (){ + Navigator.push(context, + FadePage(page: AskDoctorHomPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).askYour, + imagePath: 'ask_doctor_icon.png', + subTitle: TranslationBase.of(context) + .askYourSubtitle, + ), + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: + TranslationBase.of(context).internet, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context) + .internetSubtitle, + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: + TranslationBase.of(context).chatbot, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context) + .chatbotSubtitle, + ), + ), + ), + Expanded( + flex: 1, child: Container(), ), ]), diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart index 2f9a3e60..763948c0 100644 --- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; class HealthDataList extends StatefulWidget { @@ -8,6 +9,19 @@ class HealthDataList extends StatefulWidget { } class _HealthDataListState extends State { + List dataTypes = List(); + + @override + void initState() { + dataTypes.add(DataType.DISTANCE); + dataTypes.add(DataType.STEP_COUNT); + dataTypes.add(DataType.HEART_RATE); + dataTypes.add(DataType.SLEEP); + dataTypes.add(DataType.ENERGY); + + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -132,7 +146,7 @@ class _HealthDataListState extends State { width: MediaQuery.of(context).size.width * 0.8, child: Button( onTap: () { -// launch(model.radImageURL); + readAll(); }, label: 'Sync Health Data', backgroundColor: Colors.grey[800], @@ -142,4 +156,26 @@ class _HealthDataListState extends State { ), )); } + + void readLast() async { + final result = await FitKit.readLast(DataType.DISTANCE); + print(result); + print(result); + } + + void readAll() async { + if (await FitKit.requestPermissions(dataTypes)) { + for (DataType type in dataTypes) { + final results = await FitKit.read( + type, + dateFrom: DateTime.now().subtract(Duration(days: 15)), + dateTo: DateTime.now(), + limit: 100, + ); + print(results); + print(results.length); + } + readLast(); + } + } } diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart index eb0c1675..3f07693b 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -31,6 +31,7 @@ class _SmartWatchInstructionsState extends State { return AppScaffold( appBarTitle: "Sync Health Data", isShowAppBar: true, + isShowDecPage: false, body: Container( child: Platform.isIOS ? _getAppleWatchInstructions() @@ -88,6 +89,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 1", style: TextStyle( @@ -108,8 +111,12 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 2", + overflow: TextOverflow.clip, + softWrap: true, style: TextStyle( fontSize: 12.0)), ) @@ -135,6 +142,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 3", style: TextStyle( @@ -155,6 +164,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 4", style: TextStyle( @@ -182,6 +193,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 5", style: TextStyle( @@ -202,6 +215,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 6", style: TextStyle( @@ -427,7 +442,7 @@ class _SmartWatchInstructionsState extends State { width: MediaQuery.of(context).size.width, margin: EdgeInsets.symmetric(horizontal: 5.0), child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 0.0), color: Colors.white.withOpacity(1.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -657,7 +672,7 @@ class _SmartWatchInstructionsState extends State { style: TextStyle(fontSize: 17.0)), ), Container( - margin: EdgeInsets.all(15.0), + margin: EdgeInsets.all(12.0), child: ButtonTheme( shape: RoundedRectangleBorder( borderRadius: diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index fd3fdbdf..828218a8 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -46,7 +46,7 @@ class VitalSignItem extends StatelessWidget { des, style: TextStyle( fontSize: 1.7 * SizeConfig.textMultiplier, - color: Color(0xff40ACC9), + color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold, ), ), @@ -76,11 +76,12 @@ class VitalSignItem extends StatelessWidget { text: TextSpan( style: TextStyle(color: Colors.black), children: [ - TextSpan(text: lastVal), + TextSpan(text: lastVal + " "), TextSpan( text: " " + unit, style: TextStyle( - color: Color(0xff40ACC9), + color: + Theme.of(context).textTheme.headline1.color, ), ), ]), diff --git a/lib/pages/pharmacies/screens/order-preview-page.dart b/lib/pages/pharmacies/screens/order-preview-page.dart new file mode 100644 index 00000000..d9646fcf --- /dev/null +++ b/lib/pages/pharmacies/screens/order-preview-page.dart @@ -0,0 +1,48 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class OrderPreviewPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Shopping Cart", + isShowAppBar: true, + isShowDecPage: false, + baseViewModel: model, + backgroundColor: Colors.white, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureIconButton( + TranslationBase.of(context).deleteAllItems, + Icon(Icons.delete_outline_sharp, color: Colors.grey.shade800,), + onTap: () => {}, + ), + const Divider( + color: Colors.grey, + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + + ], + ), + ), + ), + ), + ), + ); + } +} + diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart new file mode 100644 index 00000000..2ae2be65 --- /dev/null +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -0,0 +1,245 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/order-preview-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +class PharmacyPage extends StatelessWidget { + + @override + Widget build(BuildContext context) { + return BaseView( + // onModelReady: (model) => model.getPharmacyHomeData(), + onModelReady: (model) => model.getPharmacyHomeData(), + builder: (_, model, wi) => AppScaffold( + title: "", + isShowAppBar: true, + isShowDecPage: false, + baseViewModel: model, + backgroundColor: Colors.white, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BannerPager(model), + GridViewButtons(), + /*BannerPager(model.getBannerImagesUrl()),*/ + Container( + margin: EdgeInsets.fromLTRB(10, 0, 10, 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).shopByBrands, + bold: true, + ), + BorderedButton( + TranslationBase.of(context).viewAll, + hasBorder: true, + vPadding: 6, + borderColor: Colors.green, + color: Colors.green, + handler: () {}, + ), + ], + ), + ), + Container( + height: 60, + child: ListView.builder( + itemBuilder: (ctx, i) => + ManufacturerItem(model.manufacturerList[i]), + scrollDirection: Axis.horizontal, + itemCount: model.manufacturerList.length, + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).recentlyViewed, + bold: true, + ), + BorderedButton( + TranslationBase.of(context).viewAll, + hasBorder: true, + vPadding: 6, + borderColor: Colors.green, + color: Colors.green, + handler: () {}, + ), + ], + ), + ), + Container( + height: model.lastVisitedProducts.length > 0 ? MediaQuery.of(context).size.height / 4 : 0, + child: ListView.builder( + itemBuilder: (ctx, i) => + ProductTileItem(model.lastVisitedProducts[i]), + scrollDirection: Axis.horizontal, + itemCount: model.lastVisitedProducts.length, + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).bestSellers, + bold: true, + ), + BorderedButton( + TranslationBase.of(context).viewAll, + hasBorder: true, + borderColor: Colors.green, + color: Colors.green, + vPadding: 6, + handler: () {}, + ), + ], + ), + ), + Container( + height: MediaQuery.of(context).size.height / 4, + child: ListView.builder( + itemBuilder: (ctx, i) => + ProductTileItem(model.bestSellerProduct[i]), + scrollDirection: Axis.horizontal, + itemCount: model.bestSellerProduct.length, + ), + ), + ], + ), + ), + ), + ), + ); + } +} + +class GridViewButtons extends StatelessWidget { + @override + Widget build(BuildContext context) { + final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; + return Container( + child: SizedBox( + height: gridHeight, + child: GridView.count( + childAspectRatio: 2.2, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + controller: new ScrollController(keepScrollOffset: false), + shrinkWrap: true, + padding: const EdgeInsets.all(4.0), + crossAxisCount: 2, + children: [ + DashboardItem( + imageName: 'pharmacy_module/bg_1.png', + hasColorFilter: false, + opacity: 0.8, + child: GridViewCard( + TranslationBase.of(context).offersAndPromotions, + 'assets/images/pharmacy_module/offer_icon.png', + () { + Navigator.push(context, FadePage(page: OrderPreviewPage())); + }), + ), + DashboardItem( + imageName: 'pharmacy_module/bg_2.png', + opacity: 0, + hasColorFilter: false, + child: GridViewCard(TranslationBase.of(context).medicationRefill, + 'assets/images/pharmacy_module/medication_icon.png', () {}), + ), + DashboardItem( + imageName: 'pharmacy_module/bg_3.png', + opacity: 0, + hasColorFilter: false, + child: GridViewCard(TranslationBase.of(context).myPrescriptions, + 'assets/images/pharmacy_module/prescription_icon.png', () {}), + ), + DashboardItem( + imageName: 'pharmacy_module/bg_4.png', + opacity: 0, + hasColorFilter: false, + child: GridViewCard( + TranslationBase.of(context).searchAndScanMedication, + 'assets/images/pharmacy_module/search_scan_icon.png', + () {}), + ), + ], + ), + ), + ); + } +} + +class GridViewCard extends StatelessWidget { + final String text; + final String cardImage; + final Function handler; + + GridViewCard(this.text, this.cardImage, this.handler); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(4.0), + child: Container( + child: Row( + children: [ + Expanded( + flex: 2, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 2, + child: Padding( + padding: const EdgeInsets.all(6), + child: Texts( + text, + color: Colors.white, + fontSize: SizeConfig.textMultiplier * 1.5, + ), + ), + ), + Expanded( + child: BorderedButton( + TranslationBase.of(context).viewAll, + handler: handler, + ), + ), + ], + ), + ), + Expanded( + child: Align( + alignment: Alignment.centerRight, + child: Image.asset( + cardImage, + fit: BoxFit.cover, + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/phramacy-product-detail-page.dart b/lib/pages/pharmacies/screens/phramacy-product-detail-page.dart new file mode 100644 index 00000000..afbd2b06 --- /dev/null +++ b/lib/pages/pharmacies/screens/phramacy-product-detail-page.dart @@ -0,0 +1,19 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class ProductDetailScreen extends StatelessWidget { + final PharmacyProduct product; + + ProductDetailScreen(this.product); + + @override + Widget build(BuildContext context) { + return AppScaffold( + body: Center( + child: Texts("id = ${product.id}"), + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/BannerPager.dart b/lib/pages/pharmacies/widgets/BannerPager.dart new file mode 100644 index 00000000..989c7557 --- /dev/null +++ b/lib/pages/pharmacies/widgets/BannerPager.dart @@ -0,0 +1,88 @@ +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; + +class BannerPager extends StatefulWidget { + final PharmacyModuleViewModel _model; + + BannerPager(this._model); + + @override + _BannerPagerState createState() => _BannerPagerState(); +} + +class _BannerPagerState extends State { + int _current = 0; + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + CarouselSlider( + options: CarouselOptions( + aspectRatio: 7 / 2, + enlargeCenterPage: true, + enableInfiniteScroll: false, + initialPage: 0, + autoPlay: true, + autoPlayInterval: Duration(seconds: 3), + autoPlayAnimationDuration: Duration(milliseconds: 800), + autoPlayCurve: Curves.decelerate, + onPageChanged: (index, reason) { + setState(() { + _current = index; + }); + }, + ), + items: widget._model + .getBannerImagesUrl() + .mapIndexed( + (item, index) => Container( + margin: EdgeInsets.symmetric(horizontal: 1.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Center( + child: index == 0 + ? Image.asset( + item, + fit: BoxFit.cover, + ) + : Image.network( + item, + fit: BoxFit.cover, + ), + ), + ), + ), + ) + .toList(), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: widget._model + .getBannerImagesUrl() + .mapIndexed( + (item, index) => Container( + width: 12.0, + height: 4.0, + margin: + EdgeInsets.symmetric(vertical: 0.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: _current == index + ? Color.fromRGBO(0, 250, 0, 0.9) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ), + ) + .toList(), + ), + ) + ], + )); + } +} diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart new file mode 100644 index 00000000..81b6068a --- /dev/null +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class ProductOrderItem extends StatelessWidget { + @override + Widget build(BuildContext context) { + return ListTile( + leading: Icon( + Icons.delete_outline_sharp, + color: Colors.grey.shade800, + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart new file mode 100644 index 00000000..62493387 --- /dev/null +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -0,0 +1,146 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ProductTileItem extends StatelessWidget { + final AppSharedPreferences sharedPref = AppSharedPreferences(); + final PharmacyProduct item; + + ProductTileItem(this.item); + + void productOnClick(BuildContext ctx) { + _saveLastVisitProducts(); + Navigator.push(ctx, FadePage(page: ProductDetailScreen(item))); + } + + void _saveLastVisitProducts() async { + String lastVisited = ""; + bool isIdExist = false; + if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != + null) { + lastVisited = + await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + lastVisited.split(",").forEach((id) { + if (id == item.id) { + isIdExist = true; + } + }); + } + if (!isIdExist) { + if (lastVisited == "") { + // it means there is no lastVisited yet + lastVisited = "${item.id}"; + } else { + // there is lastVisited id's and this product id is not found + lastVisited += ",${item.id}"; + } + sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, lastVisited); + } + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + return InkWell( + onTap: () => productOnClick(context), + splashColor: Theme.of(context).primaryColor, + child: Card( + elevation: 2, + shape: Border(right: BorderSide(color: Colors.grey.shade300, width: 1)), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 0), + width: MediaQuery.of(context).size.width / 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Container( + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: item.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( + item.rxMessage != null ? item.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: [ + Texts( + projectProvider.isArabic ? item.name : item.namen, + regular: true, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Texts( + "SAR ${item.price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: item.approvedTotalReviews > 0 + ? (item.approvedRatingSum.toDouble() / + item.approvedTotalReviews.toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${item.approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + ], + ), + ], + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/manufacturerItem.dart b/lib/pages/pharmacies/widgets/manufacturerItem.dart new file mode 100644 index 00000000..7ffa3d89 --- /dev/null +++ b/lib/pages/pharmacies/widgets/manufacturerItem.dart @@ -0,0 +1,35 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; +import 'package:flutter/material.dart'; + +class ManufacturerItem extends StatelessWidget { + final Manufacturer item; + + ManufacturerItem(this.item); + + @override + Widget build(BuildContext context) { + return Card( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + border: Border( + right: BorderSide(color: Colors.grey.shade300, width: 1), + bottom: BorderSide(color: Colors.grey.shade300, width: 1), + left: BorderSide(color: Colors.grey.shade300, width: 1), + top: BorderSide(color: Colors.grey.shade300, width: 1)), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Image.network( + item.image.src, + fit: BoxFit.cover, + ), + ), + ), + ); + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 0a543185..f336497d 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health-weather/ import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family-member.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family_type.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; +import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; @@ -36,7 +37,8 @@ const String SYMPTOM_CHECKER = 'symptom-checker'; const String SYMPTOM_CHECKER_INFO = 'symptom-checker-info'; const String SELECT_GENDER = 'select-gender'; const String SETTINGS = 'settings'; -const String HEALTH_WEATHER ='health-weather'; +const String HEALTH_WEATHER = 'health-weather'; +const String APP_UPDATE = 'app_update'; var routes = { SPLASH: (_) => SplashScreen(), HOME: (_) => LandingPage(), @@ -55,5 +57,6 @@ var routes = { SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(), SELECT_GENDER: (_) => SelectGender(), SETTINGS: (_) => Settings(), - HEALTH_WEATHER: (_)=> HealthWeatherIndicator() + HEALTH_WEATHER: (_) => HealthWeatherIndicator(), + APP_UPDATE: (_) => AppUpdatePage() }; diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index bc80f47c..aedd0fbf 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -65,6 +65,7 @@ final blueBackground = Color(0xFFFFFFFF); }, ), hintColor: Colors.grey[400], + accentColor: Color(0xffB8382C), disabledColor: Colors.grey[300], errorColor: Color.fromRGBO(235, 80, 60, 1.0), scaffoldBackgroundColor: Color(0xffEEEEEE), diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index c5ef6b34..34c7bf87 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -21,7 +21,7 @@ class DateUtil { static String convertDateToString(DateTime date) { const start = "/Date("; - const end = "+0300)"; + const end = "+0300)/"; int milliseconds = date.millisecondsSinceEpoch; return start + "$milliseconds" + end; @@ -341,6 +341,7 @@ class DateUtil { break; case DayOfWeek.Sunday: return "Sunday"; + break; } return ""; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 42bfa3be..9f349de2 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:diplomaticquarterapp/config/localized_values.dart'; -import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:flutter/foundation.dart' show SynchronousFuture; import 'package:flutter/material.dart'; @@ -148,7 +147,7 @@ class TranslationBase { String get idNo => localizedValues['national-id'][locale.languageCode]; String get fileNo => localizedValues['fileNo'][locale.languageCode]; -String get fileno => localizedValues['fileno'][locale.languageCode]; + String get fileno => localizedValues['fileno'][locale.languageCode]; String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; @@ -697,6 +696,8 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; localizedValues['ServiceInformation'][locale.languageCode]; String get homeHealthCare => localizedValues['HomeHealthCare'][locale.languageCode]; + String get HHCNotAuthMsg => + localizedValues['HHCNotAuthMsg'][locale.languageCode]; String get homeHealthCareText => localizedValues['HomeHealthCareText'][locale.languageCode]; String get loginRegister => @@ -706,6 +707,23 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get infoRadiology => localizedValues['info-radiology'][locale.languageCode]; + // pharmacy module + String get medicationRefill => + localizedValues['medicationRefill'][locale.languageCode]; + String get offersAndPromotions => + localizedValues['offersAndPromotions'][locale.languageCode]; + String get myPrescriptions => + localizedValues['myPrescriptions'][locale.languageCode]; + String get searchAndScanMedication => + localizedValues['searchAndScanMedication'][locale.languageCode]; + String get shopByBrands => + localizedValues['shopByBrands'][locale.languageCode]; + String get recentlyViewed => + localizedValues['recentlyViewed'][locale.languageCode]; + String get bestSellers => localizedValues['bestSellers'][locale.languageCode]; + String get deleteAllItems => + localizedValues['deleteAllItems'][locale.languageCode]; + String get termsService => localizedValues['TermsService'][locale.languageCode]; String get beforeUsing => localizedValues['Beforeusing'][locale.languageCode]; @@ -791,7 +809,8 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get modes => localizedValues['modes'][locale.languageCode]; String get vibration => localizedValues['vibration'][locale.languageCode]; String get blindMode => localizedValues['blind-modes'][locale.languageCode]; - String get invertTheme => localizedValues['invert-theme'][locale.languageCode]; + String get invertTheme => + localizedValues['invert-theme'][locale.languageCode]; String get offTheme => localizedValues['off-theme'][locale.languageCode]; String get dimTheme => localizedValues['dim-theme'][locale.languageCode]; String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; @@ -805,8 +824,7 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; localizedValues['accessibility'][locale.languageCode]; String get selectClinic => localizedValues['selectClinic'][locale.languageCode]; - String get reviews => - localizedValues['reviews'][locale.languageCode]; + String get reviews => localizedValues['reviews'][locale.languageCode]; String get orderStatus => localizedValues['orderStatus'][locale.languageCode]; String get cancelOrder => localizedValues['CancelOrder'][locale.languageCode]; @@ -814,9 +832,12 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get feedback => localizedValues['Feedback'][locale.languageCode]; String get liveChat => localizedValues['LiveChat'][locale.languageCode]; String get service => localizedValues['Service'][locale.languageCode]; - String get hMGServiceLabel => localizedValues['HMGServiceLabel'][locale.languageCode]; - String get healthWeatherIndicators => localizedValues['HealthWeatherIndicators'][locale.languageCode]; - String get healthTipsBasedOnCurrentWeather => localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; + String get hMGServiceLabel => + localizedValues['HMGServiceLabel'][locale.languageCode]; + String get healthWeatherIndicators => + localizedValues['HealthWeatherIndicators'][locale.languageCode]; + String get healthTipsBasedOnCurrentWeather => + localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; String get moreDetails => localizedValues['MoreDetails'][locale.languageCode]; String get sendCopy => localizedValues['SendCopy'][locale.languageCode]; String get resendOrder => localizedValues['ResendOrder'][locale.languageCode]; @@ -830,7 +851,8 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get mass => localizedValues['mass'][locale.languageCode]; String get tempC => localizedValues['temp-c'][locale.languageCode]; String get bpm => localizedValues['bpm'][locale.languageCode]; - String get respirationSigns => localizedValues['respiration-signs'][locale.languageCode]; + String get respirationSigns => + localizedValues['respiration-signs'][locale.languageCode]; String get sysDias => localizedValues['sys-dias'][locale.languageCode]; String get body => localizedValues['body'][locale.languageCode]; String get feedbackTitle => localizedValues['feedback'][locale.languageCode]; @@ -839,29 +861,45 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get likeToHear => localizedValues['like-to-hear'][locale.languageCode]; String get subject => localizedValues['subject'][locale.languageCode]; String get message => localizedValues['message'][locale.languageCode]; - String get emptySubject => localizedValues['empty-subject'][locale.languageCode]; - String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; - String get selectAttachment => localizedValues['select-attachment'][locale.languageCode]; - String get complainAppo => localizedValues['complain-appo'][locale.languageCode]; - String get complainWithoutAppo => localizedValues['complain-without-appo'][locale.languageCode]; + String get emptySubject => + localizedValues['empty-subject'][locale.languageCode]; + String get emptyMessage => + localizedValues['empty-message'][locale.languageCode]; + String get selectAttachment => + localizedValues['select-attachment'][locale.languageCode]; + String get complainAppo => + localizedValues['complain-appo'][locale.languageCode]; + String get complainWithoutAppo => + localizedValues['complain-without-appo'][locale.languageCode]; String get question => localizedValues['question'][locale.languageCode]; - String get messageType => localizedValues['message-type'][locale.languageCode]; + String get messageType => + localizedValues['message-type'][locale.languageCode]; String get compliment => localizedValues['compliment'][locale.languageCode]; String get suggestion => localizedValues['suggestion'][locale.languageCode]; - String get yourFeedback => localizedValues['your-feedback'][locale.languageCode]; + String get yourFeedback => + localizedValues['your-feedback'][locale.languageCode]; String get selectPart => localizedValues['select-part'][locale.languageCode]; String get number => localizedValues['number'][locale.languageCode]; - String get notClassified => localizedValues['not-classified'][locale.languageCode]; - String get searchItemError => localizedValues['searchItemError'][locale.languageCode]; + String get notClassified => + localizedValues['not-classified'][locale.languageCode]; + String get searchItemError => + localizedValues['searchItemError'][locale.languageCode]; String get youCanFind => localizedValues['YouCanFind'][locale.languageCode]; - String get itemInSearch => localizedValues['ItemInSearch'][locale.languageCode]; - String get bloodDonation => localizedValues['blood-donation'][locale.languageCode]; - String get bloodInstruction => localizedValues['blood-instruction'][locale.languageCode]; - String get bloodTermsNcondition => localizedValues['view-terms'][locale.languageCode]; + String get itemInSearch => + localizedValues['ItemInSearch'][locale.languageCode]; + String get bloodDonation => + localizedValues['blood-donation'][locale.languageCode]; + String get bloodInstruction => + localizedValues['blood-instruction'][locale.languageCode]; + String get bloodTermsNcondition => + localizedValues['view-terms'][locale.languageCode]; String get invoiceNo => localizedValues['InvoiceNo'][locale.languageCode]; - String get specialResult => localizedValues['SpecialResult'][locale.languageCode]; - String get generalResult => localizedValues['GeneralResult'][locale.languageCode]; - String get showMoreBtn => localizedValues['show-more-btn'][locale.languageCode]; + String get specialResult => + localizedValues['SpecialResult'][locale.languageCode]; + String get generalResult => + localizedValues['GeneralResult'][locale.languageCode]; + String get showMoreBtn => + localizedValues['show-more-btn'][locale.languageCode]; String get value => localizedValues['value'][locale.languageCode]; String get range => localizedValues['range'][locale.languageCode]; String get outpatient => localizedValues['out-patient'][locale.languageCode]; @@ -870,7 +908,40 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get openRad => localizedValues['open-rad'][locale.languageCode]; String get sendCopyRad => localizedValues['send-copy'][locale.languageCode]; String get appoSurvey => localizedValues['appoSurvey'][locale.languageCode]; - + String get vaccination => localizedValues['vaccination'][locale.languageCode]; + String get welcomeBackV => + localizedValues['welcomeBack'][locale.languageCode]; + String get instructions => + localizedValues['instructions'][locale.languageCode]; + String get updateEmail => + localizedValues['update-email'][locale.languageCode]; + String get updatedEmail => + localizedValues['updated-email'][locale.languageCode]; + String get viewListChildren => + localizedValues['view-list-children'][locale.languageCode]; + String get addChild => localizedValues['add-child'][locale.languageCode]; + String get childName => localizedValues['child-name'][locale.languageCode]; + String get childDob => localizedValues['childDob'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; + String get deletedChildMes => + localizedValues['deleted-child-mes'][locale.languageCode]; + String get visit => localizedValues['visit'][locale.languageCode]; + String get descriptionVaccination => + localizedValues['description-vaccination'][locale.languageCode]; + String get dueDate => localizedValues['due-date'][locale.languageCode]; + String get validEmail => localizedValues['valid-email'][locale.languageCode]; + String get confirmSend => + localizedValues['confirm-send'][locale.languageCode]; + String get emailSuccess => + localizedValues['email-success'][locale.languageCode]; + String get deletedChild => + localizedValues['deleted-child'][locale.languageCode]; + String get addInstructions => + localizedValues['add-instructions'][locale.languageCode]; + String get addedChild => localizedValues['added-child'][locale.languageCode]; + String get appUpdate => localizedValues['appUpdate'][locale.languageCode]; + String get ereferralSaveSuccess => + localizedValues['ereferralSaveSuccess'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 0a7d6026..3e1e4892 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:core'; import 'dart:typed_data'; import 'package:connectivity/connectivity.dart'; @@ -158,4 +159,22 @@ class Utils { r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") .hasMatch(email); } + +} +// extension function that use in iterations(list.. etc) to iterate items and get index and item it self +extension IndexedIterable on Iterable { + Iterable mapIndexed(T Function(E e, int i) f) { + var i = 0; + return map((e) => f(e, i++)); + } } +/* + userBoard.asMap().map((i, element) => MapEntry(i, Stack( + GestureDetector(onTap: () { + setState(() { + // print("element=${element.toString()}"); + // print("element=${userBoard[i].toString()}"); + }); + }), + ))).values.toList(); + */ diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index ba35f3c6..31ed59dc 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -80,7 +80,8 @@ class BottomNavigationItem extends StatelessWidget { toAnimate: false, position: BadgePosition.topEnd(), shape: BadgeShape.circle, - badgeColor: Color(0xFF40ACC9).withOpacity(1.0), + badgeColor: Colors + .red[800].withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index 66ee36c4..f8a99c17 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -15,7 +15,7 @@ class ImageOptions { return _BottomSheet( children: [ _BottomSheetItem( - title: "Select file souse", + title: "Select file source", ), _BottomSheetItem( title: "Gallery", diff --git a/lib/widgets/buttons/GestureIconButton.dart b/lib/widgets/buttons/GestureIconButton.dart new file mode 100644 index 00000000..841d7ea6 --- /dev/null +++ b/lib/widgets/buttons/GestureIconButton.dart @@ -0,0 +1,70 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class GestureIconButton extends StatefulWidget { + GestureIconButton( + this.label, + this.icon, { + Key key, + this.onTap, + this.backgroundColor, + }) : super(key: key); + + final String label; + final Widget icon; + final VoidCallback onTap; + final Color backgroundColor; + + @override + _GestureIconButtonState createState() => _GestureIconButtonState(); +} + +class _GestureIconButtonState extends State { + bool _buttonLongPress = false; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onLongPressStart: (_) => + setState(() => _buttonLongPress = !_buttonLongPress), + onLongPressEnd: (_) => + setState(() => _buttonLongPress = !_buttonLongPress), + child: Wrap( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all( + color: widget.backgroundColor != null + ? widget.backgroundColor + : Colors.grey[200], + ), + color: widget.backgroundColor != null + ? widget.backgroundColor + : Colors.grey.shade200, + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Expanded( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: widget.icon, + ), + Texts( + widget.label, + color: _buttonLongPress ? Colors.white : Colors.black, + ), + ], + ), + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/buttons/borderedButton.dart b/lib/widgets/buttons/borderedButton.dart new file mode 100644 index 00000000..5e05448e --- /dev/null +++ b/lib/widgets/buttons/borderedButton.dart @@ -0,0 +1,59 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:flutter/material.dart'; + +class BorderedButton extends StatelessWidget { + final String text; + final Function handler; + final Color color; + final bool hasBorder; + final Color borderColor; + final Color backgroundColor; + final double vPadding; + final double hPadding; + + BorderedButton( + this.text, { + this.handler, + this.color, + this.hasBorder = false, + this.borderColor, + this.backgroundColor, + this.vPadding = 0, + this.hPadding = 0, + }); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 4, vertical: 4), + child: ButtonTheme( + //adds padding inside the button + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + //limits the touch area to the button area + minWidth: 0, + //wraps child's width + height: 0, + //wraps child's height + child: RaisedButton( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + padding: EdgeInsets.symmetric(horizontal: 12, vertical: vPadding), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.0), + side: BorderSide(color: hasBorder ? borderColor : Colors.white, width: 0.8),), + color: backgroundColor ?? Colors.white, + textColor: color ?? Color(0xffc4aa54), + disabledTextColor: color ?? Colors.black, + disabledColor: backgroundColor ?? Colors.white, + onPressed: handler, + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.normal), + ), + ), //your original button + ), + ); + } +} diff --git a/lib/widgets/dialogs/select_location_dialog.dart b/lib/widgets/dialogs/select_location_dialog.dart new file mode 100644 index 00000000..34e37208 --- /dev/null +++ b/lib/widgets/dialogs/select_location_dialog.dart @@ -0,0 +1,139 @@ +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class SelectLocationDialog extends StatefulWidget { + final List addresses; + final Function(AddressInfo) onValueSelected; + AddressInfo selectedAddress; + + SelectLocationDialog( + {Key key, this.addresses, this.onValueSelected, this.selectedAddress}); + + @override + _SelectLocationDialogState createState() => _SelectLocationDialogState(); +} + +class _SelectLocationDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedAddress = widget.selectedAddress ?? widget.addresses[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + title: Texts("sdsdsd"), + children: [ + Column( + children: [ + Container( + height: 150, + child: SingleChildScrollView( + child: Column( + children: [ + Divider(), + ...List.generate( + widget.addresses.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedAddress = widget.addresses[index]; + }); + }, + child: ListTile( + title: Text(widget.addresses[index].address1), + leading: Radio( + value: widget.addresses[index], + groupValue: widget.selectedAddress, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedAddress = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedAddress); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 6e740fc8..e31ae88a 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -47,7 +47,7 @@ class TextFields extends StatefulWidget { this.autoFocus, this.onChanged, - // this.initialValue, + this.initialValue, this.minLines, this.maxLines, this.inputFormatters, @@ -79,7 +79,7 @@ class TextFields extends StatefulWidget { final String hintText; - // final String initialValue; + final String initialValue; final String type; final bool autoFocus; final IconData suffixIcon; @@ -230,7 +230,7 @@ class _TextFieldsState extends State { minLines: widget.minLines ?? 1, maxLines: widget.maxLines ?? 1, maxLengthEnforced: widget.maxLengthEnforced, - // initialValue: widget.initialValue, + initialValue: widget.initialValue, onChanged: widget.onChanged, focusNode: _focusNode, maxLength: widget.maxLength ?? null, diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index a807b02e..976b28e1 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -40,6 +41,8 @@ class AppScaffold extends StatelessWidget { final String image; final bool isShowDecPage; final List infoList; + final Color backgroundColor; + AuthenticatedUserObject authenticatedUserObject = locator(); @@ -55,6 +58,7 @@ class AppScaffold extends StatelessWidget { this.title, this.description, this.isShowDecPage = true, + this.backgroundColor, this.isBottomBar, this.image, this.infoList}); @@ -64,7 +68,7 @@ class AppScaffold extends StatelessWidget { AppGlobal.context = context; return Scaffold( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, + backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, appBar: isShowAppBar ? AppBar( elevation: 0, diff --git a/pubspec.yaml b/pubspec.yaml index 26fafc7f..66e08f5c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -77,6 +77,9 @@ dependencies: # charts charts_flutter: ^0.9.0 + #image banner slider + carousel_slider: ^2.3.1 + google_maps_flutter: ^1.0.3 # Qr code Scanner @@ -94,9 +97,6 @@ dependencies: # Location Helper map_launcher: ^0.8.1 - #carousel slider - carousel_slider: ^2.3.1 - #Calendar Events manage_calendar_events: ^1.0.2 @@ -181,6 +181,7 @@ flutter: - assets/images/svg/ - assets/tracker/ - assets/images/AlHabibMedicalService/ + - assets/images/pharmacy_module/ fonts: