Merge branch 'master' into Main_App_Replacement

# Conflicts:
#	ios/Runner.xcodeproj/project.pbxproj
#	ios/Runner/Info.plist
#	lib/core/api_consts.dart
#	pubspec.yaml
Main_App_Replacement
Haroon Amjad 1 month ago
commit 1d3ea2817c

@ -2,4 +2,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="120" height="120" fill="#EFF1F3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.2503 38.4816C33.2603 37.0472 34.4199 35.8864 35.8543 35.875H83.1463C84.5848 35.875 85.7503 37.0431 85.7503 38.4816V80.5184C85.7403 81.9528 84.5807 83.1136 83.1463 83.125H35.8543C34.4158 83.1236 33.2503 81.957 33.2503 80.5184V38.4816ZM80.5006 41.1251H38.5006V77.8751L62.8921 53.4783C63.9172 52.4536 65.5788 52.4536 66.6039 53.4783L80.5006 67.4013V41.1251ZM43.75 51.6249C43.75 54.5244 46.1005 56.8749 49 56.8749C51.8995 56.8749 54.25 54.5244 54.25 51.6249C54.25 48.7254 51.8995 46.3749 49 46.3749C46.1005 46.3749 43.75 48.7254 43.75 51.6249Z" fill="#687787"/>
</svg>

After

Width:  |  Height:  |  Size: 892 B

@ -0,0 +1,7 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="10" fill="#EFEFF0"/>
<g transform="translate(8.8, 8.8) scale(1.6)">
<path d="M11.5658 1.95717C9.82689 0.890531 8.26692 1.31563 7.32452 2.02335C7.26938 2.06476 7.22039 2.10153 7.17659 2.13413C7.08676 2.20099 7.04185 2.23442 6.98387 2.23442C6.92589 2.23442 6.88098 2.20099 6.79115 2.13413C6.74735 2.10153 6.69836 2.06476 6.64322 2.02335C5.70082 1.31563 4.14085 0.890531 2.40195 1.95717C1.53619 2.48823 0.943044 3.43564 0.767402 4.5853C0.741775 4.75304 0.728961 4.83691 0.781341 4.89789C0.83372 4.95888 0.923033 4.95887 1.10166 4.95885L3.00095 4.95868C3.24133 4.95767 3.64619 4.95596 4.03964 5.0991C4.19392 5.15522 4.33336 5.22877 4.4573 5.3094C4.63656 5.42602 4.72618 5.48433 4.79864 5.46761C4.87109 5.45089 4.92018 5.36908 5.01835 5.20545L5.44147 4.50026C5.71062 4.05168 6.19943 3.78162 6.72246 3.79256C7.24549 3.80349 7.72259 4.09374 7.97275 4.55319L8.72948 5.94294C8.77795 6.03196 8.80218 6.07647 8.8435 6.10102C8.88482 6.12557 8.9355 6.12557 9.03686 6.12557H9.31698C10.1224 6.12557 10.7753 6.77849 10.7753 7.5839C10.7753 8.38932 10.1224 9.04224 9.31698 9.04224L8.66574 9.04348C8.42373 9.04908 7.69714 9.06588 7.06184 8.57794C7.0432 8.56363 7.02501 8.54906 7.00725 8.5343C6.81047 8.37075 6.71208 8.28898 6.63276 8.30247C6.55344 8.31596 6.49635 8.41111 6.38218 8.6014L6.19249 8.91754C5.93991 9.33851 5.49248 9.60414 5.00197 9.62434C4.51146 9.64453 4.0437 9.41658 3.75738 9.0178L3.04199 8.02146C2.99064 7.94995 2.96497 7.91419 2.92736 7.8949C2.88975 7.8756 2.84573 7.8756 2.75769 7.8756L1.88603 7.87559C1.63453 7.87558 1.50878 7.87558 1.45819 7.96269C1.40759 8.0498 1.46788 8.15548 1.58846 8.36685C2.2106 9.45742 3.18686 10.5632 4.58832 11.6005C5.43495 12.2275 6.05634 12.6877 6.98387 12.6877C7.91141 12.6877 8.53279 12.2275 9.37943 11.6005C11.8175 9.79586 12.9688 7.78416 13.2073 6.00548C13.4447 4.23535 12.7682 2.69472 11.5658 1.95717Z" fill="#8F9AA3"/>
<path d="M7.20469 4.97105C7.10463 4.78727 6.91379 4.67117 6.70458 4.66679C6.49537 4.66242 6.29984 4.77044 6.19218 4.94988L4.8987 7.10568L4.50819 6.5618C4.50002 6.55043 4.49145 6.53935 4.48248 6.52859C4.47338 6.51766 4.4634 6.50547 4.45255 6.49222C4.32787 6.33991 4.08822 6.04716 3.74091 5.92081C3.49697 5.83206 3.23003 5.83265 2.965 5.83324L2.90072 5.83333H1.73405C1.41188 5.83333 1.15072 6.0945 1.15072 6.41667C1.15072 6.73883 1.41188 7 1.73405 7H2.90072C3.27245 7 3.31696 7.00823 3.34111 7.01684C3.34329 7.01792 3.36229 7.02776 3.40145 7.06546C3.45005 7.11226 3.4979 7.16947 3.57276 7.25931L4.46854 8.50689C4.58307 8.6664 4.77018 8.75758 4.96638 8.74951C5.16258 8.74143 5.34156 8.63518 5.44259 8.46679L6.66782 6.42473L7.16648 7.34054C7.17206 7.35078 7.17794 7.36086 7.18412 7.37075L7.20842 7.40983C7.30282 7.56206 7.41744 7.74688 7.59523 7.88343C7.98366 8.18176 8.4448 8.17225 8.67006 8.16761C8.69423 8.16711 8.71569 8.16667 8.73405 8.16667H9.31738C9.63955 8.16667 9.90072 7.9055 9.90072 7.58333C9.90072 7.26117 9.63955 7 9.31738 7H8.73405C8.69863 7 8.66723 7.00017 8.63892 7.00032C8.53614 7.00086 8.47421 7.00119 8.40933 6.99253C8.35288 6.98499 8.32768 6.97346 8.31135 6.96218C8.30864 6.95892 8.30403 6.95313 8.29726 6.94384C8.27206 6.90926 8.24113 6.86063 8.18271 6.76722L7.20469 4.97105Z" fill="#8F9AA3"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -1982,5 +1982,86 @@
"hide": "إخفاء",
"viewPatientQR": "عرض رمز الاستجابة السريعة للمريض",
"patientQR": "رمز الاستجابة السريعة للمريض",
"forText": "عن"
"forText": "عن",
"liveCareTermsHeading": "شروط خدمات الرعاية الصحية عن بُعد",
"liveCareTermsIntroHeading": "مقدمة",
"liveCareTermsConditions1": "تعتبر شركة مجموعة الدكتور سليمان الحبيب للخدمات الطبية ('المجموعة') واحدة من الشركات الرائدة في قطاع الرعاية الصحية في المملكة العربية السعودية والتي تسعى دائمًا لتحسين خدماتها في المنطقة، وكخطوة لنقل خدماتنا إلى مستوى آخر ولتسهيل عملية تلقي خدمات الرعاية الصحية، فقد اعتمدنا نهج تقديم بعض خدماتنا عن بُعد للمرضى. تنطبق هذه الشروط على خدمات الرعاية الصحية عن بُعد التي نقدمها، والتي تتيح إجراء الاستشارات بين الطبيب والمريض عبر الإنترنت، باستخدام تقنية الاتصالات الصوتية أو المرئية (يشار إليها غالباً باسم 'خدمات الرعاية الصحية عن بُعد').",
"liveCareTermsConditions2": "الغرض من خدمات الرعاية الصحية عن بعد هو تسهيل الاتصالات بين الممارسين الصحيين والمرضى لتقديم خدمات الرعاية الصحية من خلال وسائل الاتصال الإلكترونية المتقدمة، والتي تتيح للممارسين الصحيين تقييم وتشخيص وعلاج ومتابعة المرضى عن بُعد دون الحاجة إلى حضور المرضى شخصياً.",
"liveCareTermsHeading2": "الاتفاقية",
"liveCareTermsConditions3": "يتم تقديم خدمات الرعاية الصحية عن بُعد عبر تطبيق الهاتف المحمول أو الموقع الإلكتروني للمجموعة. تنطبق الشروط التالية على خدمات الرعاية الصحية عن بُعد: ",
"liveCareTermsConditions3a": "شروط استخدام الموقع الالكتروني - ",
"liveCareTermsConditions3b": "تفاقية مستخدم التطبيق - ",
"liveCareTermsConditions3c": "روط استخدام الخدمات الإلكترونية - ",
"liveCareTermsConditions3d": "شروط خدمات الرعاية الصحية عن بُعد هذه - ",
"liveCareTermsConditions4": "بالموافقة على الاستمرار في خدمات الرعاية الصحية عن بُعد وقبول هذه الشروط، فإنك تدخل في اتفاقية مع المجموعة تتضمن جميع الشروط المذكورة أعلاه (اتفاقية خدمات الرعاية الصحية عن بُعد).",
"liveCareTermsConditions5": "يتعين عليك أيضاً قراءة سياسة الخصوصية الخاصة بنا حيث تحتوي سياسة الخصوصية على تفاصيل حول كيفية استخدامنا لمعلوماتك الشخصية وحقوقك بشأنها. من خلال متابعة استخدام خدمات الرعاية الصحية عن بُعد، فإنك توافق على استخدامنا لمعلوماتك الشخصية وفقاً لسياسة الخصوصية الخاصة بنا وتوافق صراحةً على استخدامنا لمعلوماتك الشخصية لأداء خدمات الرعاية الصحية عن بُعد وأداء واجباتنا المهنية كمقدم لخدمات الرعاية الطبية.",
"liveCareTermsConditions6": "يتعين عليك أيضاً قراءة سياسة الخصوصية الخاصة بنا حيث تحتوي سياسة الخصوصية على تفاصيل حول كيفية استخدامنا لمعلوماتك الشخصية وحقوقك بشأنها. من خلال متابعة استخدام خدمات الرعاية الصحية عن بُعد، فإنك توافق على استخدامنا لمعلوماتك الشخصية وفقاً لسياسة الخصوصية الخاصة بنا وتوافق صراحةً على استخدامنا لمعلوماتك الشخصية لأداء خدمات الرعاية الصحية عن بُعد وأداء واجباتنا المهنية كمقدم لخدمات الرعاية الطبية.",
"liveCareTermsHeading3": "1.\tالتعاريف",
"liveCareTermsConditions7": "المجموعة تعني شركة مجموعة الدكتور سليمان الحبيب للخدمات الطبية والشركات التابعة لها.",
"liveCareTermsConditions8": "خدمات الرعاية الصحية عن بُعد تعني خدمة الرعاية الصحية عن بُعد التي تقدمها المجموعة، والتي تتيح الاستشارة والتشخيص والمتابعة عن بُعد بين المريض والطبيب، باستخدام التطبيق و/أو موقع الويب.",
"liveCareTermsConditions9": "خدماتنا تعني بعض الخدمات التي تقدمها المجموعة والتي تغطي استعراض السجلات الطبية للمرضى ونتائج الفحوصات الطبية، وتوفير التشخيصات الطبية بالإضافة إلى توفر خدمة الرعاية الصحية عن بعد بالصوت والفيديو بين ممارسي الرعاية الصحية والمرضى.",
"liveCareTermsConditions10": "التطبيق يعني تطبيق (Dr. ALHABIB) وهو عبارة عن منصة يتم من خلالها تقديم خدماتنا ويمكن للمستخدمين الولوج إليها.",
"liveCareTermsConditions11": "موقع الويب يعني موقع الويب الخاص بالمجموعة وهو عبارة عن منصة يتم من خلالها تقديم خدماتنا ويمكن للمستخدمين الدخول إليها.",
"liveCareTermsConditions12": "الشروط والأحكام تعني شروط خدمات الرعاية الصحية عن بُعد هذه.",
"liveCareTermsConditions13": "المحتوى يعني أي رسالة أو بيانات أو معلومات أو نص أو صوت أو صور أو فيديو أو رسومات أو رمز أو أي مادة أخرى واردة في التطبيق أو موقع الويب أو يتم نقلها عبر التطبيق أو موقع الويب.",
"liveCareTermsHeading4": "2.\tتعهدات المستخدم",
"liveCareTermsConditions14": "2-1\tمن خلال دخولك إلى خدمات الرعاية الصحية عن بُعد واستخدامها، فإنك توافق على هذه الشروط والأحكام ويتعين عليك ألا تحاول الدخول إلى خدماتنا إذا كنت لا توافق عليها.",
"liveCareTermsConditions15": "2-2\tأنت تضمن وتقر وتتعهد بأن جميع المعلومات التي تقدمها عن نفسك وعن أي شخص آخر صحيحة ودقيقة.",
"liveCareTermsConditions16": "2-3\tخدمات الرعاية الصحية عن بعد مخصصة للاستخدام من قبل المرضى الموجودين فعلياً في المملكة العربية السعودية (المنطقة المسموح بها) ولا ينبغي استخدامها من قبل المرضى خارج المنطقة المسموح بها. بالموافقة على هذه الشروط والأحكام والدخول إلى خدمات الرعاية الصحية عن بُعد عبر التطبيق أو موقع الويب، فإنك تقر وتضمن لنا أنك موجود فعلياً في إحدى المناطق المسموح بها.",
"liveCareTermsHeading5": "3.\tالقيود على خدمات الرعاية الصحية عن بعد والمخاطر المرتبطة بها",
"liveCareTermsConditions17": "3-1\tلا تستخدم التطبيق أو موقع الويب أو خدمات الرعاية الصحية عن بُعد للتواصل بشأن الحالات الطبية الطارئة أو علاجها. لا التطبيق ولا موقع الويب ولا خدمات الرعاية الصحية عن بُعد توفر الرعاية في الحالات الطبية الطارئة. إذا كانت هناك حالة طبية طارئة عاجلة أو كانت هناك حاجة إلى استجابة سريعة فيما يتعلق بصحتك، فانتقل إلى أقرب مركز/مستشفى طوارئ أو اتصل على الفور بأي رقم هاتف للطوارئ.",
"liveCareTermsConditions18": "3-2\tخدمات الرعاية الصحية عن بعد ليست مناسبة للحالات الطبية الطارئة وقد تكون هناك بعض العلاجات أو الأدوية التي لا يمكن تقديمها دون استشارة متابعة في حضور المريض شخصياً. إذا كنت تعتقد أن لديك حالة طبية خطيرة، فعليك طلب استشارة شخصية مع أخصائي طبي مرخص.",
"liveCareTermsConditions19": "3-3\tتهدف خدمات الرعاية الصحية عن بُعد إلى توفير مزايا تشمل راحة المريض. لذلك، فهو قد يكون الأنسب كبديل للاستشارة الشخصية للأمور الطبية الروتينية. ومع ذلك، هناك مخاطر محتملة مرتبطة باستخدام أي خدمة للرعاية الصحية عن بُعد، بما في ذلك خدمات الرعاية الصحية عن بُعد، وقد تشمل هذه المخاطر على سبيل المثال لا الحصر ما يلي:",
"liveCareTermsConditions19a": "(1) المعلومات المنقولة قد لا تكون كافية (مثل ضعف دقة الصور) للسماح باتخاذ القرار الطبي المناسب من قبل الممارسين الصحيين",
"liveCareTermsConditions19b": "(2) قد يقرر الممارسين الصحيين أن المعلومات المنقولة ليست ذات جودة كافية، مما يستلزم مقابلة المريض وجهاً لوجه، أو على الأقل إعادة جدولة استشارة طبية صوتية ومرئية في وقت لاحق",
"liveCareTermsConditions19c": "(3) يمكن أن يحدث تأخير في تقديم الرعاية الطبية بسبب أوجه القصور أو الأعطال في الأجهزة الإلكترونية",
"liveCareTermsConditions19d": "(4) يعتمد الممارس الصحي على المريض لتقديم جميع المعلومات ذات الصلة شفوياً وعبر الاستخدام المناسب لجهاز الكاميرا الخاص بالمريض. من الممكن ألا يتم تقديم المعلومات إلى الممارس أو قد لا تكون واضحة بقدر الوضوح الذي يتوفر للممارس الصحي أثناء إجراء الفحص البدني الشخصي",
"liveCareTermsConditions19e": "(5) قد تفشل البروتوكولات الأمنية، مما يتسبب في انتهاك خصوصية المعلومات الطبية الشخصية. على الرغم من أننا نتخذ تدابير معقولة لحماية أمن المعلومات المنقولة عبر التطبيق و/أو الموقع الإلكتروني، إلا أنه لا يمكن أبدًا ضمان أن تكون عمليات الإرسال هذه آمنة تماماً، والمعلومات المنقولة عبر شبكات الاتصالات العامة خارجة عن سيطرتنا ولا يمكننا تأمينها.",
"liveCareTermsConditions20": "3-4\tفي حال كنت تستخدم خدمات الرعاية الصحية عن بُعد ولكنك تواجه أي حالة أو مخاوف مستمرة، فإننا نوصيك بحجز استشارة شخصية.",
"liveCareTermsHeading6": "4.\tإخلاء المسؤولية عن الضمان",
"liveCareTermsConditions21": "4-1\tنحن لا نضمن ولا نقر أو نتعهد بأن خدمات الرعاية الصحية عن بُعد ستلبي احتياجاتك، أو أنها ستكون مستمرة دون انقطاع أو سيتم توفيرها في الوقت المناسب أو أنها آمنة أو خالية من الأخطاء أو خالية من الفيروسات. لن نتحمل أي مسؤولية تجاهك في حالة تعذر حدوث جلسة خدمات الرعاية الصحية عن بُعد أو تمت مقاطعتها أو التخلي عنها بسبب عدم توفر منصتنا عبر الإنترنت ومع ذلك، في حالة تعذر علينا إجراء جلسة خدمات الرعاية الصحية عن بُعد بالكامل بسبب تعطل منصتنا، فلن نتقاضى منك أي أجور عن جلسة الاستشارة البديلة.",
"liveCareTermsConditions22": "4-2\tتُستثنى جميع الضمانات الصريحة أو الضمنية بموجب النظام، باستثناء تلك التي لا يمكن استثناؤها بشكل قانوني.",
"liveCareTermsConditions23": "4-3\tلا يوجد في هذا القسم 4 أي نص يُقصد منه استبعاد أو تقييد مسؤوليتنا عن أي مطالبة تتعلق بالإهمال الطبي، إلى الحد الذي لا يسمح لنا فيه النظام المعمول به في المنطقة المسموح بها ذات الصلة بالقيام بذلك.",
"liveCareTermsHeading7": "5.\tالأهلية والتسجيل والاستخدام",
"liveCareTermsConditions24": "5-1\tمن أجل الدخول إلى خدمات الرعاية الصحية عن بُعد، يتعين عليك أن تفي بمتطلبات الحد الأدنى للسن وهو 18 عاماً (يتم احتسابها وفقاً للتقويم الميلادي) وأن تتمتع بالأهلية القانونية الكاملة.",
"liveCareTermsConditions25": "5-2\tيجب أن يحصل أي شخص يقل عمره عن 18 عاماً (يتم احتسابها وفقاً للتقويم الميلادي) يقوم بالدخول إلى خدمات الرعاية الصحية عن بُعد على إذن من أحد الوالدين أو الوصي للقيام بذلك.",
"liveCareTermsConditions26": "5-3\tأنت تضمن وتقر وتتعهد بأن لديك الحق القانوني والقدرة على الدخول إلى التطبيق و/أو موقع الويب وفقاً لهذه الشروط والأحكام و، عند الاقتضاء، إجراء الحجوزات والمدفوعات من خلال التطبيق أو موقع الويب.",
"liveCareTermsConditions27": "5-4\tتتم عملية التسجيل وفق ما ورد في شروط استخدام الخدمات الإلكترونية",
"liveCareTermsConditions28": "5-5\tخدمات الرعاية الصحية عن بُعد مخصصة فقط لاستخدامك الشخصي واستخدام أطفالك تحت إشرافك. يتعين عليك ألا تشارك بيانات تسجيل الدخول الخاصة بك (اسم المستخدم وكلمة المرور وما إلى ذلك) مع أي شخص آخر ويجب أن تتخذ خطوات معقولة للحفاظ على أمان هذه البيانات. يتم تقديم خدماتنا على أساس أن لدينا معلومات معينة حول المستخدم، والتي قد تكون مرتبطة أو تم الحصول عليها من تفاصيل حسابك (العمر والجنس والتاريخ الطبي وما إلى ذلك). نحن لا نتحمل أي مسؤولية من أي نوع تجاهك أو تجاه أي شخص آخر إذا تم تقديم خدماتنا عبر حساب مستخدم إلى شخص آخر غير المستخدم المسجل. هذا مهم بشكل خاص لخدمات الرعاية الصحية عن بعد، حيث سيحتاج الممارس الصحي إلى تقييم المعلومات التي يقدمها المريض أثناء الاستشارة في سياق الملف الطبي للمريض وتاريخه.",
"liveCareTermsConditions29": "5-6\tأنت مسؤول عن التأكد من أن لديك جهازاً متصلاً بالإنترنت وقادراً على إرسال واستقبال الفيديو والصوت. نحن لسنا مسؤولين عن أي انقطاع في جلسة خدمات الرعاية الصحية عن بعد بسبب ناجم عن جهازك أو اتصالك بالإنترنت. أنت مسؤول عن جميع التكاليف المرتبطة باتصالك بالإنترنت واستخدامك لها.",
"liveCareTermsConditions30": "5-7\tقد نقوم من وقت لآخر بإصدار تحديثات لتطبيقنا و/أو موقع الويب الخاص بنا. يجب عليك التأكد من أنك تقوم بتشغيل أحدث إصدار من التطبيق. قد يؤدي استخدام الإصدارات القديمة من التطبيق إلى حدوث أخطاء فنية أثناء استخدامك لخدمات الرعاية الصحية عن بُعد وقد يعرضك ذلك لمخاطر أمنية إضافية.",
"liveCareTermsHeading8": "6.\tخدمات الرعاية الصحية عن بُعد",
"liveCareTermsConditions31": "خدمات الرعاية الصحية عن بُعد الخاصة بنا سوف تكون لتخصصات طبية محددة أو لمواعيد المتابعة أو إعادة صرف الدواء. ",
"liveCareTermsHeading9": "7.\tالأجور والسداد",
"liveCareTermsConditions32": "خدمات الرعاية الصحية عن بُعد الخاصة بنا سوف تكون لتخصصات طبية محددة أو لمواعيد المتابعة أو إعادة صرف الدواء. ",
"liveCareTermsConditions33": "7-1\tستتم الإشارة إلى أجور استشارة خدمات الرعاية الصحية عن بُعد قبل أن تختار المتابعة. بمجرد المتابعة، فإنك توافق على سداد الأجور. لا تشمل تلك الأجور الأولية أي أجور لاحقة مثل أجور الوصفات الطبية والاختبارات المعملية واستشارات المتابعة وما إلى ذلك من أجور وسيتم إبلاغك بها بعد الاستشارة الأولية.",
"liveCareTermsConditions34": "7-2\tيتم تحديد شروط وطرق السداد المعمول بها في شروط استخدام الخدمات عبر الإنترنت الخاصة بنا.",
"liveCareTermsConditions35": "7-3\tقد يكون من الممكن فرض أجور خدمات الرعاية الصحية عن بُعد مباشرة على مزود التأمين الطبي، على الرغم من أننا لا نقدم أي تعهد أو ضمان بأن هذا سيكون ممكناً في أي وقت. تضمنت شروط استخدام الخدمات عبر الإنترنت الخاصة بنا مزيد من التفاصيل حول ذلك. إذا كان هذا التسهيل الخدمي متاحاً واخترت استخدامه، فستحتاج إلى تزويدنا بتفاصيل شركة التأمين الطبي وتغطية وثيقة التأمين، ما لم تكن قد قمت بذلك مسبقاً وربطتها بحسابك. أنت تفوضنا بموجب هذا بالتواصل مع أي شركة تأمين وفق التفاصيل التي تقدمها لنا في وقت الشراء أو المرتبطة بحسابك من أجل الحصول على الموافقة على تكلفة الخدمات المقدمة لك. أنت تقر بأنه قد يُطلب منا تقديم تفاصيل محددة عن الخدمات الطبية التي تطلبها من أجل القيام بذلك وتوافق صراحة على هذا الإفصاح.",
"liveCareTermsHeading10": "8.\tالاتصالات و/أو الاستفسارات",
"liveCareTermsConditions36": "في حال وجود أي أسئلة و/أو استفسارات بخصوص استخدام خدمات الرعاية الصحية عن بُعد، يرجى التواصل معنا على: EServices.HMG@drsulaimanalhabib.com أو الاتصال على الرقم: 9553 525 011",
"liveCareTermsHeading11": "9.\tحدود المسؤولية",
"liveCareTermsConditions37": "9-1\tمع مراعاة أي مسؤوليات ينص عليها النظام والتي لا يمكن استبعادها بموجبه، لا تتحمل المجموعة أو أي من مديرينا أو موظفينا أو وكلائنا أو مقاولينا المسؤولية تجاهك عن أي خسائر وأضرار ومسؤوليات ومطالبات ونفقات (بما في ذلك على سبيل المثال لا الحصر الأتعاب القانونية وتكاليف الدفاع أو التسوية) أيا كانت، سواء كانت مباشرة أو غير مباشرة أو تبعية، ناشئة عن أو متعلقة باستخدامك لخدمات الرعاية الصحية عن بُعد، أياً كان سبب نشوئها، سواء كان ذلك بموجب عقد أو المسؤولية التقصيرية (بما في ذلك الإهمال) أو النظام أو غير ذلك.",
"liveCareTermsConditions38": "9-2\tلن نكون مسؤولين تجاهك أو تجاه أي شخص آخر عن أي خسارة ناتجة عن سبب خارج عن سيطرتنا. يتضمن ذلك تعطل المعدات الإلكترونية أو الميكانيكية أو خطوط الاتصالات (بما في ذلك الهاتف والكابل والإنترنت)، أو الدخول غير المصرح به، أو أفعال أو إغفالات الأطراف الثالثة، أو الفيروسات، أو السرقة، أو أخطاء المشغل، أو الطقس القاسي أو غير العادي (بما في ذلك الفيضانات، أو الزلازل، أو أي من أفعال القضاء والقدر الأخرى)، أو الحرائق والحروب والتمرد والأعمال الإرهابية وأعمال شغب والنزاع العمالي أو المشاكل العمالية الأخرى أو الحوادث أو الطوارئ أو التأخير أو الحجز الزائد أو الإلغاء، أو الزوال الملكي أو أي إجراء حكومي.",
"liveCareTermsHeading12": "10.\tإنهاء الاستخدام",
"liveCareTermsConditions39": "10-1\tيجوز لنا التوقف عن توفير خدمات الرعاية الصحية عن بُعد في أي وقت ولأي سبب. لن نتحمل أي مسؤولية عن أي توقف، بما في ذلك عندما تكون خلال الاستشارات أو دورات العلاج باستخدام خدمات الرعاية الصحية عن بُعد. سنساعدك للتمكن من حجز الاستشارات الشخصية بدلاً من ذلك أو في نقل المعلومات ذات الصلة إلى مزود طبي بديل لتمكينك من مواصلة العلاج (مع مراعاة أنظمة حماية البيانات والسرية والممارسات الطبية والممارسات الطبية الجيدة السائدة).",
"liveCareTermsConditions40": "10-2\tيجوز لنا إنهاء استخدامك ودخولك إلى خدمات الرعاية الصحية عن بُعد لأي سبب أو بدون سبب، في أي وقت، سواء بإشعارك أو بدونه ودون تحمل أي مسؤولية تجاهك، ومع ذلك قد تنشأ هذه المسؤولية (على الرغم من أننا سنأخذ واجباتنا الطبية تجاهك بعين الاعتبار في حالة القيام بذلك).",
"liveCareTermsConditions41": "10-3\tستظل جميع القيود وجميع إخلاءات الطرف من المسؤولية والاستثناءات والقيود الخاصة بمسؤوليتنا سارية بعد أي إنهاء. عند الإنهاء، يتعين عليك عدم الدخول إلى أو استخدام التطبيق و/أو موقع الويب بشكل مباشر أو غير مباشر.",
"liveCareTermsHeading13": "11.\tالقانون الحاكم والاختصاص القضائي",
"liveCareTermsConditions42": "النظام المعمول به على التطبيق و/أو شروط وأحكام مستخدم موقع الويب والنزاعات الناشئة عنها أو المتعلقة بها هي أنظمة المملكة العربية السعودية. وأنت تخضع بشكل لا رجوع فيه للاختصاص القضائي الحصري لمحاكم المملكة العربية السعودية.",
"liveCareTermsHeading14": "12.\tالإقرارات",
"liveCareTermsConditions43": "12-1\tباستثناء ما هو منصوص عليه صراحةً في هذه الشروط والأحكام أو ما يسمح به أي نظام معمول به، فإنك توافق على ما يلي:",
"liveCareTermsConditions43a": "(1) أنك قد قرأت وفهمت هذه الشروط والأحكام والبنود الأخرى التي تشكل جزءاً من اتفاقيتك معنا",
"liveCareTermsConditions43b": "(2) أنك قد قرأت سياسة الخصوصية الخاصة بنا وتوافق بموجبه صراحة على استخدامنا لمعلوماتك الشخصية كما هو موضح فيها. بالإضافة إلى ذلك، أنت تدرك أن رقم الاتصال أو عنوان البريد الإلكتروني الذي زودتنا به عند التسجيل سيتم استخدامه للاتصالات من قبل المجموعة من خلال الرسائل القصيرة أو البريد الإلكتروني أو أي طريقة أخرى فيما يتعلق بخدمات الرعاية الصحية عن بُعد، بما في ذلك إشعارات المواعيد والخدمات الطبية الحالية.",
"liveCareTermsConditions43c": "(3) أنت تدرك أن لديك الحق في حجب أو سحب موافقتك بشأن استخدام التطبيق و/أو موقع الويب في سياق رعايتك في أي وقت، دون التأثير على حقك في تلقي الرعاية أو العلاج في المستقبل؛",
"liveCareTermsConditions43d": "(4) أنت تدرك أنك قد تتوقع الحصول على مزايا من استخدام التطبيق و/أو موقع الويب فيما يتعلق برعايتك الصحية، ولكن لا يمكن ضمان أي نتائج أو تأكيدها؛",
"liveCareTermsConditions43e": "(5) أنت تدرك أنه قد تتم مشاركة معلومات الرعاية الصحية الخاصة بك مع موظفين آخرين في المجموعة لأغراض جدولة المواعيد والفواتير؛",
"liveCareTermsConditions43f": "(6) أنت تدرك أن صور الفيديو والتسجيلات الصوتية الخاصة بك قد يتم التقاطها وتخزينها إلكترونياً. وأنت تدرك كذلك أنه يمكن استخدام هذه التسجيلات لاحقاً فيما يتعلق بالإجراءات النظامية إذا لزم الأمر ولكن لن يتم استخدامها لأي غرض بخلاف توفير خدمات الرعاية الصحية عن بُعد وخدمات المتابعة الطبية لك. أنت تقر وتوافق على استخدام هذه الصور والتسجيلات الصوتية من قبلنا للأغراض الموضحة؛",
"liveCareTermsConditions43g": "(7) أنك تدرك مخاطر الاتصال عبر البريد الإلكتروني والرسائل النصية، ولا سيما مخاطر الخصوصية. أنت تدرك أن المجموعة لا يمكنها ضمان أمان وسرية البريد الإلكتروني أو الاتصالات النصية. لن تكون المجموعة مسؤولة عن الرسائل التي لم يتم استلامها أو تسليمها بسبب عطل فني أو الكشف عن معلومات سرية ما لم يكن ذلك بسبب سوء سلوك متعمد.",
"liveCareTermsHeading15": "13.\tشروط وأحكام عامة",
"liveCareTermsConditions44": "13-1\tيجوز لنا في أي وقت تغيير هذه الشروط والأحكام لأسباب أمنية أو نظامية أو تنظيمية ، أو لتعكس التحديثات أو التغييرات التي تطرأ على خدمات أو وظائف خدمات الرعاية الصحية عن بُعد أو التطبيق، عن طريق نشر الشروط والأحكام المتنوعة على التطبيق. سنخطرك في التطبيق بأن هذه الشروط والأحكام قد تغيرت قبل استخدامك التالي لخدمات الرعاية الصحية عن بُعد وستتاح لك الفرصة للموافقة على الشروط المعدلة قبل استخدام الخدمة مرة أخرى.",
"liveCareTermsConditions45": "13-2\tيجوز لنا أداء أي من التزاماتنا، وممارسة أي من الحقوق الممنوحة لنا بموجب هذه الشروط والأحكام، من خلال طرف ثالث. يجوز لنا التنازل عن أي من حقوقنا والتزاماتنا أو جميعها بموجب هذه الشروط والأحكام إلى أي طرف ثالث.",
"liveCareTermsConditions46": "13-3\tإذا تبين أن أي بند أو جزء من أي بند من هذه الشروط والأحكام باطل أو غير قابل للإنفاذ أو غير صالح، فسيتم فصله عن هذه الشروط والأحكام، تاركاً باقي الشروط سارية المفعول بكامل الأثر والنفاذ، بشرط ألا يغير فصل ذلك البند من الطبيعة الأساسية لهذه الشروط والأحكام.",
"liveCareTermsHeading16": "14.\tالشكاوى",
"liveCareTermsConditions47": "خدمات الرعاية الصحية عن بُعد الخاصة بنا سوف تكون لتخصصات طبية محددة أو لمواعيد المتابعة أو إعادة صرف الدواء. ",
"liveCareTermsConditions48": "إذا كانت لديك أي شكاوى أو مخاوف بشأن التطبيق و/أو موقع الويب أو خدماتنا أو كيفية تعاملنا مع معلوماتك الشخصية، فيرجى التواصل معنا على: EServices.HMG@drsulaimanalhabib.com أو الاتصال على الرقم: 9553 525 011"
}

