diff --git a/android/app/build.gradle b/android/app/build.gradle index 99f2b204..3adef1e4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -72,9 +72,13 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "com.google.firebase:firebase-messaging:20.3.0" + implementation "com.google.firebase:firebase-messaging:21.0.0" +// implementation ('com.google.firebase:firebase-inappmessaging-display:19.1.2',{ +// exclude group: 'com.google.protobuf',module: 'protobuf-javalite' +// exclude group: 'com.google.protobuf',module: 'protobuf-lite' +// }) implementation 'pub.devrel:easypermissions:0.4.0' - implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0' + // implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0' implementation 'com.google.guava:guava:27.0.1-android' // Dependency on local binaries implementation fileTree(dir: 'libs', include: ['*.jar']) diff --git a/android/build.gradle b/android/build.gradle index 8e56476b..433bc8ad 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:4.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.2' + classpath 'com.google.gms:google-services:4.3.4' } } diff --git a/android/gradle.properties b/android/gradle.properties index 9c0729c9..38c8d454 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,4 @@ - +org.gradle.jvmargs=-Xmx1536M android.enableR8=true android.useAndroidX=true android.enableJetifier=true -org.gradle.jvmargs=-Xmx4608m diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 5660070d..c935be88 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/assets/images/new-design/empty_box.png b/assets/images/new-design/empty_box.png new file mode 100644 index 00000000..af3551fd Binary files /dev/null and b/assets/images/new-design/empty_box.png differ diff --git a/assets/images/new-design/liveCare_white_logo.svg b/assets/images/new-design/liveCare_white_logo.svg new file mode 100644 index 00000000..494b3671 --- /dev/null +++ b/assets/images/new-design/liveCare_white_logo.svg @@ -0,0 +1,40 @@ + + + + + + Online Consultation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new-design/livecare_arabic_logo.svg b/assets/images/new-design/livecare_arabic_logo.svg new file mode 100644 index 00000000..c524a803 --- /dev/null +++ b/assets/images/new-design/livecare_arabic_logo.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + استشارة مباشرة + + diff --git a/assets/images/new-design/livecare_white_logo.png b/assets/images/new-design/livecare_white_logo.png new file mode 100644 index 00000000..dc223965 Binary files /dev/null and b/assets/images/new-design/livecare_white_logo.png differ diff --git a/assets/images/no_image.png b/assets/images/no_image.png new file mode 100644 index 00000000..ebe05472 Binary files /dev/null and b/assets/images/no_image.png differ diff --git a/assets/images/offer.png b/assets/images/offer.png new file mode 100644 index 00000000..b9977670 Binary files /dev/null and b/assets/images/offer.png differ diff --git a/assets/images/offer_ar.png b/assets/images/offer_ar.png new file mode 100644 index 00000000..1fdbf749 Binary files /dev/null and b/assets/images/offer_ar.png differ diff --git a/assets/images/pharmacy/Group 1206.svg b/assets/images/pharmacy/Group 1206.svg new file mode 100644 index 00000000..ef8f7473 --- /dev/null +++ b/assets/images/pharmacy/Group 1206.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/Group 1207.svg b/assets/images/pharmacy/Group 1207.svg new file mode 100644 index 00000000..fd2ffd41 --- /dev/null +++ b/assets/images/pharmacy/Group 1207.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/Logo Parmacy-green.png b/assets/images/pharmacy/Logo Parmacy-green.png new file mode 100644 index 00000000..72862b33 Binary files /dev/null and b/assets/images/pharmacy/Logo Parmacy-green.png differ diff --git a/assets/images/pharmacy/aramex_shipping_logo.svg b/assets/images/pharmacy/aramex_shipping_logo.svg new file mode 100644 index 00000000..30cc03b8 --- /dev/null +++ b/assets/images/pharmacy/aramex_shipping_logo.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/assets/images/pharmacy/arrow-left-png.png b/assets/images/pharmacy/arrow-left-png.png new file mode 100644 index 00000000..18d58c87 Binary files /dev/null and b/assets/images/pharmacy/arrow-left-png.png differ diff --git a/assets/images/pharmacy/arrow-left.png b/assets/images/pharmacy/arrow-left.png new file mode 100644 index 00000000..18d58c87 Binary files /dev/null and b/assets/images/pharmacy/arrow-left.png differ diff --git a/assets/images/pharmacy/arrow-right-png.png b/assets/images/pharmacy/arrow-right-png.png new file mode 100644 index 00000000..19af7c0b Binary files /dev/null and b/assets/images/pharmacy/arrow-right-png.png differ diff --git a/assets/images/pharmacy/arrow.png b/assets/images/pharmacy/arrow.png new file mode 100644 index 00000000..19af7c0b Binary files /dev/null and b/assets/images/pharmacy/arrow.png differ diff --git a/assets/images/pharmacy/arrow_lef.png b/assets/images/pharmacy/arrow_lef.png new file mode 100644 index 00000000..19af7c0b Binary files /dev/null and b/assets/images/pharmacy/arrow_lef.png differ diff --git a/assets/images/pharmacy/arrow_left.svg b/assets/images/pharmacy/arrow_left.svg new file mode 100644 index 00000000..00fa7556 --- /dev/null +++ b/assets/images/pharmacy/arrow_left.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/arrow_right.svg b/assets/images/pharmacy/arrow_right.svg new file mode 100644 index 00000000..b4243287 --- /dev/null +++ b/assets/images/pharmacy/arrow_right.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/check_icon.svg b/assets/images/pharmacy/check_icon.svg new file mode 100644 index 00000000..cfa4f441 --- /dev/null +++ b/assets/images/pharmacy/check_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/compare.png b/assets/images/pharmacy/compare.png new file mode 100644 index 00000000..11a49dfb Binary files /dev/null and b/assets/images/pharmacy/compare.png differ diff --git a/assets/images/pharmacy/contact_us_icon.svg b/assets/images/pharmacy/contact_us_icon.svg new file mode 100644 index 00000000..fa591d47 --- /dev/null +++ b/assets/images/pharmacy/contact_us_icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/pharmacy/credit_card_icon.svg b/assets/images/pharmacy/credit_card_icon.svg new file mode 100644 index 00000000..9ba6c2bf --- /dev/null +++ b/assets/images/pharmacy/credit_card_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/delete_red_icon.svg b/assets/images/pharmacy/delete_red_icon.svg new file mode 100644 index 00000000..8897a683 --- /dev/null +++ b/assets/images/pharmacy/delete_red_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/edit_icon.svg b/assets/images/pharmacy/edit_icon.svg new file mode 100644 index 00000000..df7cca2f --- /dev/null +++ b/assets/images/pharmacy/edit_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/empty_box.svg b/assets/images/pharmacy/empty_box.svg new file mode 100644 index 00000000..05816608 --- /dev/null +++ b/assets/images/pharmacy/empty_box.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/hmg_shipping_greenlogo.svg b/assets/images/pharmacy/hmg_shipping_greenlogo.svg new file mode 100644 index 00000000..449712a5 --- /dev/null +++ b/assets/images/pharmacy/hmg_shipping_greenlogo.svg @@ -0,0 +1,25 @@ + + + diff --git a/assets/images/pharmacy/hmg_shipping_logo.svg b/assets/images/pharmacy/hmg_shipping_logo.svg new file mode 100644 index 00000000..8e9db3d6 --- /dev/null +++ b/assets/images/pharmacy/hmg_shipping_logo.svg @@ -0,0 +1,17 @@ + + + diff --git a/assets/images/pharmacy/lakum_icon.svg b/assets/images/pharmacy/lakum_icon.svg new file mode 100644 index 00000000..e2b223de --- /dev/null +++ b/assets/images/pharmacy/lakum_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/medication_refill_icon.svg b/assets/images/pharmacy/medication_refill_icon.svg new file mode 100644 index 00000000..d5951130 --- /dev/null +++ b/assets/images/pharmacy/medication_refill_icon.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/mobile_number_icon.svg b/assets/images/pharmacy/mobile_number_icon.svg new file mode 100644 index 00000000..d98aaf29 --- /dev/null +++ b/assets/images/pharmacy/mobile_number_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/my_family_icon.svg b/assets/images/pharmacy/my_family_icon.svg new file mode 100644 index 00000000..838b357e --- /dev/null +++ b/assets/images/pharmacy/my_family_icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/my_prescription_icon.svg b/assets/images/pharmacy/my_prescription_icon.svg new file mode 100644 index 00000000..bda0e22e --- /dev/null +++ b/assets/images/pharmacy/my_prescription_icon.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/orders_icon.svg b/assets/images/pharmacy/orders_icon.svg new file mode 100644 index 00000000..f09ae19d --- /dev/null +++ b/assets/images/pharmacy/orders_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/our_locations_icon.svg b/assets/images/pharmacy/our_locations_icon.svg new file mode 100644 index 00000000..2be16631 --- /dev/null +++ b/assets/images/pharmacy/our_locations_icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/pharmacy/pill_reminder_icon.svg b/assets/images/pharmacy/pill_reminder_icon.svg new file mode 100644 index 00000000..f4fb4ddc --- /dev/null +++ b/assets/images/pharmacy/pill_reminder_icon.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/quote_end.svg b/assets/images/pharmacy/quote_end.svg new file mode 100644 index 00000000..083ff39a --- /dev/null +++ b/assets/images/pharmacy/quote_end.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/quote_start.svg b/assets/images/pharmacy/quote_start.svg new file mode 100644 index 00000000..74216f14 --- /dev/null +++ b/assets/images/pharmacy/quote_start.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/review_icon.svg b/assets/images/pharmacy/review_icon.svg new file mode 100644 index 00000000..bb826f21 --- /dev/null +++ b/assets/images/pharmacy/review_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/shipping_addresses_icon.svg b/assets/images/pharmacy/shipping_addresses_icon.svg new file mode 100644 index 00000000..ebb8692f --- /dev/null +++ b/assets/images/pharmacy/shipping_addresses_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/shipping_mark_icon.svg b/assets/images/pharmacy/shipping_mark_icon.svg new file mode 100644 index 00000000..5cf9606b --- /dev/null +++ b/assets/images/pharmacy/shipping_mark_icon.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/shipping_truck_icon.svg b/assets/images/pharmacy/shipping_truck_icon.svg new file mode 100644 index 00000000..8ffda974 --- /dev/null +++ b/assets/images/pharmacy/shipping_truck_icon.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/success_check_icon.svg b/assets/images/pharmacy/success_check_icon.svg new file mode 100644 index 00000000..ed1379b8 --- /dev/null +++ b/assets/images/pharmacy/success_check_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/success_review_icon.svg b/assets/images/pharmacy/success_review_icon.svg new file mode 100644 index 00000000..f6951456 --- /dev/null +++ b/assets/images/pharmacy/success_review_icon.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/terms.png b/assets/images/pharmacy/terms.png new file mode 100644 index 00000000..76cfacab Binary files /dev/null and b/assets/images/pharmacy/terms.png differ diff --git a/assets/images/pharmacy/user.svg b/assets/images/pharmacy/user.svg new file mode 100644 index 00000000..8e978105 --- /dev/null +++ b/assets/images/pharmacy/user.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/user_icon.svg b/assets/images/pharmacy/user_icon.svg new file mode 100644 index 00000000..8e978105 --- /dev/null +++ b/assets/images/pharmacy/user_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/wishklist_icon.svg b/assets/images/pharmacy/wishklist_icon.svg new file mode 100644 index 00000000..cd0ce16d --- /dev/null +++ b/assets/images/pharmacy/wishklist_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/wishlist_icon.svg b/assets/images/pharmacy/wishlist_icon.svg new file mode 100644 index 00000000..910a3ab8 --- /dev/null +++ b/assets/images/pharmacy/wishlist_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy_module/ic_payment_option.png b/assets/images/pharmacy_module/ic_payment_option.png new file mode 100644 index 00000000..5f3fca8f Binary files /dev/null and b/assets/images/pharmacy_module/ic_payment_option.png differ diff --git a/assets/images/pharmacy_module/ic_shipping_address.png b/assets/images/pharmacy_module/ic_shipping_address.png new file mode 100644 index 00000000..9566fb30 Binary files /dev/null and b/assets/images/pharmacy_module/ic_shipping_address.png differ diff --git a/assets/images/pharmacy_module/ic_shipping_mark.png b/assets/images/pharmacy_module/ic_shipping_mark.png new file mode 100644 index 00000000..cc4b272d Binary files /dev/null and b/assets/images/pharmacy_module/ic_shipping_mark.png differ diff --git a/assets/images/pharmacy_module/ic_shipping_truck.png b/assets/images/pharmacy_module/ic_shipping_truck.png new file mode 100644 index 00000000..274ae1da Binary files /dev/null and b/assets/images/pharmacy_module/ic_shipping_truck.png differ diff --git a/assets/images/pharmacy_module/lakum/Account_activation_icon.png b/assets/images/pharmacy_module/lakum/Account_activation_icon.png new file mode 100644 index 00000000..dc93366c Binary files /dev/null and b/assets/images/pharmacy_module/lakum/Account_activation_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png b/assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png new file mode 100644 index 00000000..b7d33dd6 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/expired_icon.png b/assets/images/pharmacy_module/lakum/expired_icon.png new file mode 100644 index 00000000..9a980984 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/expired_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/inactive_cross.png b/assets/images/pharmacy_module/lakum/inactive_cross.png new file mode 100644 index 00000000..5a592b7a Binary files /dev/null and b/assets/images/pharmacy_module/lakum/inactive_cross.png differ diff --git a/assets/images/pharmacy_module/lakum/lakum_card_front_bg.png b/assets/images/pharmacy_module/lakum/lakum_card_front_bg.png new file mode 100644 index 00000000..73323a0e Binary files /dev/null and b/assets/images/pharmacy_module/lakum/lakum_card_front_bg.png differ diff --git a/assets/images/pharmacy_module/lakum/lakum_checkout.png b/assets/images/pharmacy_module/lakum/lakum_checkout.png new file mode 100644 index 00000000..e0230a00 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/lakum_checkout.png differ diff --git a/assets/images/pharmacy_module/lakum/waiting_gained_icon.png b/assets/images/pharmacy_module/lakum/waiting_gained_icon.png new file mode 100644 index 00000000..37ff1ac9 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/waiting_gained_icon.png differ diff --git a/assets/images/pharmacy_module/lakum/will_be_expired_icon.png b/assets/images/pharmacy_module/lakum/will_be_expired_icon.png new file mode 100644 index 00000000..7f31f622 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/will_be_expired_icon.png differ diff --git a/assets/images/pharmacy_module/payment/LogoParmacyGreen.png b/assets/images/pharmacy_module/payment/LogoParmacyGreen.png new file mode 100644 index 00000000..72862b33 Binary files /dev/null and b/assets/images/pharmacy_module/payment/LogoParmacyGreen.png differ diff --git a/assets/images/pharmacy_module/payment/aramex_shipping_logo.png b/assets/images/pharmacy_module/payment/aramex_shipping_logo.png new file mode 100644 index 00000000..e7b45d9c Binary files /dev/null and b/assets/images/pharmacy_module/payment/aramex_shipping_logo.png differ diff --git a/assets/images/pharmacy_module/payment/hmg_shipping_logo.png b/assets/images/pharmacy_module/payment/hmg_shipping_logo.png new file mode 100644 index 00000000..725b2e5e Binary files /dev/null and b/assets/images/pharmacy_module/payment/hmg_shipping_logo.png differ diff --git a/assets/images/pharmacy_module/payment/installment.png b/assets/images/pharmacy_module/payment/installment.png new file mode 100644 index 00000000..034497ef Binary files /dev/null and b/assets/images/pharmacy_module/payment/installment.png differ diff --git a/assets/images/pharmacy_module/payment/mada.png b/assets/images/pharmacy_module/payment/mada.png new file mode 100644 index 00000000..f65b970c Binary files /dev/null and b/assets/images/pharmacy_module/payment/mada.png differ diff --git a/assets/images/pharmacy_module/payment/mastercard.png b/assets/images/pharmacy_module/payment/mastercard.png new file mode 100644 index 00000000..1d48b854 Binary files /dev/null and b/assets/images/pharmacy_module/payment/mastercard.png differ diff --git a/assets/images/pharmacy_module/payment/sadad.png b/assets/images/pharmacy_module/payment/sadad.png new file mode 100644 index 00000000..35e0426c Binary files /dev/null and b/assets/images/pharmacy_module/payment/sadad.png differ diff --git a/assets/images/pharmacy_module/payment/visa.png b/assets/images/pharmacy_module/payment/visa.png new file mode 100644 index 00000000..8d29703c Binary files /dev/null and b/assets/images/pharmacy_module/payment/visa.png differ diff --git a/assets/images/pharmacy_module/payment_image.png b/assets/images/pharmacy_module/payment_image.png new file mode 100644 index 00000000..ebf7a929 Binary files /dev/null and b/assets/images/pharmacy_module/payment_image.png differ diff --git a/assets/images/progress-loading-red.gif b/assets/images/progress-loading-red.gif new file mode 100644 index 00000000..517c3dab Binary files /dev/null and b/assets/images/progress-loading-red.gif differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 4183fe68..cd7a5383 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,9 +13,14 @@ const PACKAGES_CATEGORIES = '/api/categories'; const PACKAGES_PRODUCTS = '/api/products'; const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; + +//const BASE_PHARMACY_URL = 'http://swd-pharapp-01:7200/api/'; +const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; -// const BASE_URL = 'https://hmgwebservices.com/'; + const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; ///Geofencing @@ -101,13 +106,17 @@ const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID'; ///userInformation 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'; ///newUserId const GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New'; -///delteChild +///delete Child const DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby'; ///addNewTABLE @@ -307,12 +316,46 @@ 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 wishlist +// const GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/"; + // pharmacy +const PHARMACY_VERIFY_CUSTOMER = "epharmacy/api/VerifyCustomer"; +const PHARMACY_GET_COUNTRY = "epharmacy/api/countries"; +const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer"; 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/"; +const GET_ORDER = "orders?"; +const GET_ORDER_DETAILS = "epharmacy/api/orders/"; +const ADD_CUSTOMER_ADDRESS = "epharmacy/api/addcustomeraddress"; +const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress"; +const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress"; +const GET_ADDRESS = "Customers/"; +const GET_Cancel_ORDER = "cancelorder/"; +const WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8"; +const GET_SHOPPING_CART = "epharmacy/api/shopping_cart_items/"; +const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/"; +const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/"; +const DELETE_SHOPPING_CART_ALL = + "epharmacy/api/delete_shopping_cart_item_by_customer/"; +const ORDER_SHOPPING_CART = "epharmacy/api/orders"; +const GET_LACUM_ACCOUNT_INFORMATION = + "Services/Patients.svc/REST/GetLakumAccountInformation"; +const GET_LACUM_GROUP_INFORMATION = + "Services/Patients.svc/REST/GetlakumInQueryInfoGrouping"; +const LACUM_ACCOUNT_ACTIVATE = + "Services/Patients.svc/REST/LakumAccountActivation"; +const LACUM_ACCOUNT_DEACTIVATE = + "Services/Patients.svc/REST/LakumAccountDeactivation"; +const CREATE_LAKUM_ACCOUNT = + "Services/Patients.svc/REST/PHR_CreateLakumAccount"; +const TRANSFER_YAHALA_LOYALITY_POINTS = + "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; +const LAKUM_GET_USER_TERMS_AND_CONDITIONS = + "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; // Home Health Care const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; @@ -321,12 +364,62 @@ const PATIENT_ER_UPDATE_PRES_ORDER = "Services/Patients.svc/REST/PatientER_Updat const GET_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; const GET_CMC_ORDER_DETAIL_BY_ID = "Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder"; const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems"; -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 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'; +const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; + +//Pharmacy wishlist +const GET_WISHLIST = "shopping_cart_items/"; +const DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id="; +const GET_REVIEW = "customerreviews/"; +const GET_BRANDS = "manufacturer"; +const GET_TOP_BRANDS = "topmanufacturer?page=1&limit=8"; +const GET_PRODUCT_DETAIL = "products/"; +const GET_LOCATION = "Services/Patients.svc/REST/GetPharmcyListBySKU"; +const GET_SPECIFICATION = "productspecification/"; +const GET_BRAND_ITEMS = "products?ManufacturerId="; + +// 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"; + +//Pharmacy + +const GET_PHARMACY_CATEGORISE = + 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; +const GET_OFFERS_CATEGORISE = 'epharmacy/api/discountcategories'; +const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/'; +const GET_CATEGORISE_PARENT = + 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_PARENT_PRODUCTS = 'epharmacy/api/products?categoryid='; +const GET_SUB_CATEGORISE = + 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; +const GET_SUB_PRODUCTS = 'epharmacy/api/products?categoryid='; +const GET_FINAL_PRODUCTS = + 'epharmacy/api/products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId='; + + const TIMER_MIN = 10; const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; +const GET_BRANDS_LIST = 'epharmacy/api/categoryManufacturer?categoryids='; + +const GET_SEARCH_PRODUCTS = + 'epharmacy/api/searchproducts?fields=id,discount_ids,reviews,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&search_key='; + +const SCAN_QR_CODE = 'epharmacy/api/productbysku/'; + class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b1f25ad9..387dbcb1 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -586,6 +586,82 @@ const Map localizedValues = { "ar": "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." }, + "orders": {"en": "Orders", "ar": "الطلبات"}, + "lakum": {"en": "Lakum", "ar": "لكم"}, + "wishlist": {"en": "Wishlist", "ar": "الرغبات"}, + "reviews": {"en": "Reviews", "ar": "التقيمات"}, + // "myPrescriptions": {"en": "My Prescriptions", "ar": "وصفاتي"}, + // "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"}, + "pillReminder": {"en": "Pill Reminder", "ar": "تذكير الأدويه"}, + "shippingAddresses": {"en": "Shipping Addresses", "ar": "عناوين الشحن"}, + "reachUs": {"en": "Reach Us", "ar": "الوصول لنا"}, + "ourLocations": {"en": "Our Locations", "ar": "مواقعنا"}, + "edit": {"en": "Edit", "ar": "تعديل"}, + "delete": {"en": "Delete", "ar": " حذف"}, + "addAddress": {"en": "ADD A NEW ADDRESS", "ar": " اضافة عنوان جديد"}, + "addNewAddress": {"en": "Add New Address", "ar": " اضافة عنوان جديد"}, + "order": {"en": "My Order", "ar": " طلباتي"}, + "delivered": {"en": "Delivered", "ar": " تم التوصيل"}, + "pending": {"en": "Pending", "ar": " معلقة "}, + "processing": {"en": "Processing", "ar": " تحت المعالجة"}, + "cancelled": {"en": "Cancelled", "ar": " ملغي"}, + "writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"}, + "shareReview": {"en": "SHARE REVIEW", "ar": " اكتب تقييمك"}, + "review": {"en": " reviews", "ar": " تقييمات"}, + "pendingOrder": {"en": " PENDING", "ar": " معلقة"}, + "deliveredOrder": {"en": " DELIVERED", "ar": " تم التوصيل"}, + "processingOrder": {"en": " PROCESSING", "ar": "قيد التنفيذ"}, + "cancelledOrder": {"en": " CANCELLED", "ar": "ملغي"}, + "compare": {"en": " Compare", "ar": "مقارنه"}, + "medicationsRefill": {"en": " Medication Refill", "ar": "طلب أعادة صرف"}, + "myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"}, + "quantity": {"en": " QTY ", "ar": "الكمية"}, + "backMyAccount": { + "en": "BACK TO MY ACCOUNT ", + "ar": " الرجوع لحسابي الشخصي" + }, + "reviewSuccessful": {"en": "Review Successful", "ar": " تقييم ناجح"}, + "reviewShared": { + "en": "Your review has been shared on product review section", + "ar": " تمت مشاركة تقييمك في قسم تقييم المنتج" + }, + "reviewComment": { + "en": "Your reviews help other to choose better product", + "ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل" + }, + "shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"}, + "orderDetail": {"en": "Order Details", "ar": " تفاصيل الطلب"}, + "orderSummary": {"en": "Order Summary", "ar": " تفاصيل المنتج"}, + "subtotal": {"en": "Subtotal", "ar": " المجموع الفرعي"}, + "shipping": {"en": "Shipping", "ar": " الشحن"}, + "shipBy": {"en": "SHIP BY:", "ar": "الشحن عن طريق:"}, + "lakumPoints": {"en": "Lakum Points", "ar": "نقاط لكم"}, + "use": {"en": "USE", "ar": "استخدم"}, + "proceedPay": {"en": "PROCEED TO PAY", "ar": "المتابعة للدفع"}, + "vat": {"en": "VAT (15%)", "ar": "(15%) القيمة المضافة"}, + "inclusiveVat": {"en": "(inclusive VAT)", "ar": "(شامل الضريبة)"}, + "items": {"en": "item(s)", "ar": "عنصر"}, + "checkOut": {"en": "CHECK OUT", "ar": "الدفع"}, + "sar": {"en": "SAR", "ar": " ر.س "}, + "payOnline": {"en": "PAY ONLINE", "ar": "اتمام عملية الدفع "}, + "cancelOrder": {"en": "CANCEL ORDER", "ar": "الغاء الطلب "}, + "confirmAddress": {"en": "CONFIRM ADDRESS ", "ar": " تأكيد العنوان "}, + "confirmLocation": {"en": "CONFIRM LOCATION ", "ar": " تأكيد الموقع "}, + "conditionsHMG": {"en": "Terms & Conditions ", "ar": "الشروط و الأحكام "}, + "conditions": {"en": "Terms & Conditions of Lakum", "ar": "شروط و احكام لكم"}, + "confirmDeleteMsg": { + "en": "Are you sure! want to delete ", + "ar": "هل انت متأكد تريد الحذف " + }, + "confirmDelete": {"en": "DELETE", "ar": "حذف"}, + "confirmCancellation": { + "en": "Are you sure! want to cancel this order ", + "ar": "هل انت متأكد تريد حذف هذا المنتج " + }, + "orderNumber": {"en": "Order#: ", "ar": "الطلب: "}, + "orderDate": {"en": "Date", "ar": "التاريخ:"}, + "itemsNo": {"en": "items(s)", "ar": "عناصر"}, + "noOrder": {"en": "You Don't have any orders.", "ar": "ليس لديك طلبات"}, "TermsService": {"en": "Terms of Service", "ar": "شروط الخدمه"}, "Beforeusing": { @@ -638,12 +714,50 @@ const Map localizedValues = { "recentlyViewed": {"en": "Recently Viewed", "ar": "شوهدت مؤخرا"}, "bestSellers": {"en": "Best Sellers", "ar": "أفضل البائعين"}, "deleteAllItems": {"en": "Delete All Items", "ar": "حذف كافة العناصر"}, + "total": {"en": "Total", "ar": "المجموع"}, + "selectAddress": {"en": "Select Address", "ar": "حدد العنوان"}, + "shippingAddress": {"en": "SHIPPING ADDRESS", "ar": "عنوان الشحن"}, + "changeAddress": {"en": "Change Address", "ar": "تغيير العنوان"}, + "selectPaymentOption": { + "en": "Select Payment Option", + "ar": "حدد خيار الدفع" + }, + "changeMethod": {"en": "Change Method", "ar": "تغيير خيار الدفع"}, + "reviewOrder": {"en": "Review Order", "ar": "مراجعة الطلب"}, + "active": {"en": "ACTIVE", "ar": "فعال"}, + "inactive": {"en": "INACTIVE", "ar": "غير فعال"}, + "balance": {"en": "BALANCE", "ar": "الحالي"}, + "gained": {"en": "GAINED", "ar": "المكتسب"}, + "consumed": {"en": "CONSUMED", "ar": "المستهلك"}, + "transferred": {"en": "TRANSFERRED", "ar": "المحول"}, + "checkBeneficiary": {"en": "CHECK BENEFICIARY", "ar": "تحقق من المستفيد"}, + "beneficiaryName": {"en": "Beneficiary Name", "ar": "اسم المستفيد"}, + "accountActivation": {"en": "Account Activation", "ar": "تفعيل الحساب"}, + "acceptLbl": {"en": "Accept", "ar": "موافقة"}, "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, "select-age": {"en": "Select Your Age", "ar": "حدد العمر"}, "i-am": {"en": "I am", "ar": "أنا"}, "years-old": {"en": "years old", "ar": "سنة"}, - "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, + "drag-point": { + "en": "Drag point to change your age", + "ar": "اسحب لتغيير عمرك" + }, + + "categorise": {"en": "Categories", "ar": "التطبيقات"}, + "wishList": {"en": "WishList", "ar": "الرغبات"}, + "myAccount": {"en": "My Account", "ar": "حسابي"}, + "cart": {"en": "Cart", "ar": "التسوق"}, + "searchProductHere": { + "en": "Search Product here", + "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": "احجز"}, "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, @@ -876,7 +990,6 @@ const Map localizedValues = { "number": {"en": "Number", "ar": "الرقم"}, "not-classified": {"en": "Not classified", "ar": "غير محدد"}, "selectClinic": {"en": "Select Clinic", "ar": " بحث بالعيادة"}, - "reviews": {"en": "Reviews", "ar": "تقييمات"}, "searchItemError": { "en": "Item name should be more than 3 character ", "ar": "يجب أن يكون اسم العنصر أكثر من 3 أحرف" @@ -944,7 +1057,6 @@ const Map localizedValues = { "en": "Select Transportation Method", "ar": "حدد طريقة النقل" }, - "sar": {"en": "SR", "ar": "ر.س"}, "RRT-direction-heading": {"en": "Select Direction", "ar": "حدد الاتجاه"}, "to-hospital": {"en": "To Hospital", "ar": "الى المستشفى"}, "from-hospital": {"en": "From Hospital", "ar": "من المستشفى"}, @@ -1051,7 +1163,6 @@ const Map localizedValues = { "requested": {"en": "Requested", "ar": "مطلوب"}, "ready": {"en": "Ready", "ar": "جاهز"}, "completed": {"en": "Completed", "ar": "مكتمل"}, - "cancelled": {"en": "Cancelled", "ar": "ملغى"}, "request-medical-report": { "en": "Request medical report", @@ -1241,4 +1352,101 @@ const Map localizedValues = { "en": "Live Care", "ar": "لايف كير" }, + "topBrands":{ + "en":"Top Brands", + "ar":"اعلى العلامات التجارية" + }, + + "notifyMe":{ + "en":"notify me", + "ar":"اعلمني" + }, + "specification":{ + "en":"Specification", + "ar":"تخصيص" + }, + + "availability":{ + "en":"Availability", + "ar":"التوفر" + }, + + "quantitySize":{ + "en":"Quantity", + "ar":"كميه" + }, + "addToCart":{ + "en":"add to cart", + "ar":"إضفة للسلة" + }, + "buyNow":{ + "en":"buy now", + "ar":"إشتري الان" + }, + "quantityShortcut":{ + "en":"QTY", + "ar":"كمية" + }, + + + "pharmacyServiceTermsCondition": { + "en": "I agree with the terms of service and I adhere to them unconditionally", + "ar": " أوافق على شروط الخدمة وألتزم بها دون قيد أو شرط" + }, + "Year": {"en": "YEAR", "ar": "السنة"}, + "Month": {"en": "MONTH", "ar": "الشهر"}, + "point": {"en": "POINT", "ar": "النقاط"}, + "riyal": {"en": "RIYAL", "ar": "الريال"}, + "termOfService": {"en": "Terms of service", "ar": "شروط الخدمة"}, + "shoppingCart": {"en": "Shopping Cart", "ar": "عربة التسوق"}, + + "referralStatus": {"en": "Referral Status", "ar": "حالة الإحالة"}, + "referralDate": {"en": "Referral Date", "ar": "تاريخ الإحالة"}, + "patientName": {"en": "Patient Name", "ar": "اسم المريض"}, + "referralNumber": {"en": "Referral Number", "ar": "رقم الإحالة"}, + "requestID": {"en": "Request ID", "ar": " رقم الطلب"}, + "OrderStatus": {"en": "Status", "ar": "الحاله"}, + "pickupDate": {"en": "Pickup Date", "ar": "التاريخ"}, + "serviceName": {"en": "Service Name", "ar": " اسم الخدمة"}, + "orderLocation": {"en": "Location", "ar": "الموقع"}, + "selectService": {"en": "Select Service", "ar": "حدد الخدمة"}, + "coveredService": {"en": "Covered Service : ", "ar": " الخدمات المغطاة : "}, + "selectedService": { + "en": "Selected Service : ", + "ar": " الخدمات المختارة : " + }, + "cancelOrderMsg": { + "en": "Are you sure!! want to cancel this order", + "ar": "هل أنت واثق!! تريد إلغاء هذا الطلب" + }, + "processDoneSuccessfully": { + "en": "Process Done Successfully", + "ar": "تمت العملية بنجاح" + }, + "selectHomeHealthCareServices": { + "en": "Select Home Health Care Services", + "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": "ارسال جدول التطعيمات الى بريدك الالكتروني؟" + }, + "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, + "welcomeBack": {"en": "Welcome back", "ar": "مرحبا مرة أخرى"}, + + "updated-email": { + "en": "Updated email successfully", + "ar": "تم تحديث البريد الالكتروني" + }, + + "view-list-children": { + "en": "View List of Children", + "ar": "عرض قائمة الأطفال" + }, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 16b826d2..458040bb 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -21,7 +21,8 @@ const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited'; const HMG_GEOFENCES = 'hmg-geo-fences'; - +const PHARMACY_CUSTOMER_ID = 'costumer-id'; const WEATHER = 'weather'; const BLOOD_TYPE = 'blood-type'; const NOTIFICATION_COUNT = 'notification-count'; +const PHARMACY_SELECTED_ADDRESS = 'selected-address'; 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/AlHabibMedicalService/EReferral/get_ereferral_response_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/get_ereferral_response_model.dart new file mode 100644 index 00000000..e873261d --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/get_ereferral_response_model.dart @@ -0,0 +1,128 @@ +class GetEReferralResponseModel { + dynamic acceptedBrachCode; + dynamic acceptedBranchName; + dynamic acceptedBranchNameAr; + Channel channel; + dynamic identityCardAttachment; + String identityNumber; + dynamic insuranceCardAttachment; + bool isInsuredPatient; + String otherRelationship; + String patientContactNo; + int patientId; + String patientName; + int preferredBranchCode; + String preferredBranchName; + String referralDate; + int referralNumber; + Channel relationshipType; + String requesterContactNo; + String requesterName; + String status; + String statusAr; + + GetEReferralResponseModel( + {this.acceptedBrachCode, + this.acceptedBranchName, + this.acceptedBranchNameAr, + this.channel, + this.identityCardAttachment, + this.identityNumber, + this.insuranceCardAttachment, + this.isInsuredPatient, + this.otherRelationship, + this.patientContactNo, + this.patientId, + this.patientName, + this.preferredBranchCode, + this.preferredBranchName, + this.referralDate, + this.referralNumber, + this.relationshipType, + this.requesterContactNo, + this.requesterName, + this.status, + this.statusAr}); + + GetEReferralResponseModel.fromJson(Map json) { + acceptedBrachCode = json['AcceptedBrachCode']; + acceptedBranchName = json['AcceptedBranchName']; + acceptedBranchNameAr = json['AcceptedBranchNameAr']; + channel = + json['Channel'] != null ? new Channel.fromJson(json['Channel']) : null; + identityCardAttachment = json['IdentityCardAttachment']; + identityNumber = json['IdentityNumber']; + insuranceCardAttachment = json['InsuranceCardAttachment']; + isInsuredPatient = json['IsInsuredPatient']; + otherRelationship = json['OtherRelationship']; + patientContactNo = json['PatientContactNo']; + patientId = json['PatientId']; + patientName = json['PatientName']; + preferredBranchCode = json['PreferredBranchCode']; + preferredBranchName = json['PreferredBranchName']; + referralDate = json['ReferralDate']; + referralNumber = json['ReferralNumber']; + relationshipType = json['RelationshipType'] != null + ? new Channel.fromJson(json['RelationshipType']) + : null; + requesterContactNo = json['RequesterContactNo']; + requesterName = json['RequesterName']; + status = json['Status']; + statusAr = json['StatusAr']; + } + + Map toJson() { + final Map data = new Map(); + data['AcceptedBrachCode'] = this.acceptedBrachCode; + data['AcceptedBranchName'] = this.acceptedBranchName; + data['AcceptedBranchNameAr'] = this.acceptedBranchNameAr; + if (this.channel != null) { + data['Channel'] = this.channel.toJson(); + } + data['IdentityCardAttachment'] = this.identityCardAttachment; + data['IdentityNumber'] = this.identityNumber; + data['InsuranceCardAttachment'] = this.insuranceCardAttachment; + data['IsInsuredPatient'] = this.isInsuredPatient; + data['OtherRelationship'] = this.otherRelationship; + data['PatientContactNo'] = this.patientContactNo; + data['PatientId'] = this.patientId; + data['PatientName'] = this.patientName; + data['PreferredBranchCode'] = this.preferredBranchCode; + data['PreferredBranchName'] = this.preferredBranchName; + data['ReferralDate'] = this.referralDate; + data['ReferralNumber'] = this.referralNumber; + if (this.relationshipType != null) { + data['RelationshipType'] = this.relationshipType.toJson(); + } + data['RequesterContactNo'] = this.requesterContactNo; + data['RequesterName'] = this.requesterName; + data['Status'] = this.status; + data['StatusAr'] = this.statusAr; + return data; + } +} + +class Channel { + int iD; + String text; + String textAr; + String textEn; + + Channel({this.iD, this.text, this.textAr, this.textEn}); + + Channel.fromJson(Map json) { + iD = json['ID']; + text = json['Text']; + textAr = json['Text_Ar']; + textEn = json['Text_En']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['Text'] = this.text; + data['Text_Ar'] = this.textAr; + data['Text_En'] = this.textEn; + return data; + } +} diff --git a/lib/core/model/pharmacies/Addresses.dart b/lib/core/model/pharmacies/Addresses.dart index 74d5a591..b00b1a17 100644 --- a/lib/core/model/pharmacies/Addresses.dart +++ b/lib/core/model/pharmacies/Addresses.dart @@ -17,6 +17,7 @@ class Addresses { String createdOnUtc; String province; String latLong; + bool isChecked; Addresses( {this.id, @@ -36,7 +37,8 @@ class Addresses { this.customerAttributes, this.createdOnUtc, this.province, - this.latLong}); + this.latLong, + this.isChecked = false}); Addresses.fromJson(Map json) { id = json['id']; @@ -57,6 +59,7 @@ class Addresses { createdOnUtc = json['created_on_utc']; province = json['province']; latLong = json['lat_long']; + isChecked = json['isChecked']; } Map toJson() { @@ -79,6 +82,7 @@ class Addresses { data['created_on_utc'] = this.createdOnUtc; data['province'] = this.province; data['lat_long'] = this.latLong; + data['isChecked'] = this.isChecked; return data; } diff --git a/lib/core/model/pharmacies/BillingAddress.dart b/lib/core/model/pharmacies/BillingAddress.dart new file mode 100644 index 00000000..765ac54d --- /dev/null +++ b/lib/core/model/pharmacies/BillingAddress.dart @@ -0,0 +1,84 @@ +class BillingAddress { + 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; + + BillingAddress( + {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}); + + BillingAddress.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/Country.dart b/lib/core/model/pharmacies/Country.dart new file mode 100644 index 00000000..77f519d3 --- /dev/null +++ b/lib/core/model/pharmacies/Country.dart @@ -0,0 +1,32 @@ +class CountryData { + int id; + String name; + String namen; + String twoLetterIsoCode; + String threeLetterIsoCode; + + CountryData( + {this.id, + this.name, + this.namen, + this.twoLetterIsoCode, + this.threeLetterIsoCode}); + + CountryData.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + twoLetterIsoCode = json['two_letter_iso_code']; + threeLetterIsoCode = json['three_letter_iso_code']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + data['two_letter_iso_code'] = this.twoLetterIsoCode; + data['three_letter_iso_code'] = this.threeLetterIsoCode; + return data; + } +} diff --git a/lib/core/model/pharmacies/Customer.dart b/lib/core/model/pharmacies/Customer.dart index a5311489..e3defbbe 100644 --- a/lib/core/model/pharmacies/Customer.dart +++ b/lib/core/model/pharmacies/Customer.dart @@ -1,4 +1,10 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/BillingAddress.dart'; + class Customer { + BillingAddress billingAddress; + BillingAddress shippingAddress; + List addresses; String fileNumber; String iqamaNumber; int isOutSa; @@ -8,8 +14,6 @@ class Customer { String phone; String countryCode; String yahalaAccountno; - String billingAddress; - String shippingAddress; String id; String username; String email; @@ -17,50 +21,63 @@ class Customer { String lastName; String languageId; String adminComment; - String isTaxExempt; - String hasShoppingCartItems; - String active; - String deleted; - String isSystemAccount; + bool isTaxExempt; + bool hasShoppingCartItems; + bool active; + bool deleted; + bool isSystemAccount; String systemName; String lastIpAddress; String createdOnUtc; String lastLoginDateUtc; String lastActivityDateUtc; - String registeredInStoreId; + int 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}); + {this.billingAddress, + this.shippingAddress, + this.addresses, + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + 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) { + billingAddress = json['billing_address'] != null + ? new BillingAddress.fromJson(json['billing_address']) + : null; + shippingAddress = json['shipping_address'] != null + ? new BillingAddress.fromJson(json['shipping_address']) + : null; + if (json['addresses'] != null) { + addresses = new List(); + json['addresses'].forEach((v) { + addresses.add(new Addresses.fromJson(v)); + }); + } fileNumber = json['file_number']; iqamaNumber = json['iqama_number']; isOutSa = json['is_out_sa']; @@ -70,8 +87,6 @@ class Customer { 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']; @@ -94,6 +109,15 @@ class Customer { Map toJson() { final Map data = new Map(); + if (this.billingAddress != null) { + data['billing_address'] = this.billingAddress.toJson(); + } + if (this.shippingAddress != null) { + data['shipping_address'] = this.shippingAddress.toJson(); + } + if (this.addresses != null) { + data['addresses'] = this.addresses.map((v) => v.toJson()).toList(); + } data['file_number'] = this.fileNumber; data['iqama_number'] = this.iqamaNumber; data['is_out_sa'] = this.isOutSa; @@ -103,8 +127,6 @@ class Customer { 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; @@ -125,4 +147,4 @@ class Customer { data['registered_in_store_id'] = this.registeredInStoreId; return data; } -} \ No newline at end of file +} diff --git a/lib/core/model/pharmacies/LacumAccountInformation.dart b/lib/core/model/pharmacies/LacumAccountInformation.dart new file mode 100644 index 00000000..4f1d0455 --- /dev/null +++ b/lib/core/model/pharmacies/LacumAccountInformation.dart @@ -0,0 +1,1926 @@ +import 'LakumInquiryInformationObjVersion.dart'; + +class LacumAccountInformation { + + String date; + int languageID; + int serviceName; + String time; + String androidLink; + String authenticationTokenID; + String data; + bool dataw; + int dietType; + String errorCode; + String errorEndUserMessage; + String errorEndUserMessageN; + String errorMessage; + int errorType; + int foodCategory; + String iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + String patientBlodType; + String successMsg; + String successMsgN; + int accountStatus; + String activeArchiveObject; + int activeMedicationCount; + String allMedicationTakenDuringAdmissionList; + int appointmentNo; + String arePatientsOnlineList; + String balanceAmount; + String bloodGroupList; + int cVIUnreadCount; + String checkUserHasAccount; + int complaintNo; + String dischargeList; + int episodeID; + String finalRadiologyList; + String fullName; + String geoFPointsList; + String geoGetPateintInfo; + String getAllDoctorsByProjectAndClinicList; + String getAppointmentNumbersForDoctorList; + String getCheckUpItemsList; + String getCosmeticConferenceForTodayList; + String getDoctorERClinicResult; + String getInvoiceApprovalList; + String getNearestProjectList; + String getPatientAdmissionOrAppoinmentNoList; + String getPatientBloodType; + String getPatientInsuranceCardStatusStatisticsList; + String getSurveyList; + String getTotalRegisteredPatientList; + String getUserDetailsList; + String getCustomerPointInfo; + String hISApprovalList; + String hISInpAdmissionList; + String hISProgNoteAssesmentModelList; + String hMGGetAllOffersList; + bool hasApproval; + bool hasConsultation; + bool hasDental; + bool hasLab; + bool hasPharmacy; + bool hasRad; + String hmgSMSGetByProjectIDAndPatientIDList; + int hoursLeft; + String iNPMGetAllAdmissionList; + String iNPMGetPatientInfoForSickLeaveReportList; + String iNPMHISPatientMedicalStatusUnreadCount; + String iNPMLABGetPatientLabOrdersResultsList; + String iNPMLABGetPatientLabResultsList; + String iNPMLABGetPatientRADReportList; + String iNPMLABGetPatientRadResultsList; + String iNPMRadGetPatientRadOrdersCVIList; + String iNPMRadGetPatientRadOrdersList; + String iNPMRadGetRadMedicalRecordsList; + String iNPGetPrescriptionDischargesList; + String iNPGetPrescriptionReportList; + String identificationNo; + bool isHomeMedicineDeliverySupported; + int isInsertedOrUpdated; + bool isMainAcoountEqualPatienID; + bool isPatientAlreadyAgreed; + bool isPatientCallBackBlackList; + bool isPatientHaveFingerPrint; + bool isPatientOnline; + bool isPatientTokenRemoved; + bool isPaused; + bool isProjectWorkingHours; + String isStoreRateAllowed; + String isStoreRateInserted; + String isStoreRateUpdated; + int labRadUpdatedToRead; + int labReportUnreadNo; + String lakumInquiryInformationObj; + LakumInquiryInformationObjVersion lakumInquiryInformationObjVersion; + String lakumResponseList; + String laserGetBodyPartsByCategoryList; + String laserGetCategoriesList; + String list; + int listCount; + int listCountDeliverd; + int listCountUnDeliverd; + String listDeviceInfo; + String listFamilyAppointments; + String listLabResultsByAppNo; + String listLakumInquiryInformationObj; + String listOpinionGetAllPeriod; + String listOpinionGetAllServices; + String listOpinionGetIsAgreeValue; + String listOpinionGetOpinionLogin; + String listOpinionGetRequestedSerives; + String listOpinionGetShareServicesDetails; + String listOpinionUserTerms; + String listPLO; + String listPLR; + String listPLSR; + String listPRM; + String listPatientFamilyFiles; + String listPatientFileInfo; + String listRAD; + String listRADAPI; + String listActiveGetPrescriptionReportByPatientID; + String listAppointmentsForDentalClinic; + String listBabyInfoResult; + String listCheckInsuranceCoverage; + String listCompanyClass; + String listConsentMedicalReport; + String listDentalAppointments; + String listDeviceTokenIDByAppointmentNo; + String listDischargeDiagnosis; + String listDischargeMedicine; + String listDischargeSummary; + String listDoctorResponse; + String listDoneVaccines; + String listEReferralResult; + String listEReferrals; + String listGetAllPatientsLiveCareAdmin; + String listGetDataForExcel; + String listGetMainCountID; + String listGetPrescriptionReportByPatientID; + String listGetSickLeave; + String listHISInvoice; + String listHISInvoiceProcedures; + String listInpatientInvoices; + String listInsuranceCheckList; + String listInsuranceCompanies; + String listInsuranceCompaniesGroup; + String listInsuranceUpdateDetails; + String listInvoiceApprovalProcedureInfo; + String listIsLastSatisfactionSurveyReviewedModel; + String listLabOrderDetailsModel; + String listMedicalReport; + String listMedicalReportApprovals; + String listMedicalReportStatus; + String listMonthBloodPressureResult; + String listMonthBloodPressureResultAverage; + String listMonthDiabtecPatientResult; + String listMonthDiabtectResultAverage; + String listMonthWeightMeasurementResult; + String listMonthWeightMeasurementResultAverage; + String listOnlinePrescriptionResult; + String listOutPatientInvoices; + String listPHRInvoice; + String listPHRInvoiceItems; + String listPHRPaymentMethods; + String listPateintDetails; + String listPateintInformation; + String listPatientAdmissionInfo; + String listPatientAdvanceBalanceAmount; + String listPatientCallBackLogs; + String listPatientCallBackToUpdateFromICServer; + String listPatientCount; + String listPatientDashboard; + String listPatientERGetAdminClinicsModel; + String listPatientERGetAdminProjectsModel; + String listPatientERGetAllClinicsModel; + String listPatientHISInvoices; + String listPatientICProjects; + String listPatientICProjectsByID; + String listPatientICProjectsTimings; + String listPatientIDByUID; + String listPatientIDForSurveyResult; + String listPatientInfo; + String listPatientInfoForDDScreen; + String listPatientInfoForSickleaveReport; + String listPatientInsuranceCard; + String listPatientInsuranceCardHistory; + String listPatientInsuranceDetails; + String listPatientPHRInvoices; + String listPatientServicePoint; + String listPatientStatusCount; + String listPatientChatRequestMapModel; + String listPatientChatRequestModel; + String listPatientChatRequestVCModel; + String listPaymentMethods; + String listPointServices; + String listPregnancyStagesInfo; + String listProjectAvgERWaitingTime; + String listProjectAvgERWaitingTimeHourly; + String listRadMedicalRecords; + String listRadMedicalRecordsAPI; + String listRadMedicalRecordsCVI; + String listRadMedicalRecordsCVIAPI; + String listRadMedicalRecordsResults; + String listSickLeave; + String listTransaction; + String listVideoConferenceSessions; + String listWeekBloodPressureResult; + String listWeekBloodPressureResultAverage; + String listWeekDiabtecPatientResult; + String listWeekDiabtectResultAverage; + String listWeekWeightMeasurementResult; + String listWeekWeightMeasurementResultAverage; + String listYearBloodPressureResult; + String listYearBloodPressureResultAverage; + String listYearDiabtecPatientResult; + String listYearDiabtecResultAverage; + String listYearWeightMeasurementResult; + String listYearWeightMeasurementResultAverage; + String listEInvoiceForDental; + String listEInvoiceForOnlineCheckIn; + String medGetActivitiesTransactionsStsList; + String medGetAvgMonthTransactionsStsList; + String medGetAvgWeekTransactionsStsList; + String medGetCategoriesList; + String medGetMonthActivitiesTransactionsStsList; + String medGetMonthStepsTransactionsStsList; + String medGetMonthTransactionsStsList; + String medGetPatientLastRecordList; + String medGetSubCategoriesList; + String medGetTransactionsAndActTransactionsResult; + String medGetTransactionsList; + String medGetWeekActivitiesTransactionsStsList; + String medGetWeekStepsTransactionsStsList; + String medGetWeekTransactionsStsList; + String medGetYearActivitiesTransactionsStsList; + String medGetYearSleepTransactionsStsList; + String medGetYearStepsTransactionsStsList; + String medGetYearTransactionsStsList; + String medInsertTransactionsOutputsList; + String medicalRecordImages; + int medicalReportToRead; + int medicalReportUnreadNo; + bool missingIDCardAttachment; + bool missingInsuranceCardAttachment; + bool missingMedicalReportAttachment; + bool missingOtherRelationship; + bool missingPatientContactNo; + bool missingPatientId; + bool missingPatientIdentityNumber; + bool missingPatientName; + bool missingReferralContactNo; + bool missingReferralRelationship; + bool missingReferralRequesterName; + String mobileNumber; + int nationalityNumber; + String onlineCheckInAppointments; + String opinionUserAgreementContent; + bool orderInsert; + String pateintInfoForUpdateList; + String pateintUpatedList; + String patientBirthdayCertificate; + String patientERCMCRequestSummaryByProject; + String patientERCMCRequestWithTotal; + String patientERCMCGetAllServicesList; + String patientERCMCGetTransactionsForOrderList; + String patientERCoordinates; + String patientERCountOrderList; + String patientERCountsForApprovalOffice; + String patientERDeleteOldCurrentDoctorsOutputsList; + String patientERDeliveryGetAllDeliverdOrderList; + String patientERDeliveryGetAllOrderList; + bool patientERDeliveryIsOrderInserted; + bool patientERDeliveryIsOrderUpdated; + bool patientERDeliveryIsPausedChanged; + String patientERDeliveryNextOrder; + int patientERDeliveryOrderInsert; + int patientERDeliveryUpdateOrderStatus; + bool patientERDriverUpdate; + String patientERExacartCheckIsDispenseAccpetableList; + String patientERExacartGetDispenseQuantitiesByOrderIDList; + String patientERExacartGetOrderDetailsByePharmacyOrderNoList; + String patientERExacartGetOrderDetailsList; + String patientERExacartGetTotalDispenseQuantitiesByPresNoList; + bool patientERExacartIsDispenseAdded; + String patientERExacartIsDispenseAddedList; + bool patientERExacartIsOrderCompleted; + String patientERGetAdminByProjectAndRoleList; + String patientERGetAdminProjectsList; + String patientERGetAllDriversList; + String patientERGetAllNeedAproveStatusList; + String patientERGetAllPresOrdersStatusList; + String patientERGetAllProjectsList; + String patientERGetArchiveInformationList; + String patientERGetAskDoctorTotalByDateFilterList; + String patientERGetBookScheduleConfigsList; + String patientERGetClinicAndTimeAndEpisodeForAppointmentList; + String patientERGetClinicAndTimeForDischargeList; + String patientERGetDashboardDataforApporvalSectionForAdminList; + String patientERGetDashboardDataforApporvalSectionList; + String patientERGetDashboardDataforHHCSectionForAdminList; + String patientERGetDashboardDataforHHCSectionList; + String patientERGetDashboardDataforPrescriptionSectionForAdminList; + String patientERGetDashboardDataforPrescriptionSectionList; + String patientERGetDoctorDashboardDataModelList; + String patientERGetDriverLocationList; + String patientERGetInsuranceCardRequestByDateFilterList; + String patientERGetLiveCareSummaryBookedAppoinmentStatusList; + String patientERGetLiveCareSummaryCovidList; + String patientERGetLiveCareSummaryForCMCList; + String patientERGetLiveCareSummaryForHHCList; + String patientERGetLiveCareSummaryForHomeDeliveryList; + String patientERGetLiveCareSummaryForInsuranceCardRequestList; + String patientERGetLiveCareSummaryForNewFilesList; + String patientERGetLiveCareSummaryForOnlinePaymetRequestList; + String patientERGetLiveCareSummaryForOnlinePharmacyOrdersList; + String patientERGetLiveCareSummaryForTrasnportationList; + String patientERGetLiveCareSummaryLiveCareCountsList; + String patientERGetMedicalRequestTotalByDateFilterList; + String patientERGetNearestPendingOrdersList; + String patientERGetNeedAproveHistoryForOrderList; + String patientERGetNeedAprovePendingOrdersList; + String patientERGetNeedAproveStatusStatisticsList; + String patientERGetPatientAllPresOrdersList; + String patientERGetPendingPatientsCountList; + String patientERGetPresOrdersHistoryForAdminList; + String patientERGetPresOrdersHistoryForOrderList; + String patientERGetPresOrdersStatusStatisticsList; + String patientERHHCRequest; + String patientERHHCRequestSummaryByProject; + String patientERHHCRequestWithTotal; + String patientERHHCGetAllServicesList; + String patientERHHCGetTransactionsForOrderList; + String patientERHomeDeliveryCounts; + bool patientERInsertDriver; + String patientERInsertNewCurrentDoctorsOutputsList; + String patientERInsuranceStatusCountList; + bool patientERIsNearestProjectUpdated; + bool patientERIsNeedAproveReturnedToQueue; + bool patientERIsNeedAproveUpdated; + bool patientERIsOrderClientRequestUpdated; + bool patientERIsOrderReturnedToQueue; + bool patientERIsPresOrderInserted; + bool patientERIsPresOrderUpdated; + bool patientERIsProjectUpdated; + String patientERNotCompletedDetails; + String patientERPatientsCountByCallStatus; + String patientERPeakHourCounts; + String patientERPresOrderInfo; + String patientERPrescriptionCounts; + String patientERProjectsContribution; + String patientERRRTGetAllQuestionsList; + String patientERRRTGetAllTransportationMethodList; + String patientERRRTGetPickUpRequestByPresOrderIDList; + String patientERRealRRTGetAllServicesList; + String patientERRealRRTGetOrderDetailsList; + String patientERRealRRTGetTransactionsForOrderList; + bool patientERRealRRTIsTransInserted; + String patientERRequestList; + String patientERTransportationRequestWithTotal; + String patientERealRRTGetServicePriceList; + String patientInfoByAdmissionNoList; + String patientMonitorGetPatientHeartRate; + int patientNotServedCounts; + String patientPrescriptionList; + String patientAllergies; + String patientCheckAppointmentValidationList; + String patientLoginTokenList; + String patientQRLoginInfoList; + String patientSELECTDeviceIMEIbyIMEIList; + String pharmList; + String prefLang; + int radReportUnreadNo; + String radGetPatientRadOrdersForDentalList; + int referralNumber; + String reminderConfigurations; + String requestNo; + int rowCount; + String servicePrivilegeList; + String shareFamilyFileObj; + String status; + int successCode; + String surveyRate; + String symptomCheckerConditionList; + String symptomCheckerGetAllDefaultQuestionsList; + String symptomCheckerGetBodyPartSymptomsList; + String symptomCheckerGetBodyPartsByCodeList; + String symptomCheckerGetBodyPartsList; + String symptomCheckerJsonResponseInString; + int timerTime; + int totalAdvanceBalanceAmount; + int totalPatientsCount; + int totalPendingApprovalCount; + int totalUnUsedCount; + int transactionNo; + int unReadCounts; + bool updateStatus; + String userAgreementContent; + int yahalaAccountNo; + bool check24HourComplaint; + String currency; + String message; + int patientID; + int returnValue; + String returnValueStr; + int statusCode; + + LacumAccountInformation( + {this.date, + this.languageID, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenID, + this.data, + this.dataw, + this.dietType, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iOSLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.accountStatus, + this.activeArchiveObject, + this.activeMedicationCount, + this.allMedicationTakenDuringAdmissionList, + this.appointmentNo, + this.arePatientsOnlineList, + this.balanceAmount, + this.bloodGroupList, + this.cVIUnreadCount, + this.checkUserHasAccount, + this.complaintNo, + this.dischargeList, + this.episodeID, + this.finalRadiologyList, + this.fullName, + this.geoFPointsList, + this.geoGetPateintInfo, + this.getAllDoctorsByProjectAndClinicList, + this.getAppointmentNumbersForDoctorList, + this.getCheckUpItemsList, + this.getCosmeticConferenceForTodayList, + this.getDoctorERClinicResult, + this.getInvoiceApprovalList, + this.getNearestProjectList, + this.getPatientAdmissionOrAppoinmentNoList, + this.getPatientBloodType, + this.getPatientInsuranceCardStatusStatisticsList, + this.getSurveyList, + this.getTotalRegisteredPatientList, + this.getUserDetailsList, + this.getCustomerPointInfo, + this.hISApprovalList, + this.hISInpAdmissionList, + this.hISProgNoteAssesmentModelList, + this.hMGGetAllOffersList, + this.hasApproval, + this.hasConsultation, + this.hasDental, + this.hasLab, + this.hasPharmacy, + this.hasRad, + this.hmgSMSGetByProjectIDAndPatientIDList, + this.hoursLeft, + this.iNPMGetAllAdmissionList, + this.iNPMGetPatientInfoForSickLeaveReportList, + this.iNPMHISPatientMedicalStatusUnreadCount, + this.iNPMLABGetPatientLabOrdersResultsList, + this.iNPMLABGetPatientLabResultsList, + this.iNPMLABGetPatientRADReportList, + this.iNPMLABGetPatientRadResultsList, + this.iNPMRadGetPatientRadOrdersCVIList, + this.iNPMRadGetPatientRadOrdersList, + this.iNPMRadGetRadMedicalRecordsList, + this.iNPGetPrescriptionDischargesList, + this.iNPGetPrescriptionReportList, + this.identificationNo, + this.isHomeMedicineDeliverySupported, + this.isInsertedOrUpdated, + this.isMainAcoountEqualPatienID, + this.isPatientAlreadyAgreed, + this.isPatientCallBackBlackList, + this.isPatientHaveFingerPrint, + this.isPatientOnline, + this.isPatientTokenRemoved, + this.isPaused, + this.isProjectWorkingHours, + this.isStoreRateAllowed, + this.isStoreRateInserted, + this.isStoreRateUpdated, + this.labRadUpdatedToRead, + this.labReportUnreadNo, + this.lakumInquiryInformationObj, + this.lakumInquiryInformationObjVersion, + this.lakumResponseList, + this.laserGetBodyPartsByCategoryList, + this.laserGetCategoriesList, + this.list, + this.listCount, + this.listCountDeliverd, + this.listCountUnDeliverd, + this.listDeviceInfo, + this.listFamilyAppointments, + this.listLabResultsByAppNo, + this.listLakumInquiryInformationObj, + this.listOpinionGetAllPeriod, + this.listOpinionGetAllServices, + this.listOpinionGetIsAgreeValue, + this.listOpinionGetOpinionLogin, + this.listOpinionGetRequestedSerives, + this.listOpinionGetShareServicesDetails, + this.listOpinionUserTerms, + this.listPLO, + this.listPLR, + this.listPLSR, + this.listPRM, + this.listPatientFamilyFiles, + this.listPatientFileInfo, + this.listRAD, + this.listRADAPI, + this.listActiveGetPrescriptionReportByPatientID, + this.listAppointmentsForDentalClinic, + this.listBabyInfoResult, + this.listCheckInsuranceCoverage, + this.listCompanyClass, + this.listConsentMedicalReport, + this.listDentalAppointments, + this.listDeviceTokenIDByAppointmentNo, + this.listDischargeDiagnosis, + this.listDischargeMedicine, + this.listDischargeSummary, + this.listDoctorResponse, + this.listDoneVaccines, + this.listEReferralResult, + this.listEReferrals, + this.listGetAllPatientsLiveCareAdmin, + this.listGetDataForExcel, + this.listGetMainCountID, + this.listGetPrescriptionReportByPatientID, + this.listGetSickLeave, + this.listHISInvoice, + this.listHISInvoiceProcedures, + this.listInpatientInvoices, + this.listInsuranceCheckList, + this.listInsuranceCompanies, + this.listInsuranceCompaniesGroup, + this.listInsuranceUpdateDetails, + this.listInvoiceApprovalProcedureInfo, + this.listIsLastSatisfactionSurveyReviewedModel, + this.listLabOrderDetailsModel, + this.listMedicalReport, + this.listMedicalReportApprovals, + this.listMedicalReportStatus, + this.listMonthBloodPressureResult, + this.listMonthBloodPressureResultAverage, + this.listMonthDiabtecPatientResult, + this.listMonthDiabtectResultAverage, + this.listMonthWeightMeasurementResult, + this.listMonthWeightMeasurementResultAverage, + this.listOnlinePrescriptionResult, + this.listOutPatientInvoices, + this.listPHRInvoice, + this.listPHRInvoiceItems, + this.listPHRPaymentMethods, + this.listPateintDetails, + this.listPateintInformation, + this.listPatientAdmissionInfo, + this.listPatientAdvanceBalanceAmount, + this.listPatientCallBackLogs, + this.listPatientCallBackToUpdateFromICServer, + this.listPatientCount, + this.listPatientDashboard, + this.listPatientERGetAdminClinicsModel, + this.listPatientERGetAdminProjectsModel, + this.listPatientERGetAllClinicsModel, + this.listPatientHISInvoices, + this.listPatientICProjects, + this.listPatientICProjectsByID, + this.listPatientICProjectsTimings, + this.listPatientIDByUID, + this.listPatientIDForSurveyResult, + this.listPatientInfo, + this.listPatientInfoForDDScreen, + this.listPatientInfoForSickleaveReport, + this.listPatientInsuranceCard, + this.listPatientInsuranceCardHistory, + this.listPatientInsuranceDetails, + this.listPatientPHRInvoices, + this.listPatientServicePoint, + this.listPatientStatusCount, + this.listPatientChatRequestMapModel, + this.listPatientChatRequestModel, + this.listPatientChatRequestVCModel, + this.listPaymentMethods, + this.listPointServices, + this.listPregnancyStagesInfo, + this.listProjectAvgERWaitingTime, + this.listProjectAvgERWaitingTimeHourly, + this.listRadMedicalRecords, + this.listRadMedicalRecordsAPI, + this.listRadMedicalRecordsCVI, + this.listRadMedicalRecordsCVIAPI, + this.listRadMedicalRecordsResults, + this.listSickLeave, + this.listTransaction, + this.listVideoConferenceSessions, + this.listWeekBloodPressureResult, + this.listWeekBloodPressureResultAverage, + this.listWeekDiabtecPatientResult, + this.listWeekDiabtectResultAverage, + this.listWeekWeightMeasurementResult, + this.listWeekWeightMeasurementResultAverage, + this.listYearBloodPressureResult, + this.listYearBloodPressureResultAverage, + this.listYearDiabtecPatientResult, + this.listYearDiabtecResultAverage, + this.listYearWeightMeasurementResult, + this.listYearWeightMeasurementResultAverage, + this.listEInvoiceForDental, + this.listEInvoiceForOnlineCheckIn, + this.medGetActivitiesTransactionsStsList, + this.medGetAvgMonthTransactionsStsList, + this.medGetAvgWeekTransactionsStsList, + this.medGetCategoriesList, + this.medGetMonthActivitiesTransactionsStsList, + this.medGetMonthStepsTransactionsStsList, + this.medGetMonthTransactionsStsList, + this.medGetPatientLastRecordList, + this.medGetSubCategoriesList, + this.medGetTransactionsAndActTransactionsResult, + this.medGetTransactionsList, + this.medGetWeekActivitiesTransactionsStsList, + this.medGetWeekStepsTransactionsStsList, + this.medGetWeekTransactionsStsList, + this.medGetYearActivitiesTransactionsStsList, + this.medGetYearSleepTransactionsStsList, + this.medGetYearStepsTransactionsStsList, + this.medGetYearTransactionsStsList, + this.medInsertTransactionsOutputsList, + this.medicalRecordImages, + this.medicalReportToRead, + this.medicalReportUnreadNo, + this.missingIDCardAttachment, + this.missingInsuranceCardAttachment, + this.missingMedicalReportAttachment, + this.missingOtherRelationship, + this.missingPatientContactNo, + this.missingPatientId, + this.missingPatientIdentityNumber, + this.missingPatientName, + this.missingReferralContactNo, + this.missingReferralRelationship, + this.missingReferralRequesterName, + this.mobileNumber, + this.nationalityNumber, + this.onlineCheckInAppointments, + this.opinionUserAgreementContent, + this.orderInsert, + this.pateintInfoForUpdateList, + this.pateintUpatedList, + this.patientBirthdayCertificate, + this.patientERCMCRequestSummaryByProject, + this.patientERCMCRequestWithTotal, + this.patientERCMCGetAllServicesList, + this.patientERCMCGetTransactionsForOrderList, + this.patientERCoordinates, + this.patientERCountOrderList, + this.patientERCountsForApprovalOffice, + this.patientERDeleteOldCurrentDoctorsOutputsList, + this.patientERDeliveryGetAllDeliverdOrderList, + this.patientERDeliveryGetAllOrderList, + this.patientERDeliveryIsOrderInserted, + this.patientERDeliveryIsOrderUpdated, + this.patientERDeliveryIsPausedChanged, + this.patientERDeliveryNextOrder, + this.patientERDeliveryOrderInsert, + this.patientERDeliveryUpdateOrderStatus, + this.patientERDriverUpdate, + this.patientERExacartCheckIsDispenseAccpetableList, + this.patientERExacartGetDispenseQuantitiesByOrderIDList, + this.patientERExacartGetOrderDetailsByePharmacyOrderNoList, + this.patientERExacartGetOrderDetailsList, + this.patientERExacartGetTotalDispenseQuantitiesByPresNoList, + this.patientERExacartIsDispenseAdded, + this.patientERExacartIsDispenseAddedList, + this.patientERExacartIsOrderCompleted, + this.patientERGetAdminByProjectAndRoleList, + this.patientERGetAdminProjectsList, + this.patientERGetAllDriversList, + this.patientERGetAllNeedAproveStatusList, + this.patientERGetAllPresOrdersStatusList, + this.patientERGetAllProjectsList, + this.patientERGetArchiveInformationList, + this.patientERGetAskDoctorTotalByDateFilterList, + this.patientERGetBookScheduleConfigsList, + this.patientERGetClinicAndTimeAndEpisodeForAppointmentList, + this.patientERGetClinicAndTimeForDischargeList, + this.patientERGetDashboardDataforApporvalSectionForAdminList, + this.patientERGetDashboardDataforApporvalSectionList, + this.patientERGetDashboardDataforHHCSectionForAdminList, + this.patientERGetDashboardDataforHHCSectionList, + this.patientERGetDashboardDataforPrescriptionSectionForAdminList, + this.patientERGetDashboardDataforPrescriptionSectionList, + this.patientERGetDoctorDashboardDataModelList, + this.patientERGetDriverLocationList, + this.patientERGetInsuranceCardRequestByDateFilterList, + this.patientERGetLiveCareSummaryBookedAppoinmentStatusList, + this.patientERGetLiveCareSummaryCovidList, + this.patientERGetLiveCareSummaryForCMCList, + this.patientERGetLiveCareSummaryForHHCList, + this.patientERGetLiveCareSummaryForHomeDeliveryList, + this.patientERGetLiveCareSummaryForInsuranceCardRequestList, + this.patientERGetLiveCareSummaryForNewFilesList, + this.patientERGetLiveCareSummaryForOnlinePaymetRequestList, + this.patientERGetLiveCareSummaryForOnlinePharmacyOrdersList, + this.patientERGetLiveCareSummaryForTrasnportationList, + this.patientERGetLiveCareSummaryLiveCareCountsList, + this.patientERGetMedicalRequestTotalByDateFilterList, + this.patientERGetNearestPendingOrdersList, + this.patientERGetNeedAproveHistoryForOrderList, + this.patientERGetNeedAprovePendingOrdersList, + this.patientERGetNeedAproveStatusStatisticsList, + this.patientERGetPatientAllPresOrdersList, + this.patientERGetPendingPatientsCountList, + this.patientERGetPresOrdersHistoryForAdminList, + this.patientERGetPresOrdersHistoryForOrderList, + this.patientERGetPresOrdersStatusStatisticsList, + this.patientERHHCRequest, + this.patientERHHCRequestSummaryByProject, + this.patientERHHCRequestWithTotal, + this.patientERHHCGetAllServicesList, + this.patientERHHCGetTransactionsForOrderList, + this.patientERHomeDeliveryCounts, + this.patientERInsertDriver, + this.patientERInsertNewCurrentDoctorsOutputsList, + this.patientERInsuranceStatusCountList, + this.patientERIsNearestProjectUpdated, + this.patientERIsNeedAproveReturnedToQueue, + this.patientERIsNeedAproveUpdated, + this.patientERIsOrderClientRequestUpdated, + this.patientERIsOrderReturnedToQueue, + this.patientERIsPresOrderInserted, + this.patientERIsPresOrderUpdated, + this.patientERIsProjectUpdated, + this.patientERNotCompletedDetails, + this.patientERPatientsCountByCallStatus, + this.patientERPeakHourCounts, + this.patientERPresOrderInfo, + this.patientERPrescriptionCounts, + this.patientERProjectsContribution, + this.patientERRRTGetAllQuestionsList, + this.patientERRRTGetAllTransportationMethodList, + this.patientERRRTGetPickUpRequestByPresOrderIDList, + this.patientERRealRRTGetAllServicesList, + this.patientERRealRRTGetOrderDetailsList, + this.patientERRealRRTGetTransactionsForOrderList, + this.patientERRealRRTIsTransInserted, + this.patientERRequestList, + this.patientERTransportationRequestWithTotal, + this.patientERealRRTGetServicePriceList, + this.patientInfoByAdmissionNoList, + this.patientMonitorGetPatientHeartRate, + this.patientNotServedCounts, + this.patientPrescriptionList, + this.patientAllergies, + this.patientCheckAppointmentValidationList, + this.patientLoginTokenList, + this.patientQRLoginInfoList, + this.patientSELECTDeviceIMEIbyIMEIList, + this.pharmList, + this.prefLang, + this.radReportUnreadNo, + this.radGetPatientRadOrdersForDentalList, + this.referralNumber, + this.reminderConfigurations, + this.requestNo, + this.rowCount, + this.servicePrivilegeList, + this.shareFamilyFileObj, + this.status, + this.successCode, + this.surveyRate, + this.symptomCheckerConditionList, + this.symptomCheckerGetAllDefaultQuestionsList, + this.symptomCheckerGetBodyPartSymptomsList, + this.symptomCheckerGetBodyPartsByCodeList, + this.symptomCheckerGetBodyPartsList, + this.symptomCheckerJsonResponseInString, + this.timerTime, + this.totalAdvanceBalanceAmount, + this.totalPatientsCount, + this.totalPendingApprovalCount, + this.totalUnUsedCount, + this.transactionNo, + this.unReadCounts, + this.updateStatus, + this.userAgreementContent, + this.yahalaAccountNo, + this.check24HourComplaint, + this.currency, + this.message, + this.patientID, + this.returnValue, + this.returnValueStr, + this.statusCode}); + + LacumAccountInformation.fromJson(Map json) { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + accountStatus = json['AccountStatus']; + activeArchiveObject = json['ActiveArchiveObject']; + activeMedicationCount = json['ActiveMedicationCount']; + allMedicationTakenDuringAdmissionList = + json['AllMedicationTakenDuringAdmission_List']; + appointmentNo = json['AppointmentNo']; + arePatientsOnlineList = json['ArePatientsOnlineList']; + balanceAmount = json['BalanceAmount']; + bloodGroupList = json['BloodGroupList']; + cVIUnreadCount = json['CVI_UnreadCount']; + checkUserHasAccount = json['CheckUserHasAccount']; + complaintNo = json['ComplaintNo']; + dischargeList = json['DischargeList']; + episodeID = json['EpisodeID']; + finalRadiologyList = json['FinalRadiologyList']; + fullName = json['FullName']; + geoFPointsList = json['GeoF_PointsList']; + geoGetPateintInfo = json['GeoGetPateintInfo']; + getAllDoctorsByProjectAndClinicList = + json['GetAllDoctorsByProjectAndClinicList']; + getAppointmentNumbersForDoctorList = + json['GetAppointmentNumbersForDoctorList']; + getCheckUpItemsList = json['GetCheckUpItemsList']; + getCosmeticConferenceForTodayList = + json['GetCosmeticConferenceForTodayList']; + getDoctorERClinicResult = json['GetDoctorERClinicResult']; + getInvoiceApprovalList = json['GetInvoiceApprovalList']; + getNearestProjectList = json['GetNearestProjectList']; + getPatientAdmissionOrAppoinmentNoList = + json['GetPatientAdmissionOrAppoinmentNo_List']; + getPatientBloodType = json['GetPatientBloodType']; + getPatientInsuranceCardStatusStatisticsList = + json['GetPatientInsuranceCardStatusStatisticsList']; + getSurveyList = json['GetSurveyList']; + getTotalRegisteredPatientList = json['GetTotalRegisteredPatientList']; + getUserDetailsList = json['GetUserDetailsList']; + getCustomerPointInfo = json['Get_CustomerPointInfo']; + hISApprovalList = json['HIS_Approval_List']; + hISInpAdmissionList = json['HIS_InpAdmission_List']; + hISProgNoteAssesmentModelList = json['HIS_ProgNoteAssesmentModel_List']; + hMGGetAllOffersList = json['HMG_GetAllOffersList']; + hasApproval = json['Has_Approval']; + hasConsultation = json['Has_Consultation']; + hasDental = json['Has_Dental']; + hasLab = json['Has_Lab']; + hasPharmacy = json['Has_Pharmacy']; + hasRad = json['Has_Rad']; + hmgSMSGetByProjectIDAndPatientIDList = + json['Hmg_SMS_Get_By_ProjectID_And_PatientIDList']; + hoursLeft = json['HoursLeft']; + iNPMGetAllAdmissionList = json['INPM_GetAllAdmission_List']; + iNPMGetPatientInfoForSickLeaveReportList = + json['INPM_GetPatientInfoForSickLeaveReport_List']; + iNPMHISPatientMedicalStatusUnreadCount = + json['INPM_HIS_PatientMedicalStatus_UnreadCount']; + iNPMLABGetPatientLabOrdersResultsList = + json['INPM_LAB_GetPatientLabOrdersResults_List']; + iNPMLABGetPatientLabResultsList = + json['INPM_LAB_GetPatientLabResults_List']; + iNPMLABGetPatientRADReportList = json['INPM_LAB_GetPatientRADReport_List']; + iNPMLABGetPatientRadResultsList = + json['INPM_LAB_GetPatientRadResults_List']; + iNPMRadGetPatientRadOrdersCVIList = + json['INPM_Rad_GetPatientRadOrders_CVI_List']; + iNPMRadGetPatientRadOrdersList = json['INPM_Rad_GetPatientRadOrders_List']; + iNPMRadGetRadMedicalRecordsList = + json['INPM_Rad_GetRadMedicalRecords_List']; + iNPGetPrescriptionDischargesList = + json['INP_GetPrescriptionDischarges_List']; + iNPGetPrescriptionReportList = json['INP_GetPrescriptionReport_List']; + identificationNo = json['IdentificationNo']; + isHomeMedicineDeliverySupported = json['IsHomeMedicineDeliverySupported']; + isInsertedOrUpdated = json['IsInsertedOrUpdated']; + isMainAcoountEqualPatienID = json['IsMainAcoountEqualPatienID']; + isPatientAlreadyAgreed = json['IsPatientAlreadyAgreed']; + isPatientCallBackBlackList = json['IsPatientCallBackBlackList']; + isPatientHaveFingerPrint = json['IsPatientHaveFingerPrint']; + isPatientOnline = json['IsPatientOnline']; + isPatientTokenRemoved = json['IsPatientTokenRemoved']; + isPaused = json['IsPaused']; + isProjectWorkingHours = json['IsProjectWorkingHours']; + isStoreRateAllowed = json['IsStoreRateAllowed']; + isStoreRateInserted = json['IsStoreRateInserted']; + isStoreRateUpdated = json['IsStoreRateUpdated']; + labRadUpdatedToRead = json['LabRadUpdatedToRead']; + labReportUnreadNo = json['LabReportUnreadNo']; + lakumInquiryInformationObj = json['LakumInquiryInformationObj']; + lakumInquiryInformationObjVersion = + json['LakumInquiryInformationObjVersion'] != null + ? new LakumInquiryInformationObjVersion.fromJson( + json['LakumInquiryInformationObjVersion']) + : null; + lakumResponseList = json['LakumResponseList']; + laserGetBodyPartsByCategoryList = json['Laser_GetBodyPartsByCategoryList']; + laserGetCategoriesList = json['Laser_GetCategoriesList']; + list = json['List']; + listCount = json['ListCount']; + listCountDeliverd = json['ListCountDeliverd']; + listCountUnDeliverd = json['ListCountUnDeliverd']; + listDeviceInfo = json['ListDeviceInfo']; + listFamilyAppointments = json['ListFamilyAppointments']; + listLabResultsByAppNo = json['ListLabResultsByAppNo']; + listLakumInquiryInformationObj = json['ListLakumInquiryInformationObj']; + listOpinionGetAllPeriod = json['ListOpinion_GetAllPeriod']; + listOpinionGetAllServices = json['ListOpinion_GetAllServices']; + listOpinionGetIsAgreeValue = json['ListOpinion_GetIsAgreeValue']; + listOpinionGetOpinionLogin = json['ListOpinion_GetOpinionLogin']; + listOpinionGetRequestedSerives = json['ListOpinion_GetRequestedSerives']; + listOpinionGetShareServicesDetails = + json['ListOpinion_GetShareServicesDetails']; + listOpinionUserTerms = json['ListOpinion_UserTerms']; + listPLO = json['ListPLO']; + listPLR = json['ListPLR']; + listPLSR = json['ListPLSR']; + listPRM = json['ListPRM']; + listPatientFamilyFiles = json['ListPatientFamilyFiles']; + listPatientFileInfo = json['ListPatientFileInfo']; + listRAD = json['ListRAD']; + listRADAPI = json['ListRADAPI']; + listActiveGetPrescriptionReportByPatientID = + json['List_ActiveGetPrescriptionReportByPatientID']; + listAppointmentsForDentalClinic = json['List_AppointmentsForDentalClinic']; + listBabyInfoResult = json['List_BabyInfoResult']; + listCheckInsuranceCoverage = json['List_CheckInsuranceCoverage']; + listCompanyClass = json['List_CompanyClass']; + listConsentMedicalReport = json['List_ConsentMedicalReport']; + listDentalAppointments = json['List_DentalAppointments']; + listDeviceTokenIDByAppointmentNo = + json['List_DeviceTokenIDByAppointmentNo']; + listDischargeDiagnosis = json['List_DischargeDiagnosis']; + listDischargeMedicine = json['List_DischargeMedicine']; + listDischargeSummary = json['List_DischargeSummary']; + listDoctorResponse = json['List_DoctorResponse']; + listDoneVaccines = json['List_DoneVaccines']; + listEReferralResult = json['List_EReferralResult']; + listEReferrals = json['List_EReferrals']; + listGetAllPatientsLiveCareAdmin = + json['List_GetAllPatients_LiveCare_Admin']; + listGetDataForExcel = json['List_GetDataForExcel']; + listGetMainCountID = json['List_GetMainCountID']; + listGetPrescriptionReportByPatientID = + json['List_GetPrescriptionReportByPatientID']; + listGetSickLeave = json['List_GetSickLeave']; + listHISInvoice = json['List_HISInvoice']; + listHISInvoiceProcedures = json['List_HISInvoiceProcedures']; + listInpatientInvoices = json['List_InpatientInvoices']; + listInsuranceCheckList = json['List_InsuranceCheckList']; + listInsuranceCompanies = json['List_InsuranceCompanies']; + listInsuranceCompaniesGroup = json['List_InsuranceCompaniesGroup']; + listInsuranceUpdateDetails = json['List_InsuranceUpdateDetails']; + listInvoiceApprovalProcedureInfo = + json['List_InvoiceApprovalProcedureInfo']; + listIsLastSatisfactionSurveyReviewedModel = + json['List_IsLastSatisfactionSurveyReviewedModel']; + listLabOrderDetailsModel = json['List_LabOrderDetailsModel']; + listMedicalReport = json['List_MedicalReport']; + listMedicalReportApprovals = json['List_MedicalReportApprovals']; + listMedicalReportStatus = json['List_MedicalReportStatus']; + listMonthBloodPressureResult = json['List_MonthBloodPressureResult']; + listMonthBloodPressureResultAverage = + json['List_MonthBloodPressureResultAverage']; + listMonthDiabtecPatientResult = json['List_MonthDiabtecPatientResult']; + listMonthDiabtectResultAverage = json['List_MonthDiabtectResultAverage']; + listMonthWeightMeasurementResult = + json['List_MonthWeightMeasurementResult']; + listMonthWeightMeasurementResultAverage = + json['List_MonthWeightMeasurementResultAverage']; + listOnlinePrescriptionResult = json['List_OnlinePrescriptionResult']; + listOutPatientInvoices = json['List_OutPatientInvoices']; + listPHRInvoice = json['List_PHRInvoice']; + listPHRInvoiceItems = json['List_PHRInvoiceItems']; + listPHRPaymentMethods = json['List_PHRPaymentMethods']; + listPateintDetails = json['List_PateintDetails']; + listPateintInformation = json['List_PateintInformation']; + listPatientAdmissionInfo = json['List_PatientAdmissionInfo']; + listPatientAdvanceBalanceAmount = json['List_PatientAdvanceBalanceAmount']; + listPatientCallBackLogs = json['List_PatientCallBackLogs']; + listPatientCallBackToUpdateFromICServer = + json['List_PatientCallBackToUpdateFromICServer']; + listPatientCount = json['List_PatientCount']; + listPatientDashboard = json['List_PatientDashboard']; + listPatientERGetAdminClinicsModel = + json['List_PatientER_GetAdminClinicsModel']; + listPatientERGetAdminProjectsModel = + json['List_PatientER_GetAdminProjectsModel']; + listPatientERGetAllClinicsModel = json['List_PatientER_GetAllClinicsModel']; + listPatientHISInvoices = json['List_PatientHISInvoices']; + listPatientICProjects = json['List_PatientICProjects']; + listPatientICProjectsByID = json['List_PatientICProjectsByID']; + listPatientICProjectsTimings = json['List_PatientICProjectsTimings']; + listPatientIDByUID = json['List_PatientIDByUID']; + listPatientIDForSurveyResult = json['List_PatientIDForSurveyResult']; + listPatientInfo = json['List_PatientInfo']; + listPatientInfoForDDScreen = json['List_PatientInfoForDDScreen']; + listPatientInfoForSickleaveReport = + json['List_PatientInfoForSickleaveReport']; + listPatientInsuranceCard = json['List_PatientInsuranceCard']; + listPatientInsuranceCardHistory = json['List_PatientInsuranceCardHistory']; + listPatientInsuranceDetails = json['List_PatientInsuranceDetails']; + listPatientPHRInvoices = json['List_PatientPHRInvoices']; + listPatientServicePoint = json['List_PatientServicePoint']; + listPatientStatusCount = json['List_PatientStatusCount']; + listPatientChatRequestMapModel = json['List_Patient_ChatRequestMapModel']; + listPatientChatRequestModel = json['List_Patient_ChatRequestModel']; + listPatientChatRequestVCModel = json['List_Patient_ChatRequestVCModel']; + listPaymentMethods = json['List_PaymentMethods']; + listPointServices = json['List_PointServices']; + listPregnancyStagesInfo = json['List_PregnancyStagesInfo']; + listProjectAvgERWaitingTime = json['List_ProjectAvgERWaitingTime']; + listProjectAvgERWaitingTimeHourly = + json['List_ProjectAvgERWaitingTimeHourly']; + listRadMedicalRecords = json['List_RadMedicalRecords']; + listRadMedicalRecordsAPI = json['List_RadMedicalRecordsAPI']; + listRadMedicalRecordsCVI = json['List_RadMedicalRecordsCVI']; + listRadMedicalRecordsCVIAPI = json['List_RadMedicalRecordsCVIAPI']; + listRadMedicalRecordsResults = json['List_RadMedicalRecordsResults']; + listSickLeave = json['List_SickLeave']; + listTransaction = json['List_Transaction']; + listVideoConferenceSessions = json['List_VideoConferenceSessions']; + listWeekBloodPressureResult = json['List_WeekBloodPressureResult']; + listWeekBloodPressureResultAverage = + json['List_WeekBloodPressureResultAverage']; + listWeekDiabtecPatientResult = json['List_WeekDiabtecPatientResult']; + listWeekDiabtectResultAverage = json['List_WeekDiabtectResultAverage']; + listWeekWeightMeasurementResult = json['List_WeekWeightMeasurementResult']; + listWeekWeightMeasurementResultAverage = + json['List_WeekWeightMeasurementResultAverage']; + listYearBloodPressureResult = json['List_YearBloodPressureResult']; + listYearBloodPressureResultAverage = + json['List_YearBloodPressureResultAverage']; + listYearDiabtecPatientResult = json['List_YearDiabtecPatientResult']; + listYearDiabtecResultAverage = json['List_YearDiabtecResultAverage']; + listYearWeightMeasurementResult = json['List_YearWeightMeasurementResult']; + listYearWeightMeasurementResultAverage = + json['List_YearWeightMeasurementResultAverage']; + listEInvoiceForDental = json['List_eInvoiceForDental']; + listEInvoiceForOnlineCheckIn = json['List_eInvoiceForOnlineCheckIn']; + medGetActivitiesTransactionsStsList = + json['Med_GetActivitiesTransactionsStsList']; + medGetAvgMonthTransactionsStsList = + json['Med_GetAvgMonthTransactionsStsList']; + medGetAvgWeekTransactionsStsList = + json['Med_GetAvgWeekTransactionsStsList']; + medGetCategoriesList = json['Med_GetCategoriesList']; + medGetMonthActivitiesTransactionsStsList = + json['Med_GetMonthActivitiesTransactionsStsList']; + medGetMonthStepsTransactionsStsList = + json['Med_GetMonthStepsTransactionsStsList']; + medGetMonthTransactionsStsList = json['Med_GetMonthTransactionsStsList']; + medGetPatientLastRecordList = json['Med_GetPatientLastRecordList']; + medGetSubCategoriesList = json['Med_GetSubCategoriesList']; + medGetTransactionsAndActTransactionsResult = + json['Med_GetTransactionsAndActTransactionsResult']; + medGetTransactionsList = json['Med_GetTransactionsList']; + medGetWeekActivitiesTransactionsStsList = + json['Med_GetWeekActivitiesTransactionsStsList']; + medGetWeekStepsTransactionsStsList = + json['Med_GetWeekStepsTransactionsStsList']; + medGetWeekTransactionsStsList = json['Med_GetWeekTransactionsStsList']; + medGetYearActivitiesTransactionsStsList = + json['Med_GetYearActivitiesTransactionsStsList']; + medGetYearSleepTransactionsStsList = + json['Med_GetYearSleepTransactionsStsList']; + medGetYearStepsTransactionsStsList = + json['Med_GetYearStepsTransactionsStsList']; + medGetYearTransactionsStsList = json['Med_GetYearTransactionsStsList']; + medInsertTransactionsOutputsList = + json['Med_InsertTransactionsOutputsList']; + medicalRecordImages = json['MedicalRecordImages']; + medicalReportToRead = json['MedicalReportToRead']; + medicalReportUnreadNo = json['MedicalReportUnreadNo']; + missingIDCardAttachment = json['Missing_IDCardAttachment']; + missingInsuranceCardAttachment = json['Missing_InsuranceCardAttachment']; + missingMedicalReportAttachment = json['Missing_MedicalReportAttachment']; + missingOtherRelationship = json['Missing_OtherRelationship']; + missingPatientContactNo = json['Missing_PatientContactNo']; + missingPatientId = json['Missing_PatientId']; + missingPatientIdentityNumber = json['Missing_PatientIdentityNumber']; + missingPatientName = json['Missing_PatientName']; + missingReferralContactNo = json['Missing_ReferralContactNo']; + missingReferralRelationship = json['Missing_ReferralRelationship']; + missingReferralRequesterName = json['Missing_ReferralRequesterName']; + mobileNumber = json['MobileNumber']; + nationalityNumber = json['NationalityNumber']; + onlineCheckInAppointments = json['OnlineCheckInAppointments']; + opinionUserAgreementContent = json['Opinion_UserAgreementContent']; + orderInsert = json['OrderInsert']; + pateintInfoForUpdateList = json['PateintInfoForUpdateList']; + pateintUpatedList = json['PateintUpatedList']; + patientBirthdayCertificate = json['PatientBirthdayCertificate']; + patientERCMCRequestSummaryByProject = + json['PatientER_CMCRequestSummaryByProject']; + patientERCMCRequestWithTotal = json['PatientER_CMCRequestWithTotal']; + patientERCMCGetAllServicesList = json['PatientER_CMC_GetAllServicesList']; + patientERCMCGetTransactionsForOrderList = + json['PatientER_CMC_GetTransactionsForOrderList']; + patientERCoordinates = json['PatientER_Coordinates']; + patientERCountOrderList = json['PatientER_CountOrderList']; + patientERCountsForApprovalOffice = + json['PatientER_CountsForApprovalOffice']; + patientERDeleteOldCurrentDoctorsOutputsList = + json['PatientER_DeleteOldCurrentDoctorsOutputsList']; + patientERDeliveryGetAllDeliverdOrderList = + json['PatientER_Delivery_GetAllDeliverdOrderList']; + patientERDeliveryGetAllOrderList = + json['PatientER_Delivery_GetAllOrderList']; + patientERDeliveryIsOrderInserted = + json['PatientER_Delivery_IsOrderInserted']; + patientERDeliveryIsOrderUpdated = json['PatientER_Delivery_IsOrderUpdated']; + patientERDeliveryIsPausedChanged = + json['PatientER_Delivery_IsPausedChanged']; + patientERDeliveryNextOrder = json['PatientER_Delivery_NextOrder']; + patientERDeliveryOrderInsert = json['PatientER_Delivery_OrderInsert']; + patientERDeliveryUpdateOrderStatus = + json['PatientER_Delivery_UpdateOrderStatus']; + patientERDriverUpdate = json['PatientER_DriverUpdate']; + patientERExacartCheckIsDispenseAccpetableList = + json['PatientER_Exacart_CheckIsDispenseAccpetableList']; + patientERExacartGetDispenseQuantitiesByOrderIDList = + json['PatientER_Exacart_GetDispenseQuantitiesByOrderIDList']; + patientERExacartGetOrderDetailsByePharmacyOrderNoList = + json['PatientER_Exacart_GetOrderDetailsByePharmacyOrderNoList']; + patientERExacartGetOrderDetailsList = + json['PatientER_Exacart_GetOrderDetailsList']; + patientERExacartGetTotalDispenseQuantitiesByPresNoList = + json['PatientER_Exacart_GetTotalDispenseQuantitiesByPresNoList']; + patientERExacartIsDispenseAdded = json['PatientER_Exacart_IsDispenseAdded']; + patientERExacartIsDispenseAddedList = + json['PatientER_Exacart_IsDispenseAddedList']; + patientERExacartIsOrderCompleted = + json['PatientER_Exacart_IsOrderCompleted']; + patientERGetAdminByProjectAndRoleList = + json['PatientER_GetAdminByProjectAndRoleList']; + patientERGetAdminProjectsList = json['PatientER_GetAdminProjectsList']; + patientERGetAllDriversList = json['PatientER_GetAllDriversList']; + patientERGetAllNeedAproveStatusList = + json['PatientER_GetAllNeedAproveStatusList']; + patientERGetAllPresOrdersStatusList = + json['PatientER_GetAllPresOrdersStatusList']; + patientERGetAllProjectsList = json['PatientER_GetAllProjectsList']; + patientERGetArchiveInformationList = + json['PatientER_GetArchiveInformation_List']; + patientERGetAskDoctorTotalByDateFilterList = + json['PatientER_GetAskDoctorTotalByDateFilterList']; + patientERGetBookScheduleConfigsList = + json['PatientER_GetBookScheduleConfigsList']; + patientERGetClinicAndTimeAndEpisodeForAppointmentList = + json['PatientER_GetClinicAndTimeAndEpisodeForAppointmentList']; + patientERGetClinicAndTimeForDischargeList = + json['PatientER_GetClinicAndTimeForDischargeList']; + patientERGetDashboardDataforApporvalSectionForAdminList = + json['PatientER_GetDashboardDataforApporvalSectionForAdminList']; + patientERGetDashboardDataforApporvalSectionList = + json['PatientER_GetDashboardDataforApporvalSectionList']; + patientERGetDashboardDataforHHCSectionForAdminList = + json['PatientER_GetDashboardDataforHHCSectionForAdminList']; + patientERGetDashboardDataforHHCSectionList = + json['PatientER_GetDashboardDataforHHCSectionList']; + patientERGetDashboardDataforPrescriptionSectionForAdminList = + json['PatientER_GetDashboardDataforPrescriptionSectionForAdminList']; + patientERGetDashboardDataforPrescriptionSectionList = + json['PatientER_GetDashboardDataforPrescriptionSectionList']; + patientERGetDoctorDashboardDataModelList = + json['PatientER_GetDoctorDashboardDataModelList']; + patientERGetDriverLocationList = json['PatientER_GetDriverLocationList']; + patientERGetInsuranceCardRequestByDateFilterList = + json['PatientER_GetInsuranceCardRequestByDateFilterList']; + patientERGetLiveCareSummaryBookedAppoinmentStatusList = + json['PatientER_GetLiveCareSummaryBookedAppoinmentStatusList']; + patientERGetLiveCareSummaryCovidList = + json['PatientER_GetLiveCareSummaryCovidList']; + patientERGetLiveCareSummaryForCMCList = + json['PatientER_GetLiveCareSummaryForCMCList']; + patientERGetLiveCareSummaryForHHCList = + json['PatientER_GetLiveCareSummaryForHHCList']; + patientERGetLiveCareSummaryForHomeDeliveryList = + json['PatientER_GetLiveCareSummaryForHomeDeliveryList']; + patientERGetLiveCareSummaryForInsuranceCardRequestList = + json['PatientER_GetLiveCareSummaryForInsuranceCardRequestList']; + patientERGetLiveCareSummaryForNewFilesList = + json['PatientER_GetLiveCareSummaryForNewFilesList']; + patientERGetLiveCareSummaryForOnlinePaymetRequestList = + json['PatientER_GetLiveCareSummaryForOnlinePaymetRequestList']; + patientERGetLiveCareSummaryForOnlinePharmacyOrdersList = + json['PatientER_GetLiveCareSummaryForOnlinePharmacyOrdersList']; + patientERGetLiveCareSummaryForTrasnportationList = + json['PatientER_GetLiveCareSummaryForTrasnportationList']; + patientERGetLiveCareSummaryLiveCareCountsList = + json['PatientER_GetLiveCareSummaryLiveCareCountsList']; + patientERGetMedicalRequestTotalByDateFilterList = + json['PatientER_GetMedicalRequestTotalByDateFilterList']; + patientERGetNearestPendingOrdersList = + json['PatientER_GetNearestPendingOrdersList']; + patientERGetNeedAproveHistoryForOrderList = + json['PatientER_GetNeedAproveHistoryForOrderList']; + patientERGetNeedAprovePendingOrdersList = + json['PatientER_GetNeedAprovePendingOrdersList']; + patientERGetNeedAproveStatusStatisticsList = + json['PatientER_GetNeedAproveStatusStatisticsList']; + patientERGetPatientAllPresOrdersList = + json['PatientER_GetPatientAllPresOrdersList']; + patientERGetPendingPatientsCountList = + json['PatientER_GetPendingPatientsCountList']; + patientERGetPresOrdersHistoryForAdminList = + json['PatientER_GetPresOrdersHistoryForAdminList']; + patientERGetPresOrdersHistoryForOrderList = + json['PatientER_GetPresOrdersHistoryForOrderList']; + patientERGetPresOrdersStatusStatisticsList = + json['PatientER_GetPresOrdersStatusStatisticsList']; + patientERHHCRequest = json['PatientER_HHCRequest']; + patientERHHCRequestSummaryByProject = + json['PatientER_HHCRequestSummaryByProject']; + patientERHHCRequestWithTotal = json['PatientER_HHCRequestWithTotal']; + patientERHHCGetAllServicesList = json['PatientER_HHC_GetAllServicesList']; + patientERHHCGetTransactionsForOrderList = + json['PatientER_HHC_GetTransactionsForOrderList']; + patientERHomeDeliveryCounts = json['PatientER_HomeDeliveryCounts']; + patientERInsertDriver = json['PatientER_InsertDriver']; + patientERInsertNewCurrentDoctorsOutputsList = + json['PatientER_InsertNewCurrentDoctorsOutputsList']; + patientERInsuranceStatusCountList = + json['PatientER_InsuranceStatusCountList']; + patientERIsNearestProjectUpdated = + json['PatientER_IsNearestProjectUpdated']; + patientERIsNeedAproveReturnedToQueue = + json['PatientER_IsNeedAproveReturnedToQueue']; + patientERIsNeedAproveUpdated = json['PatientER_IsNeedAproveUpdated']; + patientERIsOrderClientRequestUpdated = + json['PatientER_IsOrderClientRequestUpdated']; + patientERIsOrderReturnedToQueue = json['PatientER_IsOrderReturnedToQueue']; + patientERIsPresOrderInserted = json['PatientER_IsPresOrderInserted']; + patientERIsPresOrderUpdated = json['PatientER_IsPresOrderUpdated']; + patientERIsProjectUpdated = json['PatientER_IsProjectUpdated']; + patientERNotCompletedDetails = json['PatientER_NotCompletedDetails']; + patientERPatientsCountByCallStatus = + json['PatientER_PatientsCountByCallStatus']; + patientERPeakHourCounts = json['PatientER_PeakHourCounts']; + patientERPresOrderInfo = json['PatientER_PresOrderInfo']; + patientERPrescriptionCounts = json['PatientER_PrescriptionCounts']; + patientERProjectsContribution = json['PatientER_ProjectsContribution']; + patientERRRTGetAllQuestionsList = json['PatientER_RRT_GetAllQuestionsList']; + patientERRRTGetAllTransportationMethodList = + json['PatientER_RRT_GetAllTransportationMethodList']; + patientERRRTGetPickUpRequestByPresOrderIDList = + json['PatientER_RRT_GetPickUpRequestByPresOrderIDList']; + patientERRealRRTGetAllServicesList = + json['PatientER_RealRRT_GetAllServicesList']; + patientERRealRRTGetOrderDetailsList = + json['PatientER_RealRRT_GetOrderDetailsList']; + patientERRealRRTGetTransactionsForOrderList = + json['PatientER_RealRRT_GetTransactionsForOrderList']; + patientERRealRRTIsTransInserted = json['PatientER_RealRRT_IsTransInserted']; + patientERRequestList = json['PatientER_RequestList']; + patientERTransportationRequestWithTotal = + json['PatientER_TransportationRequestWithTotal']; + patientERealRRTGetServicePriceList = + json['PatientE_RealRRT_GetServicePriceList']; + patientInfoByAdmissionNoList = json['PatientInfoByAdmissionNo_List']; + patientMonitorGetPatientHeartRate = + json['PatientMonitor_GetPatientHeartRate']; + patientNotServedCounts = json['PatientNotServedCounts']; + patientPrescriptionList = json['PatientPrescriptionList']; + patientAllergies = json['Patient_Allergies']; + patientCheckAppointmentValidationList = + json['Patient_CheckAppointmentValidationList']; + patientLoginTokenList = json['Patient_LoginTokenList']; + patientQRLoginInfoList = json['Patient_QRLoginInfoList']; + patientSELECTDeviceIMEIbyIMEIList = + json['Patient_SELECTDeviceIMEIbyIMEIList']; + pharmList = json['PharmList']; + prefLang = json['PrefLang']; + radReportUnreadNo = json['RadReportUnreadNo']; + radGetPatientRadOrdersForDentalList = + json['Rad_GetPatientRadOrdersForDental_List']; + referralNumber = json['ReferralNumber']; + reminderConfigurations = json['ReminderConfigurations']; + requestNo = json['RequestNo']; + rowCount = json['RowCount']; + servicePrivilegeList = json['ServicePrivilegeList']; + shareFamilyFileObj = json['ShareFamilyFileObj']; + status = json['Status']; + successCode = json['SuccessCode']; + surveyRate = json['SurveyRate']; + symptomCheckerConditionList = json['SymptomChecker_ConditionList']; + symptomCheckerGetAllDefaultQuestionsList = + json['SymptomChecker_GetAllDefaultQuestionsList']; + symptomCheckerGetBodyPartSymptomsList = + json['SymptomChecker_GetBodyPartSymptomsList']; + symptomCheckerGetBodyPartsByCodeList = + json['SymptomChecker_GetBodyPartsByCodeList']; + symptomCheckerGetBodyPartsList = json['SymptomChecker_GetBodyPartsList']; + symptomCheckerJsonResponseInString = + json['SymptomChecker_JsonResponseInString']; + timerTime = json['TimerTime']; + totalAdvanceBalanceAmount = json['TotalAdvanceBalanceAmount']; + totalPatientsCount = json['TotalPatientsCount']; + totalPendingApprovalCount = json['TotalPendingApprovalCount']; + totalUnUsedCount = json['TotalUnUsedCount']; + transactionNo = json['TransactionNo']; + unReadCounts = json['UnReadCounts']; + updateStatus = json['UpdateStatus']; + userAgreementContent = json['UserAgreementContent']; + yahalaAccountNo = json['YahalaAccountNo']; + check24HourComplaint = json['check24HourComplaint']; + currency = json['currency']; + message = json['message']; + patientID = json['patientID']; + returnValue = json['returnValue']; + returnValueStr = json['returnValueStr']; + statusCode = json['statusCode']; + } + + Map toJson() { + final Map data = new Map(); + data['Date'] = this.date; + data['LanguageID'] = this.languageID; + data['ServiceName'] = this.serviceName; + data['Time'] = this.time; + data['AndroidLink'] = this.androidLink; + data['AuthenticationTokenID'] = this.authenticationTokenID; + data['Data'] = this.data; + data['Dataw'] = this.dataw; + data['DietType'] = this.dietType; + data['ErrorCode'] = this.errorCode; + data['ErrorEndUserMessage'] = this.errorEndUserMessage; + data['ErrorEndUserMessageN'] = this.errorEndUserMessageN; + data['ErrorMessage'] = this.errorMessage; + data['ErrorType'] = this.errorType; + data['FoodCategory'] = this.foodCategory; + data['IOSLink'] = this.iOSLink; + data['IsAuthenticated'] = this.isAuthenticated; + data['MealOrderStatus'] = this.mealOrderStatus; + data['MealType'] = this.mealType; + data['MessageStatus'] = this.messageStatus; + data['NumberOfResultRecords'] = this.numberOfResultRecords; + data['PatientBlodType'] = this.patientBlodType; + data['SuccessMsg'] = this.successMsg; + data['SuccessMsgN'] = this.successMsgN; + data['AccountStatus'] = this.accountStatus; + data['ActiveArchiveObject'] = this.activeArchiveObject; + data['ActiveMedicationCount'] = this.activeMedicationCount; + data['AllMedicationTakenDuringAdmission_List'] = + this.allMedicationTakenDuringAdmissionList; + data['AppointmentNo'] = this.appointmentNo; + data['ArePatientsOnlineList'] = this.arePatientsOnlineList; + data['BalanceAmount'] = this.balanceAmount; + data['BloodGroupList'] = this.bloodGroupList; + data['CVI_UnreadCount'] = this.cVIUnreadCount; + data['CheckUserHasAccount'] = this.checkUserHasAccount; + data['ComplaintNo'] = this.complaintNo; + data['DischargeList'] = this.dischargeList; + data['EpisodeID'] = this.episodeID; + data['FinalRadiologyList'] = this.finalRadiologyList; + data['FullName'] = this.fullName; + data['GeoF_PointsList'] = this.geoFPointsList; + data['GeoGetPateintInfo'] = this.geoGetPateintInfo; + data['GetAllDoctorsByProjectAndClinicList'] = + this.getAllDoctorsByProjectAndClinicList; + data['GetAppointmentNumbersForDoctorList'] = + this.getAppointmentNumbersForDoctorList; + data['GetCheckUpItemsList'] = this.getCheckUpItemsList; + data['GetCosmeticConferenceForTodayList'] = + this.getCosmeticConferenceForTodayList; + data['GetDoctorERClinicResult'] = this.getDoctorERClinicResult; + data['GetInvoiceApprovalList'] = this.getInvoiceApprovalList; + data['GetNearestProjectList'] = this.getNearestProjectList; + data['GetPatientAdmissionOrAppoinmentNo_List'] = + this.getPatientAdmissionOrAppoinmentNoList; + data['GetPatientBloodType'] = this.getPatientBloodType; + data['GetPatientInsuranceCardStatusStatisticsList'] = + this.getPatientInsuranceCardStatusStatisticsList; + data['GetSurveyList'] = this.getSurveyList; + data['GetTotalRegisteredPatientList'] = this.getTotalRegisteredPatientList; + data['GetUserDetailsList'] = this.getUserDetailsList; + data['Get_CustomerPointInfo'] = this.getCustomerPointInfo; + data['HIS_Approval_List'] = this.hISApprovalList; + data['HIS_InpAdmission_List'] = this.hISInpAdmissionList; + data['HIS_ProgNoteAssesmentModel_List'] = + this.hISProgNoteAssesmentModelList; + data['HMG_GetAllOffersList'] = this.hMGGetAllOffersList; + data['Has_Approval'] = this.hasApproval; + data['Has_Consultation'] = this.hasConsultation; + data['Has_Dental'] = this.hasDental; + data['Has_Lab'] = this.hasLab; + data['Has_Pharmacy'] = this.hasPharmacy; + data['Has_Rad'] = this.hasRad; + data['Hmg_SMS_Get_By_ProjectID_And_PatientIDList'] = + this.hmgSMSGetByProjectIDAndPatientIDList; + data['HoursLeft'] = this.hoursLeft; + data['INPM_GetAllAdmission_List'] = this.iNPMGetAllAdmissionList; + data['INPM_GetPatientInfoForSickLeaveReport_List'] = + this.iNPMGetPatientInfoForSickLeaveReportList; + data['INPM_HIS_PatientMedicalStatus_UnreadCount'] = + this.iNPMHISPatientMedicalStatusUnreadCount; + data['INPM_LAB_GetPatientLabOrdersResults_List'] = + this.iNPMLABGetPatientLabOrdersResultsList; + data['INPM_LAB_GetPatientLabResults_List'] = + this.iNPMLABGetPatientLabResultsList; + data['INPM_LAB_GetPatientRADReport_List'] = + this.iNPMLABGetPatientRADReportList; + data['INPM_LAB_GetPatientRadResults_List'] = + this.iNPMLABGetPatientRadResultsList; + data['INPM_Rad_GetPatientRadOrders_CVI_List'] = + this.iNPMRadGetPatientRadOrdersCVIList; + data['INPM_Rad_GetPatientRadOrders_List'] = + this.iNPMRadGetPatientRadOrdersList; + data['INPM_Rad_GetRadMedicalRecords_List'] = + this.iNPMRadGetRadMedicalRecordsList; + data['INP_GetPrescriptionDischarges_List'] = + this.iNPGetPrescriptionDischargesList; + data['INP_GetPrescriptionReport_List'] = this.iNPGetPrescriptionReportList; + data['IdentificationNo'] = this.identificationNo; + data['IsHomeMedicineDeliverySupported'] = + this.isHomeMedicineDeliverySupported; + data['IsInsertedOrUpdated'] = this.isInsertedOrUpdated; + data['IsMainAcoountEqualPatienID'] = this.isMainAcoountEqualPatienID; + data['IsPatientAlreadyAgreed'] = this.isPatientAlreadyAgreed; + data['IsPatientCallBackBlackList'] = this.isPatientCallBackBlackList; + data['IsPatientHaveFingerPrint'] = this.isPatientHaveFingerPrint; + data['IsPatientOnline'] = this.isPatientOnline; + data['IsPatientTokenRemoved'] = this.isPatientTokenRemoved; + data['IsPaused'] = this.isPaused; + data['IsProjectWorkingHours'] = this.isProjectWorkingHours; + data['IsStoreRateAllowed'] = this.isStoreRateAllowed; + data['IsStoreRateInserted'] = this.isStoreRateInserted; + data['IsStoreRateUpdated'] = this.isStoreRateUpdated; + data['LabRadUpdatedToRead'] = this.labRadUpdatedToRead; + data['LabReportUnreadNo'] = this.labReportUnreadNo; + data['LakumInquiryInformationObj'] = this.lakumInquiryInformationObj; + if (this.lakumInquiryInformationObjVersion != null) { + data['LakumInquiryInformationObjVersion'] = + this.lakumInquiryInformationObjVersion.toJson(); + } + data['LakumResponseList'] = this.lakumResponseList; + data['Laser_GetBodyPartsByCategoryList'] = + this.laserGetBodyPartsByCategoryList; + data['Laser_GetCategoriesList'] = this.laserGetCategoriesList; + data['List'] = this.list; + data['ListCount'] = this.listCount; + data['ListCountDeliverd'] = this.listCountDeliverd; + data['ListCountUnDeliverd'] = this.listCountUnDeliverd; + data['ListDeviceInfo'] = this.listDeviceInfo; + data['ListFamilyAppointments'] = this.listFamilyAppointments; + data['ListLabResultsByAppNo'] = this.listLabResultsByAppNo; + data['ListLakumInquiryInformationObj'] = + this.listLakumInquiryInformationObj; + data['ListOpinion_GetAllPeriod'] = this.listOpinionGetAllPeriod; + data['ListOpinion_GetAllServices'] = this.listOpinionGetAllServices; + data['ListOpinion_GetIsAgreeValue'] = this.listOpinionGetIsAgreeValue; + data['ListOpinion_GetOpinionLogin'] = this.listOpinionGetOpinionLogin; + data['ListOpinion_GetRequestedSerives'] = + this.listOpinionGetRequestedSerives; + data['ListOpinion_GetShareServicesDetails'] = + this.listOpinionGetShareServicesDetails; + data['ListOpinion_UserTerms'] = this.listOpinionUserTerms; + data['ListPLO'] = this.listPLO; + data['ListPLR'] = this.listPLR; + data['ListPLSR'] = this.listPLSR; + data['ListPRM'] = this.listPRM; + data['ListPatientFamilyFiles'] = this.listPatientFamilyFiles; + data['ListPatientFileInfo'] = this.listPatientFileInfo; + data['ListRAD'] = this.listRAD; + data['ListRADAPI'] = this.listRADAPI; + data['List_ActiveGetPrescriptionReportByPatientID'] = + this.listActiveGetPrescriptionReportByPatientID; + data['List_AppointmentsForDentalClinic'] = + this.listAppointmentsForDentalClinic; + data['List_BabyInfoResult'] = this.listBabyInfoResult; + data['List_CheckInsuranceCoverage'] = this.listCheckInsuranceCoverage; + data['List_CompanyClass'] = this.listCompanyClass; + data['List_ConsentMedicalReport'] = this.listConsentMedicalReport; + data['List_DentalAppointments'] = this.listDentalAppointments; + data['List_DeviceTokenIDByAppointmentNo'] = + this.listDeviceTokenIDByAppointmentNo; + data['List_DischargeDiagnosis'] = this.listDischargeDiagnosis; + data['List_DischargeMedicine'] = this.listDischargeMedicine; + data['List_DischargeSummary'] = this.listDischargeSummary; + data['List_DoctorResponse'] = this.listDoctorResponse; + data['List_DoneVaccines'] = this.listDoneVaccines; + data['List_EReferralResult'] = this.listEReferralResult; + data['List_EReferrals'] = this.listEReferrals; + data['List_GetAllPatients_LiveCare_Admin'] = + this.listGetAllPatientsLiveCareAdmin; + data['List_GetDataForExcel'] = this.listGetDataForExcel; + data['List_GetMainCountID'] = this.listGetMainCountID; + data['List_GetPrescriptionReportByPatientID'] = + this.listGetPrescriptionReportByPatientID; + data['List_GetSickLeave'] = this.listGetSickLeave; + data['List_HISInvoice'] = this.listHISInvoice; + data['List_HISInvoiceProcedures'] = this.listHISInvoiceProcedures; + data['List_InpatientInvoices'] = this.listInpatientInvoices; + data['List_InsuranceCheckList'] = this.listInsuranceCheckList; + data['List_InsuranceCompanies'] = this.listInsuranceCompanies; + data['List_InsuranceCompaniesGroup'] = this.listInsuranceCompaniesGroup; + data['List_InsuranceUpdateDetails'] = this.listInsuranceUpdateDetails; + data['List_InvoiceApprovalProcedureInfo'] = + this.listInvoiceApprovalProcedureInfo; + data['List_IsLastSatisfactionSurveyReviewedModel'] = + this.listIsLastSatisfactionSurveyReviewedModel; + data['List_LabOrderDetailsModel'] = this.listLabOrderDetailsModel; + data['List_MedicalReport'] = this.listMedicalReport; + data['List_MedicalReportApprovals'] = this.listMedicalReportApprovals; + data['List_MedicalReportStatus'] = this.listMedicalReportStatus; + data['List_MonthBloodPressureResult'] = this.listMonthBloodPressureResult; + data['List_MonthBloodPressureResultAverage'] = + this.listMonthBloodPressureResultAverage; + data['List_MonthDiabtecPatientResult'] = this.listMonthDiabtecPatientResult; + data['List_MonthDiabtectResultAverage'] = + this.listMonthDiabtectResultAverage; + data['List_MonthWeightMeasurementResult'] = + this.listMonthWeightMeasurementResult; + data['List_MonthWeightMeasurementResultAverage'] = + this.listMonthWeightMeasurementResultAverage; + data['List_OnlinePrescriptionResult'] = this.listOnlinePrescriptionResult; + data['List_OutPatientInvoices'] = this.listOutPatientInvoices; + data['List_PHRInvoice'] = this.listPHRInvoice; + data['List_PHRInvoiceItems'] = this.listPHRInvoiceItems; + data['List_PHRPaymentMethods'] = this.listPHRPaymentMethods; + data['List_PateintDetails'] = this.listPateintDetails; + data['List_PateintInformation'] = this.listPateintInformation; + data['List_PatientAdmissionInfo'] = this.listPatientAdmissionInfo; + data['List_PatientAdvanceBalanceAmount'] = + this.listPatientAdvanceBalanceAmount; + data['List_PatientCallBackLogs'] = this.listPatientCallBackLogs; + data['List_PatientCallBackToUpdateFromICServer'] = + this.listPatientCallBackToUpdateFromICServer; + data['List_PatientCount'] = this.listPatientCount; + data['List_PatientDashboard'] = this.listPatientDashboard; + data['List_PatientER_GetAdminClinicsModel'] = + this.listPatientERGetAdminClinicsModel; + data['List_PatientER_GetAdminProjectsModel'] = + this.listPatientERGetAdminProjectsModel; + data['List_PatientER_GetAllClinicsModel'] = + this.listPatientERGetAllClinicsModel; + data['List_PatientHISInvoices'] = this.listPatientHISInvoices; + data['List_PatientICProjects'] = this.listPatientICProjects; + data['List_PatientICProjectsByID'] = this.listPatientICProjectsByID; + data['List_PatientICProjectsTimings'] = this.listPatientICProjectsTimings; + data['List_PatientIDByUID'] = this.listPatientIDByUID; + data['List_PatientIDForSurveyResult'] = this.listPatientIDForSurveyResult; + data['List_PatientInfo'] = this.listPatientInfo; + data['List_PatientInfoForDDScreen'] = this.listPatientInfoForDDScreen; + data['List_PatientInfoForSickleaveReport'] = + this.listPatientInfoForSickleaveReport; + data['List_PatientInsuranceCard'] = this.listPatientInsuranceCard; + data['List_PatientInsuranceCardHistory'] = + this.listPatientInsuranceCardHistory; + data['List_PatientInsuranceDetails'] = this.listPatientInsuranceDetails; + data['List_PatientPHRInvoices'] = this.listPatientPHRInvoices; + data['List_PatientServicePoint'] = this.listPatientServicePoint; + data['List_PatientStatusCount'] = this.listPatientStatusCount; + data['List_Patient_ChatRequestMapModel'] = + this.listPatientChatRequestMapModel; + data['List_Patient_ChatRequestModel'] = this.listPatientChatRequestModel; + data['List_Patient_ChatRequestVCModel'] = + this.listPatientChatRequestVCModel; + data['List_PaymentMethods'] = this.listPaymentMethods; + data['List_PointServices'] = this.listPointServices; + data['List_PregnancyStagesInfo'] = this.listPregnancyStagesInfo; + data['List_ProjectAvgERWaitingTime'] = this.listProjectAvgERWaitingTime; + data['List_ProjectAvgERWaitingTimeHourly'] = + this.listProjectAvgERWaitingTimeHourly; + data['List_RadMedicalRecords'] = this.listRadMedicalRecords; + data['List_RadMedicalRecordsAPI'] = this.listRadMedicalRecordsAPI; + data['List_RadMedicalRecordsCVI'] = this.listRadMedicalRecordsCVI; + data['List_RadMedicalRecordsCVIAPI'] = this.listRadMedicalRecordsCVIAPI; + data['List_RadMedicalRecordsResults'] = this.listRadMedicalRecordsResults; + data['List_SickLeave'] = this.listSickLeave; + data['List_Transaction'] = this.listTransaction; + data['List_VideoConferenceSessions'] = this.listVideoConferenceSessions; + data['List_WeekBloodPressureResult'] = this.listWeekBloodPressureResult; + data['List_WeekBloodPressureResultAverage'] = + this.listWeekBloodPressureResultAverage; + data['List_WeekDiabtecPatientResult'] = this.listWeekDiabtecPatientResult; + data['List_WeekDiabtectResultAverage'] = this.listWeekDiabtectResultAverage; + data['List_WeekWeightMeasurementResult'] = + this.listWeekWeightMeasurementResult; + data['List_WeekWeightMeasurementResultAverage'] = + this.listWeekWeightMeasurementResultAverage; + data['List_YearBloodPressureResult'] = this.listYearBloodPressureResult; + data['List_YearBloodPressureResultAverage'] = + this.listYearBloodPressureResultAverage; + data['List_YearDiabtecPatientResult'] = this.listYearDiabtecPatientResult; + data['List_YearDiabtecResultAverage'] = this.listYearDiabtecResultAverage; + data['List_YearWeightMeasurementResult'] = + this.listYearWeightMeasurementResult; + data['List_YearWeightMeasurementResultAverage'] = + this.listYearWeightMeasurementResultAverage; + data['List_eInvoiceForDental'] = this.listEInvoiceForDental; + data['List_eInvoiceForOnlineCheckIn'] = this.listEInvoiceForOnlineCheckIn; + data['Med_GetActivitiesTransactionsStsList'] = + this.medGetActivitiesTransactionsStsList; + data['Med_GetAvgMonthTransactionsStsList'] = + this.medGetAvgMonthTransactionsStsList; + data['Med_GetAvgWeekTransactionsStsList'] = + this.medGetAvgWeekTransactionsStsList; + data['Med_GetCategoriesList'] = this.medGetCategoriesList; + data['Med_GetMonthActivitiesTransactionsStsList'] = + this.medGetMonthActivitiesTransactionsStsList; + data['Med_GetMonthStepsTransactionsStsList'] = + this.medGetMonthStepsTransactionsStsList; + data['Med_GetMonthTransactionsStsList'] = + this.medGetMonthTransactionsStsList; + data['Med_GetPatientLastRecordList'] = this.medGetPatientLastRecordList; + data['Med_GetSubCategoriesList'] = this.medGetSubCategoriesList; + data['Med_GetTransactionsAndActTransactionsResult'] = + this.medGetTransactionsAndActTransactionsResult; + data['Med_GetTransactionsList'] = this.medGetTransactionsList; + data['Med_GetWeekActivitiesTransactionsStsList'] = + this.medGetWeekActivitiesTransactionsStsList; + data['Med_GetWeekStepsTransactionsStsList'] = + this.medGetWeekStepsTransactionsStsList; + data['Med_GetWeekTransactionsStsList'] = this.medGetWeekTransactionsStsList; + data['Med_GetYearActivitiesTransactionsStsList'] = + this.medGetYearActivitiesTransactionsStsList; + data['Med_GetYearSleepTransactionsStsList'] = + this.medGetYearSleepTransactionsStsList; + data['Med_GetYearStepsTransactionsStsList'] = + this.medGetYearStepsTransactionsStsList; + data['Med_GetYearTransactionsStsList'] = this.medGetYearTransactionsStsList; + data['Med_InsertTransactionsOutputsList'] = + this.medInsertTransactionsOutputsList; + data['MedicalRecordImages'] = this.medicalRecordImages; + data['MedicalReportToRead'] = this.medicalReportToRead; + data['MedicalReportUnreadNo'] = this.medicalReportUnreadNo; + data['Missing_IDCardAttachment'] = this.missingIDCardAttachment; + data['Missing_InsuranceCardAttachment'] = + this.missingInsuranceCardAttachment; + data['Missing_MedicalReportAttachment'] = + this.missingMedicalReportAttachment; + data['Missing_OtherRelationship'] = this.missingOtherRelationship; + data['Missing_PatientContactNo'] = this.missingPatientContactNo; + data['Missing_PatientId'] = this.missingPatientId; + data['Missing_PatientIdentityNumber'] = this.missingPatientIdentityNumber; + data['Missing_PatientName'] = this.missingPatientName; + data['Missing_ReferralContactNo'] = this.missingReferralContactNo; + data['Missing_ReferralRelationship'] = this.missingReferralRelationship; + data['Missing_ReferralRequesterName'] = this.missingReferralRequesterName; + data['MobileNumber'] = this.mobileNumber; + data['NationalityNumber'] = this.nationalityNumber; + data['OnlineCheckInAppointments'] = this.onlineCheckInAppointments; + data['Opinion_UserAgreementContent'] = this.opinionUserAgreementContent; + data['OrderInsert'] = this.orderInsert; + data['PateintInfoForUpdateList'] = this.pateintInfoForUpdateList; + data['PateintUpatedList'] = this.pateintUpatedList; + data['PatientBirthdayCertificate'] = this.patientBirthdayCertificate; + data['PatientER_CMCRequestSummaryByProject'] = + this.patientERCMCRequestSummaryByProject; + data['PatientER_CMCRequestWithTotal'] = this.patientERCMCRequestWithTotal; + data['PatientER_CMC_GetAllServicesList'] = + this.patientERCMCGetAllServicesList; + data['PatientER_CMC_GetTransactionsForOrderList'] = + this.patientERCMCGetTransactionsForOrderList; + data['PatientER_Coordinates'] = this.patientERCoordinates; + data['PatientER_CountOrderList'] = this.patientERCountOrderList; + data['PatientER_CountsForApprovalOffice'] = + this.patientERCountsForApprovalOffice; + data['PatientER_DeleteOldCurrentDoctorsOutputsList'] = + this.patientERDeleteOldCurrentDoctorsOutputsList; + data['PatientER_Delivery_GetAllDeliverdOrderList'] = + this.patientERDeliveryGetAllDeliverdOrderList; + data['PatientER_Delivery_GetAllOrderList'] = + this.patientERDeliveryGetAllOrderList; + data['PatientER_Delivery_IsOrderInserted'] = + this.patientERDeliveryIsOrderInserted; + data['PatientER_Delivery_IsOrderUpdated'] = + this.patientERDeliveryIsOrderUpdated; + data['PatientER_Delivery_IsPausedChanged'] = + this.patientERDeliveryIsPausedChanged; + data['PatientER_Delivery_NextOrder'] = this.patientERDeliveryNextOrder; + data['PatientER_Delivery_OrderInsert'] = this.patientERDeliveryOrderInsert; + data['PatientER_Delivery_UpdateOrderStatus'] = + this.patientERDeliveryUpdateOrderStatus; + data['PatientER_DriverUpdate'] = this.patientERDriverUpdate; + data['PatientER_Exacart_CheckIsDispenseAccpetableList'] = + this.patientERExacartCheckIsDispenseAccpetableList; + data['PatientER_Exacart_GetDispenseQuantitiesByOrderIDList'] = + this.patientERExacartGetDispenseQuantitiesByOrderIDList; + data['PatientER_Exacart_GetOrderDetailsByePharmacyOrderNoList'] = + this.patientERExacartGetOrderDetailsByePharmacyOrderNoList; + data['PatientER_Exacart_GetOrderDetailsList'] = + this.patientERExacartGetOrderDetailsList; + data['PatientER_Exacart_GetTotalDispenseQuantitiesByPresNoList'] = + this.patientERExacartGetTotalDispenseQuantitiesByPresNoList; + data['PatientER_Exacart_IsDispenseAdded'] = + this.patientERExacartIsDispenseAdded; + data['PatientER_Exacart_IsDispenseAddedList'] = + this.patientERExacartIsDispenseAddedList; + data['PatientER_Exacart_IsOrderCompleted'] = + this.patientERExacartIsOrderCompleted; + data['PatientER_GetAdminByProjectAndRoleList'] = + this.patientERGetAdminByProjectAndRoleList; + data['PatientER_GetAdminProjectsList'] = this.patientERGetAdminProjectsList; + data['PatientER_GetAllDriversList'] = this.patientERGetAllDriversList; + data['PatientER_GetAllNeedAproveStatusList'] = + this.patientERGetAllNeedAproveStatusList; + data['PatientER_GetAllPresOrdersStatusList'] = + this.patientERGetAllPresOrdersStatusList; + data['PatientER_GetAllProjectsList'] = this.patientERGetAllProjectsList; + data['PatientER_GetArchiveInformation_List'] = + this.patientERGetArchiveInformationList; + data['PatientER_GetAskDoctorTotalByDateFilterList'] = + this.patientERGetAskDoctorTotalByDateFilterList; + data['PatientER_GetBookScheduleConfigsList'] = + this.patientERGetBookScheduleConfigsList; + data['PatientER_GetClinicAndTimeAndEpisodeForAppointmentList'] = + this.patientERGetClinicAndTimeAndEpisodeForAppointmentList; + data['PatientER_GetClinicAndTimeForDischargeList'] = + this.patientERGetClinicAndTimeForDischargeList; + data['PatientER_GetDashboardDataforApporvalSectionForAdminList'] = + this.patientERGetDashboardDataforApporvalSectionForAdminList; + data['PatientER_GetDashboardDataforApporvalSectionList'] = + this.patientERGetDashboardDataforApporvalSectionList; + data['PatientER_GetDashboardDataforHHCSectionForAdminList'] = + this.patientERGetDashboardDataforHHCSectionForAdminList; + data['PatientER_GetDashboardDataforHHCSectionList'] = + this.patientERGetDashboardDataforHHCSectionList; + data['PatientER_GetDashboardDataforPrescriptionSectionForAdminList'] = + this.patientERGetDashboardDataforPrescriptionSectionForAdminList; + data['PatientER_GetDashboardDataforPrescriptionSectionList'] = + this.patientERGetDashboardDataforPrescriptionSectionList; + data['PatientER_GetDoctorDashboardDataModelList'] = + this.patientERGetDoctorDashboardDataModelList; + data['PatientER_GetDriverLocationList'] = + this.patientERGetDriverLocationList; + data['PatientER_GetInsuranceCardRequestByDateFilterList'] = + this.patientERGetInsuranceCardRequestByDateFilterList; + data['PatientER_GetLiveCareSummaryBookedAppoinmentStatusList'] = + this.patientERGetLiveCareSummaryBookedAppoinmentStatusList; + data['PatientER_GetLiveCareSummaryCovidList'] = + this.patientERGetLiveCareSummaryCovidList; + data['PatientER_GetLiveCareSummaryForCMCList'] = + this.patientERGetLiveCareSummaryForCMCList; + data['PatientER_GetLiveCareSummaryForHHCList'] = + this.patientERGetLiveCareSummaryForHHCList; + data['PatientER_GetLiveCareSummaryForHomeDeliveryList'] = + this.patientERGetLiveCareSummaryForHomeDeliveryList; + data['PatientER_GetLiveCareSummaryForInsuranceCardRequestList'] = + this.patientERGetLiveCareSummaryForInsuranceCardRequestList; + data['PatientER_GetLiveCareSummaryForNewFilesList'] = + this.patientERGetLiveCareSummaryForNewFilesList; + data['PatientER_GetLiveCareSummaryForOnlinePaymetRequestList'] = + this.patientERGetLiveCareSummaryForOnlinePaymetRequestList; + data['PatientER_GetLiveCareSummaryForOnlinePharmacyOrdersList'] = + this.patientERGetLiveCareSummaryForOnlinePharmacyOrdersList; + data['PatientER_GetLiveCareSummaryForTrasnportationList'] = + this.patientERGetLiveCareSummaryForTrasnportationList; + data['PatientER_GetLiveCareSummaryLiveCareCountsList'] = + this.patientERGetLiveCareSummaryLiveCareCountsList; + data['PatientER_GetMedicalRequestTotalByDateFilterList'] = + this.patientERGetMedicalRequestTotalByDateFilterList; + data['PatientER_GetNearestPendingOrdersList'] = + this.patientERGetNearestPendingOrdersList; + data['PatientER_GetNeedAproveHistoryForOrderList'] = + this.patientERGetNeedAproveHistoryForOrderList; + data['PatientER_GetNeedAprovePendingOrdersList'] = + this.patientERGetNeedAprovePendingOrdersList; + data['PatientER_GetNeedAproveStatusStatisticsList'] = + this.patientERGetNeedAproveStatusStatisticsList; + data['PatientER_GetPatientAllPresOrdersList'] = + this.patientERGetPatientAllPresOrdersList; + data['PatientER_GetPendingPatientsCountList'] = + this.patientERGetPendingPatientsCountList; + data['PatientER_GetPresOrdersHistoryForAdminList'] = + this.patientERGetPresOrdersHistoryForAdminList; + data['PatientER_GetPresOrdersHistoryForOrderList'] = + this.patientERGetPresOrdersHistoryForOrderList; + data['PatientER_GetPresOrdersStatusStatisticsList'] = + this.patientERGetPresOrdersStatusStatisticsList; + data['PatientER_HHCRequest'] = this.patientERHHCRequest; + data['PatientER_HHCRequestSummaryByProject'] = + this.patientERHHCRequestSummaryByProject; + data['PatientER_HHCRequestWithTotal'] = this.patientERHHCRequestWithTotal; + data['PatientER_HHC_GetAllServicesList'] = + this.patientERHHCGetAllServicesList; + data['PatientER_HHC_GetTransactionsForOrderList'] = + this.patientERHHCGetTransactionsForOrderList; + data['PatientER_HomeDeliveryCounts'] = this.patientERHomeDeliveryCounts; + data['PatientER_InsertDriver'] = this.patientERInsertDriver; + data['PatientER_InsertNewCurrentDoctorsOutputsList'] = + this.patientERInsertNewCurrentDoctorsOutputsList; + data['PatientER_InsuranceStatusCountList'] = + this.patientERInsuranceStatusCountList; + data['PatientER_IsNearestProjectUpdated'] = + this.patientERIsNearestProjectUpdated; + data['PatientER_IsNeedAproveReturnedToQueue'] = + this.patientERIsNeedAproveReturnedToQueue; + data['PatientER_IsNeedAproveUpdated'] = this.patientERIsNeedAproveUpdated; + data['PatientER_IsOrderClientRequestUpdated'] = + this.patientERIsOrderClientRequestUpdated; + data['PatientER_IsOrderReturnedToQueue'] = + this.patientERIsOrderReturnedToQueue; + data['PatientER_IsPresOrderInserted'] = this.patientERIsPresOrderInserted; + data['PatientER_IsPresOrderUpdated'] = this.patientERIsPresOrderUpdated; + data['PatientER_IsProjectUpdated'] = this.patientERIsProjectUpdated; + data['PatientER_NotCompletedDetails'] = this.patientERNotCompletedDetails; + data['PatientER_PatientsCountByCallStatus'] = + this.patientERPatientsCountByCallStatus; + data['PatientER_PeakHourCounts'] = this.patientERPeakHourCounts; + data['PatientER_PresOrderInfo'] = this.patientERPresOrderInfo; + data['PatientER_PrescriptionCounts'] = this.patientERPrescriptionCounts; + data['PatientER_ProjectsContribution'] = this.patientERProjectsContribution; + data['PatientER_RRT_GetAllQuestionsList'] = + this.patientERRRTGetAllQuestionsList; + data['PatientER_RRT_GetAllTransportationMethodList'] = + this.patientERRRTGetAllTransportationMethodList; + data['PatientER_RRT_GetPickUpRequestByPresOrderIDList'] = + this.patientERRRTGetPickUpRequestByPresOrderIDList; + data['PatientER_RealRRT_GetAllServicesList'] = + this.patientERRealRRTGetAllServicesList; + data['PatientER_RealRRT_GetOrderDetailsList'] = + this.patientERRealRRTGetOrderDetailsList; + data['PatientER_RealRRT_GetTransactionsForOrderList'] = + this.patientERRealRRTGetTransactionsForOrderList; + data['PatientER_RealRRT_IsTransInserted'] = + this.patientERRealRRTIsTransInserted; + data['PatientER_RequestList'] = this.patientERRequestList; + data['PatientER_TransportationRequestWithTotal'] = + this.patientERTransportationRequestWithTotal; + data['PatientE_RealRRT_GetServicePriceList'] = + this.patientERealRRTGetServicePriceList; + data['PatientInfoByAdmissionNo_List'] = this.patientInfoByAdmissionNoList; + data['PatientMonitor_GetPatientHeartRate'] = + this.patientMonitorGetPatientHeartRate; + data['PatientNotServedCounts'] = this.patientNotServedCounts; + data['PatientPrescriptionList'] = this.patientPrescriptionList; + data['Patient_Allergies'] = this.patientAllergies; + data['Patient_CheckAppointmentValidationList'] = + this.patientCheckAppointmentValidationList; + data['Patient_LoginTokenList'] = this.patientLoginTokenList; + data['Patient_QRLoginInfoList'] = this.patientQRLoginInfoList; + data['Patient_SELECTDeviceIMEIbyIMEIList'] = + this.patientSELECTDeviceIMEIbyIMEIList; + data['PharmList'] = this.pharmList; + data['PrefLang'] = this.prefLang; + data['RadReportUnreadNo'] = this.radReportUnreadNo; + data['Rad_GetPatientRadOrdersForDental_List'] = + this.radGetPatientRadOrdersForDentalList; + data['ReferralNumber'] = this.referralNumber; + data['ReminderConfigurations'] = this.reminderConfigurations; + data['RequestNo'] = this.requestNo; + data['RowCount'] = this.rowCount; + data['ServicePrivilegeList'] = this.servicePrivilegeList; + data['ShareFamilyFileObj'] = this.shareFamilyFileObj; + data['Status'] = this.status; + data['SuccessCode'] = this.successCode; + data['SurveyRate'] = this.surveyRate; + data['SymptomChecker_ConditionList'] = this.symptomCheckerConditionList; + data['SymptomChecker_GetAllDefaultQuestionsList'] = + this.symptomCheckerGetAllDefaultQuestionsList; + data['SymptomChecker_GetBodyPartSymptomsList'] = + this.symptomCheckerGetBodyPartSymptomsList; + data['SymptomChecker_GetBodyPartsByCodeList'] = + this.symptomCheckerGetBodyPartsByCodeList; + data['SymptomChecker_GetBodyPartsList'] = + this.symptomCheckerGetBodyPartsList; + data['SymptomChecker_JsonResponseInString'] = + this.symptomCheckerJsonResponseInString; + data['TimerTime'] = this.timerTime; + data['TotalAdvanceBalanceAmount'] = this.totalAdvanceBalanceAmount; + data['TotalPatientsCount'] = this.totalPatientsCount; + data['TotalPendingApprovalCount'] = this.totalPendingApprovalCount; + data['TotalUnUsedCount'] = this.totalUnUsedCount; + data['TransactionNo'] = this.transactionNo; + data['UnReadCounts'] = this.unReadCounts; + data['UpdateStatus'] = this.updateStatus; + data['UserAgreementContent'] = this.userAgreementContent; + data['YahalaAccountNo'] = this.yahalaAccountNo; + data['check24HourComplaint'] = this.check24HourComplaint; + data['currency'] = this.currency; + data['message'] = this.message; + data['patientID'] = this.patientID; + data['returnValue'] = this.returnValue; + data['returnValueStr'] = this.returnValueStr; + data['statusCode'] = this.statusCode; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart new file mode 100644 index 00000000..c609fa0b --- /dev/null +++ b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart @@ -0,0 +1,179 @@ +import 'PointsAmountPerYear.dart'; +import 'PointsDetails.dart'; + +class LakumInquiryInformationObjVersion { + int accountNumber; + String accountStatus; + String barCode; + int consumedPoints; + String consumedPointsAmount; + List consumedPointsAmountPerYear; + List consumedPointsDetails; + String createdDate; + int expiredPoints; + String expiryDate; + int gainedPoints; + List gainedPointsAmountPerYear; + List gainedPointsDetails; + String lakumMessageStatus; + String memberName; + String memberUniversalId; + String mobileNumber; + int pointsBalance; + int pointsBalanceAmount; + int pointsWillBeExpired; + String prefLang; + int statusCode; + int transferPoints; + List transferPointsAmountPerYear; + List transferPointsDetails; + dynamic waitingPoints; + dynamic loyalityAmount; + dynamic loyalityPoints; + int purchaseRate; + + LakumInquiryInformationObjVersion( + {this.accountNumber, + this.accountStatus, + this.barCode, + this.consumedPoints, + this.consumedPointsAmount, + this.consumedPointsAmountPerYear, + this.consumedPointsDetails, + this.createdDate, + this.expiredPoints, + this.expiryDate, + this.gainedPoints, + this.gainedPointsAmountPerYear, + this.gainedPointsDetails, + this.lakumMessageStatus, + this.memberName, + this.memberUniversalId, + this.mobileNumber, + this.pointsBalance, + this.pointsBalanceAmount, + this.pointsWillBeExpired, + this.prefLang, + this.statusCode, + this.transferPoints, + this.transferPointsAmountPerYear, + this.transferPointsDetails, + this.waitingPoints, + this.loyalityAmount, + this.loyalityPoints, + this.purchaseRate}); + + LakumInquiryInformationObjVersion.fromJson(Map json) { + accountNumber = json['AccountNumber']; + accountStatus = json['AccountStatus']; + barCode = json['BarCode']; + consumedPoints = json['ConsumedPoints']; + consumedPointsAmount = json['ConsumedPointsAmount']; + if (json['ConsumedPointsAmountPerYear'] != null) { + consumedPointsAmountPerYear = new List(); + json['ConsumedPointsAmountPerYear'].forEach((v) { + consumedPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v)); + }); + } + if (json['ConsumedPointsDetails'] != null) { + consumedPointsDetails = new List(); + json['ConsumedPointsDetails'].forEach((v) { + consumedPointsDetails.add(PointsDetails.fromJson(v)); + }); + } + createdDate = json['CreatedDate']; + expiredPoints = json['ExpiredPoints']; + expiryDate = json['ExpiryDate']; + gainedPoints = json['GainedPoints']; + if (json['GainedPointsAmountPerYear'] != null) { + gainedPointsAmountPerYear = new List(); + json['GainedPointsAmountPerYear'].forEach((v) { + gainedPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v)); + }); + } + if (json['GainedPointsDetails'] != null) { + gainedPointsDetails = new List(); + json['GainedPointsDetails'].forEach((v) { + gainedPointsDetails.add(PointsDetails.fromJson(v)); + }); + } + lakumMessageStatus = json['LakumMessageStatus']; + memberName = json['MemberName']; + memberUniversalId = json['MemberUniversalId']; + mobileNumber = json['MobileNumber']; + pointsBalance = json['PointsBalance']; + pointsBalanceAmount = json['PointsBalanceAmount']; + pointsWillBeExpired = json['PointsWillBeExpired']; + prefLang = json['PrefLang']; + statusCode = json['StatusCode']; + transferPoints = json['TransferPoints']; + if (json['TransferPointsAmountPerYear'] != null) { + transferPointsAmountPerYear = new List(); + json['TransferPointsAmountPerYear'].forEach((v) { + transferPointsAmountPerYear.add(PointsAmountPerYear.fromJson(v)); + }); + } + if (json['TransferPointsDetails'] != null) { + transferPointsDetails = new List(); + json['TransferPointsDetails'].forEach((v) { + transferPointsDetails.add(PointsDetails.fromJson(v)); + }); + } + waitingPoints = json['WaitingPoints']; + loyalityAmount = json['loyalityAmount']; + loyalityPoints = json['loyalityPoints']; + purchaseRate = json['purchaseRate']; + } + + Map toJson() { + final Map data = new Map(); + data['AccountNumber'] = this.accountNumber; + data['AccountStatus'] = this.accountStatus; + data['BarCode'] = this.barCode; + data['ConsumedPoints'] = this.consumedPoints; + data['ConsumedPointsAmount'] = this.consumedPointsAmount; + if (this.consumedPointsAmountPerYear != null) { + data['ConsumedPointsAmountPerYear'] = + this.consumedPointsAmountPerYear.map((v) => v).toList(); + } + if (this.consumedPointsDetails != null) { + data['ConsumedPointsDetails'] = + this.consumedPointsDetails.map((v) => v).toList(); + } + data['CreatedDate'] = this.createdDate; + data['ExpiredPoints'] = this.expiredPoints; + data['ExpiryDate'] = this.expiryDate; + data['GainedPoints'] = this.gainedPoints; + if (this.gainedPointsAmountPerYear != null) { + data['GainedPointsAmountPerYear'] = + this.gainedPointsAmountPerYear.map((v) => v).toList(); + } + if (this.gainedPointsDetails != null) { + data['GainedPointsDetails'] = + this.gainedPointsDetails.map((v) => v).toList(); + } + data['LakumMessageStatus'] = this.lakumMessageStatus; + data['MemberName'] = this.memberName; + data['MemberUniversalId'] = this.memberUniversalId; + data['MobileNumber'] = this.mobileNumber; + data['PointsBalance'] = this.pointsBalance; + data['PointsBalanceAmount'] = this.pointsBalanceAmount; + data['PointsWillBeExpired'] = this.pointsWillBeExpired; + data['PrefLang'] = this.prefLang; + data['StatusCode'] = this.statusCode; + data['TransferPoints'] = this.transferPoints; + if (this.transferPointsAmountPerYear != null) { + data['TransferPointsAmountPerYear'] = + this.transferPointsAmountPerYear.map((v) => v).toList(); + } + if (this.transferPointsDetails != null) { + data['TransferPointsDetails'] = + this.transferPointsDetails.map((v) => v).toList(); + } + data['WaitingPoints'] = this.waitingPoints; + data['loyalityAmount'] = this.loyalityAmount; + data['loyalityPoints'] = this.loyalityPoints; + data['purchaseRate'] = this.purchaseRate; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/ListUserAgreement.dart b/lib/core/model/pharmacies/ListUserAgreement.dart new file mode 100644 index 00000000..4237e304 --- /dev/null +++ b/lib/core/model/pharmacies/ListUserAgreement.dart @@ -0,0 +1,28 @@ +class ListUserAgreement { + String userAgreementLAKUM; + String userAgreementLAKUMn; + String userAgreementTxt; + String userAgreementTxtn; + + ListUserAgreement( + {this.userAgreementLAKUM, + this.userAgreementLAKUMn, + this.userAgreementTxt, + this.userAgreementTxtn}); + + ListUserAgreement.fromJson(Map json) { + userAgreementLAKUM = json['UserAgreementLAKUM']; + userAgreementLAKUMn = json['UserAgreementLAKUMn']; + userAgreementTxt = json['UserAgreementTxt']; + userAgreementTxtn = json['UserAgreementTxtn']; + } + + Map toJson() { + final Map data = new Map(); + data['UserAgreementLAKUM'] = this.userAgreementLAKUM; + data['UserAgreementLAKUMn'] = this.userAgreementLAKUMn; + data['UserAgreementTxt'] = this.userAgreementTxt; + data['UserAgreementTxtn'] = this.userAgreementTxtn; + return data; + } +} diff --git a/lib/core/model/pharmacies/PharmacyAddressesModel.dart b/lib/core/model/pharmacies/PharmacyAddressesModel.dart new file mode 100644 index 00000000..db9c20ae --- /dev/null +++ b/lib/core/model/pharmacies/PharmacyAddressesModel.dart @@ -0,0 +1,170 @@ + +import 'dart:convert'; + +PharmacyAddressesModel pharmacyAddressesModelFromJson(String str) => PharmacyAddressesModel.fromJson(json.decode(str)); + +String pharmacyAddressesModelToJson(PharmacyAddressesModel data) => json.encode(data.toJson()); + +class PharmacyAddressesModel { + PharmacyAddressesModel({ + this.customers, + }); + + List customers; + + factory PharmacyAddressesModel.fromJson(Map json) => PharmacyAddressesModel( + customers: List.from(json["customers"].map((x) => Customer.fromJson(x))), + ); + + Map toJson() => { + "customers": List.from(customers.map((x) => x.toJson())), + }; +} + +class Customer { + Customer({ + this.addresses, + }); + + List
addresses; + + factory Customer.fromJson(Map json) => Customer( + addresses: List
.from(json["addresses"].map((x) => Address.fromJson(x))), + ); + + Map toJson() => { + "addresses": List.from(addresses.map((x) => x.toJson())), + }; +} + +class Address { + Address({ + 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, + }); + + String id; + FirstName firstName; + LastName lastName; + Email email; + dynamic company; + int countryId; + Country country; + dynamic stateProvinceId; + City city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + dynamic faxNumber; + String customerAttributes; + DateTime createdOnUtc; + dynamic province; + String latLong; + + factory Address.fromJson(Map json) => Address( + id: json["id"], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[json["last_name"]], + email: emailValues.map[json["email"]], + company: json["company"], + countryId: json["country_id"], + country: countryValues.map[json["country"]], + stateProvinceId: json["state_province_id"], + city: cityValues.map[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: DateTime.parse(json["created_on_utc"]), + province: json["province"], + latLong: json["lat_long"], + ); + + Map toJson() => { + "id": id, + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[lastName], + "email": emailValues.reverse[email], + "company": company, + "country_id": countryId, + "country": countryValues.reverse[country], + "state_province_id": stateProvinceId, + "city": cityValues.reverse[city], + "address1": address1, + "address2": address2, + "zip_postal_code": zipPostalCode, + "phone_number": phoneNumber, + "fax_number": faxNumber, + "customer_attributes": customerAttributes, + "created_on_utc": createdOnUtc.toIso8601String(), + "province": province, + "lat_long": latLong, + }; +} + +enum City { RIYADH, AL_OYUN } + +final cityValues = EnumValues({ + "Al Oyun": City.AL_OYUN, + "Riyadh": City.RIYADH +}); + +enum Country { SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA +}); + +enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM } + +final emailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM, + "Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_COM +}); + +enum FirstName { TAMER, TAMER_FANASHEH } + +final firstNameValues = EnumValues({ + "TAMER": FirstName.TAMER, + "TAMER FANASHEH": FirstName.TAMER_FANASHEH +}); + +enum LastName { FANASHEH, MUSA } + +final lastNameValues = EnumValues({ + "FANASHEH": LastName.FANASHEH, + "MUSA": LastName.MUSA +}); + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/core/model/pharmacies/PharmacyProduct.dart b/lib/core/model/pharmacies/PharmacyProduct.dart index cd461ae5..c472cb4c 100644 --- a/lib/core/model/pharmacies/PharmacyProduct.dart +++ b/lib/core/model/pharmacies/PharmacyProduct.dart @@ -1,149 +1,538 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Specifications.dart'; + import 'PharmacyImageObject.dart'; import 'Reviews.dart'; class PharmacyProduct { String id; + bool visibleIndividually; String name; String namen; String shortDescription; + String shortDescriptionn; String fullDescription; String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + String metaKeywords; + String metaDescription; + String metaTitle; + bool allowCustomerReviews; int approvedRatingSum; + int notApprovedRatingSum; int approvedTotalReviews; + int notApprovedTotalReviews; String sku; bool isRx; + bool prescriptionRequired; String rxMessage; String rxMessagen; + String manufacturerPartNumber; + String gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + int maxNumberOfDownloads; + String downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + int recurringCycleLength; + int recurringTotalCycles; + bool isRental; + int rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + double additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + int manageInventoryMethodId; int stockQuantity; String stockAvailability; String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + int minStockQuantity; + int notifyAdminForQuantityBelow; bool allowBackInStockSubscriptions; int orderMinimumQuantity; int orderMaximumQuantity; + String allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + String preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; double price; double oldPrice; + double productCost; + String specialPrice; + String specialPriceStartDateTimeUtc; + String specialPriceEndDateTimeUtc; + bool customerEntersPrice; + double minimumCustomerEnteredPrice; + double maximumCustomerEnteredPrice; + bool basepriceEnabled; + double basepriceAmount; + double basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; String discountName; String discountNamen; + String discountDescription; + String discountDescriptionn; String discountPercentage; + String currency; + String currencyn; + double weight; + double length; + double width; + double height; + String availableStartDateTimeUtc; + String availableEndDateTimeUtc; int displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + int parentGroupedProductId; + List roleIds; List discountIds; + List storeIds; + List manufacturerIds; List reviews; List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + int vendorId; + String seName; + PharmacyProduct( {this.id, + this.visibleIndividually, this.name, this.namen, this.shortDescription, + this.shortDescriptionn, this.fullDescription, this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, this.approvedRatingSum, + this.notApprovedRatingSum, this.approvedTotalReviews, + this.notApprovedTotalReviews, this.sku, this.isRx, + this.prescriptionRequired, this.rxMessage, this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, this.stockQuantity, this.stockAvailability, this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, this.allowBackInStockSubscriptions, this.orderMinimumQuantity, this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, this.price, this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, this.discountName, this.discountNamen, + this.discountDescription, + this.discountDescriptionn, this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, this.discountIds, + this.storeIds, + this.manufacturerIds, this.reviews, - this.images}); + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); 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); + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + shortDescription = json['short_description']; + shortDescriptionn = json['short_descriptionn']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + markasNew = json['markas_new']; + showOnHomePage = json['show_on_home_page']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + if (json['role_ids'] != null) { + roleIds = new List(); + json['role_ids'].forEach((v) { + roleIds.add(v); + }); + } + if (json['discount_ids'] != null) { + discountIds = new List(); + json['discount_ids'].forEach((v) { + discountIds.add(v); + }); + } + if (json['store_ids'] != null) { + storeIds = new List(); + json['store_ids'].forEach((v) { + storeIds.add(v); + }); + } + if (json['manufacturer_ids'] != null) { + manufacturerIds = new List(); + json['manufacturer_ids'].forEach((v) { + manufacturerIds.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)); + }); + } + if (json['attributes'] != null) { + attributes = new List(); + json['attributes'].forEach((v) { + attributes.add(v); + }); + } + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); } + if (json['associated_product_ids'] != null) { + associatedProductIds = new List(); + json['associated_product_ids'].forEach((v) { + associatedProductIds.add(v); + }); + } + if (json['tags'] != null) { + tags = new List(); + json['tags'].forEach((v) { + tags.add(v); + }); + } + vendorId = json['vendor_id']; + seName = json['se_name']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; data['name'] = this.name; data['namen'] = this.namen; data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; data['full_description'] = this.fullDescription; data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; data['sku'] = this.sku; data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; data['rx_message'] = this.rxMessage; data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; data['stock_quantity'] = this.stockQuantity; data['stock_availability'] = this.stockAvailability; data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; data['allow_back_in_stock_subscriptions'] = this.allowBackInStockSubscriptions; data['order_minimum_quantity'] = this.orderMinimumQuantity; data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; data['price'] = this.price; data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; data['discount_name'] = this.discountName; data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; data['display_order'] = this.displayOrder; - if (this.discountIds != String) { + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v).toList(); + } + if (this.discountIds != null) { data['discount_ids'] = this.discountIds.map((v) => v).toList(); } - if (this.reviews != String) { + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v).toList(); + } + data['manufacturer_ids'] = this.manufacturerIds; + if (this.reviews != null) { data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); } - if (this.images != String) { + if (this.images != null) { data['images'] = this.images.map((v) => v.toJson()).toList(); } + if (this.attributes != null) { + data['attributes'] = this.attributes.map((v) => v).toList(); + } + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + if (this.associatedProductIds != null) { + data['associated_product_ids'] = + this.associatedProductIds.map((v) => v).toList(); + } + if (this.tags != null) { + data['tags'] = this.tags.map((v) => v).toList(); + } + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; return data; } } diff --git a/lib/core/model/pharmacies/PointsAmountPerMonth.dart b/lib/core/model/pharmacies/PointsAmountPerMonth.dart new file mode 100644 index 00000000..71cf3498 --- /dev/null +++ b/lib/core/model/pharmacies/PointsAmountPerMonth.dart @@ -0,0 +1,42 @@ +import 'PointsAmountPerday.dart'; + +class PointsAmountPerMonth { + double amountPerMonth; + String month; + int monthNumber; + List pointsAmountPerday; + double pointsPerMonth; + + PointsAmountPerMonth( + {this.amountPerMonth, + this.month, + this.monthNumber, + this.pointsAmountPerday, + this.pointsPerMonth}); + + PointsAmountPerMonth.fromJson(Map json) { + amountPerMonth = json['AmountPerMonth']; + month = json['Month']; + monthNumber = json['MonthNumber']; + if (json['PointsAmountPerday'] != null) { + pointsAmountPerday = new List(); + json['PointsAmountPerday'].forEach((v) { + pointsAmountPerday.add(new PointsAmountPerday.fromJson(v)); + }); + } + pointsPerMonth = json['PointsPerMonth']; + } + + Map toJson() { + final Map data = new Map(); + data['AmountPerMonth'] = this.amountPerMonth; + data['Month'] = this.month; + data['MonthNumber'] = this.monthNumber; + if (this.pointsAmountPerday != null) { + data['PointsAmountPerday'] = + this.pointsAmountPerday.map((v) => v.toJson()).toList(); + } + data['PointsPerMonth'] = this.pointsPerMonth; + return data; + } +} diff --git a/lib/core/model/pharmacies/PointsAmountPerYear.dart b/lib/core/model/pharmacies/PointsAmountPerYear.dart new file mode 100644 index 00000000..eef74064 --- /dev/null +++ b/lib/core/model/pharmacies/PointsAmountPerYear.dart @@ -0,0 +1,38 @@ +import 'PointsAmountPerMonth.dart'; + +class PointsAmountPerYear { + int amountPerYear; + List pointsAmountPerMonth; + int pointsPerYear; + int year; + + PointsAmountPerYear( + {this.amountPerYear, + this.pointsAmountPerMonth, + this.pointsPerYear, + this.year}); + + PointsAmountPerYear.fromJson(Map json) { + amountPerYear = json['AmountPerYear']; + if (json['PointsAmountPerMonth'] != null) { + pointsAmountPerMonth = new List(); + json['PointsAmountPerMonth'].forEach((v) { + pointsAmountPerMonth.add(new PointsAmountPerMonth.fromJson(v)); + }); + } + pointsPerYear = json['PointsPerYear']; + year = json['Year']; + } + + Map toJson() { + final Map data = new Map(); + data['AmountPerYear'] = this.amountPerYear; + if (this.pointsAmountPerMonth != null) { + data['PointsAmountPerMonth'] = + this.pointsAmountPerMonth.map((v) => v.toJson()).toList(); + } + data['PointsPerYear'] = this.pointsPerYear; + data['Year'] = this.year; + return data; + } +} diff --git a/lib/core/model/pharmacies/PointsAmountPerday.dart b/lib/core/model/pharmacies/PointsAmountPerday.dart new file mode 100644 index 00000000..e78e87b7 --- /dev/null +++ b/lib/core/model/pharmacies/PointsAmountPerday.dart @@ -0,0 +1,42 @@ +import 'PointsDetails.dart'; + +class PointsAmountPerday { + double amountPerDay; + String day; + List pointsDetails; + double pointsPerDay; + String transationDate; + + PointsAmountPerday( + {this.amountPerDay, + this.day, + this.pointsDetails, + this.pointsPerDay, + this.transationDate}); + + PointsAmountPerday.fromJson(Map json) { + amountPerDay = json['AmountPerDay']; + day = json['Day']; + if (json['PointsDetails'] != null) { + pointsDetails = new List(); + json['PointsDetails'].forEach((v) { + pointsDetails.add(new PointsDetails.fromJson(v)); + }); + } + pointsPerDay = json['PointsPerDay']; + transationDate = json['TransationDate']; + } + + Map toJson() { + final Map data = new Map(); + data['AmountPerDay'] = this.amountPerDay; + data['Day'] = this.day; + if (this.pointsDetails != null) { + data['PointsDetails'] = + this.pointsDetails.map((v) => v.toJson()).toList(); + } + data['PointsPerDay'] = this.pointsPerDay; + data['TransationDate'] = this.transationDate; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/PointsDetails.dart b/lib/core/model/pharmacies/PointsDetails.dart new file mode 100644 index 00000000..7b342af9 --- /dev/null +++ b/lib/core/model/pharmacies/PointsDetails.dart @@ -0,0 +1,57 @@ +class PointsDetails { + int accNumber; + String accountStatus; + double amount; + int lineItemNo; + String operationType; + double points; + double purchasePoints; + int subTransactionType; + String subTransactionTypeDescription; + String transactionDate; + + PointsDetails( + {this.accNumber, + this.accountStatus, + this.amount, + this.lineItemNo, + this.operationType, + this.points, + this.purchasePoints, + this.subTransactionType, + this.subTransactionTypeDescription, + this.transactionDate}); + + PointsDetails.fromJson(Map json) { + accNumber = json['AccNumber']; + accountStatus = json['AccountStatus']; + amount = json['Amount']; + lineItemNo = json['LineItemNo']; + operationType = json['OperationType']; + points = json['Points']; + var purchasePoints = json['PurchasePoints']; + if(purchasePoints is int){ + this.purchasePoints = (purchasePoints).roundToDouble(); + }else { + this.purchasePoints = purchasePoints; + } + subTransactionType = json['SubTransactionType']; + subTransactionTypeDescription = json['SubTransactionTypeDescription']; + transactionDate = json['TransactionDate']; + } + + Map toJson() { + final Map data = new Map(); + data['AccNumber'] = this.accNumber; + data['AccountStatus'] = this.accountStatus; + data['Amount'] = this.amount; + data['LineItemNo'] = this.lineItemNo; + data['OperationType'] = this.operationType; + data['Points'] = this.points; + data['PurchasePoints'] = this.purchasePoints; + data['SubTransactionType'] = this.subTransactionType; + data['SubTransactionTypeDescription'] = this.subTransactionTypeDescription; + data['TransactionDate'] = this.transactionDate; + return data; + } +} diff --git a/lib/core/model/pharmacies/ShippingOption.dart b/lib/core/model/pharmacies/ShippingOption.dart new file mode 100644 index 00000000..1b589537 --- /dev/null +++ b/lib/core/model/pharmacies/ShippingOption.dart @@ -0,0 +1,97 @@ +class ShippingOption { + String shippingRateComputationMethodSystemName; + double rate; + double rateVat; + double rateVatPercent; + String name; + String namen; + String description; + String descriptionn; + bool allowShippingSunday; + bool allowShippingMonday; + bool allowShippingTuesday; + bool allowShippingWednesday; + bool allowShippingThursday; + bool allowShippingFriday; + bool allowShippingSaturday; + String allowShippingTime1From; + String allowShippingTime1To; + String allowShippingTime2From; + String allowShippingTime2To; + String allowShippingNote; + String allowShippingNoten; + + ShippingOption( + {this.shippingRateComputationMethodSystemName, + this.rate, + this.rateVat, + this.rateVatPercent, + this.name, + this.namen, + this.description, + this.descriptionn, + this.allowShippingSunday, + this.allowShippingMonday, + this.allowShippingTuesday, + this.allowShippingWednesday, + this.allowShippingThursday, + this.allowShippingFriday, + this.allowShippingSaturday, + this.allowShippingTime1From, + this.allowShippingTime1To, + this.allowShippingTime2From, + this.allowShippingTime2To, + this.allowShippingNote, + this.allowShippingNoten}); + + ShippingOption.fromJson(Map json) { + shippingRateComputationMethodSystemName = json['shipping_rate_computation_method_system_name']; + rate = json['rate']; + rateVat = json['rate_vat']; + rateVatPercent = json['rate_vat_percent']; + name = json['name']; + namen = json['namen']; + description = json['description']; + descriptionn = json['descriptionn']; + allowShippingSunday = json['AllowShippingSunday']; + allowShippingMonday = json['AllowShippingMonday']; + allowShippingTuesday = json['AllowShippingTuesday']; + allowShippingWednesday = json['AllowShippingWednesday']; + allowShippingThursday = json['AllowShippingThursday']; + allowShippingFriday = json['AllowShippingFriday']; + allowShippingSaturday = json['AllowShippingSaturday']; + allowShippingTime1From = json['AllowShippingTime1From']; + allowShippingTime1To = json['AllowShippingTime1To']; + allowShippingTime2From = json['AllowShippingTime2From']; + allowShippingTime2To = json['AllowShippingTime2To']; + allowShippingNote = json['AllowShippingNote']; + allowShippingNoten = json['AllowShippingNoten']; + } + + Map toJson() { + final Map data = new Map(); + data['shipping_rate_computation_method_system_name'] = + this.shippingRateComputationMethodSystemName; + data['rate'] = this.rate; + data['rate_vat'] = this.rateVat; + data['rate_vat_percent'] = this.rateVatPercent; + data['name'] = this.name; + data['namen'] = this.namen; + data['description'] = this.description; + data['descriptionn'] = this.descriptionn; + data['AllowShippingSunday'] = this.allowShippingSunday; + data['AllowShippingMonday'] = this.allowShippingMonday; + data['AllowShippingTuesday'] = this.allowShippingTuesday; + data['AllowShippingWednesday'] = this.allowShippingWednesday; + data['AllowShippingThursday'] = this.allowShippingThursday; + data['AllowShippingFriday'] = this.allowShippingFriday; + data['AllowShippingSaturday'] = this.allowShippingSaturday; + data['AllowShippingTime1From'] = this.allowShippingTime1From; + data['AllowShippingTime1To'] = this.allowShippingTime1To; + data['AllowShippingTime2From'] = this.allowShippingTime2From; + data['AllowShippingTime2To'] = this.allowShippingTime2To; + data['AllowShippingNote'] = this.allowShippingNote; + data['AllowShippingNoten'] = this.allowShippingNoten; + return data; + } +} diff --git a/lib/core/model/pharmacies/ShoppingCart.dart b/lib/core/model/pharmacies/ShoppingCart.dart new file mode 100644 index 00000000..f965203a --- /dev/null +++ b/lib/core/model/pharmacies/ShoppingCart.dart @@ -0,0 +1,115 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Customer.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; + +class ShoppingCart { + int languageId; + String id; + // List productAttributes; + double customerEnteredPrice; + int quantity; + String discountAmountInclTax; + String subtotal; + String subtotalWithVat; + String subtotalVatAmount; + String subtotalVatRate; + String currency; + String currencyn; + String rentalStartDateUtc; + String rentalEndDateUtc; + String createdOnUtc; + String updatedOnUtc; + String shoppingCartType; + int productId; + PharmacyProduct product; + int customerId; + Customer customer; + + ShoppingCart( + {this.languageId, + this.id, + // this.productAttributes, + this.customerEnteredPrice, + this.quantity, + this.discountAmountInclTax, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.currency, + this.currencyn, + this.rentalStartDateUtc, + this.rentalEndDateUtc, + this.createdOnUtc, + this.updatedOnUtc, + this.shoppingCartType, + this.productId, + this.product, + this.customerId, + this.customer}); + + ShoppingCart.fromJson(Map json) { + languageId = json['language_id']; + id = json['id']; + /*if (json['product_attributes'] != null) { + productAttributes = new List(); + json['product_attributes'].forEach((v) { + productAttributes.add(new Null.fromJson(v)); + }); + }*/ + customerEnteredPrice = json['customer_entered_price']; + quantity = json['quantity']; + discountAmountInclTax = json['discount_amount_incl_tax']; + subtotal = json['subtotal']; + subtotalWithVat = json['subtotal_with_vat']; + subtotalVatAmount = json['subtotal_vat_amount']; + subtotalVatRate = json['subtotal_vat_rate']; + currency = json['currency']; + currencyn = json['currencyn']; + rentalStartDateUtc = json['rental_start_date_utc']; + rentalEndDateUtc = json['rental_end_date_utc']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + shoppingCartType = json['shopping_cart_type']; + productId = json['product_id']; + product = json['product'] != null + ? new PharmacyProduct.fromJson(json['product']) + : null; + customerId = json['customer_id']; + customer = json['customer'] != null + ? new Customer.fromJson(json['customer']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['id'] = this.id; + /*if (this.productAttributes != null) { + data['product_attributes'] = + this.productAttributes.map((v) => v.toJson()).toList(); + }*/ + data['customer_entered_price'] = this.customerEnteredPrice; + data['quantity'] = this.quantity; + data['discount_amount_incl_tax'] = this.discountAmountInclTax; + data['subtotal'] = this.subtotal; + data['subtotal_with_vat'] = this.subtotalWithVat; + data['subtotal_vat_amount'] = this.subtotalVatAmount; + data['subtotal_vat_rate'] = this.subtotalVatRate; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['rental_start_date_utc'] = this.rentalStartDateUtc; + data['rental_end_date_utc'] = this.rentalEndDateUtc; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['shopping_cart_type'] = this.shoppingCartType; + data['product_id'] = this.productId; + if (this.product != null) { + data['product'] = this.product.toJson(); + } + data['customer_id'] = this.customerId; + if (this.customer != null) { + data['customer'] = this.customer.toJson(); + } + return data; + } +} diff --git a/lib/core/model/pharmacies/ShoppingCartResponse.dart b/lib/core/model/pharmacies/ShoppingCartResponse.dart new file mode 100644 index 00000000..96b751ae --- /dev/null +++ b/lib/core/model/pharmacies/ShoppingCartResponse.dart @@ -0,0 +1,55 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:flutter/material.dart'; + +class ShoppingCartResponse with ChangeNotifier { + int itemCount; + int quantityCount; + double subtotal; + double subtotalWithVat; + double subtotalVatAmount; + double subtotalVatRate; + List shoppingCarts; + + ShoppingCartResponse( + {this.itemCount, + this.quantityCount, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.shoppingCarts}); + + void updateShoppingCard() { + notifyListeners(); + } + + ShoppingCartResponse.fromJson(Map json) { + itemCount = json['item_count']; + quantityCount = json['quantity_count']; + subtotal = json['subtotal']; + subtotalWithVat = json['subtotal_with_vat']; + subtotalVatAmount = json['subtotal_vat_amount']; + subtotalVatRate = json['subtotal_vat_rate']; + if (json['shopping_carts'] != null) { + shoppingCarts = new List(); + json['shopping_carts'].forEach((v) { + shoppingCarts.add(new ShoppingCart.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['item_count'] = this.itemCount; + data['quantity_count'] = this.quantityCount; + data['subtotal'] = this.subtotal; + data['subtotal_with_vat'] = this.subtotalWithVat; + data['subtotal_vat_amount'] = this.subtotalVatAmount; + data['subtotal_vat_rate'] = this.subtotalVatRate; + if (this.shoppingCarts != null) { + data['shopping_carts'] = + this.shoppingCarts.map((v) => v.toJson()).toList(); + } + return data; + } +} diff --git a/lib/core/model/pharmacies/Specifications.dart b/lib/core/model/pharmacies/Specifications.dart new file mode 100644 index 00000000..f227de69 --- /dev/null +++ b/lib/core/model/pharmacies/Specifications.dart @@ -0,0 +1,36 @@ +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacies/order_model.dart b/lib/core/model/pharmacies/order_model.dart new file mode 100644 index 00000000..027d1f81 --- /dev/null +++ b/lib/core/model/pharmacies/order_model.dart @@ -0,0 +1,1456 @@ + +import 'dart:convert'; + +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; + +List orderModelFromJson(String str) => List.from(json.decode(str).map((x) => OrderModel.fromJson(x))); + +String orderModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class OrderModel { + OrderModel({ + this.id, + this.storeId, + this.orderGuid, + this.pickUpInStore, + this.paymentMethodSystemName, + this.paymentName, + this.paymentNamen, + this.customerCurrencyCode, + this.currencyRate, + this.customerTaxDisplayTypeId, + this.vatNumber, + this.orderSubtotalInclTax, + this.orderSubtotalExclTax, + this.orderSubTotalDiscountInclTax, + this.orderSubTotalDiscountExclTax, + this.orderShippingInclTax, + this.orderShippingExclTax, + this.paymentMethodAdditionalFeeInclTax, + this.paymentMethodAdditionalFeeExclTax, + this.taxRates, + this.orderTax, + this.orderDiscount, + this.orderTotal, + this.refundedAmount, + this.rewardPointsWereAdded, + this.rxAttachments, + this.checkoutAttributeDescription, + this.customerLanguageId, + this.affiliateId, + this.customerIp, + this.authorizationTransactionId, + this.authorizationTransactionCode, + this.authorizationTransactionResult, + this.captureTransactionId, + this.captureTransactionResult, + this.subscriptionTransactionId, + this.paidDateUtc, + this.shippingMethod, + this.shippingRateComputationMethodSystemName, + this.customValuesXml, + this.deleted, + this.createdOnUtc, + this.customer, + this.customerId, + this.billingAddress, + this.shippingAddress, + this.orderItems, + this.orderStatusId, + this.orderStatus, + this.orderStatusn, + this.paymentStatusId, + this.paymentStatus, + this.paymentStatusn, + this.shippingStatus, + this.shippingStatusn, + this.customerTaxDisplayType, + this.canCancel, + this.canRefund, + this.lakumAmount, + this.preferDeliveryDate, + this.preferDeliveryTime, + this.preferDeliveryTimen, + }); + + String id; + dynamic storeId; + String orderGuid; + bool pickUpInStore; + PaymentMethodSystemName paymentMethodSystemName; + PaymentName paymentName; + PaymentName paymentNamen; + CustomerCurrencyCode customerCurrencyCode; + dynamic currencyRate; + dynamic customerTaxDisplayTypeId; + dynamic vatNumber; + double orderSubtotalInclTax; + double orderSubtotalExclTax; + dynamic orderSubTotalDiscountInclTax; + dynamic orderSubTotalDiscountExclTax; + double orderShippingInclTax; + dynamic orderShippingExclTax; + dynamic paymentMethodAdditionalFeeInclTax; + dynamic paymentMethodAdditionalFeeExclTax; + String taxRates; + double orderTax; + dynamic orderDiscount; + double orderTotal; + dynamic refundedAmount; + dynamic rewardPointsWereAdded; + String rxAttachments; + CheckoutAttributeDescription checkoutAttributeDescription; + dynamic customerLanguageId; + dynamic affiliateId; + CustomerIp customerIp; + String authorizationTransactionId; + dynamic authorizationTransactionCode; + dynamic authorizationTransactionResult; + dynamic captureTransactionId; + dynamic captureTransactionResult; + dynamic subscriptionTransactionId; + DateTime paidDateUtc; + ShippingMethod shippingMethod; + ShippingRateComputationMethodSystemName shippingRateComputationMethodSystemName; + String customValuesXml; + bool deleted; + DateTime createdOnUtc; + OrderModelCustomer customer; + dynamic customerId; + IngAddress billingAddress; + IngAddress shippingAddress; + List orderItems; + dynamic orderStatusId; + OrderStatus orderStatus; + OrderStatusn orderStatusn; + dynamic paymentStatusId; + PaymentStatus paymentStatus; + PaymentStatusn paymentStatusn; + ShippingStatus shippingStatus; + ShippingStatusn shippingStatusn; + CustomerTaxDisplayType customerTaxDisplayType; + bool canCancel; + bool canRefund; + dynamic lakumAmount; + DateTime preferDeliveryDate; + PreferDeliveryTime preferDeliveryTime; + PreferDeliveryTimen preferDeliveryTimen; + + factory OrderModel.fromJson(Map json) => OrderModel( + id: json["id"], + storeId: json["store_id"], + orderGuid: json["order_guid"], + pickUpInStore: json["pick_up_in_store"], + paymentMethodSystemName: paymentMethodSystemNameValues.map[json["payment_method_system_name"]], + paymentName: paymentNameValues.map[json["payment_name"]], + paymentNamen: paymentNameValues.map[json["payment_namen"]], + customerCurrencyCode: customerCurrencyCodeValues.map[json["customer_currency_code"]], + currencyRate: json["currency_rate"], + customerTaxDisplayTypeId: json["customer_tax_display_type_id"], + vatNumber: json["vat_number"], + orderSubtotalInclTax: json["order_subtotal_incl_tax"].toDouble(), + orderSubtotalExclTax: json["order_subtotal_excl_tax"].toDouble(), + orderSubTotalDiscountInclTax: json["order_sub_total_discount_incl_tax"], + orderSubTotalDiscountExclTax: json["order_sub_total_discount_excl_tax"], + orderShippingInclTax: json["order_shipping_incl_tax"].toDouble(), + orderShippingExclTax: json["order_shipping_excl_tax"], + paymentMethodAdditionalFeeInclTax: json["payment_method_additional_fee_incl_tax"], + paymentMethodAdditionalFeeExclTax: json["payment_method_additional_fee_excl_tax"], + taxRates: json["tax_rates"], + orderTax: json["order_tax"].toDouble(), + orderDiscount: json["order_discount"], + orderTotal: json["order_total"].toDouble(), + refundedAmount: json["refunded_amount"], + rewardPointsWereAdded: json["reward_points_were_added"], + rxAttachments: json["rx_attachments"] == null ? null : json["rx_attachments"], + checkoutAttributeDescription: checkoutAttributeDescriptionValues.map[json["checkout_attribute_description"]], + customerLanguageId: json["customer_language_id"], + affiliateId: json["affiliate_id"], + customerIp: customerIpValues.map[json["customer_ip"]], + authorizationTransactionId: json["authorization_transaction_id"] == null ? null : json["authorization_transaction_id"], + authorizationTransactionCode: json["authorization_transaction_code"], + authorizationTransactionResult: json["authorization_transaction_result"], + captureTransactionId: json["capture_transaction_id"], + captureTransactionResult: json["capture_transaction_result"], + subscriptionTransactionId: json["subscription_transaction_id"], + paidDateUtc: json["paid_date_utc"] == null ? null : DateTime.parse(json["paid_date_utc"]), + shippingMethod: shippingMethodValues.map[json["shipping_method"]], + shippingRateComputationMethodSystemName: shippingRateComputationMethodSystemNameValues.map[json["shipping_rate_computation_method_system_name"]], + customValuesXml: json["custom_values_xml"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: OrderModelCustomer.fromJson(json["customer"]), + customerId: json["customer_id"], + billingAddress: IngAddress.fromJson(json["billing_address"]), + shippingAddress: IngAddress.fromJson(json["shipping_address"]), + orderItems: List.from(json["order_items"].map((x) => OrderItem.fromJson(x))), + orderStatusId: json["order_status_id"], + orderStatus: orderStatusValues.map[json["order_status"]], + orderStatusn: orderStatusnValues.map[json["order_statusn"]], + paymentStatusId: json["payment_status_id"], + paymentStatus: paymentStatusValues.map[json["payment_status"]], + paymentStatusn: paymentStatusnValues.map[json["payment_statusn"]], + shippingStatus: shippingStatusValues.map[json["shipping_status"]], + shippingStatusn: shippingStatusnValues.map[json["shipping_statusn"]], + customerTaxDisplayType: customerTaxDisplayTypeValues.map[json["customer_tax_display_type"]], + canCancel: json["can_cancel"], + canRefund: json["can_refund"], + lakumAmount: json["lakum_amount"], + preferDeliveryDate: json["prefer_delivery_date"] == null ? null : DateTime.parse(json["prefer_delivery_date"]), + preferDeliveryTime: json["prefer_delivery_time"] == null ? null : preferDeliveryTimeValues.map[json["prefer_delivery_time"]], + preferDeliveryTimen: json["prefer_delivery_timen"] == null ? null : preferDeliveryTimenValues.map[json["prefer_delivery_timen"]], + ); + + Map toJson() => { + "id": id, + "store_id": storeId, + "order_guid": orderGuid, + "pick_up_in_store": pickUpInStore, + "payment_method_system_name": paymentMethodSystemNameValues.reverse[paymentMethodSystemName], + "payment_name": paymentNameValues.reverse[paymentName], + "payment_namen": paymentNameValues.reverse[paymentNamen], + "customer_currency_code": customerCurrencyCodeValues.reverse[customerCurrencyCode], + "currency_rate": currencyRate, + "customer_tax_display_type_id": customerTaxDisplayTypeId, + "vat_number": vatNumber, + "order_subtotal_incl_tax": orderSubtotalInclTax, + "order_subtotal_excl_tax": orderSubtotalExclTax, + "order_sub_total_discount_incl_tax": orderSubTotalDiscountInclTax, + "order_sub_total_discount_excl_tax": orderSubTotalDiscountExclTax, + "order_shipping_incl_tax": orderShippingInclTax, + "order_shipping_excl_tax": orderShippingExclTax, + "payment_method_additional_fee_incl_tax": paymentMethodAdditionalFeeInclTax, + "payment_method_additional_fee_excl_tax": paymentMethodAdditionalFeeExclTax, + "tax_rates": taxRates, + "order_tax": orderTax, + "order_discount": orderDiscount, + "order_total": orderTotal, + "refunded_amount": refundedAmount, + "reward_points_were_added": rewardPointsWereAdded, + "rx_attachments": rxAttachments == null ? null : rxAttachments, + "checkout_attribute_description": checkoutAttributeDescriptionValues.reverse[checkoutAttributeDescription], + "customer_language_id": customerLanguageId, + "affiliate_id": affiliateId, + "customer_ip": customerIpValues.reverse[customerIp], + "authorization_transaction_id": authorizationTransactionId == null ? null : authorizationTransactionId, + "authorization_transaction_code": authorizationTransactionCode, + "authorization_transaction_result": authorizationTransactionResult, + "capture_transaction_id": captureTransactionId, + "capture_transaction_result": captureTransactionResult, + "subscription_transaction_id": subscriptionTransactionId, + "paid_date_utc": paidDateUtc == null ? null : paidDateUtc.toIso8601String(), + "shipping_method": shippingMethodValues.reverse[shippingMethod], + "shipping_rate_computation_method_system_name": shippingRateComputationMethodSystemNameValues.reverse[shippingRateComputationMethodSystemName], + "custom_values_xml": customValuesXml, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "customer_id": customerId, + "billing_address": billingAddress.toJson(), + "shipping_address": shippingAddress.toJson(), + "order_items": List.from(orderItems.map((x) => x.toJson())), + "order_status_id": orderStatusId, + "order_status": orderStatusValues.reverse[orderStatus], + "order_statusn": orderStatusnValues.reverse[orderStatusn], + "payment_status_id": paymentStatusId, + "payment_status": paymentStatusValues.reverse[paymentStatus], + "payment_statusn": paymentStatusnValues.reverse[paymentStatusn], + "shipping_status": shippingStatusValues.reverse[shippingStatus], + "shipping_statusn": shippingStatusnValues.reverse[shippingStatusn], + "customer_tax_display_type": customerTaxDisplayTypeValues.reverse[customerTaxDisplayType], + "can_cancel": canCancel, + "can_refund": canRefund, + "lakum_amount": lakumAmount, + "prefer_delivery_date": preferDeliveryDate == null ? null : "${preferDeliveryDate.year.toString().padLeft(4, '0')}-${preferDeliveryDate.month.toString().padLeft(2, '0')}-${preferDeliveryDate.day.toString().padLeft(2, '0')}", + "prefer_delivery_time": preferDeliveryTime == null ? null : preferDeliveryTimeValues.reverse[preferDeliveryTime], + "prefer_delivery_timen": preferDeliveryTimen == null ? null : preferDeliveryTimenValues.reverse[preferDeliveryTimen], + }; +} + +class IngAddress { + IngAddress({ + 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, + }); + + String id; + FirstName firstName; + LastName lastName; + BillingAddressEmail email; + dynamic company; + dynamic countryId; + Country country; + dynamic stateProvinceId; + City city; + Address1 address1; + Address2 address2; + String zipPostalCode; + String phoneNumber; + dynamic faxNumber; + String customerAttributes; + DateTime createdOnUtc; + dynamic province; + LatLong latLong; + + factory IngAddress.fromJson(Map json) => IngAddress( + id: json["id"], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[json["last_name"]], + email: billingAddressEmailValues.map[json["email"]], + company: json["company"], + countryId: json["country_id"], + country: countryValues.map[json["country"]], + stateProvinceId: json["state_province_id"], + city: cityValues.map[json["city"]], + address1: address1Values.map[json["address1"]], + address2: address2Values.map[json["address2"]], + zipPostalCode: json["zip_postal_code"], + phoneNumber: json["phone_number"], + faxNumber: json["fax_number"], + customerAttributes: json["customer_attributes"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + province: json["province"], + latLong: latLongValues.map[json["lat_long"]], + ); + + Map toJson() => { + "id": id, + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[lastName], + "email": billingAddressEmailValues.reverse[email], + "company": company, + "country_id": countryId, + "country": countryValues.reverse[country], + "state_province_id": stateProvinceId, + "city": cityValues.reverse[city], + "address1": address1Values.reverse[address1], + "address2": address2Values.reverse[address2], + "zip_postal_code": zipPostalCode, + "phone_number": phoneNumber, + "fax_number": faxNumber, + "customer_attributes": customerAttributes, + "created_on_utc": createdOnUtc.toIso8601String(), + "province": province, + "lat_long": latLongValues.reverse[latLong], + }; +} + +enum Address1 { THE_7960_MOSAB_IBN_UMAIR_STREET_AL_RIYADH, THE_6500_AL_AMEEN_ABDULLAH_AL_ALI_AL_NAEEM_STREET_AL_RIYADH, THE_6603_IBRAHIM_IBN_AL_HAMASI_AR_RIYAD, THE_9626_SALAH_AD_DIN_AL_AYYUBI_ROAD_AL_RIYADH, THE_3075_PRINCE_MANSUR_BIN_ABDULAZIZ_STREET_AL_RIYADH, THE_40, THE_7801_AL_IHSA_AL_RIYADH } + +final address1Values = EnumValues({ + "3075, Prince Mansur Bin Abdulaziz Street, Al Riyadh, ": Address1.THE_3075_PRINCE_MANSUR_BIN_ABDULAZIZ_STREET_AL_RIYADH, + "40,": Address1.THE_40, + "6500, Al Ameen Abdullah Al Ali Al Naeem Street, Al Riyadh, ": Address1.THE_6500_AL_AMEEN_ABDULLAH_AL_ALI_AL_NAEEM_STREET_AL_RIYADH, + "6603, Ibrahim Ibn Al Hamasi, Ar-Riyad, ": Address1.THE_6603_IBRAHIM_IBN_AL_HAMASI_AR_RIYAD, + "7801, Al Ihsa, Al Riyadh, ": Address1.THE_7801_AL_IHSA_AL_RIYADH, + "7960, Mosab Ibn Umair Street, Al Riyadh, ": Address1.THE_7960_MOSAB_IBN_UMAIR_STREET_AL_RIYADH, + "9626, Salah Ad Din Al Ayyubi Road, Al Riyadh, ": Address1.THE_9626_SALAH_AD_DIN_AL_AYYUBI_ROAD_AL_RIYADH +}); + +enum Address2 { AL_MALAZ_RIYADH_PROVINCE_3460, AL_MALAZ_RIYADH_PROVINCE_2817, AR_RAHMANIYYAH_RIYADH_PROVINCE_3816, AL_MALAZ_RIYADH_PROVINCE_3815, AL_WIZARAT_RIYADH_PROVINCE_7039, EASTERN_PROVINCE, AL_MALAZ_RIYADH_PROVINCE_3084 } + +final address2Values = EnumValues({ + "Al Malaz, Riyadh Province, 2817, ": Address2.AL_MALAZ_RIYADH_PROVINCE_2817, + "Al Malaz, Riyadh Province, 3084, ": Address2.AL_MALAZ_RIYADH_PROVINCE_3084, + "Al Malaz, Riyadh Province, 3460, ": Address2.AL_MALAZ_RIYADH_PROVINCE_3460, + "Al Malaz, Riyadh Province, 3815, ": Address2.AL_MALAZ_RIYADH_PROVINCE_3815, + "Al Wizarat, Riyadh Province, 7039, ": Address2.AL_WIZARAT_RIYADH_PROVINCE_7039, + "Ar Rahmaniyyah, Riyadh Province, 3816, ": Address2.AR_RAHMANIYYAH_RIYADH_PROVINCE_3816, + "Eastern Province,": Address2.EASTERN_PROVINCE +}); + +enum City { RIYADH, DAMMAM } + +final cityValues = EnumValues({ + "Dammam": City.DAMMAM, + "Riyadh": City.RIYADH +}); + +enum Country { SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA +}); + +enum BillingAddressEmail { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM, TAMER_FANASHEH_DRSULAIMANALHABIB_COM } + +final billingAddressEmailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": BillingAddressEmail.TAMER_DASDASDAS_GMAIL_COM, + "tamer.fanasheh@drsulaimanalhabib.com": BillingAddressEmail.TAMER_FANASHEH_DRSULAIMANALHABIB_COM, + "Tamer.fanasheh@gmail.com": BillingAddressEmail.TAMER_FANASHEH_GMAIL_COM +}); + +enum FirstName { TAMER, TAMER_FANASHEH, FIRST_NAME_TAMER } + +final firstNameValues = EnumValues({ + "tamer": FirstName.FIRST_NAME_TAMER, + "TAMER": FirstName.TAMER, + "TAMER FANASHEH": FirstName.TAMER_FANASHEH +}); + +enum LastName { FANASHEH, MUSA, LAST_NAME_FANASHEH } + +final lastNameValues = EnumValues({ + "FANASHEH": LastName.FANASHEH, + "Fanasheh": LastName.LAST_NAME_FANASHEH, + "MUSA": LastName.MUSA +}); + +enum LatLong { THE_246784385694919524674091019299842, THE_24664749106968054673501121876645, THE_2470993657522702246664724647270134, THE_246626170308533764673348444086107, THE_24664875225999005467347443322574, THE_24674331807435784671024726818286, THE_263430228396836664991113909164471, THE_246767400793488074673774399406786, THE_24665374673515 } + +final latLongValues = EnumValues({ + "24.662617030853376,46.73348444086107": LatLong.THE_246626170308533764673348444086107, + "24.66474910696805,46.73501121876645": LatLong.THE_24664749106968054673501121876645, + "24.664875225999005,46.7347443322574": LatLong.THE_24664875225999005467347443322574, + "24.66537,46.73515": LatLong.THE_24665374673515, + "24.67433180743578,46.71024726818286": LatLong.THE_24674331807435784671024726818286, + "24.676740079348807,46.73774399406786": LatLong.THE_246767400793488074673774399406786, + "24.678438569491952,46.74091019299842": LatLong.THE_246784385694919524674091019299842, + "24.709936575227022,46.664724647270134": LatLong.THE_2470993657522702246664724647270134, + "26.343022839683666, 49.91113909164471": LatLong.THE_263430228396836664991113909164471 +}); + +enum CheckoutAttributeDescription { EMPTY, CHECKOUT_ATTRIBUTE_DESCRIPTION } + +final checkoutAttributeDescriptionValues = EnumValues({ + "ارفاق وصفة: ": CheckoutAttributeDescription.CHECKOUT_ATTRIBUTE_DESCRIPTION, + "": CheckoutAttributeDescription.EMPTY +}); + +class OrderModelCustomer { + OrderModelCustomer({ + 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, + this.roleIds, + }); + + String id; + Username username; + BillingAddressEmail email; + FirstName firstName; + LastName lastName; + String languageId; + dynamic adminComment; + bool isTaxExempt; + bool hasShoppingCartItems; + bool active; + bool deleted; + bool isSystemAccount; + dynamic systemName; + LastIpAddress lastIpAddress; + DateTime createdOnUtc; + DateTime lastLoginDateUtc; + DateTime lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory OrderModelCustomer.fromJson(Map json) => OrderModelCustomer( + id: json["id"], + username: usernameValues.map[json["username"]], + email: billingAddressEmailValues.map[json["email"]], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[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: lastIpAddressValues.map[json["last_ip_address"]], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + lastLoginDateUtc: DateTime.parse(json["last_login_date_utc"]), + lastActivityDateUtc: DateTime.parse(json["last_activity_date_utc"]), + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "id": id, + "username": usernameValues.reverse[username], + "email": billingAddressEmailValues.reverse[email], + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[lastName], + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddressValues.reverse[lastIpAddress], + "created_on_utc": createdOnUtc.toIso8601String(), + "last_login_date_utc": lastLoginDateUtc.toIso8601String(), + "last_activity_date_utc": lastActivityDateUtc.toIso8601String(), + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +enum LastIpAddress { THE_1050220126 } + +final lastIpAddressValues = EnumValues({ + "10.50.220.126": LastIpAddress.THE_1050220126 +}); + +enum Username { TAMERF } + +final usernameValues = EnumValues({ + "tamerf": Username.TAMERF +}); + +enum CustomerCurrencyCode { SAR } + +final customerCurrencyCodeValues = EnumValues({ + "SAR": CustomerCurrencyCode.SAR +}); + +enum CustomerIp { THE_105010210, THE_127001, THE_1020200101, THE_102020041, THE_10501028, THE_102020033, THE_1020200170, THE_102020011 } + +final customerIpValues = EnumValues({ + "10.20.200.101": CustomerIp.THE_1020200101, + "10.20.200.11": CustomerIp.THE_102020011, + "10.20.200.170": CustomerIp.THE_1020200170, + "10.20.200.33": CustomerIp.THE_102020033, + "10.20.200.41": CustomerIp.THE_102020041, + "10.50.102.10": CustomerIp.THE_105010210, + "10.50.102.8": CustomerIp.THE_10501028, + "127.0.0.1": CustomerIp.THE_127001 +}); + +enum CustomerTaxDisplayType { EXCLUDING_TAX } + +final customerTaxDisplayTypeValues = EnumValues({ + "ExcludingTax": CustomerTaxDisplayType.EXCLUDING_TAX +}); + +class OrderItem { + OrderItem({ + this.quantity, + this.unitPriceInclTax, + this.unitPriceExclTax, + this.priceInclTax, + this.priceExclTax, + this.discountAmountInclTax, + this.discountAmountExclTax, + this.originalProductCost, + this.attributeDescription, + this.downloadCount, + this.isDownloadActivated, + this.licenseDownloadId, + this.itemWeight, + this.rentalStartDateUtc, + this.rentalEndDateUtc, + this.product, + this.productId, + }); + + dynamic quantity; + double unitPriceInclTax; + double unitPriceExclTax; + double priceInclTax; + double priceExclTax; + double discountAmountInclTax; + double discountAmountExclTax; + double originalProductCost; + String attributeDescription; + dynamic downloadCount; + bool isDownloadActivated; + dynamic licenseDownloadId; + double itemWeight; + dynamic rentalStartDateUtc; + dynamic rentalEndDateUtc; + Product product; + dynamic productId; + + factory OrderItem.fromJson(Map json) => OrderItem( + quantity: json["quantity"], + unitPriceInclTax: json["unit_price_incl_tax"].toDouble(), + unitPriceExclTax: json["unit_price_excl_tax"].toDouble(), + priceInclTax: json["price_incl_tax"].toDouble(), + priceExclTax: json["price_excl_tax"].toDouble(), + discountAmountInclTax: json["discount_amount_incl_tax"].toDouble(), + discountAmountExclTax: json["discount_amount_excl_tax"].toDouble(), + originalProductCost: json["original_product_cost"].toDouble(), + attributeDescription: json["attribute_description"], + downloadCount: json["download_count"], + isDownloadActivated: json["isDownload_activated"], + licenseDownloadId: json["license_download_id"], + itemWeight: json["item_weight"].toDouble(), + rentalStartDateUtc: json["rental_start_date_utc"], + rentalEndDateUtc: json["rental_end_date_utc"], + product: Product.fromJson(json["product"]), + productId: json["product_id"], + ); + + Map toJson() => { + "quantity": quantity, + "unit_price_incl_tax": unitPriceInclTax, + "unit_price_excl_tax": unitPriceExclTax, + "price_incl_tax": priceInclTax, + "price_excl_tax": priceExclTax, + "discount_amount_incl_tax": discountAmountInclTax, + "discount_amount_excl_tax": discountAmountExclTax, + "original_product_cost": originalProductCost, + "attribute_description": attributeDescription, + "download_count": downloadCount, + "isDownload_activated": isDownloadActivated, + "license_download_id": licenseDownloadId, + "item_weight": itemWeight, + "rental_start_date_utc": rentalStartDateUtc, + "rental_end_date_utc": rentalEndDateUtc, + "product": product.toJson(), + "product_id": productId, + }; +} + +class Product { + Product({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName, + }); + + String id; + bool visibleIndividually; + String name; + String namen; + dynamic localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + String metaKeywords; + String metaDescription; + String metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + dynamic stockAvailability; + dynamic stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + dynamic oldPrice; + double productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + dynamic currency; + dynamic currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + ProductType productType; + dynamic parentGroupedProductId; + dynamic roleIds; + dynamic discountIds; + dynamic storeIds; + dynamic manufacturerIds; + List reviews; + List images; + dynamic attributes; + dynamic specifications; + dynamic associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + factory Product.fromJson(Map json) => Product( + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: json["localized_names"], + shortDescription: json["short_description"] == null ? null : json["short_description"], + shortDescriptionn: json["short_descriptionn"] == null ? null : json["short_descriptionn"], + fullDescription: json["full_description"], + fullDescriptionn: json["full_descriptionn"], + markasNew: json["markas_new"], + showOnHomePage: json["show_on_home_page"], + metaKeywords: json["meta_keywords"] == null ? null : json["meta_keywords"], + metaDescription: json["meta_description"] == null ? null : json["meta_description"], + metaTitle: json["meta_title"] == null ? null : json["meta_title"], + allowCustomerReviews: json["allow_customer_reviews"], + approvedRatingSum: json["approved_rating_sum"], + notApprovedRatingSum: json["not_approved_rating_sum"], + approvedTotalReviews: json["approved_total_reviews"], + notApprovedTotalReviews: json["not_approved_total_reviews"], + sku: json["sku"], + isRx: json["is_rx"], + prescriptionRequired: json["prescription_required"], + rxMessage: json["rx_message"], + rxMessagen: json["rx_messagen"], + manufacturerPartNumber: json["manufacturer_part_number"], + gtin: json["gtin"], + isGiftCard: json["is_gift_card"], + requireOtherProducts: json["require_other_products"], + automaticallyAddRequiredProducts: json["automatically_add_required_products"], + isDownload: json["is_download"], + unlimitedDownloads: json["unlimited_downloads"], + maxNumberOfDownloads: json["max_number_of_downloads"], + downloadExpirationDays: json["download_expiration_days"], + hasSampleDownload: json["has_sample_download"], + hasUserAgreement: json["has_user_agreement"], + isRecurring: json["is_recurring"], + recurringCycleLength: json["recurring_cycle_length"], + recurringTotalCycles: json["recurring_total_cycles"], + isRental: json["is_rental"], + rentalPriceLength: json["rental_price_length"], + isShipEnabled: json["is_ship_enabled"], + isFreeShipping: json["is_free_shipping"], + shipSeparately: json["ship_separately"], + additionalShippingCharge: json["additional_shipping_charge"], + isTaxExempt: json["is_tax_exempt"], + isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], + useMultipleWarehouses: json["use_multiple_warehouses"], + manageInventoryMethodId: json["manage_inventory_method_id"], + stockQuantity: json["stock_quantity"], + stockAvailability: json["stock_availability"], + stockAvailabilityn: json["stock_availabilityn"], + displayStockAvailability: json["display_stock_availability"], + displayStockQuantity: json["display_stock_quantity"], + minStockQuantity: json["min_stock_quantity"], + notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], + allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], + orderMinimumQuantity: json["order_minimum_quantity"], + orderMaximumQuantity: json["order_maximum_quantity"], + allowedQuantities: json["allowed_quantities"], + allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], + disableBuyButton: json["disable_buy_button"], + disableWishlistButton: json["disable_wishlist_button"], + availableForPreOrder: json["available_for_pre_order"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], + callForPrice: json["call_for_price"], + price: json["price"].toDouble(), + oldPrice: json["old_price"], + productCost: json["product_cost"].toDouble(), + specialPrice: json["special_price"], + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + customerEntersPrice: json["customer_enters_price"], + minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], + maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], + basepriceEnabled: json["baseprice_enabled"], + basepriceAmount: json["baseprice_amount"], + basepriceBaseAmount: json["baseprice_base_amount"], + hasTierPrices: json["has_tier_prices"], + hasDiscountsApplied: json["has_discounts_applied"], + discountName: json["discount_name"], + discountNamen: json["discount_namen"], + discountDescription: json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"], + currency: json["currency"], + currencyn: json["currencyn"], + weight: json["weight"].toDouble(), + length: json["length"], + width: json["width"], + height: json["height"], + availableStartDateTimeUtc: json["available_start_date_time_utc"], + availableEndDateTimeUtc: json["available_end_date_time_utc"], + displayOrder: json["display_order"], + published: json["published"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + productType: productTypeValues.map[json["product_type"]], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: json["role_ids"], + discountIds: json["discount_ids"], + storeIds: json["store_ids"], + manufacturerIds: json["manufacturer_ids"], + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + images: List.from(json["images"].map((x) => PharmacyImageObject.fromJson(x))), + attributes: json["attributes"], + specifications: json["specifications"], + associatedProductIds: json["associated_product_ids"], + tags: List.from(json["tags"].map((x) => x)), + vendorId: json["vendor_id"], + seName: json["se_name"], + ); + + Map toJson() => { + "id": id, + "visible_individually": visibleIndividually, + "name": name, + "namen": namen, + "localized_names": localizedNames, + "short_description": shortDescription == null ? null : shortDescription, + "short_descriptionn": shortDescriptionn == null ? null : shortDescriptionn, + "full_description": fullDescription, + "full_descriptionn": fullDescriptionn, + "markas_new": markasNew, + "show_on_home_page": showOnHomePage, + "meta_keywords": metaKeywords == null ? null : metaKeywords, + "meta_description": metaDescription == null ? null : metaDescription, + "meta_title": metaTitle == null ? null : metaTitle, + "allow_customer_reviews": allowCustomerReviews, + "approved_rating_sum": approvedRatingSum, + "not_approved_rating_sum": notApprovedRatingSum, + "approved_total_reviews": approvedTotalReviews, + "not_approved_total_reviews": notApprovedTotalReviews, + "sku": sku, + "is_rx": isRx, + "prescription_required": prescriptionRequired, + "rx_message": rxMessage, + "rx_messagen": rxMessagen, + "manufacturer_part_number": manufacturerPartNumber, + "gtin": gtin, + "is_gift_card": isGiftCard, + "require_other_products": requireOtherProducts, + "automatically_add_required_products": automaticallyAddRequiredProducts, + "is_download": isDownload, + "unlimited_downloads": unlimitedDownloads, + "max_number_of_downloads": maxNumberOfDownloads, + "download_expiration_days": downloadExpirationDays, + "has_sample_download": hasSampleDownload, + "has_user_agreement": hasUserAgreement, + "is_recurring": isRecurring, + "recurring_cycle_length": recurringCycleLength, + "recurring_total_cycles": recurringTotalCycles, + "is_rental": isRental, + "rental_price_length": rentalPriceLength, + "is_ship_enabled": isShipEnabled, + "is_free_shipping": isFreeShipping, + "ship_separately": shipSeparately, + "additional_shipping_charge": additionalShippingCharge, + "is_tax_exempt": isTaxExempt, + "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, + "use_multiple_warehouses": useMultipleWarehouses, + "manage_inventory_method_id": manageInventoryMethodId, + "stock_quantity": stockQuantity, + "stock_availability": stockAvailability, + "stock_availabilityn": stockAvailabilityn, + "display_stock_availability": displayStockAvailability, + "display_stock_quantity": displayStockQuantity, + "min_stock_quantity": minStockQuantity, + "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, + "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, + "order_minimum_quantity": orderMinimumQuantity, + "order_maximum_quantity": orderMaximumQuantity, + "allowed_quantities": allowedQuantities, + "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, + "disable_buy_button": disableBuyButton, + "disable_wishlist_button": disableWishlistButton, + "available_for_pre_order": availableForPreOrder, + "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, + "call_for_price": callForPrice, + "price": price, + "old_price": oldPrice, + "product_cost": productCost, + "special_price": specialPrice, + "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, + "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, + "customer_enters_price": customerEntersPrice, + "minimum_customer_entered_price": minimumCustomerEnteredPrice, + "maximum_customer_entered_price": maximumCustomerEnteredPrice, + "baseprice_enabled": basepriceEnabled, + "baseprice_amount": basepriceAmount, + "baseprice_base_amount": basepriceBaseAmount, + "has_tier_prices": hasTierPrices, + "has_discounts_applied": hasDiscountsApplied, + "discount_name": discountName, + "discount_namen": discountNamen, + "discount_description": discountDescription, + "discount_Descriptionn": discountDescriptionn, + "discount_percentage": discountPercentage, + "currency": currency, + "currencyn": currencyn, + "weight": weight, + "length": length, + "width": width, + "height": height, + "available_start_date_time_utc": availableStartDateTimeUtc, + "available_end_date_time_utc": availableEndDateTimeUtc, + "display_order": displayOrder, + "published": published, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "product_type": productTypeValues.reverse[productType], + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": roleIds, + "discount_ids": discountIds, + "store_ids": storeIds, + "manufacturer_ids": manufacturerIds, + "reviews": List.from(reviews.map((x) => x.toJson())), + "images": List.from(images.map((x) => x.toJson())), + "attributes": attributes, + "specifications": specifications, + "associated_product_ids": associatedProductIds, + "tags": List.from(tags.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; +} + +enum ProductType { SIMPLE_PRODUCT } + +final productTypeValues = EnumValues({ + "SimpleProduct": ProductType.SIMPLE_PRODUCT +}); + +class Review { + Review({ + 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, + }); + + dynamic id; + dynamic position; + dynamic reviewId; + dynamic customerId; + dynamic productId; + dynamic storeId; + bool isApproved; + Title title; + ReviewText reviewText; + dynamic replyText; + dynamic rating; + dynamic helpfulYesTotal; + dynamic helpfulNoTotal; + DateTime createdOnUtc; + ReviewCustomer customer; + dynamic product; + + factory Review.fromJson(Map json) => Review( + 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: titleValues.map[json["title"]], + reviewText: reviewTextValues.map[json["review_text"]], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: ReviewCustomer.fromJson(json["customer"]), + product: json["product"], + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": titleValues.reverse[title], + "review_text": reviewTextValues.reverse[reviewText], + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product, + }; +} + +class ReviewCustomer { + ReviewCustomer({ + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + this.billingAddress, + this.shippingAddress, + this.addresses, + 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, + this.roleIds, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + dynamic isOutSa; + dynamic patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + List addresses; + String id; + String username; + PurpleEmail email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory ReviewCustomer.fromJson(Map json) => ReviewCustomer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + addresses: List.from(json["addresses"].map((x) => x)), + id: json["id"], + username: json["username"], + email: purpleEmailValues.map[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"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "addresses": List.from(addresses.map((x) => x)), + "id": id, + "username": username, + "email": purpleEmailValues.reverse[email], + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +enum PurpleEmail { STEVE_GATES_NOP_COMMERCE_COM, TAMER_FANASHEH_DRSULAIMANALHABIB_COM, ASIF_RAZA_DRSULAIMANALHABIB_COM, ABOSAMI_YMAIL_COM } + +final purpleEmailValues = EnumValues({ + "abosami@ymail.com": PurpleEmail.ABOSAMI_YMAIL_COM, + "asif.raza@drsulaimanalhabib.com": PurpleEmail.ASIF_RAZA_DRSULAIMANALHABIB_COM, + "steve_gates@nopCommerce.com": PurpleEmail.STEVE_GATES_NOP_COMMERCE_COM, + "tamer.fanasheh@drsulaimanalhabib.com": PurpleEmail.TAMER_FANASHEH_DRSULAIMANALHABIB_COM +}); + +enum ReviewText { GOOD, NICE_PRICE, GREAT, REVIEW_TEXT_GOOD, GG, ENAD_TEST_REVIEW_001, ENAD, ENADDD, ENAD_TEST_0001, PURPLE_GOOD, EMPTY } + +final reviewTextValues = EnumValues({ + "افضل علاج للزكام": ReviewText.EMPTY, + "ENAD ": ReviewText.ENAD, + "enaddd": ReviewText.ENADDD, + "ENAD TEST 0001": ReviewText.ENAD_TEST_0001, + "Enad Test Review 001": ReviewText.ENAD_TEST_REVIEW_001, + "gg": ReviewText.GG, + "good ": ReviewText.GOOD, + "great": ReviewText.GREAT, + "nice price": ReviewText.NICE_PRICE, + "Good": ReviewText.PURPLE_GOOD, + "good": ReviewText.REVIEW_TEXT_GOOD +}); + +enum Title { EMPTY, GOOD, TITLE } + +final titleValues = EnumValues({ + "": Title.EMPTY, + "Good": Title.GOOD, + "ممتاز": Title.TITLE +}); + +enum OrderStatus { ORDER_SUBMITTED, PENDING, ORDER_IN_PROGRESS, ORDER_COMPLETED, CANCELLED, PROCESSING, ORDER_REFUNDED, COMPLETE } + +final orderStatusValues = EnumValues({ + "Cancelled": OrderStatus.CANCELLED, + "Complete": OrderStatus.COMPLETE, + "OrderCompleted": OrderStatus.ORDER_COMPLETED, + "OrderInProgress": OrderStatus.ORDER_IN_PROGRESS, + "OrderRefunded": OrderStatus.ORDER_REFUNDED, + "OrderSubmitted": OrderStatus.ORDER_SUBMITTED, + "Pending": OrderStatus.PENDING, + "Processing": OrderStatus.PROCESSING +}); + +enum OrderStatusn { ORDER_SUBMITTED, EMPTY, ORDER_IN_PROGRESS, ORDER_COMPLETED, ORDER_STATUSN, PURPLE, FLUFFY, TENTACLED } + +final orderStatusnValues = EnumValues({ + "معلقة": OrderStatusn.EMPTY, + "تم ارجاع مبلغ الطلبية المدفوع للعميل": OrderStatusn.FLUFFY, + "Order Completed": OrderStatusn.ORDER_COMPLETED, + "Order In Progress": OrderStatusn.ORDER_IN_PROGRESS, + "ملغي": OrderStatusn.ORDER_STATUSN, + "Order Submitted": OrderStatusn.ORDER_SUBMITTED, + "قيد التنفيذ": OrderStatusn.PURPLE, + "مكتمل": OrderStatusn.TENTACLED +}); + +enum PaymentMethodSystemName { PAYMENTS_PAY_FORT, PAYMENTS_CASH_ON_DELIVERY } + +final paymentMethodSystemNameValues = EnumValues({ + "Payments.CashOnDelivery": PaymentMethodSystemName.PAYMENTS_CASH_ON_DELIVERY, + "Payments.PayFort": PaymentMethodSystemName.PAYMENTS_PAY_FORT +}); + +enum PaymentName { CREDIT_DEBIT_CARD_PAYFORT, CASH_ON_DELIVERY_COD } + +final paymentNameValues = EnumValues({ + "Cash On Delivery (COD)": PaymentName.CASH_ON_DELIVERY_COD, + "Credit / Debit Card Payfort": PaymentName.CREDIT_DEBIT_CARD_PAYFORT +}); + +enum PaymentStatus { PAID, PENDING } + +final paymentStatusValues = EnumValues({ + "Paid": PaymentStatus.PAID, + "Pending": PaymentStatus.PENDING +}); + +enum PaymentStatusn { EMPTY, PAYMENT_STATUSN } + +final paymentStatusnValues = EnumValues({ + "تم الدفع": PaymentStatusn.EMPTY, + "قيد الإنتظار": PaymentStatusn.PAYMENT_STATUSN +}); + +enum PreferDeliveryTime { THE_1000_AM_330_PM, THE_530_PM_730_PM } + +final preferDeliveryTimeValues = EnumValues({ + "10:00 AM - 3:30 PM": PreferDeliveryTime.THE_1000_AM_330_PM, + "5:30 PM - 7:30 PM": PreferDeliveryTime.THE_530_PM_730_PM +}); + +enum PreferDeliveryTimen { THE_1000330, THE_530730 } + +final preferDeliveryTimenValues = EnumValues({ + "10:00 ص - 3:30 م": PreferDeliveryTimen.THE_1000330, + "5:30 م - 7:30 م": PreferDeliveryTimen.THE_530730 +}); + +enum ShippingMethod { EMPTY, FIXED_PRICE } + +final shippingMethodValues = EnumValues({ + "سعر ثابت ": ShippingMethod.EMPTY, + "Fixed Price": ShippingMethod.FIXED_PRICE +}); + +enum ShippingRateComputationMethodSystemName { SHIPPING_FIXED_OR_BY_WEIGHT } + +final shippingRateComputationMethodSystemNameValues = EnumValues({ + "Shipping.FixedOrByWeight": ShippingRateComputationMethodSystemName.SHIPPING_FIXED_OR_BY_WEIGHT +}); + +enum ShippingStatus { NOT_YET_SHIPPED } + +final shippingStatusValues = EnumValues({ + "NotYetShipped": ShippingStatus.NOT_YET_SHIPPED +}); + +enum ShippingStatusn { EMPTY } + +final shippingStatusnValues = EnumValues({ + "لم يتم شحنها بعد": ShippingStatusn.EMPTY +}); + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} + + + diff --git a/lib/core/model/pharmacies/payment-checkout-data.dart b/lib/core/model/pharmacies/payment-checkout-data.dart new file mode 100644 index 00000000..dd9e0e54 --- /dev/null +++ b/lib/core/model/pharmacies/payment-checkout-data.dart @@ -0,0 +1,21 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:flutter/material.dart'; + +import 'ShippingOption.dart'; + +class PaymentCheckoutData with ChangeNotifier{ + Addresses address; + PaymentOption paymentOption; + LacumAccountInformation lacumInformation; + bool cartDataVisible; + ShippingOption shippingOption; + int usedLakumPoints; + + PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0}); + + void updateData() { + notifyListeners(); + } +} diff --git a/lib/core/model/pharmacy/brands_model.dart b/lib/core/model/pharmacy/brands_model.dart new file mode 100644 index 00000000..03cd689e --- /dev/null +++ b/lib/core/model/pharmacy/brands_model.dart @@ -0,0 +1,24 @@ +class BrandsModel { + String id; + String name; + String namen; + Null image; + + BrandsModel({this.id, this.name, this.namen, this.image}); + + BrandsModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + image = json['image']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + data['image'] = this.image; + return data; + } +} diff --git a/lib/core/model/pharmacy/categorise_parent_model.dart b/lib/core/model/pharmacy/categorise_parent_model.dart new file mode 100644 index 00000000..82c5b55f --- /dev/null +++ b/lib/core/model/pharmacy/categorise_parent_model.dart @@ -0,0 +1,75 @@ +class CategoriseParentModel { + String id; + String name; + String namen; + List localizedNames; + dynamic description; + int parentCategoryId; + int displayOrder; + dynamic image; + bool isLeaf; + + CategoriseParentModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.parentCategoryId, + this.displayOrder, + this.image, + this.isLeaf}); + + CategoriseParentModel.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']; + parentCategoryId = json['parent_category_id']; + displayOrder = json['display_order']; + image = json['image']; + isLeaf = json['is_leaf']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['parent_category_id'] = this.parentCategoryId; + data['display_order'] = this.displayOrder; + data['image'] = this.image; + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} diff --git a/lib/core/model/pharmacy/final_products_model.dart b/lib/core/model/pharmacy/final_products_model.dart new file mode 100644 index 00000000..52ab1d2d --- /dev/null +++ b/lib/core/model/pharmacy/final_products_model.dart @@ -0,0 +1,184 @@ +class FinalProductsModel { + String id; + String name; + String namen; + List localizedNames; + String shortDescription; + String fullDescription; + String fullDescriptionn; + dynamic approvedRatingSum; + dynamic approvedTotalReviews; + String sku; + bool isRx; + dynamic rxMessage; + dynamic rxMessagen; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic price; + dynamic oldPrice; + dynamic discountName; + dynamic discountNamen; + dynamic discountPercentage; + dynamic displayOrder; + List discountIds; + List reviews; + List images; + + FinalProductsModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + 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}); + + FinalProductsModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + 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']; + } + + 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['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.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacy/offer_products_model.dart b/lib/core/model/pharmacy/offer_products_model.dart new file mode 100644 index 00000000..f41b731b --- /dev/null +++ b/lib/core/model/pharmacy/offer_products_model.dart @@ -0,0 +1,579 @@ +class OfferProductsModel { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + String discountName; + String discountNamen; + String discountDescription; + String discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + dynamic weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + OfferProductsModel( + {this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); + + OfferProductsModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + shortDescriptionn = json['short_descriptionn']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + markasNew = json['markas_new']; + showOnHomePage = json['show_on_home_page']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + + discountIds = json['discount_ids'].cast(); + + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v.toJson()).toList(); + } + data['discount_ids'] = this.discountIds; + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v.toJson()).toList(); + } + if (this.manufacturerIds != null) { + data['manufacturer_ids'] = + this.manufacturerIds.map((v) => v.toJson()).toList(); + } + if (this.reviews != null) { + data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); + } + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + if (this.attributes != null) { + data['attributes'] = this.attributes.map((v) => v.toJson()).toList(); + } + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + if (this.associatedProductIds != null) { + data['associated_product_ids'] = + this.associatedProductIds.map((v) => v.toJson()).toList(); + } + if (this.tags != null) { + data['tags'] = this.tags.map((v) => v.toJson()).toList(); + } + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacy/offers_model.dart b/lib/core/model/pharmacy/offers_model.dart new file mode 100644 index 00000000..3add1d3d --- /dev/null +++ b/lib/core/model/pharmacy/offers_model.dart @@ -0,0 +1,175 @@ +class OffersModel { + String id; + String name; + String namen; + List localizedNames; + Null description; + int categoryTemplateId; + String metaKeywords; + String metaDescription; + String metaTitle; + int parentCategoryId; + int pageSize; + String pageSizeOptions; + Null priceRanges; + bool showOnHomePage; + bool includeInTopMenu; + Null hasDiscountsApplied; + bool published; + bool deleted; + int displayOrder; + String createdOnUtc; + String updatedOnUtc; + List roleIds; + List discountIds; + List storeIds; + Image image; + String seName; + bool isLeaf; + + OffersModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.categoryTemplateId, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.parentCategoryId, + this.pageSize, + this.pageSizeOptions, + this.priceRanges, + this.showOnHomePage, + this.includeInTopMenu, + this.hasDiscountsApplied, + this.published, + this.deleted, + this.displayOrder, + this.createdOnUtc, + this.updatedOnUtc, + this.roleIds, + this.discountIds, + this.storeIds, + this.image, + this.seName, + this.isLeaf}); + + OffersModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + description = json['description']; + categoryTemplateId = json['category_template_id']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + parentCategoryId = json['parent_category_id']; + pageSize = json['page_size']; + pageSizeOptions = json['page_size_options']; + priceRanges = json['price_ranges']; + showOnHomePage = json['show_on_home_page']; + includeInTopMenu = json['include_in_top_menu']; + hasDiscountsApplied = json['has_discounts_applied']; + published = json['published']; + deleted = json['deleted']; + displayOrder = json['display_order']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + + image = json['image'] != null ? new Image.fromJson(json['image']) : null; + seName = json['se_name']; + isLeaf = json['is_leaf']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['category_template_id'] = this.categoryTemplateId; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['parent_category_id'] = this.parentCategoryId; + data['page_size'] = this.pageSize; + data['page_size_options'] = this.pageSizeOptions; + data['price_ranges'] = this.priceRanges; + data['show_on_home_page'] = this.showOnHomePage; + data['include_in_top_menu'] = this.includeInTopMenu; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['display_order'] = this.displayOrder; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v.toJson()).toList(); + } + if (this.discountIds != null) { + data['discount_ids'] = this.discountIds.map((v) => v.toJson()).toList(); + } + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v.toJson()).toList(); + } + if (this.image != null) { + data['image'] = this.image.toJson(); + } + data['se_name'] = this.seName; + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Image { + String src; + Null thumb; + Null attachment; + + Image({this.src, this.thumb, this.attachment}); + + Image.fromJson(Map json) { + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacy/parent_products_model.dart b/lib/core/model/pharmacy/parent_products_model.dart new file mode 100644 index 00000000..55495416 --- /dev/null +++ b/lib/core/model/pharmacy/parent_products_model.dart @@ -0,0 +1,566 @@ +class ParentProductsModel { + dynamic id; + dynamic visibleIndividually; + dynamic name; + dynamic namen; + List localizedNames; + dynamic shortDescription; + dynamic shortDescriptionn; + dynamic fullDescription; + dynamic fullDescriptionn; + dynamic markasNew; + dynamic showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + dynamic allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + dynamic sku; + dynamic isRx; + dynamic prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + dynamic isGiftCard; + dynamic requireOtherProducts; + dynamic automaticallyAddRequiredProducts; + dynamic isDownload; + dynamic unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + dynamic hasSampleDownload; + dynamic hasUserAgreement; + dynamic isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + dynamic isRental; + dynamic rentalPriceLength; + dynamic isShipEnabled; + dynamic isFreeShipping; + dynamic shipSeparately; + dynamic additionalShippingCharge; + dynamic isTaxExempt; + dynamic isTelecommunicationsOrBroadcastingOrElectronicServices; + dynamic useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + dynamic stockAvailability; + dynamic stockAvailabilityn; + dynamic displayStockAvailability; + dynamic displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + dynamic allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + dynamic allowAddingOnlyExistingAttributeCombinations; + dynamic disableBuyButton; + dynamic disableWishlistButton; + dynamic availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + dynamic callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + dynamic customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + dynamic basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + dynamic hasTierPrices; + dynamic hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + dynamic currency; + dynamic currencyn; + dynamic weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + dynamic published; + dynamic deleted; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + ParentProductsModel( + {this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); + + ParentProductsModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + shortDescriptionn = json['short_descriptionn']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + markasNew = json['markas_new']; + showOnHomePage = json['show_on_home_page']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + + manufacturerIds = json['manufacturer_ids'].cast(); + + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } + + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + + data['manufacturer_ids'] = this.manufacturerIds; + + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacy/pharmacy_categorise.dart b/lib/core/model/pharmacy/pharmacy_categorise.dart new file mode 100644 index 00000000..33ac26f1 --- /dev/null +++ b/lib/core/model/pharmacy/pharmacy_categorise.dart @@ -0,0 +1,103 @@ +class PharmacyCategorise { + dynamic id; + String name; + dynamic namen; + List localizedNames; + dynamic description; + dynamic parentCategoryId; + dynamic displayOrder; + dynamic image; + dynamic isLeaf; + + PharmacyCategorise( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.parentCategoryId, + this.displayOrder, + this.image, + this.isLeaf}); + + PharmacyCategorise.fromJson(Map json) { + try { + id = json['id']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + description = json['description']; + parentCategoryId = json['parent_category_id']; + displayOrder = json['display_order']; + image = json['image'] != null ? new Image.fromJson(json['image']) : null; + isLeaf = json['is_leaf']; + } catch (e) { + print(e); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['parent_category_id'] = this.parentCategoryId; + data['display_order'] = this.displayOrder; + if (this.image != null) { + data['image'] = this.image.toJson(); + } + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Image { + String src; + Null thumb; + Null attachment; + + Image({this.src, this.thumb, this.attachment}); + + Image.fromJson(Map json) { + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} diff --git a/lib/core/model/pharmacy/scan_qr_model.dart b/lib/core/model/pharmacy/scan_qr_model.dart new file mode 100644 index 00000000..71e25e8d --- /dev/null +++ b/lib/core/model/pharmacy/scan_qr_model.dart @@ -0,0 +1,584 @@ +class ScanQrModel { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + ScanQrModel( + {this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); + + ScanQrModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + shortDescriptionn = json['short_descriptionn']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + markasNew = json['markas_new']; + showOnHomePage = json['show_on_home_page']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + if (json['role_ids'] != null) { + roleIds = new List(); + } + if (json['discount_ids'] != null) { + discountIds = new List(); + } + if (json['store_ids'] != null) { + storeIds = new List(); + } + manufacturerIds = json['manufacturer_ids'].cast(); + if (json['reviews'] != null) { + reviews = new List(); + } + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + if (json['attributes'] != null) { + attributes = new List(); + } + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } + if (json['associated_product_ids'] != null) { + associatedProductIds = new List(); + } + if (json['tags'] != null) { + tags = new List(); + } + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + + data['manufacturer_ids'] = this.manufacturerIds; + + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/pharmacy/sub_categories_model.dart b/lib/core/model/pharmacy/sub_categories_model.dart new file mode 100644 index 00000000..916ec023 --- /dev/null +++ b/lib/core/model/pharmacy/sub_categories_model.dart @@ -0,0 +1,75 @@ +class SubCategoriesModel { + String id; + String name; + String namen; + List localizedNames; + String description; + int parentCategoryId; + int displayOrder; + dynamic image; + bool isLeaf; + + SubCategoriesModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + this.description, + this.parentCategoryId, + this.displayOrder, + this.image, + this.isLeaf}); + + SubCategoriesModel.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']; + parentCategoryId = json['parent_category_id']; + displayOrder = json['display_order']; + image = json['image']; + isLeaf = json['is_leaf']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['description'] = this.description; + data['parent_category_id'] = this.parentCategoryId; + data['display_order'] = this.displayOrder; + data['image'] = this.image; + data['is_leaf'] = this.isLeaf; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} diff --git a/lib/core/model/pharmacy/sub_products_model.dart b/lib/core/model/pharmacy/sub_products_model.dart new file mode 100644 index 00000000..6e8964c9 --- /dev/null +++ b/lib/core/model/pharmacy/sub_products_model.dart @@ -0,0 +1,562 @@ +class SubProductsModel { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + SubProductsModel( + {this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); + + SubProductsModel.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + shortDescriptionn = json['short_descriptionn']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + markasNew = json['markas_new']; + showOnHomePage = json['show_on_home_page']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + + manufacturerIds = json['manufacturer_ids'].cast(); + + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } + + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + + data['manufacturer_ids'] = this.manufacturerIds; + + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} diff --git a/lib/core/model/search_products_model.dart b/lib/core/model/search_products_model.dart new file mode 100644 index 00000000..d63fd4b0 --- /dev/null +++ b/lib/core/model/search_products_model.dart @@ -0,0 +1,185 @@ +class SearchProductsModel { + String id; + String name; + String namen; + List localizedNames; + String shortDescription; + String fullDescription; + String fullDescriptionn; + dynamic approvedRatingSum; + dynamic approvedTotalReviews; + String sku; + bool isRx; + dynamic rxMessage; + dynamic rxMessagen; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + double price; + dynamic oldPrice; + dynamic discountName; + dynamic discountNamen; + dynamic discountPercentage; + dynamic displayOrder; + List discountIds; + List reviews; + List images; + + SearchProductsModel( + {this.id, + this.name, + this.namen, + this.localizedNames, + 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}); + + SearchProductsModel.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)); + }); + } + 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['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['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.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} 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..da12b48b --- /dev/null +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -0,0 +1,202 @@ +import 'package:diplomaticquarterapp/config/config.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/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 64cd8bdb..04f599f1 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -6,8 +6,10 @@ import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dar import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.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'; @@ -32,66 +34,83 @@ 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) ?? 'ar'; - var user = await sharedPref.getObject(USER_PROFILE); - if (body.containsKey('SetupID')) { - body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null - ? body['SetupID'] - : SETUP_ID - : SETUP_ID; - } - body['VersionID'] = VERSION_ID; - body['Channel'] = CHANNEL; - body['LanguageID'] = languageID == 'ar' ? 1 : 2; + 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; + 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 (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = + body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; + } - body['DeviceTypeID'] = DeviceTypeID; + 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; + 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'] = 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); + } } } @@ -115,6 +134,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) { @@ -125,9 +148,14 @@ class BaseAppClient { } else if (parsed['Result'] == 'OK') { onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + if (parsed != null) { + onSuccess(parsed, statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + logout(); + } } } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { @@ -146,9 +174,13 @@ class BaseAppClient { if (parsed['SameClinicApptList'] != null) { onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + if (parsed['message'] != null) { + onFailure(parsed['message'] ?? parsed['message'], statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } } } } @@ -161,12 +193,59 @@ class BaseAppClient { onFailure(e.toString(), -1); } } + 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}) async { - String url = BASE_URL + endPoint; + 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); + } + } + + getPharmacy(String endPoint, + {Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + bool isAllowAny = false, + Map queryParams}) async { + String url = PHARMACY_BASE_URL + endPoint; if (queryParams != null) { String queryString = Uri(queryParameters: queryParams).query; url += '?' + queryString; @@ -178,7 +257,7 @@ class BaseAppClient { final response = await http.get(url.trim(), headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' - },); + }); final int statusCode = response.statusCode; print("statusCode :$statusCode"); @@ -193,7 +272,6 @@ class BaseAppClient { } } - simpleGet(String fullUrl, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams}) async { String url = fullUrl; var haveParams = (queryParams != null); @@ -224,6 +302,7 @@ class BaseAppClient { logout() async { await sharedPref.remove(LOGIN_TOKEN_ID); + await sharedPref.remove(PHARMACY_CUSTOMER_ID); await authenticatedUserObject.getUser(); Provider.of(AppGlobal.context, listen: false).isLogin = false; @@ -259,4 +338,4 @@ class BaseAppClient { return params; } -} +} \ No newline at end of file diff --git a/lib/core/service/offers_service.dart b/lib/core/service/offers_service.dart new file mode 100644 index 00000000..2247c833 --- /dev/null +++ b/lib/core/service/offers_service.dart @@ -0,0 +1,56 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offer_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offers_model.dart'; + +import 'base_service.dart'; + +class OffersCategoriseService extends BaseService { + List _offersList = List(); + List get offersList => _offersList; + List _offerProducts = List(); + List get offersProducts => _offerProducts; + + clearCategorise() { + _offerProducts.clear(); + } + + // clearCategorise2() { + // _offersList.clear(); + // } + + Future getOffersCategorise() async { + hasError = false; + _offersList.clear(); + await baseAppClient.get( + GET_OFFERS_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _offersList.add(OffersModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getOffersProducts({String id}) async { + hasError = false; + _offerProducts.clear(); + String endPoint = + id != null ? GET_OFFERS_PRODUCTS + "$id" : GET_OFFERS_PRODUCTS + "1"; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _offerProducts.add(OfferProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } +} diff --git a/lib/core/service/parmacyModule/lacum-registration-service.dart b/lib/core/service/parmacyModule/lacum-registration-service.dart new file mode 100644 index 00000000..b3e64e69 --- /dev/null +++ b/lib/core/service/parmacyModule/lacum-registration-service.dart @@ -0,0 +1,50 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; + +import 'lacum-service.dart'; + +class LacumRegistrationService extends LacumService{ + + ListUserAgreement listUserAgreement; + + Future getLacumAccountInformationById(String patientIdentificationNo) async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = patientIdentificationNo; + + try { + await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, + onSuccess: (response, statusCode) async { + lacumInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future getUserTermsAndConditionsForEPharmcy() async { + hasError = false; + super.error = ""; + + Map body = Map(); + + try { + await baseAppClient.post(LAKUM_GET_USER_TERMS_AND_CONDITIONS, + onSuccess: (response, statusCode) async { + listUserAgreement = ListUserAgreement.fromJson(response['ListUserAgreement'][0]); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/lacum-service.dart b/lib/core/service/parmacyModule/lacum-service.dart new file mode 100644 index 00000000..c7117303 --- /dev/null +++ b/lib/core/service/parmacyModule/lacum-service.dart @@ -0,0 +1,133 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class LacumService extends BaseService{ + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + String successMsg = ''; + + LacumAccountInformation lacumInformation; + LacumAccountInformation lacumGroupInformation; + + Future getLacumAccountInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + + try { + await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, + onSuccess: (response, statusCode) async { + lacumInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future getLacumGroupInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; + body['IsDetailsRequired'] = true; + + try { + await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, + onSuccess: (response, statusCode) async { + lacumGroupInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future makeAccountActivate() async { + hasError = false; + super.error = ""; + int yahalaAccountNo = lacumInformation.yahalaAccountNo; + + Map body = Map(); + body['CreatedBy'] = 103; + body['YahalaAccountNumber'] = yahalaAccountNo; + + try { + await baseAppClient.post(LACUM_ACCOUNT_ACTIVATE, + onSuccess: (response, statusCode) async { + // lacumInformation = LacumAccountInformation.fromJson(response); + // lacumInformation.yahalaAccountNo = yahalaAccountNo; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future makeAccountDeactivate() async { + hasError = false; + super.error = ""; + int yahalaAccountNo = lacumInformation.yahalaAccountNo; + + Map body = Map(); + body['CreatedBy'] = 103; + body['YahalaAccountNumber'] = yahalaAccountNo; + + try { + await baseAppClient.post(LACUM_ACCOUNT_DEACTIVATE, + onSuccess: (response, statusCode) async { + // lacumInformation = LacumAccountInformation.fromJson(response); + // lacumInformation.yahalaAccountNo = yahalaAccountNo; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future createLakumAccount(String name, String phone, int accountID, String patientIdentificationID, var prefLang) async { + hasError = false; + super.error = ""; + if(prefLang == null){ + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + prefLang = languageID == 'ar' ? 1 : 2; + } + + + Map body = Map(); + body['PrefLang'] = prefLang; + body['AccountID'] = accountID; + body['FullName'] = name; + body['MobileNo'] = phone; + body['PatientIdentificationID'] = patientIdentificationID; + body['PatientID'] = user.patientID; + + try { + await baseAppClient.post(CREATE_LAKUM_ACCOUNT, + onSuccess: (response, statusCode) async { + successMsg = LacumAccountInformation.fromJson(response).message; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/lacum-transfer-service.dart b/lib/core/service/parmacyModule/lacum-transfer-service.dart new file mode 100644 index 00000000..b15696f9 --- /dev/null +++ b/lib/core/service/parmacyModule/lacum-transfer-service.dart @@ -0,0 +1,57 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; + +import 'lacum-service.dart'; + +class LacumTransferService extends LacumService{ + LacumAccountInformation lacumReceiverInformation; + + Future getLacumGroupDataBuAccountId(String accountId) async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + body['AccountNumber'] = accountId; + + try { + await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, + onSuccess: (response, statusCode) async { + lacumReceiverInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + return null; + }, body: body); + } catch (error) { + throw error; + } + } + + Future transferYaHalaLoyaltyPoints(String points) async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['MobileNo'] = lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber; + body['UserName'] = lacumGroupInformation.lakumInquiryInformationObjVersion.memberName; + body['YaHalaSenderAccNumber'] = lacumGroupInformation.lakumInquiryInformationObjVersion.accountNumber; + body['Yahala_IdentificationNo'] = lacumGroupInformation.lakumInquiryInformationObjVersion.memberUniversalId; + body['YaHalaPointsToTransfer'] = points; + body['YaHalaReceiverAccNumber'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.accountNumber; + body['YaHalaReceiverMobileNumber'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.mobileNumber; + body['YaHalaReceiverName'] = lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName; + + try { + await baseAppClient.post(TRANSFER_YAHALA_LOYALITY_POINTS, + onSuccess: (response, statusCode) async { + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 89d5550e..5648ff6d 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -1,29 +1,248 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -class OrderPreviewService extends BaseService{ +class OrderPreviewService extends BaseService { bool isFinished = true; bool hasError = false; String errorMsg = ''; List addresses = List(); + LacumAccountInformation lacumInformation; + LacumAccountInformation lacumGroupInformation; - 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 + Future getAddresses() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = {'fields': 'addresses'}; + hasError = false; + try { + await baseAppClient.get("$GET_CUSTOMERS_ADDRESSES$customerId", + 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; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future getShippingOption(Addresses selectedAddress) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = Map(); + dynamic localRes; + hasError = false; + try { + await baseAppClient.get("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}", + onSuccess: (dynamic response, int statusCode) { + localRes = response['shipping_option'][0]; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + return Future.value(localRes); + } + + Future getShoppingCart() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = {'shopping_cart_type': '1'}; + dynamic localRes; + hasError = false; + try { + await baseAppClient.get("$GET_SHOPPING_CART$customerId", + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + return Future.value(localRes); + } + + Future changeProductQuantity( + String productId, ShoppingCart product) async { + hasError = false; + super.error = ""; + dynamic localRes; + Map choppingCartObject = Map(); + choppingCartObject['id'] = product.id; + choppingCartObject['quantity'] = product.quantity; + choppingCartObject['shopping_cart_type'] = "1"; + choppingCartObject['product_id'] = product.productId; + choppingCartObject['customer_id'] = product.customerId; + + Map body = Map(); + body["shopping_cart_item"] = choppingCartObject; + + await baseAppClient.post("$GET_SHOPPING_CART$productId", + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + + return Future.value(localRes); + } + + Future deleteProduct(String productId) async { + hasError = false; + super.error = ""; + dynamic localRes; + + Map body = Map(); + + await baseAppClient.post("$DELETE_SHOPPING_CART$productId", + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + + return Future.value(localRes); + } + + Future deleteShoppingCart() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + hasError = false; + super.error = ""; + dynamic localRes; + + await baseAppClient.get("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart", + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + + return Future.value(localRes); + } + + Future getLacumAccountInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + + try { + await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, + onSuccess: (response, statusCode) async { + lacumInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future getLacumGroupInformation() async { + hasError = false; + super.error = ""; + + Map body = Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; + + try { + await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, + onSuccess: (response, statusCode) async { + lacumGroupInformation = LacumAccountInformation.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + Future makeOrder(PaymentCheckoutData paymentCheckoutData, List shoppingCarts) async { + paymentCheckoutData.address.isChecked = true; + hasError = false; + super.error = ""; + + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + Map orderBody = Map(); + orderBody['rx_attachments'] = ""; + orderBody['customer_language_id'] = languageID == 'ar' ? 1 : 2; + orderBody['billing_address'] = paymentCheckoutData.address; + orderBody['pick_up_in_store'] = false; + orderBody['payment_method_system_name'] = "Payments.PayFort"; + orderBody['shipping_method'] = languageID == 'ar' ? paymentCheckoutData.shippingOption.namen : paymentCheckoutData.shippingOption.name ; + orderBody['shipping_rate_computation_method_system_name'] = paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName; + orderBody['customer_id'] = customerId; + orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; + orderBody['shippingOption'] = paymentCheckoutData.shippingOption; + orderBody['shipping_address'] = paymentCheckoutData.address; + orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; + + List> itemsList = List(); + shoppingCarts.forEach((item) { + Map orderItemsBody = Map(); + orderItemsBody['product_id'] = item.product.id; + orderItemsBody['quantity'] = item.quantity; + itemsList.add(orderItemsBody); + }); + orderBody['order_items'] = itemsList; + + Map body = Map(); + body['order'] = orderBody; + + try { + await baseAppClient.post(ORDER_SHOPPING_CART, + onSuccess: (response, statusCode) async { + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + + String getPaymentOptionName(PaymentOption paymentOption) { + switch (paymentOption.index) { + case 0: + return "MADA"; + break; + case 1: + return "SADAD"; + break; + case 2: + return "VISA"; + break; + case 3: + return "MASTERCARD"; + break; + case 4: + return "INSTALLMENT"; + break; + default: + return ""; + } + } +} diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 53dc7e0a..c3bce324 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -4,8 +4,10 @@ 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'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; class PharmacyModuleService extends BaseService { + final AppSharedPreferences sharedPref = AppSharedPreferences(); bool isFinished = true; bool hasError = false; String errorMsg = ''; @@ -15,19 +17,68 @@ class PharmacyModuleService extends BaseService { List bestSellerProducts = List(); List lastVisitedProducts = List(); + Future makeVerifyCustomer(dynamic data) async { + Map queryParams = {'FileNumber': data['PatientID'].toString()}; + hasError = false; + try { + await baseAppClient.get(PHARMACY_VERIFY_CUSTOMER, + onSuccess: (dynamic response, int statusCode) { + if (response['UserName'] != null) { + sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); + print(response); + } else { + createUser(); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future createUser() async { + var data = await sharedPref.getObject(USER_PROFILE); + var languageID = await sharedPref.getString(APP_LANGUAGE); + Map queryParams = { + 'Phone': data['MobileNumber'], + 'Email': data['EmailAddress'], + 'FileNumber': data['PatientID'].toString(), + 'Language': languageID.toString(), + 'Gender': data['Gender'].toString(), + 'FirstName': data['FirstName'], + 'LastName': data['LastName'], + 'LanguageId': languageID.toString(), + 'CountryCode': data['ZipCode'], + }; + hasError = false; + try { + await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, + onSuccess: (dynamic response, int statusCode) { + if (!response['IsRegistered']) {} + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + 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; - // }); + 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; } @@ -36,16 +87,19 @@ class PharmacyModuleService extends BaseService { 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); + await baseAppClient.get(GET_PHARMACY_TOP_MANUFACTURER, + onSuccess: (dynamic response, int statusCode) { + manufacturerList.clear(); + response['manufacturer'].forEach((item) { + Manufacturer manufacturer = Manufacturer.fromJson(item); + if(manufacturer.image != null){ + manufacturerList.add(Manufacturer.fromJson(item)); + } + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); } catch (error) { throw error; } @@ -57,16 +111,16 @@ class PharmacyModuleService extends BaseService { 'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews', }; try { - // await baseAppClient.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); + 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; } @@ -79,16 +133,16 @@ class PharmacyModuleService extends BaseService { 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; - // }); + 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/service/parmacyModule/terms-condition-service.dart b/lib/core/service/parmacyModule/terms-condition-service.dart new file mode 100644 index 00000000..68fac632 --- /dev/null +++ b/lib/core/service/parmacyModule/terms-condition-service.dart @@ -0,0 +1,33 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; + +import '../base_service.dart'; + +class TermsConditionService extends BaseService{ + bool isFinished = true; + bool hasError = false; + String errorMsg = ''; + String successMsg = ''; + + ListUserAgreement listUserAgreement; + + Future getUserTermsAndConditionsForEPharmcy() async { + hasError = false; + super.error = ""; + + Map body = Map(); + + try { + await baseAppClient.post(LAKUM_GET_USER_TERMS_AND_CONDITIONS, + onSuccess: (response, statusCode) async { + listUserAgreement = ListUserAgreement.fromJson(response['ListUserAgreement'][0]); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } catch (error) { + throw error; + } + } + +} \ No newline at end of file diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart new file mode 100644 index 00000000..b55a755d --- /dev/null +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -0,0 +1,225 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/search_products_model.dart'; + +import 'base_service.dart'; + +class PharmacyCategoriseService extends BaseService { + //service one + List _categoriseList = List(); + List get categoriseList => _categoriseList; + + //service two + List _parentCategoriseList = List(); + List get parentCategoriseList => _parentCategoriseList; + + //service three + List _parentProductsList = List(); + List get parentProductsList => _parentProductsList; + + //service four + List _subCategoriseList = List(); + List get subCategoriseList => _subCategoriseList; + + //service five + List _subProductsList = List(); + List get subProductsList => _subProductsList; + + //service six + List _finalProducts = List(); + List get finalProducts => _finalProducts; + + //service 7 + + List _brandsList = List(); + List get brandsList => _brandsList; + + // service 8 + + List _searchList = List(); + List get searchList => _searchList; + + List _scanList = List(); + List get scanList => _scanList; + + clearSearchList() { + _searchList.clear(); + } + + Future getCategorise() async { + hasError = false; + _categoriseList.clear(); + await baseAppClient.get( + GET_PHARMACY_CATEGORISE, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _categoriseList.add(PharmacyCategorise.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future scanQr({String id}) async { + hasError = false; + _scanList.clear(); + String endPoint = id != null ? SCAN_QR_CODE + "$id" : SCAN_QR_CODE + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _scanList.add(ScanQrModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future searchProducts({String productName}) async { + hasError = false; + _searchList.clear(); + String endPoint = productName != null + ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' + : GET_SEARCH_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _searchList.add(SearchProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getBrands() async { + hasError = false; + _brandsList.clear(); + await baseAppClient.get( + GET_BRANDS_LIST, + onSuccess: (dynamic response, int statusCode) { + response['manufacturer'].forEach((item) { + _brandsList.add(BrandsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getCategoriseParent({String id}) async { + hasError = false; + _parentCategoriseList.clear(); + String endPoint = + id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _parentCategoriseList.add(CategoriseParentModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getParentProducts({String id}) async { + hasError = false; + _parentProductsList.clear(); + String endPoint = id != null + ? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50' + : GET_PARENT_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _parentProductsList.add(ParentProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getSubCategorise({String id}) async { + hasError = false; + _subCategoriseList.clear(); + + String endPoint = + id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['categories'].forEach((item) { + _subCategoriseList.add(SubCategoriesModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getSubProducts({String id}) async { + hasError = false; + _subProductsList.clear(); + String endPoint = id != null + ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' + : GET_SUB_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _subProductsList.add(SubProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + + Future getFinalProducts({String id}) async { + hasError = false; + _finalProducts.clear(); + String endPoint = + id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + ""; + await baseAppClient.get( + endPoint, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _finalProducts.add(FinalProductsModel.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = 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..f2c81956 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; @@ -107,4 +112,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/offers_Categorise_view_model.dart b/lib/core/viewModels/offers_Categorise_view_model.dart new file mode 100644 index 00000000..b63dd553 --- /dev/null +++ b/lib/core/viewModels/offers_Categorise_view_model.dart @@ -0,0 +1,48 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offer_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/offers_model.dart'; +import 'package:diplomaticquarterapp/core/service/offers_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +import 'base_view_model.dart'; + +class OffersCategoriseViewModel extends BaseViewModel { + bool hasError = false; + + OffersCategoriseService _offersCategoriseService = + locator(); + List get categorise => _offersCategoriseService.offersList; + + List get products => + _offersCategoriseService.offersProducts; + + Future getOffersCategorise() async { + hasError = false; + _offersCategoriseService.clearCategorise(); + setState(ViewState.Busy); + await _offersCategoriseService.getOffersCategorise(); + if (_offersCategoriseService.hasError) { + error = _offersCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + await getOffersProducts(); + } + + Future getOffersProducts({String i}) async { + hasError = false; + + setState(ViewState.Busy); + await _offersCategoriseService.getOffersProducts(id: i); + if (_offersCategoriseService.hasError) { + error = _offersCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} +// await _offersCategoriseService.getOffersProducts(); +// if (_offersCategoriseService.hasError) { +// error = _offersCategoriseService.error; +// setState(ViewState.ErrorLocal); +// } else +// setState(ViewState.Idle); diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index 00f4819b..06295188 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -1,3 +1,11 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShippingOption.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; import '../../../locator.dart'; @@ -5,4 +13,183 @@ import '../base_view_model.dart'; class OrderPreviewViewModel extends BaseViewModel { OrderPreviewService _orderService = locator(); + + List get addresses => _orderService.addresses; + LacumAccountInformation get lacumInformation => + _orderService.lacumInformation; + ShoppingCartResponse cartResponse = ShoppingCartResponse(); + PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); + double totalAdditionalShippingCharge = 0; + + Future getOrderPreviewData() async { + setState(ViewState.Busy); + await _orderService.getAddresses(); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + getShoppingCart(); + } + } + + getShoppingCart() async { + setState(ViewState.Busy); + await _orderService.getShoppingCart().then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + if (paymentCheckoutData != null) { + paymentCheckoutData.cartDataVisible = true; + } + setState(ViewState.Idle); + } + } + + changeProductQuantity(ShoppingCart product) async { + setState(ViewState.Busy); + await _orderService.changeProductQuantity(product.id, product).then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + deleteProduct(ShoppingCart product) async { + setState(ViewState.Busy); + await _orderService.deleteProduct(product.id).then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + deleteShoppingCart() async { + setState(ViewState.Busy); + await _orderService.deleteShoppingCart().then((res) { + _handleGetShoppingCartResponse(res); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + _handleGetShoppingCartResponse(Map res) { + totalAdditionalShippingCharge = 0; + if (res == null) { + error = "response is null"; + setState(ViewState.Error); + return; + } + print(res); + cartResponse.itemCount = res["item_count"]; + cartResponse.quantityCount = res["quantity_count"]; + cartResponse.subtotal = res["subtotal"]; + cartResponse.subtotalWithVat = res["subtotal_with_vat"]; + cartResponse.subtotalVatAmount = res["subtotal_vat_amount"]; + cartResponse.subtotalVatRate = res["subtotal_vat_rate"]; + cartResponse.shoppingCarts = List(); + res["shopping_carts"].forEach((item) { + ShoppingCart shoppingCart = ShoppingCart.fromJson(item); + cartResponse.shoppingCarts.add(shoppingCart); + totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge; + }); + cartResponse.updateShoppingCard(); + } + + String getPaymentOptionImage(PaymentOption paymentOption) { + String assetFile = "assets/images/pharmacy_module/payment/"; + switch (paymentOption.index) { + case 0: + return "${assetFile}mada.png"; + break; + case 1: + return "${assetFile}sadad.png"; + break; + case 2: + return "${assetFile}visa.png"; + break; + case 3: + return "${assetFile}mastercard.png"; + break; + case 4: + return "${assetFile}installment.png"; + break; + default: + return ""; + } + } + + String getPaymentOptionName(PaymentOption paymentOption) { + return _orderService.getPaymentOptionName(paymentOption); + } + + getInformationsByAddress() async { + await getLacumAccountInformation(); + await getShippingOption(); + } + + getLacumAccountInformation() async { + setState(ViewState.Busy); + await _orderService.getLacumAccountInformation(); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + getLacumGroupData(); + } + } + + Future getLacumGroupData() async { + setState(ViewState.Busy); + await _orderService.getLacumGroupInformation(); + paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; + paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + getShippingOption() async { + setState(ViewState.Busy); + await _orderService.getShippingOption(paymentCheckoutData.address).then((res) { + paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); + paymentCheckoutData.updateData(); + }); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future makeOrder() async { + setState(ViewState.Busy); + await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } } + +enum PaymentOption { meda, sadad, visa, mastercard, installments } diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart new file mode 100644 index 00000000..485c92fb --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -0,0 +1,117 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyAddressesModel.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class PharmacyAddressesViewModel extends BaseViewModel { + PharmacyAddressService _pharmacyAddressService = + locator(); + + List get addresses => _pharmacyAddressService.addresses; + + int get selectedAddressIndex => _pharmacyAddressService.selectedAddressIndex; + + CountryData get country => _pharmacyAddressService.country; + + setSelectedAddressIndex(int index) { + _pharmacyAddressService.selectedAddressIndex = index; + } + + Future getAddressesList() async { + setState(ViewState.Busy); + await _pharmacyAddressService.getAddresses(); + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + +/* Future getCountries(String countryName) async { + setState(ViewState.Busy); + await _pharmacyAddressService.getCountries(countryName); + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + // setState(ViewState.Error); + } else { + // setState(ViewState.Idle); + } + }*/ + + Future addEditAddress(PickResult value, Addresses editedAddress) async { + setState(ViewState.Busy); + + Addresses sendingAddress; + + if (editedAddress == null) { + sendingAddress = Addresses(); + sendingAddress.id = "0"; + sendingAddress.firstName = user.firstName; + sendingAddress.lastName = user.lastName; + sendingAddress.email = user.emailAddress; + sendingAddress.company = null; + } else { + sendingAddress = editedAddress; + } + value.addressComponents.forEach((element) { + if (element.types.contains("country")) { + sendingAddress.country = element.longName; + } + if (element.types.contains("administrative_area_level_1")) { + sendingAddress.city = element.longName; + } + if (element.types.contains("postal_code")) { + sendingAddress.zipPostalCode = element.longName; + } + if (element.types.contains("administrative_area_level_2")) { + sendingAddress.province = element.longName; + } + }); + sendingAddress.latLong = value.geometry.location.toString(); + + await _pharmacyAddressService.getCountries(sendingAddress.country); + sendingAddress.countryId = country.id; + sendingAddress.stateProvinceId = null; + sendingAddress.address1 = value.formattedAddress; + sendingAddress.address2 = ""; + sendingAddress.phoneNumber = user.mobileNumber; + sendingAddress.faxNumber = user.faxNumber; + sendingAddress.customerAttributes = ""; + sendingAddress.createdOnUtc = DateTime.now().toString(); + + if (editedAddress == null) { + await _pharmacyAddressService.addCustomerAddress(sendingAddress); + } else { + await _pharmacyAddressService.editCustomerAddress(sendingAddress); + } + + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future deleteAddresses(Addresses sendingAddress) async { + setState(ViewState.Busy); + await _pharmacyAddressService.deleteCustomerAddress(sendingAddress); + if (_pharmacyAddressService.hasError) { + error = _pharmacyAddressService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future saveSelectedAddressLocally(Addresses selectedAddress) async { + await sharedPref.setObject(PHARMACY_SELECTED_ADDRESS, selectedAddress); + } +} diff --git a/lib/core/viewModels/pharmacyModule/brand_view_model.dart b/lib/core/viewModels/pharmacyModule/brand_view_model.dart new file mode 100644 index 00000000..c981b2b3 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/brand_view_model.dart @@ -0,0 +1,57 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/brandModel.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/topBrandsModel.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/brands_service.dart'; + + +import '../../../locator.dart'; + +class BrandsViewModel extends BaseViewModel{ + BrandsService _brandsService = locator(); + List get brandsListList => _brandsService.brandsList; + + BrandsService _topBrandsService = locator(); + List get topBrandsListList => _topBrandsService.topBrandsList; + + List get searchList => + _brandsService.searchList; + + bool hasError = false; + + + Future getBrandsData() async { + hasError = false; + setState(ViewState.Busy); + await _brandsService.getBrands(); + if (_brandsService.hasError) { + error = _brandsService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getTopBrandsData() async { + hasError = false; + setState(ViewState.Busy); + await _topBrandsService.getTopBrands(); + if (_topBrandsService.hasError) { + error = _topBrandsService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + Future searchProducts({String productName}) async { + hasError = false; + _brandsService.clearSearchList(); + setState(ViewState.Busy); + await _brandsService.searchProducts(productName: productName); + if (_brandsService.hasError) { + error = _brandsService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart new file mode 100644 index 00000000..f8f5ea05 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart @@ -0,0 +1,55 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-registration-service.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-transfer-service.dart'; + +import '../../../locator.dart'; +import 'lacum-viewmodel.dart'; + +class LacumRegistrationViewModel extends LacumViewModel { + LacumRegistrationService _lacumService = locator(); + + ListUserAgreement get listUserAgreement => _lacumService.listUserAgreement; + + Future checkLacumAccountActivation(String patientIdentificationNo) async { + setState(ViewState.Busy); + await _lacumService.getLacumAccountInformationById(patientIdentificationNo); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + if(_lacumService.lacumInformation.yahalaAccountNo != 0){ + error = "The account has already been activated"; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } + + Future getUserTermsAndConditionsForEPharmcy() async { + setState(ViewState.Busy); + await _lacumService.getUserTermsAndConditionsForEPharmcy(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future createNewLakumAccount(String name, String phone, String identificationNo, int languageId) async { + setState(ViewState.Busy); + await _lacumService.createLakumAccount(name, phone, 0, identificationNo, languageId); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + return 404; + } else { + setState(ViewState.Idle); + return 200; + } + } + +} diff --git a/lib/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart b/lib/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart new file mode 100644 index 00000000..cd19a40f --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart @@ -0,0 +1,42 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-transfer-service.dart'; + +import '../../../locator.dart'; +import 'lacum-viewmodel.dart'; + +class LacumTranferViewModel extends LacumViewModel { + LacumTransferService _lacumService = locator(); + + LacumAccountInformation get lacumReceiverInformation => + _lacumService.lacumReceiverInformation; + + Future getLacumGroupDataBuAccountId(String accountId) async { + setState(ViewState.Busy); + await _lacumService.getLacumGroupDataBuAccountId(accountId); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future transferYaHalaLoyaltyPoints(String points) async { + setState(ViewState.Busy); + await _lacumService.transferYaHalaLoyaltyPoints(points); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + return 404; + } else { + setState(ViewState.Idle); + return 200; + } + } + + setLakumData(LacumAccountInformation lacumInformation, LacumAccountInformation lacumGroupInformation){ + _lacumService.lacumInformation = lacumInformation; + _lacumService.lacumGroupInformation = lacumGroupInformation; + } +} diff --git a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart new file mode 100644 index 00000000..ba8d70d9 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart @@ -0,0 +1,111 @@ +import 'dart:typed_data'; + +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-service.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'dart:async'; +import 'dart:convert' as convert; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class LacumViewModel extends BaseViewModel { + LacumService _lacumService = locator(); + + LacumAccountInformation get lacumInformation => + _lacumService.lacumInformation; + + LacumAccountInformation get lacumGroupInformation => + _lacumService.lacumGroupInformation; + + Future getLacumData() async { + await getLacumAccountData(); + getLacumGroupData(); + } + + Future getLacumAccountData() async { + setState(ViewState.Busy); + await _lacumService.getLacumAccountInformation(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getLacumGroupData() async { + setState(ViewState.Busy); + await _lacumService.getLacumGroupInformation(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future makeAccountActivate() async { + setState(ViewState.Busy); + await _lacumService.makeAccountActivate(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Active"; + getLacumAccountData(); + } + } + + Future makeAccountDeactivate() async { + setState(ViewState.Busy); + await _lacumService.makeAccountDeactivate(); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + } else { + lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Cancelled"; + getLacumAccountData(); + } + } + + Future createLakumAccount(String name, String phone) async { + setState(ViewState.Busy); + await _lacumService.createLakumAccount(name, phone, lacumInformation.yahalaAccountNo, lacumInformation.identificationNo, null); + if (_lacumService.hasError) { + error = _lacumService.error; + setState(ViewState.Error); + return 404; + } else { + setState(ViewState.Idle); + return 200; + } + } + + String formatCreatedDateToString() { + DateTime createdDate = DateUtil.convertStringToDate( + lacumGroupInformation.lakumInquiryInformationObjVersion.createdDate); + return DateUtil.getFormattedDate(createdDate, "MMM dd,yyyy"); + } + + Uint8List convertBase64ToBarCodeImage() { + try { + final _byteImage = convert.base64Decode( + lacumGroupInformation.lakumInquiryInformationObjVersion.barCode); + return _byteImage; + } catch (e) { + print(e); + return null; + } + } + + setLakumData(LacumAccountInformation lacumInformation, LacumAccountInformation lacumGroupInformation){ + _lacumService.lacumInformation = lacumInformation; + _lacumService.lacumGroupInformation = lacumGroupInformation; + } + + clearLakumGroupData(){ + _lacumService.lacumGroupInformation = null; + } +} diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart new file mode 100644 index 00000000..b7ddb528 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -0,0 +1,127 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:flutter/material.dart'; +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class OrderModelViewModel extends BaseViewModel { + OrderService _orderService = locator(); + + List get order => _orderService.orderList; + + OrderDetailsService _orderDetailsService = locator(); + + List get orderDetails => _orderDetailsService.orderDetails; + + CancelOrderService _cancelOrderService = locator(); + + List get cancelOrder => _cancelOrderService.cancelOrderList; + + + OrderPreviewService _orderServices = locator(); + List get addresses => _orderServices.addresses; + LacumAccountInformation get lacumInformation => + _orderServices.lacumInformation; + ShoppingCartResponse cartResponse = ShoppingCartResponse(); + PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); + double totalAdditionalShippingCharge = 0; + + + + Future getOrder(customerId, pageID) async { + print("this is customer id" + customerId); + setState(ViewState.Busy); + await _orderService.getOrder(customerId, pageID); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + //order = _orderService.orderList; + setState(ViewState.Idle); + } + } + + Future getOrderDetails(orderId) async { + setState(ViewState.Busy); + await _orderDetailsService.getOrderDetails(orderId); + if (_orderDetailsService.hasError) { + error = _orderDetailsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getProductReview() async { + setState(ViewState.Busy); + // await _orderService.getProductReview(); + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + //order = _orderService.orderList; + setState(ViewState.Idle); + } + } + + Future getCanceledOrder(order, context) async { + print("this is order id" + order); + setState(ViewState.Busy); + dynamic res; + await _cancelOrderService.getCanceledOrder(order).then((value) { + res = value['success']['SuccessEndUserMsg']; + print(value['success']['SuccessEndUserMsg']); + AppToast.showSuccessToast(message: "Request Sent Successfully"); +// Navigator.pop(context); + }); + if (_cancelOrderService.hasError) { + error = _cancelOrderService.error; + setState(ViewState.Error); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); +// AppToast.showSuccessToast(message: "Request Sent Successfully"); +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => OrderPage())); + + } + + return res; + } + + Future makeReview(Product product, double rating, String reviewText) async { + setState(ViewState.Busy); + await _orderDetailsService.makeReview(product, rating, reviewText); + if (_orderDetailsService.hasError) { + error = _orderDetailsService.error; + setState(ViewState.Error); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); + AppToast.showSuccessToast( + message: "Your review has been Submitted successfully"); + } + } + Future makeOrder() async { + setState(ViewState.Busy); + await _orderServices.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); + if (_orderServices.hasError) { + error = _orderServices.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + +} diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index f8c574f7..4dfc6a26 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; @@ -21,6 +22,25 @@ class PharmacyModuleViewModel extends BaseViewModel { _pharmacyService.lastVisitedProducts; Future getPharmacyHomeData() async { + setState(ViewState.Busy); + var data = await sharedPref.getObject(USER_PROFILE); + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + if (authenticatedUserObject.isLogin && data != null && customerId == null) { + await _pharmacyService.makeVerifyCustomer(data); + // here must call getShoppingCard() + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.Error); + } else { + await getBannerList(); + } + } else { + await getBannerList(); + } + } + + Future getBannerList() async { setState(ViewState.Busy); await _pharmacyService.getBannerListList(); if (_pharmacyService.hasError) { @@ -47,6 +67,7 @@ class PharmacyModuleViewModel extends BaseViewModel { error = _pharmacyService.error; setState(ViewState.Error); } else { + setState(ViewState.Idle); _getBestSellerProducts(); } } @@ -70,4 +91,18 @@ class PharmacyModuleViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future checkUserIsActivated() async { + if (authenticatedUserObject.isLogin) { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + return true; + } else { + return false; + } + } else { + // go to login page + return false; + } + } } diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart new file mode 100644 index 00000000..47a3bb11 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -0,0 +1,110 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; + + +import '../../../locator.dart'; + +class ProductDetailViewModel extends BaseViewModel{ + ProductDetailService _productDetailService = locator(); + ProductDetailService _productLocationService = locator(); + ProductDetailService _productWishlistService = locator(); + ProductDetailService _productSpecification = locator(); + + List get productDetailService => _productDetailService.productDetailList; + + List get productLocationService => _productLocationService.productLocationList; + + List get wishListItems => _productWishlistService.wishListProducts; + + List get productSpecification => _productSpecification.productSpecification; + + bool hasError = false; + + + Future getProductReviewsData(productID) async { + print('ENAD REview'); + hasError = false; + setState(ViewState.Busy); + await _productDetailService.getProductReviews(productID); + if (_productDetailService.hasError) { + error = _productDetailService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getProductLocationData() async { + print('ENAD in model view'); + hasError = false; + setState(ViewState.Busy); + await _productLocationService.getProductAvailabiltyDetail(); + if (_productLocationService.hasError) { + error = _productLocationService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future addToCartData(quantity, itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productLocationService.addToCart(quantity, itemID); + if (_productLocationService.hasError) { + error = _productLocationService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future addToWishlistData(itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productLocationService.addToWishlist(itemID); + if (_productLocationService.hasError) { + error = _productLocationService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future checkWishlistData() async { + hasError = false; + setState(ViewState.Busy); + await _productWishlistService.getWishlistItems(); + if (_productWishlistService.hasError) { + error = _productWishlistService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + Future deletWishlistData(itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productWishlistService.delteItemFromWishlist(itemID); + if (_productWishlistService.hasError) { + error = _productWishlistService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + Future productSpecificationData(itemID) async { + hasError = false; + setState(ViewState.Busy); + await _productWishlistService.productSpecificationData(itemID); + if (_productWishlistService.hasError) { + error = _productWishlistService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/review_view_model.dart b/lib/core/viewModels/pharmacyModule/review_view_model.dart new file mode 100644 index 00000000..3661820b --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/review_view_model.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/reviewModel.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/review_service.dart'; + +import '../../../locator.dart'; + +class ReviewViewModel extends BaseViewModel{ + ReviewService _reviewService = locator(); + + List get reviewListList => _reviewService.reviewList; + + bool hasError = false; + + + Future getReviewData() async { + hasError = false; + setState(ViewState.Busy); + await _reviewService.getReview(); + if (_reviewService.hasError) { + error = _reviewService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart b/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart new file mode 100644 index 00000000..6a5bd476 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart @@ -0,0 +1,24 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/terms-condition-service.dart'; +import 'dart:async'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class TermsConditionViewModel extends BaseViewModel { + TermsConditionService _termsConditionService = locator(); + + ListUserAgreement get listUserAgreement => _termsConditionService.listUserAgreement; + + Future getUserTermsAndConditionsForEPharmcy() async { + setState(ViewState.Busy); + await _termsConditionService.getUserTermsAndConditionsForEPharmcy(); + if (_termsConditionService.hasError) { + error = _termsConditionService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart b/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart new file mode 100644 index 00000000..788b7f3c --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart @@ -0,0 +1,36 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/wishList_service.dart'; + +import '../../../locator.dart'; + +class WishListViewModel extends BaseViewModel{ + WishListService _wishlistService = locator(); + + List get wishListList => _wishlistService.wishListProducts; + bool hasError = false; + + +// Future getWishlistData() async { +// setState(ViewState.Busy); +// await _wishlistService.getWishlist(); +// if (_wishlistService.hasError) { +// error = _wishlistService.error; +// setState(ViewState.Error); +// } else { +// setState(ViewState.Idle); +// } +// } + + Future getWishlistData() async { + hasError = false; + setState(ViewState.Busy); + await _wishlistService.getWishlist(); + if (_wishlistService.hasError) { + error = _wishlistService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart new file mode 100644 index 00000000..5e1f4f9f --- /dev/null +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -0,0 +1,158 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart'; +import 'package:diplomaticquarterapp/core/model/search_products_model.dart'; + +import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +import 'base_view_model.dart'; + +class PharmacyCategoriseViewModel extends BaseViewModel { + bool hasError = false; + PharmacyCategoriseService _pharmacyCategoriseService = + locator(); + + List get categorise => + _pharmacyCategoriseService.categoriseList; + + List get categoriseParent => + _pharmacyCategoriseService.parentCategoriseList; + + List get parentProducts => + _pharmacyCategoriseService.parentProductsList; + + List get subCategorise => + _pharmacyCategoriseService.subCategoriseList; + + List get subProducts => + _pharmacyCategoriseService.subProductsList; + + List get finalProducts => + _pharmacyCategoriseService.finalProducts; + List get brandsList => _pharmacyCategoriseService.brandsList; + + List get searchList => + _pharmacyCategoriseService.searchList; + + List get scanList => _pharmacyCategoriseService.scanList; + + Future getCategorise() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getCategorise(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getBrands() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getBrands(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future scanQr({String id}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.scanQr(id: id); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + clearSearchList() { + _pharmacyCategoriseService.clearSearchList(); + } + + Future searchProducts({String productName}) async { + hasError = false; + _pharmacyCategoriseService.clearSearchList(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.searchProducts(productName: productName); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getCategoriseParent({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getCategoriseParent(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + await getParentProducts(i: i); + await getBrands(); + } + + Future getParentProducts({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getParentProducts(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getSubCategorise({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getSubCategorise(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + getSubProducts(i: i); + } + + Future getSubProducts({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getSubProducts(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getFinalProducts({String i}) async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getFinalProducts(id: i); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 271bdf23..cfdad053 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -4,11 +4,18 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_v import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/review_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/wishList_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.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'; @@ -45,12 +52,19 @@ 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/packages_offers/PackagesOffersServices.dart'; +import 'core/service/parmacyModule/lacum-registration-service.dart'; +import 'core/service/parmacyModule/lacum-service.dart'; +import 'core/service/parmacyModule/lacum-transfer-service.dart'; import 'core/service/parmacyModule/order-preview-service.dart'; import 'core/service/notifications_service.dart'; +import 'core/service/parmacyModule/terms-condition-service.dart'; import 'core/service/privilege_service.dart'; +import 'core/service/weather_service.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'core/service/parmacyModule/parmacy_module_service.dart'; +import 'core/service/offers_service.dart'; +import 'core/service/pharmacy_categorise_service.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; import 'core/viewModels/blooddonation/blood_details_view_model.dart'; @@ -83,16 +97,35 @@ import 'core/viewModels/medical/vital_sign_view_model.dart'; import 'core/viewModels/medical/reports_view_model.dart'; import 'core/viewModels/medical/weight_pressure_view_model.dart'; import 'core/viewModels/notifications_view_model.dart'; +import 'core/viewModels/offers_Categorise_view_model.dart'; import 'core/viewModels/packages_offers/PackagesOffersViewModel.dart'; import 'core/viewModels/pharmacies_view_model.dart'; import 'core/service/pharmacies_service.dart'; import 'core/service/insurance_service.dart'; import 'core/viewModels/insurance_card_View_model.dart'; +import 'core/viewModels/pharmacyModule/brand_view_model.dart'; +import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'core/viewModels/pharmacyModule/review_view_model.dart'; +import 'core/viewModels/pharmacyModule/wishlist_view_model.dart'; +import 'core/viewModels/qr_view_model.dart'; +import 'core/viewModels/vaccine_view_model.dart'; +import 'core/service/vaccine_service.dart'; +import 'core/viewModels/weather/weather_view_model.dart'; +import 'services/pharmacy_services/brands_service.dart'; +import 'services/pharmacy_services/product_detail_service.dart'; import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; +import 'core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart'; +import 'core/viewModels/pharmacyModule/lacum-viewmodel.dart'; import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'core/viewModels/pharmacyModule/tems-condition-viewmodel.dart'; +import 'core/viewModels/pharmacy_categorise_view_model.dart'; import 'core/viewModels/qr_view_model.dart'; import 'core/viewModels/vaccine_view_model.dart'; import 'core/service/vaccine_service.dart'; +import 'services/pharmacy_services/orderDetails_service.dart'; +import 'services/pharmacy_services/pharmacyAddress_service.dart'; GetIt locator = GetIt.instance; @@ -125,6 +158,7 @@ void setupLocator() { locator.registerLazySingleton(() => EReferralService()); locator.registerLazySingleton(() => HomeHealthCareService()); locator.registerLazySingleton(() => CMCService()); + locator.registerLazySingleton(() => PatientSickLeaveService()); locator.registerLazySingleton(() => MyBalanceService()); locator.registerLazySingleton(() => BloodSugarService()); @@ -137,6 +171,7 @@ void setupLocator() { locator.registerLazySingleton(() => FindusService()); locator.registerLazySingleton(() => LiveChatService()); locator.registerLazySingleton(() => H2OService()); + locator.registerLazySingleton(() => BloodDonationService()); locator.registerLazySingleton(() => BloodDetailsService()); locator.registerLazySingleton(() => ChildVaccinesService()); @@ -145,10 +180,30 @@ void setupLocator() { locator.registerLazySingleton(() => DeleteBabyService()); locator.registerLazySingleton(() => VaccinationTableService()); + + //pharmacy + locator.registerLazySingleton(() => PharmacyCategoriseService()); + locator.registerLazySingleton(() => OffersCategoriseService()); + locator.registerLazySingleton(() => NotificationService()); - locator.registerLazySingleton(() => PrivilegeService()); locator.registerLazySingleton(() => PharmacyModuleService()); + locator.registerLazySingleton(() => WishListService()); + locator.registerLazySingleton(() => ReviewService()); + locator.registerLazySingleton(() => BrandsService()); + locator.registerLazySingleton(() => ProductDetailService()); + locator.registerLazySingleton(() => OrderPreviewService()); + locator.registerLazySingleton(() => LacumService()); + locator.registerLazySingleton(() => LacumTransferService()); + locator.registerLazySingleton(() => LacumRegistrationService()); + locator.registerLazySingleton(() => OrderService()); + locator.registerLazySingleton(() => PharmacyAddressService()); + locator.registerLazySingleton(() => OrderDetailsService()); + locator.registerLazySingleton(() => CustomerAddressesService()); + locator.registerLazySingleton(() => TermsConditionService()); + locator.registerLazySingleton(() => CancelOrderService()); + locator.registerLazySingleton(() => PrivilegeService()); + locator.registerLazySingleton(() => WeatherService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -179,6 +234,10 @@ void setupLocator() { locator.registerFactory(() => ChildVaccinesViewModel()); locator.registerFactory(() => UserInformationViewModel()); locator.registerFactory(() => VaccinationTableViewModel()); + locator.registerFactory(() => OrderModelViewModel()); + locator.registerFactory(() => PharmacyAddressesViewModel()); + locator.registerFactory(() => TermsConditionViewModel()); + locator.registerFactory(() => AddNewChildViewModel()); locator.registerFactory(() => H2OViewModel()); locator.registerFactory(() => BloodSugarViewMode()); @@ -194,7 +253,21 @@ void setupLocator() { locator.registerFactory(() => NotificationViewModel()); locator.registerFactory(() => PharmacyModuleViewModel()); + locator.registerFactory(() => WishListViewModel()); + locator.registerFactory(() => ReviewViewModel()); + locator.registerFactory(() => BrandsViewModel()); + locator.registerFactory(() => ProductDetailViewModel()); + locator.registerFactory(() => WeatherViewModel()); + + locator.registerFactory(() => OrderPreviewViewModel()); + locator.registerFactory(() => LacumViewModel()); + locator.registerFactory(() => LacumTranferViewModel()); + locator.registerFactory(() => LacumRegistrationViewModel()); + + //pharmacy + locator.registerFactory(() => PharmacyCategoriseViewModel()); + locator.registerFactory(() => OffersCategoriseViewModel()); // Offer And Packages //---------------------- diff --git a/lib/main.dart b/lib/main.dart index 9c415db5..fe129e01 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,6 +19,7 @@ import 'core/model/geofencing/requests/GeoZonesRequestModel.dart'; import 'core/service/geofencing/GeofencingServices.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; +import 'pages/pharmacies/compare-list.dart'; void main() async { setupLocator(); @@ -53,10 +54,13 @@ class MyApp extends StatelessWidget { StreamProvider.value( value: RobotProvider().intStream(), initialData: RobotProvider().setValue({}), - ) + ), + ChangeNotifierProvider( + create: (context) => CompareList()), ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( + showSemanticsDebugger: false, title: 'Diplomatic Quarter App', locale: projectProvider.appLocal, @@ -82,6 +86,11 @@ 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(0xffE9E9E9), // Colors.grey[100], diff --git a/lib/models/id-name-pair.dart b/lib/models/id-name-pair.dart new file mode 100644 index 00000000..00336572 --- /dev/null +++ b/lib/models/id-name-pair.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class IdNamePair with ChangeNotifier{ + var id; + var name; + + IdNamePair(this.id, this.name); + + void updateData() { + notifyListeners(); + } +} \ No newline at end of file diff --git a/lib/models/pharmacy/Wishlist.dart b/lib/models/pharmacy/Wishlist.dart new file mode 100644 index 00000000..41704ede --- /dev/null +++ b/lib/models/pharmacy/Wishlist.dart @@ -0,0 +1,881 @@ +// To parse this JSON data, do +// +// final wishlist = wishlistFromJson(jsonString); + +import 'dart:convert'; + +List wishlistFromJson(String str) => List.from(json.decode(str).map((x) => Wishlist.fromJson(x))); + +String wishlistToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class Wishlist { + Wishlist({ + this.languageId, + this.id, + this.productAttributes, + this.customerEnteredPrice, + this.quantity, + this.discountAmountInclTax, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.currency, + this.currencyn, + this.rentalStartDateUtc, + this.rentalEndDateUtc, + this.createdOnUtc, + this.updatedOnUtc, + this.shoppingCartType, + this.productId, + this.product, + this.customerId, + this.customer, + }); + + dynamic languageId; + dynamic id; + List productAttributes; + dynamic customerEnteredPrice; + dynamic quantity; + dynamic discountAmountInclTax; + dynamic subtotal; + dynamic subtotalWithVat; + dynamic subtotalVatAmount; + dynamic subtotalVatRate; + dynamic currency; + dynamic currencyn; + dynamic rentalStartDateUtc; + dynamic rentalEndDateUtc; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic shoppingCartType; + dynamic productId; + dynamic product; + dynamic customerId; + Customer customer; + + factory Wishlist.fromJson(Map json) => Wishlist( + languageId: json["language_id"], + id: json["id"], + productAttributes: List.from(json["product_attributes"].map((x) => x)), + customerEnteredPrice: json["customer_entered_price"], + quantity: json["quantity"], + discountAmountInclTax: json["discount_amount_incl_tax"], + subtotal: json["subtotal"], + subtotalWithVat: json["subtotal_with_vat"], + subtotalVatAmount: json["subtotal_vat_amount"], + subtotalVatRate: json["subtotal_vat_rate"], + currency: json["currency"], + currencyn: json["currencyn"], + rentalStartDateUtc: json["rental_start_date_utc"], + rentalEndDateUtc: json["rental_end_date_utc"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + shoppingCartType: json["shopping_cart_type"], + productId: json["product_id"], + product: Product.fromJson(json["product"]), + customerId: json["customer_id"], + customer: Customer.fromJson(json["customer"]), + ); + + Map toJson() => { + "language_id": languageId, + "id": id, + "product_attributes": List.from(productAttributes.map((x) => x)), + "customer_entered_price": customerEnteredPrice, + "quantity": quantity, + "discount_amount_incl_tax": discountAmountInclTax, + "subtotal": subtotal, + "subtotal_with_vat": subtotalWithVat, + "subtotal_vat_amount": subtotalVatAmount, + "subtotal_vat_rate": subtotalVatRate, + "currency": currency, + "currencyn": currencyn, + "rental_start_date_utc": rentalStartDateUtc, + "rental_end_date_utc": rentalEndDateUtc, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "shopping_cart_type": shoppingCartType, + "product_id": productId, + "product": product.toJson(), + "customer_id": customerId, + "customer": customer.toJson(), + }; +} + +class Customer { + Customer({ + this.billingAddress, + this.shippingAddress, + this.addresses, + 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, + this.roleIds, + }); + + Address billingAddress; + Address shippingAddress; + List
addresses; + String id; + String username; + String email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + bool isTaxExempt; + bool hasShoppingCartItems; + bool active; + bool deleted; + bool isSystemAccount; + dynamic systemName; + String lastIpAddress; + DateTime createdOnUtc; + DateTime lastLoginDateUtc; + DateTime lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory Customer.fromJson(Map json) => Customer( + billingAddress: Address.fromJson(json["billing_address"]), + shippingAddress: Address.fromJson(json["shipping_address"]), + addresses: List
.from(json["addresses"].map((x) => Address.fromJson(x))), + 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: DateTime.parse(json["created_on_utc"]), + lastLoginDateUtc: DateTime.parse(json["last_login_date_utc"]), + lastActivityDateUtc: DateTime.parse(json["last_activity_date_utc"]), + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "billing_address": billingAddress.toJson(), + "shipping_address": shippingAddress.toJson(), + "addresses": List.from(addresses.map((x) => x.toJson())), + "id": id, + "username": username, + "email": email, + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc.toIso8601String(), + "last_login_date_utc": lastLoginDateUtc.toIso8601String(), + "last_activity_date_utc": lastActivityDateUtc.toIso8601String(), + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +class Address { + Address({ + 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, + }); + + String id; + FirstName firstName; + LastName lastName; + Email email; + dynamic company; + dynamic countryId; + Country country; + dynamic stateProvinceId; + City city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + dynamic faxNumber; + String customerAttributes; + DateTime createdOnUtc; + dynamic province; + String latLong; + + factory Address.fromJson(Map json) => Address( + id: json["id"], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[json["last_name"]], + email: emailValues.map[json["email"]], + company: json["company"], + countryId: json["country_id"], + country: countryValues.map[json["country"]], + stateProvinceId: json["state_province_id"], + city: cityValues.map[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: DateTime.parse(json["created_on_utc"]), + province: json["province"], + latLong: json["lat_long"], + ); + + Map toJson() => { + "id": id, + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[lastName], + "email": emailValues.reverse[email], + "company": company, + "country_id": countryId, + "country": countryValues.reverse[country], + "state_province_id": stateProvinceId, + "city": cityValues.reverse[city], + "address1": address1, + "address2": address2, + "zip_postal_code": zipPostalCode, + "phone_number": phoneNumber, + "fax_number": faxNumber, + "customer_attributes": customerAttributes, + "created_on_utc": createdOnUtc.toIso8601String(), + "province": province, + "lat_long": latLong, + }; +} + +enum City { RIYADH, AL_OYUN } + +final cityValues = EnumValues({ + "Al Oyun": City.AL_OYUN, + "Riyadh": City.RIYADH +}); + +enum Country { SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA +}); + +enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM } + +final emailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM, + "Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_COM +}); + +enum FirstName { TAMER, TAMER_FANASHEH } + +final firstNameValues = EnumValues({ + "TAMER": FirstName.TAMER, + "TAMER FANASHEH": FirstName.TAMER_FANASHEH +}); + +enum LastName { FANASHEH, MUSA } + +final lastNameValues = EnumValues({ + "FANASHEH": LastName.FANASHEH, + "MUSA": LastName.MUSA +}); + +class Product { + Product({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName, + }); + + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + dynamic oldPrice; + double productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + factory Product.fromJson(Map json) => Product( + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + shortDescription: json["short_description"], + shortDescriptionn: json["short_descriptionn"], + fullDescription: json["full_description"], + fullDescriptionn: json["full_descriptionn"], + markasNew: json["markas_new"], + showOnHomePage: json["show_on_home_page"], + metaKeywords: json["meta_keywords"], + metaDescription: json["meta_description"], + metaTitle: json["meta_title"], + allowCustomerReviews: json["allow_customer_reviews"], + approvedRatingSum: json["approved_rating_sum"], + notApprovedRatingSum: json["not_approved_rating_sum"], + approvedTotalReviews: json["approved_total_reviews"], + notApprovedTotalReviews: json["not_approved_total_reviews"], + sku: json["sku"], + isRx: json["is_rx"], + prescriptionRequired: json["prescription_required"], + rxMessage: json["rx_message"], + rxMessagen: json["rx_messagen"], + manufacturerPartNumber: json["manufacturer_part_number"], + gtin: json["gtin"], + isGiftCard: json["is_gift_card"], + requireOtherProducts: json["require_other_products"], + automaticallyAddRequiredProducts: json["automatically_add_required_products"], + isDownload: json["is_download"], + unlimitedDownloads: json["unlimited_downloads"], + maxNumberOfDownloads: json["max_number_of_downloads"], + downloadExpirationDays: json["download_expiration_days"], + hasSampleDownload: json["has_sample_download"], + hasUserAgreement: json["has_user_agreement"], + isRecurring: json["is_recurring"], + recurringCycleLength: json["recurring_cycle_length"], + recurringTotalCycles: json["recurring_total_cycles"], + isRental: json["is_rental"], + rentalPriceLength: json["rental_price_length"], + isShipEnabled: json["is_ship_enabled"], + isFreeShipping: json["is_free_shipping"], + shipSeparately: json["ship_separately"], + additionalShippingCharge: json["additional_shipping_charge"], + isTaxExempt: json["is_tax_exempt"], + isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], + useMultipleWarehouses: json["use_multiple_warehouses"], + manageInventoryMethodId: json["manage_inventory_method_id"], + stockQuantity: json["stock_quantity"], + stockAvailability: json["stock_availability"], + stockAvailabilityn: json["stock_availabilityn"], + displayStockAvailability: json["display_stock_availability"], + displayStockQuantity: json["display_stock_quantity"], + minStockQuantity: json["min_stock_quantity"], + notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], + allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], + orderMinimumQuantity: json["order_minimum_quantity"], + orderMaximumQuantity: json["order_maximum_quantity"], + allowedQuantities: json["allowed_quantities"], + allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], + disableBuyButton: json["disable_buy_button"], + disableWishlistButton: json["disable_wishlist_button"], + availableForPreOrder: json["available_for_pre_order"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], + callForPrice: json["call_for_price"], + price: json["price"].toDouble(), + oldPrice: json["old_price"], + productCost: json["product_cost"].toDouble(), + specialPrice: json["special_price"], + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + customerEntersPrice: json["customer_enters_price"], + minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], + maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], + basepriceEnabled: json["baseprice_enabled"], + basepriceAmount: json["baseprice_amount"], + basepriceBaseAmount: json["baseprice_base_amount"], + hasTierPrices: json["has_tier_prices"], + hasDiscountsApplied: json["has_discounts_applied"], + discountName: json["discount_name"], + discountNamen: json["discount_namen"], + discountDescription: json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"], + currency: json["currency"], + currencyn: json["currencyn"], + weight: json["weight"].toDouble(), + length: json["length"], + width: json["width"], + height: json["height"], + availableStartDateTimeUtc: json["available_start_date_time_utc"], + availableEndDateTimeUtc: json["available_end_date_time_utc"], + displayOrder: json["display_order"], + published: json["published"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + productType: json["product_type"], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + discountIds: List.from(json["discount_ids"].map((x) => x)), + storeIds: List.from(json["store_ids"].map((x) => x)), + manufacturerIds: List.from(json["manufacturer_ids"].map((x) => x)), + reviews: List.from(json["reviews"].map((x) => x)), + images: List.from(json["images"].map((x) => Image.fromJson(x))), + attributes: List.from(json["attributes"].map((x) => x)), + specifications: List.from(json["specifications"].map((x) => Specification.fromJson(x))), + associatedProductIds: List.from(json["associated_product_ids"].map((x) => x)), + tags: List.from(json["tags"].map((x) => x)), + vendorId: json["vendor_id"], + seName: json["se_name"], + ); + + Map toJson() => { + "id": id, + "visible_individually": visibleIndividually, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "short_description": shortDescription, + "short_descriptionn": shortDescriptionn, + "full_description": fullDescription, + "full_descriptionn": fullDescriptionn, + "markas_new": markasNew, + "show_on_home_page": showOnHomePage, + "meta_keywords": metaKeywords, + "meta_description": metaDescription, + "meta_title": metaTitle, + "allow_customer_reviews": allowCustomerReviews, + "approved_rating_sum": approvedRatingSum, + "not_approved_rating_sum": notApprovedRatingSum, + "approved_total_reviews": approvedTotalReviews, + "not_approved_total_reviews": notApprovedTotalReviews, + "sku": sku, + "is_rx": isRx, + "prescription_required": prescriptionRequired, + "rx_message": rxMessage, + "rx_messagen": rxMessagen, + "manufacturer_part_number": manufacturerPartNumber, + "gtin": gtin, + "is_gift_card": isGiftCard, + "require_other_products": requireOtherProducts, + "automatically_add_required_products": automaticallyAddRequiredProducts, + "is_download": isDownload, + "unlimited_downloads": unlimitedDownloads, + "max_number_of_downloads": maxNumberOfDownloads, + "download_expiration_days": downloadExpirationDays, + "has_sample_download": hasSampleDownload, + "has_user_agreement": hasUserAgreement, + "is_recurring": isRecurring, + "recurring_cycle_length": recurringCycleLength, + "recurring_total_cycles": recurringTotalCycles, + "is_rental": isRental, + "rental_price_length": rentalPriceLength, + "is_ship_enabled": isShipEnabled, + "is_free_shipping": isFreeShipping, + "ship_separately": shipSeparately, + "additional_shipping_charge": additionalShippingCharge, + "is_tax_exempt": isTaxExempt, + "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, + "use_multiple_warehouses": useMultipleWarehouses, + "manage_inventory_method_id": manageInventoryMethodId, + "stock_quantity": stockQuantity, + "stock_availability": stockAvailability, + "stock_availabilityn": stockAvailabilityn, + "display_stock_availability": displayStockAvailability, + "display_stock_quantity": displayStockQuantity, + "min_stock_quantity": minStockQuantity, + "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, + "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, + "order_minimum_quantity": orderMinimumQuantity, + "order_maximum_quantity": orderMaximumQuantity, + "allowed_quantities": allowedQuantities, + "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, + "disable_buy_button": disableBuyButton, + "disable_wishlist_button": disableWishlistButton, + "available_for_pre_order": availableForPreOrder, + "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, + "call_for_price": callForPrice, + "price": price, + "old_price": oldPrice, + "product_cost": productCost, + "special_price": specialPrice, + "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, + "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, + "customer_enters_price": customerEntersPrice, + "minimum_customer_entered_price": minimumCustomerEnteredPrice, + "maximum_customer_entered_price": maximumCustomerEnteredPrice, + "baseprice_enabled": basepriceEnabled, + "baseprice_amount": basepriceAmount, + "baseprice_base_amount": basepriceBaseAmount, + "has_tier_prices": hasTierPrices, + "has_discounts_applied": hasDiscountsApplied, + "discount_name": discountName, + "discount_namen": discountNamen, + "discount_description": discountDescription, + "discount_Descriptionn": discountDescriptionn, + "discount_percentage": discountPercentage, + "currency": currency, + "currencyn": currencyn, + "weight": weight, + "length": length, + "width": width, + "height": height, + "available_start_date_time_utc": availableStartDateTimeUtc, + "available_end_date_time_utc": availableEndDateTimeUtc, + "display_order": displayOrder, + "published": published, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "product_type": productType, + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": List.from(roleIds.map((x) => x)), + "discount_ids": List.from(discountIds.map((x) => x)), + "store_ids": List.from(storeIds.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), + "reviews": List.from(reviews.map((x) => x)), + "images": List.from(images.map((x) => x.toJson())), + "attributes": List.from(attributes.map((x) => x)), + "specifications": List.from(specifications.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds.map((x) => x)), + "tags": List.from(tags.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; +} + +class Image { + Image({ + this.id, + this.position, + this.src, + this.thumb, + this.attachment, + }); + + dynamic id; + dynamic position; + String src; + String thumb; + String attachment; + + factory Image.fromJson(Map json) => Image( + id: json["id"], + position: json["position"], + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "id": id, + "position": position, + "src": src, + "thumb": thumb, + "attachment": attachment, + }; +} + +class LocalizedName { + LocalizedName({ + this.languageId, + this.localizedName, + }); + + dynamic languageId; + String localizedName; + + factory LocalizedName.fromJson(Map json) => LocalizedName( + languageId: json["language_id"], + localizedName: json["localized_name"], + ); + + Map toJson() => { + "language_id": languageId, + "localized_name": localizedName, + }; +} + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + dynamic id; + dynamic displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: json["name"], + nameN: json["nameN"], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": name, + "nameN": nameN, + }; +} + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/models/pharmacy/addToCartModel.dart b/lib/models/pharmacy/addToCartModel.dart new file mode 100644 index 00000000..3253e6f7 --- /dev/null +++ b/lib/models/pharmacy/addToCartModel.dart @@ -0,0 +1,924 @@ +// To parse this JSON data, do +// +// final shoppingCart = shoppingCartFromJson(jsonString); + +import 'dart:convert'; + +ShoppingCart shoppingCartFromJson(String str) => ShoppingCart.fromJson(json.decode(str)); + +String shoppingCartToJson(ShoppingCart data) => json.encode(data.toJson()); + +class ShoppingCart { + ShoppingCart({ + this.itemCount, + this.quantityCount, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.shoppingCarts, + }); + + int itemCount; + int quantityCount; + double subtotal; + double subtotalWithVat; + double subtotalVatAmount; + int subtotalVatRate; + List shoppingCarts; + + factory ShoppingCart.fromJson(Map json) => ShoppingCart( + itemCount: json["item_count"], + quantityCount: json["quantity_count"], + subtotal: json["subtotal"].toDouble(), + subtotalWithVat: json["subtotal_with_vat"].toDouble(), + subtotalVatAmount: json["subtotal_vat_amount"].toDouble(), + subtotalVatRate: json["subtotal_vat_rate"], + shoppingCarts: List.from(json["shopping_carts"].map((x) => ShoppingCartElement.fromJson(x))), + ); + + Map toJson() => { + "item_count": itemCount, + "quantity_count": quantityCount, + "subtotal": subtotal, + "subtotal_with_vat": subtotalWithVat, + "subtotal_vat_amount": subtotalVatAmount, + "subtotal_vat_rate": subtotalVatRate, + "shopping_carts": List.from(shoppingCarts.map((x) => x.toJson())), + }; +} + +class ShoppingCartElement { + ShoppingCartElement({ + this.languageId, + this.id, + this.productAttributes, + this.customerEnteredPrice, + this.quantity, + this.discountAmountInclTax, + this.subtotal, + this.subtotalWithVat, + this.subtotalVatAmount, + this.subtotalVatRate, + this.currency, + this.currencyn, + this.rentalStartDateUtc, + this.rentalEndDateUtc, + this.createdOnUtc, + this.updatedOnUtc, + this.shoppingCartType, + this.productId, + this.product, + this.customerId, + this.customer, + }); + + int languageId; + String id; + List productAttributes; + int customerEnteredPrice; + int quantity; + dynamic discountAmountInclTax; + String subtotal; + String subtotalWithVat; + String subtotalVatAmount; + String subtotalVatRate; + String currency; + String currencyn; + dynamic rentalStartDateUtc; + dynamic rentalEndDateUtc; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String shoppingCartType; + int productId; + Product product; + int customerId; + Customer customer; + + factory ShoppingCartElement.fromJson(Map json) => ShoppingCartElement( + languageId: json["language_id"], + id: json["id"], + productAttributes: List.from(json["product_attributes"].map((x) => x)), + customerEnteredPrice: json["customer_entered_price"], + quantity: json["quantity"], + discountAmountInclTax: json["discount_amount_incl_tax"], + subtotal: json["subtotal"], + subtotalWithVat: json["subtotal_with_vat"], + subtotalVatAmount: json["subtotal_vat_amount"], + subtotalVatRate: json["subtotal_vat_rate"], + currency: json["currency"], + currencyn: json["currencyn"], + rentalStartDateUtc: json["rental_start_date_utc"], + rentalEndDateUtc: json["rental_end_date_utc"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + shoppingCartType: json["shopping_cart_type"], + productId: json["product_id"], + product: Product.fromJson(json["product"]), + customerId: json["customer_id"], + customer: Customer.fromJson(json["customer"]), + ); + + Map toJson() => { + "language_id": languageId, + "id": id, + "product_attributes": List.from(productAttributes.map((x) => x)), + "customer_entered_price": customerEnteredPrice, + "quantity": quantity, + "discount_amount_incl_tax": discountAmountInclTax, + "subtotal": subtotal, + "subtotal_with_vat": subtotalWithVat, + "subtotal_vat_amount": subtotalVatAmount, + "subtotal_vat_rate": subtotalVatRate, + "currency": currency, + "currencyn": currencyn, + "rental_start_date_utc": rentalStartDateUtc, + "rental_end_date_utc": rentalEndDateUtc, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "shopping_cart_type": shoppingCartType, + "product_id": productId, + "product": product.toJson(), + "customer_id": customerId, + "customer": customer.toJson(), + }; +} + +class Customer { + Customer({ + this.billingAddress, + this.shippingAddress, + this.addresses, + 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, + this.roleIds, + }); + + Address billingAddress; + Address shippingAddress; + List
addresses; + String id; + String username; + String email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + bool isTaxExempt; + bool hasShoppingCartItems; + bool active; + bool deleted; + bool isSystemAccount; + dynamic systemName; + String lastIpAddress; + DateTime createdOnUtc; + DateTime lastLoginDateUtc; + DateTime lastActivityDateUtc; + int registeredInStoreId; + List roleIds; + + factory Customer.fromJson(Map json) => Customer( + billingAddress: Address.fromJson(json["billing_address"]), + shippingAddress: Address.fromJson(json["shipping_address"]), + addresses: List
.from(json["addresses"].map((x) => Address.fromJson(x))), + 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: DateTime.parse(json["created_on_utc"]), + lastLoginDateUtc: DateTime.parse(json["last_login_date_utc"]), + lastActivityDateUtc: DateTime.parse(json["last_activity_date_utc"]), + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "billing_address": billingAddress.toJson(), + "shipping_address": shippingAddress.toJson(), + "addresses": List.from(addresses.map((x) => x.toJson())), + "id": id, + "username": username, + "email": email, + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc.toIso8601String(), + "last_login_date_utc": lastLoginDateUtc.toIso8601String(), + "last_activity_date_utc": lastActivityDateUtc.toIso8601String(), + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +class Address { + Address({ + 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, + }); + + String id; + FirstName firstName; + LastName lastName; + Email email; + dynamic company; + int countryId; + Country country; + dynamic stateProvinceId; + City city; + String address1; + String address2; + String zipPostalCode; + String phoneNumber; + dynamic faxNumber; + String customerAttributes; + DateTime createdOnUtc; + dynamic province; + String latLong; + + factory Address.fromJson(Map json) => Address( + id: json["id"], + firstName: firstNameValues.map[json["first_name"]], + lastName: lastNameValues.map[json["last_name"]], + email: emailValues.map[json["email"]], + company: json["company"], + countryId: json["country_id"], + country: countryValues.map[json["country"]], + stateProvinceId: json["state_province_id"], + city: cityValues.map[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: DateTime.parse(json["created_on_utc"]), + province: json["province"], + latLong: json["lat_long"], + ); + + Map toJson() => { + "id": id, + "first_name": firstNameValues.reverse[firstName], + "last_name": lastNameValues.reverse[lastName], + "email": emailValues.reverse[email], + "company": company, + "country_id": countryId, + "country": countryValues.reverse[country], + "state_province_id": stateProvinceId, + "city": cityValues.reverse[city], + "address1": address1, + "address2": address2, + "zip_postal_code": zipPostalCode, + "phone_number": phoneNumber, + "fax_number": faxNumber, + "customer_attributes": customerAttributes, + "created_on_utc": createdOnUtc.toIso8601String(), + "province": province, + "lat_long": latLong, + }; +} + +enum City { CALIFORNIA, RIYADH, AL_OYUN } + +final cityValues = EnumValues({ + "Al Oyun": City.AL_OYUN, + "California": City.CALIFORNIA, + "Riyadh": City.RIYADH +}); + +enum Country { UNITED_STATES, SAUDI_ARABIA } + +final countryValues = EnumValues({ + "Saudi Arabia": Country.SAUDI_ARABIA, + "United States": Country.UNITED_STATES +}); + +enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM, TAMER_F_CLOUDSOLUTION_SA_COM } + +final emailValues = EnumValues({ + "Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM, + "Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_COM, + "Tamer.F@cloudsolution-sa.com": Email.TAMER_F_CLOUDSOLUTION_SA_COM +}); + +enum FirstName { TAMER, TAMER_FANASHEH } + +final firstNameValues = EnumValues({ + "TAMER": FirstName.TAMER, + "TAMER FANASHEH": FirstName.TAMER_FANASHEH +}); + +enum LastName { FANASHEH, MUSA } + +final lastNameValues = EnumValues({ + "FANASHEH": LastName.FANASHEH, + "MUSA": LastName.MUSA +}); + +class Product { + Product({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName, + }); + + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + String metaKeywords; + String metaDescription; + String metaTitle; + bool allowCustomerReviews; + int approvedRatingSum; + int notApprovedRatingSum; + int approvedTotalReviews; + int notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + int maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + int recurringCycleLength; + int recurringTotalCycles; + bool isRental; + int rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + int additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + int manageInventoryMethodId; + int stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + int minStockQuantity; + int notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + int orderMinimumQuantity; + int orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + int oldPrice; + double productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + int minimumCustomerEnteredPrice; + int maximumCustomerEnteredPrice; + bool basepriceEnabled; + int basepriceAmount; + int basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + int length; + int width; + int height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + int displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String productType; + int parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + int vendorId; + String seName; + + factory Product.fromJson(Map json) => Product( + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + shortDescription: json["short_description"], + shortDescriptionn: json["short_descriptionn"], + fullDescription: json["full_description"], + fullDescriptionn: json["full_descriptionn"], + markasNew: json["markas_new"], + showOnHomePage: json["show_on_home_page"], + metaKeywords: json["meta_keywords"] == null ? null : json["meta_keywords"], + metaDescription: json["meta_description"] == null ? null : json["meta_description"], + metaTitle: json["meta_title"] == null ? null : json["meta_title"], + allowCustomerReviews: json["allow_customer_reviews"], + approvedRatingSum: json["approved_rating_sum"], + notApprovedRatingSum: json["not_approved_rating_sum"], + approvedTotalReviews: json["approved_total_reviews"], + notApprovedTotalReviews: json["not_approved_total_reviews"], + sku: json["sku"], + isRx: json["is_rx"], + prescriptionRequired: json["prescription_required"], + rxMessage: json["rx_message"], + rxMessagen: json["rx_messagen"], + manufacturerPartNumber: json["manufacturer_part_number"], + gtin: json["gtin"], + isGiftCard: json["is_gift_card"], + requireOtherProducts: json["require_other_products"], + automaticallyAddRequiredProducts: json["automatically_add_required_products"], + isDownload: json["is_download"], + unlimitedDownloads: json["unlimited_downloads"], + maxNumberOfDownloads: json["max_number_of_downloads"], + downloadExpirationDays: json["download_expiration_days"], + hasSampleDownload: json["has_sample_download"], + hasUserAgreement: json["has_user_agreement"], + isRecurring: json["is_recurring"], + recurringCycleLength: json["recurring_cycle_length"], + recurringTotalCycles: json["recurring_total_cycles"], + isRental: json["is_rental"], + rentalPriceLength: json["rental_price_length"], + isShipEnabled: json["is_ship_enabled"], + isFreeShipping: json["is_free_shipping"], + shipSeparately: json["ship_separately"], + additionalShippingCharge: json["additional_shipping_charge"], + isTaxExempt: json["is_tax_exempt"], + isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], + useMultipleWarehouses: json["use_multiple_warehouses"], + manageInventoryMethodId: json["manage_inventory_method_id"], + stockQuantity: json["stock_quantity"], + stockAvailability: json["stock_availability"], + stockAvailabilityn: json["stock_availabilityn"], + displayStockAvailability: json["display_stock_availability"], + displayStockQuantity: json["display_stock_quantity"], + minStockQuantity: json["min_stock_quantity"], + notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], + allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], + orderMinimumQuantity: json["order_minimum_quantity"], + orderMaximumQuantity: json["order_maximum_quantity"], + allowedQuantities: json["allowed_quantities"], + allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], + disableBuyButton: json["disable_buy_button"], + disableWishlistButton: json["disable_wishlist_button"], + availableForPreOrder: json["available_for_pre_order"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], + callForPrice: json["call_for_price"], + price: json["price"].toDouble(), + oldPrice: json["old_price"], + productCost: json["product_cost"].toDouble(), + specialPrice: json["special_price"], + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + customerEntersPrice: json["customer_enters_price"], + minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], + maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], + basepriceEnabled: json["baseprice_enabled"], + basepriceAmount: json["baseprice_amount"], + basepriceBaseAmount: json["baseprice_base_amount"], + hasTierPrices: json["has_tier_prices"], + hasDiscountsApplied: json["has_discounts_applied"], + discountName: json["discount_name"], + discountNamen: json["discount_namen"], + discountDescription: json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"], + currency: json["currency"], + currencyn: json["currencyn"], + weight: json["weight"].toDouble(), + length: json["length"], + width: json["width"], + height: json["height"], + availableStartDateTimeUtc: json["available_start_date_time_utc"], + availableEndDateTimeUtc: json["available_end_date_time_utc"], + displayOrder: json["display_order"], + published: json["published"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + productType: json["product_type"], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + discountIds: List.from(json["discount_ids"].map((x) => x)), + storeIds: List.from(json["store_ids"].map((x) => x)), + manufacturerIds: List.from(json["manufacturer_ids"].map((x) => x)), + reviews: List.from(json["reviews"].map((x) => x)), + images: List.from(json["images"].map((x) => Image.fromJson(x))), + attributes: List.from(json["attributes"].map((x) => x)), + specifications: List.from(json["specifications"].map((x) => Specification.fromJson(x))), + associatedProductIds: List.from(json["associated_product_ids"].map((x) => x)), + tags: List.from(json["tags"].map((x) => x)), + vendorId: json["vendor_id"], + seName: json["se_name"], + ); + + Map toJson() => { + "id": id, + "visible_individually": visibleIndividually, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "short_description": shortDescription, + "short_descriptionn": shortDescriptionn, + "full_description": fullDescription, + "full_descriptionn": fullDescriptionn, + "markas_new": markasNew, + "show_on_home_page": showOnHomePage, + "meta_keywords": metaKeywords == null ? null : metaKeywords, + "meta_description": metaDescription == null ? null : metaDescription, + "meta_title": metaTitle == null ? null : metaTitle, + "allow_customer_reviews": allowCustomerReviews, + "approved_rating_sum": approvedRatingSum, + "not_approved_rating_sum": notApprovedRatingSum, + "approved_total_reviews": approvedTotalReviews, + "not_approved_total_reviews": notApprovedTotalReviews, + "sku": sku, + "is_rx": isRx, + "prescription_required": prescriptionRequired, + "rx_message": rxMessage, + "rx_messagen": rxMessagen, + "manufacturer_part_number": manufacturerPartNumber, + "gtin": gtin, + "is_gift_card": isGiftCard, + "require_other_products": requireOtherProducts, + "automatically_add_required_products": automaticallyAddRequiredProducts, + "is_download": isDownload, + "unlimited_downloads": unlimitedDownloads, + "max_number_of_downloads": maxNumberOfDownloads, + "download_expiration_days": downloadExpirationDays, + "has_sample_download": hasSampleDownload, + "has_user_agreement": hasUserAgreement, + "is_recurring": isRecurring, + "recurring_cycle_length": recurringCycleLength, + "recurring_total_cycles": recurringTotalCycles, + "is_rental": isRental, + "rental_price_length": rentalPriceLength, + "is_ship_enabled": isShipEnabled, + "is_free_shipping": isFreeShipping, + "ship_separately": shipSeparately, + "additional_shipping_charge": additionalShippingCharge, + "is_tax_exempt": isTaxExempt, + "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, + "use_multiple_warehouses": useMultipleWarehouses, + "manage_inventory_method_id": manageInventoryMethodId, + "stock_quantity": stockQuantity, + "stock_availability": stockAvailability, + "stock_availabilityn": stockAvailabilityn, + "display_stock_availability": displayStockAvailability, + "display_stock_quantity": displayStockQuantity, + "min_stock_quantity": minStockQuantity, + "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, + "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, + "order_minimum_quantity": orderMinimumQuantity, + "order_maximum_quantity": orderMaximumQuantity, + "allowed_quantities": allowedQuantities, + "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, + "disable_buy_button": disableBuyButton, + "disable_wishlist_button": disableWishlistButton, + "available_for_pre_order": availableForPreOrder, + "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, + "call_for_price": callForPrice, + "price": price, + "old_price": oldPrice, + "product_cost": productCost, + "special_price": specialPrice, + "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, + "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, + "customer_enters_price": customerEntersPrice, + "minimum_customer_entered_price": minimumCustomerEnteredPrice, + "maximum_customer_entered_price": maximumCustomerEnteredPrice, + "baseprice_enabled": basepriceEnabled, + "baseprice_amount": basepriceAmount, + "baseprice_base_amount": basepriceBaseAmount, + "has_tier_prices": hasTierPrices, + "has_discounts_applied": hasDiscountsApplied, + "discount_name": discountName, + "discount_namen": discountNamen, + "discount_description": discountDescription, + "discount_Descriptionn": discountDescriptionn, + "discount_percentage": discountPercentage, + "currency": currency, + "currencyn": currencyn, + "weight": weight, + "length": length, + "width": width, + "height": height, + "available_start_date_time_utc": availableStartDateTimeUtc, + "available_end_date_time_utc": availableEndDateTimeUtc, + "display_order": displayOrder, + "published": published, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "product_type": productType, + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": List.from(roleIds.map((x) => x)), + "discount_ids": List.from(discountIds.map((x) => x)), + "store_ids": List.from(storeIds.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), + "reviews": List.from(reviews.map((x) => x)), + "images": List.from(images.map((x) => x.toJson())), + "attributes": List.from(attributes.map((x) => x)), + "specifications": List.from(specifications.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds.map((x) => x)), + "tags": List.from(tags.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; +} + +class Image { + Image({ + this.id, + this.position, + this.src, + this.thumb, + this.attachment, + }); + + int id; + int position; + String src; + String thumb; + String attachment; + + factory Image.fromJson(Map json) => Image( + id: json["id"], + position: json["position"], + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "id": id, + "position": position, + "src": src, + "thumb": thumb, + "attachment": attachment, + }; +} + +class LocalizedName { + LocalizedName({ + this.languageId, + this.localizedName, + }); + + int languageId; + String localizedName; + + factory LocalizedName.fromJson(Map json) => LocalizedName( + languageId: json["language_id"], + localizedName: json["localized_name"], + ); + + Map toJson() => { + "language_id": languageId, + "localized_name": localizedName, + }; +} + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: json["name"], + nameN: json["nameN"], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": name, + "nameN": nameN, + }; +} + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/models/pharmacy/brandModel.dart b/lib/models/pharmacy/brandModel.dart new file mode 100644 index 00000000..2855d492 --- /dev/null +++ b/lib/models/pharmacy/brandModel.dart @@ -0,0 +1,137 @@ +// To parse this JSON data, do +// +// final brand = brandFromJson(jsonString); + +import 'dart:convert'; + +List brandFromJson(String str) => List.from(json.decode(str).map((x) => Brand.fromJson(x))); + +String brandToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class Brand { + Brand({ + 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, + }); + + String id; + String name; + String namen; + List localizedNames; + String description; + int manufacturerTemplateId; + String metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + int pageSize; + String pageSizeOptions; + dynamic priceRanges; + bool published; + bool deleted; + int displayOrder; + DateTime createdOnUtc; + DateTime updatedOnUtc; + Image image; + + factory Brand.fromJson(Map json) => Brand( + id: json["id"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + description: json["description"] == null ? null : 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: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + image: json["image"] == null ? null : Image.fromJson(json["image"]), + ); + + Map toJson() => { + "id": id, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "description": description == null ? null : description, + "manufacturer_template_id": manufacturerTemplateId, + "meta_keywords": metaKeywords, + "meta_description": metaDescription, + "meta_title": metaTitle, + "page_size": pageSize, + "page_size_options": pageSizeOptions, + "price_ranges": priceRanges, + "published": published, + "deleted": deleted, + "display_order": displayOrder, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "image": image == null ? null : image.toJson(), + }; +} + +class Image { + Image({ + this.src, + this.thumb, + this.attachment, + }); + + String src; + dynamic thumb; + dynamic attachment; + + factory Image.fromJson(Map json) => Image( + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "src": src, + "thumb": thumb, + "attachment": attachment, + }; +} + +class LocalizedName { + LocalizedName({ + this.languageId, + this.localizedName, + }); + + int languageId; + String localizedName; + + factory LocalizedName.fromJson(Map json) => LocalizedName( + languageId: json["language_id"], + localizedName: json["localized_name"], + ); + + Map toJson() => { + "language_id": languageId, + "localized_name": localizedName, + }; +} diff --git a/lib/models/pharmacy/locationModel.dart b/lib/models/pharmacy/locationModel.dart new file mode 100644 index 00000000..36ee7350 --- /dev/null +++ b/lib/models/pharmacy/locationModel.dart @@ -0,0 +1,159 @@ +// To parse this JSON data, do +// +// final locationModel = locationModelFromJson(jsonString); + +import 'dart:convert'; + +List locationModelFromJson(String str) => List.from(json.decode(str).map((x) => LocationModel.fromJson(x))); + +String locationModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class LocationModel { + LocationModel({ + this.expiryDate, + this.sellingPrice, + this.quantity, + this.itemId, + this.locationId, + this.projectId, + this.setupId, + this.locationDescription, + this.locationDescriptionN, + this.itemDescription, + this.itemDescriptionN, + this.alias, + this.locationTypeId, + this.barcode, + this.companybarcode, + this.cityId, + this.cityName, + this.distanceInKilometers, + this.latitude, + this.locationType, + this.longitude, + this.phoneNumber, + this.projectImageUrl, + this.sortOrder, + }); + + ExpiryDate expiryDate; + double sellingPrice; + int quantity; + int itemId; + int locationId; + int projectId; + String setupId; + String locationDescription; + dynamic locationDescriptionN; + ItemDescription itemDescription; + dynamic itemDescriptionN; + Alias alias; + int locationTypeId; + int barcode; + dynamic companybarcode; + int cityId; + CityName cityName; + int distanceInKilometers; + String latitude; + int locationType; + String longitude; + String phoneNumber; + String projectImageUrl; + int sortOrder; + + factory LocationModel.fromJson(Map json) => LocationModel( + expiryDate: expiryDateValues.map[json["ExpiryDate"]], + sellingPrice: json["SellingPrice"].toDouble(), + quantity: json["Quantity"], + itemId: json["ItemID"], + locationId: json["LocationID"], + projectId: json["ProjectID"], + setupId: json["SetupID"], + locationDescription: json["LocationDescription"], + locationDescriptionN: json["LocationDescriptionN"], + itemDescription: itemDescriptionValues.map[json["ItemDescription"]], + itemDescriptionN: json["ItemDescriptionN"], + alias: aliasValues.map[json["Alias"]], + locationTypeId: json["LocationTypeID"], + barcode: json["Barcode"], + companybarcode: json["Companybarcode"], + cityId: json["CityID"], + cityName: cityNameValues.map[json["CityName"]], + distanceInKilometers: json["DistanceInKilometers"], + latitude: json["Latitude"], + locationType: json["LocationType"], + longitude: json["Longitude"], + phoneNumber: json["PhoneNumber"], + projectImageUrl: json["ProjectImageURL"], + sortOrder: json["SortOrder"], + ); + + Map toJson() => { + "ExpiryDate": expiryDateValues.reverse[expiryDate], + "SellingPrice": sellingPrice, + "Quantity": quantity, + "ItemID": itemId, + "LocationID": locationId, + "ProjectID": projectId, + "SetupID": setupId, + "LocationDescription": locationDescription, + "LocationDescriptionN": locationDescriptionN, + "ItemDescription": itemDescriptionValues.reverse[itemDescription], + "ItemDescriptionN": itemDescriptionN, + "Alias": aliasValues.reverse[alias], + "LocationTypeID": locationTypeId, + "Barcode": barcode, + "Companybarcode": companybarcode, + "CityID": cityId, + "CityName": cityNameValues.reverse[cityName], + "DistanceInKilometers": distanceInKilometers, + "Latitude": latitude, + "LocationType": locationType, + "Longitude": longitude, + "PhoneNumber": phoneNumber, + "ProjectImageURL": projectImageUrl, + "SortOrder": sortOrder, + }; +} + +enum Alias { CAPSULE } + +final aliasValues = EnumValues({ + "CAPSULE": Alias.CAPSULE +}); + +enum CityName { RIYADH, KHOBAR, QASSIM } + +final cityNameValues = EnumValues({ + "Khobar": CityName.KHOBAR, + "Qassim": CityName.QASSIM, + "Riyadh": CityName.RIYADH +}); + +enum ExpiryDate { DATE_16223220000000300, DATE_16250004000000300, DATE_16538580000000300 } + +final expiryDateValues = EnumValues({ + "/Date(1622322000000+0300)/": ExpiryDate.DATE_16223220000000300, + "/Date(1625000400000+0300)/": ExpiryDate.DATE_16250004000000300, + "/Date(1653858000000+0300)/": ExpiryDate.DATE_16538580000000300 +}); + +enum ItemDescription { XERACTAN_20_MG_CAP_30_S } + +final itemDescriptionValues = EnumValues({ + "XERACTAN 20 MG CAP 30'S": ItemDescription.XERACTAN_20_MG_CAP_30_S +}); + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/models/pharmacy/productDetailModel.dart b/lib/models/pharmacy/productDetailModel.dart new file mode 100644 index 00000000..d2e8f010 --- /dev/null +++ b/lib/models/pharmacy/productDetailModel.dart @@ -0,0 +1,249 @@ +// To parse this JSON data, do +// +// final productDetail = productDetailFromJson(jsonString); + +import 'dart:convert'; + +List productDetailFromJson(String str) => List.from(json.decode(str).map((x) => ProductDetail.fromJson(x))); + +String productDetailToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class ProductDetail { + ProductDetail({ + this.reviews, + }); + + List reviews; + + factory ProductDetail.fromJson(Map json) => ProductDetail( + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + ); + + Map toJson() => { + "reviews": List.from(reviews.map((x) => x.toJson())), + }; +} + +class Review { + Review({ + 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, + }); + + int id; + int position; + int reviewId; + int customerId; + int productId; + int storeId; + bool isApproved; + String title; + String reviewText; + dynamic replyText; + int rating; + int helpfulYesTotal; + int helpfulNoTotal; + DateTime createdOnUtc; + Customer customer; + dynamic product; + + factory Review.fromJson(Map json) => Review( + 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: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"], + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product, + }; +} + +class Customer { + 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, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + int isOutSa; + int patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + String id; + Email username; + Email email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + + factory Customer.fromJson(Map json) => Customer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(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: emailValues.map[json["username"]], + email: emailValues.map[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() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "id": id, + "username": emailValues.reverse[username], + "email": emailValues.reverse[email], + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + }; +} + +enum Email { STEVE_GATES_NOP_COMMERCE_COM } + +final emailValues = EnumValues({ + "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM +}); + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/models/pharmacy/products.dart b/lib/models/pharmacy/products.dart new file mode 100644 index 00000000..b4833c64 --- /dev/null +++ b/lib/models/pharmacy/products.dart @@ -0,0 +1,835 @@ +// To parse this JSON data, do +// +// final products = productsFromJson(jsonString); + +import 'dart:convert'; + +Products productsFromJson(String str) => Products.fromJson(json.decode(str)); + +String productsToJson(Products data) => json.encode(data.toJson()); + +class Products { + Products({ + this.messageStatus, + this.products, + }); + + dynamic messageStatus; + List products; + + factory Products.fromJson(Map json) => Products( + messageStatus: json["MessageStatus"], + products: List.from(json["products"].map((x) => Product.fromJson(x))), + ); + + Map toJson() => { + "MessageStatus": messageStatus, + "products": List.from(products.map((x) => x.toJson())), + }; +} + +class Product { + Product({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName, + }); + + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + String metaKeywords; + String metaDescription; + String metaTitle; + bool allowCustomerReviews; + int approvedRatingSum; + int notApprovedRatingSum; + int approvedTotalReviews; + int notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + String rxMessage; + String rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + int maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + int recurringCycleLength; + int recurringTotalCycles; + bool isRental; + int rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + int additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + int manageInventoryMethodId; + int stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + int minStockQuantity; + int notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + int orderMinimumQuantity; + int orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + int oldPrice; + double productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + int minimumCustomerEnteredPrice; + int maximumCustomerEnteredPrice; + bool basepriceEnabled; + int basepriceAmount; + int basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + String discountName; + String discountNamen; + String discountDescription; + String discountDescriptionn; + String discountPercentage; + String currency; + String currencyn; + double weight; + int length; + int width; + int height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + int displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String productType; + int parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + int vendorId; + String seName; + + factory Product.fromJson(Map json) => Product( + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + shortDescription: json["short_description"] == null ? null : json["short_description"], + shortDescriptionn: json["short_descriptionn"] == null ? null : json["short_descriptionn"], + fullDescription: json["full_description"], + fullDescriptionn: json["full_descriptionn"], + markasNew: json["markas_new"], + showOnHomePage: json["show_on_home_page"], + metaKeywords: json["meta_keywords"] == null ? null : json["meta_keywords"], + metaDescription: json["meta_description"] == null ? null : json["meta_description"], + metaTitle: json["meta_title"] == null ? null : json["meta_title"], + allowCustomerReviews: json["allow_customer_reviews"], + approvedRatingSum: json["approved_rating_sum"], + notApprovedRatingSum: json["not_approved_rating_sum"], + approvedTotalReviews: json["approved_total_reviews"], + notApprovedTotalReviews: json["not_approved_total_reviews"], + sku: json["sku"], + isRx: json["is_rx"], + prescriptionRequired: json["prescription_required"], + rxMessage: json["rx_message"] == null ? null : json["rx_message"], + rxMessagen: json["rx_messagen"] == null ? null : json["rx_messagen"], + manufacturerPartNumber: json["manufacturer_part_number"], + gtin: json["gtin"], + isGiftCard: json["is_gift_card"], + requireOtherProducts: json["require_other_products"], + automaticallyAddRequiredProducts: json["automatically_add_required_products"], + isDownload: json["is_download"], + unlimitedDownloads: json["unlimited_downloads"], + maxNumberOfDownloads: json["max_number_of_downloads"], + downloadExpirationDays: json["download_expiration_days"], + hasSampleDownload: json["has_sample_download"], + hasUserAgreement: json["has_user_agreement"], + isRecurring: json["is_recurring"], + recurringCycleLength: json["recurring_cycle_length"], + recurringTotalCycles: json["recurring_total_cycles"], + isRental: json["is_rental"], + rentalPriceLength: json["rental_price_length"], + isShipEnabled: json["is_ship_enabled"], + isFreeShipping: json["is_free_shipping"], + shipSeparately: json["ship_separately"], + additionalShippingCharge: json["additional_shipping_charge"], + isTaxExempt: json["is_tax_exempt"], + isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], + useMultipleWarehouses: json["use_multiple_warehouses"], + manageInventoryMethodId: json["manage_inventory_method_id"], + stockQuantity: json["stock_quantity"], + stockAvailability: json["stock_availability"], + stockAvailabilityn: json["stock_availabilityn"], + displayStockAvailability: json["display_stock_availability"], + displayStockQuantity: json["display_stock_quantity"], + minStockQuantity: json["min_stock_quantity"], + notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], + allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], + orderMinimumQuantity: json["order_minimum_quantity"], + orderMaximumQuantity: json["order_maximum_quantity"], + allowedQuantities: json["allowed_quantities"], + allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], + disableBuyButton: json["disable_buy_button"], + disableWishlistButton: json["disable_wishlist_button"], + availableForPreOrder: json["available_for_pre_order"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], + callForPrice: json["call_for_price"], + price: json["price"].toDouble(), + oldPrice: json["old_price"], + productCost: json["product_cost"].toDouble(), + specialPrice: json["special_price"], + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + customerEntersPrice: json["customer_enters_price"], + minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], + maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], + basepriceEnabled: json["baseprice_enabled"], + basepriceAmount: json["baseprice_amount"], + basepriceBaseAmount: json["baseprice_base_amount"], + hasTierPrices: json["has_tier_prices"], + hasDiscountsApplied: json["has_discounts_applied"], + discountName: json["discount_name"] == null ? null : json["discount_name"], + discountNamen: json["discount_namen"] == null ? null : json["discount_namen"], + discountDescription: json["discount_description"] == null ? null : json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"] == null ? null : json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"] == null ? null : json["discount_percentage"], + currency: json["currency"], + currencyn: json["currencyn"], + weight: json["weight"].toDouble(), + length: json["length"], + width: json["width"], + height: json["height"], + availableStartDateTimeUtc: json["available_start_date_time_utc"], + availableEndDateTimeUtc: json["available_end_date_time_utc"], + displayOrder: json["display_order"], + published: json["published"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + productType: json["product_type"], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + discountIds: List.from(json["discount_ids"].map((x) => x)), + storeIds: List.from(json["store_ids"].map((x) => x)), + manufacturerIds: List.from(json["manufacturer_ids"].map((x) => x)), + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + images: List.from(json["images"].map((x) => Image.fromJson(x))), + attributes: List.from(json["attributes"].map((x) => x)), + specifications: List.from(json["specifications"].map((x) => Specification.fromJson(x))), + associatedProductIds: List.from(json["associated_product_ids"].map((x) => x)), + tags: List.from(json["tags"].map((x) => x)), + vendorId: json["vendor_id"], + seName: json["se_name"], + ); + + Map toJson() => { + "id": id, + "visible_individually": visibleIndividually, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "short_description": shortDescription == null ? null : shortDescription, + "short_descriptionn": shortDescriptionn == null ? null : shortDescriptionn, + "full_description": fullDescription, + "full_descriptionn": fullDescriptionn, + "markas_new": markasNew, + "show_on_home_page": showOnHomePage, + "meta_keywords": metaKeywords == null ? null : metaKeywords, + "meta_description": metaDescription == null ? null : metaDescription, + "meta_title": metaTitle == null ? null : metaTitle, + "allow_customer_reviews": allowCustomerReviews, + "approved_rating_sum": approvedRatingSum, + "not_approved_rating_sum": notApprovedRatingSum, + "approved_total_reviews": approvedTotalReviews, + "not_approved_total_reviews": notApprovedTotalReviews, + "sku": sku, + "is_rx": isRx, + "prescription_required": prescriptionRequired, + "rx_message": rxMessage == null ? null : rxMessage, + "rx_messagen": rxMessagen == null ? null : rxMessagen, + "manufacturer_part_number": manufacturerPartNumber, + "gtin": gtin, + "is_gift_card": isGiftCard, + "require_other_products": requireOtherProducts, + "automatically_add_required_products": automaticallyAddRequiredProducts, + "is_download": isDownload, + "unlimited_downloads": unlimitedDownloads, + "max_number_of_downloads": maxNumberOfDownloads, + "download_expiration_days": downloadExpirationDays, + "has_sample_download": hasSampleDownload, + "has_user_agreement": hasUserAgreement, + "is_recurring": isRecurring, + "recurring_cycle_length": recurringCycleLength, + "recurring_total_cycles": recurringTotalCycles, + "is_rental": isRental, + "rental_price_length": rentalPriceLength, + "is_ship_enabled": isShipEnabled, + "is_free_shipping": isFreeShipping, + "ship_separately": shipSeparately, + "additional_shipping_charge": additionalShippingCharge, + "is_tax_exempt": isTaxExempt, + "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, + "use_multiple_warehouses": useMultipleWarehouses, + "manage_inventory_method_id": manageInventoryMethodId, + "stock_quantity": stockQuantity, + "stock_availability": stockAvailability, + "stock_availabilityn": stockAvailabilityn, + "display_stock_availability": displayStockAvailability, + "display_stock_quantity": displayStockQuantity, + "min_stock_quantity": minStockQuantity, + "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, + "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, + "order_minimum_quantity": orderMinimumQuantity, + "order_maximum_quantity": orderMaximumQuantity, + "allowed_quantities": allowedQuantities, + "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, + "disable_buy_button": disableBuyButton, + "disable_wishlist_button": disableWishlistButton, + "available_for_pre_order": availableForPreOrder, + "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, + "call_for_price": callForPrice, + "price": price, + "old_price": oldPrice, + "product_cost": productCost, + "special_price": specialPrice, + "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, + "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, + "customer_enters_price": customerEntersPrice, + "minimum_customer_entered_price": minimumCustomerEnteredPrice, + "maximum_customer_entered_price": maximumCustomerEnteredPrice, + "baseprice_enabled": basepriceEnabled, + "baseprice_amount": basepriceAmount, + "baseprice_base_amount": basepriceBaseAmount, + "has_tier_prices": hasTierPrices, + "has_discounts_applied": hasDiscountsApplied, + "discount_name": discountName == null ? null : discountName, + "discount_namen": discountNamen == null ? null : discountNamen, + "discount_description": discountDescription == null ? null : discountDescription, + "discount_Descriptionn": discountDescriptionn == null ? null : discountDescriptionn, + "discount_percentage": discountPercentage == null ? null : discountPercentage, + "currency": currency, + "currencyn": currencyn, + "weight": weight, + "length": length, + "width": width, + "height": height, + "available_start_date_time_utc": availableStartDateTimeUtc, + "available_end_date_time_utc": availableEndDateTimeUtc, + "display_order": displayOrder, + "published": published, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "product_type": productType, + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": List.from(roleIds.map((x) => x)), + "discount_ids": List.from(discountIds.map((x) => x)), + "store_ids": List.from(storeIds.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), + "reviews": List.from(reviews.map((x) => x.toJson())), + "images": List.from(images.map((x) => x.toJson())), + "attributes": List.from(attributes.map((x) => x)), + "specifications": List.from(specifications.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds.map((x) => x)), + "tags": List.from(tags.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; +} + +class Image { + Image({ + this.id, + this.position, + this.src, + this.thumb, + this.attachment, + }); + + int id; + int position; + String src; + String thumb; + String attachment; + + factory Image.fromJson(Map json) => Image( + id: json["id"], + position: json["position"], + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "id": id, + "position": position, + "src": src, + "thumb": thumb, + "attachment": attachment, + }; +} + +class LocalizedName { + LocalizedName({ + this.languageId, + this.localizedName, + }); + + int languageId; + String localizedName; + + factory LocalizedName.fromJson(Map json) => LocalizedName( + languageId: json["language_id"], + localizedName: json["localized_name"], + ); + + Map toJson() => { + "language_id": languageId, + "localized_name": localizedName, + }; +} + +class Review { + Review({ + 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, + }); + + int id; + int position; + int reviewId; + int customerId; + int productId; + int storeId; + bool isApproved; + String title; + String reviewText; + dynamic replyText; + int rating; + int helpfulYesTotal; + int helpfulNoTotal; + DateTime createdOnUtc; + Customer customer; + dynamic product; + + factory Review.fromJson(Map json) => Review( + 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: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"], + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product, + }; +} + +class Customer { + Customer({ + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + this.billingAddress, + this.shippingAddress, + this.addresses, + 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, + this.roleIds, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + int isOutSa; + int patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + List addresses; + String id; + Username username; + Email email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory Customer.fromJson(Map json) => Customer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + addresses: List.from(json["addresses"].map((x) => x)), + id: json["id"], + username: usernameValues.map[json["username"]], + email: emailValues.map[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"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "addresses": List.from(addresses.map((x) => x)), + "id": id, + "username": usernameValues.reverse[username], + "email": emailValues.reverse[email], + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +enum Email { MEMO17299_GMAIL_COM, STEVE_GATES_NOP_COMMERCE_COM } + +final emailValues = EnumValues({ + "Memo17299@gmail.com": Email.MEMO17299_GMAIL_COM, + "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM +}); + +enum Username { AMAL_26, STEVE_GATES_NOP_COMMERCE_COM } + +final usernameValues = EnumValues({ + "amal_26": Username.AMAL_26, + "steve_gates@nopCommerce.com": Username.STEVE_GATES_NOP_COMMERCE_COM +}); + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + Name name; + NameN nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: nameValues.map[json["name"]], + nameN: nameNValues.map[json["nameN"]], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": nameValues.reverse[name], + "nameN": nameNValues.reverse[nameN], + }; +} + +enum Name { PRIMARY_UNIT_OF_MEASURE, BRAND, MANUFACTURER_COUNTRY_NAME, STORAGE, COMPOSITION, SPF } + +final nameValues = EnumValues({ + "BRAND": Name.BRAND, + "COMPOSITION": Name.COMPOSITION, + "MANUFACTURER COUNTRY NAME": Name.MANUFACTURER_COUNTRY_NAME, + "Primary Unit Of Measure": Name.PRIMARY_UNIT_OF_MEASURE, + "SPF": Name.SPF, + "STORAGE": Name.STORAGE +}); + +enum NameN { EMPTY, NAME_N, PURPLE, FLUFFY, TENTACLED, SPF } + +final nameNValues = EnumValues({ + "وحدة القياس الأولية": NameN.EMPTY, + "تخزين": NameN.FLUFFY, + "علامة تجارية": NameN.NAME_N, + "اسم البلد المصنع": NameN.PURPLE, + "SPF": NameN.SPF, + "المكونات": NameN.TENTACLED +}); + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/models/pharmacy/reviewModel.dart b/lib/models/pharmacy/reviewModel.dart new file mode 100644 index 00000000..da30212c --- /dev/null +++ b/lib/models/pharmacy/reviewModel.dart @@ -0,0 +1,803 @@ +// To parse this JSON data, do +// +// final review = reviewFromJson(jsonString); + +import 'dart:convert'; + +List reviewFromJson(String str) => List.from(json.decode(str).map((x) => Review.fromJson(x))); + +String reviewToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class Product { + Product({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName, + }); + + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + String metaKeywords; + String metaDescription; + String metaTitle; + bool allowCustomerReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; + bool isRental; + dynamic rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + dynamic additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + dynamic manageInventoryMethodId; + dynamic stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + dynamic preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; + bool customerEntersPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; + bool basepriceEnabled; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; + String currency; + String currencyn; + double weight; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; + bool published; + bool deleted; + DateTime createdOnUtc; + DateTime updatedOnUtc; + String productType; + dynamic parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + dynamic vendorId; + String seName; + + factory Product.fromJson(Map json) => Product( + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + shortDescription: json["short_description"], + shortDescriptionn: json["short_descriptionn"], + fullDescription: json["full_description"], + fullDescriptionn: json["full_descriptionn"], + markasNew: json["markas_new"], + showOnHomePage: json["show_on_home_page"], + metaKeywords: json["meta_keywords"], + metaDescription: json["meta_description"], + metaTitle: json["meta_title"], + allowCustomerReviews: json["allow_customer_reviews"], + approvedRatingSum: json["approved_rating_sum"], + notApprovedRatingSum: json["not_approved_rating_sum"], + approvedTotalReviews: json["approved_total_reviews"], + notApprovedTotalReviews: json["not_approved_total_reviews"], + sku: json["sku"], + isRx: json["is_rx"], + prescriptionRequired: json["prescription_required"], + rxMessage: json["rx_message"], + rxMessagen: json["rx_messagen"], + manufacturerPartNumber: json["manufacturer_part_number"], + gtin: json["gtin"], + isGiftCard: json["is_gift_card"], + requireOtherProducts: json["require_other_products"], + automaticallyAddRequiredProducts: json["automatically_add_required_products"], + isDownload: json["is_download"], + unlimitedDownloads: json["unlimited_downloads"], + maxNumberOfDownloads: json["max_number_of_downloads"], + downloadExpirationDays: json["download_expiration_days"], + hasSampleDownload: json["has_sample_download"], + hasUserAgreement: json["has_user_agreement"], + isRecurring: json["is_recurring"], + recurringCycleLength: json["recurring_cycle_length"], + recurringTotalCycles: json["recurring_total_cycles"], + isRental: json["is_rental"], + rentalPriceLength: json["rental_price_length"], + isShipEnabled: json["is_ship_enabled"], + isFreeShipping: json["is_free_shipping"], + shipSeparately: json["ship_separately"], + additionalShippingCharge: json["additional_shipping_charge"], + isTaxExempt: json["is_tax_exempt"], + isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], + useMultipleWarehouses: json["use_multiple_warehouses"], + manageInventoryMethodId: json["manage_inventory_method_id"], + stockQuantity: json["stock_quantity"], + stockAvailability: json["stock_availability"], + stockAvailabilityn: json["stock_availabilityn"], + displayStockAvailability: json["display_stock_availability"], + displayStockQuantity: json["display_stock_quantity"], + minStockQuantity: json["min_stock_quantity"], + notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], + allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], + orderMinimumQuantity: json["order_minimum_quantity"], + orderMaximumQuantity: json["order_maximum_quantity"], + allowedQuantities: json["allowed_quantities"], + allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], + disableBuyButton: json["disable_buy_button"], + disableWishlistButton: json["disable_wishlist_button"], + availableForPreOrder: json["available_for_pre_order"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], + callForPrice: json["call_for_price"], + price: json["price"], + oldPrice: json["old_price"], + productCost: json["product_cost"], + specialPrice: json["special_price"], + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + customerEntersPrice: json["customer_enters_price"], + minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], + maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], + basepriceEnabled: json["baseprice_enabled"], + basepriceAmount: json["baseprice_amount"], + basepriceBaseAmount: json["baseprice_base_amount"], + hasTierPrices: json["has_tier_prices"], + hasDiscountsApplied: json["has_discounts_applied"], + discountName: json["discount_name"], + discountNamen: json["discount_namen"], + discountDescription: json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"], + currency: json["currency"], + currencyn: json["currencyn"], + weight: json["weight"].toDouble(), + length: json["length"], + width: json["width"], + height: json["height"], + availableStartDateTimeUtc: json["available_start_date_time_utc"], + availableEndDateTimeUtc: json["available_end_date_time_utc"], + displayOrder: json["display_order"], + published: json["published"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + productType: json["product_type"], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + discountIds: List.from(json["discount_ids"].map((x) => x)), + storeIds: List.from(json["store_ids"].map((x) => x)), + manufacturerIds: List.from(json["manufacturer_ids"].map((x) => x)), + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + images: List.from(json["images"].map((x) => Image.fromJson(x))), + attributes: List.from(json["attributes"].map((x) => x)), + specifications: List.from(json["specifications"].map((x) => Specification.fromJson(x))), + associatedProductIds: List.from(json["associated_product_ids"].map((x) => x)), + tags: List.from(json["tags"].map((x) => x)), + vendorId: json["vendor_id"], + seName: json["se_name"], + ); + + Map toJson() => { + "id": id, + "visible_individually": visibleIndividually, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "short_description": shortDescription, + "short_descriptionn": shortDescriptionn, + "full_description": fullDescription, + "full_descriptionn": fullDescriptionn, + "markas_new": markasNew, + "show_on_home_page": showOnHomePage, + "meta_keywords": metaKeywords, + "meta_description": metaDescription, + "meta_title": metaTitle, + "allow_customer_reviews": allowCustomerReviews, + "approved_rating_sum": approvedRatingSum, + "not_approved_rating_sum": notApprovedRatingSum, + "approved_total_reviews": approvedTotalReviews, + "not_approved_total_reviews": notApprovedTotalReviews, + "sku": sku, + "is_rx": isRx, + "prescription_required": prescriptionRequired, + "rx_message": rxMessage, + "rx_messagen": rxMessagen, + "manufacturer_part_number": manufacturerPartNumber, + "gtin": gtin, + "is_gift_card": isGiftCard, + "require_other_products": requireOtherProducts, + "automatically_add_required_products": automaticallyAddRequiredProducts, + "is_download": isDownload, + "unlimited_downloads": unlimitedDownloads, + "max_number_of_downloads": maxNumberOfDownloads, + "download_expiration_days": downloadExpirationDays, + "has_sample_download": hasSampleDownload, + "has_user_agreement": hasUserAgreement, + "is_recurring": isRecurring, + "recurring_cycle_length": recurringCycleLength, + "recurring_total_cycles": recurringTotalCycles, + "is_rental": isRental, + "rental_price_length": rentalPriceLength, + "is_ship_enabled": isShipEnabled, + "is_free_shipping": isFreeShipping, + "ship_separately": shipSeparately, + "additional_shipping_charge": additionalShippingCharge, + "is_tax_exempt": isTaxExempt, + "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, + "use_multiple_warehouses": useMultipleWarehouses, + "manage_inventory_method_id": manageInventoryMethodId, + "stock_quantity": stockQuantity, + "stock_availability": stockAvailability, + "stock_availabilityn": stockAvailabilityn, + "display_stock_availability": displayStockAvailability, + "display_stock_quantity": displayStockQuantity, + "min_stock_quantity": minStockQuantity, + "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, + "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, + "order_minimum_quantity": orderMinimumQuantity, + "order_maximum_quantity": orderMaximumQuantity, + "allowed_quantities": allowedQuantities, + "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, + "disable_buy_button": disableBuyButton, + "disable_wishlist_button": disableWishlistButton, + "available_for_pre_order": availableForPreOrder, + "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, + "call_for_price": callForPrice, + "price": price, + "old_price": oldPrice, + "product_cost": productCost, + "special_price": specialPrice, + "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, + "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, + "customer_enters_price": customerEntersPrice, + "minimum_customer_entered_price": minimumCustomerEnteredPrice, + "maximum_customer_entered_price": maximumCustomerEnteredPrice, + "baseprice_enabled": basepriceEnabled, + "baseprice_amount": basepriceAmount, + "baseprice_base_amount": basepriceBaseAmount, + "has_tier_prices": hasTierPrices, + "has_discounts_applied": hasDiscountsApplied, + "discount_name": discountName, + "discount_namen": discountNamen, + "discount_description": discountDescription, + "discount_Descriptionn": discountDescriptionn, + "discount_percentage": discountPercentage, + "currency": currency, + "currencyn": currencyn, + "weight": weight, + "length": length, + "width": width, + "height": height, + "available_start_date_time_utc": availableStartDateTimeUtc, + "available_end_date_time_utc": availableEndDateTimeUtc, + "display_order": displayOrder, + "published": published, + "deleted": deleted, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "product_type": productType, + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": List.from(roleIds.map((x) => x)), + "discount_ids": List.from(discountIds.map((x) => x)), + "store_ids": List.from(storeIds.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), + "reviews": List.from(reviews.map((x) => x.toJson())), + "images": List.from(images.map((x) => x.toJson())), + "attributes": List.from(attributes.map((x) => x)), + "specifications": List.from(specifications.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds.map((x) => x)), + "tags": List.from(tags.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; +} + +class Review { + Review({ + 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, + }); + + dynamic id; + dynamic position; + dynamic reviewId; + dynamic customerId; + dynamic productId; + dynamic storeId; + bool isApproved; + String title; + ReviewText reviewText; + dynamic replyText; + dynamic rating; + dynamic helpfulYesTotal; + dynamic helpfulNoTotal; + DateTime createdOnUtc; + Customer customer; + Product product; + + factory Review.fromJson(Map json) => Review( + 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: reviewTextValues.map[json["review_text"]], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"] == null ? null : Product.fromJson(json["product"]), + ); + + Map toJson() => { + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product == null ? null : product.toJson(), + }; +} + +class Image { + Image({ + this.id, + this.position, + this.src, + this.thumb, + this.attachment, + }); + + dynamic id; + dynamic position; + String src; + String thumb; + String attachment; + + factory Image.fromJson(Map json) => Image( + id: json["id"], + position: json["position"], + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "id": id, + "position": position, + "src": src, + "thumb": thumb, + "attachment": attachment, + }; +} + +class LocalizedName { + LocalizedName({ + this.languageId, + this.localizedName, + }); + + dynamic languageId; + String localizedName; + + factory LocalizedName.fromJson(Map json) => LocalizedName( + languageId: json["language_id"], + localizedName: json["localized_name"], + ); + + Map toJson() => { + "language_id": languageId, + "localized_name": localizedName, + }; +} + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + dynamic id; + dynamic displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: json["name"], + nameN: json["nameN"], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": name, + "nameN": nameN, + }; +} + +class Customer { + Customer({ + this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + this.billingAddress, + this.shippingAddress, + this.addresses, + 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, + this.roleIds, + }); + + dynamic fileNumber; + dynamic iqamaNumber; + dynamic isOutSa; + dynamic patientType; + dynamic gender; + DateTime birthDate; + dynamic phone; + dynamic countryCode; + dynamic yahalaAccountno; + dynamic billingAddress; + dynamic shippingAddress; + List addresses; + String id; + Username username; + Email email; + dynamic firstName; + dynamic lastName; + dynamic languageId; + dynamic adminComment; + dynamic isTaxExempt; + dynamic hasShoppingCartItems; + dynamic active; + dynamic deleted; + dynamic isSystemAccount; + dynamic systemName; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; + dynamic registeredInStoreId; + List roleIds; + + factory Customer.fromJson(Map json) => Customer( + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + addresses: List.from(json["addresses"].map((x) => x)), + id: json["id"], + username: usernameValues.map[json["username"]], + email: emailValues.map[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"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); + + Map toJson() => { + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "addresses": List.from(addresses.map((x) => x)), + "id": id, + "username": usernameValues.reverse[username], + "email": emailValues.reverse[email], + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds.map((x) => x)), + }; +} + +enum Email { TAMER_FANASHEH_DRSULAIMANALHABIB_COM, STEVE_GATES_NOP_COMMERCE_COM } + +final emailValues = EnumValues({ + "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM, + "tamer.fanasheh@drsulaimanalhabib.com": Email.TAMER_FANASHEH_DRSULAIMANALHABIB_COM +}); + +enum Username { TAMERF, STEVE_GATES_NOP_COMMERCE_COM } + +final usernameValues = EnumValues({ + "steve_gates@nopCommerce.com": Username.STEVE_GATES_NOP_COMMERCE_COM, + "tamerf": Username.TAMERF +}); + +enum ReviewText { ENADDD, ENAD_TEST_0001, GOOD, ENAD_TEST_REVIEW_001, ENAD } + +final reviewTextValues = EnumValues({ + "ENAD ": ReviewText.ENAD, + "enaddd": ReviewText.ENADDD, + "ENAD TEST 0001": ReviewText.ENAD_TEST_0001, + "Enad Test Review 001": ReviewText.ENAD_TEST_REVIEW_001, + "good": ReviewText.GOOD +}); + +class EnumValues { + Map map; + Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + if (reverseMap == null) { + reverseMap = map.map((k, v) => new MapEntry(v, k)); + } + return reverseMap; + } +} diff --git a/lib/models/pharmacy/specification.dart b/lib/models/pharmacy/specification.dart new file mode 100644 index 00000000..6ef69191 --- /dev/null +++ b/lib/models/pharmacy/specification.dart @@ -0,0 +1,61 @@ +// To parse this JSON data, do +// +// final specificationModel = specificationModelFromJson(jsonString); + +import 'dart:convert'; + +SpecificationModel specificationModelFromJson(String str) => SpecificationModel.fromJson(json.decode(str)); + +String specificationModelToJson(SpecificationModel data) => json.encode(data.toJson()); + +class SpecificationModel { + SpecificationModel({ + this.specification, + }); + + List specification; + + factory SpecificationModel.fromJson(Map json) => SpecificationModel( + specification: List.from(json["specification"].map((x) => Specification.fromJson(x))), + ); + + Map toJson() => { + "specification": List.from(specification.map((x) => x.toJson())), + }; +} + +class Specification { + Specification({ + this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN, + }); + + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + factory Specification.fromJson(Map json) => Specification( + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: json["name"], + nameN: json["nameN"], + ); + + Map toJson() => { + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": name, + "nameN": nameN, + }; +} diff --git a/lib/models/pharmacy/topBrandsModel.dart b/lib/models/pharmacy/topBrandsModel.dart new file mode 100644 index 00000000..0cd833b7 --- /dev/null +++ b/lib/models/pharmacy/topBrandsModel.dart @@ -0,0 +1,137 @@ +// To parse this JSON data, do +// +// final topBrand = topBrandFromJson(jsonString); + +import 'dart:convert'; + +List topBrandFromJson(String str) => List.from(json.decode(str).map((x) => TopBrand.fromJson(x))); + +String topBrandToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class TopBrand { + TopBrand({ + 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, + }); + + String id; + String name; + String namen; + List localizedNames; + String description; + int manufacturerTemplateId; + String metaKeywords; + dynamic metaDescription; + dynamic metaTitle; + int pageSize; + String pageSizeOptions; + dynamic priceRanges; + bool published; + bool deleted; + int displayOrder; + DateTime createdOnUtc; + DateTime updatedOnUtc; + Image image; + + factory TopBrand.fromJson(Map json) => TopBrand( + id: json["id"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + description: json["description"] == null ? null : 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: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + image: json["image"] == null ? null : Image.fromJson(json["image"]), + ); + + Map toJson() => { + "id": id, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "description": description == null ? null : description, + "manufacturer_template_id": manufacturerTemplateId, + "meta_keywords": metaKeywords, + "meta_description": metaDescription, + "meta_title": metaTitle, + "page_size": pageSize, + "page_size_options": pageSizeOptions, + "price_ranges": priceRanges, + "published": published, + "deleted": deleted, + "display_order": displayOrder, + "created_on_utc": createdOnUtc.toIso8601String(), + "updated_on_utc": updatedOnUtc.toIso8601String(), + "image": image == null ? null : image.toJson(), + }; +} + +class Image { + Image({ + this.src, + this.thumb, + this.attachment, + }); + + String src; + dynamic thumb; + dynamic attachment; + + factory Image.fromJson(Map json) => Image( + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); + + Map toJson() => { + "src": src, + "thumb": thumb, + "attachment": attachment, + }; +} + +class LocalizedName { + LocalizedName({ + this.languageId, + this.localizedName, + }); + + int languageId; + String localizedName; + + factory LocalizedName.fromJson(Map json) => LocalizedName( + languageId: json["language_id"], + localizedName: json["localized_name"], + ); + + Map toJson() => { + "language_id": languageId, + "localized_name": localizedName, + }; +} 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/final_products_page.dart b/lib/pages/final_products_page.dart new file mode 100644 index 00000000..03adee97 --- /dev/null +++ b/lib/pages/final_products_page.dart @@ -0,0 +1,480 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; + +import 'base/base_view.dart'; + +class FinalProductsPage extends StatefulWidget { + String id; + FinalProductsPage({this.id}); + @override + _FinalProductsPageState createState() => _FinalProductsPageState(id: id); +} + +class _FinalProductsPageState extends State { + String id; + _FinalProductsPageState({this.id}); + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getFinalProducts(i: id), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: 'Products', + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + height: MediaQuery.of(context).size.height * 5.87, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ +//Expanded widget heree if nassery + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts( + 'Products', + fontWeight: FontWeight.w600, + ), + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, + //width: 0.3, + // indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 3.90, + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.finalProducts.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.finalProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, + ), + 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( + model.finalProducts[index] + .images.isNotEmpty + ? model + .finalProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 2.8 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.finalProducts[index] + .rxMessage != + null + ? model + .finalProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w600, + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + if (model + .finalProducts[ + index] + .discountName != + null) + Container( + width: double.infinity, + height: 13.0, + decoration: + BoxDecoration( + color: + Color(0xff5AB145), + ), + child: Center( + child: Texts( + model + .finalProducts[ + index] + .discountName, + regular: true, + color: Colors.white, + fontSize: 10.4, + ), + ), + ), + Texts( + model.finalProducts[index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w400, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .finalProducts[ + index] + .approvedRatingSum > + 0 + ? (model.finalProducts[index].approvedRatingSum + .toDouble() / + model + .finalProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ), + ) + : Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 5.0, + child: ListView.builder( + itemCount: model.finalProducts.length, + itemBuilder: + (BuildContext context, int index) { + return Card( + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: BoxDecoration(), + child: Padding( + padding: EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.finalProducts[index] + .images.isNotEmpty + ? model + .finalProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.contain, + height: 80, + ), + ), + ], + ), + Column( + children: [ + Container( + width: model + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 3.5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.finalProducts[index] + .rxMessage != + null + ? model + .finalProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w600, + ), + ), + ], + ), + ], + ), + Container( + height: 100.0, + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + height: 35.0, + width: 250.0, + child: Texts( + model.finalProducts[index] + .name, + regular: true, + fontSize: 13.2, + fontWeight: FontWeight.w500, + maxLines: 2, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .finalProducts[ + index] + .approvedRatingSum > + 0 + ? (model + .finalProducts[ + index] + .approvedRatingSum + .toDouble() / + model + .finalProducts[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ); + }), + ), + ) + ], + ), + ), + )); + } +} diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 3d49d707..cd8a8a2d 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -22,6 +22,8 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'landing_page_pharmcy.dart'; + class HomePage extends StatefulWidget { final Function goToMyProfile; @@ -482,7 +484,7 @@ class _HomePageState extends State { ), if(projectViewModel.havePrivilege(65)) DashboardItem( - onTap: () => Navigator.push(context, FadePage(page: PharmacyPage())), + onTap: () => Navigator.push(context, FadePage(page: LandingPagePharmacy())), child: Center( child: Padding( diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart new file mode 100644 index 00000000..52bbb888 --- /dev/null +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -0,0 +1,166 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/pages/search_products_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; + +import '../offers_categorise_page.dart'; + +class LandingPagePharmacy extends StatefulWidget { + @override + _LandingPagePharmacyState createState() => _LandingPagePharmacyState(); +} + +class _LandingPagePharmacyState extends State { + int currentTab = 0; + PageController pageController; + ProjectViewModel projectProvider; + + _changeCurrentTab(int tab) { + setState(() { + currentTab = tab; + pageController.jumpToPage(tab); + }); + } + + void initState() { + super.initState(); + pageController = PageController(keepPage: true); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: currentTab == 0 || currentTab == 1 + ? AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + title: Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, + ), + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchProductsPage()), + ); + }, + ), + ), + leading: Builder( + builder: (BuildContext context) { + return Container( + height: 2.0, + width: 10.0, + child: Image.asset( + 'assets/images/pharmacy_logo.png', + ), + ); + }, + ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], + centerTitle: true, + ) + : currentTab == 4 + ? null + : AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + textTheme: TextTheme( + headline6: TextStyle( + color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(getText(currentTab).toUpperCase()), + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back), + color: Colors.white, + onPressed: () => Scaffold.of(context).openDrawer(), + ); + }, + ), + actions: [ + // IconButton( + // iconSize: 70, + // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg', + // height: 100, width: 100, fit: BoxFit.cover), + // onPressed: () { + // triggerRobot(); + // } //do something, + // ) + ], + centerTitle: true, + ), + extendBody: false, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + PharmacyPage(), + PharmacyCategorisePage(), +// OffersCategorisePage(), + WishlistPage(), + PharmacyProfilePage(), +// Container( +// child: Text('text'), +// ), + CartOrderPage(), + ], // Please do not remove the BookingOptions from this array + ), + bottomNavigationBar: BottomNavPharmacyBar( + changeIndex: _changeCurrentTab, + index: currentTab, + ), + ); + } + + getText(currentTab) { + switch (currentTab) { + case 2: + return 'Wishlist'; + case 3: + return 'My Account'; + case 4: + return 'Shopping Cart'; + } + } +} diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart new file mode 100644 index 00000000..782ea018 --- /dev/null +++ b/lib/pages/offers_categorise_page.dart @@ -0,0 +1,620 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/offers_Categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'base/base_view.dart'; + +class OffersCategorisePage extends StatefulWidget { + @override + _OffersCategorisePageState createState() => _OffersCategorisePageState(); +} + +class _OffersCategorisePageState extends State { + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getOffersCategorise(), + builder: (BuildContext context, OffersCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: 'Offers', + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + //height: MediaQuery.of(context).size.height * 0.57, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts( + 'Categories', + fontWeight: FontWeight.w800, + ), + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + //Expanded widget heree if nassery + Container( + height: MediaQuery.of(context).size.height * 0.20, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categorise.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + InkWell( + child: Column( + children: [ + Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.orange.shade200 + .withOpacity(0.45), + ), + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.2, + height: MediaQuery.of(context) + .size + .height * + 0.09, + child: Center( + child: Texts( + model.categorise[index].name, + fontWeight: FontWeight.w600, + fontSize: 13.8, + ), + ), + ), + ], + ), + onTap: () { + model.getOffersProducts( + i: model.categorise[index].id); + String ids = model.categorise[index].id; + + categoriseName = + model.categorise[index].name; + }), + ], + ), + ); + }), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts( + categoriseName, + fontWeight: FontWeight.w800, + ), + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 0.7, + //width: 0.3, + // indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 0.50, + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.85, + ), + itemCount: model.products.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.products[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + height: 250.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack( + children: [ + if (model.products[index] + .discountName != + null) + RotatedBox( + quarterTurns: 4, + child: Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets.only( + right: 5.0, + top: 20.0, + bottom: 5.0, + ), + child: Texts( + 'offer' + .toUpperCase(), + color: Colors.red, + fontSize: 13.0, + fontWeight: + FontWeight.w900, + ), + ), + transform: new Matrix4 + .rotationZ( + 5.837200), + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.products[index] + .images.isNotEmpty + ? model + .products[index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model.products[index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.products[index] + .rxMessage != + null + ? model + .products[index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + if (model.products[index] + .discountName != + null) + Container( + width: double.infinity, + height: 22.0, + decoration: + BoxDecoration( + color: + Color(0xff5AB145), + ), + child: Center( + child: Texts( + model + .products[index] + .discountName, + regular: true, + color: Colors.white, + fontSize: 12.0, + fontWeight: + FontWeight.w700, + ), + ), + ), + Texts( + model + .products[index].name, + regular: true, + fontSize: 12.58, + fontWeight: + FontWeight.w600, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .products[ + index] + .approvedRatingSum > + 0 + ? (model.products[index].approvedRatingSum + .toDouble() / + model + .products[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.products[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ), + ) + : Expanded( + child: Container( + child: ListView.builder( + itemCount: model.products.length, + itemBuilder: + (BuildContext context, int index) { + return Card( + // color: + // model.products[index].discountName != + // null + // ? Color(0xffFFFF00) + // : Colors.white, + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + if (model.products[index] + .discountName != + null) + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + child: Container( + color: Colors.yellow, + height: 25.0, + width: 70.0, + child: Center( + child: Texts( + 'offer' + .toUpperCase(), + color: Colors.red, + fontSize: 13.0, + fontWeight: + FontWeight + .w900, + ), + ), + ), + ), + transform: + new Matrix4.rotationZ( + 6.15099), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.products[index] + .images.isNotEmpty + ? model + .products[index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + ], + ), + Column( + children: [ + Container( + width: model.products[index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.products[index] + .rxMessage != + null + ? model + .products[index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + if (model.products[index] + .discountName != + null) + Container( + width: 250.0, + height: 22.5, + decoration: BoxDecoration( + color: Color(0xff5AB145), + ), + child: Padding( + padding: + EdgeInsets.symmetric( + horizontal: 5.5, + ), + child: Texts( + model.products[index] + .discountName, + regular: true, + color: Colors.white, + fontSize: 12.0, + fontWeight: + FontWeight.w700, + ), + ), + ), + SizedBox( + height: 4.0, + ), + Texts( + model.products[index].name, + regular: true, + fontSize: 14.0, + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .products[ + index] + .approvedRatingSum > + 0 + ? (model + .products[ + index] + .approvedRatingSum + .toDouble() / + model + .products[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.products[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w500, + ) + ], + ), + ], + ), + ), + ], + ), + ); + }), + ), + ) + ], + ), + ), + )); + } +} diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart new file mode 100644 index 00000000..414106b1 --- /dev/null +++ b/lib/pages/parent_categorise_page.dart @@ -0,0 +1,1074 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:giffy_dialog/giffy_dialog.dart'; + +import 'base/base_view.dart'; +import 'final_products_page.dart'; + +class ParentCategorisePage extends StatefulWidget { + String id; + String titleName; + ParentCategorisePage({this.id, this.titleName}); + @override + _ParentCategorisePageState createState() => + _ParentCategorisePageState(id: id, titleName: titleName); +} + +class _ParentCategorisePageState extends State { + String id; + String titleName; + _ParentCategorisePageState({this.id, this.titleName}); + Map values = {'huusam': false, 'ali': false, 'noor': false}; + bool checkedBrands = false; + bool checkedCategorise = false; + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getCategoriseParent(i: id), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: titleName, + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + id == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : id == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : id == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : id == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : id == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : id == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : id == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : id == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : id == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : id == '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.categoriseParent.length > 8) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: InkWell( + child: Container( + child: Texts( + 'View All Categories', + fontWeight: FontWeight.w300, + ), + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return Container( + height: MediaQuery.of(context) + .size + .height * + 0.89, + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: + Axis.vertical, + itemCount: model + .categoriseParent + .length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Padding( + padding: + EdgeInsets.all( + 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts(model + .categoriseParent[ + index] + .name), + Divider( + thickness: + 0.6, + color: Colors + .black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + SubCategorisePage( + title: model.categoriseParent[index].name, + id: model.categoriseParent[index].id, + parentId: id, + )), + ); + }, + ), + ), + ); + }), + ), + ); + }, + ); + }, + ), + ), + Icon(Icons.arrow_forward) + ], + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + ], + ), + +//Expanded widget heree if nassery + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categoriseParent.length > 8 + ? 8 + : model.categoriseParent.length, + itemBuilder: + (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors + .orange.shade200 + .withOpacity(0.45), + ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.197, + height: MediaQuery.of(context) + .size + .height * + 0.08, + child: Center( + child: Texts( + projectViewModel.isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name, + fontSize: 13.4, + fontWeight: FontWeight.w600, + maxLines: 3, + ), + ), + ), + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SubCategorisePage( + title: model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[ + index] + .id, + parentId: id, + )), + ); + print(id); + }, + ), + ); + }), + ), + ), + ), + + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: FontWeight.w600, + ), + ], + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController + scrollController) { + return SingleChildScrollView( + controller: scrollController, + child: Container( + height: MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( + children: [ + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: + FontWeight + .w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( + 'Close', + color: + Colors.red, + fontWeight: + FontWeight + .w600, + fontSize: 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + Column( + children: [ + ExpansionTile( + title: Texts( + 'Categorise'), + children: [ + Container( + height: 350, + child: ListView + .builder( + controller: + scrollController, + scrollDirection: + Axis + .vertical, + shrinkWrap: + true, + itemCount: model + .categoriseParent + .length, + itemBuilder: + (BuildContext context, + int index) { + return CheckboxListTile( + tristate: + true, + title: + Texts(model.categoriseParent[index].name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedCategorise, + onChanged: + (bool value) { + setState(() { + checkedCategorise = value; + }); + }, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + ExpansionTile( + title: + Texts('Brands'), + children: [ + Container( + height: 350, + child: ListView + .builder( + scrollDirection: + Axis + .vertical, + shrinkWrap: + true, + itemCount: model + .brandsList + .length, + itemBuilder: + (BuildContext context, + int index) { + return CheckboxListTile( + tristate: + true, + title: + Texts(model.brandsList[index].name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedBrands, + onChanged: + (bool value) { + setState(() { + checkedBrands = value; + }); + }, + autofocus: + true, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + ExpansionTile( + title: + Texts('Price'), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Min'), + Container( + color: + Colors.white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: OutlineInputBorder(), + ), + ), + ), + ], + ), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Max'), + Container( + color: + Colors.white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: OutlineInputBorder(), + ), + ), + ), + ], + ), + ], + ), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets.all( + 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ + Container( + width: 100, + child: Button( + label: + 'Reset', + backgroundColor: + Colors + .red, + ), + ), + SizedBox( + width: 30, + ), + Container( + width: 200, + child: Button( + label: + 'Apply', + backgroundColor: + Colors + .green, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, +//width: 0.3, +// indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Container( + height: SizeConfig.screenHeight * 7.8, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: model.parentProducts.length, + itemBuilder: + (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.parentProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: + Radius.circular(110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack( + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: 4, + child: Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + right: 5.0, + top: 20.0, + bottom: 5.0, + ), + child: Texts( + 'offer' + .toUpperCase(), + color: + Colors.red, + fontSize: 13.0, + fontWeight: + FontWeight + .w900, + ), + ), + transform: new Matrix4 + .rotationZ( + 5.837200), + ), + ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + Container( + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + Container( + width: + double.infinity, + height: 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: Center( + child: Texts( + model + .parentProducts[ + index] + .discountName, + regular: true, + color: Colors + .white, + fontSize: 10.4, + ), + ), + ), + Texts( + model + .parentProducts[ + index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w700, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .parentProducts[ + index] + .approvedRatingSum > + 0 + ? (model.parentProducts[index].approvedRatingSum.toDouble() / + model.parentProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ) + : Container( + height: + MediaQuery.of(context).size.height * 5.0, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.parentProducts.length, + itemBuilder: + (BuildContext context, int index) { + return Card( + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + ), + ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.contain, + height: 80, + ), + ), + ], + ), + Column( + children: [ + Container( + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + ], + ), + Container( + height: 100.0, + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 4.0, + ), + Texts( + model + .parentProducts[index] + .name, + regular: true, + fontSize: 13.2, + fontWeight: + FontWeight.w500, + maxLines: 5, + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .parentProducts[ + index] + .approvedRatingSum > + 0 + ? (model.parentProducts[index].approvedRatingSum + .toDouble() / + model + .parentProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ); + }), + ) + ], + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart new file mode 100644 index 00000000..878544e1 --- /dev/null +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -0,0 +1,70 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart'; +import 'package:flutter/material.dart'; + +AppSharedPreferences sharedPref = AppSharedPreferences(); +var languageID; +class ProductCheckTypeWidget extends StatelessWidget { + final List wishlist; + final bool isTrue; + + ProductCheckTypeWidget(this.isTrue, this.wishlist); + + + void initState() { + getLanguageID(); + } + + @override + Widget build(BuildContext context) { + return isTrue + ? ListView.builder( + itemCount: wishlist.length, + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Container( + child: isTrue + ? productTile( + productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name, + productPrice: wishlist[index].subtotal, + productRate: + double.parse(wishlist[index].subtotalVatRate), + productImage: wishlist[index].product.images[0].src, + showLine: isTrue, + productID: wishlist[index].product.id, + ) + : productTile( + productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name, + productPrice: wishlist[index].subtotal, + productRate: + double.parse(wishlist[index].subtotalVatRate), + productImage: wishlist[index].product.images[0].src, + showLine: isTrue, + ), + ), + Divider(height: 1, color: Colors.grey) + ], + ); + }) + : GridView.count( + crossAxisCount: 2, + children: List.generate( + wishlist.length, + (index) => productTile( + productName: wishlist[index].product.name, + productPrice: wishlist[index].subtotal, + productRate: + double.parse(wishlist[index].subtotalVatRate), + productImage: wishlist[index].product.images[0].src, + showLine: isTrue, + )), + ); + } +} + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} + diff --git a/lib/pages/pharmacies/compare-list.dart b/lib/pages/pharmacies/compare-list.dart new file mode 100644 index 00000000..37e2fc8c --- /dev/null +++ b/lib/pages/pharmacies/compare-list.dart @@ -0,0 +1,36 @@ +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; + +class CompareList with ChangeNotifier { + List _product = []; + + List get productListItems => _product; + + void addItem(data) { + if (_product.length == 0) { + _product.add(data); + AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + } else { + for (int i = 0; i < _product.length; i++) { + if (_product.length <= 4 && _product[i].id != data.id) { + _product.add(data); + AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + break; + } else if(_product[i].id == data.id){ + AppToast.showErrorToast(message: 'the item is already in the list'); + } else if(_product.length == 4){ + AppToast.showErrorToast(message: 'your compare list is full'); + } + } + } + notifyListeners(); + } + + void deleteItem(data) { + for (int i = 0; i < _product.length; i++) { + if (_product[i].id == data) _product.remove(_product[i]); + } + notifyListeners(); + } +} diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart new file mode 100644 index 00000000..d1872187 --- /dev/null +++ b/lib/pages/pharmacies/compare.dart @@ -0,0 +1,328 @@ +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:provider/provider.dart'; + +int counter = 0; + +class ComparePage extends StatefulWidget { + @override + _ComparePageState createState() => _ComparePageState(); +} + +//CompareList compareItems = CompareList(); +class _ComparePageState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Reviews page', + isShowAppBar: true, + isPharmacy: true, + body: Container( + child: compareList(), + ), + ); + } +} + +class compareList extends StatelessWidget { + @override + Widget build(BuildContext context) { + final productItemData = Provider.of(context); + final productItem = productItemData.productListItems; + return productItem.length == 0 + ? Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), + ), + ) + : CarouselSlider( + options: CarouselOptions( + height: 800.0, + viewportFraction: 0.87, + enableInfiniteScroll: false), + items: productItem.map((i) { + return Builder( + builder: (BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 8), + child: Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.symmetric(horizontal: 10.0), + child: productItem.length != 0 + ? slideDetail(productItem) + : Container(), + ), + ); + }, + ); + }).toList(), + ); + } +} + +class slideDetail extends StatefulWidget { + final List data; + + slideDetail(this.data); + + @override + _slideDetailState createState() => _slideDetailState(); +} + +class _slideDetailState extends State { + @override + Widget build(BuildContext context) { + return ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: widget.data.length, + itemBuilder: (BuildContext contx, int index) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 550, + width: 150, + margin: EdgeInsets.symmetric(horizontal: 10.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border( + top: BorderSide(width: 0.5, color: Colors.grey), + left: BorderSide(width: 0.5, color: Colors.grey), + right: BorderSide(width: 0.5, color: Colors.grey), + bottom: BorderSide(width: 0.5, color: Colors.grey), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Container( + child: Align( + alignment: Alignment.topRight, + child: IconButton( + icon: Icon(FontAwesomeIcons.trashAlt, size: 15), + onPressed: () { + setState(() { + Provider.of(context, listen: false) + .deleteItem(widget.data[index].id); + }); + }, + ), + ), + ), + SizedBox( + height: 20, + ), + Image.network( + widget.data[index].images[0].src.trim(), + fit: BoxFit.cover, + width: 100, + height: 60, + ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].price.toString(), + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[0].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[1].name, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[2].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[3].name, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[4].name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications[5].name, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Container( + height: 1.0, + width: 300.0, + color: Colors.grey, + ), + ), + ], + ), + ), + ), + ], + ); + }, + ); + } +} + +String returnString(data) { + for (int i = 0; i < data.length; i++) { + print(data[i]); +// if(data[i] == null){ +// if(counter == i){ +// +// } +// } + } + return "ENAD HILAL"; +} diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart new file mode 100644 index 00000000..7b17a359 --- /dev/null +++ b/lib/pages/pharmacies/my_reviews.dart @@ -0,0 +1,248 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/review_view_model.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; + +class MyReviewsPage extends StatefulWidget { + @override + _MyReviewsPageState createState() => _MyReviewsPageState(); +} + +var languageID; + +class _MyReviewsPageState extends State { + void initState() { + getLanguageID(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getReviewData(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: 'My Reviews', + isShowAppBar: true, + isPharmacy: true, + baseViewModel: model, + body: model.reviewListList.length == 0 + ? Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), + ), + ) + : Container( + child: ListView.builder( + itemCount: model.reviewListList.length, + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Container( + child: reviewDetails( + model.reviewListList[index], + double.parse(model.reviewListList[index].product + .approvedTotalReviews + .toString()), + double.parse(model.reviewListList[index].rating + .toString()), + ), + ), + Divider(height: 1, color: Colors.grey) + ], + ); + }), + ), + ), + ); + } +} + +reviewDetails(data, rate, myRate) { + return Container( + child: Padding( + padding: EdgeInsets.only(bottom: 10.0), + child: Container( + height: 200, + width: double.infinity, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: languageID == 'ar' + ? EdgeInsets.only(top: 10, right: 10) + : EdgeInsets.only(top: 10, left: 10), + child: Image.network( + data.product.images[0].src.trim(), + fit: BoxFit.cover, + width: 80, + height: 80, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + child: RichText( + text: TextSpan( + text: languageID == 'ar' + ? data.product.namen + : data.product.name, + style: TextStyle( + color: Colors.black54, + fontSize: languageID == 'ar' ? 7 : 13, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + child: RichText( + text: TextSpan( + text: data.product.price.toString() + + " " + + data.product.currency, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: rate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + ], + ), + ], + ), + SizedBox( + height: 20, + ), + Container( + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10) + : EdgeInsets.only(left: 10), + child: Text(data.createdOnUtc.toString())), + ], + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: languageID == 'ar' + ? EdgeInsets.only(right: 60) + : EdgeInsets.only(left: 60), + child: RatingBar.readOnly( + initialRating: myRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 15, + ), + Expanded( + child: Container( + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10) + : EdgeInsets.only(left: 10), + child: Text(fixingString(data.reviewText.toString())), + ), + ), + ], + ), + ), + ), + ); +} + +fixingString(txt) { + String stringTxt; + String newTxt; + stringTxt = txt.toString(); + newTxt = stringTxt.split('.')[1]; + + return newTxt; +} + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart new file mode 100644 index 00000000..b9e6db95 --- /dev/null +++ b/lib/pages/pharmacies/product-brands.dart @@ -0,0 +1,254 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/pages/login/register-info.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart'; +import 'package:diplomaticquarterapp/pages/search_products_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; + +class ProductBrandsPage extends StatefulWidget { + @override + _ProductBrandsPageState createState() => _ProductBrandsPageState(); +} + +var languageID; +class _ProductBrandsPageState extends State { + + @override + void initState() { + super.initState(); + getLanguageID(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getBrandsData(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: 'Brands page', + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: Container( + child: Column( + children: [ + Container( + color: Colors.white, + alignment: languageID == 'ar'? + Alignment.topRight : + Alignment.topLeft, + padding: languageID == 'ar' ? + EdgeInsets.only( + right: 10.0, + top: 10.0 + ): + EdgeInsets.only( + left: 10.0, + top: 10.0 + ), + child: Text( + TranslationBase.of(context).topBrands, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + height: 220, + width: double.infinity, + color: Colors.white, + child: topBrand(), + ), + SizedBox( + height: 10, + ), + Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, + ), + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchBrandsPage()), + ); + }, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 230, + width: double.infinity, + color: Colors.white, + child: ListView.builder( + itemCount: model.brandsListList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Container( + margin: EdgeInsets.only(top: 50, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + languageID == 'ar' ? Text(model.brandsListList[index].namen):Text(model.brandsListList[index].name), + SizedBox( + height: 3, + ), + Divider(height: 1, color: Colors.grey) + ], + ), + ), + onTap: (){ + print("ENAD"); + }, + ); + }), + ), + ], + ), + ), + ), + ); + } +} + + +topBrand() { + return BaseView( + onModelReady: (model) => model.getTopBrandsData(), + builder: (_, model, wi) => GridView.count( + crossAxisCount: 4, + children: List.generate( + model.topBrandsListList.length, + (index) => Column( + children: [ + InkWell( + child: Container( + margin: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 0.0), + child: Container( + child: Container( + child: Container( +// padding: EdgeInsets.only(left: 5), + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10.0, vertical: 10.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border( + top: BorderSide(width: 1.0, color: Colors.grey), + left: BorderSide(width: 1.0, color: Colors.grey), + right: BorderSide(width: 1.0, color: Colors.grey), + bottom: BorderSide(width: 1.0, color: Colors.grey), + ), + color: Colors.white, + ), + child: model.topBrandsListList[index].image != null ?Image.network( + model.topBrandsListList[index].image.src, + fit: BoxFit.cover, + width: 60, + height: 40, + ): Text(model.topBrandsListList[index].name) + ), + ), + ), + ), + ), + onTap: (){ + print("ENAD"); + }, + ), + ], + ), + ), + ), + ); +} + +brandSearch() { + return Text('ENAD'); +} + +class SearchBar extends SearchDelegate { + @override + List buildActions(BuildContext context) { + return [ + IconButton( + icon: Icon(Icons.clear), + onPressed: () { + query = ""; + }, + ) + ]; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: AnimatedIcon( + icon: AnimatedIcons.menu_arrow, + progress: transitionAnimation, + ), + onPressed: () { + close(context, null); + }, + ); + } + + @override + Widget buildResults(BuildContext context) { + return Container( + height: 100, + width: 100, + child: Card( + color: Colors.red, + child: Center( + child: Text(query), + ), + ), + ); + } + + @override + Widget buildSuggestions(BuildContext context) { + return ListView.builder( + itemCount: 5, + itemBuilder: (context, index) => ListTile( + leading: Icon(Icons.location_city), + title: Text("Enad"), + onTap: () { + showResults(context); + }, + ), + ); + } +} + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart new file mode 100644 index 00000000..2040db11 --- /dev/null +++ b/lib/pages/pharmacies/product_detail.dart @@ -0,0 +1,1862 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; + +int price = 0; +var languageID; +bool isOverQuantity = false; +bool isInWishlit = false; +var itemID; +var product; +var customerId; +CompareList compareItems = new CompareList(); +PharmacyProduct specificationData; + +class ProductDetailPage extends StatefulWidget { + final PharmacyProduct product; + ProductDetailPage(this.product); + @override + __ProductDetailPageState createState() => __ProductDetailPageState(); +} + +class __ProductDetailPageState extends State { + bool isTrue = true; + bool isDetails = true; + bool isReviews = false; + bool isAvailabilty = false; + dynamic wishlistItems; + + void initState() { + price = 0; + specificationData = widget.product; + setState(() { + customerId = userInfo(widget.product.id, widget.product); + }); + super.initState(); + } + + Widget build(BuildContext context) { + return customerId != null + ? DetailPageScafold( + appBarTitle: 'product detail page', + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + color: Colors.white, + child: Column( + children: [ + Image.network( + widget.product.images[0].src.trim(), + ), + widget.product.discountDescription != null + ? Container( + width: double.infinity, + height: 50, + color: Colors.yellowAccent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: languageID == 'ar' + ? Text( + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ) + : Text( + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 0, + child: Container( + child: Image( + image: AssetImage( + 'assets/images/offer.png'), + ), + ), + ), + ], + ), + ) + : Container(), + ], + ), + ), + SizedBox( + height: 4, + ), + Container( + width: 500, + height: 150, + color: Colors.white, + child: productNameAndPrice(context, widget.product), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + height: 120, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ), + Divider(color: Colors.grey), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + "there is no data", + ), + ), + ), + ], + ), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + margin: EdgeInsets.only(bottom: 100), +// height: 350, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isDetails + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container() + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = true; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isReviews + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = false; + isAvailabilty = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isAvailabilty + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text( + TranslationBase.of(context).description, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + languageID == 'ar' + ? widget.product.fullDescriptionn + : widget.product.fullDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), + ), + ], + ), + ) + : isReviews + ? BaseView( + onModelReady: (model) => + model.getProductReviewsData( + widget.product.id), + builder: (_, model, wi) => model + .productDetailService + .length != + 0 && + model.productDetailService[0] + .reviews.length != + 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model + .productDetailService[0] + .reviews + .length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[ + index] + .customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors + .grey, + fontWeight: + FontWeight + .w600), + ), + ), + Container( + margin: + EdgeInsets.only( + left: 210), + child: RatingBar + .readOnly( + initialRating: model + .productDetailService[ + 0] + .reviews[ + index] + .rating + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: Colors + .grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[index] + .reviewText, + style: TextStyle( + fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider( + height: 1, + color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text('No Reviews Available'), + ), + ) + : isAvailabilty + ? BaseView( + onModelReady: (model) => + model.getProductLocationData(), + builder: (_, model, wi) => model + .productLocationService + .length == + 0 + ? Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + 'No location Available'), + ) + : ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .productLocationService + .length, + itemBuilder: + (BuildContext context, + int index) { + return Padding( + padding: + EdgeInsets.all(8.0), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( +// crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Expanded( + flex: 1, + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + model + .productLocationService[ + index] + .locationDescription + + "\n" + + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: + 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .location_on), + color: + Colors.red, + onPressed: + () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .phone), + color: + Colors.red, + onPressed: + () {}, + ), + ), + ], + ), + Divider( + height: 1.2, + color: Colors.grey) + ], + ), + ); + }, + ), + ) + : Container(), + ], + ), + ), +// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), + ], + ), + ), + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), + ) + : AppScaffold( + appBarTitle: 'product detail page', + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + color: Colors.white, + child: Column( + children: [ + Image.network( + widget.product.images[0].src.trim(), + ), + widget.product.discountDescription != null + ? Container( + width: double.infinity, + height: 50, + color: Colors.yellowAccent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: languageID == 'ar' + ? Text( + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ) + : Text( + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 0, + child: Container( + child: Image( + image: AssetImage( + 'assets/images/offer.png'), + ), + ), + ), + ], + ), + ) + : Container(), + ], + ), + ), + SizedBox( + height: 4, + ), + Container( + width: 500, + height: 150, + color: Colors.white, + child: productNameAndPrice(context, widget.product), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + height: 120, + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + TranslationBase.of(context).specification, + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ), + Divider(color: Colors.grey) + ], + ), + ), + SizedBox( + height: 6, + ), + Container( + width: 500, + margin: EdgeInsets.only(bottom: 100), +// height: 350, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isDetails + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container() + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = true; + isAvailabilty = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isReviews + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = false; + isReviews = false; + isAvailabilty = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + isAvailabilty + ? Container( + width: 100, + height: 5, + color: Colors.green, + ) + : Container(), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text( + TranslationBase.of(context).description, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + languageID == 'ar' + ? widget.product.fullDescriptionn + : widget.product.fullDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), + ), + ], + ), + ) + : isReviews + ? BaseView( + onModelReady: (model) => + model.getProductReviewsData( + widget.product.id), + builder: (_, model, wi) => model + .productDetailService + .length != + 0 && + model.productDetailService[0] + .reviews.length != + 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model + .productDetailService[0] + .reviews + .length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[ + index] + .customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors + .grey, + fontWeight: + FontWeight + .w600), + ), + ), + Container( + margin: + EdgeInsets.only( + left: 210), + child: RatingBar + .readOnly( + initialRating: model + .productDetailService[ + 0] + .reviews[ + index] + .rating + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: Colors + .grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[index] + .reviewText, + style: TextStyle( + fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider( + height: 1, + color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text('No Reviews Available'), + ), + ) + : isAvailabilty + ? BaseView( + onModelReady: (model) => + model.getProductLocationData(), + builder: (_, model, wi) => + ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model + .productLocationService.length, + itemBuilder: (BuildContext context, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( +// crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + model + .productLocationService[ + index] + .locationDescription + + "\n" + + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons + .location_on), + color: Colors.red, + onPressed: () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: + Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, + ), + ), + ], + ), + Divider( + height: 1.2, + color: Colors.grey) + ], + ), + ); + }, + ), + ) + : Container(), + ], + ), + ), +// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), + ], + ), + ), + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), + ); + } +} + +class footerWidget extends StatefulWidget { + final bool isAvailble; + final int maxQuantity; + final int minQuantity; + final int quantityLimit; + final PharmacyProduct item; + footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, + this.quantityLimit, this.item); + @override + _footerWidgetState createState() => _footerWidgetState(); +} + +class _footerWidgetState extends State { + double quantityUI = 70; + bool showUI = false; + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: quantityUI, + color: Colors.white, + child: Column( + children: [ + showUI + ? Container( + width: double.infinity, + height: 90, + color: Colors.white, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).quantity, + style: TextStyle( + fontSize: 15, fontWeight: FontWeight.bold), + ), + ), +// ListView( +// scrollDirection: Axis.horizontal, +// children: [ +// itemQuantity(), +// ], +// ), + Container( +// margin: EdgeInsets.symmetric(vertical: 20.0), + height: 50.0, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '1', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 1; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '2', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 2; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '3', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 3; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '4', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 4; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '5', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 5; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '6', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 6; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '7', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 7; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '8', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 8; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '9', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 9; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + InkWell( + child: Container( + alignment: Alignment.center, + width: 50.0, + color: Colors.white, + child: Text( + '10', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), + ), + ), + onTap: () { + setState(() { + price = 10; + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + return price; + } + }); + }, + ), + SizedBox( + width: 5, + ), + Container( + width: 50.0, + child: TextField( + decoration: + InputDecoration(labelText: 'quantity #'), + onChanged: (text) { + print(price); + print(widget.quantityLimit); + if (int.tryParse(text) == null) { + text = ''; + } else { + setState(() { + price = int.parse(text); + if (price >= widget.quantityLimit) { + isOverQuantity = true; + } else { + isOverQuantity = false; + } + }); + } + }, + ), + ), + ], + ), + ) + ], + ), + ), + ) + : Container( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 70, + height: 50, + child: FlatButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Text( + price.toString(), + style: TextStyle(fontSize: 20), + ), + ), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), + ), + ], + ), + onPressed: () { + setState(() { + if (showUI) { + quantityUI = 70; + showUI = false; + } else { + quantityUI = 150; + showUI = true; + } + }); + }, + ), + ), + !widget.isAvailble && price > 0 || price > widget.quantityLimit + ? Container( + width: 190, + height: 46, + color: Colors.grey, + child: Align( + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).addToCart, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ) + : InkWell( + onTap: () { + addToCartFunction(price, widget.item.id); + }, + child: Container( + alignment: Alignment.center, + width: 190, + height: 46, + color: Colors.green, + child: Text( + TranslationBase.of(context).addToCart, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ), + SizedBox( + width: 5, + ), + !widget.isAvailble && price > 0 || price > widget.quantityLimit + ? Container( + width: 120, + height: 46, + color: Colors.grey, + child: Align( + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).buyNow, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ) + : InkWell( + onTap: () { + print('buy now'); + addToCartFunction(price, widget.item.id); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartOrderPage()), + ); + }, + child: Container( + alignment: Alignment.center, + width: 120, + height: 46, + color: Colors.blue, + child: Text( + TranslationBase.of(context).buyNow, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), + ), + ), + ), + ], + ), + ], + ), + ); + } +} + +class productNameAndPrice extends StatefulWidget { + BuildContext context; + PharmacyProduct item; + productNameAndPrice(this.context, this.item); + @override + _productNameAndPriceState createState() => _productNameAndPriceState(); +} + +class _productNameAndPriceState extends State { + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Text( + widget.item.price.toString(), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), + ), + SizedBox( + width: 40, + ), + Text( + widget.item.stockAvailability, + style: widget.item.stockAvailability == 'Out of stock' + ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) + : TextStyle( + fontWeight: FontWeight.bold, color: Colors.green), + ), + SizedBox(width: 20), + widget.item.stockAvailability == 'Out of stock' + ? Text( + TranslationBase.of(context).notifyMe, + style: TextStyle( + color: Colors.blue, + decoration: TextDecoration.underline, + ), + ) + : Container(), + widget.item.stockAvailability == 'Out of stock' + ? Icon( + FontAwesomeIcons.bell, + color: Colors.blue, + size: 15.0, + ) + : Container(), + Container( + margin: languageID == 'ar' + ? EdgeInsets.only(right: 25) + : EdgeInsets.only(left: 25), + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(30), + ), + child: !isInWishlit + ? IconButton( + icon: Icon(Icons.favorite_border), + color: Colors.white, + onPressed: () { + setState(() { + addToWishlistFunction(widget.item.id); + }); +// MyStatelessWidget(); + }, + ) + : IconButton( + icon: Icon(Icons.favorite), + color: Colors.red, + onPressed: () { + setState(() { + deleteFromWishlistFunction(widget.item.id); + }); +// MyStatelessWidget(); + }, + )), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: + languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, + child: Text( + languageID == 'ar' + ? widget.item.fullDescriptionn + : widget.item.fullDescription, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Row( + children: [ + Expanded( + flex: 2, + child: Container( + margin: EdgeInsets.only(right: 150), + child: Align( + alignment: Alignment.bottomLeft, + child: RatingBar.readOnly( + initialRating: 3, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + ), + Expanded( + flex: 1, + child: Container( + child: widget.item.rxMessage != null + ? Text( + languageID == 'ar' + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), + style: TextStyle(color: Colors.red, fontSize: 10), + ) + : Container()), + ), + widget.item.rxMessage != null + ? Icon( + FontAwesomeIcons.questionCircle, + color: Colors.red, + size: 15.0, + ) + : Container(), + ], + ), + ], + ); + } +} + +//productNameAndPrice(BuildContext context, item) { +// return Column( +// mainAxisAlignment: MainAxisAlignment.start, +// children: [ +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// children: [ +// Text( +// item.price.toString(), +// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), +// ), +// SizedBox( +// width: 40, +// ), +// Text( +// item.stockAvailability, +// style: item.stockAvailability == 'Out of stock' +// ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) +// : TextStyle(fontWeight: FontWeight.bold, color: Colors.green), +// ), +// SizedBox(width: 20), +// item.stockAvailability == 'Out of stock' +// ? Text( +// TranslationBase.of(context).notifyMe, +// style: TextStyle( +// color: Colors.blue, +// decoration: TextDecoration.underline, +// ), +// ) +// : Container(), +// item.stockAvailability == 'Out of stock' +// ? Icon( +// FontAwesomeIcons.bell, +// color: Colors.blue, +// size: 15.0, +// ) +// : Container(), +// +// Container( +// margin: languageID=='ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25), +// width: 40, +// height: 40, +// decoration: BoxDecoration( +// color: Colors.grey, +// borderRadius: BorderRadius.circular(30), +// ), +// child: !isInWishlit ?IconButton( +// icon: Icon(Icons.favorite_border), +// color: Colors.white, +// onPressed: () { +// addToWishlistFunction(item.id); +//// MyStatelessWidget(); +// +// }, +// ):IconButton( +// icon: Icon(Icons.favorite), +// color: Colors.red, +// onPressed: () { +// deleteFromWishlistFunction(item.id); +//// MyStatelessWidget(); +// +// }, +// ) +// ), +// +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: +// languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, +// child: Text( +// languageID == 'ar' ? item.fullDescriptionn : item.fullDescription, +// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), +// ), +// ), +// ), +// ), +// Row( +// children: [ +// Expanded( +// flex: 2, +// child: Container( +// margin: EdgeInsets.only(right: 150), +// child: Align( +// alignment: Alignment.bottomLeft, +// child: RatingBar.readOnly( +// initialRating: 3, +// size: 15.0, +// filledColor: Colors.yellow[700], +// emptyColor: Colors.grey[500], +// isHalfAllowed: true, +// halfFilledIcon: Icons.star_half, +// filledIcon: Icons.star, +// emptyIcon: Icons.star, +// ), +// ), +// ), +// ), +// Expanded( +// flex: 1, +// child: Container( +// child: item.rxMessage != null +// ? Text( +// languageID == 'ar' +// ? item.rxMessagen.toString() +// : item.rxMessage.toString(), +// style: TextStyle(color: Colors.red, fontSize: 10), +// ) +// : Container()), +// ), +// item.rxMessage != null +// ? Icon( +// FontAwesomeIcons.questionCircle, +// color: Colors.red, +// size: 15.0, +// ) +// : Container(), +// ], +// ), +// ], +// ); +//} + +slideDetail() { + return Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 15.0), + decoration: const BoxDecoration( + border: Border( + top: BorderSide(width: 0.5, color: Colors.grey), + left: BorderSide(width: 0.5, color: Colors.grey), + right: BorderSide(width: 0.5, color: Colors.grey), + bottom: BorderSide(width: 0.5, color: Colors.grey), + ), + color: Colors.white, + ), + child: const Text('1', + textAlign: TextAlign.center, + style: TextStyle(color: Color(0xFF000000))), + ), + ) + ], + ); +} + +fixingString(txt) { + String stringTxt; + String newTxt; + stringTxt = txt.toString(); + newTxt = stringTxt.split('.')[1]; + + return newTxt; +} + +getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); +} + +getSpecificationData(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + specificationData = await x.productSpecificationData(itemID); +} + +addToCartFunction(quantity, itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.addToCartData(quantity, itemID); +} + +addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlit = true; + await x.addToWishlistData(itemID); +} + +deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlit = false; + await x.addToWishlistData(itemID); +} + +checkWishlist() async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + for (int i = 0; i < x.wishListItems.length; i++) { +// print(itemID); +// print(x.wishListItems[i].product.id); + if (itemID == x.wishListItems[i].product.id) { + isInWishlit = true; +// print('in wishlist'); + break; + } else { + isInWishlit = false; +// print('not in wishlist'); + } + } +} + +class sttingModalBottomSheet extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container(); + } +} + +settingModalBottomSheet(context) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return Container( + child: new Wrap( + children: [ + new ListTile( + leading: new Icon(Icons.shopping_cart), + title: new Text('Add to cart'), + onTap: () => { + if (price > 0) + {addToCartFunction(price, itemID)} + else + { + AppToast.showErrorToast( + message: "you should add quantity") + } + }), + new ListTile( + leading: new Icon(Icons.favorite_border), + title: new Text('Add to wishlist'), + onTap: () => {addToWishlistFunction(itemID)}, + ), + new ListTile( + leading: new Icon(Icons.compare), + title: new Text('Compare'), + onTap: () => { + Provider.of(context, listen: false) + .addItem(specificationData), + }, + ), + ], + ), + ); + }); +} + +userInfo(id, product) async { + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = id; + product = product; + checkWishlist(); + } + return customerId; +// getSpecificationData(itemID); +} diff --git a/lib/pages/pharmacies/screens/address-select-page.dart b/lib/pages/pharmacies/screens/address-select-page.dart new file mode 100644 index 00000000..6c39ba3f --- /dev/null +++ b/lib/pages/pharmacies/screens/address-select-page.dart @@ -0,0 +1,34 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class AddressSelectPageTest extends StatelessWidget { + final List addresses; + + AddressSelectPageTest(this.addresses); + + @override + Widget build(BuildContext context) { + return AppScaffold( + title: "test", + isShowAppBar: true, + isShowDecPage: false, + body: Column( + children: [ + Container( + child: RaisedButton( + onPressed: () => {Navigator.pop(context, addresses[0])}, + child: new Text( + "Set address", + style: new TextStyle(color: Colors.white, fontSize: 14), + ), + color: Colors.blueAccent, + disabledColor: Colors.blueAccent, + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart new file mode 100644 index 00000000..c5576900 --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -0,0 +1,366 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-preview.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class CartOrderPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + PreferredSizeWidget appBarWidget = + AppBarWidget(TranslationBase.of(context).shoppingCart, null, true); + final height = mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top; + + return BaseView( + onModelReady: (model) => model.getOrderPreviewData(), + builder: (_, model, wi) => ChangeNotifierProvider.value( + value: model.cartResponse, + child: AppScaffold( + title: TranslationBase.of(context).shoppingCart, + isShowAppBar: true, + isShowDecPage: false, + isPharmacy: true, + baseViewModel: model, + appBarWidget: appBarWidget, + backgroundColor: Colors.white, + body: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? Container( + height: height * 0.85, + width: double.infinity, + child: Consumer( + builder: (ctx, cart, _) => Container( + 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.shade700, + ), + onTap: () => {model.deleteShoppingCart()}, + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + child: Column( + children: [ + ...List.generate( + cart.shoppingCarts != null + ? cart.shoppingCarts.length + : 0, + (index) => ProductOrderItem( + cart.shoppingCarts[index], () { + print(cart.shoppingCarts[index] + .quantity); + model.changeProductQuantity( + cart.shoppingCarts[index]); + }, + () => model.deleteProduct( + cart.shoppingCarts[index]))) + ], + ), + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 2, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).subtotal, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Image.asset( + "assets/images/pharmacy_module/payment_image.png", + width: mediaQuery.size.width - 20, + height: 30.0, + fit: BoxFit.scaleDown, + ) + ], + ), + ), + ), + ), + ), + ) + : Container(), + bottomSheet: Container( + height: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? height * 0.15 + : 0, + color: Colors.white, + child: OrderBottomWidget(model.addresses, height), + ), + ), + ), + ); + } +} + +class OrderBottomWidget extends StatefulWidget { + final List addresses; + final double height; + + OrderBottomWidget(this.addresses, this.height); + + @override + _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); +} + +class _OrderBottomWidgetState extends State { + bool isAgree = false; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: Consumer( + builder: (ctx, cart, _) => !(cart.shoppingCarts == null || + cart.shoppingCarts.length == 0) + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + height: widget.height * 0.070, + color: Color(0xffe6ffe0), + padding: EdgeInsets.symmetric(horizontal: 4), + child: Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + isAgree = !isAgree; + }); + }, + child: Container( + width: 25.0, + height: widget.height * 0.070, + decoration: new BoxDecoration( + color: !isAgree + ? Color(0xffeeeeee) + : Colors.green, + shape: BoxShape.circle, + ), + child: !isAgree + ? null + : Padding( + padding: const EdgeInsets.all(0.0), + child: Icon( + Icons.check, + color: Colors.white, + size: 25, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 4), + margin: const EdgeInsets.symmetric(vertical: 4), + child: Texts( + TranslationBase.of(context) + .pharmacyServiceTermsCondition, + fontSize: 13, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ), + InkWell( + onTap: () => { + Navigator.push(context, + FadePage(page: PharmacyTermsConditions())) + }, + child: Container( + child: Icon( + Icons.info, + size: 25, + color: Color(0xff005aff), + ), + ), + ), + ], + ), + ), + ), + Container( + height: widget.height * 0.065, + margin: EdgeInsets.symmetric(vertical: 2), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.symmetric( + horizontal: 0, vertical: 0), + child: Row( + children: [ + Texts( + "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", + fontSize: + projectProvider.isArabic ? 12 : 14, + fontWeight: FontWeight.bold, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 4), + child: Texts( + "${TranslationBase.of(context).inclusiveVat}", + fontSize: 8, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Texts( + "${cart.quantityCount} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + RaisedButton( + onPressed: isAgree + ? () => { + Navigator.push( + context, + FadePage( + page: OrderPreviewPage( + widget.addresses))) + } + : null, + child: new Text( + "${TranslationBase.of(context).checkOut}", + style: new TextStyle( + color: isAgree + ? Colors.white + : Colors.grey.shade300, + fontSize: 14), + ), + color: Color(0xff005aff), + disabledColor: Color(0xff005aff), + ), + ], + ), + ), + ], + ) + : Container(), + )); + } +} diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart new file mode 100644 index 00000000..b4736d7a --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-order-preview.dart @@ -0,0 +1,835 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/address-select-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter/scheduler.dart'; + +class OrderPreviewPage extends StatelessWidget { + final List addresses; + + OrderPreviewPage(this.addresses); + + @override + Widget build(BuildContext context) { + PreferredSizeWidget appBarWidget = + AppBarWidget("${TranslationBase.of(context).checkOut}", null, true); + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top; + + return BaseView( + onModelReady: (model) => model.getShoppingCart(), + builder: (_, model, wi) => ChangeNotifierProvider.value( + value: model.paymentCheckoutData, + child: AppScaffold( + title: "${TranslationBase.of(context).checkOut}", + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + appBarWidget: appBarWidget, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + height: height * 0.90, + child: SingleChildScrollView( + child: Container( + color: Color(0xFFF1F1F1), + child: Column( + children: [ + SelectAddressWidget(model, addresses), + SizedBox( + height: 10, + ), + SelectPaymentOptionWidget(model), + SizedBox( + height: 10, + ), + Consumer( + builder: (ctx, paymentData, _) => + paymentData.lacumInformation != null + ? Container( + child: Column( + children: [ + LakumWidget(model), + SizedBox( + height: 10, + ), + ], + ), + ) + : Container()), + Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).reviewOrder, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ...List.generate( + model.cartResponse.shoppingCarts != null + ? model.cartResponse.shoppingCarts.length + : 0, + (index) => ProductOrderPreviewItem( + model.cartResponse.shoppingCarts[index]), + ), + ], + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(8), + child: model.cartResponse.subtotal != null + ? Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .orderSummary, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).subtotal}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).shipping}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + SizedBox( + height: 10, + ), + ], + ) + : Container(), + ) + ], + ), + ), + ), + ), + bottomSheet: Container( + height: model.cartResponse.shoppingCarts != null + ? height * 0.10 + : 0, + color: Colors.white, + child: PaymentBottomWidget(model), + ), + ), + )); + } +} + +class SelectAddressWidget extends StatefulWidget { + final OrderPreviewViewModel model; + final List addresses; + + SelectAddressWidget(this.model, this.addresses); + + @override + _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); +} + +class _SelectAddressWidgetState extends State { + Addresses address; + + _navigateToAddressPage() { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())) + .then((result) { + if (result != null) { + address = result; + widget.model.paymentCheckoutData.address = address; + widget.model.getInformationsByAddress(); + } + + /* setState(() { + if (result != null) { + address = result; + widget.model.paymentCheckoutData.address = address; + widget.model.getInformationsByAddress(); + } + })*/ + }); + } + + @override + void initState() { + if (widget.model.paymentCheckoutData.address != null) { + address = widget.model.paymentCheckoutData.address; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (ctx, paymentData, _) => Container( + color: Colors.white, + child: address == null + ? InkWell( + onTap: () => {_navigateToAddressPage()}, + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_address.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: + EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).selectAddress, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff0000ff), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 20, + color: Colors.grey.shade400, + ), + ], + ), + ), + ) + : Container( + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_mark.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).shippingAddress, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ), + InkWell( + onTap: () => {_navigateToAddressPage()}, + child: Texts( + TranslationBase.of(context).changeAddress, + fontSize: 12, + fontWeight: FontWeight.normal, + color: Color(0xff0000ff), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Texts( + "${address.firstName} ${address.lastName}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Texts( + "${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}", + fontSize: 12, + fontWeight: FontWeight.normal, + color: Colors.grey.shade500, + ), + ), + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 8), + child: Icon( + Icons.phone, + size: 20, + color: Colors.black, + ), + ), + Texts( + "${address.phoneNumber}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + ), + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_truck.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + padding: EdgeInsets.symmetric( + vertical: 0, horizontal: 6), + child: Texts( + "${TranslationBase.of(context).shipBy}", + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Container( + child: Image.asset( + paymentData.shippingOption + .shippingRateComputationMethodSystemName == + "Shipping.FixedOrByWeight" + ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" + : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", + fit: BoxFit.contain, + ), + margin: EdgeInsets.symmetric(horizontal: 8), + ), + ], + ), + ], + ), + ), + ), // ic_shipping_mark.png + ), + ); + } +} + +class SelectPaymentOptionWidget extends StatefulWidget { + final OrderPreviewViewModel model; + + SelectPaymentOptionWidget(this.model); + + @override + _SelectPaymentOptionWidgetState createState() => + _SelectPaymentOptionWidgetState(); +} + +class _SelectPaymentOptionWidgetState extends State { + PaymentOption paymentOption; + + _navigateToPaymentOption() { + Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) + .then((result) => { + setState(() { + if (result != null) { + paymentOption = result; + widget.model.paymentCheckoutData.paymentOption = + paymentOption; + widget.model.paymentCheckoutData.updateData(); + } + }) + }); + } + + @override + void initState() { + if (widget.model.paymentCheckoutData.paymentOption != null) { + paymentOption = widget.model.paymentCheckoutData.paymentOption; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: paymentOption == null + ? InkWell( + onTap: () => {_navigateToPaymentOption()}, + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_payment_option.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: + EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).selectPaymentOption, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff0000ff), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 20, + color: Colors.grey.shade400, + ), + ], + ), + ), + ) + : Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_payment_option.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0), + decoration: new BoxDecoration( + color: Colors.grey.shade100, + shape: BoxShape.rectangle, + ), + child: Image.asset( + widget.model.getPaymentOptionImage(paymentOption), + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + widget.model.getPaymentOptionName(paymentOption), + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ), + InkWell( + onTap: () => {_navigateToPaymentOption()}, + child: Texts( + TranslationBase.of(context).changeMethod, + fontSize: 12, + fontWeight: FontWeight.normal, + color: Color(0xff0000ff), + ), + ), + ], + ), + ), + ); + } +} + +class LakumWidget extends StatefulWidget { + final OrderPreviewViewModel model; + + LakumWidget(this.model); + + @override + _LakumWidgetState createState() => _LakumWidgetState(); +} + +class _LakumWidgetState extends State { + TextEditingController _pointsController = new TextEditingController(); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_checkout.png", + width: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).lakumPoints}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Texts( + "${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}", + fontSize: 12, + fontWeight: FontWeight.normal, + ), + ], + ), + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Texts( + "${TranslationBase.of(context).riyal}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Container( + margin: projectProvider.isArabic + ? EdgeInsets.only(right: 4) + : EdgeInsets.only(left: 4), + width: 60, + height: 50, + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black, width: 0.2), + gapPadding: 0, + borderRadius: projectProvider.isArabic + ? BorderRadius.only( + topRight: Radius.circular(8), + bottomRight: Radius.circular(8)) + : BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8)), + ), + disabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black, width: 0.4), + gapPadding: 0, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8)), + ), + ), + controller: _pointsController, + keyboardType: TextInputType.number, + style: TextStyle( + fontSize: 14, + color: widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount > + 0 + ? Colors.black + : Colors.grey, + ), + enabled: widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount == + 0 + ? false + : true, + onChanged: (val) { + var value = int.tryParse(val); + if (value != null && + value <= + widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount) { + widget.model.paymentCheckoutData.usedLakumPoints = + value; + } else { + widget.model.paymentCheckoutData.usedLakumPoints = 0; + } + _pointsController.text = + "${widget.model.paymentCheckoutData.usedLakumPoints}"; + }, + ), + ), + Container( + height: 50, + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), + decoration: new BoxDecoration( + color: Color(0xff3666E0), + shape: BoxShape.rectangle, + borderRadius: projectProvider.isArabic + ? BorderRadius.only( + topLeft: Radius.circular(6), + bottomLeft: Radius.circular(6)) + : BorderRadius.only( + topRight: Radius.circular(6), + bottomRight: Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: Color(0xff3666E0), + width: 0.8, + )), + ), + child: Texts( + "${TranslationBase.of(context).use}", + fontSize: 12, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} + +class PaymentBottomWidget extends StatelessWidget { + final OrderPreviewViewModel model; + + PaymentBottomWidget(this.model); + + @override + Widget build(BuildContext context) { + final scaffold = Scaffold.of(context); + + return Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: Consumer( + builder: (ctx, paymentData, _) => paymentData.cartDataVisible + ? Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + margin: + EdgeInsets.symmetric(horizontal: 0, vertical: 4), + child: Row( + children: [ + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff929295), + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 4), + child: Texts( + "${TranslationBase.of(context).inclusiveVat}", + fontSize: 8, + color: Color(0xff929295), + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + Texts( + "${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ], + ), + Container( + child: RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + side: BorderSide( + color: Color(0xff929295), + width: 1, + ), + ), + onPressed: (paymentData.address != null && + paymentData.paymentOption != null) + ? () => { + model.makeOrder().then((_) { + if (model.state != ViewState.Idle) { + SnackBar snackBar = SnackBar( + content: Text( + 'Order has been placed successfully!!')); + scaffold.showSnackBar(snackBar); + } + + // Navigator.pushAndRemoveUntil( + // context, + // MaterialPageRoute( + // builder: (context) => + // PharmacyPage()), + // (Route r) => false); + }) + } + : null, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16), + child: new Text( + "${TranslationBase.of(context).proceedPay}", + style: new TextStyle( + color: (paymentData.address != null && + paymentData.paymentOption != null) + ? Colors.white + : Colors.grey.shade400, + fontWeight: FontWeight.bold, + fontSize: 12), + ), + ), + color: (paymentData.address != null && + paymentData.paymentOption != null) + ? Colors.green + : Color(0xff929295), + disabledColor: (paymentData.address != null && + paymentData.paymentOption != null) + ? Colors.green + : Color(0xff929295), + ), + ), + ], + ), + ) + : Container(), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart new file mode 100644 index 00000000..fc1270c0 --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart @@ -0,0 +1,101 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import 'lacum-registration-page.dart'; + +class LakumActivationVidaPage extends StatelessWidget { + TextEditingController _identificationNumberController = + new TextEditingController(); + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Acount Activation", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 12), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts( + " This service allows you to activate your LAKUM account after registering through the Vida system. ", + fontSize: 14, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: _identificationNumberController, + decoration: new InputDecoration( + hintText: 'Enter Identification Number', + ), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 4), + child: BorderedButton( + TranslationBase.of(context).accountActivation, + backgroundColor: + _identificationNumberController.text != null && + _identificationNumberController.text != "" + ? Color(0xff60686b) + : Color(0xffb0b4b5), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: _identificationNumberController.text != null && + _identificationNumberController.text != "" + ? () { + model + .checkLacumAccountActivation( + _identificationNumberController.text) + .then((_) => { + if (model.state == ViewState.Idle) + { + Navigator.push( + context, + FadePage( + page: LakumRegistrationPage( + _identificationNumberController + .text))) + .then((status) => { + if (status == 200) + {Navigator.pop(context, "")} + // back to previous page + }) + } + }); + } + : null, + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-registration-page.dart b/lib/pages/pharmacies/screens/lacum-registration-page.dart new file mode 100644 index 00000000..53b9705d --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-registration-page.dart @@ -0,0 +1,236 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; +import 'package:diplomaticquarterapp/models/id-name-pair.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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/dialogs/radio-group-dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import 'lakum-terms-conditions-page.dart'; + +class LakumRegistrationPage extends StatefulWidget { + final String patientIdentificationNo; + + LakumRegistrationPage(this.patientIdentificationNo); + + @override + _LakumRegistrationPageState createState() => _LakumRegistrationPageState(); +} + +class _LakumRegistrationPageState extends State { + final TextEditingController _firstNameController = TextEditingController(); + + final TextEditingController _lastNameController = TextEditingController(); + + final TextEditingController _mobileNumberController = TextEditingController(); + + List languages = List(); + + IdNamePair selectedLanguage; + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true); + languages.clear(); + languages.add(IdNamePair(1, TranslationBase.of(context).arabic)); + languages.add(IdNamePair(2, TranslationBase.of(context).english)); + + bool canSubmit = _firstNameController.text != null && + _firstNameController.text != "" && + _lastNameController.text != null && + _lastNameController.text != "" && + _mobileNumberController.text != null && + _mobileNumberController.text != "" && + selectedLanguage != null; + + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Register Lakum", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + appBarWidget: appBarWidget, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: SizedBox( + height: mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + Column( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + height: 150, + width: mediaQuery.size.width, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).firstName, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + TextField( + controller: _firstNameController, + style: TextStyle( + fontSize: 16, + color: Colors.black, + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).lastName, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + TextField( + controller: _lastNameController, + style: TextStyle( + fontSize: 16, + color: Colors.black, + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).mobileNumber, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + TextField( + controller: _mobileNumberController, + style: TextStyle( + fontSize: 16, + color: Colors.black, + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context) + .prefferedLanguage, + fontSize: 13, + fontWeight: FontWeight.normal, + color: Color(0xff8a8a8a), + ), + InkWell( + onTap: () { + RadioGroupDialog dialog = + new RadioGroupDialog( + context: context, + title: TranslationBase.of(context) + .prefferedLanguage, + okText: + TranslationBase.of(context) + .confirm, + cancelText: + TranslationBase.of(context) + .cancel_nocaps, + list: languages, + okFunction: (selectedValue) { + setState(() { + selectedLanguage = + selectedValue; + }); + print( + "selectedLanguage = ${selectedValue.name}"); + }, + cancelFunction: () => {}); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + }, + child: TextField( + enabled: false, + decoration: InputDecoration( + suffixIcon: + Icon(Icons.arrow_drop_down), + hintText: selectedLanguage == null + ? "${TranslationBase.of(context).prefferedLanguage}" + : "${selectedLanguage.name}", + hintStyle: TextStyle( + fontSize: 16, + color: Colors.black, + )), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + ], + ), + ), + ], + ), + Container( + color: Colors.green, + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).register, + backgroundColor: canSubmit + ? Color(0xff339933) + : Color(0xff99cc99), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: canSubmit + ? () { + Navigator.push( + context, + FadePage( + page: LakumTermsConditions( + widget + .patientIdentificationNo, + _firstNameController.text, + _lastNameController.text, + _mobileNumberController + .text, + selectedLanguage.id))) + .then((status) => { + if (status == 200) + {Navigator.pop(context, "")} + // back to previous page + }); + } + : null, + ), + ), + ], + ), + ), + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-setting-page.dart b/lib/pages/pharmacies/screens/lacum-setting-page.dart new file mode 100644 index 00000000..91e4c965 --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-setting-page.dart @@ -0,0 +1,240 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.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:flutter/material.dart'; + +class LakumSettingPage extends StatefulWidget { + final LacumAccountInformation lacumInformation; + final LacumAccountInformation lacumGroupInformation; + + LakumSettingPage(this.lacumInformation, this.lacumGroupInformation); + + @override + _LakumSettingPageState createState() => _LakumSettingPageState(); +} + +class _LakumSettingPageState extends State { + bool _lakumAccountActivated = false; + TextEditingController _nameController = new TextEditingController(); + TextEditingController _phoneController = new TextEditingController(); + + @override + void initState() { + _lakumAccountActivated = widget.lacumGroupInformation + .lakumInquiryInformationObjVersion.accountStatus == + "Active"; + super.initState(); + _nameController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName; + _phoneController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber; + } + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true); + + return BaseView( + onModelReady: (model) => model.setLakumData( + widget.lacumInformation, widget.lacumGroupInformation), + builder: (_, model, wi) => AppScaffold( + title: "Lakum", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + appBarWidget: appBarWidget, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: SizedBox( + height: mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top, + child: _buildSettingScreen(mediaQuery, model), + ), + ), + ), + ), + ); + } + + _buildSettingScreen(MediaQueryData mediaQuery, LacumViewModel model) { + bool canUpdate = (_nameController.text != "" && + _phoneController.text != "" && + (_nameController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName || + _phoneController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber)); + + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Container( + height: mediaQuery.size.height * 0.15, + color: Colors.green, + ), + Column( + children: [ + SizedBox( + height: mediaQuery.size.height * 0.05, + ), + Container( + width: mediaQuery.size.width * 1, + child: LakumBannerWidget(model, mediaQuery, false)), + ], + ) + ], + ), + SizedBox( + height: 20, + ), + SizedBox( + height: 1, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "Activate LAKUM Account", + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + Switch.adaptive( + activeColor: Color.fromRGBO(51, 153, 51, 1), + inactiveThumbColor: Colors.red, + activeTrackColor: Colors.grey, + inactiveTrackColor: Colors.grey, + value: _lakumAccountActivated, + onChanged: (val) { + if (_lakumAccountActivated) { + model.makeAccountDeactivate(); + } else { + model.makeAccountActivate(); + } + setState(() { + _lakumAccountActivated = val; + }); + }, + ), + ], + ), + ), + SizedBox( + height: 30, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).name, + fontSize: 13, + fontWeight: _lakumAccountActivated + ? FontWeight.bold + : FontWeight.normal, + color: Colors.grey.shade400, + ), + _lakumAccountActivated + ? TextField( + controller: _nameController, + enabled: _lakumAccountActivated ? true : false, + style: TextStyle( + fontSize: 16, + color: _lakumAccountActivated + ? Colors.black + : Colors.white38, + ), + ) + : Texts( + _nameController.text, + fontSize: 16, + color: Colors.grey.shade600, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).mobileNumber, + fontSize: 13, + fontWeight: _lakumAccountActivated + ? FontWeight.bold + : FontWeight.normal, + color: Colors.grey.shade400, + ), + _lakumAccountActivated + ? TextField( + controller: _phoneController, + enabled: _lakumAccountActivated ? true : false, + keyboardType: TextInputType.phone, + style: TextStyle( + fontSize: 16, + color: _lakumAccountActivated + ? Colors.black + : Colors.white38, + ), + ) + : Texts( + _phoneController.text, + fontSize: 16, + color: Colors.grey.shade600, + ), + ], + ), + ), + ], + ), + Container( + child: Column( + children: [ + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).save, + backgroundColor: + canUpdate ? Color(0xff60686b) : Color(0xffb0b4b5), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: canUpdate + ? () { + model.createLakumAccount(_nameController.text, _phoneController.text).then((status) => { + if (status == 200) {Navigator.pop(context, "")} + // back to previous page + }); + } + : null, + ), + ) + ], + ), + ), + ], + ); + } +} diff --git a/lib/pages/pharmacies/screens/lacum-transfer-page.dart b/lib/pages/pharmacies/screens/lacum-transfer-page.dart new file mode 100644 index 00000000..0671f80a --- /dev/null +++ b/lib/pages/pharmacies/screens/lacum-transfer-page.dart @@ -0,0 +1,317 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.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:flutter/material.dart'; + +class LacumTransferPage extends StatefulWidget { + final LacumAccountInformation lacumInformation; + final LacumAccountInformation lacumGroupInformation; + + LacumTransferPage(this.lacumInformation, this.lacumGroupInformation); + + @override + _LacumTransferPageState createState() => _LacumTransferPageState(); +} + +class _LacumTransferPageState extends State { + TextEditingController _beneficieryAccountController = + new TextEditingController(); + TextEditingController _transferPointsController = new TextEditingController(); + + @override + void initState() { + super.initState(); + _beneficieryAccountController.text = ""; + _transferPointsController.text = "0"; + } + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true); + + return BaseView( + onModelReady: (model) => model.setLakumData( + widget.lacumInformation, widget.lacumGroupInformation), + builder: (_, model, wi) => AppScaffold( + title: "Lakum", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + appBarWidget: appBarWidget, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: SizedBox( + height: + mediaQuery.size.height - 58 - mediaQuery.padding.top, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + Row( + children: [ + Container( + height: 100, + width: mediaQuery.size.width / 2 - 26, + padding: EdgeInsets.only( + top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xff6294ed), + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Container( + child: Texts( + "Point Balance", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + vertical: 8), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Texts( + "0", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ], + ), + ), + ) + ], + ), + ), + SizedBox( + width: 20, + ), + Container( + height: 100, + width: mediaQuery.size.width / 2 - 26, + padding: EdgeInsets.only( + top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xff339933), + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Container( + child: Texts( + "Riyal Balance", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + vertical: 8), + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Texts( + "0", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ], + ), + ), + ) + ], + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 16), + child: TextField( + controller: _beneficieryAccountController, + decoration: new InputDecoration( + hintText: 'Enter Beneficiary Account No.', + ), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 4), + child: BorderedButton( + TranslationBase.of(context).checkBeneficiary, + backgroundColor: + _beneficieryAccountController.text != "" + ? Color(0xff60686b) + : Color(0xffb0b4b5), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: + _beneficieryAccountController.text != "" + ? () { + model.getLacumGroupDataBuAccountId( + _beneficieryAccountController + .text); + } + : null, + ), + ), + (model.lacumReceiverInformation != null && + model.lacumReceiverInformation + .lakumInquiryInformationObjVersion != + null) + ? Container( + margin: EdgeInsets.only(top: 8), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .beneficiaryName, + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8), + child: TextField( + enabled: false, + decoration: new InputDecoration( + hintText: + "${model.lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName}", + hintStyle: TextStyle( + fontSize: 16, + color: Colors.grey.shade600, + )), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + SizedBox( + height: 10, + width: double.infinity, + ), + Texts( + "Point's to Transfer :", + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8), + child: TextField( + controller: + _transferPointsController, + decoration: new InputDecoration( + focusColor: Colors.green, + hintStyle: TextStyle( + fontSize: 16, + color: Colors.grey.shade600, + )), + style: TextStyle( + fontSize: 16, + color: Colors.grey.shade700, + ), + ), + ), + ], + ), + ) + : Container() + ], + ), + if (model.lacumReceiverInformation != null && + model.lacumReceiverInformation + .lakumInquiryInformationObjVersion != + null) + Container( + margin: EdgeInsets.all(8), + child: BorderedButton( + "LACUM TRANSFER", + backgroundColor: Color(0xff339933), + textColor: Colors.white, + fontSize: 18, + hPadding: 8, + radius: 12, + vPadding: 16, + fontWeight: FontWeight.w600, + handler: () { + model + .transferYaHalaLoyaltyPoints( + _transferPointsController.text) + .then((status) => { + if (status == 200) + {Navigator.pop(context, "")} + // back to previous page + }); + }, + ), + ) + ], + ), + ), + ), + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart new file mode 100644 index 00000000..adbb07c2 --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -0,0 +1,555 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-setting-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-transfer-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-points-year-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import 'lacum-activitaion-vida-page.dart'; + +class LakumMainPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + onModelReady: (model) => model.getLacumData(), + builder: (_, model, wi) => AppScaffold( + title: "Lakum", + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + appBarIcons: _buildAppBarICons(context, model), + // preferredSize: mediaQuery.size.height * 0.20, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: (model.lacumGroupInformation != null && + model.lacumGroupInformation + .lakumInquiryInformationObjVersion != + null) + ? Column( + children: [ + Stack( + children: [ + Container( + height: mediaQuery.size.height * 0.15, + color: Colors.green, + ), + Column( + children: [ + SizedBox( + height: mediaQuery.size.height * 0.05, + ), + Container( + width: mediaQuery.size.width * 1, + child: LakumBannerWidget( + model, mediaQuery, true)), + ], + ) + ], + ), + SizedBox( + height: 20, + ), + LakumHomeButtons(mediaQuery, model), + SizedBox( + height: 20, + ), + Container( + height: 100, + margin: EdgeInsets.symmetric(horizontal: 16), + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + LacumPointsWidget( + mediaQuery, + 1, + TranslationBase.of(context).balance, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalance, + null), + SizedBox( + width: 8, + ), + LacumPointsWidget( + mediaQuery, + 2, + TranslationBase.of(context).gained, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPointsAmountPerYear), + SizedBox( + width: 8, + ), + LacumPointsWidget( + mediaQuery, + 3, + TranslationBase.of(context).consumed, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount != + null + ? int.parse(model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount) + : 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmountPerYear), + SizedBox( + width: 8, + ), + LacumPointsWidget( + mediaQuery, + 4, + TranslationBase.of(context).transferred, + 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPointsAmountPerYear), + ], + ), + ), + SizedBox( + height: 20, + ), + SizedBox( + height: 8, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + "Expired", + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} Points", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ], + ), + ), + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", + fit: BoxFit.fill, + width: 20, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + "Waiting gained", + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ], + ), + ), + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/will_be_expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + "Will Be Expired", + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} Points", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ], + ), + ), + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + ], + ) + : Container(), + ), + ), + )); + } +} + +List _buildAppBarICons(BuildContext context, LacumViewModel model) { + return [ + IconButton( + icon: Icon(Icons.settings), + color: Colors.white, + onPressed: () { + Navigator.push( + context, + FadePage( + page: LakumSettingPage( + model.lacumInformation, model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); + }, + ), + ]; +} + +class LakumHomeButtons extends StatelessWidget { + final MediaQueryData mediaQuery; + final LacumViewModel model; + + LakumHomeButtons(this.mediaQuery, this.model); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + print("Account activate click"); + Navigator.push( + context, FadePage(page: LakumActivationVidaPage())) + .then((result) => {model.getLacumGroupData()}); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xffe1e1e1)), + height: mediaQuery.size.height * 0.08, + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/Account_activation_icon.png", + fit: BoxFit.fill, + width: 30, + height: 30, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 16), + child: Texts( + "Account Activation", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: InkWell( + onTap: () { + print("Lacum transfer click"); + Navigator.push( + context, + FadePage( + page: LacumTransferPage(model.lacumInformation, + model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: Color(0xffe1e1e1)), + height: mediaQuery.size.height * 0.08, + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png", + fit: BoxFit.fill, + width: 35, + height: 30, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 16), + child: Texts( + "Lakum Transfer", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ), + ), + ), + ], + ), + ); + } +} + +class LacumPointsWidget extends StatelessWidget { + final MediaQueryData mediaQuery; + final int pointType; // 1. balance, 2. gained, 3. consume, 4. transfer + final String title; + final int riyal; + final int point; + Color titleColor; + final List pointsAmountPerYear; + + LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, + this.point, this.pointsAmountPerYear) { + if (pointType == 1) { + titleColor = Color(0xffefefef); + } else if (pointType == 2) { + titleColor = Color(0xff004bcc); + } else if (pointType == 3) { + titleColor = Color(0xff339933); + } else { + titleColor = Color(0xffffa500); + } + } + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (pointType != 1) { + if (pointsAmountPerYear != null && pointsAmountPerYear.length > 0) { + Navigator.push(context, + FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); + } else { + // show snackBar No Details Points are there + } + } + }, + child: Container( + width: mediaQuery.size.width / 2 - 16, + padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: pointType == 1 ? Color(0xff004bcc) : Color(0xffefefef), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Texts( + title, + fontSize: 14, + fontWeight: FontWeight.bold, + color: titleColor, + ), + ), + if (pointType != 1) + Icon( + Icons.arrow_forward, + color: titleColor, + ) + ], + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + if (pointType != 4) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "RIYAL", + fontSize: 13, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "$riyal", + fontSize: 13, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + ], + ), + ), + if (pointType != 4) + SizedBox( + child: Container( + color: pointType == 1 ? Colors.white : Colors.grey, + ), + width: 1, + ), + Expanded( + child: Container( + margin: EdgeInsets.only(left: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "POINT", + fontSize: 12, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "$point", + fontSize: 12, + fontWeight: FontWeight.bold, + color: pointType == 1 ? Colors.white : Colors.black, + ), + ], + ), + ), + ), + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-points-month-page.dart b/lib/pages/pharmacies/screens/lakum-points-month-page.dart new file mode 100644 index 00000000..47270eee --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-points-month-page.dart @@ -0,0 +1,271 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerMonth.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lakum-point-table-row-widget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class LakumPointMonthPage extends StatefulWidget { + final PointsAmountPerMonth pointsAmountPerMonth; + final int year; + int expandedItemIndex = -1; + + LakumPointMonthPage(this.pointsAmountPerMonth, this.year); + + @override + _LakumPointsMonthPageState createState() => _LakumPointsMonthPageState(); +} + +class _LakumPointsMonthPageState extends State { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Lakum points", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + height: mediaQuery.size.height * 0.25, + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: mediaQuery.size.width * 1.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + height: mediaQuery.size.height * 0.06, + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 24), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).month, + color: Colors.grey.shade600, + fontSize: 16, + ), + Texts( + "${widget.pointsAmountPerMonth.month}, ${widget.year}", + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + ), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context).point, + color: Colors.grey.shade600, + fontSize: 16, + ), + Texts( + "${widget.pointsAmountPerMonth.pointsPerMonth}", + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + ), + SizedBox( + child: Container( + color: Colors.grey, + ), + width: 1, + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context).riyal, + color: Colors.grey.shade600, + fontSize: 16, + ), + Texts( + "${widget.pointsAmountPerMonth.amountPerMonth}", + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + SizedBox( + height: 10, + ), + LakumPointTableRowWidget(true, "DAY", 0, 0, null, 0), + ...List.generate( + widget.pointsAmountPerMonth.pointsAmountPerday.length, + (index) => LakumPointTableRowWidget( + false, + widget.pointsAmountPerMonth.pointsAmountPerday[index].day, + widget.pointsAmountPerMonth.pointsAmountPerday[index] + .pointsPerDay, + widget.pointsAmountPerMonth.pointsAmountPerday[index] + .amountPerDay, + () { + setState(() { + if (widget.expandedItemIndex == index) { + widget.expandedItemIndex = -1; + } else { + widget.expandedItemIndex = index; + } + }); + }, + index, + expandFlag: widget.expandedItemIndex == index, + collapsed: Column( + children: [ + ...List.generate( + widget.pointsAmountPerMonth.pointsAmountPerday[index] + .pointsDetails.length, + (index) => DayPointsDetailWidget( + widget + .pointsAmountPerMonth + .pointsAmountPerday[index] + .pointsDetails[index] + .subTransactionTypeDescription, + widget + .pointsAmountPerMonth + .pointsAmountPerday[index] + .pointsDetails[index].purchasePoints, + widget + .pointsAmountPerMonth + .pointsAmountPerday[index] + .pointsDetails[index].amount), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} + +class DayPointsDetailWidget extends StatelessWidget { + final String rowTitle; + final double points; + final double riyal; + + DayPointsDetailWidget(this.rowTitle, this.points, this.riyal); + + @override + Widget build(BuildContext context) { + return Container( + color: Color(0xffe4e4e4), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 12), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + children: [ + Expanded( + child: Container( + child: Column( + children: [ + Texts( + "TYPE", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 4, + ), + Texts( + rowTitle, + fontSize: 14, + fontWeight: FontWeight.normal, + ), + ], + crossAxisAlignment: CrossAxisAlignment.start, + ), + )), + Expanded( + + child: Container( + child: Texts( + "$points", + fontSize: 14, + fontWeight: FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + "$riyal", + fontSize: 14, + fontWeight: FontWeight.normal, + ), + )), + Expanded(child: Container()), + ], + ), + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-points-year-page.dart b/lib/pages/pharmacies/screens/lakum-points-year-page.dart new file mode 100644 index 00000000..f7b6d9e6 --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-points-year-page.dart @@ -0,0 +1,201 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lakum-point-table-row-widget.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import 'lakum-points-month-page.dart'; + +class LakumPointsYearPage extends StatefulWidget { + final List pointsAmountPerYear; + int selectedIndexYear = 0; + + LakumPointsYearPage(this.pointsAmountPerYear); + + @override + _LakumPointsYearPageState createState() => _LakumPointsYearPageState(); +} + +class _LakumPointsYearPageState extends State { + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + + return BaseView( + builder: (_, model, wi) => AppScaffold( + title: "Lakum points", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + height: 100, + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + ...List.generate( + widget.pointsAmountPerYear.length, + (index) => LacumPointsYearWidget( + mediaQuery, + widget.selectedIndexYear == index, + widget.pointsAmountPerYear[index], () { + setState(() { + widget.selectedIndexYear = index; + }); + })), + ], + ), + ), + SizedBox( + height: 0, + ), + LakumPointTableRowWidget(true, "MONTH", 0, 0, null, 0), + ...List.generate( + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth.length, + (index) => LakumPointTableRowWidget( + false, + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index].month, + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index].pointsPerMonth, + widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index].amountPerMonth, + (){ + Navigator.push(context, + FadePage(page: LakumPointMonthPage(widget.pointsAmountPerYear[widget.selectedIndexYear] + .pointsAmountPerMonth[index], widget.pointsAmountPerYear[widget.selectedIndexYear].year))); + }, + index), + ), + ], + ), + ), + ), + ), + ); + } +} + +class LacumPointsYearWidget extends StatelessWidget { + final MediaQueryData mediaQuery; + final bool isSelected; + final PointsAmountPerYear yearPoints; + final Function yearOnTap; + + LacumPointsYearWidget( + this.mediaQuery, this.isSelected, this.yearPoints, this.yearOnTap); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: yearOnTap, + child: Container( + width: mediaQuery.size.width / 2 - 16, + padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 4), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffe1e1e1), + width: 0.4, + )), + color: isSelected ? Color(0xff004bcc) : Color(0xffefefef), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Texts( + "YEAR: ${yearPoints.year}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + ), + ], + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(left: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "POINT", + fontSize: 12, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "${yearPoints.pointsPerYear}", + fontSize: 12, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + ], + ), + ), + ), + SizedBox( + child: Container( + color: isSelected ? Colors.white : Colors.grey, + ), + width: 1, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts( + "RIYAL", + fontSize: 13, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + SizedBox( + height: 4, + ), + Texts( + "${yearPoints.amountPerYear}", + fontSize: 13, + fontWeight: FontWeight.bold, + color: isSelected ? Colors.white : Colors.black, + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/lakum-terms-conditions-page.dart b/lib/pages/pharmacies/screens/lakum-terms-conditions-page.dart new file mode 100644 index 00000000..30c3bb6e --- /dev/null +++ b/lib/pages/pharmacies/screens/lakum-terms-conditions-page.dart @@ -0,0 +1,84 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:provider/provider.dart'; + +class LakumTermsConditions extends StatelessWidget { + final String firstName, lastName, mobileNo, identificationNo; + final int languageId; + + LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, + this.mobileNo, this.languageId); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + final mediaQuery = MediaQuery.of(context); + PreferredSizeWidget appBarWidget = AppBarWidget("Lakum", null, true); + double height = mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top; + + return BaseView( + onModelReady: (model) => model.getUserTermsAndConditionsForEPharmcy(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: "Register Lakum", + isShowAppBar: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + appBarWidget: appBarWidget, + body: Container( + margin: EdgeInsets.all(8), + width: double.infinity, + child: Stack( + children: [ + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (model.listUserAgreement != null && + model.listUserAgreement.userAgreementLAKUM != + null) + Html( + data: projectProvider.isArabic + ? model.listUserAgreement.userAgreementLAKUMn + : model.listUserAgreement.userAgreementLAKUM, + ), + ], + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Container( + height: 50, + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).acceptLbl, + backgroundColor: Color(0xff60686b), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: () { + model.createNewLakumAccount("$firstName $lastName", mobileNo, identificationNo, languageId).then((status) => { + if (status == 200) {Navigator.pop(context, "")} + // back to previous page + }); + }, + ), + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart new file mode 100644 index 00000000..8cdbaf3c --- /dev/null +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -0,0 +1,202 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.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:flutter/material.dart'; + +class PaymentMethodSelectPage extends StatefulWidget { + @override + _PaymentMethodSelectPageState createState() => + _PaymentMethodSelectPageState(); +} + +class _PaymentMethodSelectPageState extends State { + PaymentOption selectedPaymentOption; + + @override + Widget build(BuildContext context) { + Size screenSize = MediaQuery.of(context).size; + double cardWidth = screenSize.width / 2 - 32; + + return AppScaffold( + title: "Payment method", + isShowAppBar: true, + isShowDecPage: false, + body: Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Texts( + TranslationBase.of(context).selectPaymentOption, + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16), + child: Column( + children: [ + Row( + children: [ + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.meda, + () => { + setState(() { + selectedPaymentOption = PaymentOption.meda; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.sadad, + () => { + setState(() { + selectedPaymentOption = PaymentOption.sadad; + }) + }), + ], + ), + Row( + children: [ + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.visa, + () => { + setState(() { + selectedPaymentOption = PaymentOption.visa; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.mastercard, + () => { + setState(() { + selectedPaymentOption = + PaymentOption.mastercard; + }) + }), + ], + ), + PaymentMethodCard( + (cardWidth * 2 + 32), + selectedPaymentOption, + PaymentOption.installments, + () => { + setState(() { + selectedPaymentOption = + PaymentOption.installments; + }) + }), + ], + ), + ), + ], + ), + ), + bottomSheet: Container( + height: screenSize.height * 0.08, + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: BorderedButton( + TranslationBase.of(context).next, + backgroundColor: Color(0xff5AB154), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: selectedPaymentOption != null + ? () => {Navigator.pop(context, selectedPaymentOption)} + : null, + ), + ), + ); + } +} + +class PaymentMethodCard extends StatelessWidget { + final double cardWidth; + final PaymentOption selectedPaymentOption; + final PaymentOption paymentOption; + final Function selectMethod; + + PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, + this.paymentOption, this.selectMethod); + + @override + Widget build(BuildContext context) { + bool isSelected = false; + if (selectedPaymentOption != null && + selectedPaymentOption == paymentOption) { + isSelected = true; + } + + return InkWell( + onTap: selectMethod, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), + child: Stack( + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), + margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), + decoration: new BoxDecoration( + color: Colors.grey.shade100, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(8), + border: Border.fromBorderSide(BorderSide( + color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, + width: 0.8, + )), + ), + width: cardWidth, + child: Image.asset( + getPaymentOptionImage(paymentOption), + fit: BoxFit.cover, + ), + ), + if (isSelected) + Positioned( + right: 1, + child: Icon( + Icons.check_circle, + color: Color(0xff20BC11), + size: 30, + ), + ), + ], + ), + ), + ); + } + + String getPaymentOptionImage(PaymentOption paymentOption) { + String assetFile = "assets/images/pharmacy_module/payment/"; + switch (paymentOption.index) { + case 0: + return "${assetFile}mada.png"; + break; + case 1: + return "${assetFile}sadad.png"; + break; + case 2: + return "${assetFile}visa.png"; + break; + case 3: + return "${assetFile}mastercard.png"; + break; + case 4: + return "${assetFile}installment.png"; + break; + default: + return ""; + } + } +} diff --git a/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart b/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart new file mode 100644 index 00000000..87c1b97c --- /dev/null +++ b/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart @@ -0,0 +1,51 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:provider/provider.dart'; + +class PharmacyTermsConditions extends StatelessWidget { + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getUserTermsAndConditionsForEPharmcy(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).termOfService, + isShowAppBar: true, + isShowDecPage: false, + isPharmacy: true, + backgroundColor: Colors.white, + baseViewModel: model, + body: Container( + margin: EdgeInsets.all(8), + width: double.infinity, + child: Stack( + children: [ + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (model.listUserAgreement != null && + model.listUserAgreement.userAgreementLAKUM != + null) + Html( + data: projectProvider.isArabic + ? model.listUserAgreement.userAgreementTxtn + : model.listUserAgreement.userAgreementTxt, + ), + ], + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 2ae2be65..fd51d6ef 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -2,27 +2,32 @@ 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/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; -class PharmacyPage extends StatelessWidget { +import 'lacum-activitaion-vida-page.dart'; +class PharmacyPage extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( - // onModelReady: (model) => model.getPharmacyHomeData(), onModelReady: (model) => model.getPharmacyHomeData(), + allowAny: true, builder: (_, model, wi) => AppScaffold( title: "", - isShowAppBar: true, + isShowAppBar: false, isShowDecPage: false, baseViewModel: model, backgroundColor: Colors.white, @@ -33,8 +38,7 @@ class PharmacyPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), - GridViewButtons(), - /*BannerPager(model.getBannerImagesUrl()),*/ + GridViewButtons(model), Container( margin: EdgeInsets.fromLTRB(10, 0, 10, 0), child: Row( @@ -48,9 +52,12 @@ class PharmacyPage extends StatelessWidget { TranslationBase.of(context).viewAll, hasBorder: true, vPadding: 6, + hPadding: 4, borderColor: Colors.green, - color: Colors.green, - handler: () {}, + textColor: Colors.green, + handler: () =>{ + Navigator.push(context,FadePage(page: ProductBrandsPage())), + }, ), ], ), @@ -77,15 +84,18 @@ class PharmacyPage extends StatelessWidget { TranslationBase.of(context).viewAll, hasBorder: true, vPadding: 6, + hPadding: 4, borderColor: Colors.green, - color: Colors.green, + textColor: Colors.green, handler: () {}, ), ], ), ), Container( - height: model.lastVisitedProducts.length > 0 ? MediaQuery.of(context).size.height / 4 : 0, + height: model.lastVisitedProducts.length > 0 + ? MediaQuery.of(context).size.height / 4 + 20 + : 0, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem(model.lastVisitedProducts[i]), @@ -106,15 +116,18 @@ class PharmacyPage extends StatelessWidget { TranslationBase.of(context).viewAll, hasBorder: true, borderColor: Colors.green, - color: Colors.green, + textColor: Colors.green, vPadding: 6, - handler: () {}, + hPadding: 4, + handler: () =>{ + Navigator.push(context,FadePage(page: ProductBrandsPage())), + }, ), ], ), ), Container( - height: MediaQuery.of(context).size.height / 4, + height: MediaQuery.of(context).size.height / 4 + 20, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem(model.bestSellerProduct[i]), @@ -132,6 +145,10 @@ class PharmacyPage extends StatelessWidget { } class GridViewButtons extends StatelessWidget { + final PharmacyModuleViewModel model; + + GridViewButtons(this.model); + @override Widget build(BuildContext context) { final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; @@ -153,24 +170,34 @@ class GridViewButtons extends StatelessWidget { opacity: 0.8, child: GridViewCard( TranslationBase.of(context).offersAndPromotions, - 'assets/images/pharmacy_module/offer_icon.png', - () { - Navigator.push(context, FadePage(page: OrderPreviewPage())); - }), + 'assets/images/pharmacy_module/offer_icon.png', () { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + }), ), DashboardItem( imageName: 'pharmacy_module/bg_2.png', opacity: 0, hasColorFilter: false, child: GridViewCard(TranslationBase.of(context).medicationRefill, - 'assets/images/pharmacy_module/medication_icon.png', () {}), + 'assets/images/pharmacy_module/medication_icon.png', () { + model.checkUserIsActivated().then((isActivated) { + if (isActivated) { + Navigator.push(context, FadePage(page: LakumMainPage())); + } else { + Navigator.push( + context, FadePage(page: LakumActivationVidaPage())); + } + }); + }), ), DashboardItem( imageName: 'pharmacy_module/bg_3.png', opacity: 0, hasColorFilter: false, child: GridViewCard(TranslationBase.of(context).myPrescriptions, - 'assets/images/pharmacy_module/prescription_icon.png', () {}), + 'assets/images/pharmacy_module/prescription_icon.png', () { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())); + }), ), DashboardItem( imageName: 'pharmacy_module/bg_4.png', @@ -179,7 +206,7 @@ class GridViewButtons extends StatelessWidget { child: GridViewCard( TranslationBase.of(context).searchAndScanMedication, 'assets/images/pharmacy_module/search_scan_icon.png', - () {}), + () {}), ), ], ), @@ -219,11 +246,16 @@ class GridViewCard extends StatelessWidget { ), ), ), - Expanded( - child: BorderedButton( - TranslationBase.of(context).viewAll, - handler: handler, - ), + Row( + children: [ + BorderedButton( + TranslationBase.of(context).viewAll, + handler: handler, + tPadding: 0, + bPadding: 0, + ), + Expanded(child: Container()), + ], ), ], ), diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart new file mode 100644 index 00000000..8f771490 --- /dev/null +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -0,0 +1,145 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class SearchBrandsPage extends StatefulWidget { + @override + _SearchBrandsPageState createState() => _SearchBrandsPageState(); +} + +class _SearchBrandsPageState extends State { + final textController = TextEditingController(); + final _formKey = GlobalKey(); + String msg = ''; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.searchProducts(), + builder: (BuildContext context, model, Widget child) => + PharmacyAppScaffold( + appBarTitle: 'Search', + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + //baseViewModel: model, + body: SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight, + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.79, + child: Form( + key: _formKey, + child: TextFields( + autoFocus: true, + hintText: 'Search', + fontSize: 19.0, + prefixIcon: Icon(Icons.search), + inputAction: TextInputAction.search, + onSaved: (value) { + //searchMedicine(model, context); + }, + onSubmit: (value) { + searchMedicine(model, context); + msg = 'No Result Found'; + }, + controller: textController, + validator: (value) { + if (value.isEmpty) { + return 'please Enter Product Name'; + } + return null; + }, + ), + ), + ), + SizedBox( + width: 10.0, + ), + InkWell( + child: Texts( + 'Cancel', + fontSize: 17.0, + fontWeight: FontWeight.w500, + ), + onTap: () { + Navigator.pop(context); + }, + ), + + // child: Container( + // child: Button( + // backgroundColor: Colors.green, + // loading: model.state == ViewState.BusyLocal, + // label: 'Search', + // onTap: () { + // searchMedicine(model, context); + // }), + // width: MediaQuery.of(context).size.width * 0.09, + // ), + ], + ), + ), + model.searchList.length == 0 + ? Container( + child: Text( + 'no data' + model.searchList.length.toString()), + ) + : Expanded( + child: Container( + child: ListView.builder( + itemCount: model.searchList.length, + itemBuilder: (BuildContext ctx, index) { + return Padding( + padding:EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + model.searchList[index].name, + style: TextStyle(fontSize: 20), + ), + ), + ), + Divider(height: 1, color: Colors.grey) + ],), + ); + }, + ), + ), + ), + ], + ), + ), + ), + ), + ); + } + + searchMedicine(model, BuildContext context) { + Utils.hideKeyboard(context); + if (_formKey.currentState.validate()) + model.searchProducts(productName: textController.text); + } +} diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index 81b6068a..92e2c39d 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -1,13 +1,239 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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'; +import 'package:provider/provider.dart'; + +class ProductOrderItem extends StatefulWidget { + final ShoppingCart item; + final VoidCallback changeCartItems; + final VoidCallback deleteCartItems; + + ProductOrderItem(this.item, this.changeCartItems, this.deleteCartItems); + + @override + _ProductOrderItemState createState() => _ProductOrderItemState(); +} + +class _ProductOrderItemState extends State { + TextEditingController _quantityController = new TextEditingController(); + String _totalPrice = "0"; + + @override + void initState() { + _quantityController.text = "${widget.item.quantity}"; + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + super.initState(); + } -class ProductOrderItem extends StatelessWidget { @override Widget build(BuildContext context) { - return ListTile( - leading: Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade800, - ), + ProjectViewModel projectProvider = Provider.of(context); + + return Column( + children: [ + ListTile( + leading: InkWell( + onTap: () => {widget.deleteCartItems()}, + child: Icon( + Icons.delete_outline_sharp, + color: Colors.grey.shade700, + ), + ), + title: Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + (widget.item.product.images != null && widget.item.product.images.length > 0) + ? Image.network( + widget.item.product.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + Expanded( + child: Container( + margin: + const EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: Container( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Texts( + projectProvider.isArabic + ? widget.item.product.namen + : widget.item.product.name, + regular: true, + textAlign: TextAlign.justify, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Container( + child: Texts( + "${(widget.item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Row( + children: [ + InkWell( + onTap: () => + {_quantityOnChangeClick(Operation.dec)}, + child: Container( + width: 25, + height: 25, + child: Center( + child: Texts( + "-", + color: Colors.grey.shade400, + )), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + ), + ), + Container( + margin: + const EdgeInsets.symmetric(horizontal: 4), + width: 25, + height: 25, + color: Colors.grey.shade300, + child: Center( + child: TextField( + cursorColor: Colors.black, + keyboardType: TextInputType.number, + controller: _quantityController, + textAlign: TextAlign.center, + onChanged: (text) { + setState(() { + var value = int.tryParse(text); + if (value == null) { + widget.item.quantity = 0; + } else { + widget.item.quantity = int.parse(text); + } + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + }); + }, + )), + ), + InkWell( + onTap: () => + {_quantityOnChangeClick(Operation.inc)}, + child: Container( + width: 25, + height: 25, + child: Center( + child: Texts( + "+", + color: Colors.grey.shade400, + )), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 1.0, + ), + ), + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + TranslationBase.of(context).total, + color: Colors.grey.shade500, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Texts( + "$_totalPrice ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}", + fontSize: 12, + fontWeight: FontWeight.bold, + ) + ], + ), + ) + ], + ) + ], + ), + ), + ), + ) + ], + ), + ), + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 15, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], ); } + + _quantityOnChangeClick(Operation operation) { + int newValue = 0; + setState(() { + switch (operation) { + case Operation.inc: + { + newValue = widget.item.quantity + 1; + } + break; + + case Operation.dec: + { + newValue = widget.item.quantity - 1; + } + break; + default: + { + //statements; + } + break; + } + if (newValue > 0) { + widget.item.quantity = newValue; + _quantityController.text = "${widget.item.quantity}"; + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + } + }); + if (newValue > 0) { + widget.changeCartItems(); + } + } + + @override + void dispose() { + // Clean up the controller when the widget is removed from the + // widget tree. + _quantityController.dispose(); + super.dispose(); + } } + +enum Operation { inc, dec } diff --git a/lib/pages/pharmacies/widgets/ProductOrderPreviewItem.dart b/lib/pages/pharmacies/widgets/ProductOrderPreviewItem.dart new file mode 100644 index 00000000..d38f437c --- /dev/null +++ b/lib/pages/pharmacies/widgets/ProductOrderPreviewItem.dart @@ -0,0 +1,111 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ProductOrderPreviewItem extends StatelessWidget { + final ShoppingCart item; + + ProductOrderPreviewItem(this.item); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return Container( + margin: EdgeInsets.only(top: 16), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + (item.product.images != null && item.product.images.length > 0) + ? Image.network( + item.product.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + Expanded( + child: Container( + margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 8), + child: Container( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Texts( + projectProvider.isArabic + ? item.product.namen + : item.product.name, + regular: true, + textAlign: TextAlign.justify, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Container( + child: Texts( + "${(item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + margin: const EdgeInsets.only(bottom: 4), + ), + Container( + width: double.infinity, + alignment: Alignment.centerRight, + child: Texts( + TranslationBase.of(context).total, + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + fontSize: 13, + ), + ), + Row( + children: [ + Texts( + "QTY: ${item.quantity}", + color: Colors.grey.shade500, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + Expanded( + child: Container( + alignment: Alignment.centerRight, + child: Texts( + "${(item.product.price * item.quantity).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}", + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ) + ], + ), + ], + ), + ), + )), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 0, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 62493387..20d6b730 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -1,6 +1,7 @@ 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/product_detail.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'; @@ -17,7 +18,7 @@ class ProductTileItem extends StatelessWidget { void productOnClick(BuildContext ctx) { _saveLastVisitProducts(); - Navigator.push(ctx, FadePage(page: ProductDetailScreen(item))); + Navigator.push(ctx, FadePage(page: ProductDetailPage(item))); } void _saveLastVisitProducts() async { @@ -69,11 +70,17 @@ class ProductTileItem extends StatelessWidget { Container( margin: EdgeInsets.fromLTRB(0, 16, 0, 0), alignment: Alignment.center, - child: Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: 80, - ), + child: (item.images != null && item.images.length > 0) + ? Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), ), Container( width: item.rxMessage != null @@ -104,7 +111,7 @@ class ProductTileItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - projectProvider.isArabic ? item.name : item.namen, + projectProvider.isArabic ? item.namen : item.name, regular: true, fontSize: 12, fontWeight: FontWeight.w400, @@ -119,19 +126,21 @@ class ProductTileItem extends StatelessWidget { ), Row( children: [ - StarRating( - totalAverage: item.approvedTotalReviews > 0 - ? (item.approvedRatingSum.toDouble() / - item.approvedTotalReviews.toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( + Expanded( + child: 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/lacum-banner-widget.dart b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart new file mode 100644 index 00000000..14a53e72 --- /dev/null +++ b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart @@ -0,0 +1,289 @@ +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.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:flutter/material.dart'; + +class LakumBannerWidget extends StatefulWidget { + final LacumViewModel model; + final MediaQueryData mediaQuery; + final bool isLacumHomePage; + + LakumBannerWidget(this.model, this.mediaQuery, this.isLacumHomePage); + + @override + _LakumBannerWidgetState createState() => _LakumBannerWidgetState(); +} + +class _LakumBannerWidgetState extends State { + int _current = 0; + + @override + Widget build(BuildContext context) { + return Container( + child: Stack( + children: [ + CarouselSlider( + options: CarouselOptions( + enableInfiniteScroll: false, + enlargeCenterPage: false, + viewportFraction: 1.0, + scrollPhysics: widget.isLacumHomePage + ? ScrollPhysics() + : NeverScrollableScrollPhysics(), + initialPage: 0, + onPageChanged: (index, reason) { + setState(() { + _current = index; + }); + }, + ), + items: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(4), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey, + width: 0.4, + )), + ), + margin: EdgeInsets.symmetric(horizontal: 16), + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: widget.mediaQuery.size.width * 1.0, + height: widget.mediaQuery.size.width * 1.0, + ), + Container( + margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + "${widget.model.lacumInformation.yahalaAccountNo}", + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + BorderedButton( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus == "Active" + ? TranslationBase.of(context).active + : TranslationBase.of(context).inactive, + textColor: widget.model.lacumInformation + .accountStatus == + 1 + ? Colors.green + : Colors.red, + hasBorder: true, + borderColor: widget.model.lacumInformation + .accountStatus == + 1 + ? Colors.green + : Colors.red, + radius: 16, + rPadding: 16, + icon: widget.model.lacumInformation + .accountStatus == + 1 + ? Icon( + Icons.check_circle, + size: 25, + color: Colors.green, + ) + : Image.asset( + "assets/images/pharmacy_module/lakum/inactive_cross.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "IDENTIFICATION #", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumInformation + .identificationNo, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + "MEMBER SINCE", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.formatCreatedDateToString(), + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "MOBILE #", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + TranslationBase.of(context).language, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumInformation.prefLang == + "1" + ? TranslationBase.of(context).lanEnglish + : TranslationBase.of(context).lanArabic, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + ], + ), + ], + ), + ), + ], + ), + ), + widget.isLacumHomePage + ? Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(4), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey, + width: 0.4, + )), + ), + margin: EdgeInsets.symmetric(horizontal: 16), + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: widget.mediaQuery.size.width * 1.0, + height: widget.mediaQuery.size.width * 1.0, + ), + Container( + margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + child: widget.model.convertBase64ToBarCodeImage() != + null + ? Image.memory( + widget.model.convertBase64ToBarCodeImage()) + : Container(), + ), + ], + ), + ) + : Container(), + ], + ), + widget.isLacumHomePage + ? Positioned( + bottom: 1, + left: 1, + right: 1, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: _current == 0 ? 12.0 : 8.0, + height: 4.0, + margin: EdgeInsets.symmetric( + vertical: 0.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: _current == 0 + ? Color(0xff5ab145) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ), + Container( + width: _current == 1 ? 12.0 : 8.0, + height: 4.0, + margin: EdgeInsets.symmetric( + vertical: 0.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: _current == 1 + ? Color(0xff5ab145) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ), + ], + ), + ), + ) + : Container(), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/widgets/lakum-banner-widget.dart b/lib/pages/pharmacies/widgets/lakum-banner-widget.dart new file mode 100644 index 00000000..14a53e72 --- /dev/null +++ b/lib/pages/pharmacies/widgets/lakum-banner-widget.dart @@ -0,0 +1,289 @@ +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.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:flutter/material.dart'; + +class LakumBannerWidget extends StatefulWidget { + final LacumViewModel model; + final MediaQueryData mediaQuery; + final bool isLacumHomePage; + + LakumBannerWidget(this.model, this.mediaQuery, this.isLacumHomePage); + + @override + _LakumBannerWidgetState createState() => _LakumBannerWidgetState(); +} + +class _LakumBannerWidgetState extends State { + int _current = 0; + + @override + Widget build(BuildContext context) { + return Container( + child: Stack( + children: [ + CarouselSlider( + options: CarouselOptions( + enableInfiniteScroll: false, + enlargeCenterPage: false, + viewportFraction: 1.0, + scrollPhysics: widget.isLacumHomePage + ? ScrollPhysics() + : NeverScrollableScrollPhysics(), + initialPage: 0, + onPageChanged: (index, reason) { + setState(() { + _current = index; + }); + }, + ), + items: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(4), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey, + width: 0.4, + )), + ), + margin: EdgeInsets.symmetric(horizontal: 16), + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: widget.mediaQuery.size.width * 1.0, + height: widget.mediaQuery.size.width * 1.0, + ), + Container( + margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + "${widget.model.lacumInformation.yahalaAccountNo}", + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + BorderedButton( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus == "Active" + ? TranslationBase.of(context).active + : TranslationBase.of(context).inactive, + textColor: widget.model.lacumInformation + .accountStatus == + 1 + ? Colors.green + : Colors.red, + hasBorder: true, + borderColor: widget.model.lacumInformation + .accountStatus == + 1 + ? Colors.green + : Colors.red, + radius: 16, + rPadding: 16, + icon: widget.model.lacumInformation + .accountStatus == + 1 + ? Icon( + Icons.check_circle, + size: 25, + color: Colors.green, + ) + : Image.asset( + "assets/images/pharmacy_module/lakum/inactive_cross.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "IDENTIFICATION #", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumInformation + .identificationNo, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + "MEMBER SINCE", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.formatCreatedDateToString(), + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "MOBILE #", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + TranslationBase.of(context).language, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + Texts( + widget.model.lacumInformation.prefLang == + "1" + ? TranslationBase.of(context).lanEnglish + : TranslationBase.of(context).lanArabic, + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black, + ), + ], + ), + ], + ), + ], + ), + ), + ], + ), + ), + widget.isLacumHomePage + ? Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(4), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey, + width: 0.4, + )), + ), + margin: EdgeInsets.symmetric(horizontal: 16), + child: Stack( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_card_front_bg.png", + fit: BoxFit.fill, + width: widget.mediaQuery.size.width * 1.0, + height: widget.mediaQuery.size.width * 1.0, + ), + Container( + margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + child: widget.model.convertBase64ToBarCodeImage() != + null + ? Image.memory( + widget.model.convertBase64ToBarCodeImage()) + : Container(), + ), + ], + ), + ) + : Container(), + ], + ), + widget.isLacumHomePage + ? Positioned( + bottom: 1, + left: 1, + right: 1, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: _current == 0 ? 12.0 : 8.0, + height: 4.0, + margin: EdgeInsets.symmetric( + vertical: 0.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: _current == 0 + ? Color(0xff5ab145) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ), + Container( + width: _current == 1 ? 12.0 : 8.0, + height: 4.0, + margin: EdgeInsets.symmetric( + vertical: 0.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: _current == 1 + ? Color(0xff5ab145) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ), + ], + ), + ), + ) + : Container(), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/widgets/lakum-point-table-row-widget.dart b/lib/pages/pharmacies/widgets/lakum-point-table-row-widget.dart new file mode 100644 index 00000000..6e4e2309 --- /dev/null +++ b/lib/pages/pharmacies/widgets/lakum-point-table-row-widget.dart @@ -0,0 +1,116 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/points-expandable-notifier.dart'; +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; + +class LakumPointTableRowWidget extends StatefulWidget { + final bool isTableTitle; // true : title , false: row + final String rowTitle; + final double points; + final double riyal; + final Function onTap; + final int rowIndex; + final Widget collapsed; + final bool expandFlag; + + LakumPointTableRowWidget(this.isTableTitle, this.rowTitle, this.points, + this.riyal, this.onTap, this.rowIndex, + {this.collapsed, this.expandFlag = false}); + + @override + _LakumPointTableRowWidgetState createState() => + _LakumPointTableRowWidgetState(); +} + +class _LakumPointTableRowWidgetState extends State { + @override + Widget build(BuildContext context) { + return InkWell( + onTap: widget.onTap, + child: Column( + children: [ + Column( + children: [ + widget.collapsed != null + ? PointsExpandableNotifier( + headerWidget: buildPointRowBody(), + // bodyWidget: widget.collapsed != null ? widget.collapsed : null, + bodyWidget: widget.collapsed, + isExpand: widget.expandFlag, + ) + : buildPointRowBody(), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + + Widget buildPointRowBody() { + bool isEven = widget.rowIndex % 2 == 0; + return Container( + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + color: widget.expandFlag ? Color(0xffe4e4e4) : isEven && !widget.isTableTitle ? Color(0xffefefef) : Colors.white, + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Container( + child: Texts( + widget.rowTitle, + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + widget.isTableTitle ? "POINTS" : "${widget.points}", + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + widget.isTableTitle ? "RIYAL" : "${widget.riyal}", + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: widget.isTableTitle + ? Container() + : Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + widget.collapsed == null + ? Icons.keyboard_arrow_right + : widget.expandFlag + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + size: 25, + color: Colors.grey.shade700, + ), + ], + )), + ], + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart b/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart new file mode 100644 index 00000000..bddd2e3b --- /dev/null +++ b/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart @@ -0,0 +1,116 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/points-expandable-notifier.dart'; +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; + +class LakumPointTableRowWidget extends StatefulWidget { + final bool isTableTitle; // true : title , false: row + final String rowTitle; + final double points; + final double riyal; + final Function onTap; + final int rowIndex; + final Widget collapsed; + final bool expandFlag; + + LakumPointTableRowWidget(this.isTableTitle, this.rowTitle, this.points, + this.riyal, this.onTap, this.rowIndex, + {this.collapsed, this.expandFlag = false}); + + @override + _LakumPointTableRowWidgetState createState() => + _LakumPointTableRowWidgetState(); +} + +class _LakumPointTableRowWidgetState extends State { + @override + Widget build(BuildContext context) { + return InkWell( + onTap: widget.onTap, + child: Column( + children: [ + Column( + children: [ + widget.collapsed != null + ? PointsExpandableNotifier( + headerWidget: buildPointRowBody(), + // bodyWidget: widget.collapsed != null ? widget.collapsed : null, + bodyWidget: widget.collapsed, + isExpand: widget.expandFlag, + ) + : buildPointRowBody(), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + + Widget buildPointRowBody() { + bool isEven = widget.rowIndex % 2 == 0; + return Container( + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + color: widget.expandFlag ? Color(0xffe4e4e4) : isEven && !widget.isTableTitle ? Color(0xffefefef) : Colors.white, + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Container( + child: Texts( + widget.rowTitle, + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + widget.isTableTitle ? "POINTS" : "${widget.points}", + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: Container( + child: Texts( + widget.isTableTitle ? "RIYAL" : "${widget.riyal}", + fontSize: 14, + fontWeight: + widget.isTableTitle ? FontWeight.bold : FontWeight.normal, + ), + )), + Expanded( + child: widget.isTableTitle + ? Container() + : Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + widget.collapsed == null + ? Icons.keyboard_arrow_right + : widget.expandFlag + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + size: 25, + color: Colors.grey.shade700, + ), + ], + )), + ], + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart new file mode 100644 index 00000000..822dfe89 --- /dev/null +++ b/lib/pages/pharmacies/wishlist.dart @@ -0,0 +1,69 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; + +class WishlistPage extends StatefulWidget { + @override + _WishlistPageState createState() => _WishlistPageState(); +} + +class _WishlistPageState extends State { + bool isTrue = true; + + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getWishlistData(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: 'Wishlist page', + isShowAppBar: false, + isShowDecPage: false, + isPharmacy: false, + baseViewModel: model, + body: model.wishListList.length == 0 + ? Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), + ), + ) + : Container( + child: Column( + children: [ + Expanded( + flex: 20, + child: Container( + width: double.infinity, + height: + MediaQuery.of(context).size.height * 0.85, //250, + child: + ProductCheckTypeWidget(isTrue, model.wishListList), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart new file mode 100644 index 00000000..576bf2a0 --- /dev/null +++ b/lib/pages/pharmacy/order/Order.dart @@ -0,0 +1,1148 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; + +dynamic languageID; +class OrderPage extends StatefulWidget { + +// orderList({this.customerId, this.pageId}); + + String customerID; + + OrderPage({@required this.customerID}); + + @override + _OrderPageState createState() => _OrderPageState(); +} + +class _OrderPageState extends State with SingleTickerProviderStateMixin{ + + String pageID= "1"; + String customerId = ""; + String order =""; + + List orderList = [] ; + List deliveredOrderList = [] ; + List processingOrderList = []; + List cancelledOrderList = []; + List pendingOrderList = []; + + TabController _tabController; +// AppSharedPreferences sharedPref = AppSharedPreferences(); + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + + @override + void initState() { + getLanguageID(); + super.initState(); + + + _tabController = new TabController(length: 4, vsync: this,); + } + + @override + Widget build(BuildContext context) { + print( "customerID" + widget.customerID); + return BaseView( + onModelReady: (model) => model.getOrder(widget.customerID, pageID), + builder: (_,model, wi )=> AppScaffold( + appBarTitle:TranslationBase.of(context).order, + baseViewModel: model, + isShowAppBar: true, + isPharmacy:true , + body: Container( + child: Column( + children: [ + TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).delivered), + Tab(text: TranslationBase.of(context).processing), + Tab(text: TranslationBase.of(context).pending), + Tab(text: TranslationBase.of(context).cancelled), + ], + controller: _tabController, + ), + Divider( + color: Colors.grey[350], + height: 10, + thickness: 6, + indent: 0, + endIndent: 0, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + getDeliveredOrder(model), + getProcessingOrder(model), + getPendingOrder(model), + getCancelledOrder(model), + ], + controller: _tabController, + ), + ), + ], + ), + ), + ), + ); + } + + + + Widget getDeliveredOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 30 || model.order[i].orderStatusId == 997 + || model.order[i].orderStatusId == 994 + ){ + deliveredOrderList.add(model.order[i]); + } + } + return Container( + width: MediaQuery.of(context).size.width, + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: deliveredOrderList.length, + itemBuilder: (context, index){ + return Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(deliveredOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:deliveredOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.blue[700], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.blue[700], + borderRadius: BorderRadius.circular(30.0) + ), + child: deliveredOrderList[index].orderStatusId == 30 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).deliveredOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? deliveredOrderList[index].orderStatusn.toString(): + deliveredOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(deliveredOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(deliveredOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + ); + } + + Widget getProcessingOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 20 || model.order[i].orderStatusId == 995 || + model.order[i].orderStatusId == 998 || model.order[i].orderStatusId == 999){ + processingOrderList.add(model.order[i]); + } + } + return Container( + width: MediaQuery.of(context).size.width, + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: processingOrderList.length, + itemBuilder: (context, index){ + return Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(processingOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0) + ), + child: processingOrderList[index].orderStatusId == 20 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).processingOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? processingOrderList[index].orderStatusn.toString(): + processingOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(processingOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(processingOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + ); +// return Container( +// child: model.order.length != 0 +// ? SingleChildScrollView( +// child: Column( +// children: [ +// ListView.builder( +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Container( +// margin: EdgeInsets.all(8), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Row( +// children: [ +// Container( +// margin: EdgeInsets.only(right: 5), +// child: Text(TranslationBase.of(context).orderNumber, +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// Container( +// child: Text(processingOrderList[0].id.toString(), +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// ], +// ), +// SizedBox( +// height: 5,), +// Row( +// children: [ +// Container( +// margin: EdgeInsets.only(right: 5), +// child: Text(TranslationBase.of(context).orderDate, +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// Container( +// child: Text(processingOrderList[0].createdOnUtc.toString().substring(0,11), +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// ], +// ), +// ], +// ), +// ), +// Container( +// margin: EdgeInsets.all(8), +// child: InkWell( +// onTap: () { +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[0]))); +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/arrow_right.svg', +// height: 20, +// width: 20,), +// ), +// ), +// ], +// ), +// ), +// Divider( +// color: Colors.grey[350], +// height: 20, +// thickness: 1, +// indent: 0, +// endIndent: 0, +// ), +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Container( +// margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), +// padding: EdgeInsets.only(left: 13.0, right: 13.0), +// decoration: BoxDecoration( +// border: Border.all( +// color: Colors.green, +// style: BorderStyle.solid, +// width: 5.0, +// ), +// color: Colors.green, +// borderRadius: BorderRadius.circular(30.0) +// ), +// child: Text( widget.languageID == "ar" +// ? processingOrderList[0].orderStatusn.toString() +// : processingOrderList[0].orderStatus.toString().substring(12), +//// TranslationBase.of(context).processing, +// style: TextStyle( +// color: Colors.white, +// fontSize: 15.0, +// fontWeight: FontWeight.bold, +// ), +// ), +// ), +// Container( +// margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), +// child: Column( +//// crossAxisAlignment: CrossAxisAlignment.end, +// children: [ +// Row( +// children: [ +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Text(processingOrderList[0].orderTotal.toString(), +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Text(TranslationBase.of(context).sar, +// style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, +// ), +// ), +// ), +// ], +// ), +// SizedBox( +// height: 5,), +// Row( +// children: [ +// Container( +// child: Text(processingOrderList[0].orderItems[0].quantity.toString(), +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Text(TranslationBase.of(context).itemsNo, +// style: TextStyle(fontSize: 14.0, +// ), +// ), +// ), +// ], +// ), +// ], +// ), +// ), +// ], +// ), +// Divider( +// color: Colors.grey[350], +// height: 20, +// thickness: 8, +// indent: 0, +// endIndent: 0, +// ), +// ], +// ), +// ) +// : Container( +// child: Center( +// child: Column( +// mainAxisAlignment: MainAxisAlignment.center, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// SvgPicture.asset( +// 'assets/images/pharmacy/empty_box.svg'), +// Container( +// margin: EdgeInsets.only(top: 10.0), +// child: Text(TranslationBase.of(context).noOrder, +// style: TextStyle( +// fontSize: 16.0, +// )), +// ), +// ], +// ), +// ), +// ), +// ); + } + + Widget getPendingOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 10){ + pendingOrderList.add(model.order[i]); + } + } + return Container( + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: pendingOrderList.length , + itemBuilder: (context, index){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(pendingOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all( 8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange[300], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.orange[300], + borderRadius: BorderRadius.circular(30.0) + ), + child: pendingOrderList[index].orderStatusId == 10 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).pendingOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? pendingOrderList[index].orderStatusn.toString(): + pendingOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.all(8.0), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(pendingOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(pendingOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + + ); + } + + Widget getCancelledOrder(OrderModelViewModel model){ + for(int i=0 ; i< model.order.length; i++){ + if( model.order[i].orderStatusId == 40 || model.order[i].orderStatusId == 996 + || model.order[i].orderStatusId == 200){ + cancelledOrderList.add(model.order[i]); + } + } + return Container( + child: model.order.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: cancelledOrderList.length, + itemBuilder: (context, index){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all( 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderNumber, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text(cancelledOrderList[index].id.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text(TranslationBase.of(context).orderDate, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,11), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:cancelledOrderList[index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + :'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 10.0, right: 10.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.red[900], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.red[900], + borderRadius: BorderRadius.circular(30.0) + ), + child: cancelledOrderList[index].orderStatusId == 40 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).cancelledOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? cancelledOrderList[index].orderStatusn.toString(): + cancelledOrderList[index].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(cancelledOrderList[index].orderTotal.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text(cancelledOrderList[index].orderItems.length.toString(), + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).itemsNo, + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + + ); + } + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), + ); + } + + +} + + + + + + diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart new file mode 100644 index 00000000..5438663d --- /dev/null +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -0,0 +1,650 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:flutter/src/widgets/image.dart' as flutterImage; + +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:provider/provider.dart'; + + + + +dynamic languageID; +class OrderDetailsPage extends StatefulWidget { + OrderModel orderModel; + + OrderDetailsPage({@required this.orderModel}); + + @override + _OrderDetailsPageState createState() => _OrderDetailsPageState(); +} + +class _OrderDetailsPageState extends State { + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + +// AppSharedPreferences sharedPref = AppSharedPreferences(); + String orderId = ""; + String customerId; + List orderList = []; + + List cancelledOrderList = []; + +// String orderId="3516"; + var model; + var isCancel = false; + var isRefund = false; + var dataIsCancel; + var dataIsRefund; + + @override + void initState() { + getLanguageID(); + super.initState(); + print(widget.orderModel.orderItems.length); + getCancelOrder(widget.orderModel.id); +// cancelOrderDetail(order) + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getOrderDetails(widget.orderModel.id), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).orderDetail, + isShowAppBar: true, + isPharmacy: true, + body: Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0), + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_mark_icon.svg', + width: 28, + height: 28, + ), + Text( + TranslationBase.of(context).shippingAddress, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 15.0, right: 10.0), + padding: EdgeInsets.only(left: 11.0, right: 11.0), + decoration: BoxDecoration( + border: Border.all( + color: getStatusBackgroundColor(), + style: BorderStyle.solid, + width: 5.0, + ), + color: getStatusBackgroundColor(), + borderRadius: BorderRadius.circular(30.0)), + child: Text( + languageID == "ar" + ? widget.orderModel.orderStatusn.toString(): + widget.orderModel.orderStatus.toString().substring(12) , +// TranslationBase.of(context).delivered, + style: TextStyle( + color: Colors.white, + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(left: 10.0, top: 13.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.orderModel.shippingAddress.firstName + .toString() + .substring(10) + + ' ' + + widget.orderModel.shippingAddress.lastName + .toString() + .substring(9), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.orderModel.shippingAddress.address1 + .toString() + .substring(9), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ),] + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.orderModel.shippingAddress.address2 + .toString() + .substring(9) + + ' ' + + widget.orderModel.shippingAddress.country + .toString() + + ' ' + + widget.orderModel.shippingAddress.zipPostalCode + .toString(), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ]), + ), + Container( + child: Row( + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/mobile_number_icon.svg', + height: 13, + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + child: Text( + widget.orderModel.shippingAddress.phoneNumber + .toString(), + style: TextStyle( + fontSize: 15.0, + ), + ), + ), + ], + ), + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/shipping_truck_icon.svg', + height: 20, + width: 20, + ), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + TranslationBase.of(context).shippedMethod, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: flutterImage.Image.asset( + widget.orderModel.shippingRateComputationMethodSystemName != + "Shipping.Aramex" + ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" + : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", + fit: BoxFit.contain, +// height: 100, + width: 100, + ), + ), +// Container( +// child: widget.orderModel +// .shippingRateComputationMethodSystemName == +// "Shipping.FixedOrByWeight" +// ? Container( +// margin: EdgeInsets.only(bottom: 10.0, top: 10.0), +// child: SvgPicture.asset( +// 'assets/images/pharmacy_module/payment/hmg_shipping_logo.png', +// height: 25, +// width: 25, +// ), +// ) +// : Container( +// margin: EdgeInsets.only(bottom: 10.0, top: 10.0), +// child: SvgPicture.asset( +// 'assets/images/pharmacy_module/payment/aramex_shipping_logo.png', +// height: 25, +// width: 25, +// ), +// ), +// ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + Row( + children: [ + Container( + margin: EdgeInsets.all(10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/credit_card_icon.svg', + height: 20, + width: 20, + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Text( + widget.orderModel.paymentName.toString().substring(12), + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + Container( + padding: EdgeInsets.only(bottom: 15.0), + margin: EdgeInsets.only(left: 10.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderDetail, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount:widget.orderModel.orderItems.length, + itemBuilder: (context, index){ + return Container( + child: productTile(productName: widget.orderModel.orderItems[index].product.name.toString(), + productPrice: widget.orderModel.orderItems[index].product.price.toString(), + productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(), + productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews, + totalPrice: "${(widget.orderModel.orderItems[index].product.price + * widget.orderModel.orderItems[index].quantity).toStringAsFixed(2)}", + qyt: widget.orderModel.orderItems[index].quantity.toString(), + isOrderDetails:true, + imgs: widget.orderModel.orderItems[index].product.images != null && + widget.orderModel.orderItems[index].product.images.length != 0 + ? widget.orderModel.orderItems[index].product.images [0].src.toString() + : null, + status: widget.orderModel.orderStatusId, + product: widget.orderModel.orderItems[index].product, + ), + ); + }), + + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(left: 10.0, top: 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderSummary, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).subtotal, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + widget.orderModel.orderSubtotalExclTax.toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).shipping, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + widget.orderModel.orderShippingExclTax.toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).vat, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + widget.orderModel.orderTax.toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(top: 5.0, left: 10.0), + child: Text( + TranslationBase.of(context).total, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Text( + widget.orderModel.orderTotal.toString(), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ], + ), + widget.orderModel.orderStatusId == 10 + ? InkWell( + onTap: () { + model.makeOrder(); + }, + child: Container( +// margin: EdgeInsets.only(top: 20.0), + height: 50.0, + color: Colors.transparent, + child: Container( + padding: EdgeInsets.only(left: 130.0, right: 130.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0), + color: Colors.green, + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).payOnline, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ) + : Container(), +// getCancelOrder(canCancel, canRefund), + isCancel + ? InkWell( + onTap: () { + presentConfirmDialog(model, + widget.orderModel.id); //(widget.orderModel.id)); +// + }, + child: Container( +// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), + height: 50.0, + color: Colors.transparent, + child: Center( + child: Text( + TranslationBase.of(context).cancelOrder, + style: TextStyle( + color: Colors.red[900], + fontWeight: FontWeight.bold, + decoration: TextDecoration.underline), + ), + ), + ), + ) + : Container(), + ], + ), + ), + ), + ), + ); + } + + Color getStatusBackgroundColor() { + print(widget.orderModel.orderStatusId); +// if(orderStatus == 'delivered') + if (widget.orderModel.orderStatusId == 30 || + widget.orderModel.orderStatusId == 997 || + widget.orderModel.orderStatusId == 994) + return Colors.blue[700]; + else if (widget.orderModel.orderStatusId == 20 || + widget.orderModel.orderStatusId == 995 || + widget.orderModel.orderStatusId == 998 || + widget.orderModel.orderStatusId == 999) + return Colors.green; + else if (widget.orderModel.orderStatusId == 10) + return Colors.orange[300]; + else if (widget.orderModel.orderStatusId == 40 || + widget.orderModel.orderStatusId == 996 || + widget.orderModel.orderStatusId == 200) return Colors.red[900]; + } + + getCancelOrder(dataIsCancel) { + if (widget.orderModel.canCancel && widget.orderModel.canRefund) { + setState(() { + isCancel = true; + isRefund = false; + }); + } else if (widget.orderModel.canCancel) { + setState(() { + isCancel = true; + isRefund = false; + }); + } else if (widget.orderModel.canRefund) { + setState(() { + isCancel = false; + isRefund = true; + }); + } else { + setState(() { + isCancel = false; + isRefund = false; + }); + } + } + +// .getCanceledOrder + presentConfirmDialog(cancelFunction, id) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).confirmCancellation, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => + cancelFunction.getCanceledOrder(id, context).then((value) { + print(":D"); + print(value); +// Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrderPage( + customerID: widget.orderModel.customerId.toString())), + ); + }), + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + + getCanceledOrder(order) { + Navigator.pop(context); + if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) { +// getCanceledOrder(order); +// AppToast.showSuccessToast(message: "Request Sent Successfully"); +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => OrderPage())); + + } + } +} diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart new file mode 100644 index 00000000..4d09191c --- /dev/null +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -0,0 +1,367 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:intl/intl.dart'; +import 'package:rating_bar/rating_bar.dart'; +import 'package:flutter/src/widgets/image.dart' as flutterImage; + +class ProductReviewPage extends StatefulWidget { + final Product product; + + ProductReviewPage(this.product); + + @override + _ProductReviewPageState createState() => _ProductReviewPageState(); +} + +class _ProductReviewPageState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + double currentRating = 0; + String reviewText = ""; + TextEditingController _reviewController = new TextEditingController(); + bool finishReview = false; + + @override + Widget build(BuildContext context) { + double ratingValue = double.parse("${widget.product.approvedRatingSum}"); + return BaseView( + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).writeReview, + isShowAppBar: true, + isPharmacy: true, + body: Container( + color: Colors.white, + child: !finishReview ? SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + widget.product.images != null + ? flutterImage.Image.network( + widget.product.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : flutterImage.Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + Expanded( + child: Container( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.product.name, + style: TextStyle( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.normal), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: + '${widget.product.price} ${TranslationBase.of(context).sar}', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: ratingValue, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + SizedBox( + width: 20, + ), + Container( + child: Align( + child: RichText( + text: TextSpan( + text: + '(${widget.product.approvedTotalReviews} reviews)', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), + ), + ), + ), + ), + ], + ), + ], + ), + ), + ), + ]), + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + Container( + margin: EdgeInsets.only(top: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar( + size: 40.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + onRatingChanged: (rating) { + currentRating = rating; + }, + ), + ], + ), + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Column( + children: [ + TextFormField( + controller: _reviewController, + maxLines: 6, + minLines: 4, + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Tell us more about product!', + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.0), + borderSide: + BorderSide(width: 1, color: Colors.grey[400]), + ), + enabledBorder: OutlineInputBorder( + borderRadius: + BorderRadius.all(Radius.circular(5.0)), + borderSide: + BorderSide(color: Colors.grey[400], width: 1), + ), + ), + onChanged: (value) { + setState(() { + reviewText = value; + }); + }, + textAlign: TextAlign.start, + textAlignVertical: TextAlignVertical.top, + ), + ], + ), + ), + InkWell( + onTap: reviewText != null && reviewText != "" + ? () { + model + .makeReview( + widget.product, ratingValue, reviewText) + .then((value) { + setState(() { + finishReview = true; + }); + }); + } + : null, + child: Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + height: 50.0, + width: 400.0, + color: Colors.transparent, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: _reviewController.value.text != null && + _reviewController.value.text != "" + ? Colors.yellow[700] + : Color(0xFFf5d69c), + style: BorderStyle.solid, + width: 1.0), + color: _reviewController.value.text != null && + _reviewController.value.text != "" + ? Colors.yellow[700] + : Color(0xFFf5d69c), + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).shareReview, + style: TextStyle( + color: Colors.white, + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ], + ), + ) : getReviewedProduct(), + ), + ), + ); + } + + //new screen is showing after submitting the review + Widget getReviewedProduct() { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/check_icon.svg', + width: 28, + height: 28, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: Text( + TranslationBase.of(context).reviewSuccessful, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8, vertical: 8), + child: Text( + TranslationBase.of(context).reviewShared, + style: TextStyle( + fontSize: 15.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 30.0, top: 30.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/success_review_icon.svg', + width: 100, + height: 100, + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/quote_start.svg', + width: 15, + height: 15, + ), + ], + ), + Text( + TranslationBase.of(context).reviewComment, + style: TextStyle( + fontSize: 15.0, + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/quote_end.svg', + width: 15, + height: 15, + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 20.0), + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return PharmacyProfilePage(); + }), + ); + }, + child: Container( + height: 50.0, + color: Colors.transparent, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange, + style: BorderStyle.solid, + width: 1.0), + color: Colors.transparent, + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).backMyAccount, + style: TextStyle( + color: Colors.orange, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ), + ], + ); + } + +} diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart new file mode 100644 index 00000000..7e8763e1 --- /dev/null +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -0,0 +1,82 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_place_picker/google_maps_place_picker.dart'; + +class AddAddressPage extends StatefulWidget { + final Addresses editedAddress; + final Function(PickResult) onPick; + + AddAddressPage(this.editedAddress, this.onPick); + + @override + _AddAddressPageState createState() => _AddAddressPageState(); +} + +class _AddAddressPageState extends State { + double _latitude; + double _longitude; + + @override + void initState() { + super.initState(); + if (widget.editedAddress != null && + widget.editedAddress.latLong != null && + widget.editedAddress.latLong != "") { + List latLng = widget.editedAddress.latLong.split(","); + _latitude = double.parse(latLng[0]); + _longitude = double.parse(latLng[1]); + } else { + _getCurrentLocation(); + } + } + + _getCurrentLocation() async { + await Geolocator.getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + } + + @override + Widget build(BuildContext context) { + PreferredSizeWidget appBarWidget = AppBarWidget( + "${TranslationBase.of(context).changeAddress}", null, true); + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top; + + return BaseView( + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).changeAddress, + isShowAppBar: true, + isPharmacy: true, + backgroundColor: Colors.white, + appBarWidget: appBarWidget, + body: Container( + height: height * 1, + child: PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + isWithAppBar: false, + buttonColor: Color(0xFF5AB145), + buttonLabel: TranslationBase.of(context).save, + onPick: (value) { + widget.onPick(value); + }, + ), + ), + ), + ); + } +} diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart new file mode 100644 index 00000000..e3651e21 --- /dev/null +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -0,0 +1,320 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; + + +class PharmacyAddressesPage extends StatefulWidget { + @override + _PharmacyAddressesState createState() => _PharmacyAddressesState(); +} + +class _PharmacyAddressesState extends State { + + void navigateToAddressPage( + BuildContext ctx, PharmacyAddressesViewModel model, Addresses address) { + Navigator.push( + ctx, + FadePage( + page: AddAddressPage(address, (pickResult) { + model.addEditAddress(pickResult, address); + }))); + } + + Widget build(BuildContext context) { + PreferredSizeWidget appBarWidget = AppBarWidget( + "${TranslationBase.of(context).changeAddress}", null, true); + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - + appBarWidget.preferredSize.height - + mediaQuery.padding.top; + + return BaseView( + onModelReady: (model) => model.getAddressesList(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).changeAddress, + isShowAppBar: true, + isPharmacy: true, + baseViewModel: model, + backgroundColor: Colors.white, + appBarWidget: appBarWidget, + body: Container( + height: height * 0.90, + child: SingleChildScrollView( + child: Column( + children: [ + ...List.generate( + model.addresses != null ? model.addresses.length : 0, + (index) => AddressItemWidget( + model, + model.addresses[index], + () { + setState(() { + model.setSelectedAddressIndex(index); + }); + }, + model.selectedAddressIndex == index, + (address) { + navigateToAddressPage(context, model, address); + }), + ), + Container( + color: Colors.white, + margin: EdgeInsets.all(8), + child: BorderedButton( + TranslationBase.of(context).addAddress, + hasBorder: true, + borderColor: Color(0xFF0fca6d), + textColor: Color(0xFF0fca6d), + fontWeight: FontWeight.bold, + backgroundColor: Colors.white, + fontSize: 14, + vPadding: 12, + hasShadow: true, + handler: () { + navigateToAddressPage(context, model, null); + }, + ), + ), + ], + ), + ), + ), + bottomSheet: Container( + height: height * 0.10, + color: Colors.white, + child: Column( + children: [ + Divider( + color: Colors.grey.shade300, + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8), + child: BorderedButton( + TranslationBase.of(context).confirmAddress, + hasBorder: true, + borderColor: Color(0xFF5AB145), + textColor: Colors.white, + fontWeight: FontWeight.bold, + backgroundColor: Color(0xFF5AB145), + fontSize: 14, + vPadding: 12, + handler: () { + model.saveSelectedAddressLocally( + model.addresses[model.selectedAddressIndex]); + Navigator.pop(context, + model.addresses[model.selectedAddressIndex]); + }, + ), + ), + ], + ), + ), + ), + ); + } +} + +class AddressItemWidget extends StatelessWidget { + final PharmacyAddressesViewModel model; + final Addresses address; + final Function selectAddress; + final bool isSelected; + final Function(Addresses) onTabEditAddress; + + AddressItemWidget(this.model, this.address, this.selectAddress, + this.isSelected, this.onTabEditAddress); + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 0), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + InkWell( + onTap: selectAddress, + child: Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Container( + decoration: new BoxDecoration( + color: !isSelected ? Colors.white : Colors.green, + shape: BoxShape.circle, + border: Border.all( + color: Colors.grey, + style: BorderStyle.solid, + width: 1.0), + ), + child: Padding( + padding: const EdgeInsets.all(0.0), + child: Icon( + Icons.check, + color: isSelected + ? Colors.white + : Colors.transparent, + size: 25, + ), + ), + ), + ), + ), + ), + ], + ), + Expanded( + child: Container( + child: Container( + margin: + EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 0), + child: Texts( + "${address.firstName} ${address.lastName}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 4), + child: Texts( + "${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}", + fontSize: 12, + fontWeight: FontWeight.normal, + color: Colors.grey.shade500, + ), + ), + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 8), + child: Icon( + Icons.phone, + size: 20, + color: Colors.black, + ), + ), + Texts( + "${address.phoneNumber}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ], + ), + SizedBox( + height: 10, + ), + Container( + height: 25, + child: Row( + children: [ + BorderedButton( + TranslationBase.of(context).edit, + backgroundColor: Colors.transparent, + hasBorder: true, + borderColor: Colors.transparent, + textColor: Color(0x990000FF), + handler: () { + onTabEditAddress(address); + }, + icon: Icon( + Icons.edit, + size: 15, + color: Color(0x990000FF), + ), + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey.shade400, + ), + ), + ), + BorderedButton( + TranslationBase.of(context).delete, + backgroundColor: Colors.transparent, + hasBorder: true, + borderColor: Colors.transparent, + textColor: Color(0x99FF0000), + handler: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + title: "Are you sure want to delete", + confirmMessage: + "${address.address1} ${address.address2}", + okText: + TranslationBase.of(context).delete, + cancelText: TranslationBase.of(context) + .cancel_nocaps, + okFunction: () => { + model + .deleteAddresses(address) + .then((_) { + ConfirmDialog.closeAlertDialog( + context); + AppToast.showErrorToast( + message: + "Address has been deleted"); + }) + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + icon: Icon( + Icons.delete, + size: 15, + color: Color(0x99FF0000), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), + Divider( + color: Colors.grey.shade200, + height: 10, + thickness: 10, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart new file mode 100644 index 00000000..1057a740 --- /dev/null +++ b/lib/pages/pharmacy/profile/profile.dart @@ -0,0 +1,626 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; +import 'package:diplomaticquarterapp/pages/login/welcome.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-terms-conditions-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; + +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart'; + +dynamic languageID ; +class PharmacyProfilePage extends StatefulWidget { + @override + _ProfilePageState createState() => _ProfilePageState(); +} + +class _ProfilePageState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + String page_id = ""; + + AuthenticatedUser user; + bool isLogin = false; + String firstName; + String customerId; + String lastName, mobileNo, identificationNo; + int languageId; + + _ProfilePageState({this.customerId }); + + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + getCustomer() async { + String custID; + custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + setState(() { + customerId = custID; + }); + print("customer Id is"+ customerId); + return customerId; + } + + getUser() async { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null){ user = AuthenticatedUser.fromJson(userData); + setState(() { + firstName = user.firstName.toString(); + print("this is user" + user.firstName.toString()); + print("this is user" + user.firstNameN.toString()); + }); + } else{ + if(userData == null){ + Navigator.push(context, + MaterialPageRoute(builder: (context) => + WelcomeLogin()), + ); + } + } + +// this.isLogin = user != null; + } + void initState() { + getCustomer(); + getLanguageID(); + super.initState(); + getUser(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getOrder(customerId, page_id), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).myAccount, + isShowAppBar:false, + isShowDecPage: false, + isPharmacy: true, + body: Container( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + child: Row( + children: [ + Container( + padding: EdgeInsets.only( + top: 20.0, + left: 10.0, + right: 10.0, + bottom: 10.0, + ), + child: LargeAvatar( + name: "profile", + url: '', + ), + ), + Container( + child: Column( + children: [ + Text( + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 14.0, + fontWeight: FontWeight.bold, + color:Colors.grey + ), + ), + Text( + languageID == "ar" + ? user.firstNameN.toString()+ " " + user.lastNameN.toString() + : user.firstName.toString()+ " " + user.lastName.toString(), + style: TextStyle( + fontSize: 14.0, fontWeight: FontWeight.bold), + ), + ], + ), + + ) + ], + ), + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 15, + ), + Container( + child: Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + if(customerId == null){ + AppToast.showErrorToast(message: "Customer not found"); + return; + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrderPage(customerID: customerId))); + }, + child: Column( + children: [ +// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), + SvgPicture.asset( + 'assets/images/pharmacy/orders_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).orders, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LakumMainPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/lakum_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).lakum, + style: TextStyle( + fontSize: 13.0, fontWeight: FontWeight.bold), + ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => WishlistPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/wishlist_icon.svg', + width: 50, + height: 50, + + ),SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).wishlist, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyReviewsPage())); + },child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/review_icon.svg', + width: 50, + height: 50, + ), + SizedBox( + height: 5, + ), + Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + )), + SizedBox( + height: 15, + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 10, + ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).myAccount, + style: TextStyle( + fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_prescription_icon.svg', + width: 28, + height: 28, + ), + SizedBox( + width: 15, + ), + Text( + TranslationBase.of(context).myPrescription, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ComparePage())); + }, + child: Row( + children: [ + Image.asset('assets/images/pharmacy/compare.png', + width: 35, height: 35), + SizedBox( + width: 15, + ), + Text( + TranslationBase.of(context).compare, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/medication_refill_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).medicationsRefill, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MyFamily())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_family_icon.svg', + width: 20, + height: 20, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).family, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PharmacyAddressesPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_addresses_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).shippingAddresses, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PharmacyTermsConditions())); + }, + child: Row( + children: [ + Image.asset('assets/images/pharmacy/terms.png', + width: 25, + height: 25, + ), + + SizedBox( + width: 10, + ), + Text( + TranslationBase.of(context).conditionsHMG, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, + this.mobileNo, this.languageId))); + }, + child: Row( + children: [ + Image.asset('assets/images/pharmacy/terms.png', + width: 25, + height: 25, + ), +// IconButton(icon: Icon(Icons.error_outline), iconSize: 30, +// color: Colors.black,), + SizedBox( + width: 10, + ), + Text( + TranslationBase.of(context).conditions, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 10, + ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).reachUs, + style: TextStyle( + fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LiveChatPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/contact_us_icon.svg', + width: 20, + height: 20, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).contactUs, + style: TextStyle(fontSize: 13.0), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FindUsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/our_locations_icon.svg', + width: 30, + height: 30, + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).ourLocations, + style: TextStyle(fontSize: 13.0), + ), + ], + ), + ) + ], + ), + ) + ], + ), + ), + ), + )); + }} + + + + diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart new file mode 100644 index 00000000..06bba8c3 --- /dev/null +++ b/lib/pages/pharmacy_categorise.dart @@ -0,0 +1,239 @@ +import 'dart:convert'; + +import 'package:barcode_scan_fix/barcode_scan.dart'; +import 'package:charts_flutter/flutter.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; +import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'base/base_view.dart'; +import 'final_products_page.dart'; + +class PharmacyCategorisePage extends StatefulWidget { + @override + _PharmacyCategorisePageState createState() => _PharmacyCategorisePageState(); +} + +class _PharmacyCategorisePageState extends State { + String idCategorise; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getCategorise(), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( + isShowDecPage: false, + baseViewModel: model, + body: Column( + children: [ + Container( + height: 400, + margin: EdgeInsets.only(bottom: 22), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 1.0, + childAspectRatio: 3.2, + ), + itemCount: model.categorise.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(4.0), + child: InkWell( + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + color: Colors.grey.withOpacity(0.24), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? model.categorise[index].namen + : model.categorise[index].name, + fontWeight: FontWeight.w600, + ), + ), + ), + onTap: () => { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + model.categorise[index].id != '12' + ? ParentCategorisePage( + id: model.categorise[index].id, + titleName: model.categorise[index].name, + ) + : FinalProductsPage( + id: model.categorise[index].id, + ), + ), + ), + }, + ), + ); + }, + ), + ), + Container( + height: 140, + child: Column( + children: [ + Divider( + height: 2.0, + thickness: 1.0, + color: Colors.black12.withOpacity(0.14)), + SizedBox( + height: 10.0, + ), + Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.green.shade300.withOpacity(0.34), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'الاكثر مبيعا' + : 'Best Sellers', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: Colors.orangeAccent.shade200 + .withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'الاكثر مشاهدة' + : 'Most Viewed', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ], + ), + Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: Colors.blue.shade200.withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'منتجات جديدة' + : 'New Products', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: InkWell( + onTap: () { + _scanQrAndGetPatient(context, model); + }, + child: Container( + height: 50.0, + width: 55.0, + decoration: BoxDecoration( + color: + Colors.purple.shade200.withOpacity(0.34), + borderRadius: BorderRadius.circular(5.0), + ), + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 10.0), + child: Texts( + projectViewModel.isArabic + ? 'شوهد مؤخرا' + : 'Recently Viewed', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ), + ], + ), + ], + )), + ], + ), + ), + ); + } + + _scanQrAndGetPatient( + BuildContext context, + PharmacyCategoriseViewModel model, + ) async { + //TODO fix it + /// When give qr we will change this method to get data + /// var result = await BarcodeScanner.scan(); + /// int patientID = get from qr result + String result = await BarcodeScanner.scan(); + var data = json.decode(result); + if (data!=null) { + var qRParkingID = data['QRParkingID']; + await model.scanQr(); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast(message: model.scanList[0].id); + { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LandingPagePharmacy()), + ); + } + } + } + } +} diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart new file mode 100644 index 00000000..45cafd35 --- /dev/null +++ b/lib/pages/search_products_page.dart @@ -0,0 +1,287 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; + +import 'base/base_view.dart'; + +class SearchProductsPage extends StatefulWidget { + @override + _SearchProductsPageState createState() => _SearchProductsPageState(); +} + +class _SearchProductsPageState extends State { + final textController = TextEditingController(); + final _formKey = GlobalKey(); + String msg = ''; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.clearSearchList(), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: 'Search', + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + //baseViewModel: model, + body: SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight, + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.79, + child: Form( + key: _formKey, + child: TextFields( + autoFocus: true, + hintText: 'Search', + fontSize: 19.0, + prefixIcon: Icon(Icons.search), + inputAction: TextInputAction.search, + onSaved: (value) { + //searchMedicine(model, context); + }, + onSubmit: (value) { + searchMedicine(model, context); + msg = 'No Result Found'; + }, + controller: textController, + validator: (value) { + if (value.isEmpty) { + return 'please Enter Product Name'; + } + return null; + }, + ), + ), + ), + SizedBox( + width: 10.0, + ), + InkWell( + child: Texts( + 'Cancel', + fontSize: 17.0, + fontWeight: FontWeight.w500, + ), + onTap: () { + Navigator.pop(context); + }, + ), + + // child: Container( + // child: Button( + // backgroundColor: Colors.green, + // loading: model.state == ViewState.BusyLocal, + // label: 'Search', + // onTap: () { + // searchMedicine(model, context); + // }), + // width: MediaQuery.of(context).size.width * 0.09, + // ), + ], + ), + ), + Center( + child: NetworkBaseView( + baseViewModel: model, + child: model.searchList.isNotEmpty + ? Container( + height: MediaQuery.of(context).size.height * 0.80, + child: GridView.builder( + //physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.searchList.length, + itemBuilder: (BuildContext context, int index) { + return Card( + color: model.searchList[index].discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, + ), + 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( + model.searchList[index].images + .isNotEmpty + ? model.searchList[index] + .images[0].thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model.searchList[index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only( + topLeft: + Radius.circular(6)), + ), + child: Texts( + model.searchList[index] + .rxMessage != + null + ? model.searchList[index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + model.searchList[index].name, + regular: true, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + Padding( + padding: const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.searchList[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .searchList[ + index] + .approvedRatingSum > + 0 + ? (model + .searchList[ + index] + .approvedRatingSum + .toDouble() / + model + .searchList[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.searchList[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + ); + }, + ), + ) + : Texts(msg), + ), + ) + ], + ), + ), + ), + ), + ); + } + + searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) { + Utils.hideKeyboard(context); + if (_formKey.currentState.validate()) + model.searchProducts(productName: textController.text); + } +} diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart new file mode 100644 index 00000000..45c9fd6c --- /dev/null +++ b/lib/pages/sub_categorise_page.dart @@ -0,0 +1,944 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'base/base_view.dart'; +import 'final_products_page.dart'; + +class SubCategorisePage extends StatefulWidget { + String id; + String title; + String parentId; + + SubCategorisePage({this.id, this.parentId, this.title}); + @override + _SubCategorisePageState createState() => + _SubCategorisePageState(id: id, title: title, parentId: parentId); +} + +class _SubCategorisePageState extends State { + bool checkedBrands = false; + bool checkedCategorise = false; + String id; + String title; + String parentId; + _SubCategorisePageState({this.title, this.parentId, this.id}); + String categoriseName = "Personal Care"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getSubCategorise(i: id), + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( + appBarTitle: title, + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 5.97, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + parentId == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : parentId == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : parentId == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : parentId == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : parentId == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : parentId == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : parentId == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : parentId == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : parentId == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : parentId == + '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.subCategorise.length > 8) + Column( + children: [ + InkWell( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts('View All Categories'), + ), + ), + Icon(Icons.arrow_forward) + ], + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return Container( + height: + MediaQuery.of(context).size.height * + 0.89, + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: + model.subCategorise.length, + itemBuilder: (BuildContext context, + int index) { + return Container( + child: Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts(model + .subCategorise[ + index] + .name), + Divider( + thickness: 0.6, + color: Colors.black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + FinalProductsPage( + id: model + .subCategorise[ + index] + .id, + ), + ), + ); + }, + ), + ), + ); + }), + ), + ); + }, + ); + }, + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + ], + ), + +//Expanded widget heree if nassery + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.subCategorise.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: + EdgeInsets.symmetric(horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.orange.shade200 + .withOpacity(0.45), + ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.17, + height: MediaQuery.of(context) + .size + .height * + 0.10, + child: Center( + child: Texts( + model.subCategorise[index].name, + fontSize: 14, + fontWeight: FontWeight.w600, + maxLines: 2, + ), + ), + ), + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + FinalProductsPage( + id: model.subCategorise[index].id, + ), + ), + ); + }, + ), + ); + }), + ), + ), + ), + + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon(Icons.wrap_text), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: FontWeight.w600, + ), + ], + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController scrollController) { + return SingleChildScrollView( + controller: scrollController, + child: Container( + height: MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( + children: [ + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: + FontWeight.w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( + 'Close', + color: Colors.red, + fontWeight: + FontWeight.w600, + fontSize: 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + Column( + children: [ + ExpansionTile( + title: + Texts('Categorise'), + children: [ + Container( + height: 350, + child: ListView + .builder( + controller: + scrollController, + scrollDirection: + Axis + .vertical, + shrinkWrap: + true, + itemCount: model + .categoriseParent + .length, + itemBuilder: + (BuildContext + context, + int index) { + return CheckboxListTile( + tristate: + true, + title: Texts(model + .categoriseParent[index] + .name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedCategorise, + onChanged: + (bool + value) { + setState( + () { + checkedCategorise = + value; + }); + }, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + ExpansionTile( + title: Texts('Brands'), + children: [ + Container( + height: 350, + child: ListView + .builder( + scrollDirection: + Axis + .vertical, + shrinkWrap: + true, + itemCount: model + .brandsList + .length, + itemBuilder: + (BuildContext + context, + int index) { + return CheckboxListTile( + tristate: + true, + title: Texts(model + .brandsList[index] + .name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedBrands, + onChanged: + (bool + value) { + setState( + () { + checkedBrands = + value; + }); + }, + autofocus: + true, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + ExpansionTile( + title: Texts('Price'), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Min'), + Container( + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), + ), + ), + ), + ], + ), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Max'), + Container( + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), + ), + ), + ), + ], + ), + ], + ), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ + Container( + width: 100, + child: Button( + label: 'Reset', + backgroundColor: + Colors.red, + ), + ), + SizedBox( + width: 30, + ), + Container( + width: 200, + child: Button( + label: 'Apply', + backgroundColor: + Colors + .green, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, + //width: 0.3, + // indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Container( + height: MediaQuery.of(context).size.height * 3.85, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.subProducts.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.subProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, + ), + 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( + model.subProducts[index] + .images.isNotEmpty + ? model + .subProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model + .subProducts[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.subProducts[index] + .rxMessage != + null + ? model + .subProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + model.subProducts[index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w400, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model.subProducts[index].approvedRatingSum + .toDouble() / + model + .subProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + )); + }, + ), + ) + : Container( + height: MediaQuery.of(context).size.height * 5.0, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.subProducts.length, + itemBuilder: + (BuildContext context, int index) { + return Card( + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: BoxDecoration(), + child: Padding( + padding: EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.subProducts[index] + .images.isNotEmpty + ? model + .subProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.contain, + height: 80, + ), + ), + ], + ), + Column( + children: [ + Container( + width: model + .subProducts[ + index] + .rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5 + : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular(6)), + ), + child: Texts( + model.subProducts[index] + .rxMessage != + null + ? model + .subProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + ], + ), + Container( + height: 100.0, + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + height: 35.0, + width: 250.0, + child: Texts( + model.subProducts[index] + .name, + regular: true, + fontSize: 13.2, + fontWeight: FontWeight.w500, + maxLines: 2, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model + .subProducts[ + index] + .approvedRatingSum + .toDouble() / + model + .parentProducts[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ); + }), + ) + ], + ), + ), + ), + )); + } +} diff --git a/lib/services/pharmacy_services/brands_service.dart b/lib/services/pharmacy_services/brands_service.dart new file mode 100644 index 00000000..32024f2f --- /dev/null +++ b/lib/services/pharmacy_services/brands_service.dart @@ -0,0 +1,73 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/brandModel.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/topBrandsModel.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; + +class BrandsService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isLogin = false; + + List _brandsList = List(); + List get brandsList => _brandsList; + + List _topBrandsList = List(); + List get topBrandsList => _topBrandsList; + + List _searchList = List(); + List get searchList => _searchList; + + clearSearchList() { + _searchList.clear(); + } + + Future getBrands() async { + hasError = false; + await baseAppClient.getPharmacy(GET_BRANDS, + onSuccess: (dynamic response, int statusCode) { + _brandsList.clear(); + response['manufacturer'].forEach((item) { + _brandsList.add(Brand.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future getTopBrands() async { + hasError = false; + await baseAppClient.getPharmacy(GET_TOP_BRANDS, + onSuccess: (dynamic response, int statusCode) { + _topBrandsList.clear(); + response['manufacturer'].forEach((item) { + _topBrandsList.add(TopBrand.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future searchProducts({String productName}) async { + RegExp exp = new RegExp(productName.toUpperCase()); + hasError = false; + _searchList.clear(); + await baseAppClient.getPharmacy( + GET_BRANDS, + onSuccess: (dynamic response, int statusCode) { + response['manufacturer'].forEach((item) { + if(exp.hasMatch(item['name'])){ + _searchList.add(Brand.fromJson(item)); + }else{ + } + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + ); + } + +} diff --git a/lib/services/pharmacy_services/cancelOrder_service.dart b/lib/services/pharmacy_services/cancelOrder_service.dart new file mode 100644 index 00000000..f848c2ff --- /dev/null +++ b/lib/services/pharmacy_services/cancelOrder_service.dart @@ -0,0 +1,44 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + + +class CancelOrderService extends BaseService{ + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List _cancelOrderList = List(); + List get cancelOrderList => _cancelOrderList; + String url =""; + + + Future getCanceledOrder(order) async { + print("step 1"); + hasError = false; + + dynamic res; + + await baseAppClient.getPharmacy(GET_Cancel_ORDER+order, + onSuccess: (dynamic response, int statusCode) { + res = response; + print(res); +// _cancelOrderList.clear(); +// response['success'].forEach((item) { +// _cancelOrderList.add(OrderModel.fromJson(item)); +// }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + return res; + } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart new file mode 100644 index 00000000..a3bb9976 --- /dev/null +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -0,0 +1,75 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + + +class OrderDetailsService extends BaseService{ + + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List get orderDetails => orderDetails; + List _orderList = List(); + List get orderList => _orderList; + + + Future getOrderDetails(orderId) async { + print("step 2" + orderId); + hasError = false; + await baseAppClient.getPharmacy(GET_ORDER_DETAILS+orderId, + onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); + response['orders'].forEach((item) { + _orderList.add(OrderModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future makeReview(Product product, double rating, String reviewText) async { + hasError = false; + super.error = ""; + + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + + Map body = Map(); + Map reviewBody = Map(); + reviewBody["created_on_utc"] = DateTime.now().toString(); + reviewBody["customer_id"] = customerId; + reviewBody["helpful_no_total"] = 0; + reviewBody["helpful_yes_total"] = 0; + reviewBody["id"] = 0; + reviewBody["is_approved"] = false; + reviewBody["position"] = 0; + reviewBody["product_id"] = product.id; + reviewBody["rating"] = rating; + reviewBody["reply_text"] = reviewText; + reviewBody["store_id"] = 2; + reviewBody["title"] = ""; + body['review'] = reviewBody; + await baseAppClient.post("$PHARMACY_MAKE_REVIEW", + onSuccess: (response, statusCode) async { + /* + "success": { + "SuccessEndUserMsg": "Your request has been completed successfuly.", + "SuccessEndUserMsgN": "تمت العملية بنجاح" + } + */ + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart new file mode 100644 index 00000000..e426b801 --- /dev/null +++ b/lib/services/pharmacy_services/order_service.dart @@ -0,0 +1,81 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; + + +class OrderService extends BaseService{ + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List _orderList = List(); + List get orderList => _orderList; + String url =""; + + Future getOrder(customerId, pageId) async { + hasError = false; + // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; + url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; + print(url); + + await baseAppClient.getPharmacy(url, + onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); + response['orders'].forEach((item) { + _orderList.add(OrderModel.fromJson(item)); + }); + print(_orderList.length); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + + Future getProductReview(orderId) async { + print("step 1"); + hasError = false; + url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; +// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$page_id&limit=200&customer_id=$custmerId"; + print(url); + await baseAppClient.getPharmacy(url, + onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); + response['orders'].forEach((item) { + _orderList.add(OrderModel.fromJson(item)); + }); + print(_orderList.length); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } +// Future getOrder(BuildContext context ) async { +// +// if (await this.sharedPref.getObject(USER_PROFILE) != null) { +// var data = AuthenticatedUser.fromJson( +// await this.sharedPref.getObject(USER_PROFILE)); +// authUser = data; +// } +// +// dynamic localRes; +// String URL; +// URL = GET_ORDER; +// +// await baseAppClient.get(URL, +// onSuccess: (response, statusCode) async { +// localRes = response; +// }, onFailure: (String error, int statusCode) { +// throw error; +// }); +// return Future.value(localRes); +// } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart new file mode 100644 index 00000000..1bb6571c --- /dev/null +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -0,0 +1,102 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; + +class PharmacyAddressService extends BaseService { + List addresses = List(); + CountryData country; + int selectedAddressIndex = 0; + + Future getAddresses() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + Map queryParams = {'fields': 'addresses'}; + hasError = false; + Addresses selectedAddress; + try { + await baseAppClient.get("$GET_CUSTOMERS_ADDRESSES$customerId", + onSuccess: (dynamic response, int statusCode) async { + addresses.clear(); + var savedAddress = + await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS); + if (savedAddress != null) { + selectedAddress = Addresses.fromJson(savedAddress); + } + int index = 0; + response['customers'][0]['addresses'].forEach((item) { + Addresses address = Addresses.fromJson(item); + if (selectedAddress != null && selectedAddress.id == item["id"]) { + selectedAddressIndex = index; + } + addresses.add(address); + index++; + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } + + Future getCountries(String countryName) async { + hasError = false; + try { + await baseAppClient.get("$PHARMACY_GET_COUNTRY", + onSuccess: (dynamic response, int statusCode) { + // countries.clear(); + response['countries'].forEach((item) { + if (CountryData.fromJson(item).name == countryName || + CountryData.fromJson(item).namen == countryName) { + country = CountryData.fromJson(item); + } + // countries.add(CountryData.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } catch (error) { + throw error; + } + } + + Future addCustomerAddress(Addresses address) async { + makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); + } + + Future editCustomerAddress(Addresses address) async { + makeCustomerAddress(address, EDIT_CUSTOMER_ADDRESS); + } + + Future deleteCustomerAddress(Addresses address) async { + makeCustomerAddress(address, DELETE_CUSTOMER_ADDRESS); + } + + Future makeCustomerAddress(Addresses address, String url) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + super.error = ""; + + Map customerObject = Map(); + customerObject["addresses"] = [address]; + customerObject["id"] = customerId; + customerObject["email"] = address.email; + customerObject["role_ids"] = [3]; + Map body = Map(); + body["customer"] = customerObject; + + await baseAppClient.post("$url", onSuccess: (response, statusCode) async { + addresses.clear(); + response['customers'][0]['addresses'].forEach((item) { + addresses.add(Addresses.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart new file mode 100644 index 00000000..7a2947b0 --- /dev/null +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -0,0 +1,178 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/addToCartModel.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; + +class ProductDetailService extends BaseService { + bool isLogin = false; + + List _productDetailList = List(); + List get productDetailList => _productDetailList; + + List _productLocationList = List(); + List get productLocationList => _productLocationList; + + List _addToCartModel = List(); + List get addToCartModel => _addToCartModel; + + List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; + + List _productSpecification = List(); + List get productSpecification => _productSpecification; + + + + Future getProductReviews(productID) async { + hasError = false; + await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+productID+"?fields=reviews", + onSuccess: (dynamic response, int statusCode) { + _productDetailList.clear(); + response['products'].forEach((item) { + _productDetailList.add(ProductDetail.fromJson(item)); + print(response); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future getProductAvailabiltyDetail() async { + hasError = false; + Map request; + + request = { + "Channel": 3, + "DeviceTypeID": 2, + "IPAdress": "10.20.10.20", + "LanguageID": 2, + "PatientOutSA": 0, + "SKU": "6720020025", + "SessionID": null, + "VersionID": 5.6, + "generalid": "Cs2020@2016\$2958", + "isDentalAllowedBackend": false + }; + await baseAppClient.post(GET_LOCATION, + onSuccess: (dynamic response, int statusCode) { + _productLocationList.clear(); + response['PharmList'].forEach((item) { + _productLocationList.add(LocationModel.fromJson(item)); + print(_productLocationList); + print(response); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + + Future addToCart(quantity, itemID) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + Map request; + + request = { + "shopping_cart_item": + { + "quantity": quantity, + "shopping_cart_type": "1", + "product_id": itemID, + "customer_id": customerId, + "language_id": 1 + } + }; + await baseAppClient.post(GET_SHOPPING_CART, + onSuccess: (dynamic response, int statusCode) { + _addToCartModel.clear(); + response['shopping_carts'].forEach((item) { + _addToCartModel.add(Wishlist.fromJson(item)); + }); + AppToast.showSuccessToast(message: 'You have added a product to the cart'); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + AppToast.showErrorToast(message: 'something went wrong please try again'); + }, body: request); + } + + Future addToWishlist(itemID) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + Map request; + + request = { + "shopping_cart_item": + { + "quantity": 1, + "shopping_cart_type": "Wishlist", + "product_id": itemID, + "customer_id": customerId, + "language_id": 1 + } + }; + await baseAppClient.post(GET_SHOPPING_CART, + onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + AppToast.showSuccessToast(message: 'You have added a product to the Wishlist'); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + AppToast.showErrorToast(message: 'something went wrong please try again'); + }, body: request); + } + + Future getWishlistItems() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", + onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + Future delteItemFromWishlist(itemID) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist", + onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + + Future productSpecificationData(itemID) async { + hasError = false; + + await baseAppClient.getPharmacy(GET_SPECIFICATION+itemID, + onSuccess: (dynamic response, int statusCode) { + _productSpecification.clear(); + response['specification'].forEach((item) { + _productSpecification.add(SpecificationModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + +} diff --git a/lib/services/pharmacy_services/review_service.dart b/lib/services/pharmacy_services/review_service.dart new file mode 100644 index 00000000..44839955 --- /dev/null +++ b/lib/services/pharmacy_services/review_service.dart @@ -0,0 +1,38 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/reviewModel.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; + + +class ReviewService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + bool isLogin = false; + List _reviewList = List(); + List get reviewList => _reviewList; + + + Future getReview() async { + + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + + hasError = false; + await baseAppClient.getPharmacy(GET_REVIEW+customerId, + onSuccess: (dynamic response, int statusCode) { + _reviewList.clear(); + response['reviews'].forEach((item) { + _reviewList.add(Review.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + +} diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart new file mode 100644 index 00000000..5404a2bd --- /dev/null +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -0,0 +1,72 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/products.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + + +class WishListService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isLogin = false; + List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; + +// Future getWishlist() async { +// var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); +// this.isLogin = isLogin != null; +//// if (!isLogin) { +//// // if not login +//// } else { +//// try { +//// await baseAppClient.get( +//// GET_WISHLIST +'/productsbyids/5308,3608,2316,963,5045,2714,1480,',//+ "272843" + "?shopping_cart_type=2", +//// onSuccess: (dynamic response, int statusCode) { +//// wishListProducts.clear(); +//// response['shopping_carts'].forEach((item) { +//// wishListProducts.add(Product.fromJson(item)); +//// }); +//// }, onFailure: (String error, int statusCode) { +//// hasError = true; +//// super.error = error; +//// }); +//// } catch (error) { +//// throw error; +//// } +//// } +// hasError = false; +// try { +// await baseAppClient.getPharmacy(GET_WISHLIST+"1367368?shopping_cart_type=2", +// onSuccess: (dynamic response, int statusCode) { +// wishListProducts.clear(); +// response.forEach((item) { +// wishListProducts.add(Wishlist.fromJson(response)); +// }); +// }, onFailure: (String error, int statusCode) { +// hasError = true; +// super.error = error; +// }); +// } catch (error) { +// throw error; +// } +// } + + Future getWishlist() async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + hasError = false; + await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", + onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } + +} diff --git a/lib/services/pharmacy_services/writeReview_service.dart b/lib/services/pharmacy_services/writeReview_service.dart new file mode 100644 index 00000000..573095eb --- /dev/null +++ b/lib/services/pharmacy_services/writeReview_service.dart @@ -0,0 +1,40 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + + +class writeReviewService extends BaseService{ + + + + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List get writeReview => writeReview; + List _writeReviewList = List(); + List get orderList => _writeReviewList; + + + Future getProductReview() async { + hasError = false; + await baseAppClient.getPharmacy(WRITE_REVIEW, + onSuccess: (dynamic response, int statusCode) { + _writeReviewList.clear(); + response[''].forEach((item) { + _writeReviewList.add(OrderModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } +} \ No newline at end of file diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 79932c1c..460a4066 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -357,6 +357,11 @@ class DateUtil { return ""; } + static String getFormattedDate(DateTime dateTime, String formattedString){ + return DateFormat(formattedString) + .format(dateTime); + } + static convertISODateToJsonDate(String isoDate) { return "/Date(" + DateFormat('mm-dd-yyy') diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 418ff732..63cf8a44 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -123,7 +123,8 @@ class TranslationBase { String get welcome => localizedValues['welcome'][locale.languageCode]; - String get welcomeText => localizedValues['welcome_text'][locale.languageCode]; + String get welcomeText => + localizedValues['welcome_text'][locale.languageCode]; String get welcomeText2 => localizedValues['welcome_text2'][locale.languageCode]; @@ -131,8 +132,10 @@ class TranslationBase { String get no => localizedValues['no'][locale.languageCode]; - String get logintypeRadio => localizedValues['logintyperadio'][locale.languageCode]; - String get registerInfoFamily => localizedValues['register-info-family'][locale.languageCode]; + String get logintypeRadio => + localizedValues['logintyperadio'][locale.languageCode]; + String get registerInfoFamily => + localizedValues['register-info-family'][locale.languageCode]; String get registerNow => localizedValues['registernow'][locale.languageCode]; @@ -142,13 +145,17 @@ class TranslationBase { String get fileNo => localizedValues['fileNo'][locale.languageCode]; String get fileno => localizedValues['fileno'][locale.languageCode]; - String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; + String get forgotPassword => + localizedValues['forgotFileNo'][locale.languageCode]; - String get forgotFileNoTitle => localizedValues['forgotFileNoTitle'][locale.languageCode]; + String get forgotFileNoTitle => + localizedValues['forgotFileNoTitle'][locale.languageCode]; - String get enterNationalId => localizedValues['enter-national-id'][locale.languageCode]; + String get enterNationalId => + localizedValues['enter-national-id'][locale.languageCode]; - String get profileInfo => localizedValues['profile-info'][locale.languageCode]; + String get profileInfo => + localizedValues['profile-info'][locale.languageCode]; String get submit => localizedValues['submit'][locale.languageCode]; @@ -209,22 +216,27 @@ class TranslationBase { String get upcomingConfirm => localizedValues['upcoming-confirm'][locale.languageCode]; - String get upcomingPaymentPending => localizedValues['upcoming-payment-pending'][locale.languageCode]; + String get upcomingPaymentPending => + localizedValues['upcoming-payment-pending'][locale.languageCode]; String get upcomingConfirmMore => localizedValues['book-success-confirm-more-24-1-2'][locale.languageCode]; - - String get upcomingPaymentNow => localizedValues['upcoming-payment-now'][locale.languageCode]; + String get upcomingPaymentNow => + localizedValues['upcoming-payment-now'][locale.languageCode]; String get upcomingQR => localizedValues['upcoming-QR'][locale.languageCode]; - String get upcomingVirtual => localizedValues['upcoming-virtual'][locale.languageCode]; + String get upcomingVirtual => + localizedValues['upcoming-virtual'][locale.languageCode]; - String get upcomingLivecare => localizedValues['upcoming-livecare'][locale.languageCode]; + String get upcomingLivecare => + localizedValues['upcoming-livecare'][locale.languageCode]; - String get liveCareAppo => localizedValues['livecareAppo'][locale.languageCode]; + String get liveCareAppo => + localizedValues['livecareAppo'][locale.languageCode]; - String get upcomingDetails => localizedValues['upcoming-details'][locale.languageCode]; + String get upcomingDetails => + localizedValues['upcoming-details'][locale.languageCode]; String get reschedule => localizedValues['reschedule'][locale.languageCode]; @@ -242,27 +254,36 @@ class TranslationBase { String get payment => localizedValues['payment'][locale.languageCode]; - String get cancel_nocaps => localizedValues['cancel-nocaps'][locale.languageCode]; + String get cancel_nocaps => + localizedValues['cancel-nocaps'][locale.languageCode]; - String get cancelAppoMsg => localizedValues['cancelAppoMsg'][locale.languageCode]; + String get cancelAppoMsg => + localizedValues['cancelAppoMsg'][locale.languageCode]; - String get pharmaciesList => localizedValues['pharmaciesList'][locale.languageCode]; + String get pharmaciesList => + localizedValues['pharmaciesList'][locale.languageCode]; String get description => localizedValues['description'][locale.languageCode]; String get price => localizedValues['price'][locale.languageCode]; - String get youCanFindItIn => localizedValues['youCanFindItIn'][locale.languageCode]; + String get youCanFindItIn => + localizedValues['youCanFindItIn'][locale.languageCode]; - String get pleaseEnterMedicineName => localizedValues['pleaseEnterMedicineName'][locale.languageCode]; + String get pleaseEnterMedicineName => + localizedValues['pleaseEnterMedicineName'][locale.languageCode]; - String get verificationMessage => localizedValues['verification_message'][locale.languageCode]; + String get verificationMessage => + localizedValues['verification_message'][locale.languageCode]; - String get validationMessage => localizedValues['validation_message'][locale.languageCode]; + String get validationMessage => + localizedValues['validation_message'][locale.languageCode]; - String get arabicChange => localizedValues['arabic-change'][locale.languageCode]; + String get arabicChange => + localizedValues['arabic-change'][locale.languageCode]; - String get notification => localizedValues['notification'][locale.languageCode]; + String get notification => + localizedValues['notification'][locale.languageCode]; String get appsetting => localizedValues['app-settings'][locale.languageCode]; @@ -279,20 +300,29 @@ class TranslationBase { String get moreVerification => localizedValues['more-verify'][locale.languageCode]; - String get welcomeBack => localizedValues['welcome-back'][locale.languageCode]; + String get welcomeBack => + localizedValues['welcome-back'][locale.languageCode]; - String get accountInfo => localizedValues['account-info'][locale.languageCode]; + String get accountInfo => + localizedValues['account-info'][locale.languageCode]; - String get useAnotherAccount => localizedValues['another-acc'][locale.languageCode]; + String get useAnotherAccount => + localizedValues['another-acc'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; - String get noNeedToWaitInLine => localizedValues['noNeedToWaitInLine'][locale.languageCode]; - String get useQRAppoAttend => localizedValues['useQRAppoAttend'][locale.languageCode]; - String get passQRAppoAttend => localizedValues['passQRAppoAttend'][locale.languageCode]; - String get sitWaitingQR => localizedValues['sitWaitingQR'][locale.languageCode]; - String get attendRegisterCode => localizedValues['attendRegisterCode'][locale.languageCode]; - String get scanQRHospital => localizedValues['scanQRHospital'][locale.languageCode]; + String get noNeedToWaitInLine => + localizedValues['noNeedToWaitInLine'][locale.languageCode]; + String get useQRAppoAttend => + localizedValues['useQRAppoAttend'][locale.languageCode]; + String get passQRAppoAttend => + localizedValues['passQRAppoAttend'][locale.languageCode]; + String get sitWaitingQR => + localizedValues['sitWaitingQR'][locale.languageCode]; + String get attendRegisterCode => + localizedValues['attendRegisterCode'][locale.languageCode]; + String get scanQRHospital => + localizedValues['scanQRHospital'][locale.languageCode]; String get sendEmail => localizedValues['sendEmail'][locale.languageCode]; String get close => localizedValues['close'][locale.languageCode]; String get booked => localizedValues['booked'][locale.languageCode]; @@ -333,9 +363,11 @@ class TranslationBase { String get myFamily => localizedValues['myFamily'][locale.languageCode]; String get oxygenation => localizedValues['oxygenation'][locale.languageCode]; - String get respirationRate => localizedValues['respirationRate'][locale.languageCode]; + String get respirationRate => + localizedValues['respirationRate'][locale.languageCode]; - String get bodyMeasurements => localizedValues['bodyMeasurements'][locale.languageCode]; + String get bodyMeasurements => + localizedValues['bodyMeasurements'][locale.languageCode]; String get height => localizedValues['height'][locale.languageCode]; String get temperature => localizedValues['temperature'][locale.languageCode]; @@ -344,7 +376,8 @@ class TranslationBase { String get respiration => localizedValues['respiration'][locale.languageCode]; - String get bloodPressure => localizedValues['bloodPressure'][locale.languageCode]; + String get bloodPressure => + localizedValues['bloodPressure'][locale.languageCode]; String get painScale => localizedValues['painScale'][locale.languageCode]; String get heart => localizedValues['heart'][locale.languageCode]; @@ -353,7 +386,8 @@ class TranslationBase { String get request => localizedValues['request'][locale.languageCode]; String get memberName => localizedValues['member-name'][locale.languageCode]; String get switchUser => localizedValues['switch-login'][locale.languageCode]; - String get removeMember => localizedValues['remove-membe'][locale.languageCode]; + String get removeMember => + localizedValues['remove-membe'][locale.languageCode]; String get allowView => localizedValues['allow-view'][locale.languageCode]; String get rejectView => localizedValues['reject-view'][locale.languageCode]; String get deleteView => localizedValues['delete-view'][locale.languageCode]; @@ -362,20 +396,28 @@ class TranslationBase { String get companyName => localizedValues['companyName'][locale.languageCode]; String get receiptOn => localizedValues['receiptOn'][locale.languageCode]; String get expiryDate => localizedValues['expiryDate'][locale.languageCode]; - String get procedureName => localizedValues['procedureName'][locale.languageCode]; - String get procedureStatus => localizedValues['procedureStatus'][locale.languageCode]; + String get procedureName => + localizedValues['procedureName'][locale.languageCode]; + String get procedureStatus => + localizedValues['procedureStatus'][locale.languageCode]; String get usageStatus => localizedValues['usageStatus'][locale.languageCode]; String get unusedCount => localizedValues['unusedCount'][locale.languageCode]; - String get totalApproval => localizedValues['totalApproval'][locale.languageCode]; + String get totalApproval => + localizedValues['totalApproval'][locale.languageCode]; String get category => localizedValues['category'][locale.languageCode]; - String get expirationDate => localizedValues['expirationDate'][locale.languageCode]; + String get expirationDate => + localizedValues['expirationDate'][locale.languageCode]; String get patientCard => localizedValues['patientCard'][locale.languageCode]; - String get policyNumber => localizedValues['policyNumber'][locale.languageCode]; + String get policyNumber => + localizedValues['policyNumber'][locale.languageCode]; String get seeDetails => localizedValues['seeDetails'][locale.languageCode]; - String get insuranceCards => localizedValues['insuranceCards'][locale.languageCode]; + String get insuranceCards => + localizedValues['insuranceCards'][locale.languageCode]; String get requestType => localizedValues['requestType'][locale.languageCode]; - String get addFamilyMember => localizedValues['add-new-member'][locale.languageCode]; - String get removeFamilyMember => localizedValues['remove-family-member'][locale.languageCode]; + String get addFamilyMember => + localizedValues['add-new-member'][locale.languageCode]; + String get removeFamilyMember => + localizedValues['remove-family-member'][locale.languageCode]; String get myMedicalFile => localizedValues['MyMedicalFile'][locale.languageCode]; @@ -415,47 +457,70 @@ class TranslationBase { String get emergencyServices => localizedValues['emergencyServices'][locale.languageCode]; String get nearester => localizedValues['nearester'][locale.languageCode]; String get locationa => localizedValues['locationa'][locale.languageCode]; - String get ambulancerequest => localizedValues['ambulancerequest'][locale.languageCode]; + String get ambulancerequest => + localizedValues['ambulancerequest'][locale.languageCode]; String get requestA => localizedValues['requestA'][locale.languageCode]; - String get consultation => localizedValues['consultation'][locale.languageCode]; + String get consultation => + localizedValues['consultation'][locale.languageCode]; String get logs => localizedValues['logs'][locale.languageCode]; - String get textToSpeech => localizedValues['textToSpeech'][locale.languageCode]; - - String get myAppointments => localizedValues['MyAppointments'][locale.languageCode]; - String get noBookedAppointments => localizedValues['NoBookedAppointments'][locale.languageCode]; - String get noConfirmedAppointments => localizedValues['NoConfirmedAppointments'][locale.languageCode]; - String get noArrivedAppointments => localizedValues['noArrivedAppointments'][locale.languageCode]; - String get myAppointmentsList => localizedValues['MyAppointmentsList'][locale.languageCode]; + String get textToSpeech => + localizedValues['textToSpeech'][locale.languageCode]; + + String get myAppointments => + localizedValues['MyAppointments'][locale.languageCode]; + String get noBookedAppointments => + localizedValues['NoBookedAppointments'][locale.languageCode]; + String get noConfirmedAppointments => + localizedValues['NoConfirmedAppointments'][locale.languageCode]; + String get noArrivedAppointments => + localizedValues['noArrivedAppointments'][locale.languageCode]; + String get myAppointmentsList => + localizedValues['MyAppointmentsList'][locale.languageCode]; String get radiology => localizedValues['Radiology'][locale.languageCode]; - String get radiologySubtitle => localizedValues['RadiologySubtitle'][locale.languageCode]; + String get radiologySubtitle => + localizedValues['RadiologySubtitle'][locale.languageCode]; String get lab => localizedValues['Lab'][locale.languageCode]; String get labSubtitle => localizedValues['LabSubtitle'][locale.languageCode]; String get medicines => localizedValues['Medicines'][locale.languageCode]; - String get medicinesSubtitle => localizedValues['MedicinesSubtitle'][locale.languageCode]; + String get medicinesSubtitle => + localizedValues['MedicinesSubtitle'][locale.languageCode]; String get vitalSigns => localizedValues['VitalSigns'][locale.languageCode]; - String get vitalSignsSubtitle => localizedValues['VitalSignsSubTitle'][locale.languageCode]; + String get vitalSignsSubtitle => + localizedValues['VitalSignsSubTitle'][locale.languageCode]; String get myMedical => localizedValues['MyMedical'][locale.languageCode]; - String get myMedicalSubtitle => localizedValues['MyMedicalSubtitle'][locale.languageCode]; + String get myMedicalSubtitle => + localizedValues['MyMedicalSubtitle'][locale.languageCode]; String get myDoctor => localizedValues['MyDoctor'][locale.languageCode]; - String get myDoctorSubtitle => localizedValues['MyDoctorSubtitle'][locale.languageCode]; + String get myDoctorSubtitle => + localizedValues['MyDoctorSubtitle'][locale.languageCode]; String get eye => localizedValues['Eye'][locale.languageCode]; String get eyeSubtitle => localizedValues['EyeSubtitle'][locale.languageCode]; String get insurance => localizedValues['Insurance'][locale.languageCode]; - String get insuranceSubtitle => localizedValues['InsuranceSubtitle'][locale.languageCode]; - String get updateInsurance => localizedValues['UpdateInsurance'][locale.languageCode]; - String get updateInsuranceSubtitle => localizedValues['UpdateInsuranceSubtitle'][locale.languageCode]; - String get insuranceApproval => localizedValues['InsuranceApproval'][locale.languageCode]; - String get insuranceApprovalSubtitle => localizedValues['InsuranceApprovalSubtitle'][locale.languageCode]; + String get insuranceSubtitle => + localizedValues['InsuranceSubtitle'][locale.languageCode]; + String get updateInsurance => + localizedValues['UpdateInsurance'][locale.languageCode]; + String get updateInsuranceSubtitle => + localizedValues['UpdateInsuranceSubtitle'][locale.languageCode]; + String get insuranceApproval => + localizedValues['InsuranceApproval'][locale.languageCode]; + String get insuranceApprovalSubtitle => + localizedValues['InsuranceApprovalSubtitle'][locale.languageCode]; String get allergies => localizedValues['Allergies'][locale.languageCode]; - String get allergiesSubtitle => localizedValues['AllergiesSubtitle'][locale.languageCode]; + String get allergiesSubtitle => + localizedValues['AllergiesSubtitle'][locale.languageCode]; String get myVaccines => localizedValues['MyVaccines'][locale.languageCode]; - String get myVaccinesSubtitle => localizedValues['MyVaccinesSubtitle'][locale.languageCode]; + String get myVaccinesSubtitle => + localizedValues['MyVaccinesSubtitle'][locale.languageCode]; String get medical => localizedValues['Medical'][locale.languageCode]; - String get medicalSubtitle => localizedValues['MedicalSubtitle'][locale.languageCode]; + String get medicalSubtitle => + localizedValues['MedicalSubtitle'][locale.languageCode]; String get monthly => localizedValues['Monthly'][locale.languageCode]; - String get monthlySubtitle => localizedValues['MonthlySubtitle'][locale.languageCode]; + String get monthlySubtitle => + localizedValues['MonthlySubtitle'][locale.languageCode]; String get sick => localizedValues['Sick'][locale.languageCode]; - String get sickSubtitle => localizedValues['SickSubtitle'][locale.languageCode]; + String get sickSubtitle => + localizedValues['SickSubtitle'][locale.languageCode]; String get myBalance => localizedValues['MyBalance'][locale.languageCode]; String get myBalanceSubtitle => localizedValues['MyBalanceSubtitle'][locale.languageCode]; @@ -608,82 +673,229 @@ class TranslationBase { localizedValues['ServiceInformationButton'][locale.languageCode]; String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; + String get infoLab => localizedValues['info-lab'][locale.languageCode]; + String get infoRadiology => + localizedValues['info-radiology'][locale.languageCode]; + String get orders => localizedValues['orders'][locale.languageCode]; + String get lakum => localizedValues['lakum'][locale.languageCode]; + String get wishlist => localizedValues['wishlist'][locale.languageCode]; + String get reviews => localizedValues['reviews'][locale.languageCode]; + String get myPrescriptions => + localizedValues['myPrescriptions'][locale.languageCode]; + String get medicationRefill => + localizedValues['medicationRefill'][locale.languageCode]; + String get pillReminder => + localizedValues['pillReminder'][locale.languageCode]; + String get shippingAddresses => + localizedValues['shippingAddresses'][locale.languageCode]; + String get reachUs => localizedValues['reachUs'][locale.languageCode]; + String get ourLocations => + localizedValues['ourLocations'][locale.languageCode]; + String get edit => localizedValues['edit'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; + String get addAddress => localizedValues['addAddress'][locale.languageCode]; + String get addNewAddress => + localizedValues['addNewAddress'][locale.languageCode]; + String get order => localizedValues['order'][locale.languageCode]; + String get delivered => localizedValues['delivered'][locale.languageCode]; + String get processing => localizedValues['processing'][locale.languageCode]; + String get pending => localizedValues['pending'][locale.languageCode]; + String get cancelled => localizedValues['cancelled'][locale.languageCode]; + String get writeReview => localizedValues['writeReview'][locale.languageCode]; + String get shareReview => localizedValues['shareReview'][locale.languageCode]; + String get backMyAccount => + localizedValues['backMyAccount'][locale.languageCode]; + String get reviewSuccessful => + localizedValues['reviewSuccessful'][locale.languageCode]; + String get reviewShared => + localizedValues['reviewShared'][locale.languageCode]; + String get reviewComment => + localizedValues['reviewComment'][locale.languageCode]; + String get shippedMethod => + localizedValues['shippedMethod'][locale.languageCode]; + String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; + String get subtotal => localizedValues['subtotal'][locale.languageCode]; + String get shipping => localizedValues['shipping'][locale.languageCode]; + String get shipBy => localizedValues['shipBy'][locale.languageCode]; + String get lakumPoints => localizedValues['lakumPoints'][locale.languageCode]; + String get use => localizedValues['use'][locale.languageCode]; + String get proceedPay => localizedValues['proceedPay'][locale.languageCode]; + String get vat => localizedValues['vat'][locale.languageCode]; + String get inclusiveVat => localizedValues['inclusiveVat'][locale.languageCode]; + String get items => localizedValues['items'][locale.languageCode]; + String get checkOut => localizedValues['checkOut'][locale.languageCode]; + String get total => localizedValues['total'][locale.languageCode]; + String get sar => localizedValues['sar'][locale.languageCode]; + String get payOnline => localizedValues['payOnline'][locale.languageCode]; + String get cancelOrder => localizedValues['cancelOrder'][locale.languageCode]; + String get confirmAddress => + localizedValues['confirmAddress'][locale.languageCode]; + String get confirmLocation => + localizedValues['confirmLocation'][locale.languageCode]; + String get confirmDeleteMsg => + localizedValues['confirmDeleteMsg'][locale.languageCode]; + String get confirmDelete => + localizedValues['confirmDelete'][locale.languageCode]; + String get confirmCancellation => + localizedValues['confirmCancellation'][locale.languageCode]; String get serviceInformation => 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 => localizedValues['LoginRegister'][locale.languageCode]; String get orderLog => localizedValues['OrderLog'][locale.languageCode]; - String get infoLab => localizedValues['info-lab'][locale.languageCode]; - String get infoRadiology => - localizedValues['info-radiology'][locale.languageCode]; + // String get infoLab => localizedValues['info-lab'][locale.languageCode]; + // String get infoRadiology => + + String get orderNumber => localizedValues['orderNumber'][locale.languageCode]; + String get orderDate => localizedValues['orderDate'][locale.languageCode]; + String get itemsNo => localizedValues['itemsNo'][locale.languageCode]; + String get noOrder => localizedValues['noOrder'][locale.languageCode]; + String get review => localizedValues['review'][locale.languageCode]; + String get deliveredOrder => localizedValues['deliveredOrder'][locale.languageCode]; + String get pendingOrder => localizedValues['pendingOrder'][locale.languageCode]; + String get processingOrder => localizedValues['processingOrder'][locale.languageCode]; + String get cancelledOrder => localizedValues['cancelledOrder'][locale.languageCode]; + String get compare => localizedValues['compare'][locale.languageCode]; + String get medicationsRefill => localizedValues['medicationsRefill'][locale.languageCode]; + String get myPrescription => localizedValues['myPrescription'][locale.languageCode]; + String get quantity => localizedValues['quantity'][locale.languageCode]; + String get conditionsHMG => localizedValues['conditionsHMG'][locale.languageCode]; + String get conditions => localizedValues['conditions'][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 offersAndPromotions => + localizedValues['offersAndPromotions'][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 selectAddress => + localizedValues['selectAddress'][locale.languageCode]; + String get shippingAddress => + localizedValues['shippingAddress'][locale.languageCode]; + String get changeAddress => + localizedValues['changeAddress'][locale.languageCode]; + String get selectPaymentOption => + localizedValues['selectPaymentOption'][locale.languageCode]; + String get changeMethod => + localizedValues['changeMethod'][locale.languageCode]; + String get reviewOrder => localizedValues['reviewOrder'][locale.languageCode]; + String get orderSummary => + localizedValues['orderSummary'][locale.languageCode]; + String get active => localizedValues['active'][locale.languageCode]; + String get inactive => localizedValues['inactive'][locale.languageCode]; + String get balance => localizedValues['balance'][locale.languageCode]; + String get gained => localizedValues['gained'][locale.languageCode]; + String get consumed => localizedValues['consumed'][locale.languageCode]; + String get transferred => localizedValues['transferred'][locale.languageCode]; + String get checkBeneficiary => + localizedValues['checkBeneficiary'][locale.languageCode]; + String get beneficiaryName => + localizedValues['beneficiaryName'][locale.languageCode]; + String get accountActivation => + localizedValues['accountActivation'][locale.languageCode]; + String get acceptLbl => localizedValues['acceptLbl'][locale.languageCode]; + + String get termsService => + localizedValues['TermsService'][locale.languageCode]; String get beforeUsing => localizedValues['Beforeusing'][locale.languageCode]; String get accept => localizedValues['accept'][locale.languageCode]; - String get dataSafeInfo => localizedValues['data-safe-info'][locale.languageCode]; + String get dataSafeInfo => + localizedValues['data-safe-info'][locale.languageCode]; String get dataSafe => localizedValues['data-safe'][locale.languageCode]; - String get informational => localizedValues['informational'][locale.languageCode]; - String get checkDiagnosis => localizedValues['check-diagnosis'][locale.languageCode]; + String get informational => + localizedValues['informational'][locale.languageCode]; + String get checkDiagnosis => + localizedValues['check-diagnosis'][locale.languageCode]; String get remeberthat => localizedValues['remeberthat'][locale.languageCode]; - String get notUseInEmbergency => localizedValues['not-use-in-emerbency'][locale.languageCode]; - String get notUseInEmbergencyDetails => localizedValues['not-use-in-emerbency-details'][locale.languageCode]; - String get notUseInEmbergencyCall => localizedValues['not-use-in-emerbency-details-call'][locale.languageCode]; - String get selectGender => localizedValues['select-gender'][locale.languageCode]; + String get notUseInEmbergency => + localizedValues['not-use-in-emerbency'][locale.languageCode]; + String get notUseInEmbergencyDetails => + localizedValues['not-use-in-emerbency-details'][locale.languageCode]; + String get notUseInEmbergencyCall => + localizedValues['not-use-in-emerbency-details-call'][locale.languageCode]; + String get selectGender => + localizedValues['select-gender'][locale.languageCode]; String get iAma => localizedValues['i-am-a'][locale.languageCode]; String get selectAge => localizedValues['select-age'][locale.languageCode]; String get iAm => localizedValues['i-am'][locale.languageCode]; String get yearOld => localizedValues['years-old'][locale.languageCode]; + String get categorise => localizedValues['categorise'][locale.languageCode]; + String get cart => localizedValues['cart'][locale.languageCode]; + String get wishList => localizedValues['wishList'][locale.languageCode]; + String get searchProductHere => + localizedValues['searchProductHere'][locale.languageCode]; String get email => localizedValues['email'][locale.languageCode]; String get book => localizedValues['Book'][locale.languageCode]; - String get appointmentLabel => localizedValues['AppointmentLabel'][locale.languageCode]; + String get appointmentLabel => + localizedValues['AppointmentLabel'][locale.languageCode]; String get bloodType => localizedValues['BloodType'][locale.languageCode]; - String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode]; - String get maritalStatus => localizedValues['marital-status'][locale.languageCode]; + String get loginToUseService => + localizedValues['loginToUseService'][locale.languageCode]; + String get maritalStatus => + localizedValues['marital-status'][locale.languageCode]; String get general => localizedValues['general'][locale.languageCode]; String get profile => localizedValues['profile'][locale.languageCode]; - String get notifications => localizedValues['notifications'][locale.languageCode]; - String get notificationDetails => localizedValues['notificationDetails'][locale.languageCode]; - List get infoMyDoctorPoints => localizedValues['info-my-doctor-points'][locale.languageCode]; - String get infoMyDoctor => localizedValues['info-my-doctor'][locale.languageCode]; - String get infoPrescriptions => localizedValues['info-prescriptions'][locale.languageCode]; - List get infoPrescriptionsPoints => localizedValues['info-my-prescription-points'][locale.languageCode]; - - String get infoInsuranceCards => localizedValues['info-insurance-cards'][locale.languageCode]; - List get infoInsuranceCardsPoints => localizedValues['info-insurance-cards-points'][locale.languageCode]; - - String get infoAllergies => localizedValues['info-allergies'][locale.languageCode]; + String get notifications => + localizedValues['notifications'][locale.languageCode]; + String get notificationDetails => + localizedValues['notificationDetails'][locale.languageCode]; + List get infoMyDoctorPoints => + localizedValues['info-my-doctor-points'][locale.languageCode]; + String get infoMyDoctor => + localizedValues['info-my-doctor'][locale.languageCode]; + String get infoPrescriptions => + localizedValues['info-prescriptions'][locale.languageCode]; + List get infoPrescriptionsPoints => + localizedValues['info-my-prescription-points'][locale.languageCode]; + + String get infoInsuranceCards => + localizedValues['info-insurance-cards'][locale.languageCode]; + List get infoInsuranceCardsPoints => + localizedValues['info-insurance-cards-points'][locale.languageCode]; + + String get infoAllergies => + localizedValues['info-allergies'][locale.languageCode]; String get sickLeaves => localizedValues['sick-leaves'][locale.languageCode]; - String get infoSickLeaves => localizedValues['info-sick-leaves'][locale.languageCode]; - List get infoSickLeavePoints => localizedValues['info-sick-leave-points'][locale.languageCode]; - - String get infoApprovals => localizedValues['info-approvals'][locale.languageCode]; - List get infoApprovalPoints => localizedValues['info-approval-points'][locale.languageCode]; - - String get monthReport => localizedValues['month-report'][locale.languageCode]; - String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; - String get languageSetting => localizedValues['language-setting'][locale.languageCode]; + String get infoSickLeaves => + localizedValues['info-sick-leaves'][locale.languageCode]; + List get infoSickLeavePoints => + localizedValues['info-sick-leave-points'][locale.languageCode]; + + String get infoApprovals => + localizedValues['info-approvals'][locale.languageCode]; + List get infoApprovalPoints => + localizedValues['info-approval-points'][locale.languageCode]; + + String get monthReport => + localizedValues['month-report'][locale.languageCode]; + String get infoMonthReport => + localizedValues['info-month-report'][locale.languageCode]; + String get languageSetting => + localizedValues['language-setting'][locale.languageCode]; String get alert => localizedValues['alert'][locale.languageCode]; String get emailAlert => localizedValues['email-alert'][locale.languageCode]; String get smsAlert => localizedValues['sms-alert'][locale.languageCode]; - String get contactInfo => localizedValues['contact-info'][locale.languageCode]; + String get contactInfo => + localizedValues['contact-info'][locale.languageCode]; String get emergencyName => localizedValues['emrg-name'][locale.languageCode]; - String get emergencyContact => localizedValues['emrg-no'][locale.languageCode]; + String get emergencyContact => + localizedValues['emrg-no'][locale.languageCode]; String get modes => localizedValues['modes'][locale.languageCode]; String get vibration => localizedValues['vibration'][locale.languageCode]; String get blindMode => localizedValues['blind-modes'][locale.languageCode]; @@ -694,14 +906,16 @@ class TranslationBase { String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; String get permissions => localizedValues['permissions'][locale.languageCode]; - String get cameraPermission => localizedValues['camera-permission'][locale.languageCode]; - String get locationPermission => localizedValues['location-permission'][locale.languageCode]; - String get accessibility => localizedValues['accessibility'][locale.languageCode]; - String get selectClinic => localizedValues['selectClinic'][locale.languageCode]; - String get reviews => localizedValues['reviews'][locale.languageCode]; + String get cameraPermission => + localizedValues['camera-permission'][locale.languageCode]; + String get locationPermission => + localizedValues['location-permission'][locale.languageCode]; + String get accessibility => + localizedValues['accessibility'][locale.languageCode]; + String get selectClinic => + localizedValues['selectClinic'][locale.languageCode]; String get orderStatus => localizedValues['orderStatus'][locale.languageCode]; - String get cancelOrder => localizedValues['CancelOrder'][locale.languageCode]; String get findUs => localizedValues['FindUs'][locale.languageCode]; String get feedback => localizedValues['Feedback'][locale.languageCode]; String get liveChat => localizedValues['LiveChat'][locale.languageCode]; @@ -801,7 +1015,6 @@ class TranslationBase { localizedValues['info-ambulance'][locale.languageCode]; String get transportHeading => localizedValues['RRT-transport-heading'][locale.languageCode]; - String get sar => localizedValues['sar'][locale.languageCode]; String get directionHeading => localizedValues['RRT-direction-heading'][locale.languageCode]; String get toHospital => localizedValues['to-hospital'][locale.languageCode]; @@ -884,7 +1097,6 @@ class TranslationBase { String get requested => localizedValues['requested'][locale.languageCode]; String get ready => localizedValues['ready'][locale.languageCode]; String get completed => localizedValues['completed'][locale.languageCode]; - String get cancelled => localizedValues['cancelled'][locale.languageCode]; String get requestMedicalReport => localizedValues['request-medical-report'][locale.languageCode]; String get insurCards => localizedValues['insur-cards'][locale.languageCode]; @@ -959,6 +1171,79 @@ class TranslationBase { String get attachInsuraceImage => localizedValues['attach-insurace-image'][locale.languageCode]; String get infoInsurCards => localizedValues['info-insur-cards'][locale.languageCode]; String get scanNow => localizedValues['scan-now'][locale.languageCode]; + String get pharmacyServiceTermsCondition => localizedValues['pharmacyServiceTermsCondition'][locale.languageCode]; + + String get referralStatus => + localizedValues['referralStatus'][locale.languageCode]; + String get referralDate => + localizedValues['referralDate'][locale.languageCode]; + String get patientName => localizedValues['patientName'][locale.languageCode]; + String get referralNumber => + localizedValues['referralNumber'][locale.languageCode]; + + String get requestID => localizedValues['requestID'][locale.languageCode]; + String get OrderStatus => localizedValues['OrderStatus'][locale.languageCode]; + String get pickupDate => localizedValues['pickupDate'][locale.languageCode]; + String get serviceName => localizedValues['serviceName'][locale.languageCode]; + String get orderLocation => + localizedValues['orderLocation'][locale.languageCode]; + String get selectService => + localizedValues['selectService'][locale.languageCode]; + String get coveredService => + localizedValues['coveredService'][locale.languageCode]; + String get selectedService => + localizedValues['selectedService'][locale.languageCode]; + String get cancelOrderMsg => + localizedValues['cancelOrderMsg'][locale.languageCode]; + String get processDoneSuccessfully => + localizedValues['processDoneSuccessfully'][locale.languageCode]; + String get selectHomeHealthCareServices => + localizedValues['selectHomeHealthCareServices'][locale.languageCode]; + + String get topBrands => localizedValues['topBrands'][locale.languageCode]; + String get notifyMe => localizedValues['notifyMe'][locale.languageCode]; + String get specification => localizedValues['specification'][locale.languageCode]; + String get availability => localizedValues['availability'][locale.languageCode]; + String get quantitySize => localizedValues['quantitySize'][locale.languageCode]; + String get addToCart => localizedValues['addToCart'][locale.languageCode]; + String get buyNow => localizedValues['buyNow'][locale.languageCode]; + String get quantityShortcut => localizedValues['quantityShortcut'][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 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]; + String get year => localizedValues['Year'][locale.languageCode]; + String get month => localizedValues['Month'][locale.languageCode]; + String get point => localizedValues['point'][locale.languageCode]; + String get riyal => localizedValues['riyal'][locale.languageCode]; + String get termOfService => + localizedValues['termOfService'][locale.languageCode]; + String get shoppingCart => + localizedValues['shoppingCart'][locale.languageCode]; + } diff --git a/lib/widgets/Loader/gif_loader_container.dart b/lib/widgets/Loader/gif_loader_container.dart index 06c151c9..b7a20339 100644 --- a/lib/widgets/Loader/gif_loader_container.dart +++ b/lib/widgets/Loader/gif_loader_container.dart @@ -36,7 +36,7 @@ class _GifLoaderContainerState extends State child: GifImage( controller: controller1, image: AssetImage( - "assets/images/progress-loading.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), ), )); } diff --git a/lib/widgets/buttons/borderedButton.dart b/lib/widgets/buttons/borderedButton.dart index 5e05448e..b0bbdaf0 100644 --- a/lib/widgets/buttons/borderedButton.dart +++ b/lib/widgets/buttons/borderedButton.dart @@ -4,55 +4,91 @@ import 'package:flutter/material.dart'; class BorderedButton extends StatelessWidget { final String text; final Function handler; - final Color color; + final Color textColor; final bool hasBorder; final Color borderColor; final Color backgroundColor; final double vPadding; final double hPadding; + final double radius; + final double lPadding; + final double tPadding; + final double rPadding; + final double bPadding; + final double fontSize; + final Widget icon; + final FontWeight fontWeight; + final bool hasShadow; BorderedButton( this.text, { this.handler, - this.color, + this.textColor, this.hasBorder = false, this.borderColor, this.backgroundColor, this.vPadding = 0, this.hPadding = 0, + this.radius = 4.0, + this.lPadding = 4.0, + this.tPadding = 0.0, + this.rPadding = 4.0, + this.bPadding = 0.0, + this.fontSize = 0, + this.icon, + this.fontWeight, + this.hasShadow = false, }); @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), + return GestureDetector( + onTap: () { + handler(); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: backgroundColor ?? Colors.white, + borderRadius: BorderRadius.circular(radius), + border: Border.fromBorderSide(BorderSide( + color: hasBorder ? borderColor : Colors.white, + width: 0.8, + )), + boxShadow: [ + BoxShadow( + color: !hasShadow ? Colors.transparent : Colors.grey.withOpacity(0.5), + // spreadRadius: 5, + blurRadius: 15.0, + offset: Offset(0.0, 0.75) // changes position of shadow + ), + ]), + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + icon != null ? icon : Container(), + Container( + padding: (hPadding > 0 || vPadding > 0) + ? EdgeInsets.symmetric( + vertical: vPadding, horizontal: hPadding) + : EdgeInsets.fromLTRB( + lPadding, tPadding, rPadding, bPadding), + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: fontSize == 0 + ? SizeConfig.textMultiplier * 1.6 + : fontSize, + fontWeight: + fontWeight != null ? fontWeight : FontWeight.normal, + color: textColor ?? Color(0xffc4aa54)), + ), + ), + ], ), - ), //your original button + ), ), ); } diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart index 8f1192a5..02b208ad 100644 --- a/lib/widgets/dialogs/confirm_dialog.dart +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; class ConfirmDialog { final BuildContext context; + final title; final confirmMessage; final okText; final cancelText; @@ -14,6 +15,7 @@ class ConfirmDialog { ConfirmDialog( {@required this.context, + this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, @@ -31,7 +33,7 @@ class ConfirmDialog { // set up the AlertDialog AlertDialog alert = AlertDialog( - title: Text(TranslationBase.of(context).confirm), + title: title != null ? Text(title) : Text(TranslationBase.of(context).confirm), content: Text(this.confirmMessage), actions: [ cancelButton, diff --git a/lib/widgets/dialogs/radio-group-dialog.dart b/lib/widgets/dialogs/radio-group-dialog.dart new file mode 100644 index 00000000..5eff11bd --- /dev/null +++ b/lib/widgets/dialogs/radio-group-dialog.dart @@ -0,0 +1,101 @@ +import 'package:diplomaticquarterapp/models/id-name-pair.dart'; +import 'package:flutter/material.dart'; + +// AppToast.showErrorToast(message: "Please select Time Slot to continue"); + +class RadioGroupDialog extends StatefulWidget { + + final BuildContext context; + final title; + final List list; + final okText; + final cancelText; + final Function(IdNamePair) okFunction; + final Function cancelFunction; + IdNamePair selectedValue; + + RadioGroupDialog( + {@required this.context, + @required this.title, + @required this.list, + @required this.okText, + @required this.cancelText, + @required this.okFunction, + @required this.cancelFunction}); + + + @override + RadioGroupState createState() => RadioGroupState(); +} + +class RadioGroupState extends State { + + @override + void initState() { + super.initState(); + widget.selectedValue = widget.selectedValue ?? widget.list[0]; + } + + @override + Widget build(BuildContext context) { + return showAlertDialog(context); + } + + showAlertDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = FlatButton( + child: Text(this.widget.cancelText), + onPressed: () { + Navigator.of(context).pop(); + }); + Widget continueButton = + FlatButton(child: Text(this.widget.okText), onPressed: () { + this.widget.okFunction(widget.selectedValue); + Navigator.of(context).pop(); + }); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: Text(widget.title), + content: createDialogGroup(), + actions: [ + cancelButton, + continueButton, + ], + ); + return alert; + } + + static closeAlertDialog(BuildContext context) { + Navigator.of(context).pop(); + } + + Widget createDialogGroup(){ + return Container( + height: MediaQuery.of(context).size.height * 0.3, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + child: Column( + children: + widget.list.map((data) => RadioListTile( + title: Text("${data.name}"), + groupValue: widget.selectedValue.id, + value: data.id, + onChanged: (val) { + setState(() { + widget.selectedValue = data ; + }); + }, + )).toList(), + ), + ), + + ], + ), + ), + ); + } + +} diff --git a/lib/widgets/others/app_scaffold_pharmacy_widget.dart b/lib/widgets/others/app_scaffold_pharmacy_widget.dart new file mode 100644 index 00000000..e92ff17a --- /dev/null +++ b/lib/widgets/others/app_scaffold_pharmacy_widget.dart @@ -0,0 +1,114 @@ +import 'package:diplomaticquarterapp/config/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'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart'; +import 'package:diplomaticquarterapp/widgets/robo-search/search.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +import '../../locator.dart'; +import 'floating_button_search.dart'; +import '../progress_indicator/app_loader_widget.dart'; +import 'arrow_back.dart'; +import 'network_base_view.dart'; +import 'not_auh_page.dart'; + +class PharmacyAppScaffold extends StatelessWidget { + final String appBarTitle; + final Widget body; + final Widget bottomSheet; + final bool isLoading; + final bool isShowAppBar; + final bool hasAppBarParam; + final BaseViewModel baseViewModel; + final bool isBottomBar; + final Widget floatingActionButton; + final String title; + final String description; + final bool isShowDecPage; + final Color backgroundColor; + + AuthenticatedUserObject authenticatedUserObject = + locator(); + + PharmacyAppScaffold( + {@required this.body, + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = false, + this.hasAppBarParam, + this.bottomSheet, + this.baseViewModel, + this.floatingActionButton, + this.title, + this.description, + this.isShowDecPage = true, + this.isBottomBar, + this.backgroundColor}); + + @override + Widget build(BuildContext context) { + AppGlobal.context = context; + + return Scaffold( + backgroundColor: + backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + appBar: isShowAppBar + ? AppBar( + elevation: 0, + backgroundColor: Color(0xff5AB145), + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(authenticatedUserObject.isLogin + ? appBarTitle.toUpperCase() + : TranslationBase.of(context).serviceInformationTitle), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); + }, + ), + centerTitle: true, + actions: [], + ) + : null, + body: (!authenticatedUserObject.isLogin && isShowDecPage) + ? NotAutPage( + title: appBarTitle, + description: description, + ) + : baseViewModel != null + ? NetworkBaseView( + child: buildBodyWidget(), + baseViewModel: baseViewModel, + ) + : buildBodyWidget(), + bottomSheet: bottomSheet, + floatingActionButton: floatingActionButton ?? floatingActionButton, + // bottomNavigationBar: + // this.isBottomBar == true ? BottomBarSearch() : SizedBox() + // floatingActionButton: FloatingSearchButton(), + ); + } + + buildAppLoaderWidget(bool isLoading) { + return isLoading ? AppLoaderWidget() : Container(); + } + + buildBodyWidget() { + // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); + return Stack(children: [ + body, /*FloatingSearchButton()*/ + ]); + } +} diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index c3fbe3a1..2e831963 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,20 +1,32 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.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'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart'; +import 'package:diplomaticquarterapp/widgets/robo-search/search.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import '../../locator.dart'; +import 'floating_button_search.dart'; +import '../progress_indicator/app_loader_widget.dart'; import 'arrow_back.dart'; import 'network_base_view.dart'; import 'not_auh_page.dart'; -// ignore: must_be_immutable class AppScaffold extends StatelessWidget { final String appBarTitle; final Widget body; @@ -25,94 +37,170 @@ class AppScaffold extends StatelessWidget { final BaseViewModel baseViewModel; final bool isBottomBar; final Widget floatingActionButton; + final bool isPharmacy; final String title; final String description; + final String image; final bool isShowDecPage; - final Color backgroundColor; final List infoList; + final Color backgroundColor; + final double preferredSize; + final List appBarIcons; + final PreferredSizeWidget appBarWidget; final List imagesInfo; + AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); AppScaffold( {@required this.body, - this.appBarTitle = '', - this.isLoading = false, - this.isShowAppBar = false, - this.hasAppBarParam, - this.bottomSheet, - this.baseViewModel, - this.floatingActionButton, - this.title, - this.description, - this.isShowDecPage = true, - this.isBottomBar, - this.infoList, - this.imagesInfo, this.backgroundColor}); + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = false, + this.hasAppBarParam, + this.bottomSheet, + this.baseViewModel, + this.floatingActionButton, + this.isPharmacy = false, + this.title, + this.description, + this.isShowDecPage = true, + this.isBottomBar, + this.backgroundColor, + this.preferredSize = 0.0, + this.appBarIcons, + this.appBarWidget, + this.image, + this.infoList, this.imagesInfo}); @override Widget build(BuildContext context) { AppGlobal.context = context; ProjectViewModel projectViewModel = Provider.of(context); + AppGlobal.context = context; + PreferredSizeWidget appBar; + return Scaffold( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: isShowAppBar - ? AppBar( - elevation: 0, - backgroundColor: Theme.of(context).appBarTheme.color, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text( - authenticatedUserObject.isLogin || !isShowDecPage - ? appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.white, - fontFamily: - projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), - centerTitle: true, - actions: [ - IconButton( - icon: Icon(FontAwesomeIcons.home), - color: Colors.white, - onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => LandingPage()), - (Route r) => false); - }, - ), - ], - ) - : null, + backgroundColor: + backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + appBar: isShowAppBar? AppBarWidget( + appBarTitle, + appBarIcons, + isShowAppBar, + isPharmacy: isPharmacy, + isShowDecPage: isShowDecPage, + image: image, + ):null, body: (!Provider.of(context, listen: false).isLogin && - isShowDecPage) + isShowDecPage) ? NotAutPage( - title: title?? appBarTitle, - description: description, - infoList: infoList, - imagesInfo: imagesInfo, - ) + title: appBarTitle, + description: description, + infoList: infoList, + imagesInfo: imagesInfo, + ) : baseViewModel != null - ? NetworkBaseView( - child: body, - baseViewModel: baseViewModel, - ) - : body, - bottomSheet: - (Provider.of(context, listen: false).isLogin || - !isShowDecPage) - ? bottomSheet - : null, + ? NetworkBaseView( + child: buildBodyWidget(), + baseViewModel: baseViewModel, + ) + : buildBodyWidget(), + bottomSheet: bottomSheet, + //floatingActionButton: floatingActionButton ?? floatingActionButton, + // bottomNavigationBar: + // this.isBottomBar == true ? BottomBarSearch() : SizedBox() + // floatingActionButton: FloatingSearchButton(), ); } + + buildAppLoaderWidget(bool isLoading) { + return isLoading ? AppLoaderWidget() : Container(); + } + + buildBodyWidget() { + // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); + return Stack(children: [ + body, /*FloatingSearchButton()*/ + ]); + } +} + +class AppBarWidget extends StatelessWidget with PreferredSizeWidget { + final AuthenticatedUserObject authenticatedUserObject = + locator(); + + final String appBarTitle; + final List appBarIcons; + final bool isShowAppBar; + final bool isPharmacy; + final bool isShowDecPage; + final String image; + + AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar, + {this.isPharmacy = true, this.isShowDecPage = true, this.image}); + + @override + Widget build(BuildContext context) { + return buildAppBar(context); + } + + Widget buildAppBar(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return isShowAppBar + ? AppBar( + elevation: 0, + backgroundColor: + isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text( + authenticatedUserObject.isLogin || !isShowDecPage + ? appBarTitle.toUpperCase() + : TranslationBase.of(context).serviceInformationTitle, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + fontFamily: + projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); + }, + ), + centerTitle: true, + actions: [ + isPharmacy + ? IconButton( + icon: Icon(Icons.shopping_cart), + color: Colors.white, + onPressed: () { + Navigator.of(context) + .popUntil(ModalRoute.withName('/')); + }) + : Container(), + IconButton( + icon: Icon(FontAwesomeIcons.home), + color: Colors.white, + onPressed: () { + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (context) => LandingPage()), + (Route r) => false); + }, + ), + if (appBarIcons != null) ...appBarIcons + ], + ) + : Container( + height: 0, + width: 0, + ); + } + + @override + Size get preferredSize => Size(double.maxFinite, 60); } diff --git a/lib/widgets/others/app_scafold_detail_page.dart b/lib/widgets/others/app_scafold_detail_page.dart new file mode 100644 index 00000000..ed8bc8a7 --- /dev/null +++ b/lib/widgets/others/app_scafold_detail_page.dart @@ -0,0 +1,241 @@ +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'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart'; +import 'package:diplomaticquarterapp/widgets/robo-search/search.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +import '../../locator.dart'; +import 'floating_button_search.dart'; +import '../progress_indicator/app_loader_widget.dart'; +import 'arrow_back.dart'; +import 'network_base_view.dart'; +import 'not_auh_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; + +class DetailPageScafold extends StatefulWidget { + final String appBarTitle; + final Widget body; + final Widget bottomSheet; + final bool isLoading; + final bool isShowAppBar; + final bool hasAppBarParam; + final BaseViewModel baseViewModel; + final bool isBottomBar; + final Widget floatingActionButton; + final bool isPharmacy; + final String title; + final String description; + final String image; + final bool isShowDecPage; + final List infoList; + final Color backgroundColor; + final double preferredSize; + final List appBarIcons; + final PreferredSizeWidget appBarWidget; + + + DetailPageScafold( + {@required this.body, + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = false, + this.hasAppBarParam, + this.bottomSheet, + this.baseViewModel, + this.floatingActionButton, + this.isPharmacy = false, + this.title, + this.description, + this.isShowDecPage = true, + this.isBottomBar, + this.backgroundColor, + this.preferredSize = 0.0, + this.appBarIcons, + this.appBarWidget, + this.image, + this.infoList}); + + @override + _DetailPageScafoldState createState() => _DetailPageScafoldState(); +} + +class _DetailPageScafoldState extends State { + AuthenticatedUserObject authenticatedUserObject = + locator(); + + @override + Widget build(BuildContext context) { + AppGlobal.context = context; + PreferredSizeWidget appBar; + + if (this.widget.appBarWidget == null) { + PreferredSizeWidget appBarWidget = AppBarWidget( + widget.appBarTitle, + widget.appBarIcons, + widget.isShowAppBar, + isPharmacy: widget.isPharmacy, + isShowDecPage: widget.isShowDecPage, + image: widget.image, + ); + appBar = widget.preferredSize == 0 + ? appBarWidget + : PreferredSize( + child: appBarWidget, + preferredSize: Size.fromHeight(widget.preferredSize)); + } else { + appBar = this.widget.appBarWidget; + } + + return Scaffold( + backgroundColor: + widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + appBar: appBar, + body: (!Provider.of(context, listen: false).isLogin && + widget.isShowDecPage) + ? NotAutPage( + title: widget.appBarTitle, + description: widget.description, + infoList: widget.infoList, + ) + : widget.baseViewModel != null + ? NetworkBaseView( + child: buildBodyWidget(), + baseViewModel: widget.baseViewModel, + ) + : buildBodyWidget(), + bottomSheet: widget.bottomSheet, + //floatingActionButton: floatingActionButton ?? floatingActionButton, + // bottomNavigationBar: + // this.isBottomBar == true ? BottomBarSearch() : SizedBox() + // floatingActionButton: FloatingSearchButton(), + ); + } + + buildAppLoaderWidget(bool isLoading) { + return isLoading ? AppLoaderWidget() : Container(); + } + + buildBodyWidget() { + // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); + return Stack(children: [ + widget.body, /*FloatingSearchButton()*/ + ]); + } +} + +class AppBarWidget extends StatelessWidget with PreferredSizeWidget { + final AuthenticatedUserObject authenticatedUserObject = + locator(); + + final String appBarTitle; + final List appBarIcons; + final bool isShowAppBar; + final bool isPharmacy; + final bool isShowDecPage; + final String image; + + AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar, + {this.isPharmacy = true, this.isShowDecPage = true, this.image}); + + @override + Widget build(BuildContext context) { + return buildAppBar(context); + } + + Widget buildAppBar(BuildContext context) { + return isShowAppBar + ? AppBar( + elevation: 0, + backgroundColor:Colors.white, +// isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Texts( + authenticatedUserObject.isLogin || !isShowDecPage + ? appBarTitle.toUpperCase() + : TranslationBase.of(context).serviceInformationTitle, + color: Colors.white, + bold: true, + ), + leading: Builder( + builder: (BuildContext context) { + return GestureDetector( + + behavior: HitTestBehavior.opaque, + onTap:()=> Navigator.pop(context), + child: Icon(Icons.arrow_back_ios, color: Colors.grey), + ); + }, + ), + centerTitle: true, + actions: [ + isPharmacy + ? IconButton( + icon: Icon(Icons.shopping_cart), + color: Colors.grey, + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => CartOrderPage()), + ); +// Navigator.of(context) +// .popUntil(ModalRoute.withName('/')); + }) + : Container(), + image != null + ? InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: InsuranceUpdate(), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + image, + height: SizeConfig.heightMultiplier * 5, + width: SizeConfig.heightMultiplier * 5, + color: Colors.grey, + ), + ), + ) + : IconButton( + icon: Icon(FontAwesomeIcons.ellipsisV), + color: Colors.grey, + onPressed: () { + settingModalBottomSheet(context); + }, + ), + if (appBarIcons != null) ...appBarIcons + ], + ) + : Container( + height: 0, + width: 0, + ); + } + + @override + Size get preferredSize => Size(double.maxFinite, 60); +} + + diff --git a/lib/widgets/others/points-expandable-notifier.dart b/lib/widgets/others/points-expandable-notifier.dart new file mode 100644 index 00000000..5f969765 --- /dev/null +++ b/lib/widgets/others/points-expandable-notifier.dart @@ -0,0 +1,77 @@ +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; + +class PointsExpandableNotifier extends StatefulWidget { + final Widget headerWidget; + final Widget bodyWidget; + final Widget collapsed; + final bool isExpand; + bool expandFlag = false; + var controller = new ExpandableController(); + + PointsExpandableNotifier( + {this.headerWidget, this.bodyWidget, this.collapsed, this.isExpand}); + + @override + _PointsExpandableNotifierState createState() => + _PointsExpandableNotifierState(); +} + +class _PointsExpandableNotifierState extends State { + @override + Widget build(BuildContext context) { + setState(() { + if (widget.isExpand == true) { + widget.expandFlag = widget.isExpand; + widget.controller.expanded = true; + } + }); + + return ExpandableNotifier( + child: Padding( + padding: const EdgeInsets.only(left: 0, right: 0), + child: Column( + children: [ + SizedBox( + child: widget.headerWidget, + ), + ScrollOnExpand( + scrollOnExpand: true, + scrollOnCollapse: false, + child: ExpandablePanel( + theme: const ExpandableThemeData( + headerAlignment: ExpandablePanelHeaderAlignment.center, + tapBodyToCollapse: true, + ), + // header: widget.headerWidget, + /* + // setState(() { + // widget.expandFlag = !widget.expandFlag; + // if (widget.expandFlag == true) { + // widget.controller.expanded = true; + // } else { + // widget.controller.expanded = false; + // } + // }); + */ + collapsed: Container(), + expanded: widget.bodyWidget, + builder: (_, collapsed, expanded) { + return Padding( + padding: EdgeInsets.only(left: 0, right: 0, bottom: 0), + child: Expandable( + controller: widget.controller, + collapsed: collapsed, + expanded: expanded, + theme: const ExpandableThemeData(crossFadePoint: 0), + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart new file mode 100644 index 00000000..d9717c38 --- /dev/null +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart @@ -0,0 +1,108 @@ +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; + +import 'bottom_nav_pharmacy_home_item.dart'; +import 'bottom_nav_pharmacy_item.dart'; + +class BottomNavPharmacyBar extends StatefulWidget { + final ValueChanged changeIndex; + final int index; + BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) + : super(key: key); + + @override + _BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState(); +} + +class _BottomNavPharmacyBarState extends State { + int _index = 0; + + _changeIndex(int index) { + widget.changeIndex(index); + } + + @override + Widget build(BuildContext context) { + return BottomAppBar( + elevation: 4, + shape: CircularNotchedRectangle(), + color: Colors.white, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + BottomNavHomeItem( + icon: EvaIcons.image, + activeIcon: EvaIcons.image, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 0, + ), + + Container( + height: 65.0, + child: Center( + child: VerticalDivider( + color: Colors.grey, + thickness: 0.5, + width: 0.3, + indent: 25.5, + ), + ), + ), + + BottomNavPharmacyItem( + icon: EvaIcons.list, + activeIcon: EvaIcons.list, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 1, + title: TranslationBase.of(context).categorise, + ), +// Expanded( +// child: SizedBox( +// height: 50, +// child: Column( +// mainAxisSize: MainAxisSize.min, +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// SizedBox(height: 22), +// ], +// ), +// ), +// ), + + // Added Calendar Icon to access book appointment flow + BottomNavPharmacyItem( + icon: EvaIcons.heart, + activeIcon: EvaIcons.heart, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 2, + title: TranslationBase.of(context).wishList), + + BottomNavPharmacyItem( + icon: EvaIcons.person, + activeIcon: EvaIcons.person, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 3, + title: TranslationBase.of(context).myAccount, + ), + BottomNavPharmacyItem( + icon: EvaIcons.shoppingCart, + activeIcon: EvaIcons.shoppingCart, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 4, + title: TranslationBase.of(context).cart) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart new file mode 100644 index 00000000..c5c3519b --- /dev/null +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart @@ -0,0 +1,74 @@ +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class BottomNavHomeItem extends StatelessWidget { + final IconData icon; + final Image image; + + final ValueChanged changeIndex; + final int index; + final int currentIndex; + final Function onTap; + final IconData activeIcon; + + BottomNavHomeItem( + {this.icon, + this.changeIndex, + this.index, + this.currentIndex, + this.activeIcon, + this.onTap, + this.image}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SizedBox( + // height: 72.0, + child: Material( + type: MaterialType.transparency, + child: InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + onTap: () => { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + ), + }, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 15, + ), + currentIndex == index + ? Divider( + // color: Color(0xff5AB145), + thickness: 0.5, + ) + : Divider( + thickness: 0, + ), + Container( + child: Image.asset( + 'assets/images/habib-logo.png', + height: 35.0, + ), + ), + SizedBox( + height: 11, + ), + + // Added TextAlign Property + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart new file mode 100644 index 00000000..9d46e2eb --- /dev/null +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -0,0 +1,76 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class BottomNavPharmacyItem extends StatelessWidget { + final String title; + final IconData icon; + + final ValueChanged changeIndex; + final int index; + final int currentIndex; + final Function onTap; + + final IconData activeIcon; + BottomNavPharmacyItem( + {this.icon, + this.changeIndex, + this.index, + this.currentIndex, + this.activeIcon, + this.title, + this.onTap}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SizedBox( + // height: 72.0, + child: Material( + type: MaterialType.transparency, + child: InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + onTap: () => changeIndex(currentIndex), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 15, + ), + currentIndex == index + ? Divider( + color: Color(0xff5AB145), + thickness: 3.5, + ) + : Divider( + thickness: 0, + ), + Container( + child: Icon(currentIndex == index ? activeIcon : icon, + color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).primaryColor, + size: 22.0), + ), + SizedBox( + height: 11, + ), + + // Added TextAlign Property + Texts( + title, + textAlign: TextAlign.center, + color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).primaryColor, + fontSize: 11, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/drug_item.dart b/lib/widgets/pharmacy/drug_item.dart index d1e98ecf..b50f825a 100644 --- a/lib/widgets/pharmacy/drug_item.dart +++ b/lib/widgets/pharmacy/drug_item.dart @@ -38,23 +38,28 @@ class _MedicineItemWidgetState extends State { children: [ if (widget.url != null) Container( - + height: 39.0, + width: 39.0, child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(7)), child: Image.memory( dataFromBase64String(widget.url), - height: SizeConfig.imageSizeMultiplier * 19, - width: SizeConfig.imageSizeMultiplier * 18, + height: SizeConfig.imageSizeMultiplier * 11, + width: SizeConfig.imageSizeMultiplier * 11, fit: BoxFit.cover, ), ), ), - SizedBox(width: 10,), Expanded( child: Center( - child: Texts( - widget.label, - fontSize: 13, + child: Padding( + padding: EdgeInsets.all(2.5), + child: Align( + alignment: Alignment.centerLeft, + child: Texts( + widget.label, + ), + ), ), ), ) diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart new file mode 100644 index 00000000..169decb0 --- /dev/null +++ b/lib/widgets/pharmacy/product_tile.dart @@ -0,0 +1,312 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/src/widgets/image.dart' as flutterImage; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class productTile extends StatelessWidget { + final String productName; + final String productPrice; + final double productRate; + final int productReviews; + final String qyt; + final String totalPrice; + final bool isOrderDetails; + final String productImage; + final bool showLine; + final String img; + final String imgs; + final int status; + final Product product; + final dynamic productID; + + productTile( + {this.productName, + this.productPrice, + this.productRate, + this.productReviews, + this.qyt, + this.totalPrice, + this.isOrderDetails = false, + this.productImage, + this.showLine = true, + this.img, + this.imgs, + this.status, + this.product, + this.productID, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 180, + width: double.infinity, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: [ + this.imgs != null && this.imgs.length > 0 + ? Container( + margin: EdgeInsets.only(left: 10), + child: Image.network( + imgs, +// productImage.trim(), + fit: BoxFit.cover, + width: 80, + height: 80, + ), + ) + : Container( + margin: EdgeInsets.only(left: 10), + child: Image.asset( + "assets/images/no_image.png", + width: 80, + height: 80, + ) +// fit: BoxFit.cover, + ), + Expanded( + flex: 5, + child: Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: productName, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: 'SAR $productPrice', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + this.isOrderDetails == false + ? Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: productRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ) + : Container(), + ], + ), + ), + this.isOrderDetails == false + ? Expanded( + flex: 1, + child: Column( + children: [ + IconButton( + icon: Icon( + FontAwesomeIcons.trashAlt, + size: 15 + ), + onPressed: (){ + deleteFromWishlistFunction(productID); + }, + ), + SizedBox( + height: 50, + ), + IconButton( + icon: Icon( + FontAwesomeIcons.shoppingCart, + size: 15 + ), + onPressed: () async{ + await addToCartFunction(1, productID); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartOrderPage()), + ); + }, + ), + ], + ), + ) + : Container(), + ], + ), + this.isOrderDetails == true + ? Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + margin: EdgeInsets.only(bottom: 5.0), + child: RichText( + text: TextSpan( + text: TranslationBase.of(context).quantity + + "" + + '$qyt', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), + ), + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + TranslationBase.of(context).total, + style: TextStyle( + color: Colors.grey, + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + RichText( + text: TextSpan( + text: ' $totalPrice SAR', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 15), + ), + ), + ], + ), + ], + ), + ], + ), + ) + : Container(), +// this.isOrderDetails == true && model.order[0].orderStatusId == 30? + + if (status == 30 && this.isOrderDetails == true) + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( +// margin: EdgeInsets.all(5.0), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: productRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Container( +// margin: EdgeInsets.all(5), + child: Align( +// alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: '($productReviews reviews)', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), + ), + ), + ), + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + ProductReviewPage(product))); + }, + child: Container( + padding: + EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), + height: 30.0, + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange, + style: BorderStyle.solid, + width: 1.0), + color: Colors.transparent, + borderRadius: BorderRadius.circular(5.0)), + child: Text( + TranslationBase.of(context).writeReview, + style: TextStyle( + fontSize: 12, + color: Colors.orange, + ), + ), + ), + ), + ], + ), + ), + /*Container( + + ),*/ + ], + ), + ); + } + deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.deletWishlistData(itemID); + } + + + addToCartFunction(quantity, itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.addToCartData(quantity, itemID); + + } +} + + diff --git a/lib/widgets/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart index d8c93441..563de5d7 100644 --- a/lib/widgets/pickupLocation/PickupLocationFromMap.dart +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/close_back.dart'; import 'package:flutter/cupertino.dart'; @@ -13,24 +14,36 @@ class PickupLocationFromMap extends StatelessWidget { final Function(PickResult) onPick; final double latitude; final double longitude; + final bool isWithAppBar; + final String buttonLabel; + final Color buttonColor; - const PickupLocationFromMap({Key key, this.onPick, this.latitude, this.longitude}) + const PickupLocationFromMap( + {Key key, + this.onPick, + this.latitude, + this.longitude, + this.isWithAppBar = true, + this.buttonLabel, + this.buttonColor}) : super(key: key); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Scaffold( - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text('Location'), - leading: CloseBack(), - centerTitle: true, - ), + appBar: isWithAppBar + ? AppBar( + elevation: 0, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text('Location'), + leading: CloseBack(), + centerTitle: true, + ) + : null, body: PlacePicker( apiKey: GOOGLE_API_KEY, enableMyLocationButton: true, @@ -57,17 +70,30 @@ class PickupLocationFromMap extends StatelessWidget { child: state == SearchingState.Searching ? Center(child: CircularProgressIndicator()) : Container( - margin: EdgeInsets.all(12), - child: SecondaryButton( - color: Colors.grey[800], + margin: EdgeInsets.all(12), + child: BorderedButton( + buttonLabel != null ? buttonLabel : TranslationBase.of(context).next, textColor: Colors.white, - onTap: () { + fontWeight: FontWeight.bold, + backgroundColor: buttonColor != null ? buttonColor : Colors.grey[800], + fontSize: 14, + vPadding: 12, + radius: 10, + handler: () { onPick(selectedPlace); Navigator.of(context).pop(); }, - label: TranslationBase.of(context).next, ), - ), + /* SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + onPick(selectedPlace); + Navigator.of(context).pop(); + }, + label: TranslationBase.of(context).next, + ),*/ + ), ); }, initialPosition: LatLng(latitude, longitude), diff --git a/pubspec.yaml b/pubspec.yaml index 2cac9435..785e831d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,7 +48,7 @@ dependencies: url_launcher: ^5.5.0 shared_preferences: ^0.5.8 flutter_flexible_toast: ^0.1.4 - firebase_messaging: ^7.0.0 + firebase_messaging: ^7.0.3 android_intent: ^0.3.7+7 # Progress bar progress_hud_v2: ^2.0.0 @@ -183,6 +183,7 @@ flutter: # assets: assets: - assets/images/ + - assets/images/pharmacy/ - assets/images/medical/ - assets/images/new-design/ - assets/images/login/ @@ -194,6 +195,8 @@ flutter: - assets/tracker/ - assets/images/AlHabibMedicalService/ - assets/images/pharmacy_module/ + - assets/images/pharmacy_module/payment/ + - assets/images/pharmacy_module/lakum/ fonts: