diff --git a/assets/images/new/add_to_cart.svg b/assets/images/new/add_to_cart.svg new file mode 100644 index 00000000..f01f6033 --- /dev/null +++ b/assets/images/new/add_to_cart.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/body_parts/female/abdomin.png b/assets/images/new/body_parts/female/abdomin.png new file mode 100644 index 00000000..f4918d71 Binary files /dev/null and b/assets/images/new/body_parts/female/abdomin.png differ diff --git a/assets/images/new/body_parts/female/anal.png b/assets/images/new/body_parts/female/anal.png new file mode 100644 index 00000000..d96ef288 Binary files /dev/null and b/assets/images/new/body_parts/female/anal.png differ diff --git a/assets/images/new/body_parts/female/axilla.png b/assets/images/new/body_parts/female/axilla.png new file mode 100644 index 00000000..f38be6b3 Binary files /dev/null and b/assets/images/new/body_parts/female/axilla.png differ diff --git a/assets/images/new/body_parts/female/back.png b/assets/images/new/body_parts/female/back.png new file mode 100644 index 00000000..65d9ef19 Binary files /dev/null and b/assets/images/new/body_parts/female/back.png differ diff --git a/assets/images/new/body_parts/female/bikini.png b/assets/images/new/body_parts/female/bikini.png new file mode 100644 index 00000000..a1a68423 Binary files /dev/null and b/assets/images/new/body_parts/female/bikini.png differ diff --git a/assets/images/new/body_parts/female/bikini_line.png b/assets/images/new/body_parts/female/bikini_line.png new file mode 100644 index 00000000..12fc0e6e Binary files /dev/null and b/assets/images/new/body_parts/female/bikini_line.png differ diff --git a/assets/images/new/body_parts/female/buttocks.png b/assets/images/new/body_parts/female/buttocks.png new file mode 100644 index 00000000..b83576f3 Binary files /dev/null and b/assets/images/new/body_parts/female/buttocks.png differ diff --git a/assets/images/new/body_parts/female/cheeks.svg b/assets/images/new/body_parts/female/cheeks.svg new file mode 100644 index 00000000..6305ce65 --- /dev/null +++ b/assets/images/new/body_parts/female/cheeks.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/chest.png b/assets/images/new/body_parts/female/chest.png new file mode 100644 index 00000000..727ebe7a Binary files /dev/null and b/assets/images/new/body_parts/female/chest.png differ diff --git a/assets/images/new/body_parts/female/chest_line.png b/assets/images/new/body_parts/female/chest_line.png new file mode 100644 index 00000000..0b4fecb8 Binary files /dev/null and b/assets/images/new/body_parts/female/chest_line.png differ diff --git a/assets/images/new/body_parts/female/chin.svg b/assets/images/new/body_parts/female/chin.svg new file mode 100644 index 00000000..37da45b4 --- /dev/null +++ b/assets/images/new/body_parts/female/chin.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/ears.svg b/assets/images/new/body_parts/female/ears.svg new file mode 100644 index 00000000..758a69e6 --- /dev/null +++ b/assets/images/new/body_parts/female/ears.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/eyebrows.svg b/assets/images/new/body_parts/female/eyebrows.svg new file mode 100644 index 00000000..9657daa7 --- /dev/null +++ b/assets/images/new/body_parts/female/eyebrows.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/full_legs.png b/assets/images/new/body_parts/female/full_legs.png new file mode 100644 index 00000000..5a365a7e Binary files /dev/null and b/assets/images/new/body_parts/female/full_legs.png differ diff --git a/assets/images/new/body_parts/female/full_neck.svg b/assets/images/new/body_parts/female/full_neck.svg new file mode 100644 index 00000000..f73f07f8 --- /dev/null +++ b/assets/images/new/body_parts/female/full_neck.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/half_neck.svg b/assets/images/new/body_parts/female/half_neck.svg new file mode 100644 index 00000000..78e4cfab --- /dev/null +++ b/assets/images/new/body_parts/female/half_neck.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/hydra_facial.svg b/assets/images/new/body_parts/female/hydra_facial.svg new file mode 100644 index 00000000..6a468211 --- /dev/null +++ b/assets/images/new/body_parts/female/hydra_facial.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/lower_arm.png b/assets/images/new/body_parts/female/lower_arm.png new file mode 100644 index 00000000..717b2cde Binary files /dev/null and b/assets/images/new/body_parts/female/lower_arm.png differ diff --git a/assets/images/new/body_parts/female/lower_leg.png b/assets/images/new/body_parts/female/lower_leg.png new file mode 100644 index 00000000..88ccacef Binary files /dev/null and b/assets/images/new/body_parts/female/lower_leg.png differ diff --git a/assets/images/new/body_parts/female/shoulders.png b/assets/images/new/body_parts/female/shoulders.png new file mode 100644 index 00000000..e1f253a8 Binary files /dev/null and b/assets/images/new/body_parts/female/shoulders.png differ diff --git a/assets/images/new/body_parts/female/side_burn.svg b/assets/images/new/body_parts/female/side_burn.svg new file mode 100644 index 00000000..123216e7 --- /dev/null +++ b/assets/images/new/body_parts/female/side_burn.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/female/upper_arm.png b/assets/images/new/body_parts/female/upper_arm.png new file mode 100644 index 00000000..1edb873c Binary files /dev/null and b/assets/images/new/body_parts/female/upper_arm.png differ diff --git a/assets/images/new/body_parts/female/upper_legs.png b/assets/images/new/body_parts/female/upper_legs.png new file mode 100644 index 00000000..a8aa2ec7 Binary files /dev/null and b/assets/images/new/body_parts/female/upper_legs.png differ diff --git a/assets/images/new/body_parts/female/upper_lips.svg b/assets/images/new/body_parts/female/upper_lips.svg new file mode 100644 index 00000000..72043376 --- /dev/null +++ b/assets/images/new/body_parts/female/upper_lips.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/abdomin.png b/assets/images/new/body_parts/male/abdomin.png new file mode 100644 index 00000000..1b180b42 Binary files /dev/null and b/assets/images/new/body_parts/male/abdomin.png differ diff --git a/assets/images/new/body_parts/male/axilla.png b/assets/images/new/body_parts/male/axilla.png new file mode 100644 index 00000000..61af9492 Binary files /dev/null and b/assets/images/new/body_parts/male/axilla.png differ diff --git a/assets/images/new/body_parts/male/back.svg b/assets/images/new/body_parts/male/back.svg new file mode 100644 index 00000000..7d9aeb46 --- /dev/null +++ b/assets/images/new/body_parts/male/back.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/bikini.png b/assets/images/new/body_parts/male/bikini.png new file mode 100644 index 00000000..aa98ea74 Binary files /dev/null and b/assets/images/new/body_parts/male/bikini.png differ diff --git a/assets/images/new/body_parts/male/bikini_line.png b/assets/images/new/body_parts/male/bikini_line.png new file mode 100644 index 00000000..60ed64e2 Binary files /dev/null and b/assets/images/new/body_parts/male/bikini_line.png differ diff --git a/assets/images/new/body_parts/male/cheek.svg b/assets/images/new/body_parts/male/cheek.svg new file mode 100644 index 00000000..984a59f8 --- /dev/null +++ b/assets/images/new/body_parts/male/cheek.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/chest.png b/assets/images/new/body_parts/male/chest.png new file mode 100644 index 00000000..b7cec070 Binary files /dev/null and b/assets/images/new/body_parts/male/chest.png differ diff --git a/assets/images/new/body_parts/male/chest_line.png b/assets/images/new/body_parts/male/chest_line.png new file mode 100644 index 00000000..41e779f3 Binary files /dev/null and b/assets/images/new/body_parts/male/chest_line.png differ diff --git a/assets/images/new/body_parts/male/chin.svg b/assets/images/new/body_parts/male/chin.svg new file mode 100644 index 00000000..9fdee93e --- /dev/null +++ b/assets/images/new/body_parts/male/chin.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/ears.svg b/assets/images/new/body_parts/male/ears.svg new file mode 100644 index 00000000..1c9600c3 --- /dev/null +++ b/assets/images/new/body_parts/male/ears.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/eyebrows.svg b/assets/images/new/body_parts/male/eyebrows.svg new file mode 100644 index 00000000..ea385230 --- /dev/null +++ b/assets/images/new/body_parts/male/eyebrows.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/full_legs.png b/assets/images/new/body_parts/male/full_legs.png new file mode 100644 index 00000000..eee2fa07 Binary files /dev/null and b/assets/images/new/body_parts/male/full_legs.png differ diff --git a/assets/images/new/body_parts/male/full_neck.png b/assets/images/new/body_parts/male/full_neck.png new file mode 100644 index 00000000..a75159f6 Binary files /dev/null and b/assets/images/new/body_parts/male/full_neck.png differ diff --git a/assets/images/new/body_parts/male/half_neck.png b/assets/images/new/body_parts/male/half_neck.png new file mode 100644 index 00000000..5ee0249c Binary files /dev/null and b/assets/images/new/body_parts/male/half_neck.png differ diff --git a/assets/images/new/body_parts/male/hydra_facial.svg b/assets/images/new/body_parts/male/hydra_facial.svg new file mode 100644 index 00000000..10516304 --- /dev/null +++ b/assets/images/new/body_parts/male/hydra_facial.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/lower_arm.png b/assets/images/new/body_parts/male/lower_arm.png new file mode 100644 index 00000000..120242ed Binary files /dev/null and b/assets/images/new/body_parts/male/lower_arm.png differ diff --git a/assets/images/new/body_parts/male/lower_legs.png b/assets/images/new/body_parts/male/lower_legs.png new file mode 100644 index 00000000..8367aa8c Binary files /dev/null and b/assets/images/new/body_parts/male/lower_legs.png differ diff --git a/assets/images/new/body_parts/male/shoulders.png b/assets/images/new/body_parts/male/shoulders.png new file mode 100644 index 00000000..907f2dd7 Binary files /dev/null and b/assets/images/new/body_parts/male/shoulders.png differ diff --git a/assets/images/new/body_parts/male/side_burn.svg b/assets/images/new/body_parts/male/side_burn.svg new file mode 100644 index 00000000..156b30f1 --- /dev/null +++ b/assets/images/new/body_parts/male/side_burn.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/body_parts/male/upper_arm.png b/assets/images/new/body_parts/male/upper_arm.png new file mode 100644 index 00000000..f80a75da Binary files /dev/null and b/assets/images/new/body_parts/male/upper_arm.png differ diff --git a/assets/images/new/body_parts/male/upper_legs.png b/assets/images/new/body_parts/male/upper_legs.png new file mode 100644 index 00000000..e0c973b7 Binary files /dev/null and b/assets/images/new/body_parts/male/upper_legs.png differ diff --git a/assets/images/new/body_parts/male/upper_lips.svg b/assets/images/new/body_parts/male/upper_lips.svg new file mode 100644 index 00000000..b7ae6e0f --- /dev/null +++ b/assets/images/new/body_parts/male/upper_lips.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/cart.svg b/assets/images/new/cart.svg new file mode 100644 index 00000000..334b86ba --- /dev/null +++ b/assets/images/new/cart.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/pharmacy_module/lakum/akum_transfer.png b/assets/images/pharmacy_module/lakum/akum_transfer.png new file mode 100644 index 00000000..30785b08 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/akum_transfer.png differ diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f78..cb6be309 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -2,25 +2,25 @@ - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 8.0 + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index e83c3bf5..1eb27a20 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,128 +1,128 @@ { - "images":[ - { - "idiom":"iphone", - "size":"20x20", - "scale":"2x", - "filename":"Icon-App-20x20@2x.png" - }, - { - "idiom":"iphone", - "size":"20x20", - "scale":"3x", - "filename":"Icon-App-20x20@3x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"1x", - "filename":"Icon-App-29x29@1x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"2x", - "filename":"Icon-App-29x29@2x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"3x", - "filename":"Icon-App-29x29@3x.png" - }, - { - "idiom":"iphone", - "size":"40x40", - "scale":"2x", - "filename":"Icon-App-40x40@2x.png" - }, - { - "idiom":"iphone", - "size":"40x40", - "scale":"3x", - "filename":"Icon-App-40x40@3x.png" - }, - { - "idiom":"iphone", - "size":"60x60", - "scale":"2x", - "filename":"Icon-App-60x60@2x.png" - }, - { - "idiom":"iphone", - "size":"60x60", - "scale":"3x", - "filename":"Icon-App-60x60@3x.png" - }, - { - "idiom":"iphone", - "size":"76x76", - "scale":"2x", - "filename":"Icon-App-76x76@2x.png" - }, - { - "idiom":"ipad", - "size":"20x20", - "scale":"1x", - "filename":"Icon-App-20x20@1x.png" - }, - { - "idiom":"ipad", - "size":"20x20", - "scale":"2x", - "filename":"Icon-App-20x20@2x.png" - }, - { - "idiom":"ipad", - "size":"29x29", - "scale":"1x", - "filename":"Icon-App-29x29@1x.png" - }, - { - "idiom":"ipad", - "size":"29x29", - "scale":"2x", - "filename":"Icon-App-29x29@2x.png" - }, - { - "idiom":"ipad", - "size":"40x40", - "scale":"1x", - "filename":"Icon-App-40x40@1x.png" - }, - { - "idiom":"ipad", - "size":"40x40", - "scale":"2x", - "filename":"Icon-App-40x40@2x.png" - }, - { - "idiom":"ipad", - "size":"76x76", - "scale":"1x", - "filename":"Icon-App-76x76@1x.png" - }, - { - "idiom":"ipad", - "size":"76x76", - "scale":"2x", - "filename":"Icon-App-76x76@2x.png" - }, - { - "idiom":"ipad", - "size":"83.5x83.5", - "scale":"2x", - "filename":"Icon-App-83.5x83.5@2x.png" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "scale" : "1x", - "filename" : "ItunesArtwork@2x.png" - } - ], - "info":{ - "version":1, - "author":"easyappicon" + "images" : [ + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-60x60@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-60x60@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-20x20@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-76x76@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-76x76@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-83.5x83.5@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "icon.jpg", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "filename" : "Icon-App-76x76@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "76x76" } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } } diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada47..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 72bd4ac9..ec89ac71 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -15,50 +15,73 @@ CFBundlePackageType APPL CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) + $(MARKETING_VERSION) CFBundleSignature ???? CFBundleVersion $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + MinimumOSVersion + 11.0 + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsArbitraryLoadsForMedia + + NSAllowsArbitraryLoadsInWebContent + + + NSAppleMusicUsageDescription + Required by another plugin, Please let us know if you find this functionality anywhere in the app. + NSBluetoothAlwaysUsageDescription + This App requires access to Bluetooth to connect blood pressure & blood sugar devices with the app to analyze the data. + NSBluetoothPeripheralUsageDescription + This App requires access to Bluetooth to connect blood pressure & blood sugar devices with the app to analyze the data. NSCalendarsUsageDescription - We need access to record you event in to calender. + This app requires calendar access to set reminders for Virtual & Normal Appointments. NSCameraUsageDescription - Need camera access for uploading images + This app requires camera access to enable virtual consultation between patient & doctor + NSContactsUsageDescription + This app requires contacts access to show incoming virtual consultation request. + NSFaceIDUsageDescription + This app requires Face ID to allow biometric authentication for app login. + NSHealthShareUsageDescription + This App need access to HealthKit to read heart rate & other data from your smart watch. + NSHealthUpdateUsageDescription + This App need access to HealthKit to read heart rate & other data from your smart watch. NSLocationAlwaysAndWhenInUseUsageDescription - This app will use your location to show cool stuffs near you. + This App requires access to your location to show the nearest hospitals & ER Locations from your location. NSLocationAlwaysUsageDescription - This app will use your location to show cool stuffs near you. - NSLocationUsageDescription - Need location access for updating nearby friends + This App requires access to your location to show the nearest hospitals from your location. NSLocationWhenInUseUsageDescription - This app will use your location to show cool stuffs near you. + This App requires access to your location to show the nearest hospitals from your location. NSMicrophoneUsageDescription - Need microphone access for uploading videos + This app requires microphone access to enable virtual consultation between patient & doctor + NSMotionUsageDescription + This app requires motion detection access to function properly. NSPhotoLibraryUsageDescription - Need photo library access for uploading images + This app requires photo library access to select image as document & upload it. + NSRemindersUsageDescription + This app requires calendar access to set reminders for Virtual & Normal Appointments. + NSSpeechRecognitionUsageDescription + This app requires speech recognition access to access voice command features. + NSUserActivityTypes + UIBackgroundModes - fetch + audio location - processing + remote-notification UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main - UIRequiredDeviceCapabilities - - location-services - gps - armv7 - UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad diff --git a/lib/config/config.dart b/lib/config/config.dart index d71b2b92..42861cce 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -362,6 +362,8 @@ const SEND_CHECK_IN_NFC_REQUEST = const HAS_DENTAL_PLAN = 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation'; +const LASER_BODY_PARTS = 'Services/Patients.svc/REST/Laser_GetBodyPartsByCategory'; + //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ae7d045d..94e7349f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -64,6 +64,7 @@ const Map localizedValues = { 'appointmentSuccess': {'en': 'Appointment is successfully booked', 'ar': 'تم حجز الموعد بنجاح'}, 'docQualifications': {'en': 'Doctor Qualifications', 'ar': 'مؤهلات الطبيب'}, 'pressAgain': {'en': 'Press again to exit the app', 'ar': 'اضغط مرة أخرى للخروج من التطبيق'}, + 'laserMaxLimitReach': {'en': "Maximum limit is 90 minutes", 'ar': "الحد الأقصى هو 90 دقيقة"}, 'confirmAppoHeading': {'en': 'Kindly review your Appointment', 'ar': 'يرجى تأكيد موعدك'}, 'patientInfo': {'en': 'Patient Information', 'ar': 'معلومات المريض'}, 'doctorFilter': {'en': 'Doctors will be filtered based on your gender and age', 'ar': 'سيتم تصفية الأطباء بناءً على جنسك وعمرك'}, @@ -170,6 +171,7 @@ const Map localizedValues = { "minute": {"en": "Minutes", "ar": "دقيقة"}, "hour": {"en": "Hour", "ar": "ساعة"}, "reminderSuccess": {"en": "The reminder has been added successfully", "ar": "تمت إضافة التذكير بنجاح"}, + "reminderCancelSuccess": {"en": "The reminder has been cancelled successfully", "ar": "تم إلغاء التذكير بنجاح"}, "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, @@ -244,6 +246,7 @@ const Map localizedValues = { "companyName": {"en": "Company Name:", "ar": "اسم الشركة: "}, "receiptOn": {"en": "Receipt on:", "ar": "تاريخ الفاتورة: "}, "expiryDate": {"en": "Expiry Date:", "ar": "تاريخ الانتهاء: "}, + "expiryPoints": {"en": "Expired", "ar": " منتهية الصلاحية"}, "expiryOn": {"en": "Expiry on:", "ar": "تاريخ الانتهاء: "}, "procedureName": {"en": "Procedure Name:", "ar": "اسم الاجراء:"}, "procedure": {"en": "Procedure", "ar": "اسم الاجراء:"}, @@ -448,6 +451,7 @@ const Map localizedValues = { "Frequency": {"en": "Frequency", "ar": "المعدل"}, "DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"}, "AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"}, + "CancelReminder": {"en": "Cancel Reminder", "ar": "إلغاء تذكير"}, "reminderDes": { "en": "Please select treatment start day and time to be notified when it\'s time to take the medicine", "ar": "يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" @@ -552,6 +556,7 @@ const Map localizedValues = { "shipping": {"en": "Shipping", "ar": " الشحن"}, "shipBy": {"en": "SHIP BY:", "ar": "الشحن عن طريق:"}, "lakumPoints": {"en": "Lakum Points", "ar": "نقاط برنامج لكم"}, + "useLakumPoints": {"en": "Use Lakum points", "ar": "استخدم برنامج لكم"}, "use": {"en": "USE", "ar": "استخدم"}, "proceedPay": {"en": "PROCEED TO PAY", "ar": "المتابعة للدفع"}, "vat": {"en": "VAT (15%)", "ar": "(15%) القيمة المضافة"}, @@ -816,6 +821,11 @@ const Map localizedValues = { "respiration-signs": {"en": "Respiration", "ar": "تنفس"}, "sys-dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"}, "body": {"en": "Body Mass", "ar": "كتلة\nالجسم"}, + "body_string": {"en": "Body", "ar": "الجسم"}, + "face": {"en": "Face", "ar": "وجه"}, + "retouch": {"en": "Retouch", "ar": "روتوش"}, + "bikini": {"en": "Bikini", "ar": "بيكيني"}, + "totalMinutes": {"en": "Total Minutes", "ar": "إجمالي الدقائق"}, "feedback": {"en": "Feedback", "ar": "رأيك يهمنا"}, "send": {"en": "Send", "ar": "أرسل"}, "status": {"en": "Status", "ar": "الحالة"}, @@ -1346,7 +1356,7 @@ const Map localizedValues = { "en": " This service allows you to activate your LAKUM account after registering completed.", "ar": " تتيح لك هذه الخدمة تفعيل حساب برنامج الولاء لكم بعد اكتمال التسجيل. " }, - "pointsToTransfer": {"en": "Point's to Transfer:", "ar": "النقاط المراد تحويلها:"}, + "pointsToTransfer": {"en": "Points to Transfer:", "ar": "النقاط المراد تحويلها:"}, "enterBeneficiaryAccountNo": {"en": "Enter Beneficiary Account No.", "ar": "أدخل رقم حساب المستفيد"}, "confirm-prescription": {"en": "Are you sure !! you want to send this request", "ar": "تاكيد ارسال الطلب؟"}, "you-already-have-order": {"en": "You already have this order! do you want to view it?", "ar": "لديك هذا الطلب بالفعل! هل تريد مشاهدته؟"}, @@ -1685,8 +1695,7 @@ const Map localizedValues = { "lowLimits": {"en": "Please check the value you have entered, since the body fat percentage cannot be this low.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، حيث لا يمكن أن تكون نسبة الدهون في الجسم منخفضة."}, "estimates": {"en": "Estimates the total body fat based on\nthe size", "ar": "تقدير إجمالي الدهون في الجسم بناءً على \ n الحجم"}, - - "myCart": {"en": "Cart", "ar": "عربة التسوق"}, + "myCart": {"en": "My Cart", "ar": "عربة التسوق"}, "browseOffers": {"en": "Browse offers by clinic", "ar": "تصفح العروض حسب العيادة"}, "inactiveAct":{"en":"Almost inactive (little or no exercise)","ar":"غير نشط تقريبا (ممارسة الرياضة قليلة أو منعدمة)"}, "light":{"en":"Lightly active (1-3) days per week","ar":"خفيف النشاط (1-3 أيام في الأسبوع)"}, @@ -1721,4 +1730,8 @@ const Map localizedValues = { "gramsPerDay": {"en": "Grams Per Day", "ar": "غرام في اليوم"}, "gr": {"en": "gr", "ar": "غرام"}, "gramsPerMeal": {"en": "Grams Per Meal", "ar": "عدد الجرامات لكل وجبة"}, + "syncSuccess": {"en": "Data Synced Successfully", "ar": "تمت مزامنة البيانات بنجاح"}, + "points": {"en": "Points", "ar": "نقاط"}, + "availableBalance": {"en": "Available Balance", "ar": "الرصيد المتوفر"}, + "ordersDashboard": {"en": "My Orders", "ar": "طلباتي"}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index c256d0c1..723e17a0 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -21,6 +21,7 @@ const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited'; const PHARMACY_CUSTOMER_ID = 'costumer-id'; +const PHARMACY_CUSTOMER_GUID = 'customer-guid'; const PHARMACY_CUSTOMER_OBJECT = 'pharmacy-customer-object'; const IS_ROBOT_VISIBLE = 'robot-visible'; const IS_ROBOT_INIT = 'robot-init'; diff --git a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart index c609fa0b..e7948d7d 100644 --- a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart +++ b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart @@ -2,35 +2,35 @@ import 'PointsAmountPerYear.dart'; import 'PointsDetails.dart'; class LakumInquiryInformationObjVersion { - int accountNumber; + num accountNumber; String accountStatus; String barCode; - int consumedPoints; + num consumedPoints; String consumedPointsAmount; List consumedPointsAmountPerYear; List consumedPointsDetails; String createdDate; - int expiredPoints; + num expiredPoints; String expiryDate; - int gainedPoints; + num gainedPoints; List gainedPointsAmountPerYear; List gainedPointsDetails; String lakumMessageStatus; String memberName; String memberUniversalId; String mobileNumber; - int pointsBalance; - int pointsBalanceAmount; - int pointsWillBeExpired; + num pointsBalance; + num pointsBalanceAmount; + num pointsWillBeExpired; String prefLang; - int statusCode; - int transferPoints; + num statusCode; + num transferPoints; List transferPointsAmountPerYear; List transferPointsDetails; dynamic waitingPoints; dynamic loyalityAmount; dynamic loyalityPoints; - int purchaseRate; + num purchaseRate; LakumInquiryInformationObjVersion( {this.accountNumber, diff --git a/lib/core/model/pharmacies/PointsAmountPerYear.dart b/lib/core/model/pharmacies/PointsAmountPerYear.dart index eef74064..2d25855f 100644 --- a/lib/core/model/pharmacies/PointsAmountPerYear.dart +++ b/lib/core/model/pharmacies/PointsAmountPerYear.dart @@ -1,10 +1,10 @@ import 'PointsAmountPerMonth.dart'; class PointsAmountPerYear { - int amountPerYear; + num amountPerYear; List pointsAmountPerMonth; - int pointsPerYear; - int year; + num pointsPerYear; + num year; PointsAmountPerYear( {this.amountPerYear, diff --git a/lib/core/model/pharmacies/payment-checkout-data.dart b/lib/core/model/pharmacies/payment-checkout-data.dart index 5d91c829..f6f93fa2 100644 --- a/lib/core/model/pharmacies/payment-checkout-data.dart +++ b/lib/core/model/pharmacies/payment-checkout-data.dart @@ -11,7 +11,7 @@ class PaymentCheckoutData { LacumAccountInformation lacumInformation; bool cartDataVisible; ShippingOption shippingOption; - int usedLakumPoints; + num usedLakumPoints; PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0}); diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index b66ce951..2f92fe5e 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -39,7 +39,8 @@ class CustomerAddressesService extends BaseService { Map queryParams = {'fields': 'addresses'}; hasError = false; var customerID = await sharedPref.getObject(PHARMACY_CUSTOMER_ID); - await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID", onSuccess: (dynamic response, int statusCode) { + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID/$customerGUID", onSuccess: (dynamic response, int statusCode) { addressesList.clear(); response["customers"][0]["addresses"].forEach((data) { addressesList.add(AddressInfo.fromJson(data)); diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 1f6ca580..f9361e90 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -467,7 +467,9 @@ class BaseAppClient { onFailure(TranslationBase.of(AppGlobal.context).pharmacyRelogin, statusCode); Navigator.of(AppGlobal.context).pushNamed(HOME); } else { - onFailure('Error While Fetching data', statusCode); + var bodyUtf = json.decode(utf8.decode(response.bodyBytes)); + print(bodyUtf); + onFailure(bodyUtf['error']['ErrorEndUserMsg'], statusCode); } } else { // var parsed = json.decode(response.body.toString()); diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 899cc66b..8b56b739 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -21,10 +21,11 @@ class OrderPreviewService extends BaseService { Future getAddresses() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + var customerGUID = await sharedPref.getString(PHARMACY_CUSTOMER_GUID); Map queryParams = {'fields': 'addresses'}; hasError = false; try { - await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) { addresses.clear(); response['customers'][0]['addresses'].forEach((item) { addresses.add(Addresses.fromJson(item)); @@ -58,13 +59,15 @@ class OrderPreviewService extends BaseService { Future getShoppingCart() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + if (customerId == null) return null; Map queryParams = {'shopping_cart_type': '1'}; dynamic localRes; hasError = false; try { - await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId", onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index cc330ed7..7c7afa30 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -22,16 +22,12 @@ class PharmacyModuleService extends BaseService { List mostViewedProducts = List(); Future makeVerifyCustomer(dynamic data) async { - Map queryParams = { - 'FileNumber': data['PatientID'].toString() - }; + Map queryParams = {'FileNumber': data['PatientID'].toString()}; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, - onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode) async { if (response['UserName'] != null) { - sharedPref.setString( - PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); + sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); print(response); } else { await createUser(); @@ -57,13 +53,14 @@ class PharmacyModuleService extends BaseService { }; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_CREATE_CUSTOMER, - onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async { if (!response['IsRegistered']) { } else { customerInfo = CustomerInfo.fromJson(response); - await sharedPref.setObject( - PHARMACY_CUSTOMER_ID, customerInfo.customerId); + print(response['customerDto']); + print(response['customerDto']['customerGuid']); + await sharedPref.setObject(PHARMACY_CUSTOMER_ID, customerInfo.customerId); + await sharedPref.setObject(PHARMACY_CUSTOMER_GUID, response['customerDto']['customerGuid']); } // await generatePharmacyToken(); }, onFailure: (String error, int statusCode) { @@ -83,11 +80,9 @@ class PharmacyModuleService extends BaseService { }; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_AUTORZIE_CUSTOMER, - onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy(PHARMACY_AUTORZIE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async { if (response['Status'] == 200) { - await sharedPref.setString( - PHARMACY_AUTORZIE_TOKEN, response['token'].toString()); + await sharedPref.setString(PHARMACY_AUTORZIE_TOKEN, response['token'].toString()); } }, onFailure: (String error, int statusCode) { hasError = true; @@ -101,8 +96,7 @@ class PharmacyModuleService extends BaseService { Future getBannerListList() async { hasError = false; try { - await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, onSuccess: (dynamic response, int statusCode) { bannerItems.clear(); response['images'].forEach((item) { bannerItems.add(PharmacyImageObject.fromJson(item)); @@ -120,8 +114,7 @@ class PharmacyModuleService extends BaseService { if (manufacturerList.isNotEmpty) return; Map queryParams = {'page': '1', 'limit': '8'}; try { - await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) { manufacturerList.clear(); response['manufacturer'].forEach((item) { Manufacturer manufacturer = Manufacturer.fromJson(item); @@ -147,8 +140,7 @@ class PharmacyModuleService extends BaseService { 'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews', }; try { - await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) { bestSellerProducts.clear(); response['products'].forEach((item) { bestSellerProducts.add(PharmacyProduct.fromJson(item)); @@ -165,23 +157,18 @@ class PharmacyModuleService extends BaseService { Future getLastVisitedProducts() async { String lastVisited = ""; - if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != - null) { - lastVisited = - await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { + lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); // lastVisited = "2458,4561"; try { - await baseAppClient - .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) { lastVisitedProducts.clear(); response['products'].forEach((item) { lastVisitedProducts.add(PharmacyProduct.fromJson(item)); }); hasError = false; }, onFailure: (String error, int statusCode) { - hasError = - true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, ""); + hasError = true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, ""); super.error = error; }); } catch (error) { @@ -197,8 +184,7 @@ class PharmacyModuleService extends BaseService { 'id,discount_ids,name,reviews,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', }; try { - await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, onSuccess: (dynamic response, int statusCode) { mostViewedProducts.clear(); response['products'].forEach((item) { mostViewedProducts.add(PharmacyProduct.fromJson(item)); diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index 3cc45680..be376c91 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -187,11 +187,14 @@ class PharmacyCategoriseService extends BaseService { ); } - Future getSubProducts({String id}) async { + Future getSubProducts( + {String id, int pageIndex, bool isLoading = false}) async { hasError = false; - _subProductsList.clear(); + if (isLoading == false) { + _subProductsList.clear(); + } String endPoint = id != null - ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' + ? GET_SUB_PRODUCTS + "$id" + '&page=' + '$pageIndex' + '&limit=24' : GET_SUB_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index e9f2a3d4..6d212d2b 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -166,8 +166,7 @@ class OrderPreviewViewModel extends BaseViewModel { } getInformationsByAddress(String identificationNo) async { - await getShippingOption(); - await getLacumAccountInformation(identificationNo); + await getShippingOption(identificationNo); } getLacumAccountInformation(String identificationNo) async { @@ -194,18 +193,18 @@ class OrderPreviewViewModel extends BaseViewModel { } } - getShippingOption() async { + Future getShippingOption(String identificationNo) async { setState(ViewState.Busy); - await _orderService.getShippingOption(paymentCheckoutData.address).then((res) { - paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); - setState(ViewState.Idle); + await _orderService.getShippingOption(paymentCheckoutData.address).then((res) async { + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); + setState(ViewState.Idle); + await getLacumAccountInformation(identificationNo); + } }); - if (_orderService.hasError) { - error = _orderService.error; - setState(ViewState.Error); - } else { - setState(ViewState.Idle); - } } Future makeOrder() async { diff --git a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart index c03e8e87..1bd0d542 100644 --- a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart +++ b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart @@ -1,5 +1,5 @@ import 'dart:async'; -import 'dart:convert' as convert; +import 'dart:convert'; import 'dart:typed_data'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; @@ -92,8 +92,8 @@ class LacumViewModel extends BaseViewModel { Uint8List convertBase64ToBarCodeImage() { try { - final _byteImage = convert.base64Decode( - lacumGroupInformation.lakumInquiryInformationObjVersion.barCode); + final _byteImage = base64Decode( + lacumGroupInformation.lakumInquiryInformationObjVersion.barCode.split(',').last); return _byteImage; } catch (e) { print(e); diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index fe5be016..7d6979cc 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -37,9 +37,9 @@ class OrderModelViewModel extends BaseViewModel { - Future getOrder(customerId, pageID) async { + Future getOrder(customerId, customerGUID, pageID) async { setState(ViewState.Busy); - await _orderService.getOrder(customerId, pageID); + await _orderService.getOrder(customerId, customerGUID, pageID); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index df895e28..23952514 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -57,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future notifyMe(customerId, itemID, context) async { + Future notifyMe(customerId, itemID) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.notifyMe(customerId, itemID, context); + await _productDetailService.notifyMe(customerId, itemID); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index fcae18d2..2be2f14c 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -121,7 +121,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.BusyLocal); - //GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context); await _pharmacyCategoriseService.getParentProducts( id: i, pageNumber: pageIndex, isLoading: isLoading); if (_pharmacyCategoriseService.hasError) { @@ -129,31 +129,45 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); - //GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); } - Future getSubCategorise({String i}) async { + Future getSubCategorise( + {String i, + int pageIndex, + bool isLoading = false, + BuildContext context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _pharmacyCategoriseService.getSubCategorise(id: i); + await _pharmacyCategoriseService.getSubCategorise( + id: i, + ); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); } else - getSubProducts(i: i); + getSubProducts( + i: i, pageIndex: pageIndex, isLoading: isLoading, context: context); } - Future getSubProducts({String i}) async { + Future getSubProducts( + {String i, + int pageIndex, + bool isLoading = false, + BuildContext context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); - setState(ViewState.Busy); - await _pharmacyCategoriseService.getSubProducts(id: i); + setState(ViewState.BusyLocal); + GifLoaderDialogUtils.showMyDialog(context); + await _pharmacyCategoriseService.getSubProducts( + id: i, pageIndex: pageIndex, isLoading: isLoading); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + GifLoaderDialogUtils.hideDialog(context); } Future getFinalProducts({String i}) async { diff --git a/lib/models/Appointments/laser_body_parts.dart b/lib/models/Appointments/laser_body_parts.dart new file mode 100644 index 00000000..99896868 --- /dev/null +++ b/lib/models/Appointments/laser_body_parts.dart @@ -0,0 +1,64 @@ +class LaserBodyPart { + int id; + int category; + String bodyPart; + bool fullBoadyPart; + bool isRetouch; + String timeDuration; + String bodyPartN; + bool isActive; + String mappingCode; + int procedureID; + int orderNum; + String categoryName; + String categoryNameN; + + LaserBodyPart( + {this.id, + this.category, + this.bodyPart, + this.fullBoadyPart, + this.isRetouch, + this.timeDuration, + this.bodyPartN, + this.isActive, + this.mappingCode, + this.procedureID, + this.orderNum, + this.categoryName, + this.categoryNameN}); + + LaserBodyPart.fromJson(Map json) { + id = json['Id']; + category = json['Category']; + bodyPart = json['BodyPart']; + fullBoadyPart = json['FullBoadyPart']; + isRetouch = json['IsRetouch']; + timeDuration = json['TimeDuration']; + bodyPartN = json['BodyPartN']; + isActive = json['IsActive']; + mappingCode = json['MappingCode']; + procedureID = json['ProcedureID']; + orderNum = json['OrderNum']; + categoryName = json['CategoryName']; + categoryNameN = json['CategoryNameN']; + } + + Map toJson() { + final Map data = new Map(); + data['Id'] = this.id; + data['Category'] = this.category; + data['BodyPart'] = this.bodyPart; + data['FullBoadyPart'] = this.fullBoadyPart; + data['IsRetouch'] = this.isRetouch; + data['TimeDuration'] = this.timeDuration; + data['BodyPartN'] = this.bodyPartN; + data['IsActive'] = this.isActive; + data['MappingCode'] = this.mappingCode; + data['ProcedureID'] = this.procedureID; + data['OrderNum'] = this.orderNum; + data['CategoryName'] = this.categoryName; + data['CategoryNameN'] = this.categoryNameN; + return data; + } +} diff --git a/lib/models/Clinics/ClinicListResponse.dart b/lib/models/Clinics/ClinicListResponse.dart index cabb47b2..1aa4065e 100644 --- a/lib/models/Clinics/ClinicListResponse.dart +++ b/lib/models/Clinics/ClinicListResponse.dart @@ -41,6 +41,12 @@ class ListClinicCentralized { data['LiveCareServiceID'] = this.liveCareServiceID; return data; } + + + @override + String toString() { + return '${clinicDescription}'.toLowerCase() + ' ${clinicDescription}'.toUpperCase(); + } } class ListGetBookScheduleConfigsList { diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart index d681f764..ac514dc2 100644 --- a/lib/models/SmartWatch/HealthData.dart +++ b/lib/models/SmartWatch/HealthData.dart @@ -4,15 +4,13 @@ class healthData { String MachineDate; double Value; int TransactionsListID; - String Notes; healthData({ this.MedCategoryID, this.MedSubCategoryID, this.MachineDate, this.Value, - this.TransactionsListID, - this.Notes, + this.TransactionsListID }); healthData.fromJson(Map json) { @@ -21,7 +19,6 @@ class healthData { MachineDate = json['MachineDate']; Value = json['Value']; TransactionsListID = json['TransactionsListID']; - Notes = json['Notes']; } Map toJson() { @@ -31,7 +28,6 @@ class healthData { data['MachineDate'] = this.MachineDate; data['Value'] = this.Value; data['TransactionsListID'] = this.TransactionsListID; - data['Notes'] = this.Notes; return data; } } \ No newline at end of file diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 89d58317..4a3f8447 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -146,7 +146,6 @@ class _NewCMCStepTowPageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, description: TranslationBase.of(context).infoCMC, diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index c5e0f714..b61cd4fc 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -134,26 +134,33 @@ class _BloodDonationPageState extends State { ), SizedBox(height: 12), if (projectProvider.isLogin && model.state != ViewState.Busy) - CommonDropDownView(TranslationBase.of(context).city, projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description, () { - List list = [ - for (int i = 0; i < model.CitiesModelList.length; i++) - RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), - ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedHospitalIndex, - isScrollable: true, - onValueSelected: (index) { - _selectedHospitalIndex = index; - _selectedHospital = model.CitiesModelList[index]; - setState(() {}); - }, - ), - ); - }).withBorderedContainer, + CommonDropDownView( + TranslationBase.of(context).city, + model.CitiesModelList.isNotEmpty + ? projectProvider.isArabic + ? model.CitiesModelList[_selectedHospitalIndex].descriptionN + : model.CitiesModelList[_selectedHospitalIndex].description + : "", () { + List list = [ + for (int i = 0; i < model.CitiesModelList.length; i++) + RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = model.CitiesModelList[index]; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, SizedBox(height: 12), CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { List list = [ diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 8e576c99..3a6d9185 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -78,7 +78,7 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart new file mode 100644 index 00000000..37ec070a --- /dev/null +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -0,0 +1,523 @@ +import 'dart:collection'; + +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/laser_body_parts_data.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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 LaserClinic extends StatefulWidget { + LaserClinic({Key key}) : super(key: key); + + @override + _LaserClinicState createState() { + return _LaserClinicState(); + } +} + +class _LaserClinicState extends State with SingleTickerProviderStateMixin { + List _laserCategoryList = [1, 2, 11]; + List _selectedBodyPartList = []; + bool _isFullBody = false; + LaserBodyPart fullBody; + int _selectedCategoryIndex = 0; + List laserBodyPartsList = []; + + TabController _tabController; + int _duration = 0; + + List maleLaserCategory = []; + List femaleLaserCategory = []; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(() { + if (_tabController.indexIsChanging) { + } else { + _selectedBodyPartList = List(); + laserBodyPartsList = List(); + _selectedCategoryIndex = 0; + setState(() {}); + if (_tabController.index == 0) { + callLaserBodyPartsAPI(maleLaserCategory[_selectedCategoryIndex].laserCategoryID); + } else { + callLaserBodyPartsAPI(femaleLaserCategory[_selectedCategoryIndex].laserCategoryID); + } + } + }); + Future.delayed(Duration.zero, () { + callLaserBodyPartsAPI(maleLaserCategory[_selectedCategoryIndex].laserCategoryID); + }); + } + + callLaserBodyPartsAPI(int laserCategoryId) async { + GifLoaderDialogUtils.showMyDialog(context); + + DoctorsListService service = new DoctorsListService(); + service.getLaserBodyPartsList(laserCategoryId).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + if (res['Laser_GetBodyPartsByCategoryList'].length != 0) { + List _tempList = List(); + res['Laser_GetBodyPartsByCategoryList'].forEach((v) { + _tempList.add(LaserBodyPart.fromJson(v)); + }); + if (_tempList[0].category == 1 || _tempList[0].category == 11 || _tempList[0].category == 2 || _tempList[0].category == 10) { + fullBody = _tempList[0]; + _tempList.removeAt(0); + } + laserBodyPartsList = _tempList; + } else {} + setState(() {}); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + bool lastIndexIsFirst = false; + bool isLastIndexIsBack = false; + ProjectViewModel projectViewModel; + + bool get isMale => _tabController.index == 0; + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + maleLaserCategory = [ + LaserCategoryType(1, TranslationBase.of(context).bodyString), + LaserCategoryType(2, TranslationBase.of(context).face), + LaserCategoryType(11, TranslationBase.of(context).retouch), + ]; + femaleLaserCategory = [ + LaserCategoryType(1, TranslationBase.of(context).bodyString), + LaserCategoryType(2, TranslationBase.of(context).face), + LaserCategoryType(10, TranslationBase.of(context).bikini), + LaserCategoryType(11, TranslationBase.of(context).retouch), + ]; + return AppScaffold( + appBarTitle: TranslationBase.of(context).laserClinic, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + backgroundColor: Color(0xfff7f7f7), + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).male), Text(TranslationBase.of(context).female)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [male(), female()], + ), + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).totalMinutes + ":", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.48, + ), + ), + Text( + "${getDuration()} / 90", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Color(0xff2E303A), + letterSpacing: -0.64, + ), + ), + ], + ), + ), + Expanded( + child: DefaultButton( + TranslationBase.of(context).continues, + getDuration() != 0 ? () { + callDoctorsSearchAPI(); + } : null, + color: CustomColors.green, + disabledColor: CustomColors.grey2, + ), + ), + ], + ).insideContainer, + ], + ), + ); + } + + callDoctorsSearchAPI() { + GifLoaderDialogUtils.showMyDialog(context); + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + List _patientDoctorAppointmentListHospital = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsList(253, 0, false, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorList'].length != 0) { + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + } + }); + } else {} + }); + + result = LinkedHashSet.from(arr).toList(); + numAll = result.length; + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) + .then((value) { + setState(() { + // dropdownValue = null; + }); + // getProjectsList(); + }); + } + + int getDuration() { + int duration = 0; + if (_isFullBody) { + _duration = int.parse(fullBody.timeDuration); + return _duration; + } + + var lowerUpperLegsList = _selectedBodyPartList.where((element) => element.mappingCode == "47" || element.mappingCode == "48")?.toList() ?? []; + var upperLowerArmsList = _selectedBodyPartList.where((element) => element.mappingCode == "40" || element.mappingCode == "41")?.toList() ?? []; + + if (_selectedBodyPartList.length > 0) { + duration = _selectedBodyPartList.fold(0, (previousValue, element) => previousValue + int.parse(element.timeDuration)); + } + print("duration:$duration"); + if (lowerUpperLegsList.length == 2) { + duration -= 30; + } + print("duration1:$duration"); + if (upperLowerArmsList.length == 2) { + duration -= 15; + } + print("duration2:$duration"); + // for (int i = 0; i < _selectedBodyPartList.length; i++) { + // if ( + // + // (lowerUpperLegsList.length == 2 && (_selectedBodyPartList[i].mappingCode == "47" || _selectedBodyPartList[i].mappingCode == "48")) || + // (upperLowerArmsList.length == 2 && (_selectedBodyPartList[i].mappingCode == "40" || _selectedBodyPartList[i].mappingCode == "41")) + // + // + // ) { + // print("duration:$duration"); + // + // duration += 15; + // print("duration1:$duration"); + // } else { + // duration += int.parse(_selectedBodyPartList[i].timeDuration); + // } + // } + print(duration); + _duration = duration; + return duration; + } + + Widget laserCategoryWidget(List list, VoidCallback onTap) { + return SizedBox( + height: 40, + child: ListView.separated( + itemCount: list.length, + physics: BouncingScrollPhysics(), + scrollDirection: Axis.horizontal, + separatorBuilder: (cxt, index) => SizedBox(width: 8), + itemBuilder: (cxt, index) { + return InkWell( + onTap: () { + // setState(() { + _selectedCategoryIndex = index; + // }); + onTap(); + }, + child: Container( + decoration: BoxDecoration( + color: _selectedCategoryIndex == index ? Color(0xffD02127) : Colors.white, + borderRadius: BorderRadius.circular(36), + border: Border.all( + width: 1, + color: _selectedCategoryIndex == index ? Colors.transparent : Color(0xffEAEAEA), + ), + ), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 26), + child: Text( + list[index].title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: _selectedCategoryIndex == index ? Colors.white : Color(0xff535353), + letterSpacing: -0.48, + ), + ), + ), + ); + }, + ), + ); + } + + Widget bodyPartsGridView() { + return Container( + padding: EdgeInsets.symmetric(vertical: 21, horizontal: 14), + margin: EdgeInsets.only(top: 16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (fullBody != null) + Row( + children: [ + SizedBox( + width: 22, + height: 22, + child: Theme( + data: Theme.of(context).copyWith( + unselectedWidgetColor: Color(0xffEAEAEA), + ), + child: Checkbox( + value: _isFullBody, + onChanged: (value) { + setState(() { + if (value) { + _selectedBodyPartList.clear(); + } + _isFullBody = !_isFullBody; + }); + }, + activeColor: Color(0xffD02127), + ), + ), + ), + SizedBox(width: 12), + Text( + projectViewModel.isArabic ? fullBody.bodyPartN : fullBody.bodyPart, + style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.6, height: 21 / 14), + ), + ], + ), + GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 85 / 107, crossAxisSpacing: 4, mainAxisSpacing: 21), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: laserBodyPartsList.length, + padding: fullBody != null ? EdgeInsets.only(top: 16) : EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + bool _isSelected = _selectedBodyPartList.any((file) => file.id == laserBodyPartsList[index].id); + return InkWell( + onTap: _isFullBody + ? null + : () { + if (_duration >= 90) { + if (_isSelected) { + _selectedBodyPartList.removeWhere((element) => element.id == laserBodyPartsList[index].id); + + // _selectedBodyPartList.remove(laserBodyPartsList[index]); + setState(() {}); + return; + } + AppToast.showToast(message: TranslationBase.of(context).laserMaxLimitReach); + return; + } + if (_isSelected) { + _selectedBodyPartList.removeWhere((element) => element.id == laserBodyPartsList[index].id); + // _selectedBodyPartList.remove(laserBodyPartsList[index]); + } else { + if (_duration + int.parse(laserBodyPartsList[index].timeDuration) > 90) { + AppToast.showToast(message: TranslationBase.of(context).laserMaxLimitReach); + return; + } + _selectedBodyPartList.add(laserBodyPartsList[index]); + } + setState(() {}); + }, + child: AnimatedOpacity( + opacity: _isFullBody ? 0.25 : 1.0, + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: 97 / 97, + child: FittedBox( + fit: BoxFit.fitWidth, + child: Stack( + alignment: Alignment.topRight, + children: [ + Container( + margin: EdgeInsets.only(top: 5, right: 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + border: Border.all(color: _isSelected ? Color(0xffD02127) : Color(0xffEAEAEA), width: 2), + ), + child: LaserBodyParts() + .getCategoryImage(isMale, (isMale ? maleLaserCategory : femaleLaserCategory)[_selectedCategoryIndex].laserCategoryID, laserBodyPartsList[index].mappingCode), + ), + if (_isSelected) + Container( + width: 18, + height: 18, + child: Icon(Icons.done, color: Colors.white, size: 12), + decoration: BoxDecoration( + color: Color(0xffD02127), + borderRadius: BorderRadius.circular(30.0), + ), + ), + ], + ), + ), + ), + SizedBox(height: 6), + Expanded( + child: Text( + projectViewModel.isArabic ? laserBodyPartsList[index].bodyPartN : laserBodyPartsList[index].bodyPart, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.48, + ), + maxLines: 1, + ), + ), + ], + ), + ), + ); + }, + ), + ], + ), + ); + } + + Widget male() { + return ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + laserCategoryWidget(maleLaserCategory, () { + callLaserBodyPartsAPI(maleLaserCategory[_selectedCategoryIndex].laserCategoryID); + }), + if (laserBodyPartsList.isNotEmpty) bodyPartsGridView() + ], + ); + } + + Widget female() { + return ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + laserCategoryWidget(femaleLaserCategory, () { + callLaserBodyPartsAPI(femaleLaserCategory[_selectedCategoryIndex].laserCategoryID); + }), + if (laserBodyPartsList.isNotEmpty) bodyPartsGridView() + ], + ); + } +} + +class LaserCategoryType { + int laserCategoryID; + String title; + + LaserCategoryType(this.laserCategoryID, this.title); +} diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index c2f667c2..7fb724b8 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/dialog/clinic_list_dialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -25,6 +26,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; +import 'LaserClinic.dart'; import 'LiveCareBookAppointment.dart'; class SearchByClinic extends StatefulWidget { @@ -39,6 +41,7 @@ class SearchByClinic extends StatefulWidget { class _SearchByClinicState extends State { bool nearestAppo = false; String dropdownValue; + String dropdownTitle = ""; String projectDropdownValue; // var event = RobotProvider(); @@ -225,17 +228,32 @@ class _SearchByClinicState extends State { }).toList()) : InkWell( onTap: () { - // dropdownKey.currentState; - openDropdown(clinicDropdownKey); + showClickListDialog(context, clinicsList, onSelection: (ListClinicCentralized clincs) { + Navigator.pop(context); + setState(() { + print(clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString()); + dropdownTitle = clincs.clinicDescription; + dropdownValue = + clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString(); + if (dropdownValue == "253-false-0-0") { + Navigator.push(context, FadePage(page: LaserClinic())); + } else if (!isDentalSelectedAndSupported() && !nearestAppo) { + projectDropdownValue = ""; + getDoctorsList(context); + } else { + print("Dental"); + } + }); + }); }, child: Container( width: double.infinity, decoration: containerRadius(Colors.white, 12), margin: EdgeInsets.only(left: 20, right: 20), - padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 8), child: Row( children: [ - Flexible( + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -247,50 +265,14 @@ class _SearchByClinicState extends State { fontWeight: FontWeight.w600, ), ), - Container( - height: 18, - child: DropdownButtonHideUnderline( - child: DropdownButton( - onTap: () { - print("Clicked"); - }, - key: clinicDropdownKey, - hint: new Text( - TranslationBase.of(context).selectClinic, - ), - value: dropdownValue, - iconSize: 0, - isExpanded: true, - style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - items: clinicsList.map((item) { - return new DropdownMenuItem( - value: item.clinicID.toString() + - "-" + - item.isLiveCareClinicAndOnline.toString() + - "-" + - item.liveCareClinicID.toString() + - "-" + - item.liveCareServiceID.toString(), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(item.clinicDescription), - item.isLiveCareClinicAndOnline - ? SvgPicture.asset('assets/images/new-design/video_icon_green_right.svg', height: 12, width: 12, fit: BoxFit.cover) - : Container(), - ]), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - print(newValue); - dropdownValue = newValue; - if (!isDentalSelectedAndSupported() && !nearestAppo) { - projectDropdownValue = ""; - getDoctorsList(context); - } else { - print("Dental"); - } - }); - }, + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 2), + child: Text( + dropdownTitle, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, ), ), ), diff --git a/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart new file mode 100644 index 00000000..8f2fbb64 --- /dev/null +++ b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart @@ -0,0 +1,128 @@ +import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:progress_hud_v2/generated/i18n.dart'; + +showClickListDialog(BuildContext context, List clinicsList, {Function(ListClinicCentralized) onSelection}) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.0), + ), //this right here + child: Container( + width: double.infinity, + // width: MediaQuery.of(context).size.width - 10, + height: MediaQuery.of(context).size.height - 80, + child: ClickListDialog( + clinicsList: clinicsList, + onSelection: onSelection, + ), + ), + ); + }, + ); +} + +class ClickListDialog extends StatefulWidget { + List clinicsList; + Function(ListClinicCentralized) onSelection; + + ClickListDialog({this.clinicsList, this.onSelection}); + + @override + _ClickListDialogState createState() => _ClickListDialogState(); +} + +class _ClickListDialogState extends State { + TextEditingController controller = new TextEditingController(); + List tempClinicsList = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + addAllData(); + } + + addAllData() { + tempClinicsList.clear(); + for (int i = 0; i < widget.clinicsList.length; i++) { + tempClinicsList.add(widget.clinicsList[i]); + } + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: controller, + onChanged: (v) { + if (v.length > 0) { + tempClinicsList.clear(); + for (int i = 0; i < widget.clinicsList.length; i++) { + if (widget.clinicsList[i].clinicDescription.toLowerCase().contains(v.toLowerCase())) { + tempClinicsList.add(widget.clinicsList[i]); + } + } + } else { + addAllData(); + } + setState(() {}); + }, + decoration: InputDecoration( + hintStyle: TextStyle(fontSize: 17), + hintText: 'Search Clinic', + suffixIcon: Icon(Icons.search), + border: InputBorder.none, + contentPadding: EdgeInsets.all(12), + ), + ), + ), + Expanded( + child: ListView.separated( + padding: EdgeInsets.all(12), + itemBuilder: (context, index) { + return InkWell( + onTap: () { + widget.onSelection(tempClinicsList[index]); + + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Text(tempClinicsList[index].clinicDescription)), + tempClinicsList[index].isLiveCareClinicAndOnline + ? SvgPicture.asset( + 'assets/images/new-design/video_icon_green_right.svg', + height: 12, + width: 12, + fit: BoxFit.cover, + ) + : Container(), + ], + ), + ), + ); + }, + itemCount: tempClinicsList.length, + separatorBuilder: (BuildContext context, int index) { + return mHeight(8); + }, + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 43038658..723bf538 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -14,13 +14,15 @@ Future> requestPermissions() async { } showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {Function onSuccess, String title, String description}) async { + {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { if (await Permission.calendar.request().isGranted) { - _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); } else { requestPermissions().then((results) { if (results[Permission.calendar].isGranted) { - _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); } }); } @@ -29,7 +31,7 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S final CalendarPlugin _myPlugin = CalendarPlugin(); Future _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {Function onSuccess, String title, String description}) async { + {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { return showDialog( context: context, barrierDismissible: true, // user must tap button! @@ -56,16 +58,20 @@ Future _showReminderDialog(BuildContext context, DateTime dateTime, String // dateTime.add(new Duration(minutes: -120)); dateTime = Jiffy(dateTime).subtract(hours: 2); } - CalendarUtils calendarUtils = await CalendarUtils.getInstance(); - calendarUtils - .createOrUpdateEvent( - title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, - description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, - scheduleDateTime: dateTime, - eventId: eventId) - .then((value) {}); + if (onMultiDateSuccess == null) { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + calendarUtils + .createOrUpdateEvent( + title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, + description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, + scheduleDateTime: dateTime, + eventId: eventId) + .then((value) {}); - onSuccess(); + onSuccess(); + } else { + onMultiDateSuccess(i); + } }, ), ); @@ -144,12 +150,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder30, + Text( + TranslationBase.of(context).appoReminder30, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( @@ -163,12 +171,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder60, + Text( + TranslationBase.of(context).appoReminder60, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( @@ -182,12 +192,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder90, + Text( + TranslationBase.of(context).appoReminder90, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 6a24a52f..4e249e53 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -58,48 +58,48 @@ class NotificationsDetailsPage extends StatelessWidget { fontSize: 18.0, color: Colors.black, fontWeight: FontWeight.w600 + ), ), ), ), - ), - SizedBox( - height: 15, - ), - if (notification.messageTypeData.length != 0) - FractionallySizedBox( - widthFactor: 0.9, - child: Image.network(notification.messageTypeData, - loadingBuilder: (BuildContext context, Widget child, - ImageChunkEvent loadingProgress) { - if (loadingProgress == null) return child; - return Center( - child: SizedBox( - width: 40.0, - height: 40.0, - child: AppCircularProgressIndicator(), - ), - ); - }, - fit: BoxFit - .fill) //Image.network(notification.messageTypeData), + SizedBox( + height: 15, ), - SizedBox( - height: 15, - ), - Row( - children: [ - Expanded( - child: Center( - child: Text(notification.message), + if (notification.messageTypeData.length != 0) + FractionallySizedBox( + widthFactor: 0.9, + child: Image.network(notification.messageTypeData, + loadingBuilder: (BuildContext context, Widget child, + ImageChunkEvent loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: SizedBox( + width: 40.0, + height: 40.0, + child: AppCircularProgressIndicator(), + ), + ); + }, + fit: BoxFit + .fill) //Image.network(notification.messageTypeData), + ), + SizedBox( + height: 15, + ), + Row( + children: [ + Expanded( + child: Center( + child: Text(notification.message), + ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), ), ), - ), ); } } diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 498afde8..fc34dbfe 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -25,156 +25,128 @@ class NotificationsPage extends StatelessWidget { AppGlobal.context = context; return BaseView( onModelReady: (model) { - GetNotificationsRequestModel getNotificationsRequestModel = - new GetNotificationsRequestModel( - currentPage: currentIndex, - pagingSize: 14, - notificationStatusID: 2); + GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: currentIndex, pagingSize: 14, notificationStatusID: 2); model.getNotifications(getNotificationsRequestModel, context); }, builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - appBarTitle: TranslationBase.of(context).notifications, - baseViewModel: model, - body: ListView.separated( - itemBuilder: (context, index) { - if (index == model.notifications.length) { - return InkWell( - onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); - currentIndex++; - GetNotificationsRequestModel - getNotificationsRequestModel = - new GetNotificationsRequestModel( - currentPage: currentIndex, - pagingSize: 14, - notificationStatusID: 2); - - await model.getNotifications( - getNotificationsRequestModel, context); - GifLoaderDialogUtils.hideDialog(context); - }, - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // Image.asset('assets/images/notf.png'), - Icon( - Icons.notifications_active, - color: CustomColors.accentColor, - size: 40, - ), - Padding( - padding: const EdgeInsets.only(left: 10.0, right: 10.0), - child: Text(TranslationBase.of(context).moreNotifications, style: TextStyle( - color: CustomColors.accentColor, - fontWeight: FontWeight.w600, - letterSpacing: -0.64, - decoration: TextDecoration.underline - )), - ), - ], - ), - ), - ); - } - + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).notifications, + baseViewModel: model, + body: ListView.separated( + itemBuilder: (context, index) { + if (index == model.notifications.length) { return InkWell( onTap: () async { - if (!model.notifications[index].isRead) { - model.markAsRead(model.notifications[index].id); - } - Navigator.push( - context, - FadePage( - page: NotificationsDetailsPage( - notification: model.notifications[index], - ))); + GifLoaderDialogUtils.showMyDialog(context); + currentIndex++; + GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: currentIndex, pagingSize: 14, notificationStatusID: 2); + + await model.getNotifications(getNotificationsRequestModel, context); + GifLoaderDialogUtils.hideDialog(context); }, - child: Container( - width: double.infinity, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: model.notifications[index].isRead - ? Theme.of(context).scaffoldBackgroundColor - : CustomColors.accentColor.withOpacity(0.05), - border: projectViewModel.isArabic - ? Border( - right: BorderSide( - color: model.notifications[index].isRead - ? Theme.of(context).scaffoldBackgroundColor - : CustomColors.accentColor, - width: 5.0, - ), - ) - : Border( - left: BorderSide( - color: model.notifications[index].isRead - ? Theme.of(context).scaffoldBackgroundColor - : CustomColors.accentColor, - width: 5.0, - ), - ), - ), + child: Center( child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(model - .notifications[index].createdOn)) + - " " + - DateUtil.formatDateToTimeLang( - DateUtil.convertStringToDate(model - .notifications[index].createdOn), - false)), - SizedBox( - height: 5, - ), - Row( - children: [ - Expanded( - child: Texts(model - .notifications[index].message)), - if (model - .notifications[index].messageType == - "image") - Icon( - FontAwesomeIcons.images, - color: CustomColors.grey, - ) - ], - ), - SizedBox( - height: 5, - ), - ], - ), - ), + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Image.asset('assets/images/notf.png'), + Icon( + Icons.notifications_active, + color: CustomColors.accentColor, + size: 40, + ), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Text(TranslationBase.of(context).moreNotifications, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), ), ], ), ), ); - }, - separatorBuilder: (context, index) { - return Column( - children: [ - Divider( - color: Colors.grey[300], - thickness: 2.0, - ), - ], - ); - }, - itemCount: model.notifications.length + 1)), + } + + return InkWell( + onTap: () async { + if (!model.notifications[index].isRead) { + model.markAsRead(model.notifications[index].id); + } + Navigator.push( + context, + FadePage( + page: NotificationsDetailsPage( + notification: model.notifications[index], + ))); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor.withOpacity(0.05), + border: projectViewModel.isArabic + ? Border( + right: BorderSide( + color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, + width: 5.0, + ), + ) + : Border( + left: BorderSide( + color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, + width: 5.0, + ), + ), + ), + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.notifications[index].createdOn)) + + " " + + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(model.notifications[index].createdOn), false)), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded(child: Texts(model.notifications[index].message)), + if (model.notifications[index].messageType == "image") + Icon( + FontAwesomeIcons.images, + color: CustomColors.grey, + ) + ], + ), + SizedBox( + height: 5, + ), + ], + ), + ), + ), + ], + ), + ), + ); + }, + separatorBuilder: (context, index) { + return Column( + children: [ + Divider( + color: Colors.grey[300], + thickness: 2.0, + ), + ], + ); + }, + itemCount: model.notifications.length + 1), + ), ); } } diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 9e650966..c90a317a 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -76,7 +76,7 @@ class _LandingPagePharmacyState extends State { children: [ PharmacyPage(), PharmacyCategorisePage(), - PharmacyProfilePage(), + PharmacyProfilePage(moveToOrder: false), CartOrderPage(changeTab: changeCurrentTab), ], ), diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index 9e164c09..a463fc00 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -46,6 +46,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt Widget build(BuildContext context) { return AppScaffold( isShowAppBar: false, + isShowDecPage: false, body: SafeArea( child: Container( decoration: BoxDecoration(color: Colors.grey[700]), diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 5a47ec3b..3a5b124b 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -1,13 +1,17 @@ +import 'dart:collection'; + +import 'package:device_calendar/device_calendar.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -18,21 +22,34 @@ import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:jiffy/jiffy.dart'; import 'package:provider/provider.dart'; -class PrescriptionDetailsPage extends StatelessWidget { +class PrescriptionDetailsPage extends StatefulWidget { final PrescriptionReport prescriptionReport; final Prescriptions prescriptions; PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); + @override + _PrescriptionDetailsPageState createState() => _PrescriptionDetailsPageState(); +} + +class _PrescriptionDetailsPageState extends State { + bool hasReminder = false; + + @override + void initState() { + checkIfHasReminder(); + super.initState(); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, showNewAppBar: true, - backgroundColor: Color(0xffF8F8F8), showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).prescriptions, body: Column( @@ -40,18 +57,18 @@ class PrescriptionDetailsPage extends StatelessWidget { children: [ DoctorHeader( headerModel: HeaderModel( - prescriptions.doctorName, - prescriptions.doctorID, - prescriptions.doctorImageURL, - prescriptions.speciality, + widget.prescriptions.doctorName, + widget.prescriptions.doctorID, + widget.prescriptions.doctorImageURL, + widget.prescriptions.speciality, "", - prescriptions.name, - DateUtil.convertStringToDate(prescriptions.appointmentDate), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), - prescriptions.nationalityFlagURL, - prescriptions.doctorRate, - prescriptions.actualDoctorRate, - prescriptions.noOfPatientsRate, + widget.prescriptions.name, + DateUtil.convertStringToDate(widget.prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.prescriptions.appointmentDate)), + widget.prescriptions.nationalityFlagURL, + widget.prescriptions.doctorRate, + widget.prescriptions.actualDoctorRate, + widget.prescriptions.noOfPatientsRate, "", ), isNeedToShowButton: false, @@ -102,7 +119,7 @@ class PrescriptionDetailsPage extends StatelessWidget { children: [ Container( child: Image.network( - prescriptionReport.imageSRCUrl, + widget.prescriptionReport.imageSRCUrl, fit: BoxFit.cover, width: 48, height: 49, @@ -123,13 +140,15 @@ class PrescriptionDetailsPage extends StatelessWidget { ], ), onTap: () { - showZoomImageDialog(context, prescriptionReport.imageSRCUrl); + showZoomImageDialog(context, widget.prescriptionReport.imageSRCUrl); }, ), SizedBox(width: 12), Expanded( child: Text( - (prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, + (widget.prescriptionReport.itemDescription.isNotEmpty ? widget.prescriptionReport.itemDescription : widget.prescriptionReport.itemDescriptionN ?? '') + .toLowerCase() + .capitalizeFirstofEach, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), ) @@ -147,10 +166,10 @@ class PrescriptionDetailsPage extends StatelessWidget { ), TableRow( children: [ - Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), ], ), ]), @@ -159,7 +178,7 @@ class PrescriptionDetailsPage extends StatelessWidget { style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), ), Text( - prescriptionReport.remarks, + widget.prescriptionReport.remarks, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), ], @@ -182,8 +201,8 @@ class PrescriptionDetailsPage extends StatelessWidget { context, FadePage( page: PharmacyForPrescriptionsPage( - itemID: prescriptionReport.itemID, - prescriptionReport: prescriptionReport, + itemID: widget.prescriptionReport.itemID, + prescriptionReport: widget.prescriptionReport, ), ), ); @@ -195,54 +214,35 @@ class PrescriptionDetailsPage extends StatelessWidget { SizedBox(width: 10), Expanded( child: DefaultButton( - TranslationBase.of(context).addReminder, + hasReminder ? TranslationBase.of(context).cancelReminder : TranslationBase.of(context).addReminder, () { - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - - showReminderDialog( - context, - endDate, - "", - prescriptionReport.itemID.toString(), - "", - "", - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - onSuccess: () { - AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - }, - ); - return; - - showGeneralDialog( - barrierColor: Colors.black.withOpacity(0.5), - transitionBuilder: (context, a1, a2, widget) { - final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; - return Transform( - transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), - child: Opacity( - opacity: a1.value, - child: PrescriptionReminderDialog( - eventId: prescriptionReport.itemID.toString(), - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - startDate: startDate, - endDate: endDate, - location: prescriptionReport.remarks, - days: 1, - ), - ), - ); + if (hasReminder) { + cancelReminders(); + } else { + DateTime startDate = DateTime.now(); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + widget.prescriptionReport.days); + showReminderDialog( + context, + endDate, + "", + widget.prescriptionReport.itemID.toString(), + "", + "", + title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ", + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }, + onMultiDateSuccess: (int selectedIndex) { + setCalender(context, widget.prescriptionReport.itemID.toString(), selectedIndex); }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); + ); + return; + } }, iconData: Icons.notifications_active, color: Color(0xffD02127), + fontSize: 13.0, //textColor: Color(0xff2B353E), ), ), @@ -253,4 +253,98 @@ class PrescriptionDetailsPage extends StatelessWidget { ), ); } + + checkIfHasReminder() async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30); + DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120); + + RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); + + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) { + Result> events = value; + events.data.forEach((element) { + if (element.title.contains(widget.prescriptionReport.itemDescriptionN)) + setState(() { + hasReminder = true; + }); + }); + }); + } + + cancelReminders() async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30); + DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120); + + RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); + + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) { + Result> events = value; + events.data.forEach((element) { + if (element.title.contains(widget.prescriptionReport.itemDescriptionN)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element); + }); + }); + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderCancelSuccess); + setState(() { + hasReminder = false; + }); + } + + setCalender(BuildContext context, String eventId, int reminderIndex) async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime actualDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0); //Time will start at 8:00 AM from starting date + if (widget.prescriptionReport?.frequencyNumber == null) widget.prescriptionReport.frequencyNumber = 1; //Some time frequency number is null so by default will be 2 + + int remainingDays = widget.prescriptionReport.days - (Jiffy(DateTime.now()).diff(DateUtil.convertStringToDate(widget.prescriptionReport.orderDate), Units.DAY)); + + GifLoaderDialogUtils.showMyDialog(context); + + for (int i = 0; i < remainingDays; i++) { + //event for number of days. + for (int j = 0; j < widget.prescriptionReport.frequencyNumber ?? 1; j++) { + // event for number of times per day. + if (j != 0) { + actualDate.add(new Duration(hours: 8)); // 8 hours addition for daily dose. + } + //Time subtraction from actual reminder time. like before 30, or 1 hour. + if (reminderIndex == 0) { + // Before 30 mints + actualDate = Jiffy(actualDate).subtract(minutes: 30); + // dateTime.add(new Duration(minutes: -30)); + } else if (reminderIndex == 1) { + // Before 1 hour + // dateTime.add(new Duration(minutes: -60)); + actualDate = Jiffy(actualDate).subtract(hours: 1); + } else if (reminderIndex == 2) { + // Before 1 hour and 30 mints + // dateTime.add(new Duration(minutes: -90)); + actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30); + } else if (reminderIndex == 3) { + // Before 2 hours + // dateTime.add(new Duration(minutes: -120)); + actualDate = Jiffy(actualDate).subtract(hours: 2); + } + calendarUtils + .createOrUpdateEvent( + title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ", + scheduleDateTime: actualDate, + eventId: eventId + (i.toString() + j.toString()), //event id with varitions + ) + .then((value) {}); + actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0); + } + actualDate = Jiffy(actualDate).add(days: 1); + print(actualDate); + } + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + GifLoaderDialogUtils.hideDialog(context); + setState(() { + hasReminder = true; + }); + } } diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 0e627a95..a9be08d2 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -243,6 +243,8 @@ class PrescriptionItemsPage extends StatelessWidget { doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, days: model.prescriptionReportEnhList[index].days, itemID: model.prescriptionReportEnhList[index].itemID, + orderDate: model.prescriptionReportEnhList[index].orderDate, + startDate: model.prescriptionReportEnhList[index].startDate, remarks: model.prescriptionReportEnhList[index].remarks); Navigator.push( context, diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index ac497ba4..7b089935 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -1,6 +1,7 @@ import 'package:collection/collection.dart'; import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -149,8 +150,7 @@ class _syncHealthDataButtonState extends State { } } date = DateUtil.convertDateToString(date); - Med_InsertTransactionsInputsList.add( - healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList.add(healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++)); }); } } @@ -197,27 +197,17 @@ class _syncHealthDataButtonState extends State { // to convert from meter to km totalDistance += (element['Value'] * 0.001); } else if (element['MedCategoryID'] == 3) { - print("HeartRate"); + // print("HeartRate"); MedCategoryID = 3; counter++; totalHeartRate += element['Value']; } else if (element['MedCategoryID'] == 4) { print("sleeeeep"); sleepDataList.add(new healthData( - MedCategoryID: 4, - MedSubCategoryID: element['MedSubCategoryID'], - MachineDate: DateUtil.convertDateToString(date), - Value: element['Value'], - TransactionsListID: TransactionsListID++, - Notes: "")); + MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add(new healthData( - MedCategoryID: 4, - MedSubCategoryID: element['MedSubCategoryID'], - MachineDate: DateUtil.convertDateToString(date), - Value: element['Value'], - TransactionsListID: TransactionsListID++, - Notes: "")); + MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); } // else if(element['MedCategoryID'] == 8){ // @@ -235,27 +225,16 @@ class _syncHealthDataButtonState extends State { } Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalSteps, TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalDistance, TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++)); }); addInsertTransactionsInputsList(); GifLoaderDialogUtils.hideDialog(context); - - // AlertDialogBox dialog = new AlertDialogBox( - // context: context, - // confirmMessage: TranslationBase.of(context).alreadySynced, - // okText: TranslationBase.of(context).ok, - // okFunction: () => { - // AlertDialogBox.closeAlertDialog(context), - // }, - // ); - - // dialog.showAlertDialog(context); } addInsertTransactionsInputsList() { @@ -264,7 +243,7 @@ class _syncHealthDataButtonState extends State { SmartWatchIntegrationService service = new SmartWatchIntegrationService(); service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res); + AppToast.showSuccessToast(message: TranslationBase.of(context).syncSuccess); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); diff --git a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart index 17c88cc8..c4d0ce6e 100644 --- a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart +++ b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart @@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:expandable/expandable.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:html/parser.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -45,185 +45,171 @@ class OfferAndPackagesDetailState extends State { isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - color: Colors.white, - padding: const EdgeInsets.all(21.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(15.0), - child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill), - ), - ), - Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 21.0), - child: Text(widget.itemModel.name, maxLines: 1, style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -1.14))), - Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0), - child: Text(widget.itemModel.shortDescription, - maxLines: 2, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor), overflow: TextOverflow.clip)), - Row( + body: Column( + children: [ + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), children: [ Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 12.0), - child: RatingBar.readOnly( - initialRating: 4.5, - size: 18.0, - filledColor: Color(0XFFD02127), - emptyColor: Color(0XFFD02127), - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, + color: Colors.white, + padding: const EdgeInsets.all(21.0), + child: AspectRatio( + aspectRatio: 333 / 333, + child: ClipRRect( + borderRadius: BorderRadius.circular(15.0), + child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill), + ), ), ), - ], - ), - Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 18.0), - width: double.infinity, - height: 50.0, - child: ListView.separated( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: widget.itemModel.storeNames.length, - separatorBuilder: (context, index) { - return mWidth(5.0); - }, - itemBuilder: (BuildContext context, int index) { - return contactButton(widget.itemModel.storeNames[index].toString()); - }, - ), - ), - Container( - padding: const EdgeInsets.only(top: 18.0), - child: ExpandableNotifier( - initialExpanded: true, - child: Container( - color: Colors.white, + Padding( + padding: const EdgeInsets.all(21.0), child: Column( - children: [ - ScrollOnExpand( - scrollOnExpand: true, - scrollOnCollapse: false, - child: ExpandablePanel( - hasIcon: false, - theme: const ExpandableThemeData( - headerAlignment: ExpandablePanelHeaderAlignment.center, - tapBodyToCollapse: true, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.itemModel.name, + maxLines: 1, + style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, color: Color(0xff2E303A), letterSpacing: -1.14), + ), + Text( + widget.itemModel.shortDescription, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -.56), + ), + SizedBox(height: 9), + Row( + children: [ + RatingBar.readOnly( + initialRating: 4.5, + // todo ask haroon about rating value + size: 18.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), - header: Padding( - padding: const EdgeInsets.only(top: 20, bottom: 20, left: 21, right: 21), - child: InkWell( + ], + ), + SizedBox(height: 16), + SizedBox( + height: 34, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemCount: widget.itemModel.storeNames.length, + separatorBuilder: (context, index) { + return mWidth(5.0); + }, + itemBuilder: (BuildContext context, int index) { + return contactButton(widget.itemModel.storeNames[index].toString()); + }, + ), + ), + ], + ), + ), + ExpandableNotifier( + initialExpanded: true, + child: Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 21), + child: Column( + children: [ + ScrollOnExpand( + scrollOnExpand: true, + scrollOnCollapse: false, + child: ExpandablePanel( + hasIcon: false, + theme: const ExpandableThemeData( + headerAlignment: ExpandablePanelHeaderAlignment.center, + tapBodyToCollapse: true, + ), + header: InkWell( onTap: () { setState(() { expandFlag = !expandFlag; controller.expanded = expandFlag; }); }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).description, - maxLines: 1, - style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -1.14), - ), - ], + child: Padding( + padding: const EdgeInsets.all(21), + child: Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).description, + maxLines: 1, + style: TextStyle(fontSize: 19.0, color: Color(0xff2E303A), fontWeight: FontWeight.bold, letterSpacing: -1.14), + ), + ), + Icon( + expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + color: Color(0xff2E303A), ), - ), - Icon( - expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, - color: Color(0xff2E303A), - ), - ], + ], + ), ), ), - ), - builder: (_, collapsed, expanded) { - return Expandable( - controller: controller, - collapsed: collapsed, - expanded: Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, bottom: 21.0), + builder: (_, collapsed, expanded) { + return Expandable( + controller: controller, + collapsed: collapsed, + expanded: Padding( + padding: const EdgeInsets.only(bottom: 21, left: 21, right: 21), child: Text(parseHtmlString(widget.itemModel.fullDescription), - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor), overflow: TextOverflow.clip)), - theme: const ExpandableThemeData(crossFadePoint: 0), - ); - }, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: Color(0xff575757), + ), + overflow: TextOverflow.clip), + ), + theme: const ExpandableThemeData(crossFadePoint: 0), + ); + }, + ), ), - ), - ], + ], + ), ), ), - ), + ], ), - ], - ), - ), - bottomSheet: Container( - padding: const EdgeInsets.only(top: 16, bottom: 16, left: 21, right: 21), - color: Colors.white, - child: Row( - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if(widget.itemModel.hasDiscountsApplied) Container( - margin: const EdgeInsets.only(top: 0.0), - child: Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, - style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600, letterSpacing: -0.6, decoration: TextDecoration.lineThrough, color: CustomColors.grey2))), - Container( - margin: const EdgeInsets.only(top: 0.0), - child: Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, - style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), - ], + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.itemModel.hasDiscountsApplied) + Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600, letterSpacing: -0.6, decoration: TextDecoration.lineThrough, color: CustomColors.grey2)), + Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -0.76, color: Color(0xff2B353E))), + ], + ), ), - ), - SizedBox(width: 8), - Expanded( - child: SizedBox( - height: 43, - width: double.infinity, - child: FlatButton( - onPressed: () { - // onCartClick(); + SizedBox(width: 8), + Expanded( + child: DefaultButton( + TranslationBase.of(context).addToCart, + () { widget.onCartClick(widget.itemModel); }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: SvgPicture.asset("assets/images/new/add-to-cart.svg", color: Colors.white), - ), - Container( - child: Text( - TranslationBase.of(context).addToCart, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), - ), - ), - ], - ), - color: const Color(0xffD02127), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), + svgIcon: "assets/images/new/add_to_cart.svg", + isTextExpanded: false, ), ), - ), - ], - ), + ], + ).insideContainer + ], ), ), ); @@ -236,18 +222,26 @@ class OfferAndPackagesDetailState extends State { } Widget contactButton(String title) { - return SizedBox( - height: 32, - width: 80.0, - child: FlatButton( - onPressed: () {}, + return Container( + height: 34, + padding: EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 9), + alignment: Alignment.center, + decoration: BoxDecoration( color: Colors.white, - shape: StadiumBorder(side: BorderSide(color: CustomColors.devider, width: 1)), - child: Text( - title, - style: TextStyle(fontSize: 10, letterSpacing: -0.4, color: CustomColors.textColor), - maxLines: 1, + border: Border.all(color: Color(0xffEAEAEA), width: 1), + borderRadius: BorderRadius.all( + Radius.circular(36.0), + ), + ), + child: Text( + title, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + color: Color(0xff535353), ), + maxLines: 1, ), ); } diff --git a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart index 4b42774b..f4743d2c 100644 --- a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/ResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart'; @@ -22,7 +23,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; dynamic languageID; const _columnCount = 1; @@ -115,195 +115,122 @@ class _PackagesCartPageState extends State with AfterLayoutMix ? Column( children: [ Expanded( - child: StaggeredGridView.countBuilder( - crossAxisCount: (_columnCount * _columnCount), - itemCount: viewModel.cartItemList.length, - itemBuilder: (BuildContext context, int index) { - var item = viewModel.cartItemList[index]; - return Dismissible( - key: Key(index.toString()), - direction: DismissDirection.startToEnd, - background: _cartItemDeleteContainer(), - secondaryBackground: _cartItemDeleteContainer(), - confirmDismiss: (direction) async { - bool status = await viewModel.service.deleteProductFromCart(item.id, context: context, showLoading: false); - return status; - }, - onDismissed: (direction) { - viewModel.cartItemList.removeAt(index); + child: ListView.separated( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + itemBuilder: (cxt, index) { + var item = viewModel.cartItemList[index]; + return PackagesCartItemCard( + itemModel: item, + viewModel: viewModel, + getCartItems: fetchData, + shouldStepperChangeApply: (apply, total) async { + var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply); + ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) { + utils.Utils.showErrorToast(error); + }); + if (response.status) { + fetchData(); + } + return response.status ?? false; }, - child: PackagesCartItemCard( - itemModel: item, - viewModel: viewModel, - getCartItems: fetchData, - shouldStepperChangeApply: (apply, total) async { - var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply); - ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) { - utils.Utils.showErrorToast(error); - }); - if (response.status) { - fetchData(); - } - return response.status ?? false; - }, - )); - }, - staggeredTileBuilder: (int index) => StaggeredTile.fit(_columnCount), - mainAxisSpacing: 0, - crossAxisSpacing: 10, - ), + ); + }, + separatorBuilder: (cxt, index) => SizedBox(height: 12), + itemCount: viewModel.cartItemList.length), ), Container( - height: 0.25, - color: Theme.of(context).primaryColor, + height: 1, + color: Color(0xffEFEFEF), ), - ], - ) - : getNoDataWidget(context), - bottomSheet: viewModel.cartItemList.length > 0 - ? Container( - padding: EdgeInsets.all(21.0), - width: double.infinity, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - margin: EdgeInsets.only(bottom: 12.0), - child: InkWell( - onTap: () => confirmSelectHospitalDialog(model.hospitals), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 50, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(color: CustomColors.devider), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - getHospitalName(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down), - ], - ), - ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0.0, 0.0, 20.0, 0.0), - child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600)), - ), - Container( - width: MediaQuery.of(context).size.width * 0.75, - margin: EdgeInsets.fromLTRB(0.0, 8.0, 20.0, 5.0), - child: getPaymentMethods(), - ), - Container( - margin: EdgeInsets.only(top: 14.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 24.0, - width: 24.0, - child: Checkbox( - value: _agreeTerms, - onChanged: (v) { - setState(() => _agreeTerms = v); - }), - ), - Expanded( - child: Text( - TranslationBase.of(context).iAcceptTermsConditions, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.textColor, letterSpacing: -0.48), - ), - ), - ], - ), - ), + if (viewModel.cartItemList.length > 0) Container( + padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15), + width: double.infinity, + color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 12, bottom: 3), - child: Row( - children: [ - Expanded( - child: _getNormalText(TranslationBase.of(context).patientShareToDo), - ), - Expanded( - child: _getNormalText(TranslationBase.of(context).sar + " " + (subtotal ?? 0.0).toStringAsFixed(2), isBold: true), - ) - ], + CommonDropDownView( + TranslationBase.of(context).hospital, + getHospitalName(), + () => confirmSelectHospitalDialog(model.hospitals), + ).withBorderedContainer, + SizedBox(height: 12), + Text( + TranslationBase.of(context).YouCanPayByTheFollowingOptions, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, ), ), - mDivider(Colors.grey[200]), - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 3, bottom: 3), - child: Row( - children: [ - Expanded( - child: _getNormalText(TranslationBase.of(context).patientTaxToDo), - ), - Expanded( - child: _getNormalText(TranslationBase.of(context).sar + ' ' + (tax ?? 0.0).toStringAsFixed(2), isBold: true), - ) - ], - ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.75, + child: getPaymentMethods(), ), - mDivider(Colors.grey[200]), - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 3, bottom: 3), + Padding( + padding: EdgeInsets.only(top: 12.0, bottom: 12), child: Row( + mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo), + SizedBox( + height: 16.0, + width: 16.0, + child: Checkbox( + value: _agreeTerms, + onChanged: (v) { + setState(() => _agreeTerms = v); + }), ), + SizedBox(width: 10), Expanded( - child: _getNormalText(TranslationBase.of(context).sar + ' ' + (total ?? 0.0).toStringAsFixed(2), isBold: true, isTotal: true), - ) + child: Text( + TranslationBase.of(context).iAcceptTermsConditions, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.textColor, letterSpacing: -0.48), + ), + ), ], ), ), - ], - ), - ), - Container( - padding: EdgeInsets.only(top: 21, bottom: 21), - child: DefaultButton( - TranslationBase.of(context).payNow, - (_agreeTerms && _selectedHospital != null) - ? () { - Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { - setState(() {}); - }))).then((value) { - print(value); - if (value != null) { - _selectedPaymentMethod = value; - _selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": value}; - onPayNowClick(); + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _amountView(TranslationBase.of(context).patientShareToDo, (subtotal ?? 0.0).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true), + mDivider(Color(0xffEFEFEF)), + _amountView(TranslationBase.of(context).patientTaxToDo, (tax ?? 0.0).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true), + mDivider(Color(0xffEFEFEF)), + _amountView(TranslationBase.of(context).patientShareTotalToDo, (total ?? 0.0).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true, isTotal: true), + ], + ), + SizedBox(height: 12), + DefaultButton( + TranslationBase.of(context).payNow, + (_agreeTerms && _selectedHospital != null) + ? () { + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }))).then((value) { + print(value); + if (value != null) { + _selectedPaymentMethod = value; + _selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": value}; + onPayNowClick(); + } + }); } - }); - } - : null, - color: CustomColors.green, - disabledColor: CustomColors.grey2, + : null, + color: CustomColors.green, + disabledColor: CustomColors.grey2, + ), + ], ), - ), - ], - ), + ) + ], ) - : SizedBox(), + : getNoDataWidget(context), ); }, ); @@ -407,6 +334,19 @@ class _PackagesCartPageState extends State with AfterLayoutMix // )), // ); // } +_amountView(String title, String value, {bool isBold = false, bool isTotal = false}) { + return Padding( + padding: const EdgeInsets.only(top: 10, bottom: 10), + child: Row(children: [ + Expanded( + child: _getNormalText(title), + ), + Expanded( + child: _getNormalText(value, isBold: isBold, isTotal: isTotal), + ), + ]), + ); +} _getNormalText(text, {bool isBold = false, bool isTotal = false}) { return Text( @@ -416,10 +356,10 @@ _getNormalText(text, {bool isBold = false, bool isTotal = false}) { ? isTotal ? 16 : 12 - : 10, + : 11, letterSpacing: -0.5, - color: isBold ? Colors.black : Colors.grey[700], - fontWeight: FontWeight.w600, + color: isBold ? Color(0xff2E303A) : Color(0xff575757), + fontWeight: isTotal ? FontWeight.bold : FontWeight.w600, ), ); } diff --git a/lib/pages/packages_offers/OfferAndPackagesPage.dart b/lib/pages/packages_offers/OfferAndPackagesPage.dart index d323b36d..2573204e 100644 --- a/lib/pages/packages_offers/OfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesPage.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOff import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart'; @@ -19,13 +20,13 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class PackagesHomePage extends StatefulWidget { @@ -99,148 +100,88 @@ class _PackagesHomePageState extends State { appBarTitle: TranslationBase.of(context).offerAndPackages, isShowAppBar: true, isPharmacy: false, + backgroundColor: Color(0xfff7f7f7), showPharmacyCart: false, isOfferPackages: true, showOfferPackagesCart: false, isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, - body: SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: projectViewModel.isArabic ? const EdgeInsets.only(top: 21, right: 21, bottom: 21) : const EdgeInsets.only(top: 21, left: 21, bottom: 21), - child: Column( - children: [ - inputWidget(TranslationBase.of(context).search, "", _searchTextController, isInputTypeNum: false), - SizedBox( - height: 10, - ), - InkWell( - onTap: () => showClinicSelectionList(), - child: Container( - padding: EdgeInsets.all(12), - margin: projectViewModel.isArabic ? const EdgeInsets.only(left: 21) : const EdgeInsets.only(right: 21), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - selectedClinic != null ? selectedClinic.name : TranslationBase.of(context).browseOffers, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down), - ], - ), - ), - ), - SizedBox( - height: 20, - ), - Container( - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.8, - child: ListView.separated( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: viewModel.bestSellerList.length, - separatorBuilder: (context, index) { - return mWidth(9.0); - }, - itemBuilder: (BuildContext context, int index) { - return PackagesItemCard( - itemModel: viewModel.bestSellerList[index], - onCartClick: onProductCartClick, - ); - }, - ), - ), - SizedBox( - height: 21, - ), - // // Best Seller Horizontal Scrollable List - Container( - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.8, - child: ListView.separated( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: viewModel.latestOffersList.length, - separatorBuilder: (context, index) { - return mWidth(9.0); - }, - itemBuilder: (BuildContext context, int index) { - return PackagesItemCard( - itemModel: viewModel.latestOffersList[index], - onCartClick: onProductCartClick, - ); - }, - ), - ), - ], - ), - ), - SizedBox( - height: 50.0, - ) - ], - ), - ), - bottomSheet: Container( - color: Colors.white, - padding: const EdgeInsets.all(12.0), - child: SizedBox( - height: 43, - width: double.infinity, - child: FlatButton( - onPressed: () { - onCartClick(); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, + body: Column( + children: [ + Expanded( + child: ListView( + padding: EdgeInsets.only(top: 21, bottom: 21), + physics: BouncingScrollPhysics(), children: [ + inputWidget(TranslationBase.of(context).search, "", _searchTextController, isInputTypeNum: false), + SizedBox(height: 12), Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: SvgPicture.asset("assets/images/new/cart.svg"), - // child: Icon( - // Icons.add_shopping_cart_rounded, - // size: 30.0, - // color: Colors.white, - // ), + padding: const EdgeInsets.only(left: 21, right: 21), + child: CommonDropDownView(TranslationBase.of(context).browseOffers, selectedClinic?.name ?? TranslationBase.of(context).selectClinic, () => showClinicSelectionList()) + .withBorderedContainer, + ), + SizedBox(height: 12), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.8, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(left: 21, right: 21), + itemCount: viewModel.bestSellerList.length, + separatorBuilder: (context, index) { + return mWidth(9.0); + }, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemModel: viewModel.bestSellerList[index], + onCartClick: onProductCartClick, + ); + }, + ), ), + SizedBox(height: 12), Container( - child: Text( - TranslationBase.of(context).myCart, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.8, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(left: 21, right: 21), + itemCount: viewModel.latestOffersList.length, + separatorBuilder: (context, index) { + return mWidth(9.0); + }, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemModel: viewModel.latestOffersList[index], + onCartClick: onProductCartClick, + ); + }, ), ), ], ), - color: const Color(0xffD02127), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), ), - ), + DefaultButton( + TranslationBase.of(context).myCart, + onCartClick, + svgIcon: "assets/images/new/cart.svg", + isTextExpanded: false, + count: viewModel?.service?.customer?.shoppingCartItems?.length ?? 0, + ).insideContainer + ], ), ); }, ); } + int _selectedClinic = -1; + showClinicSelectionList() async { var clinics = viewModel.service.categoryList; if (clinics.isEmpty) { @@ -256,9 +197,10 @@ class _PackagesHomePageState extends State { context: context, child: RadioSelectionDialog( listData: list, - selectedIndex: 0, + selectedIndex: _selectedClinic, isScrollable: true, onValueSelected: (index) async { + _selectedClinic = index; selectedClinic = clinics[index]; var clinicProducts = await viewModel.service.getAllProducts(request: OffersProductsRequestModel(categoryId: selectedClinic.id), context: context, showLoading: true); if (clinicProducts.isNotEmpty) @@ -348,7 +290,7 @@ class _PackagesHomePageState extends State { {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - margin: projectViewModel.isArabic ? const EdgeInsets.only(left: 21) : const EdgeInsets.only(right: 21), + margin: const EdgeInsets.only(left: 21, right: 21), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 461e837c..5a917897 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -689,150 +689,159 @@ class _ParentCategorisePageState extends State { ), model.parentProducts.isNotEmpty ? styleOne == true - ? model.state != ViewState.BusyLocal - ? Container( - height: - model.parentProducts.length * - MediaQuery.of(context) - .size - .height * - 0.15, - 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: InkWell( - 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, + ? Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.15, + 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: InkWell( + 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), ), - 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, + color: Colors.white, + ), + padding: EdgeInsets + .symmetric( + horizontal: 0), + width: MediaQuery.of( + context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Stack( children: [ - Stack( - children: [ - if (model - .parentProducts[index] - .discountName != - null) - RotatedBox( - quarterTurns: - 4, + 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: - Container( - decoration: - BoxDecoration(), - child: - Padding( - padding: - EdgeInsets.only( - right: 5.0, - top: 20.0, - bottom: 5.0, - ), - child: - Texts( - TranslationBase.of(context).offers.toUpperCase(), - color: Colors.red, - fontSize: 13.0, - fontWeight: FontWeight.w900, - ), - ), - transform: - new Matrix4.rotationZ(5.837200), + Texts( + TranslationBase.of(context) + .offers + .toUpperCase(), + color: + Colors.red, + fontSize: + 13.0, + fontWeight: + FontWeight.w900, ), ), - 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, - ), + 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 @@ -882,280 +891,67 @@ class _ParentCategorisePageState extends State { // .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( - projectViewModel.isArabic - ? model.parentProducts[index].namen - : 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), - RatingBar - .readOnly( - initialRating: - model.parentProducts[index].approvedRatingSum.toDouble(), - size: - 15.0, - filledColor: - Colors.yellow[700], - emptyColor: - Colors.grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons.star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: - true, - fontSize: - 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], - ), - ), - ], - ), - ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.parentProducts[ - index]), - )), - }, - )); - }, - ), - ) - : Container( - height: - model.parentProducts.length * - MediaQuery.of(context) - .size - .height * - 0.122, - child: ListView.builder( - physics: - NeverScrollableScrollPhysics(), - itemCount: model - .parentProducts.length, - itemBuilder: - (BuildContext context, - int index) { - return InkWell( - child: 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: model - .parentProducts[ - index] - .images - .isNotEmpty - ? Image - .network( - model.parentProducts[index].images[0].thumb, - fit: BoxFit.contain, - height: 70, - ) - : Text( - TranslationBase.of(context).noImage), - ), - ], - ), - Column( - children: [ - Container( - width: model.parentProducts[index].rxMessage != - null - ? MediaQuery.of(context).size.width / - 5.3 - : 0, - padding: - EdgeInsets.all( - 4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), - ), - child: model.parentProducts[index].rxMessage != - null - ? Texts( - projectProvider.isArabic ? model.parentProducts[index].rxMessagen : model.parentProducts[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - : Texts( - ""), -// 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: 0, + horizontal: 6, vertical: 0, ), child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, crossAxisAlignment: CrossAxisAlignment .start, children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.635, - child: - Texts( - projectViewModel - .isArabic - ? model - .parentProducts[ - index] - .namen - : model + 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] - .name, - regular: - true, - fontSize: - 13.2, - fontWeight: - FontWeight - .w500, - maxLines: - 5, + .discountName, + regular: + true, + color: + Colors.white, + fontSize: + 10.4, + ), + ), ), - ), - SizedBox( - height: 8.0, + Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : model + .parentProducts[index] + .name, + regular: + true, + fontSize: + 12, + fontWeight: + FontWeight + .w700, ), Padding( padding: const EdgeInsets @@ -1174,11 +970,11 @@ class _ParentCategorisePageState extends State { ), Row( children: [ -// StarRating( -// totalAverage: model.parentProducts[index].approvedRatingSum > 0 -// ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() -// : 0, -// forceStars: true), +// StarRating( +// totalAverage: model.parentProducts[index].approvedRatingSum > 0 +// ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() +// : 0, +// forceStars: true), RatingBar .readOnly( initialRating: model @@ -1214,11 +1010,258 @@ class _ParentCategorisePageState extends State { ], ), ), - widget.authenticatedUserObject - .isLogin - ? Container( - child: IconButton( - icon: Icon( + ], + ), + ), + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + )); + }, + ), + ) + : Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.122, + child: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + itemCount: + model.parentProducts.length, + itemBuilder: + (BuildContext context, + int index) { + return InkWell( + child: 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: model + .parentProducts[ + index] + .images + .isNotEmpty + ? Image + .network( + model + .parentProducts[index] + .images[0] + .thumb, + fit: BoxFit + .contain, + height: + 70, + ) + : Text(TranslationBase.of( + context) + .noImage), + ), + ], + ), + Column( + children: [ + Container( + width: model.parentProducts[index].rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5.3 + : 0, + padding: + EdgeInsets + .all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(6)), + ), + child: model.parentProducts[index] + .rxMessage != + null + ? Texts( + projectProvider.isArabic + ? model.parentProducts[index].rxMessagen + : model.parentProducts[index].rxMessage, + color: + Colors.white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + : Texts(""), +// 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: 0, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( + context) + .size + .width * + 0.635, + child: Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : 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), + RatingBar + .readOnly( + initialRating: model + .parentProducts[ + index] + .approvedRatingSum + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: + Colors.grey[ + 500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons + .star, + emptyIcon: + Icons + .star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], + ), + ), + widget.authenticatedUserObject + .isLogin + ? Container( + child: + IconButton( + icon: + Icon( Icons .shopping_cart, size: @@ -1226,7 +1269,8 @@ class _ParentCategorisePageState extends State { color: CustomColors.green, ), - onPressed: () async { + onPressed: + () async { if (model.parentProducts[index].rxMessage == null) { GifLoaderDialogUtils.showMyDialog(context); @@ -1238,66 +1282,54 @@ class _ParentCategorisePageState extends State { AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } }), - ) - : Container(), - ], - ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.parentProducts[ - index]), - )), - }, - ); - }), - ) - : Padding( - padding: const EdgeInsets.all(12.0), - child: 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, + ) + : Container(), + ], ), ), - Padding( - padding: - const EdgeInsets.all( - 8.0), - child: Text( - TranslationBase.of( - context) - .noData, - // 'There is no data', - style: TextStyle( - fontSize: 30), - ), - ) - ], + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + ); + }), + ) + : Padding( + padding: const EdgeInsets.all(12.0), + child: 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( + TranslationBase.of(context) + .noData, + // 'There is no data', + style: + TextStyle(fontSize: 30), + ), + ) + ], ), - ) - : Center( - child: CircularProgressIndicator( - backgroundColor: Colors.white, - valueColor: - AlwaysStoppedAnimation( - Colors.grey[500], ), ), ) diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index 46c5e7a3..d0a112c6 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -31,7 +31,8 @@ class _ProductCheckTypeWidgetState extends State { ? widget.model.wishListList[index].product.namen : widget.model.wishListList[index].product.name, productPrice: widget.model.wishListList[index].subtotal, - productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + // productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + productRate: widget.model.wishListList[index].product.approvedRatingSum.toDouble(), approvedTotalReviews:widget.model.wishListList[index].product.approvedTotalReviews, productImage: widget.model.wishListList[index].product.images[0].src, productID: widget.model.wishListList[index].product.id, diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index c50399f8..df44c706 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -1,29 +1,25 @@ +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/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/pharmacy-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.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/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:http/http.dart'; import 'package:provider/provider.dart'; -import '../../../../locator.dart'; -import 'cart-order-preview.dart'; - class CartOrderPage extends StatefulWidget { final Function(int) changeTab; @@ -35,10 +31,13 @@ class CartOrderPage extends StatefulWidget { class _CartOrderPageState extends State { bool isLoading = true; + String customerId; + String customerGUID; @override void initState() { super.initState(); + getCustomer(); getData(); } @@ -64,8 +63,7 @@ class _CartOrderPageState extends State { body: NetworkBaseView( isLoading: isLoading, isLocalLoader: true, - child: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) + child: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? Container( height: height * 0.85, width: double.infinity, @@ -92,45 +90,34 @@ class _CartOrderPageState extends State { ), Container( child: ListView.builder( - itemCount: - model.cartResponse.shoppingCarts.length, + itemCount: model.cartResponse.shoppingCarts.length, scrollDirection: Axis.vertical, shrinkWrap: true, - physics: const AlwaysScrollableScrollPhysics (), + physics: ScrollPhysics(), + // physics: const AlwaysScrollableScrollPhysics(), itemBuilder: (context, index) { return ProductOrderItem( - item:model.cartResponse - .shoppingCarts[index], - changeCartItems:() async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.changeProductQuantity(model - .cartResponse.shoppingCarts[index]); - if (model.state != ViewState.Error) { - } - if (model.state == - ViewState.ErrorLocal) { + item: model.cartResponse.shoppingCarts[index], + changeCartItems: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.changeProductQuantity(model.cartResponse.shoppingCarts[index]); + if (model.state != ViewState.Error) {} + if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } - GifLoaderDialogUtils.hideDialog( - context); + GifLoaderDialogUtils.hideDialog(context); }, - - deleteCartItems:() async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state == - ViewState.ErrorLocal) { + deleteCartItems: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.deleteProduct(model.cartResponse.shoppingCarts[index]).then((value) { + if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } - GifLoaderDialogUtils.hideDialog( - context); + GifLoaderDialogUtils.hideDialog(context); }); - },model: model,); + }, + model: model, + ); }), ), const Divider( @@ -243,28 +230,47 @@ class _CartOrderPageState extends State { padding: const EdgeInsets.all(8.0), child: Text( TranslationBase.of(context).noData, -// 'There is no data', style: TextStyle(fontSize: 30), ), - ) + ), + Padding( + padding: const EdgeInsets.fromLTRB(60.0, 8.0, 60.0, 0.0), + child: DefaultButton( + TranslationBase.of(context).ordersDashboard, + () { + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + }, + color: Colors.green, + ), + ), ], ), ), ), bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, + height: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? height * 0.15 : 0, color: Colors.white, child: OrderBottomWidget(model.addresses, height, model, isLoading), ), ); } + getCustomer() async { + String custID; + String custGUID; + custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + custGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + setState(() { + customerId = custID; + customerGUID = custGUID; + }); + print("customer Id is" + customerId); + print("customer GUID is" + customerGUID); + return customerId; + } + void getData() async { - await Provider.of(context, listen: false) - .getShoppingCart(); + await Provider.of(context, listen: false).getShoppingCart(); setState(() { isLoading = false; }); @@ -290,8 +296,7 @@ class _OrderBottomWidgetState extends State { Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - return ! widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || - widget.model.cartResponse.shoppingCarts.length == 0) + return !widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || widget.model.cartResponse.shoppingCarts.length == 0) ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -338,8 +343,7 @@ class _OrderBottomWidgetState extends State { padding: EdgeInsets.symmetric(horizontal: 4), margin: const EdgeInsets.symmetric(vertical: 4), child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, + TranslationBase.of(context).pharmacyServiceTermsCondition, fontSize: 13, color: Colors.grey.shade800, fontWeight: FontWeight.normal, @@ -347,10 +351,7 @@ class _OrderBottomWidgetState extends State { ), ), InkWell( - onTap: () => { - Navigator.push( - context, FadePage(page: PharmacyTermsConditions())) - }, + onTap: () => {Navigator.push(context, FadePage(page: PharmacyTermsConditions()))}, child: Container( child: Icon( Icons.info, @@ -376,8 +377,7 @@ class _OrderBottomWidgetState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0), child: Row( children: [ Texts( @@ -386,8 +386,7 @@ class _OrderBottomWidgetState extends State { fontWeight: FontWeight.bold, ), Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), + padding: const EdgeInsets.symmetric(horizontal: 4), child: Texts( "${TranslationBase.of(context).inclusiveVat}", fontSize: 8, @@ -409,33 +408,16 @@ class _OrderBottomWidgetState extends State { ), RaisedButton( onPressed: isAgree -// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { if (widget.model.isCartItemsOutOfStock()) - { - // Toast msg - AppToast.showErrorToast( - message: TranslationBase.of(context) - .outOfStockMsg) - } + {AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)} else - { - _navigateToAddressPage(widget - .model.user.patientIdentificationNo) - // Navigator.push( - // context, - // FadePage( - // page: - // OrderPreviewPage(widget.addresses))) - } + {_navigateToAddressPage(widget.model.user.patientIdentificationNo)} } : null, child: new Text( "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: - isAgree ? Colors.white : Colors.grey.shade300, - fontSize: 14), + style: new TextStyle(color: isAgree ? Colors.white : Colors.grey.shade300, fontSize: 14), ), color: Color(0xFF4CAF50), disabledColor: Color(0xFF848484), @@ -459,8 +441,7 @@ class _OrderBottomWidgetState extends State { if (result != null) { GifLoaderDialogUtils.showMyDialog(context); var address = result; - widget.model.paymentCheckoutData.address = - Addresses.fromJson(address.toJson()); + widget.model.paymentCheckoutData.address = Addresses.fromJson(address.toJson()); await widget.model.getInformationsByAddress(identificationNo); await widget.model.getShoppingCart(); // widget.changeMainState(); diff --git a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart index cdd26ddc..5d48fe1f 100644 --- a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart @@ -1,24 +1,8 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -33,39 +17,42 @@ class LakumWidget extends StatefulWidget { class _LakumWidgetState extends State { TextEditingController _pointsController = new TextEditingController(); + bool useLakumWidgets = false; @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); + _pointsController.text = widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString(); 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, + Row( + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: useLakumWidgets, + onChanged: (bool value) { + setState(() { + useLakumWidgets = value; + print(useLakumWidgets); + }); + }, ), - ], - ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), + ], ), Expanded( child: Container( @@ -74,110 +61,93 @@ class _LakumWidgetState extends State { 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)), + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, ), - disabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.black, width: 0.4), - gapPadding: 0, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) ), - ), - 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, + ], ), ), ], ), + // 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, + // ), + // ), + // ], + // ), ), ), ], diff --git a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart index 6eee6528..1931f3fa 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -1,9 +1,13 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; @@ -35,8 +39,7 @@ class PaymentBottomWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( - margin: - EdgeInsets.symmetric(horizontal: 0, vertical: 4), + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 4), child: Row( children: [ Texts( @@ -46,8 +49,7 @@ class PaymentBottomWidget extends StatelessWidget { color: Color(0xff929295), ), Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), + padding: const EdgeInsets.symmetric(horizontal: 4), child: Texts( "${TranslationBase.of(context).inclusiveVat}", fontSize: 8, @@ -76,26 +78,22 @@ class PaymentBottomWidget extends StatelessWidget { width: 1, ), ), - onPressed: (orderPreviewViewModel - .paymentCheckoutData.address != - null && - orderPreviewViewModel - .paymentCheckoutData.paymentOption != - null) + onPressed: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? () async { + GifLoaderDialogUtils.showMyDialog(context); await model.makeOrder(); if (model.state == ViewState.Idle) { - AppToast.showSuccessToast( - message: TranslationBase.of(context).compeleteOrderMsg - // "Order has been placed successfully!!" - ); - openPayment( - model.orderListModel[0], model.authenticatedUserObject.user); + AppToast.showSuccessToast(message: TranslationBase.of(context).compeleteOrderMsg); + GifLoaderDialogUtils.hideDialog(context); + openPayment(model.orderListModel[0], model.authenticatedUserObject.user); } else { AppToast.showErrorToast(message: model.error); } - Navigator.pop(context); - Navigator.pop(context); + navigateToCartPage(); + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); } : null, child: Padding( @@ -103,34 +101,14 @@ class PaymentBottomWidget extends StatelessWidget { child: new Text( "${TranslationBase.of(context).proceedPay}", style: new TextStyle( - color: (orderPreviewViewModel - .paymentCheckoutData.address != - null && - orderPreviewViewModel.paymentCheckoutData - .paymentOption != - null) - ? Colors.white - : Colors.grey.shade400, + color: + (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.white : Colors.grey.shade400, fontWeight: FontWeight.bold, fontSize: 12), ), ), - color: - (orderPreviewViewModel.paymentCheckoutData.address != - null && - orderPreviewViewModel - .paymentCheckoutData.paymentOption != - null) - ? Colors.green - : Color(0xff929295), - disabledColor: - (orderPreviewViewModel.paymentCheckoutData.address != - null && - orderPreviewViewModel - .paymentCheckoutData.paymentOption != - null) - ? Colors.green - : Color(0xff929295), + color: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.green : Color(0xff929295), + disabledColor: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.green : Color(0xff929295), ), ), ], @@ -144,20 +122,10 @@ class PaymentBottomWidget extends StatelessWidget { OrderDetailModel order, AuthenticatedUser authenticatedUser, ) { - browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); - browser.openPharmacyPaymentBrowser( - order, - order.orderTotal, - 'ePharmacy Order', - order.id, - order.billingAddress.email, - order.customValuesXml, - "${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", - authenticatedUser.patientID, - authenticatedUser, - browser); + browser.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id, order.billingAddress.email, order.customValuesXml, + "${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser); } onBrowserLoadStart(String url) { @@ -181,19 +149,20 @@ class PaymentBottomWidget extends StatelessWidget { }); } + navigateToCartPage() { + Navigator.pushAndRemoveUntil(locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 0)), (Route r) => false); + } + onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); if (isPaymentMade) { - AppToast.showSuccessToast( - message: "شكراً\nPayment status for your order is Paid"); - Navigator.pop(context); - Navigator.pop(context); + AppToast.showSuccessToast(message: "شكراً\nPayment status for your order is Paid"); + // Navigator.pop(context); + // Navigator.pop(context); } else { - AppToast.showErrorToast( - message: - "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); - Navigator.pop(context); - Navigator.pop(context); + AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); + // Navigator.pop(context); + // Navigator.pop(context); } } } diff --git a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart index a1634e21..bf51f8e5 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -189,9 +189,10 @@ class _SelectAddressWidgetState extends State { model.paymentCheckoutData.shippingOption == null ? "" : model.paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight" - ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" + ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, + width: 100, ), margin: EdgeInsets.symmetric(horizontal: 8), ), diff --git a/lib/pages/pharmacies/screens/lacum-transfer-page.dart b/lib/pages/pharmacies/screens/lacum-transfer-page.dart index f05c6da4..b3995aca 100644 --- a/lib/pages/pharmacies/screens/lacum-transfer-page.dart +++ b/lib/pages/pharmacies/screens/lacum-transfer-page.dart @@ -71,7 +71,8 @@ class _LacumTransferPageState extends State { color: Color(0xffe1e1e1), width: 0.4, )), - color: Color(0xff6294ed), + color: Colors.green + //(0xff6294ed), ), child: Row( crossAxisAlignment: diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index c4415852..20b65c55 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -28,11 +28,13 @@ class LakumMainPage extends StatelessWidget { return BaseView( onModelReady: (model) async { await model.getLacumData(); - if (model.lacumInformation.yahalaAccountNo == 0 || model.lacumInformation.yahalaAccountNo == null) { + if (model.lacumInformation.yahalaAccountNo == 0 || + model.lacumInformation.yahalaAccountNo == null) { navigateToLakumRegister(context); } else { if (model.lacumInformation.status == "Hold") { - Navigator.pushReplacement(context, FadePage(page: LakumActivationVidaPage())); + Navigator.pushReplacement( + context, FadePage(page: LakumActivationVidaPage())); } } }, @@ -49,7 +51,10 @@ class LakumMainPage extends StatelessWidget { body: Container( width: double.infinity, child: SingleChildScrollView( - child: (model.lacumGroupInformation != null && model.lacumGroupInformation.lakumInquiryInformationObjVersion != null) + child: (model.lacumGroupInformation != null && + model.lacumGroupInformation + .lakumInquiryInformationObjVersion != + null) ? Column( children: [ Stack( @@ -63,32 +68,61 @@ class LakumMainPage extends StatelessWidget { SizedBox( height: mediaQuery.size.height * 0.02, ), - Container(width: mediaQuery.size.width * 1, child: LakumBannerWidget(model, mediaQuery, true)), + Container( + width: mediaQuery.size.width * 1, + height: mediaQuery.size.width * .6, + child: LakumBannerWidget( + model, mediaQuery, true)), ], ) ], ), SizedBox( - width: 8, + height: 12, ), - LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), + LakumHomeButtons(mediaQuery, model), SizedBox( - height: 20, + height: 12, ), Container( - height: 125, - margin: EdgeInsets.symmetric(horizontal: 16), + height: 110, + margin: EdgeInsets.symmetric( + horizontal: 16, vertical: 12.0), child: ListView( scrollDirection: Axis.horizontal, children: [ - LacumPointsWidget(mediaQuery, 1, TranslationBase.of(context).balance, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance, null), + 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), + LacumPointsWidget( + mediaQuery, + 2, + TranslationBase.of(context).gained, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPointsAmountPerYear), SizedBox( width: 8, ), @@ -96,28 +130,52 @@ class LakumMainPage extends StatelessWidget { mediaQuery, 3, TranslationBase.of(context).consumed, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null - ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount != + null + ? int.parse(model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount) : 0, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), + 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), + LacumPointsWidget( + mediaQuery, + 4, + TranslationBase.of(context).transferred, + 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPointsAmountPerYear), ], ), ), - 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), + // 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, ), @@ -129,7 +187,8 @@ class LakumMainPage extends StatelessWidget { ), ), Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -144,7 +203,7 @@ class LakumMainPage extends StatelessWidget { Padding( padding: EdgeInsets.symmetric(horizontal: 8), child: Texts( - TranslationBase.of(context).expiryDate, + TranslationBase.of(context).expiryPoints, // "Expired", fontSize: 14, ), @@ -152,7 +211,7 @@ class LakumMainPage extends StatelessWidget { ], ), Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints}${TranslationBase.of(context).lakumPoint} ", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} ${TranslationBase.of(context).lakumPoint} ", fontWeight: FontWeight.bold, fontSize: 14, ), @@ -165,39 +224,45 @@ class LakumMainPage extends StatelessWidget { // fontSize: 14, // ), Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, 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( - TranslationBase.of(context).Waitinggained, + 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( + TranslationBase.of(context) + .Waitinggained, // "Waiting gained", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}", - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ])), + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ])), // Texts( // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", // fontWeight: FontWeight.bold, // fontSize: 14, // ), Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -250,7 +315,11 @@ class LakumMainPage extends StatelessWidget { } navigateToLakumRegister(BuildContext context) { - Navigator.pushReplacement(context, FadePage(page: LakumRegistrationPage(projectViewModel.user.patientIdentificationNo))); + Navigator.pushReplacement( + context, + FadePage( + page: LakumRegistrationPage( + projectViewModel.user.patientIdentificationNo))); } } @@ -260,7 +329,12 @@ List _buildAppBarICons(BuildContext context, LacumViewModel model) { icon: Icon(Icons.settings), color: Colors.white, onPressed: () { - Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); + Navigator.push( + context, + FadePage( + page: LakumSettingPage( + model.lacumInformation, model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); }, ), ]; @@ -282,7 +356,9 @@ class LakumHomeButtons extends StatelessWidget { child: InkWell( onTap: () { print("Account activate click"); - Navigator.push(context, FadePage(page: LakumActivationVidaPage())).then((result) => {model.getLacumGroupData()}); + Navigator.push( + context, FadePage(page: LakumActivationVidaPage())) + .then((result) => {model.getLacumGroupData()}); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), @@ -325,7 +401,12 @@ class LakumHomeButtons extends StatelessWidget { child: InkWell( onTap: () { print("Lacum transfer click"); - Navigator.push(context, FadePage(page: LacumTransferPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); + Navigator.push( + context, + FadePage( + page: LacumTransferPage(model.lacumInformation, + model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), @@ -341,7 +422,8 @@ class LakumHomeButtons extends StatelessWidget { child: Row( children: [ Image.asset( - "assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png", + "assets/images/pharmacy_module/lakum/akum_transfer.png", + // "assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png", fit: BoxFit.fill, width: 35, height: 30, @@ -371,18 +453,20 @@ 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; + final num riyal; + final num point; Color titleColor; final List pointsAmountPerYear; - LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, this.point, this.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(0xff004bcc); titleColor = Color(0xff339933); + } else if (pointType == 3) { + titleColor = Colors.grey; } else { titleColor = Color(0xffffa500); } @@ -394,16 +478,18 @@ class LacumPointsWidget extends StatelessWidget { onTap: () { if (pointType != 1) { if (pointsAmountPerYear != null && pointsAmountPerYear.length > 0) { - Navigator.push(context, FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); + Navigator.push(context, + FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); } else { - AppToast.showErrorToast(message: TranslationBase.of(context).lakumMsg); + AppToast.showErrorToast( + message: TranslationBase.of(context).lakumMsg); // show snackBar No Details Points are there } } }, child: Container( width: mediaQuery.size.width / 2 - 25, - padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 2), + padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 8), decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), @@ -411,13 +497,13 @@ class LacumPointsWidget extends StatelessWidget { color: Color(0xffe1e1e1), width: 0.4, )), - color: pointType == 1 ? Color(0xff004bcc) : Color(0xffefefef), + color: pointType == 1 ? Color(0xff339933) : Color(0xffefefef), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( + Container( + margin: EdgeInsets.only(bottom: 10.0), child: Column( children: [ Row( @@ -443,15 +529,15 @@ class LacumPointsWidget extends StatelessWidget { ), Expanded( child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ if (pointType != 4) Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).RIYAL, -// "RIYAL", + TranslationBase.of(context).sar, fontSize: 13, fontWeight: FontWeight.bold, color: pointType == 1 ? Colors.white : Colors.black, @@ -479,11 +565,10 @@ class LacumPointsWidget extends StatelessWidget { child: Container( margin: EdgeInsets.only(left: 8, right: 8), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).point, -// "POINT", + TranslationBase.of(context).points, fontSize: 12, fontWeight: FontWeight.bold, color: pointType == 1 ? Colors.white : Colors.black, diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart index 978afae3..53b0357e 100644 --- a/lib/pages/pharmacies/screens/payment-method-select-page.dart +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -16,13 +16,10 @@ class PaymentMethodSelectPage extends StatefulWidget { final bool isUpdating; final Function changeMainState; - const PaymentMethodSelectPage( - {Key key, this.model, this.isUpdating = false, this.changeMainState}) - : super(key: key); + const PaymentMethodSelectPage({Key key, this.model, this.isUpdating = false, this.changeMainState}) : super(key: key); @override - _PaymentMethodSelectPageState createState() => - _PaymentMethodSelectPageState(); + _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState(); } class _PaymentMethodSelectPageState extends State { @@ -85,16 +82,17 @@ class _PaymentMethodSelectPageState extends State { selectedPaymentOption = PaymentOption.mastercard; }) }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.installments, - () => { - setState(() { - selectedPaymentOption = - PaymentOption.installments; - }) - }), + widget.model.cartResponse.totalAmount > 1000 + ? PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.installments, + () => { + setState(() { + selectedPaymentOption = PaymentOption.installments; + }) + }) + : Container(), if (Platform.isIOS) PaymentMethodCard( cardWidth, @@ -118,8 +116,7 @@ class _PaymentMethodSelectPageState extends State { TranslationBase.of(context).next, selectedPaymentOption != null ? () { - widget.model.paymentCheckoutData.paymentOption = - selectedPaymentOption; + widget.model.paymentCheckoutData.paymentOption = selectedPaymentOption; if (widget.isUpdating) { widget.changeMainState(); Navigator.pop(context); @@ -150,14 +147,12 @@ class PaymentMethodCard extends StatelessWidget { final PaymentOption paymentOption; final Function selectMethod; - PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, - this.paymentOption, this.selectMethod); + PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod); @override Widget build(BuildContext context) { bool isSelected = false; - if (selectedPaymentOption != null && - selectedPaymentOption == paymentOption) { + if (selectedPaymentOption != null && selectedPaymentOption == paymentOption) { isSelected = true; } @@ -171,9 +166,7 @@ class PaymentMethodCard extends StatelessWidget { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: isSelected - ? BorderSide(color: Colors.green, width: 2.0) - : BorderSide(color: Colors.transparent, width: 0.0), + side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), child: Padding( padding: const EdgeInsets.all(12.0), @@ -182,13 +175,7 @@ class PaymentMethodCard extends StatelessWidget { Container( width: 24, height: 24, - decoration: containerColorRadiusBorderWidth( - isSelected - ? CustomColors.accentColor - : Colors.transparent, - 100, - Colors.grey, - 0.5), + decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), mWidth(12), Container( @@ -200,8 +187,7 @@ class PaymentMethodCard extends StatelessWidget { if (isSelected) Container( decoration: containerRadius(CustomColors.green, 200), - padding: - EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), child: Text( TranslationBase.of(context).paymentSelected, style: TextStyle( diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 13e94c87..a5ba0956 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; @@ -17,57 +19,64 @@ class AvailabilityInfo extends StatelessWidget { TranslationBase.of(context).noLocationAvailable, ), ) - : ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: previousModel.productLocationService.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Image.network(previousModel.productLocationService[index].projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(), - style: TextStyle(fontSize: 12), + : Container( + margin: EdgeInsets.only(bottom: 40), + child: ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: previousModel.productLocationService.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(previousModel.productLocationService[index].projectImageUrl), ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.location_on), - color: Colors.red, - onPressed: () {}, + SizedBox( + width: 10, ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, + Expanded( + flex: 4, + child: Text( + previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(), + style: TextStyle(fontSize: 12), + ), ), - ), - ], - ), - Divider(height: 1.2, color: Colors.grey) - ], - ), - ); - }, - ); + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.location_on), + color: Colors.red, + onPressed: () { + MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + }, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.phone), + color: Colors.red, + onPressed: () { + launch("tel://" + previousModel.productLocationService[index].phoneNumber); + }, + ), + ), + ], + ), + Divider(height: 1.2, color: Colors.grey) + ], + ), + ); + }, + ), + ); } convertCityName(txt) { diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 644ab693..3520b305 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,11 +1,15 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import '../../../../../locator.dart'; @@ -35,6 +39,7 @@ class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; AuthenticatedUserObject authenticatedUserObject = locator(); + AppSharedPreferences sharedPref = new AppSharedPreferences(); @override Widget build(BuildContext context) { @@ -128,7 +133,7 @@ class _FooterWidgetState extends State { height: 20, ), Container( - height: 58, + height: 55, child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -182,9 +187,7 @@ class _FooterWidgetState extends State { disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, onTap: () async { if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + login(); } else await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); }, @@ -204,12 +207,9 @@ class _FooterWidgetState extends State { disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, onTap: () async { if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + login(); } else { await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); - } }, fontWeight: FontWeight.w600, @@ -227,6 +227,37 @@ class _FooterWidgetState extends State { ); } + void setUserValues(value) async { + if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); + } + + login() async { + final authService = new AuthProvider(); + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + GifLoaderDialogUtils.showMyDialog(context); + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); + } + } + onChangeValue(int i) { setState(() { widget.quantity = i; diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index ad802349..1f9dcc52 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -185,7 +184,8 @@ class __ProductDetailPageState extends State { ), Container( // width: 500, - margin: EdgeInsets.only(bottom: 6), + margin: EdgeInsets.only(bottom: 10), + padding: EdgeInsets.only(bottom: 10), color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -251,17 +251,19 @@ class __ProductDetailPageState extends State { Column( children: [ FlatButton( - onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.getProductLocationData(widget.product.sku); - GifLoaderDialogUtils.hideDialog(context); - - setState(() { - isDetails = false; - isReviews = false; - isAvailability = true; - }); - }, + onPressed: model.isStockAvailable + ? () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductLocationData(widget.product.sku); + GifLoaderDialogUtils.hideDialog(context); +// + setState(() { + isDetails = false; + isReviews = false; + isAvailability = true; + }); + } + : null, child: Text( TranslationBase.of(context).availability, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), @@ -288,9 +290,18 @@ class __ProductDetailPageState extends State { previousModel: model, ) : isAvailability - ? AvailabilityInfo( - previousModel: model, - ) + //&& widget.product.stockAvailability != "Out of stock" + ? AvailabilityInfo(previousModel: model) +// : isAvailability && widget.product.stockAvailability == "Out of stock" +// ? Container( +// // padding: EdgeInsets.all(15), +// padding: EdgeInsets.fromLTRB(15, 15, 15, 20), +// margin: EdgeInsets.only(bottom: 20), +// alignment: Alignment.center, +// child: Text( +// TranslationBase.of(context).noLocationAvailable, +// ), +// ) : Container(), ], ), @@ -298,17 +309,17 @@ class __ProductDetailPageState extends State { SizedBox( height: 10, ), - if (projectViewModel.isLogin) - RecommendedProducts( - product: widget.product, - productDetailViewModel: model, - addToWishlistFunction: (itemID) async { - await addToWishlistFunction(itemID: itemID, model: model); - }, - deleteFromWishlistFunction: (itemID) async { - await deleteFromWishlistFunction(itemID: itemID, model: model); - }, - ) +// if (projectViewModel.isLogin) +// RecommendedProducts( +// product: widget.product, +// productDetailViewModel: model, +// addToWishlistFunction: (itemID) async { +// await addToWishlistFunction(itemID: itemID, model: model); +// }, +// deleteFromWishlistFunction: (itemID) async { +// await deleteFromWishlistFunction(itemID: itemID, model: model); +// }, +// ) ], ), ), @@ -358,8 +369,8 @@ class __ProductDetailPageState extends State { await model.addToCartData(quantity, itemID, context); GifLoaderDialogUtils.hideDialog(context); } -} -notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async { - await model.notifyMe(customerId, itemId, context); + notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async { + await model.notifyMe(customerId, itemId); + } } diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 0f25b236..f71c92a4 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.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/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -57,22 +58,32 @@ class _ProductNameAndPriceState extends State { // SizedBox(width: 20), if (widget.authenticatedUserObject.isLogin) !widget.isStockAvailable && widget.customerId != null - ? InkWell( - onTap: () => widget.notifyMeWhenAvailable(context, widget.item.id), - child: Row(children: [ - Texts( + ?BorderedButton( TranslationBase.of(context).notifyMe, - decoration: TextDecoration.underline, - color: Colors.blue, - ), - SizedBox(width: 4), - Icon( - FontAwesomeIcons.bell, - color: Colors.blue, - size: 15.0, - ) - ]), - ) + hasBorder: true, + borderColor: Colors.green, + textColor: Colors.green, + fontWeight: FontWeight.bold, + vPadding: 6, + hPadding: 14, + handler: () => widget.notifyMeWhenAvailable(context, widget.item.id), + ) +// InkWell( +// onTap: () => widget.notifyMeWhenAvailable(context, widget.item.id), +// child: Row(children: [ +// Texts( +// TranslationBase.of(context).notifyMe, +// decoration: TextDecoration.underline, +// color: Colors.blue, +// ), +// SizedBox(width: 4), +// Icon( +// FontAwesomeIcons.bell, +// color: Colors.blue, +// size: 15.0, +// ) +// ]), +// ) : IconWithBg( icon: !widget.isInWishList ? Icons.favorite_border : Icons.favorite, color: !widget.isInWishList ? Colors.white : Colors.red[800], diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index 64336d85..e3050927 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -30,15 +30,21 @@ class ReviewsInfo extends StatelessWidget { Container( child: Row( children: [ - Container( - child: Text( - previousModel.productDetailService[0] - .reviews[index].customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + Expanded( + child: Container( + child: Text(previousModel.productDetailService[0].reviews[index].customer.firstName != null + && previousModel.productDetailService[0].reviews[index].customer.firstName != null + ? previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " " + + previousModel.productDetailService[0].reviews[index].customer.lastName.toString() + :"", +// previousModel.productDetailService[0] +// .reviews[index].customerId +// .toString(), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), ), ), Container( @@ -79,7 +85,8 @@ class ReviewsInfo extends StatelessWidget { }, ) : Container( - padding: EdgeInsets.all(15), + padding: EdgeInsets.fromLTRB(15,15,15,20), + margin: EdgeInsets.only(bottom: 20), alignment: Alignment.center, child: Text( TranslationBase.of(context).noReviewsAvailable, diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index f58438cf..fb608953 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -156,8 +156,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { await addToCartFunction( quantity: quantity, itemID: itemID, - model: model, - context: context); + model: model); Navigator.of(context).pop(); } diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index 429ee92b..afe74371 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -15,8 +15,8 @@ class ProductOrderItem extends StatefulWidget { final VoidCallback deleteCartItems; final OrderPreviewViewModel model; - ProductOrderItem({this.item, this.changeCartItems, this.deleteCartItems, - this.model}); + ProductOrderItem( + {this.item, this.changeCartItems, this.deleteCartItems, this.model}); @override _ProductOrderItemState createState() => _ProductOrderItemState(); @@ -28,7 +28,6 @@ class _ProductOrderItemState extends State { @override void initState() { - super.initState(); } @@ -36,7 +35,7 @@ class _ProductOrderItemState extends State { Widget build(BuildContext context) { _quantityController.text = "${widget.item.quantity}"; _totalPrice = - "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; ProjectViewModel projectProvider = Provider.of(context); return Column( diff --git a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart index 7d10b886..29111570 100644 --- a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart +++ b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart @@ -59,7 +59,7 @@ class _LakumBannerWidgetState extends State { height: widget.mediaQuery.size.width * 1.0, ), Container( - margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + margin: EdgeInsets.fromLTRB(12, 75, 12, 0), child: Column( children: [ Row( @@ -70,13 +70,13 @@ class _LakumBannerWidgetState extends State { children: [ Texts( widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName, - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( "${widget.model.lacumInformation.yahalaAccountNo}", - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -117,7 +117,7 @@ class _LakumBannerWidgetState extends State { ], ), SizedBox( - height: 10, + height: 5, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -127,14 +127,14 @@ class _LakumBannerWidgetState extends State { children: [ Texts(TranslationBase.of(context).identificationNumber, // "IDENTIFICATION #", - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.lacumInformation .identificationNo, - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -145,13 +145,13 @@ class _LakumBannerWidgetState extends State { children: [ Texts(TranslationBase.of(context).MEMBERSINCE, // "MEMBER SINCE", - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.formatCreatedDateToString(), - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -160,7 +160,7 @@ class _LakumBannerWidgetState extends State { ], ), SizedBox( - height: 10, + height: 5, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -170,13 +170,13 @@ class _LakumBannerWidgetState extends State { children: [ Texts(TranslationBase.of(context).lakumMobile, // "MOBILE #", - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber, - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -187,16 +187,16 @@ class _LakumBannerWidgetState extends State { children: [ Texts( TranslationBase.of(context).language, - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.lacumInformation.prefLang == - "1" + "2" ? TranslationBase.of(context).lanEnglish : TranslationBase.of(context).lanArabic, - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -229,13 +229,19 @@ class _LakumBannerWidgetState extends State { 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(), + Center( + child: Container( + margin: EdgeInsets.fromLTRB(5, 70, 5, 4), + child: widget.model.convertBase64ToBarCodeImage() != + null + ? Image.memory( + widget.model.convertBase64ToBarCodeImage(), + fit: BoxFit.fill, + height: 100.0, + width: 180.0 + ) + : Container(), + ), ), ], ), diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 8b3f8502..9eda1004 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -8,6 +9,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; dynamic languageID; @@ -15,15 +17,15 @@ class OrderPage extends StatefulWidget { // orderList({this.customerId, this.pageId}); String customerID; + String customerGUID; - OrderPage({@required this.customerID}); + OrderPage({@required this.customerID, this.customerGUID}); @override _OrderPageState createState() => _OrderPageState(); } -class _OrderPageState extends State - with SingleTickerProviderStateMixin { +class _OrderPageState extends State with SingleTickerProviderStateMixin { String pageID = "1"; String customerId = ""; String order = ""; @@ -57,7 +59,8 @@ class _OrderPageState extends State @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getOrder(widget.customerID, pageID), + onModelReady: (model) => + model.getOrder(widget.customerID, widget.customerGUID, pageID), builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).order, baseViewModel: model, @@ -105,6 +108,8 @@ class _OrderPageState extends State } Widget getDeliveredOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + deliveredOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 30 || model.orders[i].orderStatusId == 997 || @@ -134,9 +139,12 @@ class _OrderPageState extends State FadePage( page: OrderDetailsPage( orderModel: - deliveredOrderList[ - index]), - )); + deliveredOrderList[index]), + )).then((value) { + model.getOrder(widget.customerID, + widget.customerGUID, pageID); + getDeliveredOrder(model); + }); }, child: Row( mainAxisAlignment: @@ -151,7 +159,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, @@ -180,7 +189,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, @@ -207,12 +217,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -236,16 +244,23 @@ class _OrderPageState extends State left: 13.0, right: 13.0), decoration: BoxDecoration( border: Border.all( - color: Colors.blue[700], + color: Color(0xFF4CAF50), style: BorderStyle.solid, width: 5.0, ), - color: Colors.blue[700], - borderRadius: - BorderRadius.circular(30.0)), - child: deliveredOrderList[index].orderStatusId == 30 || - deliveredOrderList[index].orderStatusId == 997 || - deliveredOrderList[index].orderStatusId == 994 + color: Color(0xFF4CAF50), + borderRadius: BorderRadius.circular( + 30.0)), + child: deliveredOrderList[ + index] + .orderStatusId == + 30 || + deliveredOrderList[index] + .orderStatusId == + 997 || + deliveredOrderList[index] + .orderStatusId == + 994 // deliveredOrderList[index].orderStatusId == 30 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), @@ -371,6 +386,8 @@ class _OrderPageState extends State } Widget getProcessingOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + processingOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 20 || model.orders[i].orderStatusId == 995 || @@ -379,6 +396,7 @@ class _OrderPageState extends State processingOrderList.add(model.orders[i]); } } + _tabController.index = 1; return Container( width: MediaQuery.of(context).size.width, child: processingOrderList.length != 0 @@ -397,12 +415,20 @@ class _OrderPageState extends State InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - processingOrderList[ - index]))); + context, + FadePage( + page: OrderDetailsPage( + orderModel: + processingOrderList[ + index]))) + .then((value) { + model + .getOrder(widget.customerID, + widget.customerGUID, pageID) + .then((value) { + getProcessingOrder(model); + }); + }); }, child: Row( mainAxisAlignment: @@ -417,7 +443,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, @@ -446,7 +473,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, @@ -473,12 +501,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -502,17 +528,26 @@ class _OrderPageState extends State left: 13.0, right: 13.0), decoration: BoxDecoration( border: Border.all( - color: Colors.green, + color: Colors.grey[500], style: BorderStyle.solid, width: 5.0, ), - color: Colors.green, - borderRadius: - BorderRadius.circular(30.0)), - child: processingOrderList[index].orderStatusId == 20 || - processingOrderList[index].orderStatusId == 995 || - processingOrderList[index].orderStatusId == 998 || - processingOrderList[index].orderStatusId == 999 + color: Colors.grey[500], + borderRadius: BorderRadius.circular( + 30.0)), + child: processingOrderList[ + index] + .orderStatusId == + 20 || + processingOrderList[index] + .orderStatusId == + 995 || + processingOrderList[index] + .orderStatusId == + 998 || + processingOrderList[index] + .orderStatusId == + 999 // processingOrderList[index].orderStatusId == 20 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), @@ -817,11 +852,14 @@ class _OrderPageState extends State } Widget getPendingOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + pendingOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 10) { pendingOrderList.add(model.orders[i]); } } + _tabController.animateTo(2); return Container( child: pendingOrderList.length != 0 ? SingleChildScrollView( @@ -840,12 +878,20 @@ class _OrderPageState extends State InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - pendingOrderList[ - index]))); + context, + FadePage( + page: OrderDetailsPage( + orderModel: + pendingOrderList[ + index]))) + .then((value) { + model + .getOrder(widget.customerID, + widget.customerGUID, pageID) + .then((value) { + getPendingOrder(model); + }); + }); }, child: Row( mainAxisAlignment: @@ -867,7 +913,8 @@ class _OrderPageState extends State .orderNumber, style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -878,7 +925,8 @@ class _OrderPageState extends State .toString(), style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -918,12 +966,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -1084,9 +1130,11 @@ class _OrderPageState extends State } Widget getCancelledOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + cancelledOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 40 || - model.orders[i].orderStatus == 996 || + model.orders[i].orderStatusId == 996 || model.orders[i].orderStatusId == 200) { cancelledOrderList.add(model.orders[i]); } @@ -1109,12 +1157,13 @@ class _OrderPageState extends State InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - cancelledOrderList[ - index]))); + context, + FadePage( + page: OrderDetailsPage( + orderModel: + cancelledOrderList[ + index]))) + ; }, child: Row( mainAxisAlignment: @@ -1136,7 +1185,8 @@ class _OrderPageState extends State .orderNumber, style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -1147,7 +1197,8 @@ class _OrderPageState extends State .toString(), style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -1187,12 +1238,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index ee360bb1..fc4ae184 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -16,6 +17,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/image.dart' as flutterImage; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; dynamic languageID; @@ -67,6 +69,8 @@ class _OrderDetailsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); this.context = context; return BaseView( onModelReady: (model) { @@ -132,7 +136,7 @@ class _OrderDetailsPageState extends State { ), ) : Text( - languageID == "ar" ? model.orderListModel[0].orderStatusn.toString() : model.orderListModel[0].orderStatus.toString(), + projectProvider.isArabic ? model.orderListModel[0].orderStatusn.toString() : model.orderListModel[0].orderStatus.toString(), style: TextStyle( color: Colors.white, fontSize: 13.0, @@ -250,7 +254,6 @@ class _OrderDetailsPageState extends State { ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, -// height: 100, width: 100, ), ), @@ -337,7 +340,9 @@ class _OrderDetailsPageState extends State { itemBuilder: (context, index) { return Container( child: productTile( - productName: model.orderListModel[0].orderItems[index].product.name.toString(), + productName: projectViewModel.isArabic ? + model.orderListModel[0].orderItems[index].product.namen.toString() + :model.orderListModel[0].orderItems[index].product.name.toString(), productPrice: model.orderListModel[0].orderItems[index].product.price.toString(), productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum.toDouble(), productReviews: model.orderListModel[0].orderItems[index].product.approvedTotalReviews, @@ -557,8 +562,6 @@ class _OrderDetailsPageState extends State { ? InkWell( onTap: () { presentConfirmDialog(model, widget.orderModel.id); - // model.orderListModel[0].id//(widget.orderModel.id)); -// }, child: Container( // padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), @@ -606,9 +609,9 @@ class _OrderDetailsPageState extends State { print(widget.orderModel.orderStatusId); // if(orderStatus == 'delivered') if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994) - return Colors.blue[700]; + return Color(0xFF4CAF50); else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999) - return Colors.green; + return Colors.grey[500]; 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]; @@ -645,18 +648,12 @@ class _OrderDetailsPageState extends State { 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, - FadePage( - page: OrderPage( -// customerID: model.ordersList[0].customerId.toString() - customerID: widget.orderModel.customerId.toString())), - ); - }), + okFunction: () { + Navigator.pop(context); + cancelFunction.getCanceledOrder(id, context).then((value) { + Navigator.pop(context); + }); + }, cancelFunction: () => {}); dialog.showAlertDialog(context); } diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index 514ea1a5..5e55d537 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -62,7 +62,7 @@ class _AddAddressPageState extends State { return BaseView( builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).changeAddress, - isShowAppBar: true, + isShowAppBar: false, isPharmacy: true, backgroundColor: Colors.white, body: Container( diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index a84f3554..6a423b82 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -128,11 +128,16 @@ class _PharmacyAddressesState extends State { GifLoaderDialogUtils.showMyDialog(context); await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo); - await widget.orderPreviewViewModel.getShoppingCart(); - // widget.changeMainState(); - GifLoaderDialogUtils.hideDialog(context); - model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); - _navigateToPaymentOption(model); + if (widget.orderPreviewViewModel.error == "") { + await widget.orderPreviewViewModel.getShoppingCart(); + GifLoaderDialogUtils.hideDialog(context); + model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); + _navigateToPaymentOption(model); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.orderPreviewViewModel.error); + return; + } }, ), ), diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 8362b2c8..1f2520b6 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -18,7 +18,6 @@ import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -29,6 +28,10 @@ import 'package:flutter_svg/flutter_svg.dart'; dynamic languageID; class PharmacyProfilePage extends StatefulWidget { + final bool moveToOrder; + + PharmacyProfilePage({@required this.moveToOrder}); + @override _ProfilePageState createState() => _ProfilePageState(); } @@ -41,6 +44,7 @@ class _ProfilePageState extends State { bool isLogin = false; String firstName; String customerId; + String customerGUID; String lastName, mobileNo, identificationNo; int languageId; @@ -50,11 +54,15 @@ class _ProfilePageState extends State { getCustomer() async { String custID; + String custGUID; custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + custGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); setState(() { customerId = custID; + customerGUID = custGUID; }); print("customer Id is" + customerId); + print("customer GUID is" + customerGUID); return customerId; } @@ -75,8 +83,6 @@ class _ProfilePageState extends State { ); } } - -// this.isLogin = user != null; } void initState() { @@ -84,556 +90,520 @@ class _ProfilePageState extends State { getLanguageID(); super.initState(); getUser(); + if (widget.moveToOrder) { + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + } } @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) async { - var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - GifLoaderDialogUtils.showMyDialog(context); - model.getOrder(customerId, page_id); - GifLoaderDialogUtils.hideDialog(context); - }, - builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar: true, - isShowDecPage: true, - isPharmacy: true, + onModelReady: (model) async { + // var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + // var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + // GifLoaderDialogUtils.showMyDialog(context); + // model.getOrder(customerId, customerGUID, page_id); + // GifLoaderDialogUtils.hideDialog(context); + }, + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).myAccount, + isShowAppBar: true, + isShowDecPage: true, + isPharmacy: true, - //isBottomBar: true, - isMainPharmacyPages: true, - body: user != null - ? Container( - color: Colors.white, - child: SingleChildScrollView( - child: Column( + //isBottomBar: true, + isMainPharmacyPages: true, + body: user != null + ? Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + child: Row( children: [ Container( child: Row( children: [ Container( - child: Row( - children: [ - Container( - padding: EdgeInsets.only( - top: 20.0, - left: 10.0, - right: 10.0, - bottom: 10.0, - ), - child: LargeAvatar( - name: user.firstName.toString(), - url: '', - ), - ), - Column(children: [ - Row(children: [ - Text( - TranslationBase.of(context).welcome, - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), - ), - ]), - SizedBox( - height: 10, - ), - Row(children: [ - Text( - languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), - ), - ]), - ]), - ], + padding: EdgeInsets.only( + top: 20.0, + left: 10.0, + right: 10.0, + bottom: 10.0, ), - ) - ], - ), - ), - 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, FadePage(page: 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, - ), - ), - ], + child: LargeAvatar( + name: user.firstName.toString(), + url: '', ), ), - ), - Expanded( - child: InkWell( - onTap: () { - if (customerId == null || customerId == '') - Navigator.push(context, FadePage(page: LakumActivationVidaPage())); - else - Navigator.push(context, FadePage(page: 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), - ), - ], + Column(children: [ + Row(children: [ + Text( + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), + ), + ]), + SizedBox( + height: 10, ), + Row(children: [ + Text( + languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + ), + ]), + ]), + ], + ), + ) + ], + ), + ), + 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, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + }, + child: Column( + children: [ +// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), + SvgPicture.asset( + 'assets/images/pharmacy/orders_icon.svg', + width: 50, + height: 50, ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: 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, - ), - ), - ], - ), + SizedBox( + height: 5, ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: 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, - ), - ), - ], + Text( + TranslationBase.of(context).orders, + 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), + ), + Expanded( + child: InkWell( + onTap: () { + if (customerId == null || customerId == '') + Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + else + Navigator.push(context, FadePage(page: LakumMainPage())); + }, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - TranslationBase.of(context).myAccount, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + SvgPicture.asset( + 'assets/images/pharmacy/lakum_icon.svg', + width: 50, + height: 50, ), SizedBox( - height: 10, + height: 5, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).lakum, + style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold), ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: 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, - ), - ), - ], - ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push(context, FadePage(page: WishlistPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/wishlist_icon.svg', + width: 50, + height: 50, ), SizedBox( height: 5, ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: 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, - ), - ), - ], + Text( + TranslationBase.of(context).wishlist, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, ), ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyReviewsPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/review_icon.svg', + width: 50, + height: 50, + ), SizedBox( height: 5, ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: 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, - ), - ), - ], + Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, ), ), - SizedBox( - height: 5, + ], + ), + ), + ), + ], + )), + 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, FadePage(page: HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_prescription_icon.svg', + width: 28, + height: 28, ), - Divider( - color: Colors.grey, - height: 20, + SizedBox( + width: 15, ), - InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: 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, - ), - ), - ], + Text( + TranslationBase.of(context).myPrescription, + style: TextStyle( + fontSize: 13.0, ), ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: ComparePage())); + }, + child: Row( + children: [ + Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35), SizedBox( - height: 5, + width: 15, ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: 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, - ), - ), - ], + Text( + TranslationBase.of(context).compare, + style: TextStyle( + fontSize: 13.0, ), ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/medication_refill_icon.svg', + width: 30, + height: 30, + ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, + Text( + TranslationBase.of(context).medicationsRefill, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyFamily())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_family_icon.svg', + width: 20, height: 20, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: 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( + width: 20, + ), + Text( + TranslationBase.of(context).family, + style: TextStyle( + fontSize: 13.0, ), ), - SizedBox( - height: 5, + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_addresses_icon.svg', + width: 30, + height: 30, ), - Divider( - color: Colors.grey, - height: 20, + SizedBox( + width: 20, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: 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, - ), - ), - ], + Text( + TranslationBase.of(context).shippingAddresses, + style: TextStyle( + fontSize: 13.0, ), ), ], ), ), SizedBox( - height: 10, + height: 5, ), Divider( - color: Colors.grey[350], + color: Colors.grey, height: 20, - thickness: 5, - indent: 0, - endIndent: 0, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: 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: 10, + height: 5, ), - Container( - padding: EdgeInsets.only(left: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: 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).reachUs, + TranslationBase.of(context).conditions, style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + 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, FadePage(page: LiveChatPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/contact_us_icon.svg', + width: 20, + height: 20, ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).contactUs, + style: TextStyle(fontSize: 13.0), ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: 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, FadePage(page: FindUsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/our_locations_icon.svg', + width: 30, + height: 30, ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).ourLocations, + style: TextStyle(fontSize: 13.0), ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: 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), - ), - ], - ), - ) ], ), ) ], ), - ), - ) - : Container(), - )); + ) + ], + ), + ), + ) + : Container(), + ), + ); } } diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index b7c5d244..4bc069dc 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; @@ -18,6 +19,7 @@ import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:rating_bar/rating_bar.dart'; import 'base/base_view.dart'; @@ -55,6 +57,10 @@ class _SubCategorisePageState extends State { color: Colors.blue, size: 29.0, ); + + int pageIndex = 1; + + RefreshController controller = RefreshController(); List entityList = List(); List entityListBrands = List(); @@ -65,7 +71,8 @@ class _SubCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getSubCategorise(i: id), + onModelReady: (model) => model.getSubCategorise( + i: id, pageIndex: pageIndex, isLoading: false, context: context), allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => @@ -75,9 +82,26 @@ class _SubCategorisePageState extends State { isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, - //baseViewModel: model, - body: NetworkBaseView( - baseViewModel: model, + baseViewModel: model, + body: SmartRefresher( + controller: controller, + enablePullDown: false, + enablePullUp: true, + onLoading: () async { + setState(() { + ++pageIndex; + }); + await model.getSubProducts( + pageIndex: pageIndex, + i: id, + isLoading: true, + context: context); + if (model.state != ViewState.BusyLocal && pageIndex < 5) { + controller.loadComplete(); + } else { + controller.loadFailed(); + } + }, child: SingleChildScrollView( child: Container( child: Column( diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 3986c8e4..80039ece 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1317,4 +1317,19 @@ class DoctorsListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future getLaserBodyPartsList(int laserCategoryID) async { + Map request; + + request = { + "LaserCategoryID": laserCategoryID, + }; + dynamic localRes; + await baseAppClient.post(LASER_BODY_PARTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart index a897955a..2f4a1d56 100644 --- a/lib/services/pharmacy_services/orderDetails_service.dart +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -21,8 +21,9 @@ class OrderDetailsService extends BaseService{ Future getOrderDetails(OrderId) async { + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); hasError = false; - await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId, + await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId + "/$customerGUID", onSuccess: (dynamic response, int statusCode) { _orderList.clear(); response['orders'].forEach((item) { diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart index b5632076..373f2819 100644 --- a/lib/services/pharmacy_services/order_service.dart +++ b/lib/services/pharmacy_services/order_service.dart @@ -5,40 +5,38 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - -class OrderService extends BaseService{ +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 =""; + String url = ""; - Future getOrder(customerId, pageId) async { + Future getOrder(customerId, customerGUID, 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"; - url =GET_ORDER+"customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId"; + // 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"; + url = GET_ORDER + "customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId&CustomerguId=$customerGUID"; print(url); - await baseAppClient.getPharmacy(url, - onSuccess: (dynamic response, int statusCode) { - _orderList.clear(); + await baseAppClient.getPharmacy(url, onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); - response['orders'].forEach((item) { - _orderList.add(Orders.fromJson(item)); - }); - print(_orderList.length); - print(response); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + response['orders'].forEach((item) { + _orderList.add(Orders.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; @@ -59,7 +57,6 @@ class OrderService extends BaseService{ // }); // } - // Future getOrder(BuildContext context ) async { // // if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -80,4 +77,4 @@ class OrderService extends BaseService{ // }); // 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 index 13583dba..5329c658 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -15,13 +15,14 @@ class PharmacyAddressService extends BaseService { Future> getAddresses() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); Map queryParams = {'fields': 'addresses'}; hasError = false; Addresses selectedAddress; try { var completer = Completer(); - await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) async { addresses.clear(); var savedAddress = await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS); if (savedAddress != null) { diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index e3e0fb7f..d326c130 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -58,8 +58,8 @@ class ProductDetailService extends BaseService { _stockAvailability = response['products'][0]['stock_availability']; _stockAvailabilityn = response['products'][0]['stock_availabilityn']; - // _isStockAvailable = response['products'][0]['IsStockAvailable']; - _isStockAvailable = _stockAvailability == "In stock" ? true : false; + _isStockAvailable = response['products'][0]['IsStockAvailable']; + // _isStockAvailable = _stockAvailability == "In stock" ? true : false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -123,10 +123,11 @@ class ProductDetailService extends BaseService { return Future.value(localRes); } - Future notifyMe(customerId, itemID, context) async { + Future notifyMe(customerId, itemID) async { hasError = false; await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: TranslationBase.of(context).notifyMeMsg + AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).notifyMeMsg + // TranslationBase.of(context).notifyMeMsg //'You will be notified when product available' ); }, onFailure: (String error, int statusCode) { diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index f1c6442f..5488d39b 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -10,15 +10,17 @@ final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterL class LocalNotification { Function(String payload) _onNotificationClick; static LocalNotification _instance; - static LocalNotification getInstance(){ + + static LocalNotification getInstance() { return _instance; } - static init({Function(String payload) onNotificationClick}){ - if(_instance == null){ + + static init({Function(String payload) onNotificationClick}) { + if (_instance == null) { _instance = LocalNotification(); _instance._onNotificationClick = onNotificationClick; _instance._initialize(); - }else{ + } else { // assert(false,(){ // //TODO fix it // "LocalNotification Already Initialized"; @@ -26,7 +28,7 @@ class LocalNotification { } } - _initialize(){ + _initialize() { var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null); var initializationSettings = InitializationSettings(initializationSettingsAndroid, initializationSettingsIOS); @@ -34,11 +36,12 @@ class LocalNotification { } var _random = new Random(); - _randomNumber({int from = 100000}){ + + _randomNumber({int from = 100000}) { return _random.nextInt(from); } - _vibrationPattern(){ + _vibrationPattern() { var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; vibrationPattern[1] = 1000; @@ -50,10 +53,11 @@ class LocalNotification { Future showNow({@required String title, @required String subtitle, String payload}) { Future.delayed(Duration(seconds: 1)).then((result) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); + var androidPlatformChannelSpecifics = + AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err){ + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { print(err); }); }); @@ -81,11 +85,9 @@ class LocalNotification { ledOffMs: 500); var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); - ///change it to be as ionic - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.schedule(0, title, description, - // scheduledNotificationDateTime, platformChannelSpecifics); + // /change it to be as ionic + var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); } ///Repeat notification every day at approximately 10:00:00 am diff --git a/lib/uitl/laser_body_parts_data.dart b/lib/uitl/laser_body_parts_data.dart new file mode 100644 index 00000000..e52b4870 --- /dev/null +++ b/lib/uitl/laser_body_parts_data.dart @@ -0,0 +1,132 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/svg.dart'; + +class LaserBodyParts { + static final LaserBodyParts _instance = LaserBodyParts._internal(); + + LaserBodyParts._internal(); + + factory LaserBodyParts() => _instance; + + static Widget image(String assetUri) { + return new SvgPicture.asset(assetUri, fit: BoxFit.cover, width: 88, height: 88); + } + + static Widget imagePng(String assetUri) { + return Image.asset(assetUri, fit: BoxFit.cover, width: 88, height: 88); + } + + Map maleBodyMap = { + "40": imagePng("assets/images/new/body_parts/male/upper_arm.png"), + "41": imagePng("assets/images/new/body_parts/male/lower_arm.png"), + "42": imagePng("assets/images/new/body_parts/male/chest.png"), + "43": imagePng("assets/images/new/body_parts/male/chest_line.png"), + "44": imagePng("assets/images/new/body_parts/male/shoulders.png"), + "45": imagePng("assets/images/new/body_parts/male/back.png"), + "46": imagePng("assets/images/new/body_parts/male/abdomin.png"), + "47": imagePng("assets/images/new/body_parts/male/upper_legs.png"), + "48": imagePng("assets/images/new/body_parts/male/lower_legs.png"), + "49": imagePng("assets/images/new/body_parts/male/axilla.png") + }; + + Map maleFaceMap = { + "62": image("assets/images/new/body_parts/male/hydra_facial.svg"), + "5": image("assets/images/new/body_parts/male/upper_lips.svg"), + "6": image("assets/images/new/body_parts/male/chin.svg"), + "7": image("assets/images/new/body_parts/male/cheek.svg"), + "8": image("assets/images/new/body_parts/male/side_burn.svg"), + "9": image("assets/images/new/body_parts/male/ears.svg"), + "10": image("assets/images/new/body_parts/male/full_neck.svg"), + "11": image("assets/images/new/body_parts/male/half_neck.svg"), + "12": image("assets/images/new/body_parts/male/eyebrows.svg") + }; + + Map maleBodyRetouchMap = { + "51": imagePng("assets/images/new/body_parts/male/upper_arm.png"), + "52": imagePng("assets/images/new/body_parts/male/lower_arm.png"), + "53": imagePng("assets/images/new/body_parts/male/chest.png"), + "54": imagePng("assets/images/new/body_parts/male/shoulders.png"), + "55": imagePng("assets/images/new/body_parts/male/back.png"), + "56": imagePng("assets/images/new/body_parts/male/abdomin.png"), + "57": imagePng("assets/images/new/body_parts/male/full_legs.png"), + "58": imagePng("assets/images/new/body_parts/male/upper_legs.png"), + "59": imagePng("assets/images/new/body_parts/male/lower_legs.png"), + "60": imagePng("assets/images/new/body_parts/male/bikini.png"), + "61": imagePng("assets/images/new/body_parts/male/bikini_line.png") + }; + + Map femaleBodyMap = { + "40": imagePng("assets/images/new/body_parts/female/upper_arm.png"), + "41": imagePng("assets/images/new/body_parts/female/lower_arm.png"), + "42": imagePng("assets/images/new/body_parts/female/chest.png"), + "43": imagePng("assets/images/new/body_parts/female/chest_line.png"), + "44": imagePng("assets/images/new/body_parts/female/shoulders.png"), + "45": imagePng("assets/images/new/body_parts/female/back.png"), + "46": imagePng("assets/images/new/body_parts/female/abdomin.png"), + "47": imagePng("assets/images/new/body_parts/female/upper_legs.png"), + "48": imagePng("assets/images/new/body_parts/female/lower_leg.png"), + "49": imagePng("assets/images/new/body_parts/female/axilla.png") + }; + + Map femaleFaceMap = { + "62": image("assets/images/new/body_parts/female/hydra_facial.svg"), + "5": image("assets/images/new/body_parts/female/upper_lips.svg"), + "6": image("assets/images/new/body_parts/female/chin.svg"), + "7": image("assets/images/new/body_parts/female/cheeks.svg"), + "8": image("assets/images/new/body_parts/female/side_burn.svg"), + "9": image("assets/images/new/body_parts/female/ears.svg"), + "10": image("assets/images/new/body_parts/female/full_neck.svg"), + "11": image("assets/images/new/body_parts/female/half_neck.svg"), + "12": image("assets/images/new/body_parts/female/eyebrows.svg") + }; + + Map femaleBodyBikiniMap = { + "34": imagePng("assets/images/new/body_parts/female/bikini.png"), + "36": imagePng("assets/images/new/body_parts/female/bikini_line.png"), + "38": imagePng("assets/images/new/body_parts/female/buttocks.png"), + "39": imagePng("assets/images/new/body_parts/female/anal.png") + }; + + Map femaleBodyRetouchMap = { + "51": imagePng("assets/images/new/body_parts/female/upper_arm.png"), + "52": imagePng("assets/images/new/body_parts/female/lower_arm.png"), + "53": imagePng("assets/images/new/body_parts/female/chest.png"), + "54": imagePng("assets/images/new/body_parts/female/shoulders.png"), + "55": imagePng("assets/images/new/body_parts/female/back.png"), + "56": imagePng("assets/images/new/body_parts/female/abdomin.png"), + "57": imagePng("assets/images/new/body_parts/female/full_legs.png"), + "58": imagePng("assets/images/new/body_parts/female/upper_legs.png"), + "59": imagePng("assets/images/new/body_parts/female/lower_leg.png"), + "60": imagePng("assets/images/new/body_parts/female/bikini.png"), + "61": imagePng("assets/images/new/body_parts/female/bikini_line.png") + }; + + Widget getCategoryImage(bool isMale, int category, String mappingCode) { + if (isMale) { + if (category == 1) { + return maleBodyMap[mappingCode]; + } + if (category == 2) { + return maleFaceMap[mappingCode]; + } + if (category == 11) { + return maleBodyRetouchMap[mappingCode]; + } + } else { + if (category == 1) { + return femaleBodyMap[mappingCode]; + } + if (category == 2) { + return femaleFaceMap[mappingCode]; + } + if (category == 10) { + return femaleBodyBikiniMap[mappingCode]; + } + if (category == 11) { + return femaleBodyRetouchMap[mappingCode]; + } + } + return null; + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 80e961b7..4a5c8a5d 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -121,6 +121,8 @@ class TranslationBase { String get pressAgain => localizedValues['pressAgain'][locale.languageCode]; + String get laserMaxLimitReach => localizedValues['laserMaxLimitReach'][locale.languageCode]; + String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode]; String get doctorFilter => localizedValues['doctorFilter'][locale.languageCode]; @@ -509,7 +511,7 @@ class TranslationBase { String get switchUser => localizedValues['switch-login'][locale.languageCode]; - String get removeMember => localizedValues['remove-membe'][locale.languageCode]; + String get removeMember => localizedValues['remove-member'][locale.languageCode]; String get allowView => localizedValues['allow-view'][locale.languageCode]; @@ -529,6 +531,8 @@ class TranslationBase { String get expiryDate => localizedValues['expiryDate'][locale.languageCode]; + String get expiryPoints => localizedValues['expiryPoints'][locale.languageCode]; + String get procedureName => localizedValues['procedureName'][locale.languageCode]; String get procedure => localizedValues['procedure'][locale.languageCode]; @@ -1384,6 +1388,16 @@ class TranslationBase { String get body => localizedValues['body'][locale.languageCode]; + String get bodyString => localizedValues['body_string'][locale.languageCode]; + + String get bikini => localizedValues['bikini'][locale.languageCode]; + + String get totalMinutes => localizedValues['totalMinutes'][locale.languageCode]; + + String get face => localizedValues['face'][locale.languageCode]; + + String get retouch => localizedValues['retouch'][locale.languageCode]; + String get feedbackTitle => localizedValues['feedback'][locale.languageCode]; String get send => localizedValues['send'][locale.languageCode]; @@ -2777,8 +2791,14 @@ class TranslationBase { String get gr => localizedValues["gr"][locale.languageCode]; String get gramsPerMeal => localizedValues["gramsPerMeal"][locale.languageCode]; + String get cancelReminder => localizedValues["CancelReminder"][locale.languageCode]; - + String get reminderCancelSuccess => localizedValues["reminderCancelSuccess"][locale.languageCode]; + String get syncSuccess => localizedValues["syncSuccess"][locale.languageCode]; + String get useLakumPoints => localizedValues["useLakumPoints"][locale.languageCode]; + String get points => localizedValues["points"][locale.languageCode]; + String get availableBalance => localizedValues["availableBalance"][locale.languageCode]; + String get ordersDashboard => localizedValues["ordersDashboard"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index 274ef651..affd9a3e 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; -extension WithContainer on DefaultButton { +extension WithContainer on Widget { Widget get insideContainer => Container(color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); } @@ -11,8 +12,12 @@ class DefaultButton extends StatelessWidget { final Color color; final Color disabledColor; final IconData iconData; + final String svgIcon; final double fontSize; - DefaultButton(this.text, this.onPress, {this.color, this.disabledColor, this.textColor = Colors.white, this.iconData, this.fontSize}); + final bool isTextExpanded; + final int count; + + DefaultButton(this.text, this.onPress, {this.color, this.isTextExpanded = true, this.svgIcon, this.disabledColor, this.count = 0, this.textColor = Colors.white, this.iconData, this.fontSize}); @override Widget build(BuildContext context) { @@ -22,15 +27,43 @@ class DefaultButton extends StatelessWidget { child: FlatButton( onPressed: onPress, child: Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ if (iconData != null) Icon(iconData, color: textColor), - Expanded( - child: Text( - text, - textAlign: TextAlign.center, - style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + if (svgIcon != null) SvgPicture.asset(svgIcon,color: textColor), + if (!isTextExpanded) + Padding( + padding: EdgeInsets.only(left: (iconData ?? svgIcon) != null ? 6 : 0), + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + ), + ), + if (isTextExpanded) + Expanded( + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + ), ), - ), + if (count > 0) + Align( + alignment: Alignment.topCenter, + child: Container( + margin: EdgeInsets.only(top: 6, bottom: 6), + padding: EdgeInsets.only(left: 5, right: 5), + alignment: Alignment.center, + height: 16, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0), color: Colors.white), + child: Text( + "$count", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w700, color: Color(0xffD02127), letterSpacing: -0.6), + ), + ), + ) ], ), // color: Color(0xffD02127), diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e24fd6f0..5ae0d119 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -48,9 +48,9 @@ class MyInAppBrowser extends InAppBrowser { static String PACKAGES_PAYMENT_SUCCESS_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess'; static String PACKAGES_PAYMENT_FAIL_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed'; - static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete']; + static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete', 'orderdetails']; - static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed']; + static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed', 'orderdetails']; final Function onExitCallback; final Function onLoadStartCallback; diff --git a/lib/widgets/offers_packages/PackagesCartItemCard.dart b/lib/widgets/offers_packages/PackagesCartItemCard.dart index 10c7e5b1..d53f9505 100644 --- a/lib/widgets/offers_packages/PackagesCartItemCard.dart +++ b/lib/widgets/offers_packages/PackagesCartItemCard.dart @@ -30,21 +30,20 @@ class PackagesCartItemCardState extends State { wide = !wide; return Container( decoration: cardRadius(15.0), - margin: EdgeInsets.only(left: 21.0, right: 21.0, top: 12.0), - height: 90, + height: 95, + padding: EdgeInsets.all(9), child: Row( mainAxisSize: MainAxisSize.max, children: [ _image(widget.itemModel.product), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _itemName(widget.itemModel.product.getName()), - _itemDescription(widget.itemModel.product.shortDescription), - Container( - padding: const EdgeInsets.only(top: 12.0), - width: MediaQuery.of(context).size.width * 0.65, - child: Row( + SizedBox(width: 7), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _itemName(widget.itemModel.product.getName()), + Expanded(child: _itemDescription(widget.itemModel.product.shortDescription)), + Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -54,11 +53,12 @@ class PackagesCartItemCardState extends State { await widget.viewModel.service.deleteProductFromCart(widget.itemModel.id, context: context, showLoading: false); widget.getCartItems(); }, - child: Row( - children: [ - Padding( - padding: const EdgeInsets.only(left: 5.0, right: 5.0), - child: Text( + child: Padding( + padding: const EdgeInsets.only(right: 3, bottom: 3), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( TranslationBase.of(context).removeMember, style: TextStyle( fontSize: 10, @@ -67,15 +67,16 @@ class PackagesCartItemCardState extends State { letterSpacing: -0.36, ), ), - ), - SvgPicture.asset("assets/images/new-design/delete.svg", color: CustomColors.accentColor), - ], + SizedBox(width: 2), + SvgPicture.asset("assets/images/new-design/delete.svg", color: CustomColors.accentColor), + ], + ), ), ), ], ), - ), - ], + ], + ), ) ], ), @@ -85,52 +86,41 @@ class PackagesCartItemCardState extends State { Widget _image(PackagesResponseModel model) => AspectRatio( aspectRatio: 1 / 1, - child: Padding( - padding: const EdgeInsets.all(9), - child: Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.grey[300], width: 0.25), - boxShadow: [BoxShadow(color: Colors.grey[200], blurRadius: 2.0, spreadRadius: 1, offset: Offset(1, 1.5))], - borderRadius: BorderRadius.circular(15), - color: Colors.white, - shape: BoxShape.rectangle, - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(15), - child: (model.images.isNotEmpty) ? Utils.loadNetworkImage(url: model.images.first.src, fitting: BoxFit.fill) : Container(color: Colors.grey[200])), - ), - ), + child: ClipRRect( + borderRadius: BorderRadius.circular(15), child: (model.images.isNotEmpty) ? Utils.loadNetworkImage(url: model.images.first.src, fitting: BoxFit.fill) : Container(color: Colors.grey[200])), ); -Widget _itemName(String name) => Padding( - padding: const EdgeInsets.only(top: 9.0), - child: Text(name, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.56, - ))); - -Widget _itemDescription(String desc) => Padding( - padding: const EdgeInsets.only(top: 0.0), - child: Text(desc, - style: TextStyle( - fontSize: 10, - // fontWeight: FontWeight.bold, - letterSpacing: -0.4, - ))); +Widget _itemName(String name) => Text( + name, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff2B353E), + letterSpacing: -0.56, + ), + ); -Widget _itemPrice(double price, {@required BuildContext context}) { - final prc = (price ?? 0.0).toStringAsFixed(2); - return Padding( - padding: const EdgeInsets.all(0), - child: Text( - '${prc} ${TranslationBase.of(context).sar}', +Widget _itemDescription(String desc) => Text( + desc, + maxLines: 2, + overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, + fontSize: 10, + fontWeight: FontWeight.w500, + color: Color(0xff535353), letterSpacing: -0.4, ), + ); + +Widget _itemPrice(double price, {@required BuildContext context}) { + final prc = (price ?? 0.0).toStringAsFixed(2); + return Text( + '$prc ${TranslationBase.of(context).sar}', + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff5D5D5D), + letterSpacing: -0.44, ), ); } diff --git a/lib/widgets/offers_packages/PackagesOfferCard.dart b/lib/widgets/offers_packages/PackagesOfferCard.dart index be756caf..14b1aeb0 100644 --- a/lib/widgets/offers_packages/PackagesOfferCard.dart +++ b/lib/widgets/offers_packages/PackagesOfferCard.dart @@ -2,10 +2,7 @@ import 'package:diplomaticquarterapp/core/model/packages_offers/responses/Packag import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -32,6 +29,103 @@ class PackagesItemCardState extends State { @override Widget build(BuildContext context) { wide = !wide; + return InkWell( + onTap: () { + Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OfferAndPackagesDetail(itemModel: widget.itemModel, onCartClick: widget.onCartClick))); + }, + child: AspectRatio( + aspectRatio: 162 / 279, + child: Container( + // width: widget.itemWidth, + // color: Colors.transparent, + decoration: cardRadius(15.0), + padding: const EdgeInsets.all(9.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: 144 / 144, + child: ClipRRect( + borderRadius: BorderRadius.circular(12.0), + child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), + ), + ), + SizedBox(height: 6), + Text( + widget.itemModel.name, + maxLines: 1, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.56, + color: Color(0xff2B353E), + ), + ), + Text("Special discount for all HMG Employees and their first…", + maxLines: 2, + style: TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xff535353), + ), + overflow: TextOverflow.ellipsis), + if (widget.itemModel.hasDiscountsApplied) + Container( + margin: const EdgeInsets.only(top: 19.0), + child: Text( + widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 9.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.36, + decoration: TextDecoration.lineThrough, + color: Color(0xffA0A0A0), + ), + ), + ), + Container( + margin: widget.itemModel.hasDiscountsApplied ? const EdgeInsets.only(top: 0.0) : const EdgeInsets.only(top: 19.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: const EdgeInsets.only(top: 0.0), + child: Text( + widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ), + RatingBar.readOnly( + initialRating: 4.5, // todo ask haroon about parameter for rating + size: 18.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + ], + ), + InkWell( + child: SvgPicture.asset("assets/images/new/add_to_cart.svg"), + onTap: () { + widget.onCartClick(widget.itemModel); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ); + return InkWell( onTap: () { Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OfferAndPackagesDetail(itemModel: widget.itemModel, onCartClick: widget.onCartClick))); @@ -50,8 +144,15 @@ class PackagesItemCardState extends State { child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), ), Container(margin: const EdgeInsets.only(top: 8.0), child: Text(widget.itemModel.name, maxLines: 1, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), - Container(width: MediaQuery.of(context).size.width * 0.4, child: Text("Special discount for all HMG Employees and their first…", maxLines: 2, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, letterSpacing: -0.4, color: CustomColors.textColor), overflow: TextOverflow.clip)), - if (widget.itemModel.hasDiscountsApplied) Container(margin: const EdgeInsets.only(top: 19.0), child: Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, style: TextStyle(fontSize: 9.0, fontWeight: FontWeight.w600, letterSpacing: -0.36, decoration: TextDecoration.lineThrough, color: CustomColors.grey2))), + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: Text("Special discount for all HMG Employees and their first…", + maxLines: 2, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, letterSpacing: -0.4, color: CustomColors.textColor), overflow: TextOverflow.clip)), + if (widget.itemModel.hasDiscountsApplied) + Container( + margin: const EdgeInsets.only(top: 19.0), + child: Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 9.0, fontWeight: FontWeight.w600, letterSpacing: -0.36, decoration: TextDecoration.lineThrough, color: CustomColors.grey2))), Container( margin: widget.itemModel.hasDiscountsApplied ? const EdgeInsets.only(top: 0.0) : const EdgeInsets.only(top: 19.0), child: Row( @@ -60,7 +161,10 @@ class PackagesItemCardState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container(margin: const EdgeInsets.only(top: 0.0), child: Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), + Container( + margin: const EdgeInsets.only(top: 0.0), + child: Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), RatingBar.readOnly( initialRating: 4.5, size: 18.0, diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 9731f2b1..1d5893fd 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -1,16 +1,16 @@ -import 'package:diplomaticquarterapp/Constants.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/login/welcome.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../locator.dart'; - class BottomNavPharmacyItem extends StatelessWidget { final String title; final IconData icon; @@ -22,15 +22,10 @@ class BottomNavPharmacyItem extends StatelessWidget { final bool isHome; final IconData activeIcon; - BottomNavPharmacyItem( - {this.icon, - this.changeIndex, - this.index, - this.currentIndex, - this.activeIcon, - this.title, - this.onTap, - this.isHome = false}); + + BottomNavPharmacyItem({this.icon, this.changeIndex, this.index, this.currentIndex, this.activeIcon, this.title, this.onTap, this.isHome = false}); + + AppSharedPreferences sharedPref = AppSharedPreferences(); @override Widget build(BuildContext context) { @@ -39,7 +34,7 @@ class BottomNavPharmacyItem extends StatelessWidget { return Expanded( child: SizedBox( - height: 66.0, + height: 66.0, child: Stack( clipBehavior: Clip.none, children: [ @@ -49,13 +44,8 @@ class BottomNavPharmacyItem extends StatelessWidget { highlightColor: Colors.transparent, splashColor: Colors.transparent, onTap: () { - if (!Provider.of(context, listen: false) - .isLogin && - (currentIndex == 2 || currentIndex == 3)) - Navigator.push( - context, - FadePage(page: WelcomeLogin()), - ); + if (!Provider.of(context, listen: false).isLogin && (currentIndex == 2 || currentIndex == 3)) + login(context); else changeIndex(currentIndex); }, @@ -63,9 +53,6 @@ class BottomNavPharmacyItem extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ -// SizedBox( -// height: 15, -// ), currentIndex == index ? Divider( color: Color(0xff5AB133), @@ -93,20 +80,14 @@ class BottomNavPharmacyItem extends StatelessWidget { title, textAlign: TextAlign.center, color: currentIndex == index ? Colors.grey : Colors.grey, - fontWeight: currentIndex == index - ? FontWeight.normal - : FontWeight.w400, + fontWeight: currentIndex == index ? FontWeight.normal : FontWeight.w400, fontSize: currentIndex == index ? 11 : 9, ), ], ), ), ), - if (currentIndex == 3 && - Provider.of(context, listen: false) - .cartResponse - .quantityCount != - 0) + if (currentIndex == 3 && Provider.of(context, listen: false).cartResponse.quantityCount != 0) Positioned( top: 11.5, right: -3.5, @@ -131,4 +112,35 @@ class BottomNavPharmacyItem extends StatelessWidget { ), ); } + + void setUserValues(value) async { + if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); + } + + login(BuildContext context) async { + final authService = new AuthProvider(); + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + GifLoaderDialogUtils.showMyDialog(context); + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); + } + } } diff --git a/pubspec.yaml b/pubspec.yaml index 73c9cea9..c7cda641 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -172,6 +172,8 @@ dependencies: badges: ^1.1.4 syncfusion_flutter_sliders: ^18.4.49-beta + searchable_dropdown: ^1.1.3 + dropdown_search: 0.4.9 # Dep by Zohaib shimmer: ^1.1.2 @@ -230,6 +232,9 @@ flutter: - assets/images/new/services/ - assets/images/new/appointment-rating/ - assets/images/new/payment/ + - assets/images/new/body_parts/ + - assets/images/new/body_parts/male/ + - assets/images/new/body_parts/female/ fonts: - family: WorkSans