@ -21,7 +21,7 @@
"mySchedule": "My Schedule",
"logout": "Logout",
"respirationRate": "Respiration Rate",
"bookAppo": "New Appointment",
"bookAppo": "Book Appointment",
"searchBy": "Search By:",
"clinic": "Clinic",
"byClinic": "By Clinic",
@ -1972,7 +1972,88 @@
"hide": "Hide",
"viewPatientQR": "View Patient QR Code",
"patientQR": "Patient QR Code",
"forText": "For"
"forText": "For",
"liveCareTermsHeading": "TELEHEALTH SERVICES TERMS OF USE",
"liveCareTermsIntroHeading": "INTRODUCTION",
"liveCareTermsConditions1": "Dr. Sulaiman Al Habib Medical Services Group Company (the “Group”) is one of the leaders in the healthcare sector in the Kingdom of Saudi Arabia with an aim to always improve its services in the region, and as a step to take our services to another level and to facilitate the process of receiving healthcare services we have adopted the approach of providing some of our services remotely to patients. These terms apply to our Telehealth Services, which enable consultations to occur between a doctor and a patient over the internet, using audio or and video conferencing technology (often referred to as “Telehealth Services”).",
"liveCareTermsConditions2": "The purpose of the Telehealth Services is to facilitate communication between healthcare practitioners and patients to provide healthcare services through advanced electronic communication means, which allows healthcare professionals to evaluate, diagnose, treat and follow-up with patients remotely without the need for patients to attend in person.).",
"liveCareTermsHeading2": "AGREEMENT",
"liveCareTermsConditions3": "Telehealth Services is delivered over the Group’s mobile application or and Website. The following terms apply to the Telehealth Services: ",
"liveCareTermsConditions3a": " - Website Terms of Use",
"liveCareTermsConditions3b": " - App User Agreement",
"liveCareTermsConditions3c": " - Online Services Terms of Use",
"liveCareTermsConditions3d": " - These Telehealth Services User Terms of Use",
"liveCareTermsConditions4": "By agreeing to proceed with the Telehealth Services and accepting these terms, you enter into an agreement with The Group incorporating all the above terms (Telehealth Services Agreement).",
"liveCareTermsConditions5": "Our Privacy Policy should also be read. It contains details about how we use your personal information and your rights. By proceeding with the Telehealth Services, you agree to our use of your personal information in accordance with our Privacy Policy and you expressly consent to our use of your personal information for the performance of the Telehealth Services and the discharge of our professional duties as a medical care provider.",
"liveCareTermsConditions6": "Our Privacy Policy should also be read. It contains details about how we use your personal information and your rights. By proceeding with the Telehealth Services, you agree to our use of your personal information in accordance with our Privacy Policy and you expressly consent to our use of your personal information for the performance of the Telehealth Services and the discharge of our professional duties as a medical care provider.",
"liveCareTermsHeading3": "1. DEFINITIONS",
"liveCareTermsConditions7": "Group means Dr. Sulaiman Al Habib Medical Services Group Company and its subsidiaries. ",
"liveCareTermsConditions8": "Telehealth Services means the Group’s telehealth service, enabling remote consultation, diagnosis and follow-up between the patient and doctor, using the Application and or the Website.",
"liveCareTermsConditions9": "Our Services means certain services provided by the Group which covers viewing patients’ medical records and medical test results, providing medical diagnostics in addition to the availability of voice and video Telehealth Service between healthcare practitioners and patients.",
"liveCareTermsConditions10": "Application means Dr. ALHABIB Application which is a platform where Our Services are provided through and accessible by users. ",
"liveCareTermsConditions11": "Website means the Group internet website which is a platform where Our Services are provided through and accessible by users. ",
"liveCareTermsConditions12": "Terms & Conditions means these Telehealth Services Terms of Use. ",
"liveCareTermsConditions13": "Content means any message, data, information, text, sound, photos, video, graphics, code or any other material contained on the Application and or the Website or transmitted via the Application and or the Website. ",
"liveCareTermsHeading4": "2. USER UNDERTAKINGS",
"liveCareTermsConditions14": "2.1 By accessing and using Telehealth Services, you agree to these Terms & Conditions, and you should not attempt to access Our Services if you do not agree. ",
"liveCareTermsConditions15": "2.2 You warrant, represent and undertake that all information you provide about yourself and about anyone else is true and accurate. ",
"liveCareTermsConditions16": "2.3 Telehealth Services is intended for use by patients physically located in the Kingdom Saudi Arabia (Permitted Territory) and should not be used by patients outside the Permitted Territory. By agreeing to these Terms & Conditions and accessing Telehealth Services via the Application and or the Website, you represent and warrant to us that you are physically located in one of the Permitted Territory. ",
"liveCareTermsHeading5": "3. LIMITATIONS OF TELEHEALTH SERVICES AND ASSOCIATED RISKS",
"liveCareTermsConditions17": "3.1 Do not use the Application and or the Website or the Telehealth Services to communicate or treat medical emergencies. Neither the Application nor the Website nor Telehealth Services are intended for the provision of care in an emergency. IF THERE IS AN URGENT MEDICAL EMERGENCY OR A RESPONSE IS NEEDED QUICKLY REGARDING YOUR HEALTH, GO TO A NEARBY EMERGENCY CENTER/HOSPITAL OR CALL IMMEDIATELY ANY EMERGENCY PHONE NUMBER. ",
"liveCareTermsConditions18": "3.2 Telehealth Services is not appropriate for emergency conditions and there may be some treatments or medicines which cannot be provided without follow-up physical consultation. If you believe you have a serious medical condition, you should seek an in-person consultation with a licensed medical professional.",
"liveCareTermsConditions19": "3.3 Telehealth Services is intended to provide benefits including patient convenience. As such, it is most suitable as an alternative to in-person consultation for routine medical matters. However, there are potential risks associated with the use of any telehealth service, including Telehealth Services, and these risks may include but not be limited to the following: ",
"liveCareTermsConditions19a": "(a) information transmitted may not be sufficient (e.g. poor resolution of images) to allow for appropriate medical decision making by healthcare practitioners.",
"liveCareTermsConditions19b": "(b) healthcare practitioners may determine that the transmitted information is of inadequate quality, thus necessitating a face-to-face meeting with the patient, or at least a rescheduled voice and video medical consult. ",
"liveCareTermsConditions19c": "(c) delays in medical care could occur due to deficiencies or failures of the electronic devices. ",
"liveCareTermsConditions19d": "(d) the practitioner is dependent on the patient to provide all relevant information orally and via the appropriate use of the patient’s own camera device. It is possible that information may not be provided to the practitioner or may not be apparent which would have been apparent to the practitioner during an in-person physical examination. ",
"liveCareTermsConditions19e": "(e) security protocols could fail, causing a breach of privacy of personal medical information. Whilst we take reasonable measures to protect the security of the information transmitted over the Application and or the Website, such transmissions can never be guaranteed to be completely secure and information transmitted over public telecommunications networks is outside our control and cannot be secured by us.",
"liveCareTermsConditions20": "3.4 If you use Telehealth Services but are experiencing any ongoing condition or concerns, we recommend you schedule an in-person consultation. ",
"liveCareTermsHeading6": "4. DISCLAIMER OF WARRANTY ",
"liveCareTermsConditions21": "4.1 We do not warrant, represent or undertake that Telehealth Services will meet your needs, or that it will be uninterrupted, timely, secure, error-free or free from viruses. We shall have no liability to you if a Telehealth Services session cannot occur or is interrupted or abandoned due to any unavailability of our online platform, however, where the Telehealth Services session cannot be delivered fully due to the downtime of our own platform, we will not charge you for a replacement consultation.",
"liveCareTermsConditions22": "4.2 All warranties expressed or implied by law, except those that cannot be lawfully excluded, are excluded. ",
"liveCareTermsConditions23": "4.3 Nothing in this section 4 is intended to exclude or limit our liability for any medical negligence claim, to the extent the applicable law in the relevant Permitted Territory does not permit us to do so.",
"liveCareTermsHeading7": "5. ELIGIBILITY, REGISTRATION AND USE",
"liveCareTermsConditions24": "5.1 To access Telehealth Services, you must satisfy the minimum age requirement of 18 years (measured according to the Gregorian calendar) and have full legal capacity. ",
"liveCareTermsConditions25": "5.2 Any person under the age of 18 years (measured according to the Gregorian calendar) accessing Telehealth Services must have permission from their parent or guardian to do so.",
"liveCareTermsConditions26": "5.3 You warrant, represent and undertake that you possess the legal right and ability to access the Application and or the Website in accordance with these Terms & Conditions and, where relevant, to make bookings and payments through the Application and or the Website.",
"liveCareTermsConditions27": "5.4 The registration process is as provided in the Online Services Terms of Use.",
"liveCareTermsConditions28": "5.5 Telehealth Services is intended only for your own personal use and the use of your children under your supervision. You must not share your user access details (log-in name, password etc.) with any other person and must take reasonable steps to maintain the security of such details. Our services are delivered on the basis that we have certain information about the user, which may be connected to or obtained from your account details (age, gender, medical history etc.). We accept no responsibility whatsoever to you or any other person if our services are delivered via a user account to a person other than the registered user. This is particularly important for telehealth services, where the practitioner will need to assess the information, the patient provides during the consultation in the context of the patient’s medical file and history.",
"liveCareTermsConditions29": "5.6 You are responsible for ensuring you have a device connected to the internet and capable of transmitting and receiving video and sound. We are not responsible for any failure of a Telehealth Services session caused by your device or your internet connection. You are responsible for all costs associated with your own internet connection and use.",
"liveCareTermsConditions30": "5.7 From time to time we may release updates to our Application and or the Website. You should ensure that you are running the latest version of the Application. Use of old versions of the Application may lead to technical errors in your use of the Telehealth Services and may expose you to additional security risks.",
"liveCareTermsHeading8": "6. TELEHEALTH SERVICES",
"liveCareTermsConditions31": "Our Telehealth Services will be for specific medical specialties or follow-up or medication refill appointments.",
"liveCareTermsHeading9": "7. CHARGES AND PAYMENT",
"liveCareTermsConditions32": "Our Telehealth Services will be for specific medical specialties or follow-up or medication refill appointments.",
"liveCareTermsConditions33": "7.1 The charges for a Telehealth Services consultation will be indicated before you choose to proceed. By proceeding, you agree to pay the charges. Any subsequent charges, such as prescription charges, lab tests, follow-up consultations etc. are excluded from the initial charge and will be communicated to you following the initial consultation. ",
"liveCareTermsConditions34": "7.2 The applicable payment terms and methods are set out in our Online Services Terms of Use. ",
"liveCareTermsConditions35": "7.3 It may be possible to charge Telehealth Services directly to a provider of medical insurance, although we give no undertaking or warranty that this shall be possible at any given time. Further details are set out in our Online Services Terms of Use. If such facility is made available and you choose to use it, you will need to provide us with details of your medical insurer and policy coverage, unless you have already done so and linked them to your account. You hereby authorise us to contact any such insurer with the details you provide at the time of purchase, or which are linked to your account to seek approval of the cost of your services. You acknowledge that we may be required to provide specific details of the medical services sought by you to do so and you expressly consent to such disclosure.",
"liveCareTermsHeading10": "8. COMMUNICATION AND/OR INQUIRIES",
"liveCareTermsConditions36": "In case there are any questions and/or inquiries regarding the use of Telehealth Services please contact: EServices.HMG@drsulaimanalhabib.com or call 011 525 9553",
"liveCareTermsHeading11": "9. LIMITATION OF LIABILITY ",
"liveCareTermsConditions37": "9.1 Subject to any responsibilities implied by law and which cannot be excluded, neither the Group nor any of our directors, employees, agents or contractors, are liable to you for any losses, damages, liabilities, claims and expenses (including without limitation but not limited to legal costs and defense or settlement costs) whatsoever, whether direct, indirect or consequential, arising out of or referable to your use of Telehealth Services , however caused, whether in contract, tort (including negligence), statute or otherwise. ",
"liveCareTermsConditions38": "9.2 We will not be liable to you or anyone else for any loss resulting from a cause over which we do not have control. This includes failure of electronic or mechanical equipment or communications lines (including telephone, cable and Internet), unauthorized access, acts or omissions of third parties, viruses, theft, operator errors, severe or extraordinary weather (including flood, earthquake, or other act of God), fire, war, insurrection, terrorist act, riot, labor dispute or other labor problems, accident, emergency, delay, overbooking, cancellation, Royal demise or action of government",
"liveCareTermsHeading12": "10. TERMINATION OF USE",
"liveCareTermsConditions39": "10.1 We may discontinue the provision of Telehealth Services at any time and for any reason. We shall have no liability for any discontinuation, including where you are part-way through a series of consultations or courses of treatment using Telehealth Services. We will assist in enabling you to book in-person consultations instead or in transferring relevant information to an alternative medical provider to enable you to continue treatment (subject to data protection, confidentiality and medical practice laws and to prevailing medical good practice).",
"liveCareTermsConditions40": "10.2 We may terminate your use and access to Telehealth Services for any or no reason, at any time, with or without notice to you and without incurring any liability to you, however that liability may arise (although we will consider our medical duties to you, if doing so). ",
"liveCareTermsConditions41": "10.3 All restrictions and all disclaimers and exclusions and limitations of our liability will survive any termination. Upon termination, you must not directly or indirectly access or use the Application and or the Website.",
"liveCareTermsHeading13": "11. GOVERNING LAW AND JURISDICTION ",
"liveCareTermsConditions42": "The law applicable to the Application and or the Website User Terms and Conditions and to disputes arising out of or in connection with them are the laws of The Kingdom of Saudi Arabia. You irrevocably submit to the exclusive jurisdiction of the courts of the Kingdom of Saudi Arabia. ",
"liveCareTermsHeading14": "12. ACKNOWLEDGEMENTS",
"liveCareTermsConditions43": "12.1 Except as expressly set out in these Terms & Conditions or as permitted by any applicable law, you agree on the following: ",
"liveCareTermsConditions43a": "(a) you have read and understand these Terms & Conditions and the other terms forming part of your Agreement with us; ",
"liveCareTermsConditions43b": "(b) you have read our Privacy Policy and hereby expressly consent to our use of your personal information as described. In addition, you understand that the contact number or email address that you have provided on registration will be used for communications by the Group through SMS, email or any other method in connection with the Telehealth Services, including for appointment notifications and current medical services;",
"liveCareTermsConditions43c": "(c) you understand that you have the right to withhold or withdraw your consent to the use of the Application and or the Website in the course of your care at any time, without affecting your right to future care or treatment; ",
"liveCareTermsConditions43d": "(d) you understand that you may expect to receive benefits from the use of Application and or the Website concerning your healthcare, but that no results can be guaranteed or assured; ",
"liveCareTermsConditions43e": "(e) you understand that your healthcare information may be shared with other employees in the Group for scheduling and billing purposes;",
"liveCareTermsConditions43f": "(f) you understand that video images and audio recordings of you may be captured and stored electronically. You understand that these recordings may be later used in connection with legal proceedings if necessary but will not otherwise be used for any purpose other than providing Telehealth Services and follow-up medical services to you. You acknowledge and consent to the use of these images and audio recordings by us for the purposes described; ",
"liveCareTermsConditions43g": "(g) you understand the risks of communicating by email and text messages, particularly the privacy risks. You understand that the Group cannot guarantee the security and confidentiality of email or text communication. The Group will not be responsible for messages that are not received or delivered due to technical failure, or for disclosure of confidential information unless caused by intentional misconduct.",
"liveCareTermsHeading15": "13. GENERAL TERMS AND CONDITIONS ",
"liveCareTermsConditions44": "13.1 We may at any time vary these Terms & Conditions for security, legal or regulatory reasons, or to reflect updates or changes to the services or functionality of Telehealth Services or the Application, by publishing the varied Terms & Conditions on the Application. We will notify you on the Application that these Terms & Conditions have changed before your next use of the Telehealth Services and you will have the opportunity to agree to the revised terms before using the service again. ",
"liveCareTermsConditions45": "13.2 We may perform any of our obligations, and exercise any of the rights granted to us under these Terms & Conditions, through a third party. We may assign any or all our rights and obligations under these Terms & Conditions to any third party.",
"liveCareTermsConditions46": "13.3 If any clause or part of any clause of these Terms & Conditions is found to be void, unenforceable or invalid, then it will be severed from these Terms & Conditions, leaving the remainder in full force and effect, provided that the severance has not altered the basic nature of these Terms & Conditions. ",
"liveCareTermsHeading16": "14. COMPLAINTS",
"liveCareTermsConditions47": "Our Telehealth Services will be for specific medical specialties or follow-up or medication refill appointments.",
"liveCareTermsConditions48": "If you have any complaints or concerns about the Application and or the Website, Our Services, or how we handle your personal information please contact us on: EServices.HMG@drsulaimanalhabib.com or call 011 525 9553"
}

@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
37D27FAF2C38AC83B852680C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A83C76CFF9D3F92EDE3B22B4 /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
478CFA942E638C8E0064F3D7 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 478CFA932E638C8E0064F3D7 /* GoogleService-Info.plist */; };
61243B492EC5FA3700D46FA0 /* PenguinModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61243B422EC5FA3700D46FA0 /* PenguinModel.swift */; };
@ -126,7 +127,7 @@
76B1D2512F91BF8000DBBD1B /* Penguin.xcframework in Frameworks */,
76B1D2552F91BF8000DBBD1B /* PenNavUI.xcframework in Frameworks */,
76B1D2532F91BF8000DBBD1B /* PenguinINRenderer.xcframework in Frameworks */,
7CEC6842AAF072D6B4F1B9A6 /* Pods_Runner.framework in Frameworks */,
37D27FAF2C38AC83B852680C /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -370,10 +371,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
@ -387,10 +392,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";

@ -87,7 +87,9 @@
<key>NSMicrophoneUsageDescription</key>
<string>This app requires microphone access to enable virtual consultation between patient &amp; doctor</string>
<key>NSMotionUsageDescription</key>
<string>This app uses motion data to count your daily steps.</string>
<string>This app requires motion detection access to function properly.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to select image as document &amp; upload it.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires photo library access to upload profile picture and documents.</string>
<key>NSPhotoLibraryUsageDescription</key>

