diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index c70123d4..13f778ff 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -36,7 +36,7 @@ android {
applicationId = "com.cloudsolutions.HMGPatientApp"
// minSdk = 24
minSdk = 29
- targetSdk = 35
+ targetSdk = 36
compileSdk = 36
// targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..360ab55d
--- /dev/null
+++ b/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,26 @@
+
+ #ffffff
+ #ED1C2B
+ #444647
+ #2E3039
+ #2E3039
+ #a5a5a5
+ #e1e1e1
+ #FFF
+ #1e1e1e
+ #ED1C2B
+ #F9FAFD
+ #F2FAFD
+ #EC2213
+ #4D6E6E6E
+ #FFFFFFFF
+ #00000000
+ #3db39e
+ #00000000
+ #c7c7c7
+ #4c4c4c
+ #4c4c4c
+ #a5a5a5
+ #ED1C2B
+ #FFF
+
\ No newline at end of file
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index ac3b4792..2299155e 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -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
diff --git a/assets/images/svg/no_image_found.svg b/assets/images/svg/no_image_found.svg
new file mode 100644
index 00000000..faea08cd
--- /dev/null
+++ b/assets/images/svg/no_image_found.svg
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/assets/images/svg/patient_qr_code_icon.svg b/assets/images/svg/patient_qr_code_icon.svg
new file mode 100644
index 00000000..c76f0326
--- /dev/null
+++ b/assets/images/svg/patient_qr_code_icon.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/images/svg/vital_sign_item_icon.svg b/assets/images/svg/vital_sign_item_icon.svg
new file mode 100644
index 00000000..3ebe220a
--- /dev/null
+++ b/assets/images/svg/vital_sign_item_icon.svg
@@ -0,0 +1,7 @@
+
diff --git a/assets/json/default_occasion_config.json b/assets/json/default_occasion_config.json
new file mode 100644
index 00000000..6b38a4cb
--- /dev/null
+++ b/assets/json/default_occasion_config.json
@@ -0,0 +1,12 @@
+{
+ "key": "none",
+ "enabled": false,
+ "start_date": null,
+ "end_date": null,
+ "primary_color": null,
+ "secondary_color": null,
+ "background_opacity_image": null,
+ "background_image_opacity": 0.2,
+ "header_image": null
+}
+
diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json
index ed554e97..911856ab 100644
--- a/assets/langs/ar-SA.json
+++ b/assets/langs/ar-SA.json
@@ -123,7 +123,7 @@
"forgotFileNoTitle": "نسيت الملف الطبي",
"enterNationalId": "يرجى إدخال رقم الهاتف المحمول ورقم الهوية",
"profileInfo": "يرجى إدخال معلومات الملف الشخصي",
- "submit": "بحث",
+ "submit": "تأكيد",
"forgotDesc": "أدخل رقم الهاتف المحمول لاستلام رقم الملف الطبي عبر الرسائل القصيرة",
"dob": "تاريخ الميلاد",
"hijriDate": "التاريخ الهجري",
@@ -1390,7 +1390,6 @@
"medicalFiles": "الملفات الطبية",
"addANewFamilyMember": "اضافة",
"viewInvoiceDetails": "عرض تفاصيل الفاتورة",
- "outPatient": "مريض خارجي",
"invoiceDetails": "تفاصيل الفاتورة",
"sendingEmailPleaseWait": "جاري إرسال ال��ريد الإلكتروني، يرجى الانتظار...",
"emailSentSuccessfullyMessage": "تم إرسال البريد الإلكتروني بنجاح.",
@@ -1946,7 +1945,7 @@
"transactions": "المعاملات",
"pharmacy": "الصيدلية",
"visitsOrders": "الزيارات/الطلبات",
- "earned": "حصل",
+ "earned": "مكتسب",
"getParkingQR": "الحصول على رمز الاستجابة السريعة لوقوف السيارات",
"cannotOpenThisFile": "لا يمكن فتح هذا الملف",
"refundDetails": "تفاصيل الاسترداد",
@@ -1960,12 +1959,96 @@
"refund": "استرداد",
"parkingQR": "رمز الاستجابة السريعة لوقوف السيارات",
"parkingQRDesc": "امسح رمز الاستجابة السريعة (QR Code) أدناه عند بوابة الخروج من موقف السيارات:",
- "livecareUpdateInsuranceSent": "تم استلام طلب تحديث بيانات التأمين الخاص بك، ويجري العمل عليه حالياً. سنقوم بإشعارك فور اكتمال التحديث.",
- "livecareUpdateInsurance": "سيتم تحويل طلب تحديث بيانات التأمين إلى فريق LiveCare المختص لاستكمال الإجراءات. هل تود المتابعة؟",
- "schedule": "جدول",
- "doctorSchedule": "جدول الطبيب",
- "weeklyShift": "الفترات الأسبوعية",
- "dayOff": "إجازة",
- "notAvailable": "غير متاح",
- "hide": "إخفاء"
+ "livecareUpdateInsuranceSent": "تم استلام طلب تحديث بيانات التأمين الخاص بك، ويجري العمل عليه حالياً. سنقوم بإشعارك فور اكتمال التحديث.",
+ "livecareUpdateInsurance": "سيتم تحويل طلب تحديث بيانات التأمين إلى فريق LiveCare المختص لاستكمال الإجراءات. هل تود المتابعة؟",
+ "schedule": "جدول",
+ "doctorSchedule": "جدول الطبيب",
+ "weeklyShift": "الفترات الأسبوعية",
+ "dayOff": "إجازة",
+ "notAvailable": "غير متاح",
+ "hide": "إخفاء",
+ "viewPatientQR": "عرض رمز الاستجابة السريعة للمريض",
+ "patientQR": "رمز الاستجابة السريعة للمريض",
+ "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"
}
diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json
index ae344b01..aaafb124 100644
--- a/assets/langs/en-US.json
+++ b/assets/langs/en-US.json
@@ -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",
@@ -1949,14 +1949,98 @@
"invoiceHistory": "Invoice History",
"parkingQR": "Parking QR Code",
"parkingQRDesc": "Scan the below QR Code at the exit parking gate:",
- "livecareUpdateInsuranceSent": "Your insurance update request is being processed. You will be notified once the update is completed.",
- "livecareUpdateInsurance": "Please note that your insurance update request will be sent to the our LiveCare team for update. Would you like to proceed?",
- "schedule": "Schedule",
- "doctorSchedule": "Doctor Schedule",
- "weeklyShift": "Weekly Shift",
- "dayOff": "Off",
- "notAvailable": "Not Available",
- "hide": "Hide"
+ "livecareUpdateInsuranceSent": "Your insurance update request is being processed. You will be notified once the update is completed.",
+ "livecareUpdateInsurance": "Please note that your insurance update request will be sent to the our LiveCare team for update. Would you like to proceed?",
+ "schedule": "Schedule",
+ "doctorSchedule": "Doctor Schedule",
+ "weeklyShift": "Weekly Shift",
+ "dayOff": "Off",
+ "notAvailable": "Not Available",
+ "hide": "Hide",
+ "viewPatientQR": "View Patient QR Code",
+ "patientQR": "Patient QR Code",
+ "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"
}
diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist
index 1dc6cf76..391a902b 100644
--- a/ios/Flutter/AppFrameworkInfo.plist
+++ b/ios/Flutter/AppFrameworkInfo.plist
@@ -20,7 +20,5 @@
????CFBundleVersion1.0
- MinimumOSVersion
- 13.0
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index fdc3bdfa..dac5fbe9 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -8,8 +8,8 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
- 1587365701FF0D2AAAFED0D8 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A83C76CFF9D3F92EDE3B22B4 /* Pods_Runner.framework */; };
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 */; };
@@ -29,6 +29,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -90,6 +91,7 @@
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
A83C76CFF9D3F92EDE3B22B4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -97,10 +99,11 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
76B1D2512F91BF8000DBBD1B /* Penguin.xcframework in Frameworks */,
76B1D2552F91BF8000DBBD1B /* PenNavUI.xcframework in Frameworks */,
76B1D2532F91BF8000DBBD1B /* PenguinINRenderer.xcframework in Frameworks */,
- DE1EF78253E64BE86845D2CC /* Pods_Runner.framework in Frameworks */,
+ 37D27FAF2C38AC83B852680C /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -159,6 +162,7 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@@ -230,6 +234,9 @@
productType = "com.apple.product-type.bundle.unit-test";
};
97C146ED1CF9000F007C117D /* Runner */ = {
+ packageProductDependencies = (
+ 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
+ );
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
@@ -256,6 +263,9 @@
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
+ packageReferences = (
+ 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
+ );
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
@@ -519,7 +529,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3A359E86ZF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -529,7 +539,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 0.0.5;
+ MARKETING_VERSION = 0.0.12;
PRODUCT_BUNDLE_IDENTIFIER = com.cloudsolutions.HMGPatientApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -706,7 +716,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3A359E86ZF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -716,7 +726,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 0.0.5;
+ MARKETING_VERSION = 0.0.12;
PRODUCT_BUNDLE_IDENTIFIER = com.cloudsolutions.HMGPatientApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -736,7 +746,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3A359E86ZF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -746,7 +756,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 0.0.5;
+ MARKETING_VERSION = 0.0.12;
PRODUCT_BUNDLE_IDENTIFIER = com.cloudsolutions.HMGPatientApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -790,6 +800,18 @@
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
+/* Begin XCLocalSwiftPackageReference section */
+ 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
+ isa = XCLocalSwiftPackageReference;
+ relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
+ };
+/* End XCLocalSwiftPackageReference section */
+/* Begin XCSwiftPackageProductDependency section */
+ 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
+ isa = XCSwiftPackageProductDependency;
+ productName = FlutterGeneratedPluginSwiftPackage;
+ };
+/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index e3773d42..c3fedb29 100644
--- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -5,6 +5,24 @@
+
+
+
+
+
+
+
+
+
+ NSMicrophoneUsageDescription
This app requires microphone access to enable virtual consultation between patient & doctorNSMotionUsageDescription
- This app requires motion detection access to function properly.
+ This app requires access to motion detection to count your daily steps.NSPhotoLibraryUsageDescriptionThis app requires photo library access to select image as document & upload it.NSPhotoLibraryAddUsageDescription
diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart
index 3bfbf6cb..00eebb34 100644
--- a/lib/core/api/api_client.dart
+++ b/lib/core/api/api_client.dart
@@ -138,8 +138,7 @@ class ApiClientImp implements ApiClient {
} else {}
if (body.containsKey('isDentalAllowedBackend')) {
- body['isDentalAllowedBackend'] =
- body.containsKey('isDentalAllowedBackend') ? body['isDentalAllowedBackend'] ?? IS_DENTAL_ALLOWED_BACKEND : IS_DENTAL_ALLOWED_BACKEND;
+ body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') ? body['isDentalAllowedBackend'] ?? IS_DENTAL_ALLOWED_BACKEND : IS_DENTAL_ALLOWED_BACKEND;
}
if (!body.containsKey('IsPublicRequest')) {
@@ -210,8 +209,8 @@ class ApiClientImp implements ApiClient {
body['TokenID'] = "@dm!n";
}
- // body['TokenID'] = "@dm!n";
- // body['PatientID'] = 2122445;
+ body['TokenID'] = "@dm!n";
+ // body['PatientID'] = 7000792;
// body['PatientID'] = 53320;
// body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0;
@@ -271,11 +270,11 @@ class ApiClientImp implements ApiClient {
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'POST');
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_socket_exception');
return;
@@ -283,19 +282,19 @@ class ApiClientImp implements ApiClient {
final message = e.message.contains('Connection reset by peer') ? LocaleKeys.networkConnectionReset.tr() : LocaleKeys.networkErrorMessage.tr();
onFailure(message, -1, failureType: ConnectivityFailure(message));
_analytics.errorTracking.log(endPoint, error: "ClientException: $e");
-
+
// Enhanced Clarity logging
Clarity.setCustomTag('api_err_type', 'client_exception');
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'POST');
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_client_exception');
-
+
return;
} on TimeoutException catch (_) {
final message = LocaleKeys.networkTimeout.tr();
@@ -307,36 +306,36 @@ class ApiClientImp implements ApiClient {
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'POST');
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_timeout');
-
+
return;
} catch (e) {
final message = LocaleKeys.networkUnknownError.tr();
onFailure(message, -1, failureType: ConnectivityFailure(message));
_analytics.errorTracking.log(endPoint, error: "UnknownException: $e");
-
+
// Enhanced Clarity logging for unknown errors
Clarity.setCustomTag('api_err_type', 'unknown_exception');
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'POST');
-
+
// Truncate exception message for Clarity
final exceptionMsg = e.toString();
final truncatedMsg = exceptionMsg.length > 252 ? '...${exceptionMsg.substring(exceptionMsg.length - 252)}' : exceptionMsg;
Clarity.setCustomTag('api_err_exception', truncatedMsg);
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_unknown_exception');
-
+
return;
}
@@ -384,24 +383,19 @@ class ApiClientImp implements ApiClient {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode,
- failureType:
- UnAuthenticatedUserFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'] ?? "User is not Authenticated", url: url),
+ failureType: UnAuthenticatedUserFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'] ?? "User is not Authenticated", url: url),
);
// logApiEndpointError(endPoint, "session logged out", statusCode);
}
if (isAllowAny) {
- onSuccess(parsed, statusCode,
- messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
+ onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
} else if (parsed['IsAuthenticated'] == null) {
if (parsed['isSMSSent'] == true) {
- onSuccess(parsed, statusCode,
- messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
+ onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
} else if (parsed['MessageStatus'] == 1) {
- onSuccess(parsed, statusCode,
- messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
+ onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
} else if (parsed['Result'] == 'OK') {
- onSuccess(parsed, statusCode,
- messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
+ onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
} else {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
@@ -411,8 +405,7 @@ class ApiClientImp implements ApiClient {
logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
}
} else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) {
- onSuccess(parsed, statusCode,
- messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
+ onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
}
// else if (parsed['IsAuthenticated'] == false) {
// onFailure(
@@ -424,8 +417,7 @@ class ApiClientImp implements ApiClient {
// }
else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) {
if (parsed['SameClinicApptList'] != null) {
- onSuccess(parsed, statusCode,
- messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
+ onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
} else {
if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) {
if (parsed['ErrorSearchMsg'] == null) {
@@ -459,8 +451,7 @@ class ApiClientImp implements ApiClient {
}
} else {
if (parsed['SameClinicApptList'] != null) {
- onSuccess(parsed, statusCode,
- messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
+ onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
} else {
if (parsed['message'] != null) {
onFailure(
@@ -537,74 +528,74 @@ class ApiClientImp implements ApiClient {
final message = e.message.contains('Connection reset by peer') ? LocaleKeys.networkConnectionReset.tr() : LocaleKeys.networkErrorMessage.tr();
onFailure(message, -1);
_analytics.errorTracking.log(endPoint, error: "SocketException: $e");
-
+
// Clarity logging for GET requests
Clarity.setCustomTag('api_err_type', 'socket_exception');
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'GET');
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_get_socket_exception');
-
+
return;
} on http.ClientException catch (e) {
final message = e.message.contains('Connection reset by peer') ? LocaleKeys.networkConnectionReset.tr() : LocaleKeys.networkErrorMessage.tr();
onFailure(message, -1);
_analytics.errorTracking.log(endPoint, error: "ClientException: $e");
-
+
Clarity.setCustomTag('api_err_type', 'client_exception');
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'GET');
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_get_client_exception');
-
+
return;
} on TimeoutException catch (_) {
final message = LocaleKeys.networkTimeout.tr();
onFailure(message, -1);
_analytics.errorTracking.log(endPoint, error: "TimeoutException");
-
+
Clarity.setCustomTag('api_err_type', 'timeout');
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'GET');
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_get_timeout');
-
+
return;
} catch (e) {
final message = LocaleKeys.networkUnknownError.tr();
onFailure(message, -1);
_analytics.errorTracking.log(endPoint, error: "UnknownException: $e");
-
+
Clarity.setCustomTag('api_err_type', 'unknown_exception');
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'GET');
-
+
final exceptionMsg = e.toString();
final truncatedMsg = exceptionMsg.length > 252 ? '...${exceptionMsg.substring(exceptionMsg.length - 252)}' : exceptionMsg;
Clarity.setCustomTag('api_err_exception', truncatedMsg);
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_get_unknown_exception');
-
+
return;
}
@@ -614,18 +605,18 @@ class ApiClientImp implements ApiClient {
if (statusCode < 200 || statusCode >= 400) {
onFailure(LocaleKeys.networkErrorWhileFetching.tr(), statusCode);
logApiEndpointError(endPoint, LocaleKeys.networkErrorWhileFetching.tr(), statusCode);
-
+
// Clarity logging for GET status code errors
Clarity.setCustomTag('api_err_type', 'status_code_error');
Clarity.setCustomTag('api_err_url', _getEndofUrl(url.trim()));
Clarity.setCustomTag('api_err_endpoint', _getEndpointName(endPoint));
Clarity.setCustomTag('api_err_method', 'GET');
Clarity.setCustomTag('api_err_status', statusCode.toString());
-
+
if (_appState.isAuthenticated) {
Clarity.setCustomTag('api_err_user_id', _appState.getAuthenticatedUser()!.patientId.toString());
}
-
+
Clarity.sendCustomEvent('api_get_status_error');
} else {
var parsed = json.decode(utf8.decode(response.bodyBytes));
@@ -813,7 +804,7 @@ class ApiClientImp implements ApiClient {
// Extract the last part of the endpoint path for cleaner tracking
const int clarityLimit = 100;
final cleanEndpoint = endpoint.split('/').last;
-
+
if (cleanEndpoint.length <= clarityLimit) return cleanEndpoint;
return '...${cleanEndpoint.substring(cleanEndpoint.length - (clarityLimit - 3))}';
}
diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart
index 8c5de0c4..d5053e3b 100644
--- a/lib/core/api_consts.dart
+++ b/lib/core/api_consts.dart
@@ -1,11 +1,12 @@
import 'package:amazon_payfort/amazon_payfort.dart';
import 'package:flutter_amazonpaymentservices/environment_type.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
+import 'package:myfatoorah_flutter/myfatoorah_flutter.dart';
class ApiConsts {
static const maxSmallScreen = 660;
- static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
+ static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT
@@ -44,12 +45,17 @@ class ApiConsts {
// var payFortEnvironment = FortEnvironment.test;
// var applePayMerchantId = "merchant.com.hmgwebservices.uat";
+ static var myFatoorahEnvironmentType = MFEnvironment.TEST;
+ static var myFatoorahCountry = MFCountry.SAUDIARABIA;
+
static setBackendURLs() {
switch (appEnvironmentType) {
case AppEnvironmentTypeEnum.prod:
baseUrl = "https://hmgwebservices.com/";
payFortEnvironment = FortEnvironment.production;
payFortEnvironmentType = EnvironmentType.production;
+ myFatoorahEnvironmentType = MFEnvironment.LIVE;
+ myFatoorahCountry = MFCountry.SAUDIARABIA;
applePayMerchantId = "merchant.com.hmgwebservices";
SERVICE_URL = "https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx";
TAMARA_URL = "https://mdlaboratories.com/tamaralive/Home/Checkout";
@@ -66,6 +72,8 @@ class ApiConsts {
baseUrl = "https://uat.hmgwebservices.com/";
payFortEnvironment = FortEnvironment.test;
payFortEnvironmentType = EnvironmentType.sandbox;
+ myFatoorahEnvironmentType = MFEnvironment.TEST;
+ myFatoorahCountry = MFCountry.KUWAIT;
applePayMerchantId = "merchant.com.hmgwebservices.uat";
SERVICE_URL = 'https://uat.hmgwebservices.com/HMGPayment/pages/SendPayFortRequest.aspx';
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
@@ -77,12 +85,13 @@ class ApiConsts {
symptomsCheckerApi = symptomsCheckerApiUAT;
symptomsCheckerUsername = 'guest_user';
symptomsCheckerPassword = '123456';
-
break;
case AppEnvironmentTypeEnum.uat:
baseUrl = "https://uat.hmgwebservices.com/";
payFortEnvironment = FortEnvironment.test;
payFortEnvironmentType = EnvironmentType.sandbox;
+ myFatoorahEnvironmentType = MFEnvironment.TEST;
+ myFatoorahCountry = MFCountry.KUWAIT;
applePayMerchantId = "merchant.com.hmgwebservices.uat";
SERVICE_URL = 'https://uat.hmgwebservices.com/HMGPayment/pages/SendPayFortRequest.aspx';
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
@@ -100,6 +109,8 @@ class ApiConsts {
baseUrl = "https://webservices.hmg.com/";
payFortEnvironment = FortEnvironment.production;
payFortEnvironmentType = EnvironmentType.production;
+ myFatoorahEnvironmentType = MFEnvironment.LIVE;
+ myFatoorahCountry = MFCountry.SAUDIARABIA;
applePayMerchantId = "merchant.com.hmgwebservices";
SERVICE_URL = "https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx";
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
@@ -117,6 +128,8 @@ class ApiConsts {
baseUrl = "https://uat.hmgwebservices.com/";
payFortEnvironment = FortEnvironment.test;
payFortEnvironmentType = EnvironmentType.sandbox;
+ myFatoorahEnvironmentType = MFEnvironment.TEST;
+ myFatoorahCountry = MFCountry.KUWAIT;
applePayMerchantId = "merchant.com.hmgwebservices.uat";
SERVICE_URL = 'https://uat.hmgwebservices.com/HMGPayment/pages/SendPayFortRequest.aspx';
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
@@ -134,6 +147,8 @@ class ApiConsts {
baseUrl = "https://uat.hmgwebservices.com/";
payFortEnvironment = FortEnvironment.test;
payFortEnvironmentType = EnvironmentType.sandbox;
+ myFatoorahEnvironmentType = MFEnvironment.TEST;
+ myFatoorahCountry = MFCountry.KUWAIT;
applePayMerchantId = "merchant.com.hmgwebservices.uat";
SERVICE_URL = 'https://uat.hmgwebservices.com/HMGPayment/pages/SendPayFortRequest.aspx';
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
@@ -301,7 +316,7 @@ class ApiConsts {
static String googleCloudStorageENTranslationFileBaseURL = "https://storage.googleapis.com/hmg-patientapp-translations";
// ************ static values for Api ****************
- static final double appVersionID = 21.6;
+ static final double appVersionID = 22.1;
// static final double appVersionID = 50.7;
static final int appChannelId = 3;
@@ -870,8 +885,7 @@ var GET_CUSTOMER_INFO = "VerifyCustomer";
//Pharmacy
-var GET_PHARMACY_CATEGORISE =
- 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
+var GET_PHARMACY_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
var GET_OFFERS_CATEGORISE = 'discountcategories';
var GET_OFFERS_PRODUCTS = 'offerproducts/';
var GET_CATEGORISE_PARENT = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
@@ -917,8 +931,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';
diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart
index aba22eb3..bd850985 100644
--- a/lib/core/app_assets.dart
+++ b/lib/core/app_assets.dart
@@ -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';
@@ -399,6 +400,8 @@ class AppAssets {
static const String habibLogoOnly = '$svgBasePath/habib logo_only.svg';
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';
diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart
index a27b727e..78432b23 100644
--- a/lib/core/app_state.dart
+++ b/lib/core/app_state.dart
@@ -48,12 +48,19 @@ class AppState {
bool isPaytabsEnabled = false;
bool isPayfortHostedPageEnabled = true;
+ bool isMyFatoorahEnabled = false;
+ // bool isMyFatoorahEnabled = true;
void setIsPaytabsEnabled(bool value) {
isPaytabsEnabled = value;
// isPaytabsEnabled = true;
}
+ void setIsMyFatoorahEnabled(bool value) {
+ // isMyFatoorahEnabled = value;
+ isMyFatoorahEnabled = true;
+ }
+
void setIsPayfortHostedPageEnabled(bool value) {
isPayfortHostedPageEnabled = value;
// isPayfortHostedPageEnabled = false;
@@ -170,7 +177,6 @@ class AppState {
set setIsAuthenticated(v) => isAuthenticated = v;
-
String deviceTypeID = "";
set setDeviceTypeID(v) => deviceTypeID = v;
@@ -179,6 +185,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;
}
diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart
index ecfe1324..97458e1b 100644
--- a/lib/core/dependencies.dart
+++ b/lib/core/dependencies.dart
@@ -44,6 +44,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_rep
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/my_invoices/my_invoices_repo.dart';
import 'package:hmg_patient_app_new/features/my_invoices/my_invoices_view_model.dart';
+import 'package:hmg_patient_app_new/features/myfatoorah/myfatoorah_view_model.dart';
import 'package:hmg_patient_app_new/features/notifications/notifications_repo.dart';
import 'package:hmg_patient_app_new/features/notifications/notifications_view_model.dart';
import 'package:hmg_patient_app_new/features/offers_and_discounts/offers_and_discounts_repo.dart';
@@ -84,6 +85,9 @@ 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/remote_config_service.dart';
+import 'package:hmg_patient_app_new/services/security_service.dart';
+import 'package:hmg_patient_app_new/features/occasion_theme/occasion_theme_view_model.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 +161,10 @@ class AppDependencies {
getIt.registerLazySingleton(() => PermissionService());
getIt.registerLazySingleton(() => TurnstileService(getIt()));
+ getIt.registerLazySingleton(() => SecurityServiceImpl(
+ appState: getIt(),
+ loggerService: getIt(),
+ ));
// Repositories
getIt.registerLazySingleton(() => CommonRepoImp(loggerService: getIt()));
@@ -369,10 +377,28 @@ class AppDependencies {
errorHandlerService: getIt(),
));
- getIt.registerLazySingleton(() => PayTabsViewModel(appState: getIt()));
+ getIt.registerLazySingleton(() => PayTabsViewModel(
+ appState: getIt(),
+ payfortRepo: getIt(),
+ errorHandlerService: getIt(),
+ ));
+
+ getIt.registerLazySingleton(() => MyFatoorahViewModel(
+ appState: getIt(),
+ errorHandlerService: getIt(),
+ payfortRepo: getIt(),
+ ));
getIt.registerLazySingleton(
() => ClarityService(appState: getIt.get()),
);
+
+ // Remote-config-driven "occasion" theming (National Day, Eid, etc.).
+ getIt.registerLazySingleton(() => RemoteConfigServiceImp(loggerService: getIt()));
+ getIt.registerLazySingleton(() => OccasionThemeViewModel(
+ remoteConfigService: getIt(),
+ cacheService: getIt(),
+ loggerService: getIt(),
+ ));
}
}
diff --git a/lib/core/myFatoorah_config.dart b/lib/core/myFatoorah_config.dart
new file mode 100644
index 00000000..582ced3c
--- /dev/null
+++ b/lib/core/myFatoorah_config.dart
@@ -0,0 +1,5 @@
+class MyFatoorahConfig {
+
+ static const String configAPIKey = "SK_KWT_0auB76h3Frhj7aUBSZa6H5ei792eZoGAPh0bBxKsrgtyjqKgf38MPnZqzGqagErb";
+
+}
\ No newline at end of file
diff --git a/lib/core/paytabs_config.dart b/lib/core/paytabs_config.dart
index 4d90ee8f..b1ba0dd4 100644
--- a/lib/core/paytabs_config.dart
+++ b/lib/core/paytabs_config.dart
@@ -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";
diff --git a/lib/core/services/turnstile_service.dart b/lib/core/services/turnstile_service.dart
index f6665190..b30113e0 100644
--- a/lib/core/services/turnstile_service.dart
+++ b/lib/core/services/turnstile_service.dart
@@ -18,6 +18,10 @@ class TurnstileService {
// Initialize an instance of invisible Cloudflare Turnstile with your site key
final turnstile = CloudflareTurnstile.invisible(
siteKey: _siteKey,
+ onTimeout: () {},
+ options: TurnstileOptions(
+ retryInterval: const Duration(milliseconds: 2000),
+ ),
);
try {
diff --git a/lib/core/talsec_config.dart b/lib/core/talsec_config.dart
new file mode 100644
index 00000000..1603d419
--- /dev/null
+++ b/lib/core/talsec_config.dart
@@ -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
+);
\ No newline at end of file
diff --git a/lib/core/utils/date_util.dart b/lib/core/utils/date_util.dart
index 97c8dad0..7510786d 100644
--- a/lib/core/utils/date_util.dart
+++ b/lib/core/utils/date_util.dart
@@ -28,21 +28,21 @@ class DateUtil {
const end = "+0300)";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
- // if (projectId == 2 || projectId == 3) {
- // return DateTime.fromMillisecondsSinceEpoch(
- // int.parse(
- // date.substring(startIndex + start.length, endIndex),
- // ),
- // isUtc: true)
- // .add(Duration(hours: 4));
- // } else {
- return DateTime.fromMillisecondsSinceEpoch(
+ if (projectId == 2 || projectId == 3) {
+ return DateTime.fromMillisecondsSinceEpoch(
+ int.parse(
+ date.substring(startIndex + start.length, endIndex),
+ ),
+ isUtc: true)
+ .add(Duration(hours: 4));
+ } else {
+ return DateTime.fromMillisecondsSinceEpoch(
int.parse(
date.substring(startIndex + start.length, endIndex),
),
isUtc: true)
.add(Duration(hours: 3));
- // }
+ }
} else {
return DateTime.now();
}
diff --git a/lib/core/utils/push_notification_handler.dart b/lib/core/utils/push_notification_handler.dart
index e179a1ab..89f6969a 100644
--- a/lib/core/utils/push_notification_handler.dart
+++ b/lib/core/utils/push_notification_handler.dart
@@ -19,7 +19,12 @@ 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/cache_consts.dart';
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/notifications/models/resp_models/notification_response_model.dart';
+import 'package:hmg_patient_app_new/presentation/notifications/notification_details_page.dart';
+import 'package:hmg_patient_app_new/services/navigation_service.dart';
+import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:uuid/uuid.dart';
@@ -523,6 +528,26 @@ class PushNotificationHandler {
_incomingCall(remoteMessage.data);
// showCallkitIncoming();
} else {
+ NotificationResponseModel notification = NotificationResponseModel();
+
+ notification.createdOn = DateUtil.convertDateToString(DateTime.now());
+ notification.isSentOn = DateUtil.convertDateToString(DateTime.now());
+ notification.messageTypeData = remoteMessage.data['picture'];
+ notification.messageType = notification.messageTypeData != null && notification.messageTypeData!.isNotEmpty ? "image" : "";
+ notification.message = remoteMessage.data['message'];
+ notification.notificationType = remoteMessage.data["NotificationType"].toString();
+ if (remoteMessage.data["NotificationType"] == "2") {
+ notification.videoURL = remoteMessage.data["VideoUrl"];
+ }
+
+ Navigator.of(getIt.get().navigatorKey.currentContext!).push(
+ CustomPageRoute(
+ page: NotificationDetailsPage(
+ notification: notification,
+ ),
+ ),
+ );
+
// GetNotificationsResponseModel notification = new GetNotificationsResponseModel();
//
// notification.createdOn = DateUtil.convertDateToString(DateTime.now());
diff --git a/lib/core/utils/request_utils.dart b/lib/core/utils/request_utils.dart
index 3abf02a2..b7691eb5 100644
--- a/lib/core/utils/request_utils.dart
+++ b/lib/core/utils/request_utils.dart
@@ -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 {
@@ -77,15 +86,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]+$');
@@ -97,8 +106,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;
@@ -112,8 +130,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;
@@ -121,7 +139,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
@@ -167,8 +186,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;
@@ -259,16 +287,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,
@@ -285,31 +313,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,
@@ -333,7 +361,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;
@@ -344,4 +374,4 @@ class RequestUtils {
request.isDentalAllowedBackend = false;
return request;
}
-}
+}
\ No newline at end of file
diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart
index 320bd1cf..0d09a716 100644
--- a/lib/core/utils/utils.dart
+++ b/lib/core/utils/utils.dart
@@ -437,8 +437,8 @@ class Utils {
onCancelTap();
}
},
- backgroundColor: AppColors.primaryRedColor,
- borderColor: AppColors.primaryRedColor,
+ backgroundColor: AppColors.criticalActionColor,
+ borderColor: AppColors.criticalActionColor,
textColor: AppColors.whiteColor,
// icon: AppAssets.cancel,
// iconColor: AppColors.whiteColor,
@@ -516,8 +516,8 @@ class Utils {
onCancelTap();
}
},
- backgroundColor: AppColors.primaryRedColor,
- borderColor: AppColors.primaryRedColor,
+ backgroundColor: AppColors.criticalActionColor,
+ borderColor: AppColors.criticalActionColor,
textColor: AppColors.whiteColor,
// icon: AppAssets.cancel,
// iconColor: AppColors.whiteColor,
@@ -808,8 +808,8 @@ class Utils {
double? border,
double? borderRadius,
}) {
- final iconH = height ?? 24.h;
- final iconW = width ?? 24.w;
+ final double? iconW = (width == null && height == null) ? 24.w : width;
+ final double? iconH = (width == null && height == null) ? 24.h : height;
return PreserveImageColors(
child: Container(
decoration: BoxDecoration(
@@ -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,8 +859,15 @@ class Utils {
BoxFit fit = BoxFit.cover,
ImageErrorWidgetBuilder? errorBuilder,
}) {
- final iconH = height ?? 24.h;
- final iconW = width ?? 24.w;
+ final double? iconW = (width == null && height == null) ? 24.w : width;
+ final double? iconH = (width == null && height == null) ? 24.h : height;
+ if (url == null || url.isEmpty) {
+ return Utils.buildSvgWithAssets(
+ width: iconW ?? 24.w,
+ height: iconH ?? 24.h,
+ icon: AppAssets.noImageFound,
+ );
+ }
return PreserveImageColors(
child: Image.network(
url,
@@ -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 ?? 24.w, height: iconH ?? 24.h, 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 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) {
diff --git a/lib/core/utils/zoom_config.dart b/lib/core/utils/zoom_config.dart
index 09370c00..8262e83d 100644
--- a/lib/core/utils/zoom_config.dart
+++ b/lib/core/utils/zoom_config.dart
@@ -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',
+// };
diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart
index 6ec5d2bf..271c628d 100644
--- a/lib/features/authentication/authentication_view_model.dart
+++ b/lib/features/authentication/authentication_view_model.dart
@@ -3,6 +3,7 @@ import 'dart:developer';
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:get_it/get_it.dart';
@@ -30,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';
@@ -823,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();
@@ -855,8 +861,6 @@ class AuthenticationViewModel extends ChangeNotifier {
}
Future 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) {
@@ -979,13 +983,15 @@ class AuthenticationViewModel extends ChangeNotifier {
// TODO: GET APP SMS SIGNATURE HERE
request.sMSSignature = await getSignature();
- // Get Turnstile token if configured
- final turnstileToken = await _turnstileService.getTurnstileToken();
- if (turnstileToken != null) {
- request.turnstileToken = turnstileToken;
- } else {
- request.turnstileToken = "";
- }
+ // if(!kDebugMode) {
+ // // Get Turnstile token if configured
+ // final turnstileToken = await _turnstileService.getTurnstileToken();
+ // if (turnstileToken != null) {
+ // request.turnstileToken = turnstileToken;
+ // } else {
+ // request.turnstileToken = "";
+ // }
+ // }
if (isNeedLoading) {
LoaderBottomSheet.showLoader();
@@ -998,7 +1004,10 @@ class AuthenticationViewModel extends ChangeNotifier {
sendActivationCodeReq: request, isRegister: checkIsUserComingForRegister(request: payload), languageID: 'er', isFormFamilyFile: isFormFamilyFile);
resultEither.fold(
- (failure) async => await _errorHandlerService.handleError(failure: failure),
+ (failure) async {
+ LoaderBottomSheet.hideLoader();
+ await _errorHandlerService.handleError(failure: failure);
+ },
(apiResponse) async {
if (isFormFamilyFile) {
if (apiResponse.data['PatientShareRequestID'] != null && apiResponse.data['PatientShareRequestID'] == 0 && apiResponse.messageStatus == 1) {
@@ -1239,6 +1248,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_appState.setUserBloodGroup = activation.patientBlodType ?? "N/A";
_appState.setIsPaytabsEnabled(Utils.havePrivilege(120));
_appState.setIsPayfortHostedPageEnabled(Utils.havePrivilege(121));
+ _appState.setIsMyFatoorahEnabled(Utils.havePrivilege(123));
// Refresh privileges after user switching to ensure correct privileges are loaded
if (isSwitchUser) {
@@ -1272,6 +1282,9 @@ class AuthenticationViewModel extends ChangeNotifier {
getIt.get().setIsWalletAmountToBeLoaded(true);
getIt.get().setIsInsuranceDataToBeLoaded(true);
getIt.get().setHasVitalSignDataLoaded(false);
+ getIt.get().setIsSickLeavesDataNeedsReloading(true);
+ getIt.get().setIsMedicalReportsDataNeedsReloading(true);
+ getIt.get().setIsPrescriptionDataNeedsReloading(true);
if (isUserAgreedBefore) {
LoaderBottomSheet.hideLoader();
navigateToHomeScreen();
@@ -1784,6 +1797,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_appState.setProjectsDetailList(projectDetailListModel);
_appState.setIsPaytabsEnabled(Utils.havePrivilege(120));
_appState.setIsPayfortHostedPageEnabled(Utils.havePrivilege(121));
+ _appState.setIsMyFatoorahEnabled(Utils.havePrivilege(123));
}
},
);
diff --git a/lib/features/book_appointments/book_appointments_repo.dart b/lib/features/book_appointments/book_appointments_repo.dart
index e5200f67..a705d84a 100644
--- a/lib/features/book_appointments/book_appointments_repo.dart
+++ b/lib/features/book_appointments/book_appointments_repo.dart
@@ -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>> getDoctorProfile(int clinicID, int projectID, int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError});
- Future>> getDoctorRatingDetails(int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError});
+ Future>> getDoctorRatingDetails(int doctorId, int projectID, {Function(dynamic)? onSuccess, Function(String)? onError});
Future>> 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().isAuthenticated ? getIt.get().getAuthenticatedUser()!.gender! : 0,
+ "age": getIt.get().isAuthenticated ? getIt.get().getAuthenticatedUser()!.age! : 0,
+ "DateofBirth": getIt.get().isAuthenticated ? getIt.get().getAuthenticatedUser()!.dateofBirth! : null,
if (isNearest) "SelectedDate": DateUtil.convertDateToString(DateTime.now()),
"License": true
};
@@ -309,9 +314,10 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo {
}
@override
- Future>> getDoctorRatingDetails(int doctorId, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
+ Future>> getDoctorRatingDetails(int doctorId, int projectID, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
Map mapDevice = {
"DoctorID": doctorId,
+ "ProjectID": projectID,
"PatientID": 0,
"License": true,
"IsRegistered": true,
diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart
index e4f028d9..a4530eee 100644
--- a/lib/features/book_appointments/book_appointments_view_model.dart
+++ b/lib/features/book_appointments/book_appointments_view_model.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
+import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
@@ -404,6 +405,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
isWaitingAppointmentSelected = false;
isPatientRescheduleAppointment = false;
bodyTypes = [maleLaserCategory, femaleLaserCategory];
+ selectedChiefComplaintID = 0;
// getLocation();
notifyListeners();
}
@@ -420,14 +422,14 @@ class BookAppointmentsViewModel extends ChangeNotifier {
setIsNearestAppointmentSelected(bool isNearestAppointmentSelected) {
this.isNearestAppointmentSelected = isNearestAppointmentSelected;
if (isNearestAppointmentSelected) {
- for (var group in doctorsListGrouped) {
- group.sort((a, b) {
- var aSlot = a.nearestFreeSlot;
- var bSlot = b.nearestFreeSlot;
- if (aSlot == null || bSlot == null) return 0;
- return DateUtil.convertStringToDate(aSlot).compareTo(DateUtil.convertStringToDate(bSlot));
- });
- }
+ // for (var group in doctorsListGrouped) {
+ // group.sort((a, b) {
+ // var aSlot = a.nearestFreeSlot;
+ // var bSlot = b.nearestFreeSlot;
+ // if (aSlot == null || bSlot == null) return 0;
+ // return DateUtil.convertStringToDate(aSlot).compareTo(DateUtil.convertStringToDate(bSlot));
+ // });
+ // }
} else {
// for (var group in doctorsListGrouped) {
// group.sort((a, b) {
@@ -675,7 +677,6 @@ class BookAppointmentsViewModel extends ChangeNotifier {
(failure) async {
isDoctorsListLoading = false;
if (onError != null) onError(LocaleKeys.noDoctorFound.tr());
-
notifyListeners();
},
(apiResponse) {
@@ -690,7 +691,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
clearSearchFilters();
getFiltersFromDoctorList();
_groupDoctorsList();
- setIsNearestAppointmentSelected(isNearest);
+ // setIsNearestAppointmentSelected(isNearest);
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@@ -806,7 +807,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 {
@@ -842,67 +843,73 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
Future getDoctorFreeSlots({bool isBookingForLiveCare = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
- docFreeSlots.clear();
- DateTime date;
- final DateFormat formatter = DateFormat('HH:mm', "en-US");
- final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
- Map _eventsParsed;
-
- final result = await bookAppointmentsRepo.getDoctorFreeSlots(
- selectedDoctor.clinicID ?? 0,
- selectedDoctor.projectID ?? 0,
- selectedDoctor.doctorID ?? 0,
- isBookingForLiveCare,
- continueDentalPlan: isContinueDentalPlan,
- onError: onError,
- );
-
- result.fold(
- (failure) async {
- print(failure);
- if (onError != null) {
- onError(failure.message);
- }
- },
- (apiResponse) {
- if (apiResponse.messageStatus == 2) {
- onError!(apiResponse.errorMessage ?? "Unknown error occurred");
- // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
- } else if (apiResponse.messageStatus == 1) {
- if (apiResponse.data['FreeTimeSlots'] == null || apiResponse.data['FreeTimeSlots'].isEmpty) {
- onError!("No free slots available".tr());
- return;
+ // try {
+ docFreeSlots.clear();
+ DateTime date;
+ final DateFormat formatter = DateFormat('HH:mm', "en-US");
+ // final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
+ // Map _eventsParsed;
+
+ final result = await bookAppointmentsRepo.getDoctorFreeSlots(
+ selectedDoctor.clinicID ?? 0,
+ selectedDoctor.projectID ?? 0,
+ selectedDoctor.doctorID ?? 0,
+ isBookingForLiveCare,
+ continueDentalPlan: isContinueDentalPlan,
+ onError: onError,
+ );
+
+ result.fold(
+ (failure) async {
+ print(failure);
+ if (onError != null) {
+ onError(failure.message);
}
- initialSlotDuration = apiResponse.data["InitialSlotDuration"];
- freeSlotsResponse = apiResponse.data['FreeTimeSlots'];
- isWaitingAppointmentAvailable = apiResponse.data["IsAllowToBookWaitingAppointment"];
-
- // isWaitingAppointmentAvailable = true;
-
- freeSlotsResponse.forEach((element) {
- // date = (isLiveCareSchedule != null && isLiveCareSchedule)
- // ? DateUtil.convertStringToDate(element)
- // :
- date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
- slotsList.add(FreeSlot(date, ['slot']));
- docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
- });
+ },
+ (apiResponse) {
+ if (apiResponse.messageStatus == 2) {
+ onError!(apiResponse.errorMessage ?? "Unknown error occurred");
+ // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
+ } else if (apiResponse.messageStatus == 1) {
+ if (apiResponse.data['FreeTimeSlots'] == null || apiResponse.data['FreeTimeSlots'].isEmpty) {
+ onError!("No free slots available".tr());
+ return;
+ }
+ initialSlotDuration = apiResponse.data["InitialSlotDuration"];
+ freeSlotsResponse = apiResponse.data['FreeTimeSlots'];
+ isWaitingAppointmentAvailable = apiResponse.data["IsAllowToBookWaitingAppointment"];
+
+ // isWaitingAppointmentAvailable = true;
+
+ freeSlotsResponse.forEach((element) {
+ // date = (isLiveCareSchedule != null && isLiveCareSchedule)
+ // ? DateUtil.convertStringToDate(element)
+ // :
+ date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
+ slotsList.add(FreeSlot(date, ['slot']));
+ docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
+ });
- notifyListeners();
- if (onSuccess != null) {
- onSuccess(apiResponse);
+ notifyListeners();
+ if (onSuccess != null) {
+ onSuccess(apiResponse);
+ }
}
- }
- },
- );
+ },
+ );
+ // } catch(ex) {
+ // if (onError != null) {
+ // onError(ex.toString());
+ // }
+ // }
}
Future getLiveCareDoctorFreeSlots({bool isBookingForLiveCare = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
docFreeSlots.clear();
DateTime date;
final DateFormat formatter = DateFormat('HH:mm', "en-US");
- final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
- Map _eventsParsed;
+ // final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
+ // Map _eventsParsed;
final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots(
selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare,
diff --git a/lib/features/contact_us/contact_us_view_model.dart b/lib/features/contact_us/contact_us_view_model.dart
index 323eb782..40cab14c 100644
--- a/lib/features/contact_us/contact_us_view_model.dart
+++ b/lib/features/contact_us/contact_us_view_model.dart
@@ -15,6 +15,19 @@ import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:permission_handler/permission_handler.dart';
+/// Class to store feedback attachment data
+class FeedbackAttachment {
+ final String base64String;
+ final File file;
+ final String fileName;
+
+ FeedbackAttachment({
+ required this.base64String,
+ required this.file,
+ required this.fileName,
+ });
+}
+
class ContactUsViewModel extends ChangeNotifier {
ContactUsRepo contactUsRepo;
ErrorHandlerService errorHandlerService;
@@ -35,7 +48,7 @@ class ContactUsViewModel extends ChangeNotifier {
String? chatRequestID;
- List feedbackAttachmentList = [];
+ List feedbackAttachmentList = [];
List cocItemsList = [];
bool isCOCItemsListLoading = false;
@@ -168,13 +181,20 @@ class ContactUsViewModel extends ChangeNotifier {
notifyListeners();
}
- addFeedbackAttachment(String attachmentPath) {
- feedbackAttachmentList.add(attachmentPath);
+ addFeedbackAttachment(String base64String, File file) {
+ // Extract filename from file path
+ final fileName = file.path.split('/').last;
+
+ feedbackAttachmentList.add(FeedbackAttachment(
+ base64String: base64String,
+ file: file,
+ fileName: fileName,
+ ));
notifyListeners();
}
- removeFeedbackAttachment(String attachmentPath) {
- feedbackAttachmentList.remove(attachmentPath);
+ removeFeedbackAttachment(FeedbackAttachment attachment) {
+ feedbackAttachmentList.remove(attachment);
notifyListeners();
}
@@ -282,7 +302,7 @@ class ContactUsViewModel extends ChangeNotifier {
Future insertCOCItem({required String subject, required String message, Function(dynamic)? onSuccess, Function(String)? onError}) async {
RequestInsertCOCItem requestInsertCOCItem = RequestInsertCOCItem();
- requestInsertCOCItem.attachment = feedbackAttachmentList.isNotEmpty ? feedbackAttachmentList.first : "";
+ requestInsertCOCItem.attachment = feedbackAttachmentList.isNotEmpty ? feedbackAttachmentList.first.base64String : "";
requestInsertCOCItem.title = subject;
requestInsertCOCItem.details = message;
requestInsertCOCItem.cOCTypeName = selectedFeedbackType.id.toString();
@@ -291,7 +311,7 @@ class ContactUsViewModel extends ChangeNotifier {
requestInsertCOCItem.isUserLoggedIn = true;
requestInsertCOCItem.projectID = 0;
requestInsertCOCItem.patientName = "${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}";
- requestInsertCOCItem.fileName = "Image 1";
+ requestInsertCOCItem.fileName = feedbackAttachmentList.isNotEmpty ? feedbackAttachmentList.first.fileName : "";
requestInsertCOCItem.appVersion = ApiConsts.appVersionID;
requestInsertCOCItem.uILanguage = appState.isArabic() ? "ar" : "en";
requestInsertCOCItem.browserInfo = Platform.localHostname;
diff --git a/lib/features/habib_wallet/habib_wallet_view_model.dart b/lib/features/habib_wallet/habib_wallet_view_model.dart
index cc87bb7b..21ec0e79 100644
--- a/lib/features/habib_wallet/habib_wallet_view_model.dart
+++ b/lib/features/habib_wallet/habib_wallet_view_model.dart
@@ -30,7 +30,36 @@ class HabibWalletViewModel extends ChangeNotifier {
num habibWalletAmount = 0;
num walletRechargeAmount = 0;
String notesText = "";
- bool isWalletAmountToBeLoaded = true;
+ bool isWalletAmountToBeLoaded = false;
+ bool isLakumInfoToBeLoaded = false;
+
+ // ── Balance visibility (show/hide like a password field) ──────────────────
+ bool isWalletAmountHidden = true;
+ bool isLakumPointsHidden = true;
+
+ // Track whether data has already been fetched (to avoid re-calling APIs).
+ bool isWalletAmountFetched = false;
+ bool isLakumInfoFetched = false;
+
+ void toggleWalletAmountVisibility() {
+ isWalletAmountHidden = !isWalletAmountHidden;
+ notifyListeners();
+ // On first unhide, fetch the data if not already fetched.
+ if (!isWalletAmountHidden && !isWalletAmountFetched) {
+ isWalletAmountToBeLoaded = true;
+ getPatientBalanceAmount();
+ }
+ }
+
+ void toggleLakumPointsVisibility() {
+ isLakumPointsHidden = !isLakumPointsHidden;
+ notifyListeners();
+ // On first unhide, fetch the data if not already fetched.
+ if (!isLakumPointsHidden && !isLakumInfoFetched) {
+ isLakumInfoToBeLoaded = true;
+ getLakumAccountInformation();
+ }
+ }
bool isBottomSheetContentLoading = false;
@@ -70,6 +99,8 @@ class HabibWalletViewModel extends ChangeNotifier {
bool isLakumAccountInfoLoading = false;
LakumInquiryInformationResponseModel? lakumAccountInfo;
+
+
// Get all flattened transactions sorted by date descending
List getAllLakumTransactions() {
if (lakumAccountInfo?.gainedPointsAmountPerYear == null) {
@@ -328,6 +359,8 @@ class HabibWalletViewModel extends ChangeNotifier {
if (isWalletAmountToBeLoaded) {
isWalletAmountLoading = true;
habibWalletAmount = 0;
+ }
+ if (isLakumInfoToBeLoaded) {
isLakumAccountInfoLoading = true;
yahalaAccountNumber = "";
}
@@ -399,6 +432,11 @@ class HabibWalletViewModel extends ChangeNotifier {
notifyListeners();
}
+ setIsLakumInfoToBeLoaded(bool value) {
+ isLakumInfoToBeLoaded = value;
+ notifyListeners();
+ }
+
String getSelectedRechargeTypeValue() {
switch (selectedRechargeType) {
case 1:
@@ -437,6 +475,7 @@ class HabibWalletViewModel extends ChangeNotifier {
isWalletAmountLoading = false;
isWalletAmountToBeLoaded = false;
+ isWalletAmountFetched = true;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@@ -540,7 +579,7 @@ class HabibWalletViewModel extends ChangeNotifier {
}
Future getLakumAccountInformation({Function(dynamic)? onSuccess, Function(String)? onError}) async {
- if (!isWalletAmountToBeLoaded) {
+ if (!isLakumInfoToBeLoaded) {
return;
}
@@ -555,6 +594,8 @@ class HabibWalletViewModel extends ChangeNotifier {
(failure) async {
yahalaAccountNumber = "0";
isLakumAccountInfoLoading = false;
+ isLakumInfoFetched = true;
+ isLakumInfoToBeLoaded = false;
notifyListeners(); // 675534
},
(apiResponse) async {
@@ -581,6 +622,8 @@ class HabibWalletViewModel extends ChangeNotifier {
);
}
isLakumAccountInfoLoading = false;
+ isLakumInfoFetched = true;
+ isLakumInfoToBeLoaded = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
diff --git a/lib/features/hmg_services/hmg_services_repo.dart b/lib/features/hmg_services/hmg_services_repo.dart
index 8f439d2c..6e01a561 100644
--- a/lib/features/hmg_services/hmg_services_repo.dart
+++ b/lib/features/hmg_services/hmg_services_repo.dart
@@ -67,7 +67,7 @@ abstract class HmgServicesRepo {
Future>> getCovidPaymentInfo(String procedureID, int projectID);
- Future>>> getPatientVitalSign();
+ Future>>> getPatientVitalSign( num? transID, int? projectID);
}
class HmgServicesRepoImp implements HmgServicesRepo {
@@ -917,8 +917,11 @@ class HmgServicesRepoImp implements HmgServicesRepo {
}
@override
- Future>>> getPatientVitalSign() async {
+ Future>>> getPatientVitalSign(num? transID, int? projectID) async {
Map requestBody = {
+ "TransID": transID,
+ "TransNo": transID,
+ "ProjectID": projectID,
};
try {
diff --git a/lib/features/hmg_services/hmg_services_view_model.dart b/lib/features/hmg_services/hmg_services_view_model.dart
index da1ae80d..9cd7e519 100644
--- a/lib/features/hmg_services/hmg_services_view_model.dart
+++ b/lib/features/hmg_services/hmg_services_view_model.dart
@@ -895,37 +895,59 @@ class HmgServicesViewModel extends ChangeNotifier {
Future 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>(
+ 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().setSelectedHeight(vitalSignList.first.heightCm);
- getIt.get().setSelectedWeight(vitalSignList.first.weightKg);
+ if (!isSpecificQuery) {
+ isVitalSignLoading = false;
+ if (apiResponse.messageStatus == 1) {
+ vitalSignList = apiResponse.data ?? [];
+ hasVitalSignDataLoaded = true;
+ if (vitalSignList.isNotEmpty) {
+ getIt.get().setSelectedHeight(vitalSignList.first.heightCm);
+ getIt.get().setSelectedWeight(vitalSignList.first.weightKg);
+ }
}
notifyListeners();
+ }
+
+ if (apiResponse.messageStatus == 1) {
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
- notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
diff --git a/lib/features/immediate_livecare/immediate_livecare_repo.dart b/lib/features/immediate_livecare/immediate_livecare_repo.dart
index 6726a09b..e07d6293 100644
--- a/lib/features/immediate_livecare/immediate_livecare_repo.dart
+++ b/lib/features/immediate_livecare/immediate_livecare_repo.dart
@@ -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(
messageStatus: messageStatus,
statusCode: statusCode,
diff --git a/lib/features/immediate_livecare/immediate_livecare_view_model.dart b/lib/features/immediate_livecare/immediate_livecare_view_model.dart
index 84a79c02..57bf6553 100644
--- a/lib/features/immediate_livecare/immediate_livecare_view_model.dart
+++ b/lib/features/immediate_livecare/immediate_livecare_view_model.dart
@@ -59,16 +59,25 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
bool isShowNotEligibleDialog = false;
String notEligibleErrorMsg = "";
+ bool isTermsAccepted = false;
+
initImmediateLiveCare() {
_appState = getIt();
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();
@@ -126,7 +135,9 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
result.fold(
(failure) async {
- onError!(failure.message);
+ if(onError != null) {
+ onError(failure.message);
+ }
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
diff --git a/lib/features/insurance/insurance_repo.dart b/lib/features/insurance/insurance_repo.dart
index 2719035b..0a0ee0be 100644
--- a/lib/features/insurance/insurance_repo.dart
+++ b/lib/features/insurance/insurance_repo.dart
@@ -11,7 +11,7 @@ import 'package:hmg_patient_app_new/features/insurance/models/resp_models/upload
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class InsuranceRepo {
- Future>>> getPatientInsuranceDetails();
+ Future>>> getPatientInsuranceDetails({bool isFromHomePage = false});
Future>>> getPatientInsuranceCardHistory();
@@ -35,8 +35,10 @@ class InsuranceRepoImp implements InsuranceRepo {
InsuranceRepoImp({required this.loggerService, required this.apiClient});
@override
- Future>>> getPatientInsuranceDetails() async {
- Map mapDevice = {};
+ Future>>> getPatientInsuranceDetails({bool isFromHomePage = false}) async {
+ Map mapDevice = {
+ "IsFromHomePage": isFromHomePage
+ };
try {
GenericApiModel>? apiResponse;
diff --git a/lib/features/insurance/insurance_view_model.dart b/lib/features/insurance/insurance_view_model.dart
index 621ebe4c..caeba030 100644
--- a/lib/features/insurance/insurance_view_model.dart
+++ b/lib/features/insurance/insurance_view_model.dart
@@ -32,15 +32,11 @@ class InsuranceViewModel extends ChangeNotifier {
InsuranceViewModel({required this.insuranceRepo, required this.errorHandlerService});
- initInsuranceProvider() {
- debugPrint("InsuranceViewModel: initInsuranceProvider called, isInsuranceDataToBeLoaded=$isInsuranceDataToBeLoaded");
+ initInsuranceProvider({bool isFromHomePage = false}) {
if (isInsuranceDataToBeLoaded) {
patientInsuranceList.clear();
isInsuranceLoading = true;
- debugPrint("InsuranceViewModel: Calling getPatientInsuranceDetails API");
- getPatientInsuranceDetails();
- } else {
- debugPrint("InsuranceViewModel: Skipping API call, isInsuranceDataToBeLoaded is false");
+ getPatientInsuranceDetails(isFromHomePage: isFromHomePage);
}
patientInsuranceCardHistoryList.clear();
isInsuranceHistoryLoading = true;
@@ -80,19 +76,16 @@ class InsuranceViewModel extends ChangeNotifier {
notifyListeners();
}
- Future getPatientInsuranceDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async {
+ Future getPatientInsuranceDetails({bool isFromHomePage = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isInsuranceDataToBeLoaded) {
- debugPrint("InsuranceViewModel: getPatientInsuranceDetails - skipping, flag is false");
return;
}
- debugPrint("InsuranceViewModel: getPatientInsuranceDetails - making API call");
- final result = await insuranceRepo.getPatientInsuranceDetails();
+ final result = await insuranceRepo.getPatientInsuranceDetails(isFromHomePage: isFromHomePage);
result.fold(
// (failure) async => await errorHandlerService.handleError(failure: failure),
(failure) async {
- debugPrint("InsuranceViewModel: API call failed - ${failure.toString()}");
isInsuranceLoading = false;
isInsuranceDataToBeLoaded = true;
isInsuranceExpired = false;
@@ -102,11 +95,9 @@ class InsuranceViewModel extends ChangeNotifier {
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
- debugPrint("InsuranceViewModel: API returned error status");
isInsuranceDataToBeLoaded = false;
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
- debugPrint("InsuranceViewModel: API success - received ${apiResponse.data?.length ?? 0} insurance records");
patientInsuranceList = apiResponse.data!;
isInsuranceLoading = false;
isInsuranceDataToBeLoaded = false;
@@ -115,7 +106,6 @@ class InsuranceViewModel extends ChangeNotifier {
isInsuranceExpired = DateTime.now().isAfter(
DateUtil.convertStringToDate(patientInsuranceList.first.cardValidTo),
);
- debugPrint("InsuranceViewModel: Insurance card expired: $isInsuranceExpired");
}
isInsuranceExpiryBannerShown = isInsuranceExpired;
diff --git a/lib/features/lab/lab_view_model.dart b/lib/features/lab/lab_view_model.dart
index 1c25ef9d..d7f5bb62 100644
--- a/lib/features/lab/lab_view_model.dart
+++ b/lib/features/lab/lab_view_model.dart
@@ -209,12 +209,12 @@ class LabViewModel extends ChangeNotifier {
final result = await labRepo.getLabResultReportPDF(labOrder: labOrder);
result.fold(
- (failure) async => await errorHandlerService.handleError(
- failure: failure,
- onOkPressed: () {
- onError!(failure.message);
- },
- ),
+ // (failure) async => await errorHandlerService.handleError(
+ (failure) async {
+ if (onError != null) {
+ onError(failure.message);
+ }
+ },
(apiResponse) {
if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage!);
diff --git a/lib/features/medical_file/medical_file_view_model.dart b/lib/features/medical_file/medical_file_view_model.dart
index e0abd9d7..29f653ec 100644
--- a/lib/features/medical_file/medical_file_view_model.dart
+++ b/lib/features/medical_file/medical_file_view_model.dart
@@ -29,7 +29,11 @@ class MedicalFileViewModel extends ChangeNotifier {
bool isPatientSickLeavePDFLoading = false;
bool isPatientMedicalReportsListLoading = false;
bool isPatientAllergiesListLoading = false;
+ bool _isFamilyFilesLoading = false;
+ bool get isFamilyFilesLoading => _isFamilyFilesLoading;
+
+ set setIsFamilyFilesLoading(bool value) => _isFamilyFilesLoading = value;
MedicalFileRepo medicalFileRepo;
ErrorHandlerService errorHandlerService;
@@ -41,7 +45,6 @@ class MedicalFileViewModel extends ChangeNotifier {
List patientSickLeavesViewList = [];
bool isSickLeavesSortByClinic = true;
-
bool isSickLeavesDataNeedsReloading = true;
List patientAllergiesList = [];
@@ -57,6 +60,7 @@ class MedicalFileViewModel extends ChangeNotifier {
List patientMedicalReportsViewList = [];
bool isMedicalReportsSortByClinic = true;
+ bool isMedicalReportsDataNeedsReloading = true;
List patientMedicalReportAppointmentHistoryList = [];
PatientAppointmentHistoryResponseModel? patientMedicalReportSelectedAppointment;
@@ -164,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();
@@ -188,7 +202,7 @@ class MedicalFileViewModel extends ChangeNotifier {
}
setIsPatientMedicalReportsLoading(bool val) {
- if (val) {
+ if (val && isMedicalReportsDataNeedsReloading) {
onMedicalReportTabChange(0);
patientMedicalReportList.clear();
patientMedicalReportsByClinic.clear();
@@ -196,8 +210,8 @@ class MedicalFileViewModel extends ChangeNotifier {
patientMedicalReportsViewList.clear();
patientMedicalReportPDFBase64 = "";
isMedicalReportsSortByClinic = true;
+ isPatientMedicalReportsListLoading = val;
}
- isPatientMedicalReportsListLoading = val;
notifyListeners();
}
@@ -369,6 +383,10 @@ class MedicalFileViewModel extends ChangeNotifier {
}
Future getPatientMedicalReportList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
+ if (!isMedicalReportsDataNeedsReloading) {
+ return;
+ }
+
patientMedicalReportList.clear();
patientMedicalReportRequestedList.clear();
patientMedicalReportReadyList.clear();
@@ -381,6 +399,7 @@ class MedicalFileViewModel extends ChangeNotifier {
(failure) async => await errorHandlerService.handleError(
failure: failure,
onOkPressed: () {
+ isMedicalReportsDataNeedsReloading = true;
onError!(failure.message);
},
),
@@ -396,6 +415,7 @@ class MedicalFileViewModel extends ChangeNotifier {
}
onMedicalReportTabChange(0);
isPatientMedicalReportsListLoading = false;
+ isMedicalReportsDataNeedsReloading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@@ -431,21 +451,42 @@ class MedicalFileViewModel extends ChangeNotifier {
}
Future getFamilyFiles({int? status, Function(dynamic)? onSuccess, Function(String)? onError}) async {
+
+ setIsFamilyFilesLoading = true;
+
+ final shouldShowLoader = patientFamilyFiles.isEmpty;
+ if (shouldShowLoader) {
+ LoaderBottomSheet.showLoader();
+ }
+
final result = await medicalFileRepo.getPatientFamilyFiles(status, _appState.getSuperUserID != null ? _appState.getSuperUserID! : _appState.getAuthenticatedUser()!.patientId!);
result.fold(
- (failure) async => await errorHandlerService.handleError(
- failure: failure,
- onOkPressed: () {
- onError!(failure.message);
- },
- ),
+ (failure) async {
+
+ setIsFamilyFilesLoading = false;
+
+ await errorHandlerService.handleError(
+ failure: failure,
+ onOkPressed: () {
+ if (shouldShowLoader) {
+ LoaderBottomSheet.hideLoader();
+ }
+ onError!(failure.message);
+ },
+ );
+ },
(apiResponse) {
if (apiResponse.messageStatus == 2) {
+
+ setIsFamilyFilesLoading = false;
+
// _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {});
+ if (shouldShowLoader) {
+ LoaderBottomSheet.hideLoader();
+ }
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data != null) {
- // Add current user as the first active family file
final currentUser = _appState.getAuthenticatedUser()!;
final currentUserFamilyFile = FamilyFileResponseModelLists(
patientId: currentUser.patientId,
@@ -525,6 +566,12 @@ class MedicalFileViewModel extends ChangeNotifier {
pendingFamilyFiles = newPendingFamilyFiles;
}
+ // Clear loading state on success
+ setIsFamilyFilesLoading = false;
+
+ if (shouldShowLoader) {
+ LoaderBottomSheet.hideLoader();
+ }
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@@ -662,13 +709,10 @@ class MedicalFileViewModel extends ChangeNotifier {
}
Future handleFamilyFileRequestOTPVerification() async {
- LoaderBottomSheet.showLoader();
if (!_appState.getIsChildLoggedIn) {
await getFamilyFiles(status: 0);
await getAllPendingRecordsByResponseId();
}
-
- LoaderBottomSheet.hideLoader();
}
Future removeFileFromFamilyMembers({int? id}) async {
diff --git a/lib/features/my_appointments/appointment_via_region_viewmodel.dart b/lib/features/my_appointments/appointment_via_region_viewmodel.dart
index 1144be82..bb4179e1 100644
--- a/lib/features/my_appointments/appointment_via_region_viewmodel.dart
+++ b/lib/features/my_appointments/appointment_via_region_viewmodel.dart
@@ -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) {
diff --git a/lib/features/my_appointments/my_appointments_repo.dart b/lib/features/my_appointments/my_appointments_repo.dart
index 87484e06..87fb2ec2 100644
--- a/lib/features/my_appointments/my_appointments_repo.dart
+++ b/lib/features/my_appointments/my_appointments_repo.dart
@@ -25,7 +25,7 @@ import 'models/resp_models/appointment_details_resp_model.dart';
abstract class MyAppointmentsRepo {
Future>>> getPatientAppointments(
- {required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false});
+ {required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false, bool isForTimeLine = false});
Future>> getPatientShareAppointment(
{required int projectID, required int clinicID, required String appointmentNo, required bool isLiveCareAppointment});
@@ -105,14 +105,15 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
@override
Future>>> 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 mapDevice = {
"IsActiveAppointment": isActiveAppointment,
"IsComingFromCOC": false,
"isForUpcomming": false,
"IsForMedicalReport": false,
"IsForArrived": isArrivedAppointments,
- "IsIrisPrescription": isForEyeMeasurement
+ "IsIrisPrescription": isForEyeMeasurement,
+ "IsForTimeLine": isForTimeLine
};
try {
@@ -172,9 +173,9 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
try {
final list = response['OnlineCheckInAppointments'];
patientShareObj = (list == null || list.isEmpty) ? PatientAppointmentShareResponseModel() : PatientAppointmentShareResponseModel.fromJson(list[0]);
- patientShareObj.isCash = response["IsCash"];
- patientShareObj.isEligible = response["IsEligible"];
- patientShareObj.isInsured = response["IsInsured"];
+ patientShareObj.isCash = isLiveCareAppointment ? list[0]["IsCash"] : response["IsCash"];
+ patientShareObj.isEligible = isLiveCareAppointment ? list[0]["IsEligible"] : response["IsEligible"];
+ patientShareObj.isInsured = isLiveCareAppointment ? list[0]["IsInsured"] : response["IsInsured"];
// if (list == null || list.isEmpty) {
// throw Exception("patient share list is empty");
diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart
index b480a354..b2b990db 100644
--- a/lib/features/my_appointments/my_appointments_view_model.dart
+++ b/lib/features/my_appointments/my_appointments_view_model.dart
@@ -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 patientUpcomingAppointmentsHistoryList = [];
List patientArrivedAppointmentsHistoryList = [];
- List patientTimelineAppointmentsList = [];
+ // List patientAllArrivedAppointmentsHistoryList = [];
List 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 getPatientAppointments(bool isActiveAppointment, bool isArrivedAppointments, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
+ Future getPatientAppointments(bool isActiveAppointment, bool isArrivedAppointments, {bool isForTimeLine = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (patientArrivedAppointmentsHistoryList.isNotEmpty) {
isPatientHasQueueAppointment = false;
notifyListeners();
@@ -275,15 +278,19 @@ class MyAppointmentsViewModel extends ChangeNotifier {
getPatientAppointmentQueueDetails();
}
}
- if (!isAppointmentDataToBeLoaded) return;
- debugPrint('getPatientAppointments CALLED!!!');
+ // 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();
@@ -292,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(
@@ -321,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);
@@ -347,13 +359,73 @@ class MyAppointmentsViewModel extends ChangeNotifier {
}
// }
- debugPrint('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}');
- debugPrint('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}');
- debugPrint('All Appointments: ${patientAppointmentsHistoryList.length}');
getFiltersForSelectedAppointmentList(filteredAppointmentList);
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 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 filteredAppointmentList) {
availableFilters.clear();
if (filteredAppointmentList.isEmpty == true) return;
@@ -362,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);
@@ -699,7 +771,11 @@ class MyAppointmentsViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) {
patientMyDoctorsList = apiResponse.data!;
isPatientMyDoctorsLoading = false;
+
+ // if (!isTop8) {
isMyDoctorsDataToBeLoaded = false;
+ // }
+
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@@ -801,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;
@@ -835,11 +911,12 @@ class MyAppointmentsViewModel extends ChangeNotifier {
this.end = end;
isDateFilterSelected = true;
List 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;
@@ -1299,7 +1376,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
);
} catch (e) {
// Ignore errors if reminder doesn't exist
- debugPrint("No existing ${type.displayName} to remove");
}
}
}
diff --git a/lib/features/myfatoorah/myfatoorah_view_model.dart b/lib/features/myfatoorah/myfatoorah_view_model.dart
new file mode 100644
index 00000000..b76b251e
--- /dev/null
+++ b/lib/features/myfatoorah/myfatoorah_view_model.dart
@@ -0,0 +1,197 @@
+import 'dart:developer';
+
+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_state.dart';
+import 'package:hmg_patient_app_new/core/cache_consts.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/myFatoorah_config.dart';
+import 'package:hmg_patient_app_new/core/utils/utils.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/generated/codegen_loader.g.dart';
+import 'package:hmg_patient_app_new/services/error_handler_service.dart';
+import 'package:hmg_patient_app_new/theme/colors.dart';
+import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
+import 'package:myfatoorah_flutter/myfatoorah_flutter.dart';
+
+class MyFatoorahViewModel extends ChangeNotifier {
+ final AppState appState;
+ final ErrorHandlerService errorHandlerService;
+ final PayfortRepo payfortRepo;
+
+ MyFatoorahViewModel({
+ required this.appState,
+ required this.errorHandlerService,
+ required this.payfortRepo,
+ });
+
+ // Payment Method ID
+ // 2: Credit/Debit Card
+ // 6: Mada
+
+ initiateCardPayment({
+ num amount = 10.0,
+ paymentDescription = "",
+ String displayCurrencyIso = MFCurrencyISO.KUWAIT_KWD,
+ required String paymentOption,
+ required String liveServiceID,
+ required String isScheduleLiveCare,
+ required String appointmentDate,
+ required String appointmentNo,
+ required String doctorID,
+ required String fileNumber,
+ required String serviceID,
+ required String projectID,
+ Function(MFGetPaymentStatusResponse)? onSuccess,
+ Function(String)? onError,
+ }) async {
+ LoaderBottomSheet.showLoader();
+ await MFSDK.init(MyFatoorahConfig.configAPIKey, ApiConsts.myFatoorahCountry, ApiConsts.myFatoorahEnvironmentType);
+
+ MFSDK.setUpActionBar(toolBarTitle: paymentDescription, toolBarTitleColor: "#ffffff", toolBarBackgroundColor: '#ED1C2B', isShowToolBar: true);
+
+ var request = MFExecutePaymentRequest(paymentMethodId: paymentOption.toLowerCase() == "mada" ? 6 : 2, invoiceValue: amount);
+ request.displayCurrencyIso = displayCurrencyIso;
+ request.customerName = ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? "Test test" : "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}";
+ request.customerEmail = "CustID_${appState.getAuthenticatedUser()!.patientId}@HMG.com";
+
+ await MFSDK.executePayment(request, appState.isArabic() ? MFLanguage.ARABIC : MFLanguage.ENGLISH, (invoiceId) async {
+ PayfortRequestInsertModel payfortRequestInsertModel = PayfortRequestInsertModel();
+
+ payfortRequestInsertModel.commandType = "SALE";
+ payfortRequestInsertModel.amount = amount;
+ payfortRequestInsertModel.customerEmail = getIt.get().getAuthenticatedUser()!.emailAddress;
+ payfortRequestInsertModel.orderDescription = paymentDescription;
+ payfortRequestInsertModel.serviceID = serviceID;
+ payfortRequestInsertModel.paymentOption = paymentOption;
+ payfortRequestInsertModel.clientRequestID = invoiceId;
+ payfortRequestInsertModel.projectID = projectID;
+ payfortRequestInsertModel.fileNumber = getIt.get().getAuthenticatedUser()!.patientId.toString();
+ payfortRequestInsertModel.customerName = "${getIt.get().getAuthenticatedUser()!.firstName} ${getIt.get().getAuthenticatedUser()!.lastName}";
+ payfortRequestInsertModel.currency = getIt.get().getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED";
+ payfortRequestInsertModel.liveServiceID = liveServiceID;
+ payfortRequestInsertModel.latitude = getIt.get().userLat.toString();
+ payfortRequestInsertModel.longitude = getIt.get().userLong.toString();
+ payfortRequestInsertModel.merchantReference = invoiceId;
+ payfortRequestInsertModel.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
+ payfortRequestInsertModel.language = getIt.get().isArabic() ? "ar" : "en";
+ payfortRequestInsertModel.integrationId = "6"; // 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();
+ }).then((value) async {
+ var valJson = value.toString();
+ print(valJson);
+
+ // // Create PayfortResponseInsertModel (same as Payfort implementation)
+ PayfortResponseInsertModel payfortResponseInsertModel = PayfortResponseInsertModel();
+
+ payfortResponseInsertModel.fortId = value.invoiceTransactions!.first.transactionId ?? "";
+ payfortResponseInsertModel.commandType = "SALE";
+ // payfortResponseInsertModel.amount = paytabsTransactionResponseModel.tranTotal ?? 0;
+ payfortResponseInsertModel.amount = amount;
+ payfortResponseInsertModel.sadadOLP = "";
+ payfortResponseInsertModel.paymentOption = value.invoiceTransactions!.first.paymentGateway ?? "";
+ payfortResponseInsertModel.customerIP = "";
+ payfortResponseInsertModel.eCI = "";
+ payfortResponseInsertModel.responseMessage = value.invoiceTransactions!.first.transactionStatus ?? "";
+ payfortResponseInsertModel.cardNumber = value.invoiceTransactions!.first.cardNumber ?? "";
+ payfortResponseInsertModel.cardBin = "";
+ payfortResponseInsertModel.installmentsNumber = 0;
+ payfortResponseInsertModel.status = (value.invoiceStatus ?? "").toLowerCase() == "paid" ? "14" : "00";
+ payfortResponseInsertModel.merchantRef = value.invoiceId.toString();
+ payfortResponseInsertModel.isRefund = false;
+ payfortResponseInsertModel.remmeberMe = true;
+ payfortResponseInsertModel.reconciliationReference = "";
+
+ // Call response insert API after payment
+ await paytabsResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);
+
+ if ((value.invoiceStatus ?? "").toLowerCase() == "paid") {
+ if (onSuccess != null) {
+ onSuccess(value);
+ }
+ } else {
+ if (onError != null) {
+ onError(LocaleKeys.paymentFailedPleaseTryAgain.tr());
+ }
+ }
+ }).catchError((error) {
+ if (onError != null) {
+ onError(error.message);
+ }
+ });
+ }
+
+ executeApplePayPayment() {
+ MFApplepay.executeApplePayPayment(onInvoiceCreated: (invoiceID) {
+ log(
+ invoiceID.toString(),
+ );
+ }).then((value) {
+ log(
+ value.toString(),
+ );
+ }).catchError((error) {
+ log(error.message);
+ });
+ }
+
+ initApplePayPayment(num invoiceValue) async {
+ await MFSDK.init(MyFatoorahConfig.configAPIKey, ApiConsts.myFatoorahCountry, ApiConsts.myFatoorahEnvironmentType);
+
+ await MFSDK.initSession(MFInitiateSessionRequest(), MFLanguage.ENGLISH).then((value) async {
+ var executePaymentRequest = MFExecutePaymentRequest(invoiceValue: invoiceValue, sessionId: value.sessionId, displayCurrencyIso: MFCurrencyISO.SAUDIARABIA_SAR);
+
+ MFApplepay.setupApplePay(value, executePaymentRequest, MFLanguage.ENGLISH, merchantName: "Dr Sulaiman Al Habib");
+ }).catchError((error) {
+ log(error.message);
+ });
+ }
+
+ Future 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 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);
+ }
+ }
+ },
+ );
+ }
+}
diff --git a/lib/features/occasion_theme/occasion_config_model.dart b/lib/features/occasion_theme/occasion_config_model.dart
new file mode 100644
index 00000000..03bf9392
--- /dev/null
+++ b/lib/features/occasion_theme/occasion_config_model.dart
@@ -0,0 +1,123 @@
+import 'package:flutter/material.dart';
+
+/// Model representing a remotely-configurable "occasion" theme
+/// (e.g. Saudi National Day, Founding Day, Eid, Ramadan, ...).
+///
+/// Everything here is fully data-driven — nothing about a specific
+/// occasion (name, color, dates, banner asset) is hardcoded in the app.
+/// All values are supplied via Firebase Remote Config (or the bundled
+/// default JSON fallback used before the first successful fetch).
+@immutable
+class OccasionConfigModel {
+ /// Unique identifier of the occasion (e.g. "national_day"). Used only
+ /// for logging/analytics — no app logic branches on this value.
+ final String key;
+
+ /// Master kill-switch. When false, the app must look exactly like the
+ /// default/current theme, regardless of any other field below.
+ final bool enabled;
+
+ /// Optional activation window. When both are present, the theme is only
+ /// considered active if `DateTime.now()` falls within [startDate, endDate].
+ /// When null, the [enabled] flag alone controls activation.
+ final DateTime? startDate;
+ final DateTime? endDate;
+
+ /// Hex string (e.g. "#00894A") for the occasion's primary brand color.
+ /// When null, the app's default primary color is preserved.
+ final String? primaryColorHex;
+
+ /// Remote (or bundled asset path) image rendered as a decorative
+ /// background/watermark, drawn using [backgroundImageOpacity].
+ final String? backgroundOpacityImage;
+
+ /// Opacity (0.0 - 1.0) applied to [backgroundOpacityImage].
+ final double backgroundImageOpacity;
+
+ /// Remote (or bundled asset path) image rendered as the occasion's main
+ /// header/banner (e.g. the National Day greeting banner), drawn at full
+ /// opacity on top of [backgroundOpacityImage].
+ final String? headerImage;
+
+ const OccasionConfigModel({
+ required this.key,
+ required this.enabled,
+ this.startDate,
+ this.endDate,
+ this.primaryColorHex,
+ this.backgroundOpacityImage,
+ this.backgroundImageOpacity = 1.0,
+ this.headerImage,
+ });
+
+ /// Fully inert config — identical to the app's current/default look.
+ factory OccasionConfigModel.disabled() => const OccasionConfigModel(
+ key: 'none',
+ enabled: false,
+ startDate: null,
+ endDate: null,
+ primaryColorHex: null,
+ backgroundOpacityImage: null,
+ backgroundImageOpacity: 1.0,
+ headerImage: null,
+ );
+
+ factory OccasionConfigModel.fromJson(Map json) {
+ return OccasionConfigModel(
+ key: (json['key'] as String?) ?? 'none',
+ enabled: (json['enabled'] as bool?) ?? false,
+ startDate: _parseDate(json['start_date']),
+ endDate: _parseDate(json['end_date']),
+ primaryColorHex: json['primary_color'] as String?,
+ backgroundOpacityImage: json['background_opacity_image'] as String?,
+ backgroundImageOpacity: (json['background_image_opacity'] as num?)?.toDouble() ?? 1.0,
+ headerImage: json['header_image'] as String?,
+ );
+ }
+
+ static DateTime? _parseDate(dynamic value) {
+ if (value == null) return null;
+ if (value is String && value.isNotEmpty) {
+ return DateTime.tryParse(value);
+ }
+ return null;
+ }
+
+ /// Whether "now" falls inside the configured activation window.
+ /// If no window is configured, the [enabled] flag alone decides.
+ bool isWithinActiveWindow([DateTime? now]) {
+ final current = now ?? DateTime.now();
+ if (startDate != null && current.isBefore(startDate!)) return false;
+ if (endDate != null && current.isAfter(endDate!)) return false;
+ return true;
+ }
+
+ /// Parsed [Color] from [primaryColorHex], or null if not configured.
+ Color? get primaryColor => _hexToColor(primaryColorHex);
+
+ /// Lighter/translucent variant of [primaryColor] — 11% opacity of the same
+ /// hue (e.g. for chip/badge backgrounds). Derived automatically from
+ /// [primaryColor]; not an independent remote-config field. Null unless
+ /// [primaryColor] is configured.
+ Color? get secondaryColor => primaryColor?.withValues(alpha: 0.11);
+
+ static Color? _hexToColor(String? hex) {
+ if (hex == null || hex.isEmpty) return null;
+ var value = hex.trim().replaceFirst('#', '');
+ if (value.length == 6) value = 'FF$value';
+ final parsed = int.tryParse(value, radix: 16);
+ return parsed != null ? Color(parsed) : null;
+ }
+
+ Map toJson() => {
+ 'key': key,
+ 'enabled': enabled,
+ 'start_date': startDate?.toIso8601String(),
+ 'end_date': endDate?.toIso8601String(),
+ 'primary_color': primaryColorHex,
+ 'background_opacity_image': backgroundOpacityImage,
+ 'background_image_opacity': backgroundImageOpacity,
+ 'header_image': headerImage,
+ };
+}
+
diff --git a/lib/features/occasion_theme/occasion_theme_view_model.dart b/lib/features/occasion_theme/occasion_theme_view_model.dart
new file mode 100644
index 00000000..9dd22b09
--- /dev/null
+++ b/lib/features/occasion_theme/occasion_theme_view_model.dart
@@ -0,0 +1,109 @@
+import 'dart:convert';
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/painting.dart' show Color;
+import 'package:hmg_patient_app_new/features/occasion_theme/occasion_config_model.dart';
+import 'package:hmg_patient_app_new/services/cache_service.dart';
+import 'package:hmg_patient_app_new/services/logger_service.dart';
+import 'package:hmg_patient_app_new/services/remote_config_service.dart';
+import 'package:hmg_patient_app_new/theme/colors.dart';
+
+/// Drives the fully remote-config-based "occasion" theming (National Day,
+/// Founding Day, Eid, Ramadan, ...). Nothing about a specific occasion is
+/// hardcoded here — every color/asset/date comes from [OccasionConfigModel],
+/// which is parsed from Firebase Remote Config.
+///
+/// Mirrors the existing dark-mode pattern in ProfileSettingsViewModel:
+/// a static flag on [AppColors] is kept in sync so every widget using
+/// AppColors.primaryRedColor (even ones with no BuildContext/Provider
+/// access) reflects the active occasion instantly.
+class OccasionThemeViewModel extends ChangeNotifier {
+ static const String _cachedConfigKey = 'cached_occasion_config_json';
+
+ final RemoteConfigService _remoteConfigService;
+ final CacheService _cacheService;
+ final LoggerService _loggerService;
+
+ OccasionThemeViewModel({
+ required RemoteConfigService remoteConfigService,
+ required CacheService cacheService,
+ required LoggerService loggerService,
+ }) : _remoteConfigService = remoteConfigService,
+ _cacheService = cacheService,
+ _loggerService = loggerService;
+
+ OccasionConfigModel _config = OccasionConfigModel.disabled();
+ OccasionConfigModel get config => _config;
+
+ /// True only when enabled AND (if a window is configured) within it.
+ bool get isOccasionActive => _config.enabled && _config.isWithinActiveWindow();
+
+ String? get backgroundOpacityImage => isOccasionActive ? _config.backgroundOpacityImage : null;
+
+ double get backgroundImageOpacity => _config.backgroundImageOpacity;
+
+ /// The occasion's main header/banner image (e.g. National Day greeting
+ /// banner), rendered at full opacity. Null unless an occasion is active.
+ String? get headerImage => isOccasionActive ? _config.headerImage : null;
+
+ /// Lighter/translucent variant of the active occasion's primary color
+ /// (11% opacity) — e.g. for chip/badge backgrounds. Null unless an
+ /// occasion is active.
+ Color? get secondaryColor => isOccasionActive ? _config.secondaryColor : null;
+
+ /// Call once at app startup (before the first frame) to restore the last
+ /// known-good config instantly (offline-safe), then kick off a remote
+ /// fetch in the background.
+ Future initialize() async {
+ _restoreCachedConfig();
+ _applyToAppColors();
+
+ try {
+ await _remoteConfigService.initialize();
+ await refresh();
+ } catch (ex) {
+ _loggerService.logError('OccasionThemeViewModel.initialize error: $ex');
+ }
+ }
+
+ /// Fetches the latest occasion config from Firebase Remote Config and
+ /// applies it. Safe to call again later (e.g. on app resume) to pick up
+ /// changes without requiring an app update.
+ Future refresh() async {
+ try {
+ await _remoteConfigService.fetchAndActivate();
+ final rawJson = _remoteConfigService.occasionConfigRawJson;
+ _config = OccasionConfigModel.fromJson(json.decode(rawJson) as Map);
+ await _cacheService.saveString(key: _cachedConfigKey, value: rawJson);
+ _applyToAppColors();
+ notifyListeners();
+ } catch (ex) {
+ _loggerService.logError('OccasionThemeViewModel.refresh error: $ex');
+ // Keep whatever config was already applied (cached/disabled) — never
+ // let a remote-config failure change the app's appearance unexpectedly.
+ }
+ }
+
+ void _restoreCachedConfig() {
+ try {
+ final cachedJson = _cacheService.getString(key: _cachedConfigKey);
+ if (cachedJson == null || cachedJson.isEmpty) {
+ _config = OccasionConfigModel.disabled();
+ return;
+ }
+ _config = OccasionConfigModel.fromJson(json.decode(cachedJson) as Map);
+ } catch (ex) {
+ _loggerService.logError('OccasionThemeViewModel._restoreCachedConfig error: $ex');
+ _config = OccasionConfigModel.disabled();
+ }
+ }
+
+ /// Keeps AppColors in sync so non-Provider call sites (AppColors.primaryRedColor)
+ /// pick up the occasion color exactly like the existing dark-mode flag does.
+ void _applyToAppColors() {
+ AppColors.isOccasionThemeActive = isOccasionActive;
+ AppColors.occasionPrimaryColor = _config.primaryColor;
+ AppColors.occasionSecondaryColor = _config.secondaryColor;
+ }
+}
+
diff --git a/lib/features/payfort/payfort_repo.dart b/lib/features/payfort/payfort_repo.dart
index 3cd27a9d..6826478c 100644
--- a/lib/features/payfort/payfort_repo.dart
+++ b/lib/features/payfort/payfort_repo.dart
@@ -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>> payfortRequestInsert({required PayfortRequestInsertModel payfortRequestInsertModel});
Future>> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel});
+
+ Future>> 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> tamaraRequestInsert({required TamaraRequestModel tamaraRequestModel}) async {
+ try {
+ GenericApiModel? 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(
+ 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()));
+ }
+ }
}
diff --git a/lib/features/payfort/payfort_view_model.dart b/lib/features/payfort/payfort_view_model.dart
index f567264f..c4f96857 100644
--- a/lib/features/payfort/payfort_view_model.dart
+++ b/lib/features/payfort/payfort_view_model.dart
@@ -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 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 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().isArabic() ? "ar" : "en";
- payfortRequestInsertModel.integrationId = "1";
+ payfortRequestInsertModel.integrationId = "1"; // Payfort integration ID
payfortRequestInsertModel.isSchedule = isScheduleLiveCare;
payfortRequestInsertModel.appointmentDate = appointmentDate;
payfortRequestInsertModel.appointmentNo = appointmentNo;
diff --git a/lib/features/paytabs/paytabs_view_model.dart b/lib/features/paytabs/paytabs_view_model.dart
index 35a924af..35d3c85b 100644
--- a/lib/features/paytabs/paytabs_view_model.dart
+++ b/lib/features/paytabs/paytabs_view_model.dart
@@ -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().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().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 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 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