@ -302,7 +302,7 @@ class ApiConsts {
static String googleCloudStorageENTranslationFileBaseURL = "https://storage.googleapis.com/hmg-patientapp-translations";
// ************ static values for Api ****************
// static final double appVersionID = 21.8;
// static final double appVersionID = 21.9;
static final double appVersionID = 20.8;
// static final double appVersionID = 50.7;
@ -913,8 +913,6 @@ var AUTO_GENERATE_INVOICE_TAMARA = 'Services/PayFort_Serv.svc/REST/Tamara_Getinf
var GET_ONESIGNAL_VOIP_TOKEN = 'https://onesignal.com/api/v1/players';
var CANCEL_PHARMA_LIVECARE_REQUEST = 'https://vcallapi.hmg.com/api/PharmaLiveCare/SendPaymentStatus';
var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLogs';
var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality';

@ -110,6 +110,7 @@ class AppAssets {
static const String report_icon = '$svgBasePath/report_icon.svg';
static const String radiology_icon = '$svgBasePath/radiology_icon.svg';
static const String prescription_item_icon = '$svgBasePath/prescription_item_icon.svg';
static const String vital_sign_item_icon = '$svgBasePath/vital_sign_item_icon.svg';
static const String checkin_location_icon = '$svgBasePath/checkin_location_icon.svg';
static const String checkin_nfc_icon = '$svgBasePath/checkin_nfc_icon.svg';
static const String checkin_qr_icon = '$svgBasePath/checkin_qr_icon.svg';
@ -400,6 +401,7 @@ class AppAssets {
static const String descriptionIcon = '$svgBasePath/description_icon.svg';
static const String selectImageIcon = '$svgBasePath/select_image_icon.svg';
static const String patientQRCodeIcon = '$svgBasePath/patient_qr_code_icon.svg';
static const String noImageFound = '$svgBasePath/no_image_found.svg';
// PNGS //
static const String hmgLogo = '$pngBasePath/hmg_logo.png';

@ -170,7 +170,6 @@ class AppState {
set setIsAuthenticated(v) => isAuthenticated = v;
String deviceTypeID = "";
set setDeviceTypeID(v) => deviceTypeID = v;
@ -179,6 +178,14 @@ class AppState {
String get getFamilyFileTokenID => _familyFileTokenID;
bool isSafeDevice = true;
// set setIsSafeDevice(v) => isSafeDevice = v;
set setIsSafeDevice(bool value) {
isSafeDevice = value;
}
set setFamilyFileTokenID(String value) {
_familyFileTokenID = value;
}

@ -84,6 +84,7 @@ import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/services/notification_service.dart';
import 'package:hmg_patient_app_new/services/permission_service.dart';
import 'package:hmg_patient_app_new/services/security_service.dart';
import 'package:hmg_patient_app_new/core/services/turnstile_service.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_calendar_model.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart';
@ -157,6 +158,10 @@ class AppDependencies {
getIt.registerLazySingleton<PermissionService>(() => PermissionService());
getIt.registerLazySingleton<TurnstileService>(() => TurnstileService(getIt<LoggerService>()));
getIt.registerLazySingleton<SecurityService>(() => SecurityServiceImpl(
appState: getIt(),
loggerService: getIt(),
));
// Repositories
getIt.registerLazySingleton<CommonRepo>(() => CommonRepoImp(loggerService: getIt()));
@ -369,7 +374,11 @@ class AppDependencies {
errorHandlerService: getIt(),
));
getIt.registerLazySingleton<PayTabsViewModel>(() => PayTabsViewModel(appState: getIt()));
getIt.registerLazySingleton<PayTabsViewModel>(() => PayTabsViewModel(
appState: getIt(),
payfortRepo: getIt(),
errorHandlerService: getIt(),
));
getIt.registerLazySingleton<ClarityService>(
() => ClarityService(appState: getIt.get<AppState>()),

@ -3,6 +3,11 @@ class PaymentSdkDefaultConfig {
static const String profileID = "119730";
static const String serverKey = "SWJ9LD22MT-JLJZLBKTLK-WGWTLWGTWR";
static const String clientKey = "C7K2DQ-PDDN6B-69B2K7-P9GB9T";
// static const String profileID = "135577";
// static const String serverKey = "SDJ9LD22LR-J9LRBKZDRD-ZRZKWDWBRR";
// static const String clientKey = "CBK2DQ-PDPN6P-BR2K9D-VPBTB2";
static const String defaultCurrency = "SAR";
static const double defaultAmount = 10.0;
static const String defaultMerchantCountryCode = "SA";

@ -0,0 +1,15 @@
import 'package:freerasp/freerasp.dart';
final talsecConfig = TalsecConfig(
androidConfig: AndroidConfig(
packageName: 'com.cloudsolutions.HMGPatientApp',
signingCertHashes: ['6tvWaoN5coG4SnfxGbdQlcLmM0J4ePQwDjrKIg+QkV0=', 'j6VEqVhrypHMIiXiFdRLDdGwjGaMGWY7KAdBJA+Z4Pc='], // Must be the release cert hash
supportedStores: ['com.android.vending'], // Google Play Store
),
iosConfig: IOSConfig(
bundleIds: ['com.cloudsolutions.HMGPatientApp'], // iOS Bundle ID
teamId: '3A359E86ZF', // Found in Apple Developer portal
),
watcherMail: '', // Required to receive security alerts
isProd: true, // Enforces strict checks for release builds
);

@ -27,7 +27,7 @@ class RequestUtils {
}) {
bool fileNo = false;
if (nationId.isNotEmpty) {
final numericRegex = RegExp(r'^[0-9]+$');
final numericRegex = RegExp(r'^[0-9]+$');
fileNo = nationId.length < 10 && numericRegex.hasMatch(nationId);
//fileNo = nationId.length < 10 && nationId.isNumericOnly() ;
if (fileNo) {
@ -40,14 +40,23 @@ class RequestUtils {
if (zipCode == "0") {
request.patientMobileNumberOthers = phoneNumber;
} else {
request.patientMobileNumber = int.parse(phoneNumber);
// Remove any non-numeric characters before parsing
final numericPhone = phoneNumber.replaceAll(RegExp(r'[^0-9]'), '');
final parsedPhone = int.tryParse(numericPhone);
if (parsedPhone != null) {
request.patientMobileNumber = parsedPhone;
} else {
// If parsing fails, use as string in Others field
request.patientMobileNumberOthers = phoneNumber;
}
}
}
request.oTPSendType = otpTypeEnum.toInt(); // could map OTPTypeEnum if needed
request.zipCode = zipCode; // or countryCode if defined elsewhere
if (isForRegister) {
request.patientIdentificationID = int.parse(nationId);
final parsedNationId = int.tryParse(nationId.replaceAll(RegExp(r'[^0-9]'), ''));
request.patientIdentificationID = parsedNationId ?? 0;
request.searchType = 1;
request.isHijri = calenderType.toInt;
request.patientID = patientId;
@ -56,7 +65,7 @@ class RequestUtils {
request.isDentalAllowedBackend = false;
} else {
if (fileNo) {
request.patientID = patientId ?? int.parse(nationId);
request.patientID = patientId ?? (int.tryParse(nationId.replaceAll(RegExp(r'[^0-9]'), '')) ?? 0);
request.patientIdentificationID = request.nationalID;
request.searchType = 2;
} else {
@ -71,15 +80,15 @@ class RequestUtils {
static dynamic getCommonRequestWelcome(
{required String phoneNumber,
required OTPTypeEnum otpTypeEnum,
required String? deviceToken,
required bool patientOutSA,
required String? loginTokenID,
RegistrationDataModelPayload? registeredData,
int? patientId,
required String nationIdText,
required String countryCode,
required int loginType}) {
required OTPTypeEnum otpTypeEnum,
required String? deviceToken,
required bool patientOutSA,
required String? loginTokenID,
RegistrationDataModelPayload? registeredData,
int? patientId,
required String nationIdText,
required String countryCode,
required int loginType}) {
bool fileNo = false;
if (nationIdText.isNotEmpty) {
final numericRegex = RegExp(r'^[0-9]+$');
@ -91,8 +100,17 @@ class RequestUtils {
request.patientMobileNumberOthers = phoneNumber;
request.mobileNo = phoneNumber;
} else {
request.patientMobileNumber = int.parse(phoneNumber);
request.mobileNo = '0$phoneNumber';
// Remove any non-numeric characters before parsing
final numericPhone = phoneNumber.replaceAll(RegExp(r'[^0-9]'), '');
final parsedPhone = int.tryParse(numericPhone);
if (parsedPhone != null) {
request.patientMobileNumber = parsedPhone;
request.mobileNo = '0$numericPhone';
} else {
// If parsing fails, use as string in Others field
request.patientMobileNumberOthers = phoneNumber;
request.mobileNo = phoneNumber;
}
}
request.deviceToken = deviceToken;
request.projectOutSA = patientOutSA;
@ -106,8 +124,8 @@ class RequestUtils {
request.searchType = registeredData.searchType != null
? registeredData.searchType
: fileNo
? 1
: 2;
? 1
: 2;
request.patientID = registeredData.patientId ?? 0;
request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0);
request.dob = registeredData.dob;
@ -115,7 +133,8 @@ class RequestUtils {
log("nationIdText: ${nationIdText}");
} else {
if (fileNo) {
request.patientID = patientId ?? int.parse(nationIdText);
final numericNationId = nationIdText.replaceAll(RegExp(r'[^0-9]'), '');
request.patientID = patientId ?? (int.tryParse(numericNationId) ?? 0);
request.patientIdentificationID = request.nationalID = '0';
request.searchType = 2;
//TODO: Issue HEre is Not Login
@ -155,8 +174,17 @@ class RequestUtils {
request.patientMobileNumberOthers = mobileNumber;
request.mobileNo = mobileNumber;
} else {
request.patientMobileNumber = int.parse(mobileNumber);
request.mobileNo = '0$mobileNumber';
// Remove any non-numeric characters before parsing
final numericMobile = mobileNumber.replaceAll(RegExp(r'[^0-9]'), '');
final parsedMobile = int.tryParse(numericMobile);
if (parsedMobile != null) {
request.patientMobileNumber = parsedMobile;
request.mobileNo = '0$numericMobile';
} else {
// If parsing fails, use as string in Others field
request.patientMobileNumberOthers = mobileNumber;
request.mobileNo = mobileNumber;
}
}
}
request.projectOutSA = patientOutSA;
@ -240,16 +268,16 @@ class RequestUtils {
"Patientobject": {
"TempValue": true,
"PatientIdentificationType": (isDubai
? appState.getUserRegistrationPayload.patientIdentificationId?.toString().substring(0, 1)
: appState.getNHICUserData.idNumber!.substring(0, 1)) ==
"1"
? appState.getUserRegistrationPayload.patientIdentificationId?.toString().substring(0, 1)
: appState.getNHICUserData.idNumber!.substring(0, 1)) ==
"1"
? 1
: 2,
"PatientIdentificationNo":
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
"MobileNumber": appState.getUserRegistrationPayload.patientMobileNumber ?? 0,
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
appState.getUserRegistrationPayload.zipCode == '+966')
appState.getUserRegistrationPayload.zipCode == '+966')
? 0
: 1,
"FirstNameN": isDubai ? "..." : appState.getNHICUserData.firstNameAr,
@ -266,31 +294,31 @@ class RequestUtils {
"DateofBirthN": date,
"EmailAddress": emailAddress,
"SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
appState.getUserRegistrationPayload.zipCode == '+966')
appState.getUserRegistrationPayload.zipCode == '+966')
? "1"
: "2",
"PreferredLanguage": appState.getLanguageCode() == "ar" ? (isDubai ? "1" : 1) : (isDubai ? "2" : 2),
"Marital": isDubai
? (maritalStatus == MaritalStatusTypeEnum.single
? '0'
: maritalStatus == MaritalStatusTypeEnum.married
? '1'
: '2')
? '0'
: maritalStatus == MaritalStatusTypeEnum.married
? '1'
: '2')
: (appState.getNHICUserData.maritalStatusCode == 'U'
? '0'
: appState.getNHICUserData.maritalStatusCode == 'M'
? '1'
: '2'),
? '0'
: appState.getNHICUserData.maritalStatusCode == 'M'
? '1'
: '2'),
},
"PatientIdentificationID":
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
"PatientMobileNumber": appState.getUserRegistrationPayload.patientMobileNumber.toString()[0] == '0'
? appState.getUserRegistrationPayload.patientMobileNumber
: '0${appState.getUserRegistrationPayload.patientMobileNumber}',
"DOB": dob,
"IsHijri": appState.getUserRegistrationPayload.isHijri,
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
appState.getUserRegistrationPayload.zipCode == '+966')
appState.getUserRegistrationPayload.zipCode == '+966')
? 0
: 1,
"isDentalAllowedBackend": appState.getUserRegistrationPayload.isDentalAllowedBackend,
@ -314,7 +342,9 @@ class RequestUtils {
request.sharedPatientId = 0;
request.sharedPatientIdentificationId = nationalIDorFile;
} else if (loginType == 2) {
request.sharedPatientId = int.parse(nationalIDorFile);
// Remove any non-numeric characters before parsing
final numericId = nationalIDorFile.replaceAll(RegExp(r'[^0-9]'), '');
request.sharedPatientId = int.tryParse(numericId) ?? 0;
request.sharedPatientIdentificationId = '';
}
request.searchType = loginType;
@ -325,4 +355,4 @@ class RequestUtils {
request.isDentalAllowedBackend = false;
return request;
}
}
}

@ -851,7 +851,7 @@ class Utils {
/// Widget to build an image from network - automatically preserves colors in visual modes
static Widget buildImgWithNetwork({
required String url,
required String? url,
required Color iconColor,
bool isDisabled = false,
double? width,
@ -859,6 +859,13 @@ class Utils {
BoxFit fit = BoxFit.cover,
ImageErrorWidgetBuilder? errorBuilder,
}) {
if (url == null || url.isEmpty) {
return Utils.buildSvgWithAssets(
width: width ?? 24.w,
height: height ?? 24.h,
icon: AppAssets.noImageFound,
);
}
final iconH = height ?? 24.h;
final iconW = width ?? 24.w;
return PreserveImageColors(
@ -870,7 +877,7 @@ class Utils {
errorBuilder: errorBuilder ??
(_, __, ___) {
//todo_section change the error builder icon that it is returning
return Utils.buildSvgWithAssets(width: iconW, height: iconH, icon: AppAssets.no_visit_icon);
return Utils.buildSvgWithAssets(width: iconW, height: iconH, icon: AppAssets.noImageFound);
},
),
);
@ -1057,9 +1064,42 @@ class Utils {
return isHavePrivilege;
}
static void openWebView({required String url}) {
Uri uri = Uri.parse(url);
launchUrl(uri, mode: LaunchMode.inAppBrowserView);
static Future<void> openWebView({required String url}) async {
try {
Uri uri = Uri.parse(url);
// Validate URL scheme for in-app browser
if (!uri.hasScheme || (!uri.scheme.startsWith('http'))) {
throw 'Invalid URL scheme. In-app browser only supports HTTP/HTTPS URLs';
}
// Check if URL can be launched
if (await canLaunchUrl(uri)) {
final launched = await launchUrl(
uri,
mode: LaunchMode.externalApplication,
);
if (!launched) {
// Fallback to external browser
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
} else {
// Fallback to external browser
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
} catch (e) {
debugPrint('❌ Failed to open URL: $url - Error: $e');
// Try external browser as last resort
try {
final uri = Uri.parse(url);
await launchUrl(uri, mode: LaunchMode.externalApplication);
} catch (e2) {
debugPrint('❌ Failed to open URL in external browser: $e2');
// Optionally show user-friendly error message
}
}
}
static Color getCardBorderColor(int currentQueueStatus) {

@ -2,3 +2,9 @@ const Map configs = {
'ZOOM_SDK_KEY': 'b9T74nhfTg-ioP9urm970A',
'ZOOM_SDK_SECRET': 'KOzmjBNXQ1f4IPHpnngfL29uZvJMufSy2Fk8',
};
// const Map configs = {
// 'ZOOM_SDK_KEY': 'jYHoRpSUMTTefOwLq94Kyf1Kak513TUHpu78',
// 'ZOOM_SDK_SECRET': 'MOqi1zc18VFOMEaBDshFSHKLB0C2n9M0K48H',
// };

@ -31,6 +31,7 @@ import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_mode
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
@ -824,7 +825,11 @@ class AuthenticationViewModel extends ChangeNotifier {
onSuccess: (dynamic respData) async {
try {
if (respData != null) {
dynamic data = await SelectDeviceByImeiRespModelElement.fromJson(respData.toJson());
SelectDeviceByImeiRespModelElement data = SelectDeviceByImeiRespModelElement.fromJson(respData.toJson());
if (data.mobile == null || data.mobile == "" || data.identificationNo == null || data.identificationNo == "") {
return;
}
_appState.setSelectDeviceByImeiRespModelElement(data);
LoaderBottomSheet.hideLoader();
@ -856,8 +861,6 @@ class AuthenticationViewModel extends ChangeNotifier {
}
Future<void> checkUserAuthentication({required OTPTypeEnum otpTypeEnum, Function(dynamic)? onSuccess, Function(String)? onError}) async {
// TODO: THIS SHOULD BE REMOVED LATER ON AND PASSED FROM APP STATE DIRECTLY INTO API CLIENT. BECAUSE THIS API ONLY NEEDS FEW PARAMS FROM USER
loginTypeEnum = otpTypeEnum == OTPTypeEnum.sms ? LoginTypeEnum.sms : LoginTypeEnum.whatsapp;
// if (phoneNumberController.text.isEmpty) {
@ -1278,6 +1281,9 @@ class AuthenticationViewModel extends ChangeNotifier {
getIt.get<HabibWalletViewModel>().setIsWalletAmountToBeLoaded(true);
getIt.get<InsuranceViewModel>().setIsInsuranceDataToBeLoaded(true);
getIt.get<HmgServicesViewModel>().setHasVitalSignDataLoaded(false);
getIt.get<MedicalFileViewModel>().setIsSickLeavesDataNeedsReloading(true);
getIt.get<MedicalFileViewModel>().setIsMedicalReportsDataNeedsReloading(true);
getIt.get<PrescriptionsViewModel>().setIsPrescriptionDataNeedsReloading(true);
if (isUserAgreedBefore) {
LoaderBottomSheet.hideLoader();
navigateToHomeScreen();

@ -2,7 +2,9 @@
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/appointment_nearest_gate_response_model.dart';
@ -30,7 +32,7 @@ abstract class BookAppointmentsRepo {
Future<Either<Failure, GenericApiModel<DoctorsProfileResponseModel>>> getDoctorProfile(int clinicID, int projectID, int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError});
Future<Either<Failure, GenericApiModel<dynamic>>> getDoctorRatingDetails(int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError});
Future<Either<Failure, GenericApiModel<dynamic>>> getDoctorRatingDetails(int doctorId, int projectID, {Function(dynamic)? onSuccess, Function(String)? onError});
Future<Either<Failure, GenericApiModel<dynamic>>> getDoctorFreeSlots(int clinicID, int projectID, int doctorId, bool isBookingForLiveCare,
{bool continueDentalPlan = false, Function(dynamic)? onSuccess, Function(String)? onError});
@ -181,6 +183,9 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo {
"IsSearchAppointmnetByClinicID": isContinueDentalPlan ? false : true,
"isDentalAllowedBackend": clinicID == 17 ? true : isContinueDentalPlan,
"IsGetNearAppointment": isNearest,
"gender": getIt.get<AppState>().isAuthenticated ? getIt.get<AppState>().getAuthenticatedUser()!.gender! : 0,
"age": getIt.get<AppState>().isAuthenticated ? getIt.get<AppState>().getAuthenticatedUser()!.age! : 0,
"DateofBirth": getIt.get<AppState>().isAuthenticated ? getIt.get<AppState>().getAuthenticatedUser()!.dateofBirth! : null,
if (isNearest) "SelectedDate": DateUtil.convertDateToString(DateTime.now()),
"License": true
};
@ -309,9 +314,10 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo {
}
@override
Future<Either<Failure, GenericApiModel<dynamic>>> getDoctorRatingDetails(int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<Either<Failure, GenericApiModel<dynamic>>> getDoctorRatingDetails(int doctorId, int projectID, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
Map<String, dynamic> mapDevice = {
"DoctorID": doctorId,
"ProjectID": projectID,
"PatientID": 0,
"License": true,
"IsRegistered": true,

@ -676,7 +676,6 @@ class BookAppointmentsViewModel extends ChangeNotifier {
(failure) async {
isDoctorsListLoading = false;
if (onError != null) onError(LocaleKeys.noDoctorFound.tr());
notifyListeners();
},
(apiResponse) {
@ -691,7 +690,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
clearSearchFilters();
getFiltersFromDoctorList();
_groupDoctorsList();
setIsNearestAppointmentSelected(isNearest);
// setIsNearestAppointmentSelected(isNearest);
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@ -807,7 +806,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
doctorDetailsList.clear();
notifyListeners();
final result = await bookAppointmentsRepo.getDoctorRatingDetails(selectedDoctor.doctorID ?? 0, onSuccess: onSuccess, onError: onError);
final result = await bookAppointmentsRepo.getDoctorRatingDetails(selectedDoctor.doctorID ?? 0, selectedDoctor.projectID ?? 0, onSuccess: onSuccess, onError: onError);
result.fold(
(failure) async {

@ -67,7 +67,7 @@ abstract class HmgServicesRepo {
Future<Either<Failure, GenericApiModel<Covid19GetPaymentInfo>>> getCovidPaymentInfo(String procedureID, int projectID);
Future<Either<Failure, GenericApiModel<List<VitalSignResModel>>>> getPatientVitalSign();
Future<Either<Failure, GenericApiModel<List<VitalSignResModel>>>> getPatientVitalSign( num? transID, int? projectID);
}
class HmgServicesRepoImp implements HmgServicesRepo {
@ -917,8 +917,11 @@ class HmgServicesRepoImp implements HmgServicesRepo {
}
@override
Future<Either<Failure, GenericApiModel<List<VitalSignResModel>>>> getPatientVitalSign() async {
Future<Either<Failure, GenericApiModel<List<VitalSignResModel>>>> getPatientVitalSign(num? transID, int? projectID) async {
Map<String, dynamic> requestBody = {
"TransID": transID,
"TransNo": transID,
"ProjectID": projectID,
};
try {

@ -895,37 +895,59 @@ class HmgServicesViewModel extends ChangeNotifier {
Future<void> getPatientVitalSign({
Function(dynamic)? onSuccess,
Function(String)? onError,
num? transNo,
int? projectID,
bool forceRefresh = false,
}) async {
if (hasVitalSignDataLoaded) return;
isVitalSignLoading = true;
notifyListeners();
final bool isSpecificQuery = (transNo != null || projectID != null);
if (!isSpecificQuery && hasVitalSignDataLoaded && !forceRefresh) {
if (onSuccess != null) {
onSuccess(GenericApiModel<List<VitalSignResModel>>(
messageStatus: 1,
data: vitalSignList,
));
}
return;
}
final result = await hmgServicesRepo.getPatientVitalSign();
if (!isSpecificQuery) {
isVitalSignLoading = true;
notifyListeners();
}
final result = await hmgServicesRepo.getPatientVitalSign(transNo, projectID);
result.fold(
(failure) async {
isVitalSignLoading = false;
notifyListeners();
if (!isSpecificQuery) {
isVitalSignLoading = false;
notifyListeners();
}
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.message);
}
},
(apiResponse) {
isVitalSignLoading = false;
if (apiResponse.messageStatus == 1) {
vitalSignList = apiResponse.data ?? [];
hasVitalSignDataLoaded = true;
if (vitalSignList.isNotEmpty) {
getIt.get<SymptomsCheckerViewModel>().setSelectedHeight(vitalSignList.first.heightCm);
getIt.get<SymptomsCheckerViewModel>().setSelectedWeight(vitalSignList.first.weightKg);
if (!isSpecificQuery) {
isVitalSignLoading = false;
if (apiResponse.messageStatus == 1) {
vitalSignList = apiResponse.data ?? [];
hasVitalSignDataLoaded = true;
if (vitalSignList.isNotEmpty) {
getIt.get<SymptomsCheckerViewModel>().setSelectedHeight(vitalSignList.first.heightCm);
getIt.get<SymptomsCheckerViewModel>().setSelectedWeight(vitalSignList.first.weightKg);
}
}
notifyListeners();
}
if (apiResponse.messageStatus == 1) {
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}

@ -101,9 +101,7 @@ class ImmediateLiveCareRepoImp implements ImmediateLiveCareRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final respObject = response['GetERAppointmentFeesList'];
final liveCareFeesObj = LiveCareImmediateAppointmentFeesList.fromJson(respObject);
apiResponse = GenericApiModel<LiveCareImmediateAppointmentFeesList>(
messageStatus: messageStatus,
statusCode: statusCode,

@ -59,16 +59,25 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
bool isShowNotEligibleDialog = false;
String notEligibleErrorMsg = "";
bool isTermsAccepted = false;
initImmediateLiveCare() {
_appState = getIt<AppState>();
immediateLiveCareClinicsList = [];
mainLiveCareClinicList = [];
isImmediateLiveCareClinicsLoading = true;
isTermsAccepted = false;
liveCareSelectedCallType = 0; // 1- Video, 2- Audio, 3- Phone
immediateLiveCareSelectedClinic = GetLiveCareClinicListResponseModel();
liveCareImmediateAppointmentFeesList = LiveCareImmediateAppointmentFeesList();
}
onTermsAccepted() {
isTermsAccepted = !isTermsAccepted;
notifyListeners();
}
setLiveCareSelectedCallType(int value) {
liveCareSelectedCallType = value;
notifyListeners();

@ -45,7 +45,6 @@ class MedicalFileViewModel extends ChangeNotifier {
List<SickLeaveList> patientSickLeavesViewList = [];
bool isSickLeavesSortByClinic = true;
bool isSickLeavesDataNeedsReloading = true;
List<GetAllergiesResponseModel> patientAllergiesList = [];
@ -61,6 +60,7 @@ class MedicalFileViewModel extends ChangeNotifier {
List<MedicalReportList> patientMedicalReportsViewList = [];
bool isMedicalReportsSortByClinic = true;
bool isMedicalReportsDataNeedsReloading = true;
List<PatientAppointmentHistoryResponseModel> patientMedicalReportAppointmentHistoryList = [];
PatientAppointmentHistoryResponseModel? patientMedicalReportSelectedAppointment;
@ -168,6 +168,16 @@ class MedicalFileViewModel extends ChangeNotifier {
notifyListeners();
}
setIsSickLeavesDataNeedsReloading(bool value) {
isSickLeavesDataNeedsReloading = value;
notifyListeners();
}
setIsMedicalReportsDataNeedsReloading(bool value) {
isMedicalReportsDataNeedsReloading = value;
notifyListeners();
}
setIsPatientSickLeaveListLoading(bool val) {
if (val && isSickLeavesDataNeedsReloading) {
patientSickLeaveList.clear();
@ -192,7 +202,7 @@ class MedicalFileViewModel extends ChangeNotifier {
}
setIsPatientMedicalReportsLoading(bool val) {
if (val) {
if (val && isMedicalReportsDataNeedsReloading) {
onMedicalReportTabChange(0);
patientMedicalReportList.clear();
patientMedicalReportsByClinic.clear();
@ -200,8 +210,8 @@ class MedicalFileViewModel extends ChangeNotifier {
patientMedicalReportsViewList.clear();
patientMedicalReportPDFBase64 = "";
isMedicalReportsSortByClinic = true;
isPatientMedicalReportsListLoading = val;
}
isPatientMedicalReportsListLoading = val;
notifyListeners();
}
@ -373,6 +383,10 @@ class MedicalFileViewModel extends ChangeNotifier {
}
Future<void> getPatientMedicalReportList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isMedicalReportsDataNeedsReloading) {
return;
}
patientMedicalReportList.clear();
patientMedicalReportRequestedList.clear();
patientMedicalReportReadyList.clear();
@ -385,6 +399,7 @@ class MedicalFileViewModel extends ChangeNotifier {
(failure) async => await errorHandlerService.handleError(
failure: failure,
onOkPressed: () {
isMedicalReportsDataNeedsReloading = true;
onError!(failure.message);
},
),
@ -400,6 +415,7 @@ class MedicalFileViewModel extends ChangeNotifier {
}
onMedicalReportTabChange(0);
isPatientMedicalReportsListLoading = false;
isMedicalReportsDataNeedsReloading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);

@ -161,6 +161,20 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier {
page: DentalChiefComplaintsPage(),
),
);
} else {
if (appState.getAuthenticatedUser()!.age! > 12) {
navigationService.push(
CustomPageRoute(
page: DentalChiefComplaintsPage(),
),
);
} else {
navigationService.push(
CustomPageRoute(
page: SelectDoctorPage(),
),
);
}
}
}
if (clinicId == 253) {

@ -25,7 +25,7 @@ import 'models/resp_models/appointment_details_resp_model.dart';
abstract class MyAppointmentsRepo {
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments(
{required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false});
{required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false, bool isForTimeLine = false});
Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment(
{required int projectID, required int clinicID, required String appointmentNo, required bool isLiveCareAppointment});
@ -105,14 +105,15 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
@override
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments(
{required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false}) async {
{required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false, bool isForTimeLine = false}) async {
Map<String, dynamic> mapDevice = {
"IsActiveAppointment": isActiveAppointment,
"IsComingFromCOC": false,
"isForUpcomming": false,
"IsForMedicalReport": false,
"IsForArrived": isArrivedAppointments,
"IsIrisPrescription": isForEyeMeasurement
"IsIrisPrescription": isForEyeMeasurement,
"IsForTimeLine": isForTimeLine
};
try {

@ -55,6 +55,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
bool isAppointmentDataToBeLoaded = true;
bool isMyDoctorsDataToBeLoaded = true;
bool isArrivedAppointmentDataLoaded = false;
bool isFullArrivedAppointmentsLoaded = false;
bool isEyeMeasurementsAppointmentsLoading = false;
@ -76,7 +78,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
List<PatientAppointmentHistoryResponseModel> patientUpcomingAppointmentsHistoryList = [];
List<PatientAppointmentHistoryResponseModel> patientArrivedAppointmentsHistoryList = [];
List<PatientAppointmentHistoryResponseModel> patientTimelineAppointmentsList = [];
// List<PatientAppointmentHistoryResponseModel> patientAllArrivedAppointmentsHistoryList = [];
List<PatientAppointmentHistoryResponseModel> patientMyDoctorsList = [];
@ -172,11 +174,12 @@ class MyAppointmentsViewModel extends ChangeNotifier {
patientAppointmentsHistoryList.clear();
patientUpcomingAppointmentsHistoryList.clear();
patientArrivedAppointmentsHistoryList.clear();
patientTimelineAppointmentsList.clear();
// patientAllArrivedAppointmentsHistoryList.clear();
patientEyeMeasurementsAppointmentsHistoryList.clear();
isMyAppointmentsLoading = true;
isTimeLineAppointmentsLoading = true;
patientMyDoctorsList.clear();
isFullArrivedAppointmentsLoaded = false;
}
isTamaraDetailsLoading = true;
isAppointmentPatientShareLoading = true;
@ -266,7 +269,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
);
}
Future<void> getPatientAppointments(bool isActiveAppointment, bool isArrivedAppointments, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<void> getPatientAppointments(bool isActiveAppointment, bool isArrivedAppointments, {bool isForTimeLine = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (patientArrivedAppointmentsHistoryList.isNotEmpty) {
isPatientHasQueueAppointment = false;
notifyListeners();
@ -275,14 +278,19 @@ class MyAppointmentsViewModel extends ChangeNotifier {
getPatientAppointmentQueueDetails();
}
}
if (!isAppointmentDataToBeLoaded) return;
// Skip API call if full data is already loaded and we're not requesting timeline view
if (!isForTimeLine && isFullArrivedAppointmentsLoaded && !isAppointmentDataToBeLoaded) {
return;
}
if (!isAppointmentDataToBeLoaded) return;
patientAppointmentsByClinic.clear();
patientAppointmentsByHospital.clear();
patientAppointmentsViewList.clear();
patientTimelineAppointmentsList.clear();
// patientAllArrivedAppointmentsHistoryList.clear();
filteredAppointmentList.clear();
patientAppointmentsHistoryList.clear();
patientUpcomingAppointmentsHistoryList.clear();
@ -291,7 +299,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
final results = await Future.wait([
myAppointmentsRepo.getPatientAppointments(isActiveAppointment: isActiveAppointment, isArrivedAppointments: isArrivedAppointments),
myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true),
myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true, isForTimeLine: isForTimeLine),
]);
results[0].fold(
@ -320,6 +328,11 @@ class MyAppointmentsViewModel extends ChangeNotifier {
patientArrivedAppointmentsHistoryList = apiResponse.data!;
isMyAppointmentsLoading = false;
isAppointmentDataToBeLoaded = false;
if (!isForTimeLine) {
// patientAllArrivedAppointmentsHistoryList = apiResponse.data!;
isArrivedAppointmentDataLoaded = true;
isFullArrivedAppointmentsLoaded = true;
}
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@ -350,6 +363,69 @@ class MyAppointmentsViewModel extends ChangeNotifier {
notifyListeners();
}
changeTabToArrived() {
if (isFullArrivedAppointmentsLoaded && patientUpcomingAppointmentsHistoryList.isEmpty && patientArrivedAppointmentsHistoryList.isNotEmpty && selectedTabIndex == 0) {
selectedTabIndex = 1;
updateListWRTTab(1);
notifyListeners();
}
}
/// Loads full arrived appointments list if not already loaded
/// This is called when navigating to My Appointments page from landing page
Future<void> loadFullArrivedAppointmentsIfNeeded({Function(dynamic)? onSuccess, Function(String)? onError}) async {
// Skip if already loaded
if (isFullArrivedAppointmentsLoaded) {
// Auto-switch to Arrived tab if no upcoming appointments (even when data is already loaded)
if (patientUpcomingAppointmentsHistoryList.isEmpty && patientArrivedAppointmentsHistoryList.isNotEmpty && selectedTabIndex == 0) {
selectedTabIndex = 1;
updateListWRTTab(1);
notifyListeners();
}
return;
}
setIsAppointmentsHistoryLoading(true);
// Fetch full arrived appointments (isForTimeLine = false)
final result = await myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true, isForTimeLine: false);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// Handle error
} else if (apiResponse.messageStatus == 1) {
patientArrivedAppointmentsHistoryList = apiResponse.data!;
// patientAllArrivedAppointmentsHistoryList = apiResponse.data!;
isArrivedAppointmentDataLoaded = true;
isFullArrivedAppointmentsLoaded = true;
// Rebuild the combined list
patientAppointmentsHistoryList.clear();
patientAppointmentsHistoryList.addAll(patientUpcomingAppointmentsHistoryList);
patientAppointmentsHistoryList.addAll(patientArrivedAppointmentsHistoryList);
isMyAppointmentsLoading = false;
// Auto-switch to Arrived tab if no upcoming appointments
if (patientUpcomingAppointmentsHistoryList.isEmpty && patientArrivedAppointmentsHistoryList.isNotEmpty && selectedTabIndex == 0) {
selectedTabIndex = 1;
updateListWRTTab(1);
} else {
// Update filtered list based on current tab
updateListWRTTab(selectedTabIndex);
}
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
void getFiltersForSelectedAppointmentList(List<PatientAppointmentHistoryResponseModel> filteredAppointmentList) {
availableFilters.clear();
if (filteredAppointmentList.isEmpty == true) return;
@ -358,9 +434,9 @@ class MyAppointmentsViewModel extends ChangeNotifier {
availableFilters.add(AppointmentListingFilters.LIVECARE);
}
if (filteredAppointmentList.any((element) => element.isLiveCareAppointment == false)) {
availableFilters.add(AppointmentListingFilters.WALKIN);
}
// if (filteredAppointmentList.any((element) => element.isLiveCareAppointment == false)) {
// availableFilters.add(AppointmentListingFilters.WALKIN);
// }
if (filteredAppointmentList.any((element) => AppointmentType.isArrived(element) == true)) {
availableFilters.add(AppointmentListingFilters.ARRIVED);
@ -695,7 +771,11 @@ class MyAppointmentsViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) {
patientMyDoctorsList = apiResponse.data!;
isPatientMyDoctorsLoading = false;
isMyDoctorsDataToBeLoaded = false;
if (!isTop8) {
isMyDoctorsDataToBeLoaded = false;
}
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@ -797,15 +877,15 @@ class MyAppointmentsViewModel extends ChangeNotifier {
selectedFilter = [];
// if(previouslySelectedTab == selectedTabIndex ) return;
switch (index) {
// case 0:
// filteredAppointmentList.clear();
// filteredAppointmentList.addAll(patientAppointmentsHistoryList);
// break;
case 0:
filteredAppointmentList.clear();
filteredAppointmentList.addAll(patientAppointmentsHistoryList);
break;
case 1:
filteredAppointmentList.clear();
filteredAppointmentList.addAll(patientUpcomingAppointmentsHistoryList);
break;
case 2:
case 1:
filteredAppointmentList.clear();
filteredAppointmentList.addAll(patientArrivedAppointmentsHistoryList);
break;
@ -831,11 +911,12 @@ class MyAppointmentsViewModel extends ChangeNotifier {
this.end = end;
isDateFilterSelected = true;
List<PatientAppointmentHistoryResponseModel> sourceList = [];
if (selectedTabIndex == 0) {
sourceList = patientAppointmentsHistoryList;
} else if (selectedTabIndex == 1) {
// if (selectedTabIndex == 0) {
// sourceList = patientAppointmentsHistoryList;
// } else
if (selectedTabIndex == 0) {
sourceList = patientUpcomingAppointmentsHistoryList;
} else if (selectedTabIndex == 2) {
} else if (selectedTabIndex == 1) {
sourceList = patientArrivedAppointmentsHistoryList;
}
// if (isDateFilterSelected) sourceList = filteredAppointmentList;

@ -3,6 +3,7 @@ import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/common_models/tamara_request_model.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart';
@ -34,6 +35,8 @@ abstract class PayfortRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> payfortRequestInsert({required PayfortRequestInsertModel payfortRequestInsertModel});
Future<Either<Failure, GenericApiModel<dynamic>>> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel});
Future<Either<Failure, GenericApiModel<dynamic>>> tamaraRequestInsert({required TamaraRequestModel tamaraRequestModel});
}
class PayfortRepoImp implements PayfortRepo {
@ -55,7 +58,7 @@ class PayfortRepoImp implements PayfortRepo {
try {
final list = response;
if (list == null || list.isEmpty) {
throw Exception("payfort list is empty");
throw Exception("No project configuration found.");
}
final applePayConfigurationResponse = PayfortProjectDetailsRespModel.fromJson(list[0]);
@ -350,4 +353,31 @@ class PayfortRepoImp implements PayfortRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> tamaraRequestInsert({required TamaraRequestModel tamaraRequestModel}) async {
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(TAMARA_REQUEST_INSERT, body: tamaraRequestModel.toJson(), onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true, isPaymentServices: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -9,6 +9,7 @@ import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/tamara_request_model.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart';
@ -116,6 +117,25 @@ class PayfortViewModel extends ChangeNotifier {
);
}
Future<void> tamaraRequestInsert({required TamaraRequestModel tamaraRequestModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.tamaraRequestInsert(tamaraRequestModel: tamaraRequestModel);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
// payfortProjectDetailsRespModel = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.payfortResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);
@ -398,7 +418,7 @@ class PayfortViewModel extends ChangeNotifier {
payfortRequestInsertModel.sHAResponsePhase = payfortProjectDetailsRespModel!.shaResponse;
payfortRequestInsertModel.signature = sdkTokenResponse!.signature;
payfortRequestInsertModel.language = getIt.get<AppState>().isArabic() ? "ar" : "en";
payfortRequestInsertModel.integrationId = "1";
payfortRequestInsertModel.integrationId = "1"; // Payfort integration ID
payfortRequestInsertModel.isSchedule = isScheduleLiveCare;
payfortRequestInsertModel.appointmentDate = appointmentDate;
payfortRequestInsertModel.appointmentNo = appointmentNo;

@ -11,26 +11,53 @@ import 'package:flutter_paytabs_bridge/PaymentSdkTransactionType.dart';
import 'package:flutter_paytabs_bridge/flutter_paytabs_bridge.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/tamara_request_model.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/paytabs_config.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_project_details_resp_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
import 'package:hmg_patient_app_new/features/paytabs/models/paytabs_transaction_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_request_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_response_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_repo.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
class PayTabsViewModel extends ChangeNotifier {
late PaymentSdkConfigurationDetails paymentConfiguration;
final AppState appState;
final PayfortRepo payfortRepo;
final ErrorHandlerService errorHandlerService;
late PaytabsTransactionResponseModel paytabsTransactionResponseModel;
PayfortProjectDetailsRespModel? paytabsProjectDetailsRespModel;
PayTabsViewModel({
required this.appState,
required this.payfortRepo,
required this.errorHandlerService,
});
setPaymentConfiguration(String paymentDescription, num amount, {bool isAddCard = false}) {
setPaymentConfiguration(String paymentDescription, num amount, int serviceID, int projectID, {bool isAddCard = false}) async {
String cartID = DateTime.now().millisecondsSinceEpoch.toString();
LoaderBottomSheet.showLoader();
await getPayTabsConfigurations(serviceId: serviceID, projectId: projectID);
paymentConfiguration = PaymentSdkConfigurationDetails(
profileId: PaymentSdkDefaultConfig.profileID,
serverKey: PaymentSdkDefaultConfig.serverKey,
clientKey: PaymentSdkDefaultConfig.clientKey,
transactionType: PaymentSdkTransactionType.SALE,
profileId: paytabsProjectDetailsRespModel!.merchantIdentifier,
serverKey: paytabsProjectDetailsRespModel!.accessCode,
clientKey: paytabsProjectDetailsRespModel!.shaResponse,
// profileId: PaymentSdkDefaultConfig.profileID,
// serverKey: PaymentSdkDefaultConfig.serverKey,
// clientKey: PaymentSdkDefaultConfig.clientKey,
transactionType: PaymentSdkTransactionType.SALE,
cartId: cartID.substring((cartID.length - 5), cartID.length),
cartDescription: paymentDescription,
merchantName: PaymentSdkDefaultConfig.defaultMerchantName,
@ -43,7 +70,8 @@ class PayTabsViewModel extends ChangeNotifier {
amount: amount.toDouble(),
showBillingInfo: false,
forceShippingInfo: false,
currencyCode: PaymentSdkDefaultConfig.defaultCurrency,
// currencyCode: PaymentSdkDefaultConfig.defaultCurrency,
currencyCode: getIt.get<AppState>().getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
merchantCountryCode: PaymentSdkDefaultConfig.defaultMerchantCountryCode,
billingDetails: BillingDetails(
"${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" ?? "HMG Patient",
@ -97,12 +125,17 @@ class PayTabsViewModel extends ChangeNotifier {
notifyListeners();
}
setAlternatePaymentConfiguration(String paymentDescription, num amount, {bool isAddCard = false}) {
setAlternatePaymentConfiguration(String paymentDescription, num amount, int serviceID, int projectID, {bool isAddCard = false}) async {
String cartID = DateTime.now().millisecondsSinceEpoch.toString();
LoaderBottomSheet.showLoader();
await getPayTabsConfigurations(serviceId: serviceID, projectId: projectID);
paymentConfiguration = PaymentSdkConfigurationDetails(
profileId: PaymentSdkDefaultConfig.profileID,
serverKey: PaymentSdkDefaultConfig.serverKey,
clientKey: PaymentSdkDefaultConfig.clientKey,
profileId: paytabsProjectDetailsRespModel!.merchantIdentifier,
serverKey: paytabsProjectDetailsRespModel!.accessCode,
clientKey: paytabsProjectDetailsRespModel!.shaResponse,
transactionType: PaymentSdkTransactionType.SALE,
cartId: cartID.substring((cartID.length - 5), cartID.length),
cartDescription: paymentDescription,
@ -112,7 +145,8 @@ class PayTabsViewModel extends ChangeNotifier {
amount: amount.toDouble(),
showBillingInfo: false,
forceShippingInfo: false,
currencyCode: PaymentSdkDefaultConfig.defaultCurrency,
// currencyCode: PaymentSdkDefaultConfig.defaultCurrency,
currencyCode: getIt.get<AppState>().getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
merchantCountryCode: PaymentSdkDefaultConfig.defaultMerchantCountryCode,
billingDetails: BillingDetails("${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" ?? "HMG Patient",
"CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com", appState.getAuthenticatedUser()!.mobileNumber ?? "0000000000", "Riyadh", "SA", "Riyadh", "Riyadh", "12626"),
@ -152,6 +186,42 @@ class PayTabsViewModel extends ChangeNotifier {
notifyListeners();
}
Future<void> paytabsRequestInsert({required PayfortRequestInsertModel payfortRequestInsertModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.payfortRequestInsert(payfortRequestInsertModel: payfortRequestInsertModel);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> paytabsResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.payfortResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
startApplePayPayment({Function(PaytabsTransactionResponseModel)? onSuccess, Function(String)? onError}) async {
bool _callbackFired = false; // prevent duplicate callback invocations
@ -189,44 +259,180 @@ class PayTabsViewModel extends ChangeNotifier {
});
}
startCardPayment({Function(PaytabsTransactionResponseModel)? onSuccess, Function(String)? onError}) {
startCardPayment({
required String paymentOption,
required String liveServiceID,
required String isScheduleLiveCare,
required String appointmentDate,
required String appointmentNo,
required String doctorID,
required String transactionID,
required String amount,
required String fileNumber,
required String orderDescription,
required String serviceID,
required String projectID,
Function(PaytabsTransactionResponseModel)? onSuccess,
Function(String)? onError,
}) async {
bool _callbackFired = false; // prevent duplicate callback invocations
FlutterPaytabsBridge.startCardPayment(paymentConfiguration, (event) {
if (_callbackFired) return; // ignore any subsequent callback calls
try {
// LoaderBottomSheet.showLoader();
final transactionDetails = event["data"] as Map<Object?, Object?>?;
if (event["status"] == "success") {
_callbackFired = true;
// Cast Map<Object?, Object?> to Map<String, dynamic>
final data = Map<String, dynamic>.from(event["data"] as Map);
paytabsTransactionResponseModel = PaytabsTransactionResponseModel.fromJson(data);
if (paytabsTransactionResponseModel.isSuccess!) {
onSuccess!(paytabsTransactionResponseModel);
} else {
// Transaction was processed but failed
final reason =
transactionDetails?["payResponseReturn"] ?? transactionDetails?["responseMessage"] ?? transactionDetails?["message"] ?? "Unknown error";
final responseCode = transactionDetails?["responseCode"] ?? "";
final errorMessage =
responseCode.toString().isNotEmpty ? "Transaction failed (Code: $responseCode): $reason" : "Transaction failed: $reason";
onError!(errorMessage);
// Create PayfortRequestInsertModel (same as Payfort implementation)
PayfortRequestInsertModel payfortRequestInsertModel = PayfortRequestInsertModel();
payfortRequestInsertModel.commandType = "SALE";
payfortRequestInsertModel.amount = num.parse(amount);
payfortRequestInsertModel.customerEmail = getIt.get<AppState>().getAuthenticatedUser()!.emailAddress;
payfortRequestInsertModel.orderDescription = orderDescription;
payfortRequestInsertModel.serviceID = serviceID;
payfortRequestInsertModel.paymentOption = paymentOption;
payfortRequestInsertModel.clientRequestID = transactionID;
payfortRequestInsertModel.projectID = projectID;
payfortRequestInsertModel.fileNumber = getIt.get<AppState>().getAuthenticatedUser()!.patientId.toString();
payfortRequestInsertModel.customerName = "${getIt.get<AppState>().getAuthenticatedUser()!.firstName} ${getIt.get<AppState>().getAuthenticatedUser()!.lastName}";
payfortRequestInsertModel.currency = getIt.get<AppState>().getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED";
payfortRequestInsertModel.liveServiceID = liveServiceID;
payfortRequestInsertModel.latitude = getIt.get<AppState>().userLat.toString();
payfortRequestInsertModel.longitude = getIt.get<AppState>().userLong.toString();
payfortRequestInsertModel.merchantReference = transactionID;
payfortRequestInsertModel.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
payfortRequestInsertModel.language = getIt.get<AppState>().isArabic() ? "ar" : "en";
payfortRequestInsertModel.integrationId = "2"; // PayTabs integration ID
payfortRequestInsertModel.isSchedule = isScheduleLiveCare;
payfortRequestInsertModel.appointmentDate = appointmentDate;
payfortRequestInsertModel.appointmentNo = appointmentNo;
payfortRequestInsertModel.doctorID = doctorID;
// Call request insert API before payment
await paytabsRequestInsert(payfortRequestInsertModel: payfortRequestInsertModel);
LoaderBottomSheet.hideLoader();
// Start PayTabs payment
FlutterPaytabsBridge.startCardPayment(paymentConfiguration, (event) async {
if (_callbackFired) return; // ignore any subsequent callback calls
final transactionDetails = event["data"] as Map<Object?, Object?>?;
if (event["status"] == "success") {
_callbackFired = true;
LoaderBottomSheet.showLoader();
// Cast Map<Object?, Object?> to Map<String, dynamic>
final data = Map<String, dynamic>.from(event["data"] as Map);
paytabsTransactionResponseModel = PaytabsTransactionResponseModel.fromJson(data);
// Create PayfortResponseInsertModel (same as Payfort implementation)
PayfortResponseInsertModel payfortResponseInsertModel = PayfortResponseInsertModel();
payfortResponseInsertModel.fortId = paytabsTransactionResponseModel.transactionReference ?? "";
payfortResponseInsertModel.commandType = paytabsTransactionResponseModel.transactionType ?? "SALE";
// payfortResponseInsertModel.amount = paytabsTransactionResponseModel.tranTotal ?? 0;
payfortResponseInsertModel.amount = num.parse(amount);
payfortResponseInsertModel.sadadOLP = "";
payfortResponseInsertModel.paymentOption = paytabsTransactionResponseModel.paymentInfo?.paymentMethod ?? "";
payfortResponseInsertModel.customerIP = "";
payfortResponseInsertModel.eCI = "";
payfortResponseInsertModel.responseMessage = paytabsTransactionResponseModel.payResponseReturn ?? "";
payfortResponseInsertModel.cardNumber = paytabsTransactionResponseModel.paymentInfo!.paymentDescription;
payfortResponseInsertModel.cardBin = "";
payfortResponseInsertModel.installmentsNumber = 0;
payfortResponseInsertModel.status = paytabsTransactionResponseModel.isSuccess! ? "14" : "00";
payfortResponseInsertModel.merchantRef = transactionID;
payfortResponseInsertModel.isRefund = false;
payfortResponseInsertModel.remmeberMe = true;
payfortResponseInsertModel.reconciliationReference = "";
// Call response insert API after payment
await paytabsResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);
LoaderBottomSheet.hideLoader();
if (paytabsTransactionResponseModel.isSuccess!) {
if (onSuccess != null) {
onSuccess(paytabsTransactionResponseModel);
}
} else {
// Transaction was processed but failed
final reason = transactionDetails?["payResponseReturn"] ?? transactionDetails?["responseMessage"] ?? transactionDetails?["message"] ?? "Unknown error";
final responseCode = transactionDetails?["responseCode"] ?? "";
final errorMessage = responseCode.toString().isNotEmpty ? "Transaction failed (Code: $responseCode): $reason" : "Transaction failed: $reason";
if (onError != null) {
onError(errorMessage);
}
}
} else if (event["status"] == "error") {
_callbackFired = true;
final errorMessage = event["message"] ?? "An error occurred";
debugPrint("Error occurred in transaction: $errorMessage");
debugPrint("Full error event: $event");
if (onError != null) {
onError(errorMessage);
}
} else if (event["status"] == "event") {
// Intermediate SDK events – do NOT mark _callbackFired, just log
final eventMessage = event["message"] ?? "Event occurred";
debugPrint("Event occurred: $eventMessage");
}
} else if (event["status"] == "error") {
_callbackFired = true;
final errorMessage = event["message"] ?? "An error occurred";
debugPrint("Error occurred in transaction: $errorMessage");
debugPrint("Full error event: $event");
onError!(errorMessage);
} else if (event["status"] == "event") {
// Intermediate SDK events – do NOT mark _callbackFired, just log
final eventMessage = event["message"] ?? "Event occurred";
debugPrint("Event occurred: $eventMessage");
});
} catch (error) {
debugPrint("PayTabs Payment Error: $error");
LoaderBottomSheet.hideLoader();
if (onError != null) {
onError("Payment initialization failed: $error");
}
});
}
}
startAlternatePayment({Function(PaytabsTransactionResponseModel)? onSuccess, Function(String)? onError}) {
startAlternatePayment(
{required String liveServiceID,
required String appointmentDate,
required String appointmentNo,
required String doctorID,
required String transactionID,
required String amount,
required String fileNumber,
required String serviceID,
required String projectID,
required bool isSchedule,
Function(PaytabsTransactionResponseModel)? onSuccess,
Function(String)? onError}) async {
// LoaderBottomSheet.showLoader();
TamaraRequestModel tamaraRequestModel = TamaraRequestModel();
tamaraRequestModel.merchantReference = transactionID;
tamaraRequestModel.merchantIdentifier = "Tamara";
tamaraRequestModel.clientRequestID = transactionID;
tamaraRequestModel.amount = num.parse(amount);
tamaraRequestModel.currency = "SR";
tamaraRequestModel.language = appState.isArabic() ? 'AR' : 'EN';
tamaraRequestModel.commandType = "PURCHASE";
tamaraRequestModel.customerEmail = "CustID_$fileNumber@HMG.com";
tamaraRequestModel.orderDescription = "Ancillary Order Payment";
tamaraRequestModel.isInstallment = true;
tamaraRequestModel.projectID = num.parse(projectID);
tamaraRequestModel.accessCode = getIt.get<AppState>().getAuthenticatedUser()!.mobileNumber!;
tamaraRequestModel.appointmentNo = appointmentNo;
tamaraRequestModel.customerName = "${getIt.get<AppState>().getAuthenticatedUser()!.firstName} ${getIt.get<AppState>().getAuthenticatedUser()!.lastName}";
tamaraRequestModel.fileNumber = fileNumber;
tamaraRequestModel.patientOutSA = getIt.get<AppState>().getAuthenticatedUser()!.outSa == 1 ? true : false;
tamaraRequestModel.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
tamaraRequestModel.latitude = appState.userLat.toString();
tamaraRequestModel.longitude = appState.userLong.toString();
tamaraRequestModel.serviceID = serviceID;
tamaraRequestModel.liveServiceID = liveServiceID;
tamaraRequestModel.doctorID = (doctorID != "") ? doctorID.toString() : "";
tamaraRequestModel.appointmentDate = appointmentDate;
tamaraRequestModel.isSchedule = isSchedule;
await getIt.get<PayfortViewModel>().tamaraRequestInsert(tamaraRequestModel: tamaraRequestModel);
LoaderBottomSheet.hideLoader();
bool _callbackFired = false; // prevent duplicate callback invocations
FlutterPaytabsBridge.startAlternativePaymentMethod(paymentConfiguration, (event) {
@ -260,4 +466,23 @@ class PayTabsViewModel extends ChangeNotifier {
}
});
}
Future<void> getPayTabsConfigurations({int? serviceId, int? projectId, int integrationId = 5, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.getPayfortConfigurations(serviceId: serviceId, projectId: projectId, integrationId: integrationId);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
paytabsProjectDetailsRespModel = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
}

@ -78,6 +78,11 @@ class PrescriptionsViewModel extends ChangeNotifier {
notifyListeners();
}
void setIsPrescriptionDataNeedsReloading(bool value) {
isPrescriptionsDataNeedsReloading = value;
notifyListeners();
}
Future<bool> checkIfReminderExistForPrescription(int index) async {
final item = prescriptionDetailsList[index];
// Check device calendar
@ -191,7 +196,9 @@ class PrescriptionsViewModel extends ChangeNotifier {
result.fold(
// (failure) async => await errorHandlerService.handleError(failure: failure),
(failure) async {
onError!(failure.message);
if (onError != null) {
onError(failure.message);
}
},
(apiResponse) async {
if (apiResponse.messageStatus == 2) {

@ -70,9 +70,7 @@ class ProfilePictureViewModel extends ChangeNotifier {
try {
_cachedImageBytes = base64Decode(imageData);
_cachedImageDataHash = '${imageData.length}_${imageData.hashCode}';
print('✅ Cached existing profile image');
} catch (e) {
print('❌ Error caching existing image: $e');
_cachedImageBytes = null;
_cachedImageDataHash = null;
}
@ -85,7 +83,6 @@ class ProfilePictureViewModel extends ChangeNotifier {
final currentPatientId = _appState.getAuthenticatedUser()?.patientId;
if (currentPatientId != null && currentPatientId != _currentPatientId) {
print('🔄 User switched detected: $_currentPatientId -> $currentPatientId');
_handleUserSwitch(currentPatientId);
return true;
}
@ -97,8 +94,6 @@ class ProfilePictureViewModel extends ChangeNotifier {
final oldPatientId = _currentPatientId;
_currentPatientId = newPatientId;
print('🧹 Clearing cache for old user: $oldPatientId');
// Clear AppState cache
_appState.clearProfileImageCache();
@ -113,17 +108,14 @@ class ProfilePictureViewModel extends ChangeNotifier {
notifyListeners();
// Load new user's profile image
print('📥 Loading profile image for new user: $newPatientId');
_profileSettingsViewModel.getProfileImage(
patientID: newPatientId,
forceRefresh: true,
onSuccess: (data) {
print('✅ Profile image loaded successfully for user: $newPatientId');
_tryCacheExistingImage();
notifyListeners();
},
onError: (error) {
print('❌ Error loading profile image: $error');
notifyListeners();
},
);
@ -133,22 +125,18 @@ class ProfilePictureViewModel extends ChangeNotifier {
void loadProfileImage({bool forceRefresh = false}) {
// Check if profile image is already loaded in AppState (skip if forcing refresh)
if (!forceRefresh && _appState.getProfileImageData != null && _appState.getProfileImageData!.isNotEmpty) {
print('✅ Profile image already cached in AppState');
return;
}
final patientID = _appState.getAuthenticatedUser()?.patientId;
if (patientID == null) {
print('⚠️ Cannot load profile image - no authenticated user');
return;
}
print('📥 Loading profile image for patient: $patientID (forceRefresh: $forceRefresh)');
_profileSettingsViewModel.getProfileImage(
patientID: patientID,
forceRefresh: forceRefresh,
onSuccess: (data) {
print('✅ Profile image loaded successfully');
_tryCacheExistingImage();
notifyListeners();
},
@ -188,10 +176,6 @@ class ProfilePictureViewModel extends ChangeNotifier {
false, // Don't show files option, only camera and gallery
(base64String, file) async {
try {
print('=== Starting image processing ===');
print('File path: ${file.path}');
print('File exists: ${await file.exists()}');
print('Original file size: ${await file.length() / 1024} KB');
// Compress and resize the image
print('Calling compressAndResizeImage...');
@ -266,14 +250,10 @@ class ProfilePictureViewModel extends ChangeNotifier {
onError('No authenticated user found');
return;
}
print('📤 Uploading profile image for patient: $patientID');
_profileSettingsViewModel.uploadProfileImage(
patientID: patientID,
imageData: base64String,
onSuccess: (data) async {
print('✅ Profile image uploaded successfully');
// Clear old cache first to ensure fresh data
_cachedImageBytes = null;
_cachedImageDataHash = null;
@ -287,9 +267,13 @@ class ProfilePictureViewModel extends ChangeNotifier {
// Increment version to trigger targeted rebuild (no full screen refresh)
_profileImageVersion.value++;
print('🔄 Profile image version updated to ${_profileImageVersion.value} (targeted rebuild)');
onSuccess(data);
final String successMessage = data is String
? data
: (data is Map && data['message'] != null
? data['message'].toString()
: data?.toString() ?? 'Success');
onSuccess(successMessage);
},
onError: (error) {
print('❌ Error uploading profile image: $error');
@ -308,7 +292,6 @@ class ProfilePictureViewModel extends ChangeNotifier {
try {
_cachedImageBytes = base64Decode(imageData!);
_cachedImageDataHash = currentHash;
print('🔄 Updated cached image bytes');
} catch (e) {
print('❌ Error decoding profile image: $e');
_cachedImageBytes = null;
@ -326,7 +309,6 @@ class ProfilePictureViewModel extends ChangeNotifier {
_cachedImageDataHash = null;
_selectedImage = null;
notifyListeners();
print('🧹 Cleared all profile picture cache');
}
/// Check if we should show shimmer loading

@ -1951,5 +1951,86 @@ abstract class LocaleKeys {
static const viewPatientQR = 'viewPatientQR';
static const patientQR = 'patientQR';
static const forText = 'forText';
static const liveCareTermsHeading = 'liveCareTermsHeading';
static const liveCareTermsIntroHeading = 'liveCareTermsIntroHeading';
static const liveCareTermsConditions1 = 'liveCareTermsConditions1';
static const liveCareTermsConditions2 = 'liveCareTermsConditions2';
static const liveCareTermsHeading2 = 'liveCareTermsHeading2';
static const liveCareTermsConditions3 = 'liveCareTermsConditions3';
static const liveCareTermsConditions3a = 'liveCareTermsConditions3a';
static const liveCareTermsConditions3b = 'liveCareTermsConditions3b';
static const liveCareTermsConditions3c = 'liveCareTermsConditions3c';
static const liveCareTermsConditions3d = 'liveCareTermsConditions3d';
static const liveCareTermsConditions4 = 'liveCareTermsConditions4';
static const liveCareTermsConditions5 = 'liveCareTermsConditions5';
static const liveCareTermsConditions6 = 'liveCareTermsConditions6';
static const liveCareTermsHeading3 = 'liveCareTermsHeading3';
static const liveCareTermsConditions7 = 'liveCareTermsConditions7';
static const liveCareTermsConditions8 = 'liveCareTermsConditions8';
static const liveCareTermsConditions9 = 'liveCareTermsConditions9';
static const liveCareTermsConditions10 = 'liveCareTermsConditions10';
static const liveCareTermsConditions11 = 'liveCareTermsConditions11';
static const liveCareTermsConditions12 = 'liveCareTermsConditions12';
static const liveCareTermsConditions13 = 'liveCareTermsConditions13';
static const liveCareTermsHeading4 = 'liveCareTermsHeading4';
static const liveCareTermsConditions14 = 'liveCareTermsConditions14';
static const liveCareTermsConditions15 = 'liveCareTermsConditions15';
static const liveCareTermsConditions16 = 'liveCareTermsConditions16';
static const liveCareTermsHeading5 = 'liveCareTermsHeading5';
static const liveCareTermsConditions17 = 'liveCareTermsConditions17';
static const liveCareTermsConditions18 = 'liveCareTermsConditions18';
static const liveCareTermsConditions19 = 'liveCareTermsConditions19';
static const liveCareTermsConditions19a = 'liveCareTermsConditions19a';
static const liveCareTermsConditions19b = 'liveCareTermsConditions19b';
static const liveCareTermsConditions19c = 'liveCareTermsConditions19c';
static const liveCareTermsConditions19d = 'liveCareTermsConditions19d';
static const liveCareTermsConditions19e = 'liveCareTermsConditions19e';
static const liveCareTermsConditions20 = 'liveCareTermsConditions20';
static const liveCareTermsHeading6 = 'liveCareTermsHeading6';
static const liveCareTermsConditions21 = 'liveCareTermsConditions21';
static const liveCareTermsConditions22 = 'liveCareTermsConditions22';
static const liveCareTermsConditions23 = 'liveCareTermsConditions23';
static const liveCareTermsHeading7 = 'liveCareTermsHeading7';
static const liveCareTermsConditions24 = 'liveCareTermsConditions24';
static const liveCareTermsConditions25 = 'liveCareTermsConditions25';
static const liveCareTermsConditions26 = 'liveCareTermsConditions26';
static const liveCareTermsConditions27 = 'liveCareTermsConditions27';
static const liveCareTermsConditions28 = 'liveCareTermsConditions28';
static const liveCareTermsConditions29 = 'liveCareTermsConditions29';
static const liveCareTermsConditions30 = 'liveCareTermsConditions30';
static const liveCareTermsHeading8 = 'liveCareTermsHeading8';
static const liveCareTermsConditions31 = 'liveCareTermsConditions31';
static const liveCareTermsHeading9 = 'liveCareTermsHeading9';
static const liveCareTermsConditions32 = 'liveCareTermsConditions32';
static const liveCareTermsConditions33 = 'liveCareTermsConditions33';
static const liveCareTermsConditions34 = 'liveCareTermsConditions34';
static const liveCareTermsConditions35 = 'liveCareTermsConditions35';
static const liveCareTermsHeading10 = 'liveCareTermsHeading10';
static const liveCareTermsConditions36 = 'liveCareTermsConditions36';
static const liveCareTermsHeading11 = 'liveCareTermsHeading11';
static const liveCareTermsConditions37 = 'liveCareTermsConditions37';
static const liveCareTermsConditions38 = 'liveCareTermsConditions38';
static const liveCareTermsHeading12 = 'liveCareTermsHeading12';
static const liveCareTermsConditions39 = 'liveCareTermsConditions39';
static const liveCareTermsConditions40 = 'liveCareTermsConditions40';
static const liveCareTermsConditions41 = 'liveCareTermsConditions41';
static const liveCareTermsHeading13 = 'liveCareTermsHeading13';
static const liveCareTermsConditions42 = 'liveCareTermsConditions42';
static const liveCareTermsHeading14 = 'liveCareTermsHeading14';
static const liveCareTermsConditions43 = 'liveCareTermsConditions43';
static const liveCareTermsConditions43a = 'liveCareTermsConditions43a';
static const liveCareTermsConditions43b = 'liveCareTermsConditions43b';
static const liveCareTermsConditions43c = 'liveCareTermsConditions43c';
static const liveCareTermsConditions43d = 'liveCareTermsConditions43d';
static const liveCareTermsConditions43e = 'liveCareTermsConditions43e';
static const liveCareTermsConditions43f = 'liveCareTermsConditions43f';
static const liveCareTermsConditions43g = 'liveCareTermsConditions43g';
static const liveCareTermsHeading15 = 'liveCareTermsHeading15';
static const liveCareTermsConditions44 = 'liveCareTermsConditions44';
static const liveCareTermsConditions45 = 'liveCareTermsConditions45';
static const liveCareTermsConditions46 = 'liveCareTermsConditions46';
static const liveCareTermsHeading16 = 'liveCareTermsHeading16';
static const liveCareTermsConditions47 = 'liveCareTermsConditions47';
static const liveCareTermsConditions48 = 'liveCareTermsConditions48';
}

@ -7,8 +7,11 @@ import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/active_prescriptions/active_prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/features/ask_doctor/ask_doctor_view_model.dart';
@ -53,11 +56,15 @@ import 'package:hmg_patient_app_new/routes/app_routes.dart';
import 'package:hmg_patient_app_new/services/app_lifecycle_service.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/services/security_service.dart';
import 'package:hmg_patient_app_new/theme/app_theme.dart';
import 'package:hmg_patient_app_new/unsafe_device.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_calendar_model.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart' show DateRangeSelectorRangeViewModel;
import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
import 'package:safe_device/safe_device.dart';
import 'package:safe_device/safe_device_config.dart';
import 'core/utils/size_utils.dart';
import 'features/monthly_reports/terms_conditions_view_model.dart';
@ -110,6 +117,10 @@ Future<void> callInitializations() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
SafeDevice.init(
SafeDeviceConfig(mockLocationCheckEnabled: false), // disables mock location check on Android
);
try {
// Attempt to get the default app. If it exists, this avoids the error.
await Firebase.app();
@ -126,6 +137,26 @@ Future<void> callInitializations() async {
HttpOverrides.global = MyHttpOverrides();
await callAppStateInitializations();
// Initialize Security Service early to catch threats before app logic runs
if (kReleaseMode) {
await getIt.get<SecurityService>().initialize();
}
// Set up critical threat callback to navigate to unsafe device page
getIt.get<SecurityService>().setOnCriticalThreatCallback(() {
final navigationService = getIt.get<NavigationService>();
final context = navigationService.navigatorKey.currentContext;
if (context != null) {
// Clear entire navigation stack and show unsafe device page
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (_) => const UnsafeDevice()),
(route) => false, // Remove all previous routes
);
getIt.get<LoggerService>().logError('🚨 Navigated to UnsafeDevice page - Critical threat detected');
}
});
// Initialize App Lifecycle Service to monitor background/foreground transitions
getIt.get<AppLifecycleService>().initialize();

@ -22,6 +22,9 @@ import 'package:hmg_patient_app_new/features/book_appointments/models/resp_model
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/feedback_type.dart';
import 'package:hmg_patient_app_new/features/hospital/AppPermission.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/vital_sign_respo_model.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
@ -40,6 +43,7 @@ import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appoin
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/bell_switch.dart';
import 'package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_detail_page.dart';
import 'package:hmg_patient_app_new/presentation/vital_sign/vital_sign_page.dart';
import 'package:hmg_patient_app_new/services/clarity_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
@ -666,6 +670,76 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
padding: EdgeInsets.zero,
shrinkWrap: true,
children: [
MedicalFileCard(
label: LocaleKeys.vitalSigns.tr(context: context),
textColor: AppColors.blackColor,
backgroundColor: AppColors.whiteColor,
svgIcon: AppAssets.vital_sign_item_icon,
isLargeText: true,
iconSize: 36.w,
).onPress(() async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.loadingText.tr(context: context));
final hmgServicesVM = getIt.get<HmgServicesViewModel>();
final appt = widget.patientAppointmentHistoryResponseModel;
final targetTransNo = appt.vitalSignAppointmentNo ?? appt.appointmentNo;
await hmgServicesVM.getPatientVitalSign(
transNo: targetTransNo,
projectID: appt.projectID,
onSuccess: (apiResponse) {
LoaderBottomSheet.hideLoader();
final List<VitalSignResModel> vitalList = (apiResponse is GenericApiModel<List<VitalSignResModel>>)
? (apiResponse.data ?? [])
: (apiResponse.data is List<VitalSignResModel>
? (apiResponse.data as List<VitalSignResModel>)
: <VitalSignResModel>[]);
VitalSignResModel? matchedVitalSign;
if (vitalList.isNotEmpty) {
// 1. Match by vitalSignAppointmentNo or appointmentNo
if (targetTransNo != null) {
final targetStr = targetTransNo.toString();
for (final v in vitalList) {
if (v.transNo != null && v.transNo.toString() == targetStr) {
matchedVitalSign = v;
break;
}
}
}
// 2. If specific API returned records for this TransNo/ProjectID, fallback to first
matchedVitalSign ??= vitalList.first;
Navigator.of(context).push(
CustomPageRoute(
page: VitalSignPage(
specificVitalSign: matchedVitalSign,
isFromAppointment: true,
),
),
);
} else {
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: LocaleKeys.noVitalSignsRecordedYet.tr(context: context)),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
},
);
}),
MedicalFileCard(
label: LocaleKeys.labResults.tr(context: context),
textColor: AppColors.blackColor,
@ -790,6 +864,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
// ),
// );
}),
MedicalFileCard(
label: LocaleKeys.doctorResponses.tr(context: context),
textColor: AppColors.blackColor,
@ -945,6 +1020,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
);
})
: SizedBox.shrink(),
],
);
}),
@ -1200,8 +1276,8 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
onSuccess: (apiResponse) {
LoaderBottomSheet.hideLoader();
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.getPatientAppointments(true, false);
// myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
// myAppointmentsViewModel.getPatientAppointments(true, false);
showCommonBottomSheet(context,
child: Utils.getSuccessWidget(loadingText: LocaleKeys.appointmentConfirmedSuccessfully.tr(context: context)), callBackFunc: (str) {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);

@ -69,12 +69,18 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
widget.patientAppointmentHistoryResponseModel.clinicID,
widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false, onSuccess: (val) {
myAppointmentsViewModel.getTamaraInstallmentsDetails().then((val) {
if (myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel != null) {
// if (myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel != null && myAppointmentsViewModel.patientAppointmentShareResponseModel != null) {
if (myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel != null &&
myAppointmentsViewModel.patientAppointmentShareResponseModel?.patientShareWithTax != null &&
myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel?.minLimit?.amount != null &&
myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel?.maxLimit?.amount != null) {
if (myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax! >= myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel!.minLimit!.amount! &&
myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax! <= myAppointmentsViewModel.getTamaraInstallmentsDetailsResponseModel!.maxLimit!.amount!) {
setState(() {
isShowTamara = true;
});
if (mounted) {
setState(() {
isShowTamara = true;
});
}
}
}
});
@ -139,12 +145,31 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "MADA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
transID = Utils.getAppointmentTransID(
widget.patientAppointmentHistoryResponseModel.projectID,
widget.patientAppointmentHistoryResponseModel.clinicID,
widget.patientAppointmentHistoryResponseModel.appointmentNo,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
widget.patientAppointmentHistoryResponseModel.projectID);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? "true" : "false",
appointmentDate: widget.patientAppointmentHistoryResponseModel.appointmentDate!,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
doctorID: widget.patientAppointmentHistoryResponseModel.doctorID.toString(),
transactionID: transID,
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "Appointment Payment",
serviceID: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(),
projectID: widget.patientAppointmentHistoryResponseModel.projectID.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(
paymentMethodName: selectedPaymentMethod,
projectID: widget.patientAppointmentHistoryResponseModel.projectID,
@ -155,7 +180,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -239,7 +263,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
orderDescription: "Appointment Payment",
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(
paymentMethodName: selectedPaymentMethod,
@ -251,7 +274,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -362,12 +384,31 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "VISA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
transID = Utils.getAppointmentTransID(
widget.patientAppointmentHistoryResponseModel.projectID,
widget.patientAppointmentHistoryResponseModel.clinicID,
widget.patientAppointmentHistoryResponseModel.appointmentNo,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
widget.patientAppointmentHistoryResponseModel.projectID);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? "true" : "false",
appointmentDate: widget.patientAppointmentHistoryResponseModel.appointmentDate!,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
doctorID: widget.patientAppointmentHistoryResponseModel.doctorID.toString(),
transactionID: transID,
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "Appointment Payment",
serviceID: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(),
projectID: widget.patientAppointmentHistoryResponseModel.projectID.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(
paymentMethodName: selectedPaymentMethod,
projectID: widget.patientAppointmentHistoryResponseModel.projectID,
@ -378,7 +419,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -462,7 +502,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
orderDescription: "Appointment Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(
paymentMethodName: selectedPaymentMethod,
@ -474,7 +513,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: Utils.isVidaPlusProject(widget.patientAppointmentHistoryResponseModel.projectID)
? value.data['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
@ -590,96 +628,94 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
).paddingSymmetrical(16.h, 16.h),
).paddingSymmetrical(24.h, 0.h).onPress(() {
selectedPaymentMethod = "TAMARA";
transID = Utils.getAppointmentTransID(
widget.patientAppointmentHistoryResponseModel.projectID,
widget.patientAppointmentHistoryResponseModel.clinicID,
widget.patientAppointmentHistoryResponseModel.appointmentNo,
);
if (appState.isPaytabsEnabled) {
paytabsViewModel.setAlternatePaymentConfiguration(
"Appointment Payment", num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()));
paytabsViewModel.startAlternatePayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
tamaraOrderID = transactionData.cartID!;
transID = transactionData.transactionReference!;
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await payfortViewModel.updateTamaraRequestStatus(responseMessage: "success", status: "14", clientRequestID: transID, tamaraOrderID: tamaraOrderID);
await payfortViewModel.markAppointmentAsTamaraPaid(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
widget.patientAppointmentHistoryResponseModel.projectID);
paytabsViewModel.startAlternatePayment(
liveServiceID: "0",
appointmentDate: widget.patientAppointmentHistoryResponseModel.appointmentDate!,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
doctorID: widget.patientAppointmentHistoryResponseModel.doctorID.toString(),
transactionID: transID,
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
fileNumber: widget.patientAppointmentHistoryResponseModel.patientID.toString(),
serviceID: "2",
projectID: widget.patientAppointmentHistoryResponseModel.projectID.toString(),
isSchedule: widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false,
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
tamaraOrderID = transactionData.cartID!;
// transID = transactionData.transactionReference!;
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await payfortViewModel.updateTamaraRequestStatus(responseMessage: "success", status: "14", clientRequestID: transID, tamaraOrderID: tamaraOrderID);
await payfortViewModel.markAppointmentAsTamaraPaid(
projectID: widget.patientAppointmentHistoryResponseModel.projectID, appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo);
await myAppointmentsViewModel.createAdvancePayment(
paymentMethodName: selectedPaymentMethod,
projectID: widget.patientAppointmentHistoryResponseModel.projectID,
clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
payedAmount: num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
paymentReference: transactionData.transactionReference!,
patientID: appState.getAuthenticatedUser()!.patientId.toString(),
patientType: appState.getAuthenticatedUser()!.patientType!,
onSuccess: (value) async {
print(value);
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: "Tamara-Advance-0000",
paymentReference: transactionData.transactionReference!,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
onSuccess: (value) async {
if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) {
//TODO: Implement LiveCare Check-In API Call
await myAppointmentsViewModel.insertLiveCareVIDARequest(
clientRequestID: transID,
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
onSuccess: (apiResponse) {
Future.delayed(Duration(milliseconds: 500), () {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
LoaderBottomSheet.hideLoader();
await myAppointmentsViewModel.addAdvanceNumberRequest(
advanceNumber: "Tamara-Advance-0000",
paymentReference: transactionData.transactionReference!,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
onSuccess: (value) async {
if (widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment!) {
//TODO: Implement LiveCare Check-In API Call
await myAppointmentsViewModel.insertLiveCareVIDARequest(
clientRequestID: transID,
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
onSuccess: (apiResponse) {
Future.delayed(Duration(milliseconds: 500), () {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
LoaderBottomSheet.hideLoader();
getIt.get<HabibWalletViewModel>().setIsWalletAmountToBeLoaded(true);
getIt.get<HabibWalletViewModel>().initHabibWalletProvider();
getIt.get<HabibWalletViewModel>().getPatientBalanceAmount();
getIt.get<HabibWalletViewModel>().setIsWalletAmountToBeLoaded(true);
getIt.get<HabibWalletViewModel>().initHabibWalletProvider();
getIt.get<HabibWalletViewModel>().getPatientBalanceAmount();
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
});
},
onError: (error) {});
} else {
await myAppointmentsViewModel.generateAppointmentQR(
clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
projectID: widget.patientAppointmentHistoryResponseModel.projectID,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!,
onSuccess: (apiResponse) {
Future.delayed(Duration(milliseconds: 500), () {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
});
},
onError: (error) {});
} else {
await myAppointmentsViewModel.generateAppointmentQR(
clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
projectID: widget.patientAppointmentHistoryResponseModel.projectID,
appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(),
isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!,
onSuccess: (apiResponse) {
Future.delayed(Duration(milliseconds: 500), () {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
getIt.get<HabibWalletViewModel>().setIsWalletAmountToBeLoaded(true);
getIt.get<HabibWalletViewModel>().initHabibWalletProvider();
getIt.get<HabibWalletViewModel>().getPatientBalanceAmount();
getIt.get<HabibWalletViewModel>().setIsWalletAmountToBeLoaded(true);
getIt.get<HabibWalletViewModel>().initHabibWalletProvider();
getIt.get<HabibWalletViewModel>().getPatientBalanceAmount();
LoaderBottomSheet.hideLoader();
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
});
LoaderBottomSheet.hideLoader();
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
});
}
});
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err.toString()),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}, onError: (err) async {
});
}
});
}, onError: (err) async {
await payfortViewModel.updateTamaraRequestStatus(responseMessage: "Failed", status: "00", clientRequestID: transID, tamaraOrderID: tamaraOrderID);
showCommonBottomSheetWithoutHeight(
context,
@ -1084,10 +1120,13 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(),
projectId: widget.patientAppointmentHistoryResponseModel.projectID,
integrationId: 2);
if (!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: widget.patientAppointmentHistoryResponseModel.projectID, integrationId: 2);
} else {
await paytabsViewModel.setPaymentConfiguration("Appointment Payment", num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), widget.patientAppointmentHistoryResponseModel.projectID);
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = widget.patientAppointmentHistoryResponseModel.clinicID;
@ -1123,12 +1162,13 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
applePayInsertRequest.isMobSDK = true;
applePayInsertRequest.merchantReference = transID;
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.merchantIdentifier =
appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.merchantIdentifier : payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.commandType = "PURCHASE";
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.signature = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.signature : payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.accessCode : payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaRequest : payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaResponse : payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.returnURL = "";
//TODO: Need to pass dynamic params to the Apple Pay instead of static values
@ -1136,10 +1176,6 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
if (appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
num.parse(myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString()),
);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
await myAppointmentsViewModel.createAdvancePayment(

@ -45,8 +45,9 @@ class _MyAppointmentsPageState extends State<MyAppointmentsPage> {
scheduleMicrotask(() {
if (!myAppointmentsViewModel.isMyAppointmentsLoading) {
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
myAppointmentsViewModel.getPatientAppointments(true, false, isForTimeLine: false);
}
// myAppointmentsViewModel.changeTabToArrived();
});
super.initState();
}
@ -69,9 +70,9 @@ class _MyAppointmentsPageState extends State<MyAppointmentsPage> {
activeTextColor: Color(0xffED1C2B),
activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1),
tabs: [
CustomTabBarModel(null, LocaleKeys.allAppt.tr(context: context)),
// CustomTabBarModel(null, LocaleKeys.allAppt.tr(context: context)),
CustomTabBarModel(null, LocaleKeys.upcoming.tr(context: context)),
CustomTabBarModel(null, LocaleKeys.completed.tr(context: context)),
CustomTabBarModel(null, LocaleKeys.arrived.tr(context: context)),
],
onTabChange: (index) {
setState(() {
@ -80,6 +81,10 @@ class _MyAppointmentsPageState extends State<MyAppointmentsPage> {
myAppointmentsViewModel.onTabChange(index);
myAppointmentsViewModel.updateListWRTTab(index);
context.read<DateRangeSelectorRangeViewModel>().flush();
if(index == 1) {
myAppointmentsViewModel.loadFullArrivedAppointmentsIfNeeded();
}
},
).paddingSymmetrical(24.h, 0.h),
// Consumer<MyAppointmentsViewModel>(builder: (context, myAppointmentsVM, child) {
@ -150,7 +155,7 @@ class _MyAppointmentsPageState extends State<MyAppointmentsPage> {
? myAppointmentsVM.patientAppointmentsViewList.length
: 1,
itemBuilder: (context, index) {
final isExpanded = myAppointmentsVM.selectedTabIndex == 1 ? true : expandedIndex == index;
final isExpanded = myAppointmentsVM.selectedTabIndex == 0 ? true : expandedIndex == index;
return myAppointmentsVM.isMyAppointmentsLoading
? Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),

@ -232,7 +232,7 @@ class _AppointmentCardState extends State<AppointmentCard> {
Utils.buildImgWithNetwork(
url: widget.isLoading
? 'https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png'
: widget.patientAppointmentHistoryResponseModel.doctorImageURL!,
: widget.patientAppointmentHistoryResponseModel.doctorImageURL,
iconColor: AppColors.transparent,
width: 63.h,
height: 63.h,
@ -637,6 +637,7 @@ class _AppointmentCardState extends State<AppointmentCard> {
}
void _goToDetails(BuildContext context) {
if (widget.isLoading) return;
if (widget.isFromMedicalReport) return;
if (widget.isForEyeMeasurements) {
Navigator.of(context).push(

@ -45,8 +45,9 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
checkInOptionCard(
AppAssets.checkin_location_icon,
Utils.havePrivilege(102)
? checkInOptionCard(
AppAssets.checkin_location_icon,
LocaleKeys.liveLocation.tr(context: context),
LocaleKeys.verifyYourLocationAtHospital.tr(context: context),
).onPress(() {
@ -71,9 +72,10 @@ class AppointmentCheckinBottomSheet extends StatelessWidget {
}, isFullScreen: false);
}
});
}),
})
: SizedBox.shrink(),
// SizedBox(height: 16.h),
// checkInOptionCard(O
// checkInOptionCard(
// AppAssets.checkin_nfc_icon,
// LocaleKeys.nfcNearFieldCommunication.tr(context: context),
// LocaleKeys.scanPhoneViaNFC.tr(context: context),

@ -152,16 +152,13 @@ class AppointmentDoctorCard extends StatelessWidget {
),
AppCustomChipWidget(
labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w),
icon: !patientAppointmentHistoryResponseModel.isLiveCareAppointment!
? AppAssets.walkin_appointment_icon
icon: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppAssets.walkin_appointment_icon
: AppAssets.small_livecare_icon,
iconColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : Colors.white,
labelText: patientAppointmentHistoryResponseModel.isLiveCareAppointment!
? LocaleKeys.livecare.tr(context: context)
iconColor: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppColors.textColor : Colors.white,
labelText: (patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? LocaleKeys.livecare.tr(context: context)
: LocaleKeys.walkin.tr(context: context),
backgroundColor:
!patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.greyColor : AppColors.successColor,
textColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : Colors.white,
backgroundColor: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppColors.greyColor : AppColors.successColor,
textColor: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppColors.textColor : Colors.white,
),
],
),
@ -176,39 +173,39 @@ class AppointmentDoctorCard extends StatelessWidget {
? SizedBox.shrink()
: Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_icon, width: 20.h, height: 20.h, fit: BoxFit.scaleDown)
.onPress(() async {
DoctorsListResponseModel selectedDoctor = DoctorsListResponseModel();
selectedDoctor.doctorID = patientAppointmentHistoryResponseModel.doctorID;
selectedDoctor.doctorImageURL = patientAppointmentHistoryResponseModel.doctorImageURL;
selectedDoctor.name = patientAppointmentHistoryResponseModel.doctorNameObj;
selectedDoctor.doctorTitle = patientAppointmentHistoryResponseModel.doctorTitle;
selectedDoctor.nationalityFlagURL = "";
selectedDoctor.speciality = patientAppointmentHistoryResponseModel.doctorSpeciality;
selectedDoctor.clinicName = patientAppointmentHistoryResponseModel.clinicName;
selectedDoctor.projectName = patientAppointmentHistoryResponseModel.projectName;
selectedDoctor.clinicID = patientAppointmentHistoryResponseModel.clinicID;
selectedDoctor.projectID = patientAppointmentHistoryResponseModel.projectID;
getIt.get<BookAppointmentsViewModel>().setSelectedDoctor(selectedDoctor);
LoaderBottomSheet.showLoader();
await getIt.get<BookAppointmentsViewModel>().getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(
isDoctorAllowedToBook: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false),
),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
// DoctorsListResponseModel selectedDoctor = DoctorsListResponseModel();
// selectedDoctor.doctorID = patientAppointmentHistoryResponseModel.doctorID;
// selectedDoctor.doctorImageURL = patientAppointmentHistoryResponseModel.doctorImageURL;
// selectedDoctor.name = patientAppointmentHistoryResponseModel.doctorNameObj;
// selectedDoctor.doctorTitle = patientAppointmentHistoryResponseModel.doctorTitle;
// selectedDoctor.nationalityFlagURL = "";
// selectedDoctor.speciality = patientAppointmentHistoryResponseModel.doctorSpeciality;
// selectedDoctor.clinicName = patientAppointmentHistoryResponseModel.clinicName;
// selectedDoctor.projectName = patientAppointmentHistoryResponseModel.projectName;
// selectedDoctor.clinicID = patientAppointmentHistoryResponseModel.clinicID;
// selectedDoctor.projectID = patientAppointmentHistoryResponseModel.projectID;
//
// getIt.get<BookAppointmentsViewModel>().setSelectedDoctor(selectedDoctor);
// LoaderBottomSheet.showLoader();
// await getIt.get<BookAppointmentsViewModel>().getDoctorProfile(onSuccess: (dynamic respData) {
// LoaderBottomSheet.hideLoader();
// Navigator.of(context).push(
// CustomPageRoute(
// page: DoctorProfilePage(
// isDoctorAllowedToBook: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false),
// ),
// ),
// );
// }, onError: (err) {
// LoaderBottomSheet.hideLoader();
// showCommonBottomSheetWithoutHeight(
// context,
// child: Utils.getErrorWidget(loadingText: err),
// callBackFunc: () {},
// isFullScreen: false,
// isCloseButtonVisible: true,
// );
// });
})
],
),
@ -223,7 +220,48 @@ class AppointmentDoctorCard extends StatelessWidget {
],
),
),
);
).onPress(() async {
if ((patientAppointmentHistoryResponseModel.isLiveCareAppointment! ||
patientAppointmentHistoryResponseModel.isExecludeDoctor! ||
patientAppointmentHistoryResponseModel.isClinicReBookingAllowed! == false ||
patientAppointmentHistoryResponseModel.isActiveDoctor! == false ||
!Utils.isClinicAllowedForRebook(patientAppointmentHistoryResponseModel.clinicID))) {
} else {
DoctorsListResponseModel selectedDoctor = DoctorsListResponseModel();
selectedDoctor.doctorID = patientAppointmentHistoryResponseModel.doctorID;
selectedDoctor.doctorImageURL = patientAppointmentHistoryResponseModel.doctorImageURL;
selectedDoctor.name = patientAppointmentHistoryResponseModel.doctorNameObj;
selectedDoctor.doctorTitle = patientAppointmentHistoryResponseModel.doctorTitle;
selectedDoctor.nationalityFlagURL = "";
selectedDoctor.speciality = patientAppointmentHistoryResponseModel.doctorSpeciality;
selectedDoctor.clinicName = patientAppointmentHistoryResponseModel.clinicName;
selectedDoctor.projectName = patientAppointmentHistoryResponseModel.projectName;
selectedDoctor.clinicID = patientAppointmentHistoryResponseModel.clinicID;
selectedDoctor.projectID = patientAppointmentHistoryResponseModel.projectID;
getIt.get<BookAppointmentsViewModel>().setSelectedDoctor(selectedDoctor);
LoaderBottomSheet.showLoader();
await getIt.get<BookAppointmentsViewModel>().getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(
isDoctorAllowedToBook: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false),
),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}
});
}
Widget getAppointmentActionButtons(bool isAppointmentArrived) {

@ -26,7 +26,7 @@ class BuildDoctorRowAppointmentRating extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: patientAppointmentHistoryResponseModel.doctorImageURL!,
url: patientAppointmentHistoryResponseModel.doctorImageURL,
iconColor: AppColors.transparent,
width: 63.h,
height: 63.h,

@ -88,7 +88,7 @@ class AskDoctorAppointmentCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Utils.buildImgWithNetwork(
url: askDoctorAppointmentHistoryList.doctorImageURL!,
url: askDoctorAppointmentHistoryList.doctorImageURL,
iconColor: AppColors.blackBgColor,
width: 63.h,
height: 63.h,

@ -196,7 +196,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Utils.buildImgWithNetwork(
url: myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL!,
url: myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL,
iconColor: AppColors.transparent,
width: 64.h,
height: 64.h,
@ -389,7 +389,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Utils.buildImgWithNetwork(
url: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl!,
url: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl,
iconColor: AppColors.transparent,
width: 64.h,
height: 64.h,
@ -552,6 +552,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
Transform.flip(flipX: appState.isArabic(), child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, iconColor: AppColors.textColor, width: 40.h, height: 40.h)),
],
).onPress(() {
Clarity.sendCustomEvent('Select_Region_Page');
bookAppointmentsViewModel.setProjectID(null);
openRegionListBottomSheet(context, RegionBottomSheetType.FOR_REGION);
}),
@ -610,6 +611,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
),
);
} else {
immediateLiveCareViewModel.initImmediateLiveCare();
Navigator.of(context).push(
CustomPageRoute(
page: SelectImmediateLiveCareClinicPage(),

@ -1,3 +1,4 @@
import 'package:clarity_flutter/clarity_flutter.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -30,6 +31,7 @@ class DoctorProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
Clarity.setCurrentScreenName('Doctor Profile Page');
final bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
final appState = getIt.get<AppState>();
return Scaffold(
@ -87,7 +89,7 @@ class DoctorProfilePage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: bookAppointmentsViewModel.doctorsProfileResponseModel.doctorImageURL!,
url: bookAppointmentsViewModel.doctorsProfileResponseModel.doctorImageURL,
iconColor: AppColors.transparent,
width: 63.h,
height: 63.h,
@ -114,7 +116,7 @@ class DoctorProfilePage extends StatelessWidget {
],
),
Utils.buildImgWithNetwork(
url: bookAppointmentsViewModel.doctorsProfileResponseModel.nationalityFlagURL!,
url: bookAppointmentsViewModel.doctorsProfileResponseModel.nationalityFlagURL,
iconColor: AppColors.transparent,
width: 32.h,
height: 32.h,

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
@ -15,6 +16,7 @@ import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_liveca
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/immediate_livecare_pending_request_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/livecare_terms_conditions.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/widgets/select_livecare_call_type.dart';
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart';
@ -286,7 +288,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget {
(immediateLiveCareVM.liveCareImmediateAppointmentFeesList.currency ?? "ريال").toLowerCase() == "ريال")),
],
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 17.h),
SizedBox(height: 16.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -299,18 +301,59 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget {
(immediateLiveCareVM.liveCareImmediateAppointmentFeesList.currency ?? "ريال").toLowerCase() == "ريال")),
],
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 16.h),
GestureDetector(
onTap: immediateLiveCareVM.onTermsAccepted,
child: Row(
children: [
Selector<ImmediateLiveCareViewModel, bool>(
selector: (_, viewModel) => viewModel.isTermsAccepted,
shouldRebuild: (previous, next) => previous != next,
builder: (context, isTermsAccepted, child) {
return AnimatedContainer(
duration: const Duration(milliseconds: 200),
height: 24.h,
width: 24.h,
decoration: BoxDecoration(
color: isTermsAccepted ? AppColors.primaryRedColor : Colors.transparent,
borderRadius: BorderRadius.circular(6),
border: Border.all(color: isTermsAccepted ? AppColors.primaryRedBorderColor : AppColors.greyColor, width: 2.h),
),
child: isTermsAccepted ? Icon(Icons.check, size: 16.f, color: Colors.white) : null,
);
},
),
SizedBox(width: 12.h),
Row(
children: [
"${LocaleKeys.iAcceptThe.tr(context: context)} ".toText14(isBold: true),
GestureDetector(
onTap: () {
Navigator.push(
context,
CustomPageRoute(
page: LiveCareTermsConditions(),
),
);
},
child: LocaleKeys.termsConditoins.tr(context: context).toText14(isBold: true, isUnderLine: true, color: AppColors.primaryRedColor)),
],
),
],
),
).paddingSymmetrical(24.h, 0.h),
(immediateLiveCareVM.liveCareImmediateAppointmentFeesList.total == "0" ||
immediateLiveCareVM.liveCareImmediateAppointmentFeesList.total == "0.0")
// (true)
? CustomButton(
isDisabled: !immediateLiveCareVM.isTermsAccepted,
text: LocaleKeys.confirmLiveCare.tr(context: context),
onPressed: () async {
await askVideoCallPermission(context).then((val) async {
if (val) {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.confirmingLiveCareRequest.tr(context: context));
await immediateLiveCareVM.addNewCallRequestForImmediateLiveCare(
"${appState.getAuthenticatedUser()!.patientId}${DateTime.now().millisecondsSinceEpoch}");
await immediateLiveCareVM.addNewCallRequestForImmediateLiveCare("${appState.getAuthenticatedUser()!.patientId}${DateTime.now().millisecondsSinceEpoch}");
await immediateLiveCareVM.getPatientLiveCareHistory();
LoaderBottomSheet.hideLoader();
if (immediateLiveCareVM.patientHasPendingLiveCareRequest) {
@ -367,6 +410,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget {
iconSize: 18.h,
).paddingSymmetrical(24.h, 24.h)
: CustomButton(
isDisabled: !immediateLiveCareVM.isTermsAccepted,
text: LocaleKeys.payNow.tr(context: context),
onPressed: () async {
await askVideoCallPermission(context).then((val) {

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:clarity_flutter/clarity_flutter.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
@ -60,6 +61,7 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
@override
void initState() {
Clarity.setCurrentScreenName('LiveCare Payment Page');
scheduleMicrotask(() {
payfortViewModel.initPayfortViewModel();
myAppointmentsViewModel.getTamaraInstallmentsDetails().then((val) {
@ -130,11 +132,27 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "MADA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration(
"LiveCare Payment",
num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
transID = Utils.getAppointmentTransID(
immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID!,
ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12,
DateTime.now().millisecondsSinceEpoch,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
await paytabsViewModel.setPaymentConfiguration("LiveCare Payment", num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12));
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "LiveCare Payment",
serviceID: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(),
projectID: (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12).toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr());
await immediateLiveCareViewModel.addNewCallRequestForImmediateLiveCare(transactionData.transactionReference!);
await immediateLiveCareViewModel.getPatientLiveCareHistory();
@ -281,11 +299,27 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "VISA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration(
"LiveCare Payment",
num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
transID = Utils.getAppointmentTransID(
immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID!,
ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12,
DateTime.now().millisecondsSinceEpoch,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
await paytabsViewModel.setPaymentConfiguration("LiveCare Payment", num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0"),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12));
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "LiveCare Payment",
serviceID: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(),
projectID: (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12).toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr());
await immediateLiveCareViewModel.addNewCallRequestForImmediateLiveCare(transactionData.transactionReference!);
await immediateLiveCareViewModel.getPatientLiveCareHistory();
@ -426,7 +460,62 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
).paddingSymmetrical(16.h, 16.h),
).paddingSymmetrical(24.h, 0.h).onPress(() {
selectedPaymentMethod = "TAMARA";
openPaymentURL("tamara");
transID = Utils.getAppointmentTransID(
immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID!,
ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12,
DateTime.now().millisecondsSinceEpoch,
);
if (appState.isPaytabsEnabled) {
paytabsViewModel.setAlternatePaymentConfiguration(
"LiveCare Payment", num.parse(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total!),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(),
(ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12));
paytabsViewModel.startAlternatePayment(
liveServiceID: immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
appointmentDate: "",
appointmentNo: "",
doctorID: "",
transactionID: transID,
amount: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0",
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
serviceID: "4",
projectID: "12",
isSchedule: false,
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr());
tamaraOrderID = transactionData.cartID!;
await payfortViewModel.updateTamaraRequestStatus(responseMessage: "success", status: "14", clientRequestID: transID, tamaraOrderID: tamaraOrderID);
await immediateLiveCareViewModel.addNewCallRequestForImmediateLiveCare(transID);
await immediateLiveCareViewModel.getPatientLiveCareHistory();
LoaderBottomSheet.hideLoader();
if (immediateLiveCareViewModel.patientHasPendingLiveCareRequest) {
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
Navigator.of(context).push(
CustomPageRoute(
page: ImmediateLiveCarePendingRequestPage(),
),
);
} else {
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: "Unknown error occurred..."),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
},
onError: (err) async {},
);
} else {
openPaymentURL("TAMARA");
}
})
: SizedBox.shrink(),
],
@ -488,17 +577,24 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.amountBeforeTax.tr().toText14(isBold: true),
Utils.getPaymentAmountWithSymbol((immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.amount ?? "0.0").toString().toText16(isBold: true), AppColors.blackColor, 13,
isSaudiCurrency: true),
ClarityUnmask(
child: Utils.getPaymentAmountWithSymbol(
(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.amount ?? "0.0").toString().toText16(isBold: true), AppColors.blackColor, 13,
isSaudiCurrency: true),
),
],
).paddingSymmetrical(24.h, 0.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.vat15.tr().toText14(isBold: true, color: AppColors.greyTextColor),
Utils.getPaymentAmountWithSymbol(
(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.tax ?? "0.0").toString().toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, 13,
isSaudiCurrency: true),
ClarityUnmask(
child: Utils.getPaymentAmountWithSymbol(
(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.tax ?? "0.0").toString().toText14(isBold: true, color: AppColors.greyTextColor),
AppColors.greyTextColor,
13,
isSaudiCurrency: true),
),
],
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 17.h),
@ -506,8 +602,11 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
"".toText14(isBold: true),
Utils.getPaymentAmountWithSymbol((immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0").toString().toText24(isBold: true), AppColors.blackColor, 17,
isSaudiCurrency: true),
ClarityUnmask(
child: Utils.getPaymentAmountWithSymbol(
(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0").toString().toText24(isBold: true), AppColors.blackColor, 17,
isSaudiCurrency: true),
),
],
).paddingSymmetrical(24.h, 0.h),
Platform.isIOS
@ -716,9 +815,28 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
);
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), projectId: ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? 15 : 12, integrationId: 2);
if (!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(),
projectId: ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat
? appState.getAuthenticatedUser()!.outSa == 0
? 15
: 2
: appState.getAuthenticatedUser()!.outSa == 0
? 12
: 2,
integrationId: 2);
} else {
await paytabsViewModel.setPaymentConfiguration("LiveCare Payment", num.parse((immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0")),
ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(),
(ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat
? appState.getAuthenticatedUser()!.outSa == 0
? 15
: 2
: appState.getAuthenticatedUser()!.outSa == 0
? 12
: 2));
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID!;
@ -732,7 +850,7 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
applePayInsertRequest.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
applePayInsertRequest.voipToken = await Utils.getStringFromPrefs(CacheConst.voipToken);
applePayInsertRequest.doctorID = 0;
applePayInsertRequest.projectID = "12";
applePayInsertRequest.projectID = appState.getAuthenticatedUser()!.outSa == 0 ? "12" : "2";
applePayInsertRequest.serviceID = ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString();
applePayInsertRequest.channelID = 3;
applePayInsertRequest.patientID = appState.getAuthenticatedUser()!.patientId.toString();
@ -755,20 +873,19 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
applePayInsertRequest.isMobSDK = true;
applePayInsertRequest.merchantReference = transID;
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.merchantIdentifier = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.merchantIdentifier : payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.commandType = "PURCHASE";
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.signature = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.signature : payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.accessCode : payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaRequest : payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaResponse : payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.returnURL = "";
//TODO: Need to pass dynamic params to the Apple Pay instead of static values
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest).then((value) {
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest).then((value) async {
if (appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration("Advance Payment", num.parse((immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0")));
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr());
await immediateLiveCareViewModel.addNewCallRequestForImmediateLiveCare(transactionData.transactionReference!);

@ -0,0 +1,230 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import '../../../generated/locale_keys.g.dart';
class LiveCareTermsConditions extends StatelessWidget {
const LiveCareTermsConditions({super.key});
@override
Widget build(BuildContext context) {
final isArabic = getIt.get<AppState>().isArabic();
return Scaffold(
backgroundColor: AppColors.scaffoldBgColor,
body: Column(
children: [
Expanded(
child: CollapsingListView(
title: LocaleKeys.livecare.tr(context: context),
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeading(context, LocaleKeys.liveCareTermsHeading.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsIntroHeading.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions1.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions2.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading2.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions3.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions3a.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions3b.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions3c.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions3d.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions4.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions5.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions6.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading3.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions7.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions8.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions9.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions10.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions11.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions12.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions13.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading4.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions14.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions15.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions16.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading5.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions17.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions18.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions19.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions19a.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions19b.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions19c.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions19d.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions19e.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions20.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading6.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions21.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions22.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions23.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading7.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions24.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions25.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions26.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions27.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions28.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions29.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions30.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading8.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions31.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading9.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions32.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions33.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions34.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions35.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading10.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions36.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading11.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions37.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions38.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading12.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions39.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions40.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions41.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading13.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions42.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading14.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43a.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43b.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43c.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43d.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43e.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43f.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions43g.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading15.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions44.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions45.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions46.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildHeading(context, LocaleKeys.liveCareTermsHeading16.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions47.tr(context: context), isArabic),
SizedBox(height: 12.h),
_buildContent(context, LocaleKeys.liveCareTermsConditions48.tr(context: context), isArabic),
SizedBox(height: 24.h),
],
),
),
),
)
],
),
);
}
/// Helper method to build heading text with consistent styling
Widget _buildHeading(BuildContext context, String text, bool isArabic) {
return Text(
text,
style: TextStyle(
fontSize: 20.f,
fontFamily: isArabic ? 'CairoArabic' : 'Poppins',
fontWeight: FontWeight.w700,
color: AppColors.textColor,
letterSpacing: -0.5,
height: 1.4,
),
);
}
/// Helper method to build content text with consistent styling
Widget _buildContent(BuildContext context, String text, bool isArabic) {
return Text(
text,
style: TextStyle(
fontSize: 16.f,
fontFamily: isArabic ? 'CairoArabic' : 'Poppins',
color: AppColors.textColor,
letterSpacing: -0.3,
height: 1.5,
),
);
}
}

@ -3,15 +3,19 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_clinic_list_response_model.dart';
import 'package:hmg_patient_app_new/features/doctor_filter/doctor_filter_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_filter/doctors_filter.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_profile_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/select_doctor_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/doctor_card.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
@ -214,28 +218,46 @@ class _SearchDoctorByNameState extends State<SearchDoctorByName> {
bookAppointmentsViewModel: bookAppointmentsViewModel,
isDoctorNameSearch: true,
).paddingSymmetrical(16.h, 0.h).onPress(() async {
bookAppointmentsVM.setSelectedDoctor(bookAppointmentsVM.filteredDoctorList[index]);
LoaderBottomSheet.showLoader();
await bookAppointmentsVM.getDoctorProfile(
onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(isDoctorAllowedToBook: true),
),
);
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
},
);
if (bookAppointmentsVM.filteredDoctorList[index].clinicID == 17 && getIt.get<AppState>().getAuthenticatedUser()!.age! < 12) {
bookAppointmentsViewModel.setProjectID(bookAppointmentsVM.filteredDoctorList[index].projectID.toString());
bookAppointmentsViewModel.setSelectedClinic(GetClinicsListResponseModel(
clinicID: bookAppointmentsVM.filteredDoctorList[index].clinicID,
clinicDescription: bookAppointmentsVM.filteredDoctorList[index].clinicName,
isLiveCareClinicAndOnline: false,
liveCareServiceID: 0,
liveCareClinicID: 0));
bookAppointmentsViewModel.setIsDoctorsListLoading(true);
Navigator.push(
context,
CustomPageRoute(
page: SelectDoctorPage(),
),
);
} else {
bookAppointmentsVM.setSelectedDoctor(bookAppointmentsVM.filteredDoctorList[index]);
LoaderBottomSheet.showLoader();
await bookAppointmentsVM.getDoctorProfile(
onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(isDoctorAllowedToBook: true),
),
);
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
},
);
}
// Column(
// children: bookAppointmentsVM.doctorsList[index].map<Widget>((entry) {
// final doctorIndex = entry.key;

File diff suppressed because it is too large Load Diff

@ -48,17 +48,20 @@ class _SelectDoctorPageState extends State<SelectDoctorPage> {
Clarity.setCurrentScreenName('Select Doctor Page');
_scrollController = ScrollController();
scheduleMicrotask(() {
bookAppointmentsViewModel.setIsNearestAppointmentSelected(true);
bookAppointmentsViewModel.setIsNearestAppointmentSelected(false);
if (bookAppointmentsViewModel.isLiveCareSchedule) {
bookAppointmentsViewModel.getLiveCareDoctorsList();
} else {
if (bookAppointmentsViewModel.selectedClinic.clinicID == 17) {
bookAppointmentsViewModel.getDentalChiefComplaintDoctorsList();
if (appState.isAuthenticated && appState.getAuthenticatedUser()!.age! > 12) {
bookAppointmentsViewModel.getDentalChiefComplaintDoctorsList();
} else {
bookAppointmentsViewModel.getDoctorsList(isNearest: false);
}
} else if (bookAppointmentsViewModel.isGetDocForHealthCal) {
bookAppointmentsViewModel.getDoctorsListByHealthCal();
} else {
bookAppointmentsViewModel.setIsNearestAppointmentSelected(true);
bookAppointmentsViewModel.getDoctorsList(isNearest: true);
bookAppointmentsViewModel.getDoctorsList(isNearest: false);
}
}
});
@ -134,8 +137,28 @@ class _SelectDoctorPageState extends State<SelectDoctorPage> {
isLoading: bookAppointmentsVM.isClinicsListLoading,
doctorsListResponseModel: bookAppointmentsVM.liveCareDoctorsList[index],
bookAppointmentsViewModel: bookAppointmentsViewModel,
).onPress(() {
// onLiveCareClinicSelected(bookAppointmentsVM.liveCareClinicsList[index]);
).onPress(() async {
bookAppointmentsVM.setSelectedDoctor(bookAppointmentsVM.liveCareDoctorsList[index]);
LoaderBottomSheet.showLoader();
await bookAppointmentsVM.getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(
isDoctorAllowedToBook: true,
),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}),
),
),

@ -138,12 +138,30 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "MADA";
if (appState.isPaytabsEnabled) {
transID = Utils.getAppointmentTransID(
bookAppointmentsViewModel.selectedDoctor.projectID!,
bookAppointmentsViewModel.selectedDoctor.clinicID!,
bookAppointmentsViewModel.selectedDoctor.doctorID!,
);
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), bookAppointmentsViewModel.selectedDoctor.projectID!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: DateTime.now().millisecondsSinceEpoch.toString(),
doctorID: bookAppointmentsViewModel.selectedDoctor.doctorID.toString(),
transactionID: transID,
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "Appointment Payment",
serviceID: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(),
projectID: bookAppointmentsViewModel.selectedDoctor.projectID.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
await bookAppointmentsViewModel.insertSpecificAppointmentForWalkIn(onSuccess: (val) async {
String appointmentNo = val.data['AppointmentNo'].toString();
await myAppointmentsViewModel.createAdvancePayment(
@ -289,12 +307,31 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "VISA";
if (appState.isPaytabsEnabled) {
transID = Utils.getAppointmentTransID(
bookAppointmentsViewModel.selectedDoctor.projectID!,
bookAppointmentsViewModel.selectedDoctor.clinicID!,
bookAppointmentsViewModel.selectedDoctor.doctorID!,
);
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), bookAppointmentsViewModel.selectedDoctor.projectID!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: DateTime.now().millisecondsSinceEpoch.toString(),
doctorID: bookAppointmentsViewModel.selectedDoctor.doctorID.toString(),
transactionID: transID,
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "Appointment Payment",
serviceID: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(),
projectID: bookAppointmentsViewModel.selectedDoctor.projectID.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
await bookAppointmentsViewModel.insertSpecificAppointmentForWalkIn(onSuccess: (val) async {
String appointmentNo = val.data['AppointmentNo'].toString();
await myAppointmentsViewModel.createAdvancePayment(
@ -817,7 +854,7 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
paytabsViewModel.setPaymentConfiguration(
"Appointment Payment",
bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!,
);
ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), bookAppointmentsViewModel.selectedDoctor.projectID!);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.bookingWaitingAppointment.tr(context: context));
await bookAppointmentsViewModel.insertSpecificAppointmentForWalkIn(onSuccess: (val) async {

@ -278,11 +278,22 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
bookAppointmentsViewModel.setProjectID(bookAppointmentsViewModel.selectedDoctor.projectID.toString());
bookAppointmentsViewModel.setSelectedClinic(selectedClinic);
bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true);
Navigator.of(context).push(
CustomPageRoute(
page: DentalChiefComplaintsPage(),
),
);
if(appState.isAuthenticated && appState.getAuthenticatedUser()!.age! > 12) {
Navigator.of(context).push(
CustomPageRoute(
page: DentalChiefComplaintsPage(),
),
);
} else {
bookAppointmentsViewModel.getAppointmentNearestGate(projectID: bookAppointmentsViewModel.selectedDoctor.projectID!, clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!);
bookAppointmentsViewModel.setSelectedAppointmentDateTime(selectedDate, selectedTime, selectedDateDisplay);
Navigator.of(context).pop();
Navigator.of(context).push(
CustomPageRoute(
page: ReviewAppointmentPage(),
),
);
}
} else {
bookAppointmentsViewModel.getAppointmentNearestGate(projectID: bookAppointmentsViewModel.selectedDoctor.projectID!, clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!);
bookAppointmentsViewModel.setSelectedAppointmentDateTime(selectedDate, selectedTime, selectedDateDisplay);

@ -14,6 +14,7 @@ import 'package:hmg_patient_app_new/features/book_appointments/models/resp_model
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/dental_chief_complaints_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/laser/laser_appointment.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/select_doctor_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
@ -85,7 +86,7 @@ class DoctorCard extends StatelessWidget {
children: [
Utils.buildSvgWithAssets(icon: AppAssets.rating_icon, width: 15.w, height: 15.h, applyThemeColor: false),
SizedBox(height: 2.h),
"${isLoading ? 4.78 : doctorsListResponseModel.decimalDoctorRate}".toText11(isBold: true, color: AppColors.textColor, isEnglishOnly: true),
"${isLoading ? 4.78 : doctorsListResponseModel.decimalDoctorRate ?? 5.0}".toText11(isBold: true, color: AppColors.textColor, isEnglishOnly: true),
],
),
).circle(100).toShimmer2(isShow: isLoading),
@ -144,8 +145,9 @@ class DoctorCard extends StatelessWidget {
spacing: 3.h,
runSpacing: 4.h,
children: [
bookAppointmentsViewModel.isNearestAppointmentSelected
? doctorsListResponseModel.nearestFreeSlot != null
// bookAppointmentsViewModel.isNearestAppointmentSelected
// ?
doctorsListResponseModel.nearestFreeSlot != null
? AppCustomChipWidget(
labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)),
// richText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot))
@ -155,7 +157,8 @@ class DoctorCard extends StatelessWidget {
textColor: AppColors.successColor,
).toShimmer2(isShow: isLoading)
: SizedBox.shrink()
: SizedBox.shrink(),
// : SizedBox.shrink()
,
AppCustomChipWidget(
labelText: "${isLoading ? "Cardiologist" : doctorsListResponseModel.clinicName}",
).toShimmer2(isShow: isLoading),
@ -167,9 +170,10 @@ class DoctorCard extends StatelessWidget {
],
),
),
(doctorsListResponseModel.isLiveCare ?? true)
? SizedBox.shrink()
: Expanded(
// (doctorsListResponseModel.isLiveCare ?? true)
// ? SizedBox.shrink()
// :
Expanded(
flex: 1,
child: Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_icon, width: 20.h, height: 20.h, fit: BoxFit.scaleDown).toShimmer2(isShow: isLoading),
),
@ -182,14 +186,26 @@ class DoctorCard extends StatelessWidget {
if (isDoctorNameSearch && doctorsListResponseModel.clinicID == 17) {
GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel(
clinicID: doctorsListResponseModel.clinicID, clinicDescription: doctorsListResponseModel.clinicName, isLiveCareClinicAndOnline: false, liveCareServiceID: 0, liveCareClinicID: 0);
bookAppointmentsViewModel.setProjectID(doctorsListResponseModel.projectID.toString());
bookAppointmentsViewModel.setSelectedClinic(selectedClinic);
bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true);
Navigator.of(context).push(
CustomPageRoute(
page: DentalChiefComplaintsPage(),
),
);
if (getIt.get<AppState>().getAuthenticatedUser()!.age! > 12) {
bookAppointmentsViewModel.setProjectID(doctorsListResponseModel.projectID.toString());
bookAppointmentsViewModel.setSelectedClinic(selectedClinic);
bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true);
Navigator.of(context).push(
CustomPageRoute(
page: DentalChiefComplaintsPage(),
),
);
} else {
bookAppointmentsViewModel.setProjectID(doctorsListResponseModel.projectID.toString());
bookAppointmentsViewModel.setSelectedClinic(selectedClinic);
bookAppointmentsViewModel.setIsDoctorsListLoading(true);
Navigator.push(
context,
CustomPageRoute(
page: SelectDoctorPage(),
),
);
}
} else if (isDoctorNameSearch && doctorsListResponseModel.clinicID == 253) {
GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel(
clinicID: doctorsListResponseModel.clinicID, clinicDescription: doctorsListResponseModel.clinicName, isLiveCareClinicAndOnline: false, liveCareServiceID: 0, liveCareClinicID: 0);

@ -260,7 +260,7 @@ class FeedbackPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: contactUsViewModel.patientFeedbackSelectedAppointment!.doctorImageURL!,
url: contactUsViewModel.patientFeedbackSelectedAppointment?.doctorImageURL??"",
iconColor: AppColors.transparent,
width: 63.h,
height: 63.h,

@ -124,12 +124,29 @@ class _ErOnlineCheckinPaymentPageState extends State<ErOnlineCheckinPaymentPage>
).paddingSymmetrical(24.h, 0.h).onPress(() {
selectedPaymentMethod = "MADA";
if (appState.isPaytabsEnabled) {
transID = Utils.getAdvancePaymentTransID(
emergencyServicesViewModel.selectedHospital!.iD,
appState.getAuthenticatedUser()!.patientId!,
);
paytabsViewModel.setPaymentConfiguration(
"ER Online Check-In Payment",
emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
if (emergencyServicesViewModel.isERBookAppointment) {
ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum(), emergencyServicesViewModel.selectedHospital!.iD);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "0",
appointmentDate: "",
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "ER Online Check-In Payment",
serviceID: ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum().toString(),
projectID: emergencyServicesViewModel.selectedHospital!.iD.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
if (emergencyServicesViewModel.isERBookAppointment) {
await emergencyServicesViewModel.ER_CreateAdvancePayment(
paymentMethodName: selectedPaymentMethod,
paymentReference: transactionData.transactionReference!,
@ -214,12 +231,29 @@ class _ErOnlineCheckinPaymentPageState extends State<ErOnlineCheckinPaymentPage>
).paddingSymmetrical(24.h, 0.h).onPress(() {
selectedPaymentMethod = "VISA";
if (appState.isPaytabsEnabled) {
transID = Utils.getAdvancePaymentTransID(
emergencyServicesViewModel.selectedHospital!.iD,
appState.getAuthenticatedUser()!.patientId!,
);
paytabsViewModel.setPaymentConfiguration(
"ER Online Check-In Payment",
emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
if (emergencyServicesViewModel.isERBookAppointment) {
ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum(), emergencyServicesViewModel.selectedHospital!.iD);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "0",
appointmentDate: "",
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "ER Online Check-In Payment",
serviceID: ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum().toString(),
projectID: emergencyServicesViewModel.selectedHospital!.iD.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
if (emergencyServicesViewModel.isERBookAppointment) {
await emergencyServicesViewModel.ER_CreateAdvancePayment(
paymentMethodName: selectedPaymentMethod,
paymentReference: transactionData.transactionReference!,
@ -499,7 +533,7 @@ class _ErOnlineCheckinPaymentPageState extends State<ErOnlineCheckinPaymentPage>
paytabsViewModel.setPaymentConfiguration(
"ER Online Check-In Payment",
emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax!,
);
ServiceTypeEnum.erOnlineCheckIn.getIdFromServiceEnum(), emergencyServicesViewModel.selectedHospital!.iD);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
if (emergencyServicesViewModel.isERBookAppointment) {

@ -3,6 +3,7 @@ import 'dart:developer';
import 'dart:io';
import 'package:amazon_payfort/amazon_payfort.dart';
import 'package:clarity_flutter/clarity_flutter.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -54,6 +55,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
@override
void initState() {
Clarity.setCurrentScreenName('Habib Wallet Payment Page');
scheduleMicrotask(() {
payfortViewModel.initPayfortViewModel();
});
@ -113,9 +115,24 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "MADA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader();
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
await paytabsViewModel.setPaymentConfiguration(
"Advance Payment", habibWalletVM.walletRechargeAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), habibWalletVM.selectedHospital!.iD!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: habibWalletVM.walletRechargeAmount.toString(),
fileNumber: habibWalletVM.fileNumber.toString(),
orderDescription: "Advance Payment",
serviceID: ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(),
projectID: habibWalletVM.selectedHospital!.iD!.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader();
await habibWalletVM.HISCreateAdvancePayment(
paymentMethodName: selectedPaymentMethod,
paidAmount: habibWalletVM.walletRechargeAmount,
@ -162,6 +179,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
);
});
}, onError: (err) {
LoaderBottomSheet.showLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err.toString()),
@ -295,9 +313,24 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
).paddingSymmetrical(24.h, 0.h).onPress(() async {
selectedPaymentMethod = "VISA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader();
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
await paytabsViewModel.setPaymentConfiguration(
"Advance Payment", habibWalletVM.walletRechargeAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), habibWalletVM.selectedHospital!.iD!);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: habibWalletVM.walletRechargeAmount.toString(),
fileNumber: habibWalletVM.fileNumber.toString(),
orderDescription: "Advance Payment",
serviceID: ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(),
projectID: habibWalletVM.selectedHospital!.iD!.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader();
await habibWalletVM.HISCreateAdvancePayment(
paymentMethodName: selectedPaymentMethod,
paidAmount: habibWalletVM.walletRechargeAmount,
@ -469,7 +502,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
isEnglishOnly: true,
),
AppCustomChipWidget(
labelText: "${habibWalletVM.selectedHospital!.name}",
labelText: "${habibWalletVM.selectedHospital != null ? habibWalletVM.selectedHospital!.name : "Habib Hospital"}",
),
],
).paddingSymmetrical(24.h, 0.h),
@ -480,9 +513,11 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.totalAmountToPay.tr(context: context).toText16(isBold: true),
Utils.getPaymentAmountWithSymbol(
NumberFormat.decimalPattern().format(habibWalletVM.walletRechargeAmount).toString().toText24(isBold: true, isEnglishOnly: true), AppColors.blackColor, 15.h,
isSaudiCurrency: true),
ClarityUnmask(
child: Utils.getPaymentAmountWithSymbol(
NumberFormat.decimalPattern().format(habibWalletVM.walletRechargeAmount).toString().toText24(isBold: true, isEnglishOnly: true), AppColors.blackColor, 15.h,
isSaudiCurrency: true),
),
],
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 12.h),
@ -510,7 +545,11 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
transID = Utils.getAdvancePaymentTransID(habibWalletVM.selectedHospital!.iD!, int.parse(habibWalletVM.fileNumber));
await payfortViewModel.getPayfortConfigurations(serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), projectId: habibWalletVM.selectedHospital!.iD!, integrationId: 2);
if(!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), projectId: habibWalletVM.selectedHospital!.iD!, integrationId: 2);
} else {
await paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), habibWalletVM.selectedHospital!.iD!);
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = 0;
@ -546,12 +585,12 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
applePayInsertRequest.isMobSDK = true;
applePayInsertRequest.merchantReference = transID;
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.merchantIdentifier = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.merchantIdentifier : payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.commandType = "PURCHASE";
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.signature = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.signature : payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.accessCode : payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaRequest : payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = appState.isPaytabsEnabled ? paytabsViewModel.paytabsProjectDetailsRespModel!.shaResponse : payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.returnURL = "";
//TODO: Need to pass dynamic params to the Apple Pay instead of static values
@ -559,7 +598,6 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
if(appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration("Advance Payment", habibWalletVM.walletRechargeAmount);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
LoaderBottomSheet.showLoader();
await habibWalletVM.HISCreateAdvancePayment(

@ -45,89 +45,110 @@ class _HealthCalculatorDetailedPageState extends State<HealthCalculatorDetailedP
return CollapsingListView(
title: widget.calculatorType.displayName,
bottomChild: widget.calculatorType == HealthCalculatorsTypeEnum.bloodSugar ||
widget.calculatorType == HealthCalculatorsTypeEnum.bloodCholesterol ||
widget.calculatorType == HealthCalculatorsTypeEnum.triglycerides
widget.calculatorType == HealthCalculatorsTypeEnum.bloodCholesterol ||
widget.calculatorType == HealthCalculatorsTypeEnum.triglycerides
? SizedBox()
: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, customBorder: BorderRadius.only(topLeft: Radius.circular(24.r), topRight: Radius.circular(24.r))),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.h),
child: CustomButton(
text: widget.calculatorType == HealthCalculatorsTypeEnum.bloodSugar ||
widget.calculatorType == HealthCalculatorsTypeEnum.bloodCholesterol ||
widget.calculatorType == HealthCalculatorsTypeEnum.triglycerides
? LocaleKeys.convert.tr(context: context)
: LocaleKeys.calculate.tr(context: context),
onPressed: () {
if (calculatedResult == null) return;
Navigator.of(context).push(CustomPageRoute(
page: SelectClinicPage(calculatorType: widget.calculatorType, calculatedResult: calculatedResult),
));
},
icon: null,
fontSize: 16.f,
backgroundColor: calculatedResult == null ? AppColors.bgRedLightColor : AppColors.primaryRedColor,
borderColor: calculatedResult == null ? AppColors.bgRedLightColor : AppColors.primaryRedColor,
borderRadius: 12.r,
isBold: true)),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor, customBorder: BorderRadius.only(topLeft: Radius.circular(24.r), topRight: Radius.circular(24.r))),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.h),
child: CustomButton(
text: widget.calculatorType == HealthCalculatorsTypeEnum.bloodSugar ||
widget.calculatorType == HealthCalculatorsTypeEnum.bloodCholesterol ||
widget.calculatorType == HealthCalculatorsTypeEnum.triglycerides
? LocaleKeys.convert.tr(context: context)
: LocaleKeys.calculate.tr(context: context),
onPressed: () {
if (calculatedResult == null) return;
Navigator.of(context).push(CustomPageRoute(
page: SelectClinicPage(calculatorType: widget.calculatorType, calculatedResult: calculatedResult),
));
},
icon: null,
fontSize: 16.f,
backgroundColor: calculatedResult == null ? AppColors.bgRedLightColor : AppColors.primaryRedColor,
borderColor: calculatedResult == null ? AppColors.bgRedLightColor : AppColors.primaryRedColor,
borderRadius: 12.r,
isBold: true)),
child: getCalculatorWidget(
type: widget.calculatorType,
onCalculate: (result) {
// result may be directly provided by widget, but prefer provider maps if available
switch (widget.calculatorType) {
case HealthCalculatorsTypeEnum.bmi:
calculatedResult = provider.bmiResultMap != null
? {...?provider.bmiResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.calories:
case HealthCalculatorsTypeEnum.bmr:
calculatedResult = provider.caloriesResultMap != null
? {...?provider.caloriesResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.idealBodyWeight:
calculatedResult = provider.ibwResultMap != null
? {...?provider.ibwResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.bodyFat:
calculatedResult = provider.bodyFatResultMap != null
? {...?provider.bodyFatResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.crabsProteinFat:
calculatedResult = provider.macrosResultMap != null
? {...?provider.macrosResultMap, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.ovulation:
calculatedResult = (provider.ovulationResult is Map)
? {...provider.ovulationResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': provider.ovulationResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.deliveryDueDate:
calculatedResult = (provider.deliveryResult is Map)
? {...provider.deliveryResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': provider.deliveryResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.bloodSugar:
calculatedResult = (provider.bloodSugarResult is Map)
? {...provider.bloodSugarResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': provider.bloodSugarResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.bloodCholesterol:
calculatedResult = (provider.bloodCholesterolResult is Map)
? {...provider.bloodCholesterolResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': provider.bloodCholesterolResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
case HealthCalculatorsTypeEnum.triglycerides:
calculatedResult = (provider.triglyceridesResult is Map)
? {...provider.triglyceridesResult as Map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: {'result': provider.triglyceridesResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
break;
}
setState(() {
switch (widget.calculatorType) {
case HealthCalculatorsTypeEnum.bmi:
final map = provider.bmiResultMap ?? (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.calories:
case HealthCalculatorsTypeEnum.bmr:
final map = provider.caloriesResultMap ?? (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.idealBodyWeight:
final map = provider.ibwResultMap ?? (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.bodyFat:
final map = provider.bodyFatResultMap ?? (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.crabsProteinFat:
final map = provider.macrosResultMap ?? (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.ovulation:
final map = (provider.ovulationResult is Map)
? provider.ovulationResult
: (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.deliveryDueDate:
final map = (provider.deliveryResult is Map)
? provider.deliveryResult
: (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.bloodSugar:
final map = (provider.bloodSugarResult is Map)
? provider.bloodSugarResult
: (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.bloodCholesterol:
final map = (provider.bloodCholesterolResult is Map)
? provider.bloodCholesterolResult
: (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
case HealthCalculatorsTypeEnum.triglycerides:
final map = (provider.triglyceridesResult is Map)
? provider.triglyceridesResult
: (result is Map ? Map<String, dynamic>.from(result) : null);
calculatedResult = map != null
? {...map, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID}
: null;
break;
}
});
},
).paddingSymmetrical(20.w, 24.h),
);
@ -140,68 +161,68 @@ class _HealthCalculatorDetailedPageState extends State<HealthCalculatorDetailedP
case HealthCalculatorsTypeEnum.bmi:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: BMIWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.calories:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: CaloriesWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.bmr:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: BMRWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.idealBodyWeight:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: IdealBodyWeightWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.bodyFat:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: BodyFatWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.crabsProteinFat:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: CrabsWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.ovulation:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: OvulationWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.deliveryDueDate:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: DeliveryDueDWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.bloodSugar:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: BloodSugarWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.bloodCholesterol:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: BloodCholesterolWidget(onChange: onCalculate),
);
case HealthCalculatorsTypeEnum.triglycerides:
return Container(
decoration:
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
child: TriglyceridesWidget(onChange: onCalculate),
);
}

@ -58,6 +58,7 @@ import 'package:hmg_patient_app_new/presentation/notifications/notifications_lis
import 'package:hmg_patient_app_new/presentation/offers_and_discounts/offers_and_discounts_page.dart';
import 'package:hmg_patient_app_new/presentation/offers_and_discounts/widgets/offers_and_discounts.dart';
import 'package:hmg_patient_app_new/presentation/rate_appointment/rate_appointment_doctor.dart';
import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/call_screen.dart';
import 'package:hmg_patient_app_new/presentation/todo_section/ancillary_procedures_details_page.dart';
import 'package:hmg_patient_app_new/presentation/todo_section/todo_page.dart';
import 'package:hmg_patient_app_new/presentation/todo_section/widgets/ancillary_orders_list.dart';
@ -120,12 +121,23 @@ class _LandingPageState extends State<LandingPage> {
authVM = context.read<AuthenticationViewModel>();
habibWalletVM = context.read<HabibWalletViewModel>();
appointmentRatingViewModel = context.read<AppointmentRatingViewModel>();
appState = getIt.get<AppState>();
authVM.savePushTokenToAppState();
if (mounted) {
authVM.checkLastLoginStatus(() {
showQuickLogin(context);
});
final user = appState.getAuthenticatedUser();
final hasUserQuickLoginData =
user != null &&
(user.mobileNumber?.isNotEmpty ?? false) &&
(user.patientIdentificationNo?.isNotEmpty ?? false);
if (hasUserQuickLoginData) {
authVM.checkLastLoginStatus(() {
if (mounted) {
showQuickLogin(context);
}
});
}
}
_scrollController.addListener(() {
@ -154,7 +166,7 @@ class _LandingPageState extends State<LandingPage> {
immediateLiveCareViewModel.initImmediateLiveCare();
immediateLiveCareViewModel.getPatientLiveCareHistory();
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
myAppointmentsViewModel.getPatientAppointments(true, false, isForTimeLine: true);
emergencyServicesViewModel.checkPatientERAdvanceBalance();
// myAppointmentsViewModel.getPatientAppointmentQueueDetails();
notificationsViewModel.initNotificationsViewModel();
@ -172,12 +184,19 @@ class _LandingPageState extends State<LandingPage> {
appointmentNo,
projectID,
onSuccess: ((response) {
// Only open dialog if details are loaded AND widget is mounted
if (!mounted || appointmentRatingViewModel.appointmentDetails == null) return;
appointmentRatingViewModel.setClinicOrDoctor(false);
appointmentRatingViewModel.setTitle(LocaleKeys.rateDoctor.tr(context: context));
appointmentRatingViewModel.setSubTitle(LocaleKeys.howWasYourLastVisitWithDoctor.tr(context: context));
appointmentRatingViewModel.setTitle(LocaleKeys.rateDoctor.tr());
appointmentRatingViewModel.setSubTitle(LocaleKeys.howWasYourLastVisitWithDoctor.tr());
openLastRating();
appState.setRatedVisible(true);
}),
onError: (String errorMessage) {
// Silently mark as rated to prevent retry loops
if (mounted) appState.setRatedVisible(true);
},
);
}
},
@ -212,7 +231,7 @@ class _LandingPageState extends State<LandingPage> {
// Refresh Appointments Data
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
myAppointmentsViewModel.getPatientAppointments(true, false, isForTimeLine: true);
// Refresh Appointments Data
habibWalletVM.initHabibWalletProvider();
@ -273,6 +292,15 @@ class _LandingPageState extends State<LandingPage> {
page: FamilyMedicalScreen(),
),
);
// Navigator.pushReplacementNamed(
// // context,
// GetIt.instance<NavigationService>().navigatorKey.currentContext!,
// AppRoutes.zoomCallPage,
// // arguments: CallArguments(appointmentID, "111", "Patient", "40", "1", true, 1),
// arguments: CallArguments("yosemite-338", "123", "Patient", "40", "0", true, 1),
// // arguments: CallArguments("SmallDailyStandup9875", "123", "Patient", "40", "0", false, int.parse(widget.incomingCallData!.appointmentNo!)),
// );
},
name: ('${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}'),
imageWidget: Selector<ProfileSettingsViewModel, String?>(
@ -296,6 +324,13 @@ class _LandingPageState extends State<LandingPage> {
onPressed: () async {
await authVM.onLoginPressed();
// Navigator.pushReplacementNamed(
// // context,
// GetIt.instance<NavigationService>().navigatorKey.currentContext!,
// AppRoutes.zoomCallPage,
// arguments: CallArguments("lake-tahoe-289", "123", "Patient", "40", "0", true, 1),
// );
// Navigator.of(context).push(
// CustomPageRoute(
// // page: NotificationsListPage(),
@ -322,21 +357,7 @@ class _LandingPageState extends State<LandingPage> {
// spacing: 18.h,
children: [
Stack(clipBehavior: Clip.none, children: [
if (appState.isAuthenticated)
Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 24.h, width: 24.h).onPress(() async {
if (appState.isAuthenticated) {
notificationsViewModel.setNotificationStatusID(2);
notificationsViewModel.getAllNotifications();
Navigator.of(context).push(
CustomPageRoute(
page: NotificationsListPage(),
// page: LoginScreen(),
),
);
} else {
await authVM.onLoginPressed();
}
}),
if (appState.isAuthenticated) Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 24.h, width: 24.h),
(appState.isAuthenticated && todoSectionVM.notificationsCount != null && todoSectionVM.notificationsCount != "0")
? Positioned(
// right: appState.isArabic() ? 8.w : -8.w,
@ -364,7 +385,20 @@ class _LandingPageState extends State<LandingPage> {
),
)
: SizedBox.shrink(),
]),
]).onPress(() async {
if (appState.isAuthenticated) {
notificationsViewModel.setNotificationStatusID(2);
notificationsViewModel.getAllNotifications();
Navigator.of(context).push(
CustomPageRoute(
page: NotificationsListPage(),
// page: LoginScreen(),
),
);
} else {
await authVM.onLoginPressed();
}
}),
SizedBox(
width: 24.w,
),
@ -493,8 +527,8 @@ class _LandingPageState extends State<LandingPage> {
).paddingSymmetrical(24.h, 0.h).onPress(() {
myAppointmentsViewModel.onTabChange(0);
myAppointmentsViewModel.updateListWRTTab(0);
Navigator.of(context).push(CustomPageRoute(page: MyAppointmentsPage()));
Navigator.of(context).push(CustomPageRoute(page: MyAppointmentsPage()));
// getIt.get<PayTabsViewModel>().setPaymentConfiguration("Appointment Payment", 15.5);
// getIt.get<PayTabsViewModel>().startCardPayment();
}),
@ -1415,6 +1449,7 @@ class _LandingPageState extends State<LandingPage> {
appointmentNoVida: order.appointmentNo ?? 0,
orderNo: order.orderNo ?? 0,
projectID: order.projectID ?? 0,
clinicID: 0,
projectName: order.projectName ?? "",
setupID: order.setupID ?? "",
),
@ -1458,6 +1493,7 @@ class _LandingPageState extends State<LandingPage> {
}
openLastRating() {
if (!mounted) return;
showCommonBottomSheetWithoutHeight(
context,
titleWidget: Selector<AppointmentRatingViewModel, String?>(

@ -84,7 +84,7 @@ class InsuranceApprovalDetailsPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: insuranceApprovalResponseModel.doctorImageURL!,
url: insuranceApprovalResponseModel.doctorImageURL,
iconColor: AppColors.blackBgColor,
width: 63.h,
height: 63.h,

@ -107,7 +107,7 @@ class InsuranceApprovalCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: isLoading ? "https://hmgwebservices.com/Images/MobileImages/OALAY/1439.png" : insuranceApprovalResponseModel.doctorImageURL!,
url: isLoading ? "https://hmgwebservices.com/Images/MobileImages/OALAY/1439.png" : insuranceApprovalResponseModel.doctorImageURL,
iconColor: AppColors.blackBgColor,
width: 63.h,
height: 63.h,

@ -56,7 +56,7 @@ class LabResultItemView extends StatelessWidget {
Row(
children: [
Utils.buildImgWithNetwork(
url: isLoading ? "" : labOrder!.doctorImageURL!,
url: isLoading ? "" : labOrder?.doctorImageURL??"",
iconColor: AppColors.transparent,
width: 24.h,
height: 24.h,

@ -485,8 +485,6 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
dividerColor: AppColors.dividerColor,
itemPadding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.h),
onItemToggled: (index, isExpanded) {
debugPrint("Item at index $index is now ${isExpanded ? 'expanded' : 'collapsed'}");
if (index == 0 && isExpanded) {
myAppointmentsViewModel.getPatientMyDoctors(isTop8: true);
prescriptionsViewModel.initPrescriptionsViewModel();
@ -926,7 +924,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
child: Row(
children: [
Utils.buildImgWithNetwork(
url: prescriptionVM.patientPrescriptionOrders[index].doctorImageURL!,
url: prescriptionVM.patientPrescriptionOrders[index].doctorImageURL,
iconColor: AppColors.transparent,
width: 40.h,
height: 40.h,
@ -1063,7 +1061,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
],
).onPress(() {
// myAppointmentsViewModel.getPatientMyDoctors();
myAppointmentsViewModel.setIsMyDoctorsDataToBeLoaded(true);
// myAppointmentsViewModel.setIsMyDoctorsDataToBeLoaded(true);
Navigator.of(context).push(
CustomPageRoute(
page: MyDoctorsPage(),
@ -1127,7 +1125,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Utils.buildImgWithNetwork(
url: myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL!,
url: myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL,
iconColor: AppColors.transparent,
width: 64.h,
height: 64.h,

@ -142,7 +142,7 @@ class _PatientSickleavesListPageState extends State<PatientSickleavesListPage> {
mainAxisSize: MainAxisSize.min,
children: [
Utils.buildImgWithNetwork(
url: model.patientSickLeaveList[index].doctorImageURL!,
url: model.patientSickLeaveList[index].doctorImageURL,
iconColor: AppColors.transparent,
width: 24.h,
height: 24.h,

@ -57,7 +57,7 @@ class PatientSickLeaveCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: isLoading ? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png" : patientSickLeavesResponseModel.doctorImageURL!,
url: isLoading ? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png" : patientSickLeavesResponseModel.doctorImageURL,
iconColor: AppColors.transparent,
width: 30.h,
height: 30.h,

@ -43,7 +43,7 @@ class PatientMedicalReportCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: isLoading ? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png" : patientMedicalReportResponseModel.doctorImageURL!,
url: isLoading ? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png" : patientMedicalReportResponseModel.doctorImageURL,
iconColor: AppColors.transparent,
width: 63.h,
height: 63.h,

@ -94,7 +94,7 @@ class OffersAndDiscountsDetailedPage extends StatelessWidget {
ClipRRect(
borderRadius: BorderRadius.circular(24.h),
child: Utils.buildImgWithNetwork(
url: offer.imageUrl!,
url: offer.imageUrl,
iconColor: AppColors.blackBgColor,
width: double.infinity,
height: 250.h,

@ -159,7 +159,7 @@ class _OffersAndDiscountsPageState extends State<OffersAndDiscountsPage> {
borderRadius: BorderRadius.vertical(top: Radius.circular(24.h)),
child: SizedBox.expand(
child: Utils.buildImgWithNetwork(
url: offersAndDiscountVM.filteredOffers[index].imageUrl!,
url: offersAndDiscountVM.filteredOffers[index].imageUrl,
iconColor: AppColors.blackBgColor,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {

@ -62,7 +62,7 @@ class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget {
Radius.circular(5.r),
),
child: Utils.buildImgWithNetwork(
url: prescriptionsViewModel.prescriptionDetailsList[index].imageSRCUrl!,
url: prescriptionsViewModel.prescriptionDetailsList[index].imageSRCUrl,
iconColor: AppColors.blackBgColor,
fit: BoxFit.cover,
width: 60.w,

@ -126,7 +126,7 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
mainAxisSize: MainAxisSize.min,
children: [
Utils.buildImgWithNetwork(
url: widget.prescriptionsResponseModel.doctorImageURL!,
url: widget.prescriptionsResponseModel.doctorImageURL,
iconColor: AppColors.blackBgColor,
width: 24.h,
height: 24.h,

@ -43,7 +43,7 @@ class PrescriptionItemView extends StatelessWidget {
spacing: 8.h,
children: [
Utils.buildImgWithNetwork(
url: isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].imageThumbUrl!,
url: isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].imageThumbUrl,
iconColor: AppColors.blackBgColor,
width: 60.h,
height: 60.h,

@ -151,7 +151,7 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
mainAxisSize: MainAxisSize.min,
children: [
Utils.buildImgWithNetwork(
url: model.patientPrescriptionOrders[index].doctorImageURL!,
url: model.patientPrescriptionOrders[index].doctorImageURL,
iconColor: AppColors.blackBgColor,
width: 24.h,
height: 24.h,

@ -74,7 +74,7 @@ class _PreferredLanguageWidgetState extends State<PreferredLanguageWidget> {
callBackFunc: () async {
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).pop();
profileSettingsViewModel.getProfileSettings();
}, isFullScreen: false, isAutoDismiss: true);
}, isFullScreen: false, isAutoDismiss: true, isCloseButtonVisible: false);
},
onError: (error) {
LoaderBottomSheet.hideLoader();

@ -134,7 +134,7 @@ class _UpdateEmailDialogState extends State<UpdateEmailDialog> {
callBackFunc: () async {
Navigator.of(getIt<NavigationService>().navigatorKey.currentContext!).pop();
profileSettingsViewModel!.getProfileSettings();
}, isFullScreen: false, isAutoDismiss: true);
}, isFullScreen: false, isAutoDismiss: true, isCloseButtonVisible: false);
},
onError: (error) {
LoaderBottomSheet.hideLoader();

@ -41,7 +41,7 @@ class _UpdateEmergencyContactDialogState extends State<UpdateEmergencyContactDia
// Set the text
setState(() {
textController!.text = viewModel.getPatientInfoForUpdate!.emergencyContactNo ?? "";
textController!.text = viewModel.getPatientInfoForUpdate != null ? viewModel.getPatientInfoForUpdate!.emergencyContactNo ?? "" : "";
});
});

@ -25,7 +25,7 @@ class BuildDoctorRow extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildImgWithNetwork(
url: isForClinic ? 'https://hmgwebservices.com/Images/Hospitals/${appointmentDetails!.projectID}.jpg' : appointmentDetails!.doctorImageURL ,
url: isForClinic ? 'https://hmgwebservices.com/Images/Hospitals/${appointmentDetails?.projectID}.jpg' : appointmentDetails?.doctorImageURL ,
iconColor: AppColors.transparent,
width: 63.h,
height: 63.h,

@ -29,11 +29,19 @@ class OrganSelectorPage extends StatefulWidget {
State<OrganSelectorPage> createState() => _OrganSelectorPageState();
}
class _OrganSelectorPageState extends State<OrganSelectorPage> {
class _OrganSelectorPageState extends State<OrganSelectorPage> with SingleTickerProviderStateMixin {
static const double _expandedBodyZoomFactor = 1.08;
static const double _expandedSheetHeightFactor = 0.3;
static const bool _enableTutorialOverlay = false;
static const bool _enableSwipeToFlip = false;
late final AppState _appState;
late final DialogService dialogService;
late final CacheService cacheService;
late final AnimationController _introZoomHintController;
late final Animation<double> _introZoomHintAnimation;
bool _showTutorial = false;
bool _hasPlayedIntroZoomHint = false;
@override
void initState() {
@ -41,10 +49,52 @@ class _OrganSelectorPageState extends State<OrganSelectorPage> {
_appState = getIt.get<AppState>();
dialogService = getIt<DialogService>();
cacheService = getIt<CacheService>();
_introZoomHintController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 2000),
)..addListener(() {
if (mounted) setState(() {});
});
_introZoomHintAnimation = TweenSequence<double>([
TweenSequenceItem(
tween: Tween<double>(begin: 1.0, end: 1.25),
weight: 45,
),
TweenSequenceItem(
tween: Tween<double>(begin: 1.25, end: 1.0),
weight: 55,
),
]).animate(CurvedAnimation(
parent: _introZoomHintController,
curve: Curves.easeInOut,
));
_checkAndShowTutorial();
_playIntroZoomHint();
}
@override
void dispose() {
_introZoomHintController.dispose();
super.dispose();
}
Future<void> _playIntroZoomHint() async {
if (_hasPlayedIntroZoomHint) return;
_hasPlayedIntroZoomHint = true;
await Future.delayed(const Duration(milliseconds: 700));
if (!mounted) return;
_introZoomHintController.forward(from: 0);
}
Future<void> _checkAndShowTutorial() async {
if (!_enableTutorialOverlay) {
_showTutorial = false;
return;
}
// final hasSeenTutorial = cacheService.getBool(key: CacheConst.organSelectorTutorialShown) ?? false;
// if (!hasSeenTutorial) {
// Show tutorial after a short delay to ensure the screen is fully built
@ -118,7 +168,11 @@ class _OrganSelectorPageState extends State<OrganSelectorPage> {
Expanded(
child: Stack(
children: [
_buildBodyViewer(viewModel),
SafeArea(
top: false,
bottom: false,
child: _buildBodyViewer(viewModel),
),
_buildViewToggleButtons(viewModel),
// _buildViewZoomButtons(viewModel),
_buildBottomSheet(viewModel),
@ -131,7 +185,7 @@ class _OrganSelectorPageState extends State<OrganSelectorPage> {
),
),
// Tutorial overlay
if (_showTutorial)
if (_enableTutorialOverlay && _showTutorial)
PinchZoomTutorialOverlay(
onComplete: _onTutorialComplete,
),
@ -152,7 +206,13 @@ class _OrganSelectorPageState extends State<OrganSelectorPage> {
height: 24.h,
),
padding: EdgeInsetsDirectional.only(start: 12, end: 12),
onPressed: () => Navigator.pop(context),
onPressed: () {
// Clear selected organs and sheet status when going back
final viewModel = context.read<SymptomsCheckerViewModel>();
viewModel.clearAllSelections();
viewModel.setBottomSheetExpanded(false);
Navigator.pop(context);
},
highlightColor: Colors.transparent,
),
),
@ -175,45 +235,82 @@ class _OrganSelectorPageState extends State<OrganSelectorPage> {
Widget _buildBodyViewer(SymptomsCheckerViewModel viewModel) {
return GestureDetector(
onHorizontalDragEnd: (details) {
// Swipe left or right to toggle view
if (details.primaryVelocity != null) {
if (details.primaryVelocity! < -200 || details.primaryVelocity! > 200) {
viewModel.toggleView();
}
}
},
child: Padding(
padding: EdgeInsets.fromLTRB(16.h, 16.h, 16.h, 60.h),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 600),
transitionBuilder: (child, animation) => _build3DFlipTransition(child, animation),
switchInCurve: Curves.easeInOut,
switchOutCurve: Curves.easeInOut,
child: Builder(
key: ValueKey<BodyView>(viewModel.currentView),
builder: (context) {
// Detect female gender from viewModel; allow Arabic value as fallback
final bool isFemale =
(viewModel.selectedGender != null && (viewModel.selectedGender!.toLowerCase() == 'female' || viewModel.selectedGender == 'أنثى'));
final String bodyAsset = viewModel.currentView == BodyView.front
? (isFemale ? AppAssets.fullBodyFrontFemale : AppAssets.fullBodyFrontMale)
: (isFemale ? AppAssets.fullBodyBackFemale : AppAssets.fullBodyBackMale);
return InteractiveBodyWidget(
bodyImageAsset: bodyAsset,
organs: viewModel.currentOrgans,
selectedOrganIds: viewModel.selectedOrganIds,
onOrganTap: viewModel.toggleOrganSelection,
isBodyHidden: viewModel.isBodyHidden,
tooltipOrganId: viewModel.tooltipOrganId,
isArabic: _appState.isArabic(),
zoomScale: viewModel.currentZoomScale,
);
onHorizontalDragEnd: !_enableSwipeToFlip
? null
: (details) {
// Swipe left or right to toggle view
if (details.primaryVelocity != null) {
if (details.primaryVelocity! < -200 || details.primaryVelocity! > 200) {
viewModel.toggleView();
}
}
},
),
),
child: LayoutBuilder(
builder: (context, constraints) {
final bool isExpanded = viewModel.isBottomSheetExpanded;
final double screenHeight = MediaQuery.of(context).size.height;
final double extraBottomInset = isExpanded ? screenHeight * _expandedSheetHeightFactor : 0;
final bool isUserZoomedIn = viewModel.currentZoomScale > 1.01;
Widget buildInteractiveBody({required bool useExpandedZoom}) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 600),
transitionBuilder: (child, animation) => _build3DFlipTransition(child, animation),
switchInCurve: Curves.easeInOut,
switchOutCurve: Curves.easeInOut,
child: Builder(
key: ValueKey<BodyView>(viewModel.currentView),
builder: (context) {
final bool isFemale = (viewModel.selectedGender != null && (viewModel.selectedGender!.toLowerCase() == 'female' || viewModel.selectedGender == 'أنثى'));
final double effectiveZoomScale = viewModel.currentZoomScale * _introZoomHintAnimation.value;
final String bodyAsset = viewModel.currentView == BodyView.front
? (isFemale ? AppAssets.fullBodyFrontFemale : AppAssets.fullBodyFrontMale)
: (isFemale ? AppAssets.fullBodyBackFemale : AppAssets.fullBodyBackMale);
final body = InteractiveBodyWidget(
bodyImageAsset: bodyAsset,
organs: viewModel.currentOrgans,
selectedOrganIds: viewModel.selectedOrganIds,
onOrganTap: viewModel.toggleOrganSelection,
isBodyHidden: viewModel.isBodyHidden,
tooltipOrganId: viewModel.tooltipOrganId,
isArabic: _appState.isArabic(),
zoomScale: effectiveZoomScale,
);
return body;
},
),
);
}
if (!isExpanded) {
return Padding(
padding: EdgeInsets.fromLTRB(16.h, 16.h, 16.h, 60.h),
child: buildInteractiveBody(useExpandedZoom: false),
);
}
return SingleChildScrollView(
physics: isExpanded && !isUserZoomedIn ? const ClampingScrollPhysics() : const NeverScrollableScrollPhysics(),
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight + extraBottomInset,
),
child: Padding(
padding: EdgeInsets.only(
bottom: extraBottomInset,
top: 24.h,
),
child: Padding(
padding: EdgeInsets.fromLTRB(16.h, 16.h, 16.h, 60.h),
child: buildInteractiveBody(useExpandedZoom: true),
),
),
),
);
},
),
);
}
@ -408,37 +505,73 @@ class _OrganSelectorPageState extends State<OrganSelectorPage> {
}
Widget _buildExpandCollapseButton(SymptomsCheckerViewModel viewModel) {
final organCount = viewModel.selectedOrgans.length;
final showBadge = !viewModel.isBottomSheetExpanded && organCount > 0;
return PositionedDirectional(
end: 24.w,
top: -24.h,
child: GestureDetector(
onTap: viewModel.toggleBottomSheet,
behavior: HitTestBehavior.opaque,
child: Container(
child: SizedBox(
width: 70.w,
height: 70.h,
alignment: Alignment.center,
child: Container(
width: 48.w,
height: 48.h,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 11.r,
),
child: Center(
child: Transform.flip(
flipX: _appState.isArabic(),
child: AnimatedRotation(
duration: const Duration(milliseconds: 300),
turns: viewModel.isBottomSheetExpanded ? 0.25 : -0.25,
child: Utils.buildSvgWithAssets(
icon: AppAssets.arrowRight,
width: 25.w,
height: 25.h,
child: Stack(
clipBehavior: Clip.none,
children: [
Align(
alignment: Alignment.center,
child: Container(
width: 48.w,
height: 48.h,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 11.r,
),
child: Center(
child: Transform.flip(
flipX: _appState.isArabic(),
child: AnimatedRotation(
duration: const Duration(milliseconds: 300),
turns: viewModel.isBottomSheetExpanded ? 0.25 : -0.25,
child: Utils.buildSvgWithAssets(
icon: AppAssets.arrowRight,
width: 25.w,
height: 25.h,
),
),
),
),
),
),
),
if (showBadge)
PositionedDirectional(
top: 8.h,
end: 8.w,
child: Container(
width: 22.w,
height: 22.h,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.primaryRedColor,
shape: BoxShape.circle,
border: Border.all(
color: AppColors.whiteColor,
width: 1.5,
),
),
child: Text(
'$organCount',
style: TextStyle(
color: AppColors.whiteColor,
fontSize: 10.f,
fontWeight: FontWeight.w700,
),
),
),
),
],
),
),
),

@ -1,3 +1,4 @@
import 'dart:developer';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
@ -7,7 +8,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/symptoms_checker/models/organ_model.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/organ_dot_widget.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/organ_tooltip_widget.dart';
import 'package:vector_math/vector_math_64.dart' show Vector3;
class InteractiveBodyWidget extends StatefulWidget {
final String bodyImageAsset;
@ -63,9 +63,12 @@ class _InteractiveBodyWidgetState extends State<InteractiveBodyWidget> {
@override
void dispose() {
_transformationController.dispose();
currentZoom = 0.0;
super.dispose();
}
double currentZoom = 0.0;
Future<void> _loadImageAspectRatio() async {
final ByteData data = await rootBundle.load(widget.bodyImageAsset);
final ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List());
@ -77,17 +80,16 @@ class _InteractiveBodyWidgetState extends State<InteractiveBodyWidget> {
_imageAspectRatio = image.width / image.height;
});
}
_transformationController.addListener(() {
currentZoom = _transformationController.value.getMaxScaleOnAxis();
setState(() {});
});
}
void _updateZoom(double scale) {
// Get current translation
final currentTransform = _transformationController.value;
final currentTranslation = currentTransform.getTranslation();
// Create new transformation with updated scale while preserving translation
final newTransform = Matrix4.identity()
..setTranslation(currentTranslation)
..scaleByVector3(Vector3(scale, scale, 1.0));
// Keep programmatic zoom centered to avoid drifting the body off-screen.
final newTransform = Matrix4.identity()..scaleByDouble(scale, scale, 1.0, 1.0);
_transformationController.value = newTransform;
}
@ -103,8 +105,12 @@ class _InteractiveBodyWidgetState extends State<InteractiveBodyWidget> {
return Center(
child: InteractiveViewer(
transformationController: _transformationController,
minScale: 0.5,
maxScale: 4.0,
alignment: Alignment.center,
panEnabled: true,
scaleEnabled: true,
boundaryMargin: currentZoom > 1.2 ? EdgeInsets.all(200.h) : EdgeInsets.zero,
minScale: 1.0,
maxScale: 9.0,
clipBehavior: Clip.none,
child: AspectRatio(
aspectRatio: _imageAspectRatio!,
@ -135,7 +141,7 @@ class _InteractiveBodyWidgetState extends State<InteractiveBodyWidget> {
// Organ dots
...widget.organs.map((organ) {
final isSelected = widget.selectedOrganIds.contains(organ.id);
final dotSize = 16.0;
final dotSize = 18.0;
final leftPos = (organ.position.x * imageConstraints.maxWidth) - (dotSize / 2);
final topPos = (organ.position.y * imageConstraints.maxHeight) - (dotSize / 2);

@ -84,7 +84,7 @@ class _CallScreenState extends State<CallScreen> {
//hide status bar
SystemChrome.setEnabledSystemUIMode(SystemUiMode.leanBack);
var circleButtonSize = 65.0;
var circleButtonSize = 65.h;
Color backgroundColor = const Color(0xFF232323);
Color buttonBackgroundColor = const Color.fromRGBO(0, 0, 0, 0.6);
Color chatTextColor = const Color(0xFFAAAAAA);
@ -178,12 +178,12 @@ class _CallScreenState extends State<CallScreen> {
// "Join",
// arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
// );
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
// Navigator.pushAndRemoveUntil(
// context,
// CustomPageRoute(
// page: LandingNavigation(),
// ),
// (r) => false);
});
final sessionNeedPasswordListener = eventListener.addListener(EventType.onSessionNeedPassword, (data) async {
@ -1773,16 +1773,17 @@ class _CallScreenState extends State<CallScreen> {
alignment: Alignment.centerRight,
child: FractionallySizedBox(
widthFactor: 0.2,
heightFactor: 0.6,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
heightFactor: 0.8,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: onPressAudio,
icon: isMuted.value ? Utils.buildImgWithAssets(icon: "assets/images/png/zoom/unmute@2x.png") : Utils.buildImgWithAssets(icon: "assets/images/png/zoom/mute@2x.png"),
iconSize: circleButtonSize,
tooltip: isMuted.value == true ? "Unmute" : "Mute",
),
icon: isMuted.value
? Utils.buildImgWithAssets(icon: "assets/images/png/zoom/unmute@2x.png", width: circleButtonSize.h, height: circleButtonSize.h)
: Utils.buildImgWithAssets(icon: "assets/images/png/zoom/mute@2x.png", width: circleButtonSize.h, height: circleButtonSize.h),
iconSize: circleButtonSize,
),
// IconButton(
// onPressed: onPressShare,
// icon: isSharing.value ? Image.asset("assets/images/png/zoom/share-off@2x.png") : Image.asset("assets/images/png/zoom/share-on@2x.png"),
@ -1791,9 +1792,11 @@ class _CallScreenState extends State<CallScreen> {
IconButton(
onPressed: onPressVideo,
iconSize: circleButtonSize,
icon: isVideoOn.value ? Utils.buildImgWithAssets(icon: "assets/images/png/zoom/video-off@2x.png") : Utils.buildImgWithAssets(icon: "assets/images/png/zoom/video-on@2x.png"),
),
Column(
icon: isVideoOn.value
? Utils.buildImgWithAssets(icon: "assets/images/png/zoom/video-off@2x.png", width: circleButtonSize.h, height: circleButtonSize.h)
: Utils.buildImgWithAssets(icon: "assets/images/png/zoom/video-on@2x.png", width: circleButtonSize.h, height: circleButtonSize.h),
),
Column(
children: [
IconButton(
onPressed: () async {
@ -1808,7 +1811,8 @@ class _CallScreenState extends State<CallScreen> {
),
],
),
)),
),
),
// Container(
// margin: const EdgeInsets.only(left: 16, right: 16, bottom: 40, top: 10),
// alignment: Alignment.bottomCenter,

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:clarity_flutter/clarity_flutter.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -14,6 +15,8 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
import 'package:hmg_patient_app_new/features/paytabs/models/paytabs_transaction_response_model.dart';
@ -36,6 +39,7 @@ class AncillaryOrderPaymentPage extends StatefulWidget {
final int appointmentNoVida;
final int orderNo;
final int projectID;
final int clinicID;
final String setupID;
final List<AncillaryOrderProcDetail> selectedProcedures;
final num totalAmount;
@ -46,6 +50,7 @@ class AncillaryOrderPaymentPage extends StatefulWidget {
required this.appointmentNoVida,
required this.orderNo,
required this.projectID,
required this.clinicID,
required this.setupID,
required this.selectedProcedures,
required this.totalAmount,
@ -60,13 +65,20 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
late AppState appState;
late TodoSectionViewModel todoSectionViewModel;
late PayTabsViewModel paytabsViewModel;
late MyAppointmentsViewModel myAppointmentsViewModel;
late HabibWalletViewModel habibWalletVM;
MyInAppBrowser? browser;
String selectedPaymentMethod = "";
String transID = "";
bool isShowTamara = false;
String tamaraPaymentStatus = "";
String tamaraOrderID = "";
@override
void initState() {
Clarity.setCurrentScreenName('Ancillary Payment Page');
scheduleMicrotask(() {
payfortViewModel.initPayfortViewModel();
payfortViewModel.setIsApplePayConfigurationLoading(false);
@ -80,6 +92,8 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
todoSectionViewModel = Provider.of<TodoSectionViewModel>(context);
payfortViewModel = Provider.of<PayfortViewModel>(context);
paytabsViewModel = Provider.of<PayTabsViewModel>(context, listen: false);
myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context);
habibWalletVM = Provider.of<HabibWalletViewModel>(context, listen: false);
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
@ -132,12 +146,26 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
if (!todoVM.isProcessingPayment) {
selectedPaymentMethod = "MADA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration(
"Ancillary Orders Payment",
widget.totalAmount,
transID = Utils.getAdvancePaymentTransID(
widget.projectID,
appState.getAuthenticatedUser()!.patientId!,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
final paymentAmount = widget.totalAmount;
await paytabsViewModel.setPaymentConfiguration("Ancillary Orders Payment", widget.totalAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), widget.projectID);
paytabsViewModel.startCardPayment(
paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: widget.totalAmount.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId!.toString(),
orderDescription: "Ancillary Orders Payment",
serviceID: ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(),
projectID: widget.projectID.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
final paymentAmount = widget.totalAmount;
final fortId = transactionData.transactionReference;
final paymentMethod = selectedPaymentMethod;
@ -254,11 +282,24 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
if (!todoVM.isProcessingPayment) {
selectedPaymentMethod = "VISA";
if (appState.isPaytabsEnabled) {
paytabsViewModel.setPaymentConfiguration(
"Ancillary Orders Payment",
widget.totalAmount,
transID = Utils.getAdvancePaymentTransID(
widget.projectID,
appState.getAuthenticatedUser()!.patientId!,
);
paytabsViewModel.startCardPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
await paytabsViewModel.setPaymentConfiguration("Ancillary Orders Payment", widget.totalAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), widget.projectID);
paytabsViewModel.startCardPayment(paymentOption: selectedPaymentMethod,
liveServiceID: "0",
isScheduleLiveCare: "false",
appointmentDate: DateUtil.convertDateToString(DateTime.now()),
appointmentNo: "0",
doctorID: "0",
transactionID: transID,
amount: widget.totalAmount.toString(),
fileNumber: appState.getAuthenticatedUser()!.patientId!.toString(),
orderDescription: "Ancillary Orders Payment",
serviceID: ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(),
projectID: widget.projectID.toString(),
onSuccess: (PaytabsTransactionResponseModel transactionData) async {
final paymentAmount = widget.totalAmount;
final fortId = transactionData.transactionReference;
final paymentMethod = selectedPaymentMethod;
@ -331,6 +372,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
}
}
}),
SizedBox(height: 16.h),
],
),
),
@ -374,11 +416,13 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true),
Utils.getPaymentAmountWithSymbol(
amountBeforeTax.toStringAsFixed(2).toText16(isBold: true),
AppColors.blackColor,
13,
isSaudiCurrency: true,
ClarityUnmask(
child: Utils.getPaymentAmountWithSymbol(
amountBeforeTax.toStringAsFixed(2).toText16(isBold: true),
AppColors.blackColor,
13,
isSaudiCurrency: true,
),
),
],
).paddingSymmetrical(24.h, 0.h),
@ -388,11 +432,13 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.vat15.tr(context: context).toText14(isBold: true, color: AppColors.greyTextColor),
Utils.getPaymentAmountWithSymbol(
taxAmount.toStringAsFixed(2).toText14(isBold: true, color: AppColors.greyTextColor),
AppColors.greyTextColor,
13,
isSaudiCurrency: true,
ClarityUnmask(
child: Utils.getPaymentAmountWithSymbol(
taxAmount.toStringAsFixed(2).toText14(isBold: true, color: AppColors.greyTextColor),
AppColors.greyTextColor,
13,
isSaudiCurrency: true,
),
),
],
).paddingSymmetrical(24.h, 0.h),
@ -404,11 +450,13 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
"".toText14(isBold: true),
Utils.getPaymentAmountWithSymbol(
widget.totalAmount.toStringAsFixed(2).toText24(isBold: true),
AppColors.blackColor,
17,
isSaudiCurrency: true,
ClarityUnmask(
child: Utils.getPaymentAmountWithSymbol(
widget.totalAmount.toStringAsFixed(2).toText24(isBold: true),
AppColors.blackColor,
17,
isSaudiCurrency: true,
),
),
],
).paddingSymmetrical(24.h, 0.h),
@ -667,11 +715,13 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
transID = Utils.getAdvancePaymentTransID(widget.projectID, user!.patientId!);
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum(),
projectId: widget.projectID,
integrationId: 2,
);
if (!appState.isPaytabsEnabled) {
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum(),
projectId: widget.projectID,
integrationId: 2,
);
}
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = 0;
@ -716,6 +766,10 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
applePayInsertRequest.returnURL = "";
try {
if (appState.isPaytabsEnabled) {
await paytabsViewModel.setPaymentConfiguration("Ancillary Orders Payment", widget.totalAmount, ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), widget.projectID);
}
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest);
} catch (error) {
log("Apple Pay Insert Request Failed: $error");
@ -733,10 +787,6 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
if(appState.isPaytabsEnabled) {
selectedPaymentMethod = "VISA";
LoaderBottomSheet.hideLoader();
paytabsViewModel.setPaymentConfiguration(
"Ancillary Orders Payment",
widget.totalAmount,
);
paytabsViewModel.startApplePayPayment(onSuccess: (PaytabsTransactionResponseModel transactionData) async {
final paymentAmount = widget.totalAmount;
final fortId = transactionData.transactionReference;

@ -29,6 +29,7 @@ class AncillaryOrderDetailsList extends StatefulWidget {
final int appointmentNoVida;
final int orderNo;
final int projectID;
final int clinicID;
final String projectName;
final String setupID;
@ -37,6 +38,7 @@ class AncillaryOrderDetailsList extends StatefulWidget {
required this.appointmentNoVida,
required this.orderNo,
required this.projectID,
required this.clinicID,
required this.projectName,
required this.setupID,
});
@ -682,6 +684,7 @@ class _AncillaryOrderDetailsListState extends State<AncillaryOrderDetailsList> {
appointmentNoVida: widget.appointmentNoVida,
orderNo: widget.orderNo,
projectID: widget.projectID,
clinicID: widget.clinicID,
selectedProcedures: selectedProcedures,
totalAmount: _getTotalAmount(),
appointmentDate: orderData.appointmentDate,

@ -34,6 +34,7 @@ class _ToDoPageState extends State<ToDoPage> {
scheduleMicrotask(() async {
if (appState.isAuthenticated) {
await todoSectionViewModel.initializeTodoSectionViewModel();
todoSectionViewModel.setProcessingPayment(false);
}
});
super.initState();
@ -83,7 +84,8 @@ class _ToDoPageState extends State<ToDoPage> {
appointmentNoVida: order.appointmentNo ?? 0,
orderNo: order.orderNo ?? 0,
projectID: order.projectID ?? 0,
projectName: order.projectName ?? "",
clinicID: order.clinicID ?? 0,
projectName: order.projectName ?? "",
setupID: order.setupID ?? "0",
),
),

@ -53,8 +53,15 @@ class VitalSignDetailsArgs {
class VitalSignDetailsPage extends StatefulWidget {
final VitalSignDetailsArgs args;
const VitalSignDetailsPage({super.key, required this.args});
final VitalSignResModel? selectedVitalSign;
final bool isFromAppointment;
const VitalSignDetailsPage({
super.key,
required this.args,
this.selectedVitalSign,
this.isFromAppointment = false,
});
@override
State<VitalSignDetailsPage> createState() => _VitalSignDetailsPageState();
@ -65,17 +72,28 @@ class _VitalSignDetailsPageState extends State<VitalSignDetailsPage> {
VitalSignDetailsArgs get args => widget.args;
@override
void initState() {
super.initState();
if (widget.isFromAppointment) {
WidgetsBinding.instance.addPostFrameCallback((_) {
getIt.get<HmgServicesViewModel>().getPatientVitalSign(forceRefresh: true);
});
}
}
@override
Widget build(BuildContext context) {
return CollapsingListView(
title: LocaleKeys.vitalSignDetails.tr(context: context),
child: Consumer<HmgServicesViewModel>(
builder: (context, viewModel, child) {
final latest = viewModel.vitalSignList.isNotEmpty ? viewModel.vitalSignList.first : null;
final targetVitalSign = widget.selectedVitalSign ??
(viewModel.vitalSignList.isNotEmpty ? viewModel.vitalSignList.first : null);
final history = _buildSeries(viewModel.vitalSignList, args);
final latestValueText = _latestValueText(latest);
final status = _statusForLatest(latest);
final latestValueText = _latestValueText(targetVitalSign);
final status = _statusForLatest(targetVitalSign);
final scheme = VitalSignUiModel.scheme(status: status, label: args.title);
return SingleChildScrollView(
@ -89,7 +107,7 @@ class _VitalSignDetailsPageState extends State<VitalSignDetailsPage> {
valueText: latestValueText,
status: status,
scheme: scheme,
latestDate: latest?.vitalSignDate,
latestDate: targetVitalSign?.vitalSignDate,
),
_whatIsThisResultCard(context),
_historyCard(context, history: history),
@ -531,6 +549,17 @@ class _VitalSignDetailsPageState extends State<VitalSignDetailsPage> {
return RangeAnnotations(horizontalRangeAnnotations: ranges);
}
String _formatValue(dynamic value) {
if (value == null) return '--';
if (value is num && value == 0) return '--';
if (value is String) {
if (value.trim().isEmpty) return '--';
final parsed = double.tryParse(value);
if (parsed == null || parsed == 0) return '--';
}
return value.toString();
}
List<DataPoint> _buildSeries(List<VitalSignResModel> vitals, VitalSignDetailsArgs args) {
final List<DataPoint> points = [];
@ -578,7 +607,7 @@ class _VitalSignDetailsPageState extends State<VitalSignDetailsPage> {
DataPoint(
value: index,
label: label,
actualValue: mv.toStringAsFixed(0),
actualValue: _formatValue(mv),
time: dt,
displayTime: '${dt.day}/${dt.month}/${dt.year}',
unitOfMeasurement: args.unit,
@ -618,7 +647,7 @@ class _VitalSignDetailsPageState extends State<VitalSignDetailsPage> {
DataPoint(
value: index,
label: label,
actualValue: diastolic.toStringAsFixed(0),
actualValue: _formatValue(diastolic),
time: dt,
displayTime: '${dt.day}/${dt.month}/${dt.year}',
unitOfMeasurement: args.unit,
@ -646,28 +675,27 @@ class _VitalSignDetailsPageState extends State<VitalSignDetailsPage> {
switch (args.metric) {
case VitalSignMetric.bmi:
final v = _toDouble(latest.bodyMassIndex);
return v == null ? '--' : v.toStringAsFixed(0);
return _formatValue(latest.bodyMassIndex);
case VitalSignMetric.height:
final v = _toDouble(latest.heightCm);
return v == null ? '--' : '${v.toStringAsFixed(0)} ${args.unit}';
final formatted = _formatValue(latest.heightCm);
return formatted == '--' ? '--' : (args.unit.isNotEmpty ? '$formatted ${args.unit}' : formatted);
case VitalSignMetric.weight:
final v = _toDouble(latest.weightKg);
return v == null ? '--' : '${v.toStringAsFixed(0)} ${args.unit}';
final formatted = _formatValue(latest.weightKg);
return formatted == '--' ? '--' : (args.unit.isNotEmpty ? '$formatted ${args.unit}' : formatted);
case VitalSignMetric.temperature:
final v = _toDouble(latest.temperatureCelcius);
return v == null ? '--' : '${v.toStringAsFixed(0)} ${args.unit}';
final formatted = _formatValue(latest.temperatureCelcius);
return formatted == '--' ? '--' : (args.unit.isNotEmpty ? '$formatted ${args.unit}' : formatted);
case VitalSignMetric.heartRate:
final v = _toDouble(latest.heartRate ?? latest.pulseBeatPerMinute);
return v == null ? '--' : '${v.toStringAsFixed(0)} ${args.unit}';
final formatted = _formatValue(latest.heartRate ?? latest.pulseBeatPerMinute);
return formatted == '--' ? '--' : (args.unit.isNotEmpty ? '$formatted ${args.unit}' : formatted);
case VitalSignMetric.respiratoryRate:
final v = _toDouble(latest.respirationBeatPerMinute);
return v == null ? '--' : '${v.toStringAsFixed(0)} ${args.unit}';
final formatted = _formatValue(latest.respirationBeatPerMinute);
return formatted == '--' ? '--' : (args.unit.isNotEmpty ? '$formatted ${args.unit}' : formatted);
case VitalSignMetric.bloodPressure:
final s = _toDouble(latest.bloodPressureHigher);
final d = _toDouble(latest.bloodPressureLower);
if (s == null || d == null) return '--';
return '${s.toStringAsFixed(0)}/${d.toStringAsFixed(0)}';
final s = _formatValue(latest.bloodPressureHigher);
final d = _formatValue(latest.bloodPressureLower);
if (s == '--' || d == '--') return '--';
return '$s/$d';
}
}

@ -21,7 +21,14 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart';
class VitalSignPage extends StatefulWidget {
const VitalSignPage({super.key});
final VitalSignResModel? specificVitalSign;
final bool isFromAppointment;
const VitalSignPage({
super.key,
this.specificVitalSign,
this.isFromAppointment = false,
});
@override
State<VitalSignPage> createState() => _VitalSignPageState();
@ -53,10 +60,14 @@ class _VitalSignPageState extends State<VitalSignPage> {
return value.toString();
}
void _openDetails(VitalSignDetailsArgs args) {
void _openDetails(VitalSignDetailsArgs args, VitalSignResModel? targetVitalSign) {
Navigator.of(context).push(
CustomPageRoute(
page: VitalSignDetailsPage(args: args),
page: VitalSignDetailsPage(
args: args,
selectedVitalSign: targetVitalSign,
isFromAppointment: widget.isFromAppointment,
),
),
);
}
@ -75,20 +86,21 @@ class _VitalSignPageState extends State<VitalSignPage> {
child: Consumer<HmgServicesViewModel>(
builder: (context, viewModel, child) {
// Get the latest vital sign data (first item in the list)
VitalSignResModel? latestVitalSign = viewModel.vitalSignList.isNotEmpty
? viewModel.vitalSignList.first
: null;
// Get target vital sign: specificVitalSign if passed, otherwise first in list
VitalSignResModel? targetVitalSign = widget.specificVitalSign ??
(viewModel.vitalSignList.isNotEmpty
? viewModel.vitalSignList.first
: null);
// Debug logging for blood pressure
// if (latestVitalSign != null) {
// if (targetVitalSign != null) {
// print('=== Blood Pressure Debug ===');
// print('bloodPressureHigher: ${latestVitalSign.bloodPressureHigher}');
// print('bloodPressureLower: ${latestVitalSign.bloodPressureLower}');
// print('bloodPressureHigher type: ${latestVitalSign.bloodPressureHigher.runtimeType}');
// print('bloodPressureLower type: ${latestVitalSign.bloodPressureLower.runtimeType}');
// print('bloodPressureHigher == 0: ${latestVitalSign.bloodPressureHigher == 0}');
// print('bloodPressureLower == 0: ${latestVitalSign.bloodPressureLower == 0}');
// print('bloodPressureHigher: ${targetVitalSign.bloodPressureHigher}');
// print('bloodPressureLower: ${targetVitalSign.bloodPressureLower}');
// print('bloodPressureHigher type: ${targetVitalSign.bloodPressureHigher.runtimeType}');
// print('bloodPressureLower type: ${targetVitalSign.bloodPressureLower.runtimeType}');
// print('bloodPressureHigher == 0: ${targetVitalSign.bloodPressureHigher == 0}');
// print('bloodPressureLower == 0: ${targetVitalSign.bloodPressureLower == 0}');
// print('========================');
// }
@ -112,9 +124,9 @@ class _VitalSignPageState extends State<VitalSignPage> {
_buildVitalSignCard(
icon: AppAssets.bmiVital,
label: LocaleKeys.bmi.tr(context: context),
value: _formatValue(latestVitalSign?.bodyMassIndex),
value: _formatValue(targetVitalSign?.bodyMassIndex),
unit: '',
status: VitalSignUiModel.bmiStatus(latestVitalSign?.bodyMassIndex),
status: VitalSignUiModel.bmiStatus(targetVitalSign?.bodyMassIndex),
onTap: () => _openDetails(
VitalSignDetailsArgs(
metric: VitalSignMetric.bmi,
@ -122,6 +134,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
icon: AppAssets.bmiVital,
unit: '',
),
targetVitalSign,
),
),
SizedBox(height: 16.h),
@ -130,7 +143,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
_buildVitalSignCard(
icon: AppAssets.heightVital,
label: LocaleKeys.height.tr(context: context),
value: _formatValue(latestVitalSign?.heightCm),
value: _formatValue(targetVitalSign?.heightCm),
unit: 'cm',
status: null,
onTap: () => _openDetails(
@ -140,6 +153,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
icon: AppAssets.heightVital,
unit: 'cm',
),
targetVitalSign,
),
),
SizedBox(height: 16.h),
@ -148,10 +162,10 @@ class _VitalSignPageState extends State<VitalSignPage> {
_buildVitalSignCard(
icon: AppAssets.weightVital,
label: LocaleKeys.weight.tr(context: context),
value: _formatValue(latestVitalSign?.weightKg),
value: _formatValue(targetVitalSign?.weightKg),
unit: 'kg',
status: (latestVitalSign?.weightKg != null)
? VitalSignUiModel.weightStatus(latestVitalSign?.bodyMassIndex)
status: (targetVitalSign?.weightKg != null)
? VitalSignUiModel.weightStatus(targetVitalSign?.bodyMassIndex)
: null,
onTap: () => _openDetails(
VitalSignDetailsArgs(
@ -160,6 +174,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
icon: AppAssets.weightVital,
unit: 'kg',
),
targetVitalSign,
),
),
SizedBox(height: 16.h),
@ -168,18 +183,18 @@ class _VitalSignPageState extends State<VitalSignPage> {
_buildVitalSignCard(
icon: AppAssets.bloodPressure,
label: LocaleKeys.bloodPressure.tr(context: context),
value: (latestVitalSign != null &&
_isValidValue(latestVitalSign.bloodPressureHigher) &&
_isValidValue(latestVitalSign.bloodPressureLower))
? '${latestVitalSign.bloodPressureHigher}/${latestVitalSign.bloodPressureLower}'
value: (targetVitalSign != null &&
_isValidValue(targetVitalSign.bloodPressureHigher) &&
_isValidValue(targetVitalSign.bloodPressureLower))
? '${targetVitalSign.bloodPressureHigher}/${targetVitalSign.bloodPressureLower}'
: '--',
unit: '',
status: (latestVitalSign != null &&
_isValidValue(latestVitalSign.bloodPressureHigher) &&
_isValidValue(latestVitalSign.bloodPressureLower))
status: (targetVitalSign != null &&
_isValidValue(targetVitalSign.bloodPressureHigher) &&
_isValidValue(targetVitalSign.bloodPressureLower))
? VitalSignUiModel.bloodPressureStatus(
systolic: latestVitalSign.bloodPressureHigher,
diastolic: latestVitalSign.bloodPressureLower,
systolic: targetVitalSign.bloodPressureHigher,
diastolic: targetVitalSign.bloodPressureLower,
)
: null,
onTap: () => _openDetails(
@ -191,6 +206,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
low: 90,
high: 140,
),
targetVitalSign,
),
),
SizedBox(height: 16.h),
@ -199,7 +215,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
_buildVitalSignCard(
icon: AppAssets.temperature,
label: LocaleKeys.temperature.tr(context: context),
value: _formatValue(latestVitalSign?.temperatureCelcius),
value: _formatValue(targetVitalSign?.temperatureCelcius),
unit: '°C',
status: null,
onTap: () => _openDetails(
@ -211,6 +227,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
low: 36.1,
high: 37.2,
),
targetVitalSign,
),
),
],
@ -275,9 +292,9 @@ class _VitalSignPageState extends State<VitalSignPage> {
child: _buildVitalSignCard(
icon: AppAssets.heart,
label: LocaleKeys.heart.tr(context: context),
value: _formatValue(latestVitalSign?.heartRate ?? latestVitalSign?.pulseBeatPerMinute),
value: _formatValue(targetVitalSign?.heartRate ?? targetVitalSign?.pulseBeatPerMinute),
unit: 'bpm',
status: _isValidValue(latestVitalSign?.heartRate ?? latestVitalSign?.pulseBeatPerMinute) ? VitalSignStatus.normal : null,
status: _isValidValue(targetVitalSign?.heartRate ?? targetVitalSign?.pulseBeatPerMinute) ? VitalSignStatus.normal : null,
onTap: () => _openDetails(
VitalSignDetailsArgs(
metric: VitalSignMetric.heartRate,
@ -287,6 +304,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
low: 60,
high: 100,
),
targetVitalSign,
),
),
),
@ -299,9 +317,9 @@ class _VitalSignPageState extends State<VitalSignPage> {
_buildVitalSignCard(
icon: AppAssets.respRate,
label: LocaleKeys.respirationRate.tr(context: context),
value: _formatValue(latestVitalSign?.respirationBeatPerMinute),
value: _formatValue(targetVitalSign?.respirationBeatPerMinute),
unit: 'bpm',
status: _isValidValue(latestVitalSign?.respirationBeatPerMinute) ? VitalSignStatus.normal : null,
status: _isValidValue(targetVitalSign?.respirationBeatPerMinute) ? VitalSignStatus.normal : null,
onTap: () => _openDetails(
VitalSignDetailsArgs(
metric: VitalSignMetric.respiratoryRate,
@ -311,6 +329,7 @@ class _VitalSignPageState extends State<VitalSignPage> {
low: 12,
high: 20,
),
targetVitalSign,
),
),
],

@ -23,7 +23,8 @@ abstract class DialogService {
Future<void> showExceptionBottomSheet({required String message, required Function() onOkPressed, Function()? onCancelPressed});
Future<void> showCommonBottomSheetWithoutH({String? label, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed});
Future<void> showCommonBottomSheetWithoutH(
{String? label, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed});
Future<void> showSuccessBottomSheetWithoutH({String? label, required String message, required Function() onOkPressed, Function()? onCancelPressed});
@ -119,21 +120,15 @@ class DialogServiceImp implements DialogService {
}
@override
Future<void> showCommonBottomSheetWithoutH({String? label, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed}) async {
Future<void> showCommonBottomSheetWithoutH(
{String? label, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed}) async {
final context = navigationService.navigatorKey.currentContext;
if (context == null) return;
showCommonBottomSheetWithoutHeight(
context,
title: label ?? "",
child: exceptionBottomSheetWidget(
context: context,
message: message,
okLabel: okLabel,
cancelLabel: cancelLabel,
onOkPressed: onOkPressed,
onCancelPressed: onCancelPressed,
isConfirmButton: isConfirmButton
),
context: context, message: message, okLabel: okLabel, cancelLabel: cancelLabel, onOkPressed: onOkPressed, onCancelPressed: onCancelPressed, isConfirmButton: isConfirmButton),
callBackFunc: () {},
);
}
@ -240,7 +235,8 @@ class DialogServiceImp implements DialogService {
}
}
Widget exceptionBottomSheetWidget({required BuildContext context, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed}) {
Widget exceptionBottomSheetWidget(
{required BuildContext context, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed}) {
return Column(
children: [
(message).toText16(isBold: false, color: AppColors.textColor),

@ -31,14 +31,14 @@ class LiveCarePermissionService {
Permission.camera,
Permission.microphone,
Permission.notification,
if (Platform.isAndroid) Permission.systemAlertWindow,
// if (Platform.isAndroid) Permission.systemAlertWindow,
]
: <Permission>[
// Permission.camera,
// Permission.microphone,
Permission.notification,
if (Platform.isAndroid) Permission.systemAlertWindow,
];
// if (Platform.isAndroid) Permission.systemAlertWindow,
];
try {
final statuses = await permissions.request();

@ -0,0 +1,157 @@
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:freerasp/freerasp.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/talsec_config.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
/// Enum to categorize threat severity levels
enum ThreatSeverity {
critical, // Block app usage
warning, // Log only, don't block
}
/// Model to track threat details
class ThreatEvent {
final String threatType;
final ThreatSeverity severity;
final DateTime timestamp;
final String? additionalInfo;
ThreatEvent({
required this.threatType,
required this.severity,
this.additionalInfo,
}) : timestamp = DateTime.now();
}
/// Callback type for critical threat detection
typedef OnCriticalThreatDetected = void Function();
/// Abstract class defining the security service interface
abstract class SecurityService {
/// Initialize and start the security monitoring
Future<void> initialize();
/// Check if device is currently safe
bool get isSafeDevice;
/// Get list of detected threats
List<ThreatEvent> get detectedThreats;
/// Set callback for when critical threat is detected
void setOnCriticalThreatCallback(OnCriticalThreatDetected callback);
}
/// Implementation of SecurityService using Talsec (freeRASP)
class SecurityServiceImpl implements SecurityService {
final AppState appState;
final LoggerService loggerService;
final List<ThreatEvent> _detectedThreats = [];
bool _isInitialized = false;
OnCriticalThreatDetected? _onCriticalThreatCallback;
SecurityServiceImpl({
required this.appState,
required this.loggerService,
});
@override
bool get isSafeDevice => appState.isSafeDevice;
@override
List<ThreatEvent> get detectedThreats => List.unmodifiable(_detectedThreats);
@override
Future<void> initialize() async {
if (_isInitialized) {
loggerService.logInfo('SecurityService already initialized');
return;
}
try {
loggerService.logInfo('Initializing SecurityService with Talsec');
// Start the RASP engine
await Talsec.instance.start(talsecConfig);
// Setup threat callbacks
final callback = ThreatCallback(
onAppIntegrity: () => _handleThreat('App Integrity', ThreatSeverity.critical),
onObfuscationIssues: () => _handleThreat('Obfuscation Issues', ThreatSeverity.warning),
onDebug: () => _handleThreat('Debug Mode', ThreatSeverity.critical),
onDeviceBinding: () => _handleThreat('Device Binding', ThreatSeverity.critical),
onDeviceID: () => _handleThreat('Device ID Mismatch', ThreatSeverity.critical),
onHooks: () => _handleThreat('Hooks Detected', ThreatSeverity.critical),
onPasscode: () => _handleThreat('Passcode Not Set', ThreatSeverity.warning),
onPrivilegedAccess: () => _handleThreat('Privileged Access (Root/Jailbreak)', ThreatSeverity.critical),
onSecureHardwareNotAvailable: () => _handleThreat('Secure Hardware Not Available', ThreatSeverity.warning),
onSimulator: () => _handleThreat('Simulator/Emulator Detected', ThreatSeverity.critical),
onSystemVPN: () => _handleThreat('System VPN Active', ThreatSeverity.warning),
onDevMode: () => _handleThreat('Developer Mode', ThreatSeverity.warning),
onADBEnabled: () => _handleThreat('USB Debugging Enabled', ThreatSeverity.warning),
onUnofficialStore: () => _handleThreat('Unofficial Store Installation', ThreatSeverity.critical),
onScreenshot: () => _handleThreat('Screenshot Detected', ThreatSeverity.warning),
onScreenRecording: () => _handleThreat('Screen Recording Active', ThreatSeverity.warning),
onMultiInstance: () => _handleThreat('Multiple Instances', ThreatSeverity.warning),
onLocationSpoofing: () => _handleThreat('Location Spoofing', ThreatSeverity.warning),
onTimeSpoofing: () => _handleThreat('Time Spoofing', ThreatSeverity.warning),
onAutomation: () => _handleThreat('Automation Detected', ThreatSeverity.warning),
onBootloader: () => _handleThreat('Unlocked Bootloader', ThreatSeverity.critical),
onMalware: (suspiciousApps) => _handleThreat('Malware/Suspicious Apps', ThreatSeverity.critical, additionalInfo: suspiciousApps.toString()),
);
Talsec.instance.attachListener(callback);
_isInitialized = true;
loggerService.logInfo('SecurityService initialized successfully');
} catch (e) {
loggerService.logError('Failed to initialize SecurityService: $e');
if (!kDebugMode) {
FirebaseCrashlytics.instance.recordError(
e,
StackTrace.current,
reason: 'SecurityService initialization failed',
fatal: false,
);
}
rethrow;
}
}
@override
void setOnCriticalThreatCallback(OnCriticalThreatDetected callback) {
_onCriticalThreatCallback = callback;
loggerService.logInfo('Critical threat callback registered');
}
/// Handle detected threats with appropriate severity
void _handleThreat(String threatType, ThreatSeverity severity, {String? additionalInfo}) {
final threat = ThreatEvent(
threatType: threatType,
severity: severity,
additionalInfo: additionalInfo,
);
_detectedThreats.add(threat);
// Log to console
if (severity == ThreatSeverity.critical) {
loggerService.logError('🔴 CRITICAL THREAT: $threatType ${additionalInfo != null ? "- $additionalInfo" : ""}');
} else {
loggerService.logInfo('⚠️ WARNING: $threatType ${additionalInfo != null ? "- $additionalInfo" : ""}');
}
// Block app if critical threat
if (severity == ThreatSeverity.critical) {
appState.setIsSafeDevice = false;
loggerService.logError('Device marked as UNSAFE due to: $threatType');
// Trigger callback to navigate to unsafe device page
if (_onCriticalThreatCallback != null) {
_onCriticalThreatCallback!();
}
}
}
}

@ -13,9 +13,12 @@ import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/main.dart';
import 'package:hmg_patient_app_new/presentation/home/app_update_page.dart';
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
import 'package:hmg_patient_app_new/presentation/onboarding/onboarding_screen.dart';
import 'package:hmg_patient_app_new/presentation/onboarding/splash_animation_screen.dart';
@ -25,8 +28,10 @@ import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/services/notification_service.dart';
import 'package:hmg_patient_app_new/services/zoom_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/unsafe_device.dart';
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
import 'package:lottie/lottie.dart';
import 'package:safe_device/safe_device.dart';
import 'core/cache_consts.dart';
import 'core/utils/push_notification_handler.dart';
@ -41,43 +46,62 @@ class SplashPage extends StatefulWidget {
class _SplashScreenState extends State<SplashPage> {
late AuthenticationViewModel authVm;
bool isJailBroken = false;
bool isRealDevice = true;
bool isDevelopmentModeEnable = false;
Future<void> initializeStuff() async {
listenerEvent();
if (kReleaseMode) {
checkDeviceSafety();
}
Timer(
Duration(milliseconds: 500),
() async {
ApiConsts.setBackendURLs();
PushNotificationHandler().init(context); // Asyncronously
// if (ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat) {
// HttpOverrides.global = MyHttpOverrides();
// }
},
);
await authVm.getServicePrivilege();
Timer(Duration(seconds: 2, milliseconds: 500), () async {
bool isAppOpenedFromCall = getIt.get<CacheService>().getBool(key: CacheConst.isAppOpenedFromCall) ?? false;
// Initialize NotificationService using dependency injection
final notificationService = getIt.get<NotificationService>();
await notificationService.initialize(onNotificationClick: (payload) {
// Handle notification click here
});
if (isJailBroken || !isRealDevice || !getIt.get<AppState>().isSafeDevice) {
// Critical threat detected - navigate to unsafe device page
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pushAndRemoveUntil(
MaterialPageRoute(builder: (_) => const UnsafeDevice()),
(route) => false, // Remove all previous routes
);
} else {
bool isAppOpenedFromCall = getIt.get<CacheService>().getBool(key: CacheConst.isAppOpenedFromCall) ?? false;
// Initialize NotificationService using dependency injection
final notificationService = getIt.get<NotificationService>();
await notificationService.initialize(onNotificationClick: (payload) {
// Handle notification click here
});
ZoomService().initializeZoomSDK();
ZoomService().initializeZoomSDK();
if (!kDebugMode) {
_initializeClarity();
}
if (!kDebugMode) {
_initializeClarity();
}
if (isAppOpenedFromCall) {
navigateToTeleConsult();
} else {
if (await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) {
// Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: OnboardingScreen())));
Navigator.of(context).pushReplacement(FadePage(page: OnboardingScreen()));
if (isAppOpenedFromCall) {
navigateToTeleConsult();
} else {
// Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation())));
Navigator.of(context).pushReplacement(FadePage(page: LandingNavigation()));
if (await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) {
// Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: OnboardingScreen())));
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pushReplacement(FadePage(page: OnboardingScreen()));
} else {
// Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation())));
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pushReplacement(FadePage(page: LandingNavigation()));
}
}
}
});
// var zoom = ZoomVideoSdk();
// InitConfig initConfig = InitConfig(
// domain: "zoom.us",
@ -153,6 +177,29 @@ class _SplashScreenState extends State<SplashPage> {
);
}
void checkDeviceSafety() {
try {
SafeDevice.isJailBroken.then((bool value) {
isJailBroken = value;
});
SafeDevice.isJailBrokenCustom.then((bool value) {
isJailBroken = value;
});
SafeDevice.isRealDevice.then((value) {
isRealDevice = value;
});
if (Platform.isAndroid) {
// isOnExternalStorage = await SafeDevice.isOnExternalStorage;
// SafeDevice.isDevelopmentModeEnable.then((value) {
// isDevelopmentModeEnable = value;
// });
}
} catch (error) {
print(error);
}
}
Future<void> listenerEvent() async {
print('Call Canceled : ------->');

@ -16,10 +16,7 @@ class AppTheme {
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.light,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder()
},
builders: {TargetPlatform.android: ZoomPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder()},
),
hintColor: Colors.grey[400],
disabledColor: Colors.grey[300],
@ -52,10 +49,7 @@ class AppTheme {
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.dark,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder()
},
builders: {TargetPlatform.android: ZoomPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder()},
),
hintColor: Colors.grey[600],
disabledColor: Colors.grey[700],
@ -64,8 +58,7 @@ class AppTheme {
scaffoldBackgroundColor: AppColors.dark.scaffoldBgColor,
highlightColor: Colors.grey[800]!.withOpacity(0.4),
splashColor: Colors.transparent,
bottomSheetTheme: BottomSheetThemeData(
backgroundColor: Colors.black.withOpacity(0)),
bottomSheetTheme: BottomSheetThemeData(backgroundColor: Colors.black.withOpacity(0)),
floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2),
appBarTheme: AppBarTheme(
color: AppColors.dark.scaffoldBgColor,

@ -0,0 +1,119 @@
import 'package:clarity_flutter/clarity_flutter.dart';
import 'package:flutter/material.dart';
import 'package:freerasp/freerasp.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/services/security_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class UnsafeDevice extends StatefulWidget {
const UnsafeDevice({super.key});
@override
State<UnsafeDevice> createState() => _UnsafeDeviceState();
}
class _UnsafeDeviceState extends State<UnsafeDevice> {
@override
void initState() {
Clarity.setCurrentScreenName('Unsafe Device Page');
Talsec.instance.detachListener();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.whiteColor,
body: SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Logo
Utils.buildImgWithAssets(icon: AppAssets.hmgLogo, width: MediaQuery.of(context).size.width * 0.7, height: 90.h, fit: BoxFit.contain),
SizedBox(height: 32.h),
// Warning Icon
Icon(
Icons.security,
size: 80.h,
color: AppColors.primaryRedColor,
),
SizedBox(height: 24.h),
// Title
Text(
'Unsafe Device Detected',
style: TextStyle(
fontSize: 24.f,
fontWeight: FontWeight.bold,
color: AppColors.primaryRedColor,
),
textAlign: TextAlign.center,
),
SizedBox(height: 16.h),
// Description
Text(
'For your security, this app cannot run on devices with security vulnerabilities.',
style: TextStyle(
fontSize: 16.f,
color: Colors.black87,
),
textAlign: TextAlign.center,
),
SizedBox(height: 24.h),
if (getIt.get<SecurityService>().detectedThreats.isNotEmpty) ...[
Text(
'Detected Issues:',
style: TextStyle(
fontSize: 14.f,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
SizedBox(height: 8.h),
Container(
padding: EdgeInsets.all(12.w),
decoration: BoxDecoration(
color: Colors.red.withOpacity(0.1),
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: Colors.red.withOpacity(0.3)),
),
child: Column(
children: getIt
.get<SecurityService>()
.detectedThreats
.where((t) => t.severity == ThreatSeverity.critical)
.take(5) // Show max 5 threats
.map((threat) => Padding(
padding: EdgeInsets.symmetric(vertical: 4.h),
child: Row(
children: [
Icon(Icons.error_outline, size: 16.f, color: AppColors.primaryRedColor),
SizedBox(width: 8.w),
Expanded(
child: Text(
threat.threatType,
style: TextStyle(fontSize: 12.f),
),
),
],
),
))
.toList(),
),
),
SizedBox(height: 24.h),
],
],
),
),
),
);
}
}

@ -257,8 +257,7 @@ void showCommonBottomSheetWithoutHeight(
duration: Duration(milliseconds: 500),
reverseDuration: Duration(milliseconds: 300),
),
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width //MediaQuery.of(context).size.width, // Full width
),
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width),
context: context,
isScrollControlled: true,
showDragHandle: false,

@ -56,8 +56,9 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
late DateRangeSelectorRangeViewModel model;
PickerViewMode _viewMode = PickerViewMode.date;
// Cache for Hijri conversions to avoid repeated calculations
final Map<String, HijriGregDate> _hijriCache = {};
// Prevent Syncfusion's initial onViewChanged callback from scheduling an
// unnecessary second build of the same month.
late int _displayedMonthKey;
// Track the current Hijri month/year being displayed (for header display accuracy)
HijriGregDate? _currentHijriDisplay;
@ -65,10 +66,14 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
@override
void initState() {
_calendarController = DateRangePickerController();
final today = DateTime.now();
_displayedMonthKey = _monthKey(today);
if (widget.designType == CalendarDesignType.designV2) {
_calendarController.displayDate = today;
}
scheduleMicrotask(() {
if (widget.designType == CalendarDesignType.designV2) {
// For V2, select today's date by default
final today = DateTime.now();
_calendarController.selectedDate = today;
model.updateSelectedDate(today);
} else {
@ -83,7 +88,9 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
Widget build(BuildContext context) {
model = Provider.of<DateRangeSelectorRangeViewModel>(context);
_calendarController.selectedRange = PickerDateRange(model.fromDate, model.toDate);
if (widget.designType != CalendarDesignType.designV2) {
_calendarController.selectedRange = PickerDateRange(model.fromDate, model.toDate);
}
return widget.designType == CalendarDesignType.designV2 ? _buildDesignV2(widget.btnTitle) : _buildDefaultUI();
}
@ -273,18 +280,17 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
tabs: [CustomTabBarModel(null, LocaleKeys.gregorianDate.tr()), CustomTabBarModel(null, LocaleKeys.hijriDate.tr())],
onTabChange: (index) {
final calendarModel = Provider.of<DateRangCalenderModel>(context, listen: false);
if (calendarModel.getSelectedTabIndex == index) return;
// Update local fields before notifying the provider so
// the calendar changes with a single rebuild.
_viewMode = PickerViewMode.date;
_currentHijriDisplay = null;
calendarModel.setTabIndex(index);
// Notify parent widget about calendar type change (e.g., AuthenticationViewModel)
final isGregorian = index == 0;
widget.onCalendarTypeChanged?.call(isGregorian);
print('📅 Calendar type changed: ${isGregorian ? "Gregorian" : "Hijri"}');
// Reset view mode and Hijri display when switching calendar types
setState(() {
_viewMode = PickerViewMode.date;
_currentHijriDisplay = null;
});
},
),
),
@ -306,12 +312,17 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
child: Material(
color: AppColors.whiteColor,
// Rebuild when view mode or calendar type changes
// Syncfusion caches its rendered date cells. Include
// the calendar type in the key so Gregorian/Hijri day
// labels refresh immediately when the tab changes.
// Hijri conversion is now constant-time, so this
// targeted recreation remains responsive.
key: ValueKey('${calendarModel.getSelectedTabIndex}-$_viewMode'),
child: _viewMode == PickerViewMode.month
? _buildMonthPicker(isArabic, calendarModel)
: _viewMode == PickerViewMode.year
? _buildYearPicker(isArabic, calendarModel)
: (calendarModel.isHijri ? _buildHijriCalendar(isArabic) : _buildGregorianCalendar(isArabic)),
? _buildYearPicker(isArabic, calendarModel)
: (calendarModel.isHijri ? _buildHijriCalendar(isArabic) : _buildGregorianCalendar(isArabic)),
),
),
],
@ -343,6 +354,8 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
// Build Gregorian calendar (Design V2 - Single Date Selection)
Widget _buildGregorianCalendar(bool isArabic) {
final today = DateTime.now();
return SfDateRangePicker(
controller: _calendarController,
selectionMode: DateRangePickerSelectionMode.single,
@ -366,7 +379,7 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
// Custom cell builder for square border selection
cellBuilder: (BuildContext context, DateRangePickerCellDetails cellDetails) {
if (cellDetails.date != DateTime(0)) {
final isToday = cellDetails.date.day == DateTime.now().day && cellDetails.date.month == DateTime.now().month && cellDetails.date.year == DateTime.now().year;
final isToday = cellDetails.date.day == today.day && cellDetails.date.month == today.month && cellDetails.date.year == today.year;
final isSelected = _calendarController.selectedDate != null &&
cellDetails.date.day == _calendarController.selectedDate!.day &&
cellDetails.date.month == _calendarController.selectedDate!.month &&
@ -414,12 +427,7 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
),
),
onViewChanged: (DateRangePickerViewChangedArgs args) {
// Trigger rebuild when month changes
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {});
}
});
_handleCalendarViewChanged(args);
},
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
if (args.value is DateTime) {
@ -433,105 +441,155 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
);
}
// Build Hijri calendar (Design V2 - Single Date Selection)
// Note: SfDateRangePicker doesn't have built-in Hijri support
// Using Gregorian calendar with Hijri date conversion in the model
// Build one complete Hijri month instead of relabelling the dates in a
// Gregorian month. A Gregorian month overlaps two Hijri months, which would
// otherwise produce sequences such as 16...30, 1...17 in the same grid.
Widget _buildHijriCalendar(bool isArabic) {
final calendarModel = Provider.of<DateRangCalenderModel>(context, listen: false);
final today = DateTime.now();
final displayedGregorian = _calendarController.displayDate ?? today;
final displayedHijri = _currentHijriDisplay ?? calendarModel.gregorianToHijri(displayedGregorian);
final firstHijriDay = HijriGregDate(day: 1, month: displayedHijri.month, year: displayedHijri.year);
final firstGregorianDay = calendarModel.hijriToGregorian(firstHijriDay);
final leadingEmptyCells = firstGregorianDay.weekday % DateTime.daysPerWeek;
final daysInMonth = calendarModel.getDaysInMonth(displayedHijri.year, displayedHijri.month);
final selectedDate = _calendarController.selectedDate;
const weekdays = [
DateTime.sunday,
DateTime.monday,
DateTime.tuesday,
DateTime.wednesday,
DateTime.thursday,
DateTime.friday,
DateTime.saturday,
];
return SfDateRangePicker(
controller: _calendarController,
selectionMode: DateRangePickerSelectionMode.single,
showNavigationArrow: false,
headerHeight: 0,
backgroundColor: AppColors.whiteColor,
monthViewSettings: DateRangePickerMonthViewSettings(
viewHeaderStyle: DateRangePickerViewHeaderStyle(
backgroundColor: AppColors.whiteColor,
textStyle: TextStyle(
fontSize: 12.f,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
color: AppColors.textColor,
return Column(
children: [
SizedBox(
height: 32.h,
child: Row(
children: weekdays
.map(
(weekday) => Expanded(
child: Center(
child: Text(
calendarModel.getWeekdayNameLocalized(weekday, isArabic),
style: TextStyle(
fontSize: 12.f,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
color: AppColors.textColor,
),
),
),
),
)
.toList(),
),
),
showTrailingAndLeadingDates: false,
dayFormat: "EEE",
),
cellBuilder: (BuildContext context, DateRangePickerCellDetails cellDetails) {
if (cellDetails.date != DateTime(0)) {
// Use cached Hijri conversion
final dateKey = '${cellDetails.date.year}-${cellDetails.date.month}-${cellDetails.date.day}';
final hijriDate = _hijriCache.putIfAbsent(dateKey, () => calendarModel.gregorianToHijri(cellDetails.date));
Expanded(
child: GridView.builder(
padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: DateTime.daysPerWeek,
mainAxisExtent: 36.h,
mainAxisSpacing: 4.h,
),
itemCount: 42,
itemBuilder: (context, index) {
final hijriDay = index - leadingEmptyCells + 1;
if (hijriDay < 1 || hijriDay > daysInMonth) {
return const SizedBox.shrink();
}
final isToday = cellDetails.date.day == DateTime.now().day && cellDetails.date.month == DateTime.now().month && cellDetails.date.year == DateTime.now().year;
final isSelected = _calendarController.selectedDate != null &&
cellDetails.date.day == _calendarController.selectedDate!.day &&
cellDetails.date.month == _calendarController.selectedDate!.month &&
cellDetails.date.year == _calendarController.selectedDate!.year;
final hijriDate = HijriGregDate(day: hijriDay, month: displayedHijri.month, year: displayedHijri.year);
final gregorianDate = calendarModel.hijriToGregorian(hijriDate);
final isToday = _isSameDate(gregorianDate, today);
final isSelected = selectedDate != null && _isSameDate(gregorianDate, selectedDate);
return Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.h),
border: isSelected ? Border.all(color: AppColors.primaryRedColor, width: 2) : null,
color: Colors.transparent,
),
child: Text(
hijriDate.day.toString(),
style: TextStyle(
fontFamily: "Poppins",
fontSize: 12.f,
color: AppColors.textColor,
fontWeight: isToday ? FontWeight.bold : (isSelected ? FontWeight.w600 : FontWeight.normal),
),
),
);
}
return Container();
},
selectionShape: DateRangePickerSelectionShape.rectangle,
selectionRadius: 8.h,
selectionColor: Colors.transparent,
selectionTextStyle: TextStyle(
fontFamily: "Poppins",
color: AppColors.textColor,
fontWeight: FontWeight.w600,
),
todayHighlightColor: Colors.transparent,
monthCellStyle: DateRangePickerMonthCellStyle(
textStyle: TextStyle(
fontFamily: "Poppins",
fontSize: 12.f,
color: AppColors.textColor,
),
todayTextStyle: TextStyle(
fontFamily: "Poppins",
color: AppColors.textColor,
fontWeight: FontWeight.bold,
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_calendarController.selectedDate = gregorianDate;
setState(() {
start = gregorianDate;
end = gregorianDate;
});
model.updateSelectedDate(gregorianDate);
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.h),
border: isSelected ? Border.all(color: AppColors.primaryRedColor, width: 2) : null,
color: Colors.transparent,
),
child: Text(
hijriDay.toString(),
style: TextStyle(
fontFamily: "Poppins",
fontSize: 12.f,
color: AppColors.textColor,
fontWeight: isToday ? FontWeight.bold : (isSelected ? FontWeight.w600 : FontWeight.normal),
),
),
),
);
},
),
),
),
onViewChanged: (DateRangePickerViewChangedArgs args) {
// Clear cache when month changes to avoid stale data
_hijriCache.clear();
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {});
}
});
},
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
if (args.value is DateTime) {
setState(() {
start = args.value;
end = args.value;
});
model.updateSelectedDate(args.value);
}
},
],
);
}
bool _isSameDate(DateTime first, DateTime second) {
return first.year == second.year && first.month == second.month && first.day == second.day;
}
int _monthKey(DateTime date) => (date.year * 100) + date.month;
void _changeHijriMonth(DateRangCalenderModel calendarModel, int monthDelta) {
final displayedDate = _calendarController.displayDate ?? DateTime.now();
final currentHijri = _currentHijriDisplay ?? calendarModel.gregorianToHijri(displayedDate);
final zeroBasedMonth = (currentHijri.year * 12) + currentHijri.month - 1 + monthDelta;
final nextHijriDate = HijriGregDate(
day: 1,
month: (zeroBasedMonth % 12) + 1,
year: zeroBasedMonth ~/ 12,
);
final nextGregorianDate = calendarModel.hijriToGregorian(nextHijriDate);
setState(() {
_currentHijriDisplay = nextHijriDate;
_calendarController.displayDate = nextGregorianDate;
_displayedMonthKey = _monthKey(nextGregorianDate);
});
}
void _handleCalendarViewChanged(DateRangePickerViewChangedArgs args) {
final rangeStart = args.visibleDateRange.startDate;
final rangeEnd = args.visibleDateRange.endDate;
final displayedDate = _calendarController.displayDate ??
(rangeEnd == null
? rangeStart
: rangeStart?.add(Duration(days: rangeEnd.difference(rangeStart).inDays ~/ 2)));
if (displayedDate == null) return;
final newMonthKey = _monthKey(displayedDate);
if (newMonthKey == _displayedMonthKey) return;
_displayedMonthKey = newMonthKey;
_currentHijriDisplay = null;
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {});
}
});
}
// Build unified calendar header for both Gregorian and Hijri
Widget _buildCalendarHeader(bool isArabic, DateRangCalenderModel calendarModel) {
final displayedDate = _calendarController.displayDate ?? DateTime.now();
@ -609,12 +667,10 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
icon: Icon(Icons.chevron_left, color: AppColors.primaryRedColor),
onPressed: () {
if (_viewMode == PickerViewMode.date) {
_calendarController.backward!();
// Update tracked Hijri display when navigating months
if (calendarModel.isHijri) {
setState(() {
_currentHijriDisplay = null; // Will recalculate on next build
});
_changeHijriMonth(calendarModel, -1);
} else {
_calendarController.backward!();
}
} else if (_viewMode == PickerViewMode.year) {
// Navigate years backward by 12
@ -625,7 +681,7 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
try {
final newHijriDate = HijriGregDate(day: 1, month: hijriDate.month, year: hijriDate.year - 12);
final newGregorianDate = calendarModel.hijriToGregorian(newHijriDate);
_calendarController.displayDate = DateTime(newGregorianDate.year, newGregorianDate.month, 1);
_calendarController.displayDate = newGregorianDate;
_currentHijriDisplay = newHijriDate;
} catch (e) {
// Fallback
@ -645,12 +701,10 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
icon: Icon(Icons.chevron_right, color: AppColors.primaryRedColor),
onPressed: () {
if (_viewMode == PickerViewMode.date) {
_calendarController.forward!();
// Update tracked Hijri display when navigating months
if (calendarModel.isHijri) {
setState(() {
_currentHijriDisplay = null; // Will recalculate on next build
});
_changeHijriMonth(calendarModel, 1);
} else {
_calendarController.forward!();
}
} else if (_viewMode == PickerViewMode.year) {
// Navigate years forward by 12
@ -661,7 +715,7 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
try {
final newHijriDate = HijriGregDate(day: 1, month: hijriDate.month, year: hijriDate.year + 12);
final newGregorianDate = calendarModel.hijriToGregorian(newHijriDate);
_calendarController.displayDate = DateTime(newGregorianDate.year, newGregorianDate.month, 1);
_calendarController.displayDate = newGregorianDate;
_currentHijriDisplay = newHijriDate;
} catch (e) {
// Fallback
@ -696,7 +750,7 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
if (calendarModel.isHijri) {
// For Hijri calendar
final hijriCurrent = calendarModel.gregorianToHijri(currentDate);
final hijriDisplayed = calendarModel.gregorianToHijri(displayedDate);
final hijriDisplayed = _currentHijriDisplay ?? calendarModel.gregorianToHijri(displayedDate);
currentMonth = hijriCurrent.month;
currentYear = hijriCurrent.year;
displayedYear = hijriDisplayed.year;
@ -730,11 +784,9 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
try {
final hijriDate = HijriGregDate(day: 1, month: monthIndex, year: displayedYear);
final gregorianDate = calendarModel.hijriToGregorian(hijriDate);
_calendarController.displayDate = DateTime(gregorianDate.year, gregorianDate.month, 1);
_calendarController.displayDate = gregorianDate;
// Track the Hijri month/year for accurate header display
_currentHijriDisplay = hijriDate;
// Clear cache since we changed the month
_hijriCache.clear();
} catch (e) {
// Fallback if conversion fails
_calendarController.displayDate = DateTime(displayedDate.year, monthIndex, 1);
@ -784,7 +836,7 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
if (calendarModel.isHijri) {
// For Hijri calendar
final hijriDisplayed = calendarModel.gregorianToHijri(displayedDate);
final hijriDisplayed = _currentHijriDisplay ?? calendarModel.gregorianToHijri(displayedDate);
final hijriCurrent = calendarModel.gregorianToHijri(DateTime.now());
displayedYear = hijriDisplayed.year;
currentDisplayYear = hijriCurrent.year;
@ -818,7 +870,7 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
final currentHijriMonth = _currentHijriDisplay?.month ?? calendarModel.gregorianToHijri(displayedDate).month;
final hijriDate = HijriGregDate(day: 1, month: currentHijriMonth, year: year);
final gregorianDate = calendarModel.hijriToGregorian(hijriDate);
_calendarController.displayDate = DateTime(gregorianDate.year, gregorianDate.month, 1);
_calendarController.displayDate = gregorianDate;
// Track the Hijri month/year for accurate header display
_currentHijriDisplay = hijriDate;
} catch (e) {
@ -876,34 +928,34 @@ class _DateRangeSelectorState extends State<DateRangeSelector> {
}
displayDate(String label, String? date, bool isNotSelected) => Expanded(
child: Row(
spacing: 12.h,
child: Row(
spacing: 12.h,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.rangeCalendar, iconColor: isNotSelected ? AppColors.borderOnlyColor : AppColors.blackColor, height: 24, width: 24),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.rangeCalendar, iconColor: isNotSelected ? AppColors.borderOnlyColor : AppColors.blackColor, height: 24, width: 24),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(
color: AppColors.inputLabelTextColor,
fontSize: 12.f,
fontWeight: FontWeight.w600,
),
),
Text(
date!,
style: TextStyle(
color: AppColors.textColor,
fontSize: 14.f,
fontWeight: FontWeight.w600,
),
)
],
Text(
label,
style: TextStyle(
color: AppColors.inputLabelTextColor,
fontSize: 12.f,
fontWeight: FontWeight.w600,
),
),
Text(
date!,
style: TextStyle(
color: AppColors.textColor,
fontSize: 14.f,
fontWeight: FontWeight.w600,
),
)
],
),
);
)
],
),
);
selectionChip(DateRangeSelectorRangeViewModel model) {
return Row(

@ -122,12 +122,12 @@ class HijriGregConverter {
static int _hijriYearStartJulian(int hijriYear) {
if (hijriYear <= 1) return _hijriEpoch;
int totalDays = 0;
for (int year = 1; year < hijriYear; year++) {
totalDays += _hijriYearLength(year);
}
return _hijriEpoch + totalDays;
// A Hijri year has 354 days, with 11 leap days in every 30-year
// cycle. Calculate the completed years directly instead of iterating
// from year 1 for every calendar cell.
final completedYears = hijriYear - 1;
final completedLeapDays = (3 + (11 * hijriYear)) ~/ 30;
return _hijriEpoch + (completedYears * 354) + completedLeapDays;
}
static int _hijriYearLength(int year) {
@ -358,6 +358,8 @@ class DateRangCalenderModel extends ChangeNotifier {
}
void setTabIndex(int index) {
if (_selectedTabIndex == index) return;
_selectedTabIndex = index;
_calendarType = index == 0 ? CalendarType.gregorian : CalendarType.hijri;
// Persist the selection for next time the widget opens

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -9,7 +11,6 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'dart:ui' as ui;
class CustomCountryDropdown extends StatefulWidget {
final List<CountryEnum> countryList;
@ -35,7 +36,9 @@ class CustomCountryDropdown extends StatefulWidget {
class CustomCountryDropdownState extends State<CustomCountryDropdown> {
CountryEnum? selectedCountry;
late OverlayEntry _overlayEntry;
OverlayEntry? _overlayEntry;
Timer? _showDropdownTimer;
Timer? _refocusTimer;
bool _isDropdownOpen = false;
FocusNode textFocusNode = FocusNode();
@ -55,6 +58,9 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
@override
void dispose() {
_showDropdownTimer?.cancel();
_refocusTimer?.cancel();
_removeOverlayEntry();
textFocusNode.dispose();
super.dispose();
}
@ -74,9 +80,18 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
},
child: Row(
children: [
Utils.buildSvgWithAssets(icon: selectedCountry != null ? selectedCountry!.iconPath : AppAssets.ksa, width: 40.h, height: 40.h, applyThemeColor: false),
Utils.buildSvgWithAssets(
icon: selectedCountry != null
? selectedCountry!.iconPath
: AppAssets.ksa,
width: 40.h,
height: 40.h,
applyThemeColor: false),
SizedBox(width: 8.h),
Utils.buildSvgWithAssets(icon: _isDropdownOpen ? AppAssets.dropdow_icon : AppAssets.dropdow_icon),
Utils.buildSvgWithAssets(
icon: _isDropdownOpen
? AppAssets.dropdow_icon
: AppAssets.dropdow_icon),
],
),
),
@ -94,7 +109,11 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
children: [
Text(
LocaleKeys.phoneNumber.tr(),
style: TextStyle(fontSize: 12.f, height: 1.5, fontWeight: FontWeight.w600, letterSpacing: -1),
style: TextStyle(
fontSize: 12.f,
height: 1.5,
fontWeight: FontWeight.w600,
letterSpacing: -1),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
@ -102,9 +121,15 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
if (selectedCountry != CountryEnum.others)
Text(
selectedCountry!.countryCode,
style: TextStyle(fontSize: 12.f, fontWeight: FontWeight.w600, letterSpacing: -0.4, height: 1.5, fontFamily: "Poppins"),
style: TextStyle(
fontSize: 12.f,
fontWeight: FontWeight.w600,
letterSpacing: -0.4,
height: 1.5,
fontFamily: "Poppins"),
),
if (selectedCountry != CountryEnum.others) SizedBox(width: 4.h),
if (selectedCountry != CountryEnum.others)
SizedBox(width: 4.h),
if (widget.isEnableTextField)
SizedBox(
height: 20.h,
@ -113,14 +138,19 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
alignment: Alignment.centerLeft,
child: TextField(
focusNode: textFocusNode,
style: TextStyle(fontSize: 12.f, fontWeight: FontWeight.w600, letterSpacing: -0.4, height: 1.5, fontFamily: "Poppins"),
style: TextStyle(
fontSize: 12.f,
fontWeight: FontWeight.w600,
letterSpacing: -0.4,
height: 1.5,
fontFamily: "Poppins"),
decoration: InputDecoration(
hintText: selectedCountry == CountryEnum.others ? "001*******" : "",
hintText: selectedCountry == CountryEnum.others
? "001*******"
: "",
isDense: true,
border: InputBorder.none,
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.phone,
onChanged: widget.onPhoneNumberChanged,
@ -136,21 +166,31 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
Text(
selectedCountry != null
? appState.getLanguageCode() == "ar"
? selectedCountry!.nameArabic
: selectedCountry!.displayName
? selectedCountry!.nameArabic
: selectedCountry!.displayName
: LocaleKeys.selectCountry.tr(),
style: TextStyle(fontSize: 14.f, height: 21 / 14, fontWeight: FontWeight.w600, letterSpacing: -0.2),
style: TextStyle(
fontSize: 14.f,
height: 21 / 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.2),
),
],
);
}
void _openDropdown() {
if (!mounted || _isDropdownOpen || _overlayEntry != null) return;
_showDropdownTimer?.cancel();
if (textFocusNode.hasFocus) {
textFocusNode.unfocus();
// Wait for keyboard to close before calculating position
Future.delayed(Duration(milliseconds: 300), () {
_showDropdown();
_showDropdownTimer = Timer(const Duration(milliseconds: 300), () {
_showDropdownTimer = null;
if (mounted) {
_showDropdown();
}
});
} else {
_showDropdown();
@ -158,8 +198,18 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
}
void _showDropdown() {
if (!mounted || _isDropdownOpen || _overlayEntry != null) return;
AppState appState = getIt.get<AppState>();
RenderBox renderBox = context.findRenderObject() as RenderBox;
final renderObject = context.findRenderObject();
final overlay = Overlay.maybeOf(context);
if (renderObject is! RenderBox ||
!renderObject.attached ||
overlay == null) {
return;
}
final renderBox = renderObject;
Offset offset = renderBox.localToGlobal(Offset.zero);
bool isRtl = appState.getLanguageCode() == "ar";
double leftPosition;
@ -169,7 +219,7 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
leftPosition = offset.dx;
}
_overlayEntry = OverlayEntry(
final overlayEntry = OverlayEntry(
builder: (context) => Stack(
children: [
Positioned.fill(
@ -185,32 +235,41 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
width: !widget.isFromBottomSheet ? renderBox.size.width : 60.h,
child: Material(
child: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.white, borderRadius: 12),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: Colors.white, borderRadius: 12),
child: Column(
children: widget.countryList
.map(
(country) => GestureDetector(
onTap: () {
setState(() {
selectedCountry = country;
});
widget.onCountryChange?.call(country);
_closeDropdown();
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(borderRadius: 16.h),
child: Row(
children: [
Utils.buildSvgWithAssets(icon: country.iconPath, width: 38.h, height: 38.h, applyThemeColor: false),
if (!widget.isFromBottomSheet) SizedBox(width: 12.h),
if (!widget.isFromBottomSheet)
Text(appState.getLanguageCode() == "ar" ? country.nameArabic : country.displayName,
style: TextStyle(fontSize: 14.f, height: 21 / 14, fontWeight: FontWeight.w600, letterSpacing: -0.2)),
],
),
)),
)
onTap: () => _selectCountry(country),
child: Container(
padding: EdgeInsets.symmetric(
vertical: 8.h, horizontal: 8.h),
decoration: RoundedRectangleBorder()
.toSmoothCornerDecoration(borderRadius: 16.h),
child: Row(
children: [
Utils.buildSvgWithAssets(
icon: country.iconPath,
width: 38.h,
height: 38.h,
applyThemeColor: false),
if (!widget.isFromBottomSheet)
SizedBox(width: 12.h),
if (!widget.isFromBottomSheet)
Text(
appState.getLanguageCode() == "ar"
? country.nameArabic
: country.displayName,
style: TextStyle(
fontSize: 14.f,
height: 21 / 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.2)),
],
),
)),
)
.toList(),
),
),
@ -220,7 +279,8 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
),
);
Overlay.of(context)?.insert(_overlayEntry);
overlay.insert(overlayEntry);
_overlayEntry = overlayEntry;
setState(() {
_isDropdownOpen = true;
});
@ -291,18 +351,61 @@ class CustomCountryDropdownState extends State<CustomCountryDropdown> {
// });
// }
void _closeDropdown() {
_overlayEntry.remove();
void _selectCountry(CountryEnum country) {
if (!mounted) {
_removeOverlayEntry();
return;
}
_removeOverlayEntry();
setState(() {
selectedCountry = country;
_isDropdownOpen = false;
});
// Notify the parent only after this widget has finished updating and
// removing its overlay. The callback may synchronously close the parent.
widget.onCountryChange?.call(country);
_scheduleTextFieldRefocus();
}
void _closeDropdown() {
_showDropdownTimer?.cancel();
_showDropdownTimer = null;
_removeOverlayEntry();
if (!mounted) {
_isDropdownOpen = false;
return;
}
if (_isDropdownOpen) {
setState(() {
_isDropdownOpen = false;
});
}
_scheduleTextFieldRefocus();
}
void _removeOverlayEntry() {
final overlayEntry = _overlayEntry;
_overlayEntry = null;
if (overlayEntry == null) return;
overlayEntry.remove();
overlayEntry.dispose();
}
void _scheduleTextFieldRefocus() {
_refocusTimer?.cancel();
if (widget.isEnableTextField && widget.isFromBottomSheet) {
Future.delayed(Duration(milliseconds: 100), () {
_refocusTimer = Timer(const Duration(milliseconds: 100), () {
_refocusTimer = null;
if (mounted && textFocusNode.canRequestFocus) {
FocusScope.of(context).requestFocus(textFocusNode);
}
});
}
}
}
}

@ -11,6 +11,7 @@ import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
enum _PAYMENT_TYPE { PACKAGES, PHARMACY, PATIENT }
@ -217,6 +218,8 @@ class MyInAppBrowser extends InAppBrowser {
tamaraRequestModel.appointmentDate = (appoDate != null && appoDate != "") ? appoDate : null;
tamaraRequestModel.isSchedule = ((appoNo != null && appoNo != "") && (appoDate != null && appoDate != "")) ? true : false;
getIt.get<PayfortViewModel>().tamaraRequestInsert(tamaraRequestModel: tamaraRequestModel);
// service.tamaraInsertRequest(tamaraRequestModel, context).then((res) {
// // if (context != null) GifLoaderDialogUtils.hideDialog(context);
generateTamaraURL(amount, orderDesc, transactionID, projId, emailId, paymentMethod, patientType, patientName, patientID, authenticatedUser, isLiveCareAppo, servID, LiveServID, appoDate, appoNo,

@ -198,7 +198,8 @@ class TextInputWidget extends StatelessWidget {
],
),
),
(suffix != null) ? suffix! : SizedBox.shrink()
// (suffix != null) ? suffix : SizedBox.shrink()
suffix ?? SizedBox.shrink()
],
),
),

@ -117,10 +117,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.4.1"
chewie:
dependency: transitive
description:
@ -145,6 +145,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.2"
cloudflare_turnstile:
dependency: "direct main"
description:
name: cloudflare_turnstile
sha256: b3f2b7606a9d6eabfa38112ee4ae4272c4c75f16ed8e52d99fd01822e3ea0478
url: "https://pub.dev"
source: hosted
version: "3.8.1"
collection:
dependency: transitive
description:
@ -499,6 +507,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_amazonpaymentservices:
dependency: "direct main"
description:
name: flutter_amazonpaymentservices
sha256: "23f45fd3b1e12a0933da3704d66cebd19c4c41e28a50d4fd458d3e3e6311f332"
url: "https://pub.dev"
source: hosted
version: "0.0.13"
flutter_cache_manager:
dependency: transitive
description:
@ -700,10 +716,10 @@ packages:
dependency: "direct main"
description:
name: flutter_paytabs_bridge
sha256: fc48e68848147a8edf41b27f9068b988c4fb28ff9778bf20560a90be0b4dddfb
sha256: d65396883c661ea945a526c21b2fe859299f25fcd951fe3a733ff224e6ec984c
url: "https://pub.dev"
source: hosted
version: "2.7.13"
version: "2.7.14"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
@ -720,6 +736,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.1"
flutter_screenshot_blocker:
dependency: "direct main"
description:
name: flutter_screenshot_blocker
sha256: "20e36b4aaca20259008dbb1403b77af6207d48cd8382a772b9c27619bc116849"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
flutter_staggered_animations:
dependency: "direct main"
description:
@ -1341,26 +1365,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev"
source: hosted
version: "0.12.17"
version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.13.0"
meta:
dependency: transitive
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.18.0"
mime:
dependency: transitive
description:
@ -1641,6 +1665,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
screen_brightness:
dependency: "direct main"
description:
name: screen_brightness
sha256: "7d4ac84ae26b37c01d6f5db7123a72db7933e1f2a2a8c369a51e08f81b3178d8"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_android:
dependency: transitive
description:
name: screen_brightness_android
sha256: "8c69d3ac475e4d625e7fa682a3a51a69ff59abe5b4a9e57f6ec7d830a6c69bd6"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_ios:
dependency: transitive
description:
name: screen_brightness_ios
sha256: f08f70ca1ac3e30719764b5cfb8b3fe1e28163065018a41b3e6f243ab146c2f1
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_macos:
dependency: transitive
description:
name: screen_brightness_macos
sha256: "70c2efa4534e22b927e82693488f127dd4a0f008469fccf4f0eefe9061bbdd6a"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_platform_interface:
dependency: transitive
description:
name: screen_brightness_platform_interface
sha256: "9f3ebf7f22d5487e7676fe9ddaf3fc55b6ff8057707cf6dc0121c7dfda346a16"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
screen_brightness_windows:
dependency: transitive
description:
name: screen_brightness_windows
sha256: c8e12a91cf6dd912a48bd41fcf749282a51afa17f536c3460d8d05702fb89ffa
url: "https://pub.dev"
source: hosted
version: "1.0.1"
scrollable_positioned_list:
dependency: "direct main"
description:
@ -1890,10 +1962,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
url: "https://pub.dev"
source: hosted
version: "0.7.7"
version: "0.7.11"
time:
dependency: transitive
description:
@ -2175,5 +2247,5 @@ packages:
source: hosted
version: "1.2.0"
sdks:
dart: ">=3.9.0 <4.0.0"
dart: ">=3.10.0-0 <4.0.0"
flutter: ">=3.35.0"

@ -111,6 +111,8 @@ dependencies:
screen_brightness: ^1.0.1
flutter_screenshot_blocker: ^1.0.4
cloudflare_turnstile: ^3.7.2
freerasp: ^8.2.1
safe_device: ^1.4.1
dev_dependencies:
flutter_test:

Loading…
Cancel
Save