Compare commits

..

No commits in common. 'main' and 'ambulance_ui' have entirely different histories.

@ -1,165 +1,16 @@
# HMG Patient App
# hmg_patient_app_new
A comprehensive Flutter-based mobile application for HMG (Habib Medical Group) patients,
providing seamless healthcare services and patient management features.
New HMG Patient App
## 📱 Features
## Getting Started
- **Patient Registration & Authentication**: Secure login and registration system
- **Appointment Management**: Book, reschedule, and manage medical appointments
- **Medical Records**: Access to personal health records and medical history
- **Doctor Consultation**: Video consultations and chat with healthcare providers
- **Health Monitoring**: Track vital signs and health metrics
- **Prescription Management**: View and manage prescriptions
- **Payment Integration**: Secure payment processing for medical services
- **Multi-language Support**: Available in English and Arabic
- **Push Notifications**: Real-time updates for appointments and health reminders
- **Calendar Integration**: Sync appointments with device calendar
- **Location Services**: Find nearby hospitals and clinics
This project is a starting point for a Flutter application.
## 🚀 Getting Started
A few resources to get you started if this is your first Flutter project:
### Prerequisites
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
- Flutter SDK (>=3.0.0)
- Dart SDK (>=3.0.0)
- Android Studio / VS Code
- Android SDK (for Android development)
- Xcode (for iOS development, macOS only)
### Installation
1. **Clone the repository:**
```bash
git clone <repository-url>
cd HMG_Patient_App_New
```
2. **Install dependencies:**
```bash
flutter pub get
```
3. **Configure Firebase:**
- Add your `google-services.json` file to `android/app/`
- Add your `GoogleService-Info.plist` file to `ios/Runner/`
4. **Run the application:**
```bash
flutter run
```
## 🏗️ Project Structure
```
lib/
├── core/ # Core utilities and constants
├── extensions/ # Dart extensions
├── features/ # Feature-based modules
├── generated/ # Generated files (localization, etc.)
├── presentation/ # UI screens and widgets
├── routes/ # App navigation and routing
├── services/ # Business logic and API services
├── theme/ # App theming and styling
├── widgets/ # Reusable UI components
├── main.dart # App entry point
└── splashPage.dart # Splash screen
assets/
├── animations/ # Lottie animations
├── fonts/ # Custom fonts (Poppins, Gess Two)
├── images/ # PNG and SVG images
├── json/ # JSON data files
└── langs/ # Localization files
```
## 🛠️ Technologies Used
- **Framework**: Flutter
- **Language**: Dart
- **State Management**: [Your state management solution]
- **Backend Services**: Firebase
- **Authentication**: Firebase Auth
- **Database**: Cloud Firestore
- **Push Notifications**: Firebase Cloud Messaging
- **Maps**: Google Maps
- **Payment**: Amazon PayFort
- **Video Calling**: Flutter Zoom Video SDK
- **Local Storage**: SQLite, Shared Preferences
## 📱 Supported Platforms
- ✅ Android (API level 21+)
- ✅ iOS (iOS 12.0+)
- ✅ Foldable devices support
- ✅ Tablet optimization
## 🌐 Localization
The app supports multiple languages:
- English (en-US)
- Arabic (ar-SA)
## 🔧 Configuration
### Environment Setup
1. **API Keys**: Configure your API keys in the appropriate configuration files
2. **Firebase**: Set up Firebase project and add configuration files
3. **Maps**: Add Google Maps API key
4. **Payment**: Configure PayFort credentials
### Build Variants
- **Debug**: Development build with debugging enabled
- **Release**: Production-ready optimized build
## 📝 Development Guidelines
### Code Style
- Follow Dart/Flutter best practices
- Use consistent naming conventions
- Implement proper error handling
- Write comprehensive documentation
### Testing
```bash
# Run unit tests
flutter test
# Run integration tests
flutter test integration_test/
```
### Building for Production
**Android:**
```bash
flutter build apk --release
# or
flutter build appbundle --release
```
**iOS:**
```bash
flutter build ios --release
```
## 🤝 Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/new-feature`)
3. Commit your changes (`git commit -am 'Add new feature'`)
4. Push to the branch (`git push origin feature/new-feature`)
5. Create a Pull Request
## 📄 License
This project is proprietary software developed for HMG Healthcare Group.
**Built with ❤️ for better healthcare accessibility**
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

@ -0,0 +1,74 @@
{
"agcgw":{
"backurl":"connect-drcn.hispace.hicloud.com",
"url":"connect-drcn.dbankcloud.cn",
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
},
"agcgw_all":{
"CN":"connect-drcn.dbankcloud.cn",
"CN_back":"connect-drcn.hispace.hicloud.com",
"DE":"connect-dre.dbankcloud.cn",
"DE_back":"connect-dre.hispace.hicloud.com",
"RU":"connect-drru.dbankcloud.cn",
"RU_back":"connect-drru.hispace.hicloud.com",
"SG":"connect-dra.dbankcloud.cn",
"SG_back":"connect-dra.hispace.hicloud.com"
},
"client":{
"cp_id":"2640966000002322881",
"product_id":"736430079244816567",
"client_id":"563735388191982656",
"client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF",
"project_id":"736430079244816567",
"app_id":"102857389",
"api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI",
"package_name":"com.ejada.hmg"
},
"oauth_client":{
"client_id":"102857389",
"client_type":1
},
"app_info":{
"app_id":"102857389",
"package_name":"com.ejada.hmg"
},
"service":{
"analytics":{
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn",
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"resource_id":"p1",
"channel_id":""
},
"search":{
"url":"https://search-drcn.cloud.huawei.com"
},
"cloudstorage":{
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
},
"ml":{
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
}
},
"region":"CN",
"configuration_version":"3.0",
"appInfos":[
{
"package_name":"com.ejada.hmg",
"client":{
"app_id":"102857389"
},
"app_info":{
"package_name":"com.ejada.hmg",
"app_id":"102857389"
},
"oauth_client":{
"client_type":1,
"client_id":"102857389"
}
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -248,6 +248,9 @@
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng" />
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="appid=102857389" />
<!--
Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java

@ -1,27 +0,0 @@
//package com.cloud.diplomaticquarterapp
package com.ejada.hmg
import io.flutter.app.FlutterApplication
class Application : FlutterApplication() {
override fun onCreate() {
super.onCreate()
}
}
//import io.flutter.app.FlutterApplication
//import io.flutter.plugin.common.PluginRegistry
//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
//
//class Application : FlutterApplication(), PluginRegistrantCallback {
// override fun onCreate() {
// super.onCreate()
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
// }
//
// override fun registerWith(registry: PluginRegistry?) {
// FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
// }
//}

@ -1,6 +0,0 @@
package com.ejada.hmg
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity : FlutterFragmentActivity()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.cloud.diplomaticquarterapp.whatsapp.WhatsAppCodeActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal">
<FrameLayout
android:id="@+id/publisher_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF9800" />
</LinearLayout>

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal">
<FrameLayout
android:id="@+id/subscriber_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3F51B5" />
<TextView
android:text="Remote"
android:textColor="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/*,@raw/slow_spring_board" />

@ -1,23 +0,0 @@
<resources>
<string name="app_name">HMG Patient App</string>
<string name="geofence_unknown_error">
Unknown error: the Geofence service is not available now.
</string>
<string name="geofence_not_available">
Geofence service is not available now. Go to Settings>Location>Mode and choose High accuracy.
</string>
<string name="geofence_too_many_geofences">
Your app has registered too many geofences.
</string>
<string name="geofence_too_many_pending_intents">
You have provided too many PendingIntents to the addGeofences() call.
</string>
<string name="GEOFENCE_INSUFFICIENT_LOCATION_PERMISSION">
App do not have permission to access location service.
</string>
<string name="GEOFENCE_REQUEST_TOO_FREQUENT">
Geofence requests happened too frequently.
</string>
<string name="mapbox_access_token" translatable="false">sk.eyJ1IjoicndhaWQiLCJhIjoiY2x6NWo0bTMzMWZodzJrcGZpemYzc3Z4dSJ9.uSSZuwNSGCcCdPAiORECmg</string>
</resources>

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 543 KiB

@ -1,5 +0,0 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.88966 2.26044H6.1556C6.54339 2.26042 6.87763 2.2604 7.1452 2.29638C7.43199 2.33494 7.7069 2.42189 7.92987 2.64486C8.15285 2.86784 8.2398 3.14275 8.27836 3.42953C8.30096 3.59766 8.30936 3.79206 8.31247 4.00954C8.31248 4.01004 8.31288 4.01044 8.31338 4.01044C8.31369 4.01044 8.31396 4.0106 8.31413 4.01083C8.31413 4.01063 8.31423 4.01098 8.31413 4.01083L8.31429 6.19794C8.31429 6.43957 8.51017 6.63544 8.75179 6.63544C8.99342 6.63544 9.18929 6.43957 9.18929 6.19794V4.20362C9.18929 4.10493 9.2722 4.02578 9.37041 4.03551C9.63863 4.06206 9.88036 4.11895 10.1131 4.2507C10.3443 4.38162 10.5211 4.56074 10.6893 4.77855C10.8614 5.00128 11.0127 5.23986 11.1635 5.47761L11.164 5.4784C11.1889 5.51758 11.2137 5.55673 11.2386 5.59579C11.5034 6.01096 11.8302 6.35342 12.2362 6.63158C12.6288 6.90049 12.9411 7.11434 13.1141 7.46714C13.2034 7.64923 13.24 7.83466 13.2568 8.03171C13.2597 8.06529 13.2329 8.09377 13.1992 8.09377H12.6893C12.4477 8.09377 12.2518 8.28965 12.2518 8.53127C12.2518 8.7729 12.4477 8.96877 12.6893 8.96877H12.9207C13.0883 8.96877 13.1722 8.96877 13.2238 9.02251C13.2755 9.07625 13.2722 9.15762 13.2658 9.32036C13.2616 9.42578 13.2549 9.52356 13.244 9.61307C13.2135 9.86447 13.1447 10.1138 12.9593 10.3235C12.7687 10.5391 12.5059 10.6479 12.2248 10.6872C12.1439 10.6985 12.0789 10.625 12.0886 10.5439C12.0989 10.4578 12.1042 10.3701 12.1042 10.2813C12.1042 9.07315 11.1249 8.09377 9.91675 8.09377C8.71731 8.09377 7.72602 9.09672 7.72928 10.2935C7.73046 10.5082 7.73105 10.6156 7.67973 10.6672C7.62842 10.7188 7.53389 10.7188 7.34482 10.7188H6.65534C6.46628 10.7188 6.37175 10.7188 6.32043 10.6672C6.26912 10.6156 6.26971 10.5082 6.27088 10.2935C6.27415 9.09672 5.28286 8.09377 4.08342 8.09377C2.87529 8.09377 1.89592 9.07315 1.89592 10.2813C1.89592 10.4083 1.90675 10.5328 1.92753 10.6539C1.93036 10.6704 1.9166 10.6851 1.90005 10.6828C1.61327 10.6443 1.33836 10.5573 1.11539 10.3344C0.892408 10.1114 0.805457 9.83647 0.766899 9.54969C0.730924 9.28211 0.73094 8.94798 0.730958 8.56018V4.41914C0.73094 4.03135 0.730924 3.69711 0.766899 3.42953C0.805457 3.14275 0.892408 2.86784 1.11539 2.64486C1.33836 2.42189 1.61327 2.33494 1.90005 2.29638C2.16763 2.2604 2.50187 2.26042 2.88966 2.26044ZM5.10596 4.44794C5.10596 4.20631 4.91008 4.01044 4.66846 4.01044C4.42683 4.01044 4.23096 4.20631 4.23096 4.44794V5.17711H3.50179C3.26017 5.17711 3.06429 5.37298 3.06429 5.61461C3.06429 5.85623 3.26017 6.05211 3.50179 6.05211H4.23096V6.78127C4.23096 7.0229 4.42683 7.21877 4.66846 7.21877C4.91008 7.21877 5.10596 7.0229 5.10596 6.78127V6.05211H5.83513C6.07675 6.05211 6.27263 5.85623 6.27263 5.61461C6.27263 5.37298 6.07675 5.17711 5.83513 5.17711H5.10596V4.44794Z" fill="#2E3039"/>
<path d="M11.3757 10.2813C11.3757 11.0867 10.7227 11.7396 9.91732 11.7396C9.1119 11.7396 8.45898 11.0867 8.45898 10.2813C8.45898 9.47586 9.1119 8.82294 9.91732 8.82294C10.7227 8.82294 11.3757 9.47586 11.3757 10.2813Z" fill="#2E3039"/>
<path d="M4.08399 11.7396C4.8894 11.7396 5.54232 11.0867 5.54232 10.2813C5.54232 9.47586 4.8894 8.82294 4.08399 8.82294C3.27857 8.82294 2.62565 9.47586 2.62565 10.2813C2.62565 11.0867 3.27857 11.7396 4.08399 11.7396Z" fill="#2E3039"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

@ -1,6 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9 3.75C9 2.09315 10.3431 0.75 12 0.75C13.6569 0.75 15 2.09315 15 3.75C15 4.82282 14.4369 5.76411 13.5901 6.29442C16.5251 6.71056 18.309 9.97478 17.1349 12.8582C16.8794 13.4857 16.2803 13.9167 15.5919 13.9167H15.0998L14.272 17.4022C14.019 18.4673 13.0967 19.25 12 19.25C10.9033 19.25 9.98103 18.4673 9.72805 17.4022L8.9002 13.9167L8.40809 13.9167C7.71969 13.9167 7.12056 13.4857 6.86508 12.8582C5.69103 9.97478 7.47495 6.71056 10.4099 6.29442C9.56313 5.76411 9 4.82282 9 3.75Z" fill="white"/>
<path d="M7 15.25H6C5.44772 15.25 5 15.6977 5 16.25C5 16.8023 5.44772 17.25 6 17.25H7C7.55228 17.25 8 16.8023 8 16.25C8 15.6977 7.55228 15.25 7 15.25Z" fill="white"/>
<path d="M17 15.25C16.4477 15.25 16 15.6977 16 16.25C16 16.8023 16.4477 17.25 17 17.25H18C18.5523 17.25 19 16.8023 19 16.25C19 15.6977 18.5523 15.25 18 15.25H17Z" fill="white"/>
<path d="M13 21.25C13 20.6977 12.5523 20.25 12 20.25C11.4477 20.25 11 20.6977 11 21.25V22.25C11 22.8023 11.4477 23.25 12 23.25C12.5523 23.25 13 22.8023 13 22.25V21.25Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

@ -1,7 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.0493 1.25C14.7141 1.24997 15.287 1.24994 15.7457 1.31161C16.2373 1.37771 16.7086 1.52677 17.0908 1.90902C17.4731 2.29126 17.6222 2.76253 17.6883 3.25416C17.7499 3.7129 17.7499 4.28574 17.7499 4.95059V6.04937C17.7499 6.71423 17.7499 7.28712 17.6883 7.74585C17.6222 8.23749 17.4731 8.70875 17.0908 9.091C16.7086 9.47324 16.2373 9.6223 15.7457 9.6884C15.287 9.75008 14.7141 9.75004 14.0492 9.75001L13.2269 9.75001L10.4159 11.624C10.1857 11.7775 9.88983 11.7918 9.64597 11.6613C9.4021 11.5307 9.24986 11.2766 9.24986 11V9.7469C8.87641 9.74158 8.54263 9.7272 8.25402 9.6884C7.76238 9.6223 7.29112 9.47324 6.90887 9.091C6.52662 8.70875 6.37756 8.23749 6.31147 7.74585C6.24979 7.28712 6.24982 6.71427 6.24986 6.04943V4.95063C6.24982 4.28579 6.24979 3.7129 6.31147 3.25416C6.37756 2.76253 6.52662 2.29126 6.90887 1.90902C7.29112 1.52677 7.76238 1.37771 8.25402 1.31161C8.71274 1.24994 9.28556 1.24997 9.95039 1.25L14.0493 1.25Z" fill="white"/>
<path d="M3.17258 18.1177C4.89963 16.9608 7.10028 16.9608 8.82733 18.1177C9.13739 18.3137 9.84338 18.7614 10.2141 19.1697C10.4495 19.4288 10.6975 19.7967 10.7428 20.2626C10.7914 20.7627 10.5934 21.2221 10.2316 21.6099C9.68447 22.1963 8.95287 22.75 7.95957 22.75H4.04034C3.04704 22.75 2.31543 22.1963 1.76831 21.6099C1.40651 21.2221 1.20853 20.7627 1.25712 20.2626C1.30239 19.7967 1.55044 19.4288 1.78577 19.1697C2.15652 18.7614 2.86252 18.3137 3.17258 18.1177Z" fill="white"/>
<path d="M20.8273 18.1177C19.1003 16.9608 16.8996 16.9608 15.1726 18.1177C14.8625 18.3137 14.1565 18.7614 13.7858 19.1697C13.5504 19.4288 13.3024 19.7967 13.2571 20.2626C13.2085 20.7627 13.4065 21.2221 13.7683 21.6099C14.3154 22.1963 15.047 22.75 16.0403 22.75H19.9596C20.9529 22.75 21.6845 22.1963 22.2316 21.6099C22.5934 21.2221 22.7914 20.7627 22.7428 20.2626C22.6975 19.7967 22.4495 19.4288 22.2141 19.1697C21.8434 18.7614 21.1374 18.3137 20.8273 18.1177Z" fill="white"/>
<path d="M3.24986 13.5C3.24986 11.9812 4.48107 10.75 5.99986 10.75C7.51864 10.75 8.74986 11.9812 8.74986 13.5C8.74986 15.0188 7.51864 16.25 5.99986 16.25C4.48107 16.25 3.24986 15.0188 3.24986 13.5Z" fill="white"/>
<path d="M17.9999 10.75C16.4811 10.75 15.2499 11.9812 15.2499 13.5C15.2499 15.0188 16.4811 16.25 17.9999 16.25C19.5186 16.25 20.7499 15.0188 20.7499 13.5C20.7499 11.9812 19.5186 10.75 17.9999 10.75Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

@ -1,5 +0,0 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.49411 2.85661C9.06887 2.71829 8.56575 2.71849 7.82926 2.71878L5.20973 2.7188C4.36011 2.71878 3.66581 2.71877 3.11767 2.79255C2.5447 2.86967 2.04795 3.03656 1.65143 3.43352C1.25491 3.83049 1.0882 4.32779 1.01117 4.90139C0.93747 5.45014 0.937484 6.14521 0.9375 6.99576V10.0798C0.937484 10.9303 0.93747 11.6254 1.01117 12.1741C1.0882 12.7477 1.25491 13.245 1.65143 13.642C1.76583 13.7565 1.89283 13.8531 2.02893 13.9345C2.22063 14.0492 2.31647 14.1065 2.39389 14.059C2.47131 14.0115 2.46224 13.8786 2.44411 13.6127C2.43973 13.5484 2.4375 13.4836 2.4375 13.4181C2.4375 11.8631 3.6967 10.6025 5.25 10.6025C6.8033 10.6025 8.0625 11.8631 8.0625 13.4181C8.0625 13.5947 8.04626 13.7675 8.01519 13.9351C7.97875 14.1317 7.96053 14.23 8.00499 14.2841C8.04945 14.3381 8.14092 14.3389 8.32387 14.3406C8.77449 14.3448 9.22551 14.3448 9.67614 14.3406C9.85908 14.3389 9.95055 14.3381 9.99501 14.2841C10.0395 14.23 10.0213 14.1317 9.98481 13.9351C9.95374 13.7675 9.9375 13.5947 9.9375 13.4181C9.9375 11.8631 11.1967 10.6025 12.75 10.6025C14.3033 10.6025 15.5625 11.8631 15.5625 13.4181C15.5625 13.4835 15.5603 13.5484 15.5559 13.6127C15.5378 13.8786 15.5287 14.0115 15.6061 14.059C15.6835 14.1065 15.7794 14.0492 15.9711 13.9345C16.1072 13.8531 16.2342 13.7565 16.3486 13.642C16.7451 13.245 16.9118 12.7477 16.9888 12.1741C17.0625 11.6254 17.0625 10.9303 17.0625 10.0798V8.55433C17.0654 8.4286 17.0367 8.30042 16.9729 8.18177L15.9988 6.37069C15.7544 5.91626 15.5451 5.52708 15.3388 5.22173C15.1184 4.89536 14.8689 4.61351 14.5195 4.40455C14.17 4.19558 13.8038 4.10932 13.4123 4.06973C13.046 4.0327 12.6044 4.03272 12.0889 4.03274L11.2524 4.03274C11.1353 4.03274 11.0767 4.03274 11.0295 4.00933C10.9823 3.98592 10.9424 3.93349 10.8626 3.82864C10.5202 3.37853 10.0455 3.03597 9.49411 2.85661ZM11.7406 5.53441C11.5945 5.53441 11.5214 5.53441 11.4773 5.57901C11.4333 5.62362 11.4342 5.69802 11.4359 5.84684C11.4377 5.99664 11.4376 6.15736 11.4375 6.33106C11.4375 6.93389 11.4444 7.20613 11.4834 7.32612C11.5761 7.61185 11.7999 7.83587 12.0853 7.92871C12.2052 7.96769 12.3728 7.97464 12.975 7.97464H14.6556C14.8798 7.97464 14.9919 7.97464 15.0355 7.90148C15.0792 7.82832 15.026 7.72952 14.9197 7.53192L14.6949 7.11386C14.429 6.61959 14.2551 6.29803 14.0963 6.06291C13.9469 5.84183 13.845 5.75037 13.7503 5.69375C13.6556 5.63714 13.5268 5.59062 13.2616 5.5638C12.9795 5.53529 12.6142 5.53441 12.0535 5.53441H11.7406ZM4.5001 5.53125C4.91431 5.53125 5.2501 5.86704 5.2501 6.28125V7.78125C5.2501 8.19546 4.91431 8.53125 4.5001 8.53125C4.08589 8.53125 3.7501 8.19546 3.7501 7.78125V6.28125C3.7501 5.86704 4.08589 5.53125 4.5001 5.53125ZM7.5001 5.53125C7.91431 5.53125 8.2501 5.86704 8.2501 6.28125V7.78125C8.2501 8.19546 7.91431 8.53125 7.5001 8.53125C7.08589 8.53125 6.7501 8.19546 6.7501 7.78125V6.28125C6.7501 5.86704 7.08589 5.53125 7.5001 5.53125Z" fill="#2E3039"/>
<path d="M5.25 11.5312C4.21447 11.5312 3.375 12.3707 3.375 13.4062C3.375 14.4418 4.21447 15.2812 5.25 15.2812C6.28553 15.2812 7.125 14.4418 7.125 13.4062C7.125 12.3707 6.28553 11.5312 5.25 11.5312Z" fill="#2E3039"/>
<path d="M12.75 11.5312C11.7145 11.5312 10.875 12.3707 10.875 13.4062C10.875 14.4418 11.7145 15.2812 12.75 15.2812C13.7855 15.2812 14.625 14.4418 14.625 13.4062C14.625 12.3707 13.7855 11.5312 12.75 11.5312Z" fill="#2E3039"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 10 KiB

@ -1,4 +0,0 @@
<svg width="10" height="13" viewBox="0 0 10 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2.85449C3.79188 2.85449 2.8125 3.83387 2.8125 5.04199C2.8125 6.25011 3.79188 7.22949 5 7.22949C6.20812 7.22949 7.1875 6.25011 7.1875 5.04199C7.1875 3.83387 6.20812 2.85449 5 2.85449ZM3.6875 5.04199C3.6875 4.31712 4.27513 3.72949 5 3.72949C5.72487 3.72949 6.3125 4.31712 6.3125 5.04199C6.3125 5.76687 5.72487 6.35449 5 6.35449C4.27513 6.35449 3.6875 5.76687 3.6875 5.04199Z" fill="#ED1C2B"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 0.229492C2.38798 0.229492 0.1875 2.42783 0.1875 5.09268C0.1875 7.8228 2.43772 9.64709 4.31579 10.8329L4.32334 10.8377L4.33107 10.8422C4.5346 10.9593 4.76514 11.0212 5 11.0212C5.23486 11.0212 5.4654 10.9593 5.66893 10.8422L5.67567 10.8383L5.68227 10.8342C7.56769 9.65737 9.8125 7.81358 9.8125 5.09268C9.8125 2.42783 7.61202 0.229492 5 0.229492ZM1.0625 5.09268C1.0625 2.90553 2.87676 1.10449 5 1.10449C7.12324 1.10449 8.9375 2.90553 8.9375 5.09268C8.9375 7.29808 7.10717 8.91207 5.22662 10.0871C5.15694 10.1259 5.079 10.1462 5 10.1462C4.92132 10.1462 4.84369 10.1261 4.77422 10.0876C2.89372 8.89884 1.0625 7.30546 1.0625 5.09268Z" fill="#ED1C2B"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -455,8 +455,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 3A359E86ZF;
ENABLE_BITCODE = NO;
@ -469,7 +467,6 @@
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
@ -640,9 +637,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_ENTITLEMENTS = Runner/RunnerDebug.entitlements;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 3A359E86ZF;
ENABLE_BITCODE = NO;
@ -655,7 +650,6 @@
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@ -670,8 +664,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 3A359E86ZF;
ENABLE_BITCODE = NO;
@ -684,7 +676,6 @@
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
@ -702,7 +693,7 @@
331C808A294A63A400263BE5 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
defaultConfigurationName = Release;
};
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
@ -712,7 +703,7 @@
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
@ -722,7 +713,7 @@
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

@ -1,22 +1,21 @@
import Flutter
import UIKit
//import FirebaseCore
//import FirebaseMessaging
import GoogleMaps
import FirebaseCore
import FirebaseMessaging
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey("AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng")
// FirebaseApp.configure()
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:Data){
// Messaging.messaging().apnsToken = deviceToken
Messaging.messaging().apnsToken = deviceToken
super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}
}

@ -88,22 +88,22 @@ class ApiClientImp implements ApiClient {
@override
post(
String endPoint, {
required Map<String, dynamic> body,
required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess,
required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure,
bool isAllowAny = false,
bool isExternal = false,
bool isRCService = false,
bool isPaymentServices = false,
bool bypassConnectionCheck = true,
}) async {
String endPoint, {
required Map<String, dynamic> body,
required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess,
required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure,
bool isAllowAny = false,
bool isExternal = false,
bool isRCService = false,
bool isPaymentServices = false,
bool bypassConnectionCheck = true,
}) async {
String url;
if (isExternal) {
url = endPoint;
} else {
if (isRCService) {
url = ApiConsts.rcBaseUrl + endPoint;
url = RC_BASE_URL + endPoint;
} else {
url = ApiConsts.baseUrl + endPoint;
}
@ -119,8 +119,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')) {
@ -137,9 +136,9 @@ class ApiClientImp implements ApiClient {
body['PatientType'] = PATIENT_TYPE_ID.toString();
}
// TODO : These should be from the appState
if (user != null) {
body['TokenID'] = body['TokenID'] ?? token;
body['PatientID'] = body['PatientID'] ?? user.patientId;
body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] ?? user.outSa : user.outSa;
@ -161,7 +160,7 @@ class ApiClientImp implements ApiClient {
// body['VersionID'] = ApiConsts.appVersionID.toString();
if (!isExternal) {
body['VersionID'] = ApiConsts.appVersionID.toString();
body['VersionID'] = "50.0";
body['Channel'] = ApiConsts.appChannelId.toString();
body['IPAdress'] = ApiConsts.appIpAddress;
body['generalid'] = ApiConsts.appGeneralId;
@ -175,8 +174,7 @@ class ApiClientImp implements ApiClient {
}
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 4772429;
// body['PatientID'] = 1231755;
// body['PatientID'] = 3966014;
// body['PatientTypeID'] = 1;
//
// body['PatientOutSA'] = 0;
@ -184,9 +182,8 @@ class ApiClientImp implements ApiClient {
}
body.removeWhere((key, value) => value == null);
log("uri: ${Uri.parse(url.trim())}");
log("body: ${json.encode(body)}");
log("uri: ${Uri.parse(url.trim())}");
final bool networkStatus = await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck);
@ -202,10 +199,7 @@ class ApiClientImp implements ApiClient {
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
final int statusCode = response.statusCode;
log("uri: ${Uri.parse(url.trim())}");
log("body: ${json.encode(body)}");
log("response.body: ${response.body}");
// log("response.body: ${response.body}");
if (statusCode < 200 || statusCode >= 400) {
onFailure('Error While Fetching data', statusCode, failureType: StatusCodeFailure("Error While Fetching data"));
logApiEndpointError(endPoint, 'Error While Fetching data', statusCode);
@ -216,44 +210,35 @@ class ApiClientImp implements ApiClient {
onSuccess(parsed, statusCode, messageStatus: 1, errorMessage: "");
} else {
onSuccess(parsed, statusCode,
messageStatus: (parsed is Map && parsed.containsKey('MessageStatus')) ? parsed['MessageStatus'] : 1,
errorMessage: (parsed is Map && parsed.containsKey('ErrorEndUserMessage')) ? parsed['ErrorEndUserMessage'] : "");
messageStatus: parsed.contains('MessageStatus') ? parsed['MessageStatus'] : 1, errorMessage: parsed.contains('ErrorEndUserMessage') ? parsed['ErrorEndUserMessage'] : "");
}
} else {
if (parsed['Response_Message'] != null) {
onSuccess(parsed, statusCode,
messageStatus: (parsed is Map && parsed.containsKey('MessageStatus')) ? parsed['MessageStatus'] : 1,
errorMessage: (parsed is Map && parsed.containsKey('ErrorEndUserMessage')) ? parsed['ErrorEndUserMessage'] : "");
onSuccess(parsed, statusCode, messageStatus: parsed['MessageStatus'], errorMessage: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']);
} else {
if (parsed['ErrorType'] == 4) {
//TODO : handle app update
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode,
failureType: AppUpdateFailure("parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']"));
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode, failureType: AppUpdateFailure("parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']"));
logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
}
if (parsed['ErrorType'] == 2) {
// todo_section: handle Logout
// todo: handle Logout
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'],
@ -263,19 +248,16 @@ 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(
"User is not Authenticated",
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),
);
} 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) {
@ -294,6 +276,7 @@ class ApiClientImp implements ApiClient {
logApiEndpointError(endPoint, parsed['ErrorSearchMsg'], statusCode);
}
} else {
onFailure(
parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode,
@ -304,8 +287,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(
@ -356,9 +338,9 @@ class ApiClientImp implements ApiClient {
url = endPoint;
} else {
if (isRCService) {
url = ApiConsts.rcBaseUrl + endPoint;
url = RC_BASE_URL + endPoint;
} else {
url = ApiConsts.baseUrl + endPoint;
url = BASE_URL + endPoint;
}
}
if (queryParams != null) {
@ -369,7 +351,7 @@ class ApiClientImp implements ApiClient {
debugPrint("URL : $url");
// print("Body : ${json.encode(body)}");
if (await Utils.checkConnection(bypassConnectionCheck: true)) {
if (await Utils.checkConnection()) {
final response = await http.get(
Uri.parse(url.trim()),
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},

@ -1,5 +1,9 @@
import 'package:amazon_payfort/amazon_payfort.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:amazon_payfort/amazon_payfort.dart';
var MAX_SMALL_SCREEN = 660;
final OPENTOK_API_KEY = '46209962';
// final OPENTOK_API_KEY = '47464241';
// PACKAGES and OFFERS
var EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/offersdiscounts';
@ -44,7 +48,9 @@ var PHARMACY_REDIRECT_URL = 'https://bit.ly/AlhabibPharmacy';
// var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/';
// RC API URL
// var RC_BASE_URL = 'https://rc.hmg.com/';
var RC_BASE_URL = 'https://rc.hmg.com/';
// var RC_BASE_URL = 'https://rc.hmg.com/test/';
// var RC_BASE_URL = 'https://ms.hmg.com/rc/';
@ -259,6 +265,7 @@ var CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment";
var GENERATE_QR_APPOINTMENT = "Services/Doctors.svc/REST/GenerateQRAppointmentNo";
//URL send email appointment QR
var EMAIL_QR_APPOINTMENT = "Services/Notifications.svc/REST/sendEmailForOnLineCheckin";
//URL check payment status
var CHECK_PAYMENT_STATUS = "Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID";
@ -268,8 +275,14 @@ var CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment";
var HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment";
var ER_CREATE_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_CreateAdvancePaymentForClinic";
var ER_INSERT_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_InsertEROnlinePaymentDetails";
var ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest';
var GENERATE_ANCILLARY_ORDERS_INVOICE = 'Services/Doctors.svc/REST/AutoGenerateAncillaryOrderInvoice';
var IS_ALLOW_ASK_DOCTOR = 'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
var GET_CALL_REQUEST_TYPE = 'Services/Doctors.svc/REST/GetCallRequestType_LOV';
var ADD_VIDA_REQUEST = 'Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart';
@ -295,6 +308,8 @@ var GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_Get
var GET_ER_APPOINTMENT_FEES = 'Services/DoctorApplication.svc/REST/GetERAppointmentFees';
var GET_ER_APPOINTMENT_TIME = 'Services/ER_VirtualCall.svc/REST/GetRestTime';
var CHECK_PATIENT_DERMA_PACKAGE = 'Services/OUTPs.svc/REST/getPatientPackageComponentsForOnlineCheckIn';
var ADD_NEW_CALL_FOR_PATIENT_ER = 'Services/DoctorApplication.svc/REST/NewCallForPatientER';
var GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory';
@ -519,6 +534,12 @@ var ADD_HHC_ORDER_RC = "api/HHC/add";
var GET_ALL_HHC_ORDERS_RC = 'api/hhc/list';
var UPDATE_HHC_ORDER_RC = 'api/hhc/update';
// CMC RC SERVICES
var GET_ALL_CMC_SERVICES_RC = 'api/cmc/getallcmc';
var ADD_CMC_ORDER_RC = 'api/cmc/add';
var GET_ALL_CMC_ORDERS_RC = 'api/cmc/list';
var UPDATE_CMC_ORDER_RC = 'api/cmc/update';
// RRT RC SERVICES
var ADD_RRT_ORDER_RC = "api/rrt/add";
var GET_ALL_RRT_ORDERS_RC = "api/rrt/list";
@ -549,8 +570,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=';
@ -700,24 +720,26 @@ const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo';
const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_InsertUpdate';
var ER_CREATE_ADVANCE_PAYMENT = "services/Doctors.svc/REST/ER_CreateAdvancePaymentForClinic";
//family Files
const FAMILY_FILES = 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus';
const FAMILY_FILES= 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus';
var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatbot_SendMedicationInstructionByWhatsApp';
class ApiConsts {
static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT
static String baseUrl = 'https://hmgwebservices.com/'; // HIS API URL PROD
static String rcBaseUrl = 'https://rc.hmg.com/'; // RC API URL PROD
static String RCBaseUrl = 'https://rc.hmg.com/'; // RC API URL PROD
static String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
static num VERSION_ID = 18.9;
static var payFortEnvironment = FortEnvironment.production;
static var applePayMerchantId = "merchant.com.hmgwebservices";
@ -744,7 +766,7 @@ class ApiConsts {
TAMARA_URL = "https://mdlaboratories.com/tamaralive/Home/Checkout";
GET_TAMARA_INSTALLMENTS_URL = "https://mdlaboratories.com/tamaralive/Home/GetInstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://mdlaboratories.com/tamaralive/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/';
RCBaseUrl = 'https://rc.hmg.com/';
break;
case AppEnvironmentTypeEnum.dev:
baseUrl = "https://uat.hmgwebservices.com/";
@ -754,7 +776,7 @@ class ApiConsts {
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
RCBaseUrl = 'https://rc.hmg.com/test/';
break;
case AppEnvironmentTypeEnum.uat:
baseUrl = "https://uat.hmgwebservices.com/";
@ -764,9 +786,10 @@ class ApiConsts {
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
RCBaseUrl = 'https://rc.hmg.com/test/';
break;
case AppEnvironmentTypeEnum.preProd:
baseUrl = "https://webservices.hmg.com/";
payFortEnvironment = FortEnvironment.production;
applePayMerchantId = "merchant.com.hmgwebservices";
@ -774,7 +797,7 @@ class ApiConsts {
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/';
RCBaseUrl = 'https://rc.hmg.com/';
break;
case AppEnvironmentTypeEnum.qa:
baseUrl = "https://uat.hmgwebservices.com/";
@ -784,7 +807,7 @@ class ApiConsts {
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
RCBaseUrl = 'https://rc.hmg.com/test/';
break;
case AppEnvironmentTypeEnum.staging:
baseUrl = "https://uat.hmgwebservices.com/";
@ -794,7 +817,7 @@ class ApiConsts {
TAMARA_URL = "https://epharmacy.hmg.com/tamara/Home/Checkout";
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
RCBaseUrl = 'https://rc.hmg.com/test/';
break;
}
}
@ -810,7 +833,7 @@ class ApiConsts {
static final String getUserAgreementContent = 'Services/Patients.svc/REST/GetUsageAgreementText';
static final String checkPatientForRegistration = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
static final String checkUserStatus = 'Services/NHIC.svc/REST/GetPatientInfo';
static final String checkUserStatus= 'Services/NHIC.svc/REST/GetPatientInfo';
static final String insertPatientDeviceIMEIData = 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
static final String insertPatientMobileData = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
@ -826,33 +849,8 @@ class ApiConsts {
static final String removeFileFromFamilyMembers = 'Services/Authentication.svc/REST/ActiveDeactive_PatientFile';
static final String acceptAndRejectFamilyFile = 'Services/Authentication.svc/REST/Update_FileStatus';
// Ancillary Order Apis
static final String getOnlineAncillaryOrderList = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderList';
static final String getOnlineAncillaryOrderProcList = 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderProcList';
static final String generateAncillaryOrderInvoice = 'Services/Doctors.svc/REST/AutoGenerateAncillaryOrderInvoice';
static final String autoGenerateAncillaryOrdersInvoice = 'Services/Doctors.svc/REST/AutoGenerateAncillaryOrderInvoice';
static final String getRequestStatusByRequestID = 'Services/PayFort_Serv.svc/REST/GetRequestStatusByRequestID';
//Payment APIs
static final String applePayInsertRequest = "Services/PayFort_Serv.svc/REST/PayFort_ApplePayRequestData_Insert";
static final String createAdvancePayments = 'Services/Patients.svc/REST/HIS_CreateAdvancePayment';
static final String addAdvanceNumberRequest = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest';
// RC COMPREHENSIVE MEDICAL CHECKUP ServIces
static final String allCMCOrdersRc = 'api/cmc/list';
static final String allCMCServicesRc = 'api/cmc/getallcmc';
static final String updateCMCOrder = 'api/cmc/update';
static final String addCMCOrder = 'api/cmc/add';
static final String getHospitalsList = 'Services/Lists.svc/REST/GetProject';
// RC HOME HEALTHCARE ServIces
static final String allHHCOrdersRc = 'api/hhc/list';
static final String allHHCServicesRc = 'api/HHC/getallhhc';
static final String updateHHCOrder = 'api/hhc/update';
static final String addHHCOrder = 'api/HHC/add';
// ************ static values for Api ****************
static final double appVersionID = 19.3;
// static values for Api
static final double appVersionID = 18.7;
static final int appChannelId = 3;
static final String appIpAddress = "10.20.10.20";
static final String appGeneralId = "Cs2020@2016\$2958";

@ -25,7 +25,6 @@ class AppAssets {
static const String download = '$svgBasePath/download.svg';
static const String language = '$svgBasePath/language.svg';
static const String location = '$svgBasePath/location.svg';
static const String pin_location = '$svgBasePath/pin_location.svg';
static const String whatsapp = '$svgBasePath/whatsapp.svg';
static const String card_user = '$svgBasePath/card_user.svg';
static const String habiblogo = '$svgBasePath/habiblogo.svg';
@ -157,7 +156,6 @@ class AppAssets {
static const String activeCheck = '$svgBasePath/active-check.svg';
static const String deleteIcon = '$svgBasePath/delete_icon.svg';
static const String call_ambulance_icon = '$svgBasePath/call_ambulance_icon.svg';
static const String ambulance = '$svgBasePath/ambulance.svg';
static const String nearest_er_icon = '$svgBasePath/nearest_er_icon.svg';
static const String rrt_icon = '$svgBasePath/rrt_icon.svg';
static const String waiting_time_clock = '$svgBasePath/waiting_time_clock.svg';
@ -171,10 +169,6 @@ class AppAssets {
static const String to_arrow = '$svgBasePath/to_arrow.svg';
static const String dual_arrow = '$svgBasePath/to_arrow.svg';
static const String forward_arrow_medium = '$svgBasePath/forward_arrow_medium.svg';
static const String eReferral = '$svgBasePath/e-referral.svg';
static const String comprehensiveCheckup = '$svgBasePath/comprehensive_checkup.svg';
static const String all_payment_method = '$svgBasePath/all_payment_method.svg';
static const String ic_rrt_vehicle = '$svgBasePath/ic_rrt_vehicle.svg';
//bottom navigation//
@ -204,8 +198,6 @@ class AppAssets {
static const String visa = '$pngBasePath/visa.png';
static const String lockIcon = '$pngBasePath/lock-icon.png';
static const String dummy_user = '$pngBasePath/dummy_user.png';
static const String comprehensiveCheckupEn = '$pngBasePath/cc_en.png';
static const String comprehensiveCheckupAr = '$pngBasePath/cc_er.png';
}
class AppAnimations {

@ -56,12 +56,12 @@ class AppState {
}
FutureOr<void> checkIfGMSAvailableOrNot() async {
isGMSAvailable = (await GmsCheck().checkGmsAvailability()) ?? true;
if(Platform.isIOS) {
isGMSAvailable = true;
isGMSAvailable = false;
isAndroid = false;
return;
}
isGMSAvailable = (await GmsCheck().checkGmsAvailability()) ?? true;
}
AuthenticatedUser? getAuthenticatedUser({bool isFamily = false}) {

@ -8,23 +8,17 @@ import 'package:hmg_patient_app_new/features/authentication/authentication_view_
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_repo.dart';
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/common/common_repo.dart';
import 'package:hmg_patient_app_new/features/contact_us/contact_us_repo.dart';
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
import 'package:hmg_patient_app_new/features/doctor_filter/doctor_filter_view_model.dart';
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_repo.dart';
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_repo.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_repo.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_repo.dart';
import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart';
import 'package:hmg_patient_app_new/features/insurance/insurance_repo.dart';
import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/lab_repo.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/location/location_repo.dart';
import 'package:hmg_patient_app_new/features/location/location_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart';
@ -37,8 +31,6 @@ import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_mo
import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart';
import 'package:hmg_patient_app_new/features/radiology/radiology_repo.dart';
import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart';
import 'package:hmg_patient_app_new/features/todo_section/todo_section_repo.dart';
import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
import 'package:hmg_patient_app_new/services/cache_service.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart';
@ -48,6 +40,7 @@ import 'package:hmg_patient_app_new/services/localauth_service.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart';
import 'package:http/http.dart';
import 'package:local_auth/local_auth.dart';
import 'package:logger/web.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -105,37 +98,43 @@ class AppDependencies {
getIt.registerLazySingleton<PrescriptionsRepo>(() => PrescriptionsRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<InsuranceRepo>(() => InsuranceRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<PayfortRepo>(() => PayfortRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<LocalAuthService>(
() => LocalAuthService(loggerService: getIt<LoggerService>(), localAuth: getIt<LocalAuthentication>()),
);
getIt.registerLazySingleton<LocalAuthService>(() => LocalAuthService(loggerService: getIt<LoggerService>(), localAuth: getIt<LocalAuthentication>()));
getIt.registerLazySingleton<HabibWalletRepo>(() => HabibWalletRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<MedicalFileRepo>(() => MedicalFileRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<ImmediateLiveCareRepo>(() => ImmediateLiveCareRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<EmergencyServicesRepo>(() => EmergencyServicesRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<TodoSectionRepo>(() => TodoSectionRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<LocationRepo>(() => LocationRepoImpl(apiClient: getIt()));
getIt.registerLazySingleton<ContactUsRepo>(() => ContactUsRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<HmgServicesRepo>(() => HmgServicesRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
// ViewModels
// Global/shared VMs LazySingleton
getIt.registerLazySingleton<LabViewModel>(() => LabViewModel(labRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt()));
getIt.registerLazySingleton<LabViewModel>(
() => LabViewModel(labRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt()),
);
getIt.registerLazySingleton<RadiologyViewModel>(
() => RadiologyViewModel(
radiologyRepo: getIt(),
errorHandlerService: getIt(),
navigationService: getIt()
),
);
getIt.registerLazySingleton<PrescriptionsViewModel>(() => PrescriptionsViewModel(prescriptionsRepo: getIt(), errorHandlerService: getIt(), navServices: getIt()));
getIt.registerLazySingleton<PrescriptionsViewModel>(
() => PrescriptionsViewModel(
prescriptionsRepo: getIt(),
errorHandlerService: getIt(),
),
);
getIt.registerLazySingleton<InsuranceViewModel>(() => InsuranceViewModel(insuranceRepo: getIt(), errorHandlerService: getIt()));
getIt.registerLazySingleton<InsuranceViewModel>(
() => InsuranceViewModel(
insuranceRepo: getIt(),
errorHandlerService: getIt(),
),
);
getIt.registerLazySingleton<MyAppointmentsViewModel>(
() => MyAppointmentsViewModel(myAppointmentsRepo: getIt(), errorHandlerService: getIt(), appState: getIt()));
() => MyAppointmentsViewModel(myAppointmentsRepo: getIt(), errorHandlerService: getIt(), appState: getIt()),
);
getIt.registerLazySingleton<PayfortViewModel>(
() => PayfortViewModel(
@ -159,13 +158,7 @@ class AppDependencies {
);
getIt.registerLazySingleton<BookAppointmentsViewModel>(
() => BookAppointmentsViewModel(
bookAppointmentsRepo: getIt(),
errorHandlerService: getIt(),
navigationService: getIt(),
myAppointmentsViewModel: getIt(),
locationUtils: getIt(),
dialogService: getIt()),
() => BookAppointmentsViewModel(bookAppointmentsRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt(), myAppointmentsViewModel: getIt(), locationUtils: getIt(), dialogService: getIt()),
);
getIt.registerLazySingleton<ImmediateLiveCareViewModel>(
@ -179,49 +172,34 @@ class AppDependencies {
getIt.registerLazySingleton<AuthenticationViewModel>(
() => AuthenticationViewModel(
authenticationRepo: getIt(),
cacheService: getIt(),
navigationService: getIt(),
dialogService: getIt(),
appState: getIt(),
errorHandlerService: getIt(),
localAuthService: getIt()),
authenticationRepo: getIt(), cacheService: getIt(), navigationService: getIt(), dialogService: getIt(), appState: getIt(), errorHandlerService: getIt(), localAuthService: getIt()),
);
getIt.registerLazySingleton<ProfileSettingsViewModel>(() => ProfileSettingsViewModel());
getIt.registerLazySingleton<DateRangeSelectorRangeViewModel>(() => DateRangeSelectorRangeViewModel());
getIt.registerLazySingleton<DateRangeSelectorRangeViewModel>(
() => DateRangeSelectorRangeViewModel(),
);
getIt.registerLazySingleton<DoctorFilterViewModel>(() => DoctorFilterViewModel());
getIt.registerLazySingleton<DoctorFilterViewModel>(
() => DoctorFilterViewModel(),
);
getIt.registerLazySingleton<AppointmentViaRegionViewmodel>(
() => AppointmentViaRegionViewmodel(navigationService: getIt(), appState: getIt()),
() =>
AppointmentViaRegionViewmodel(
navigationService: getIt(),
appState: getIt(),
),
);
getIt.registerLazySingleton<EmergencyServicesViewModel>(
() => EmergencyServicesViewModel(
locationUtils: getIt(),
navServices: getIt(),
emergencyServicesRepo: getIt(),
appState: getIt(),
errorHandlerService: getIt(),
appointmentRepo: getIt(),
dialogService: getIt()),
);
getIt.registerLazySingleton<LocationViewModel>(
() => LocationViewModel(locationRepo: getIt(), errorHandlerService: getIt()),
);
getIt.registerLazySingleton<ContactUsViewModel>(
() => ContactUsViewModel(contactUsRepo: getIt(), appState: getIt(), errorHandlerService: getIt()),
);
getIt.registerLazySingleton<TodoSectionViewModel>(
() => TodoSectionViewModel(todoSectionRepo: getIt(), errorHandlerService: getIt()),
);
getIt.registerLazySingleton<HmgServicesViewModel>(
() => HmgServicesViewModel(bookAppointmentsRepo: getIt(), hmgServicesRepo: getIt(), errorHandlerService: getIt()),
locationUtils: getIt(),
navServices: getIt(),
emergencyServicesRepo: getIt(),
appState: getIt(),
errorHandlerService: getIt(),
),
);
// Screen-specific VMs Factory

@ -6,19 +6,17 @@ class DateUtil {
/// convert String To Date function
/// [date] String we want to convert
static DateTime convertStringToDate(String? date) {
if (date == null) return DateTime.now();
if (date.isEmpty) return DateTime.now();
const start = "/Date(";
const end = "+0300)";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
return DateTime.fromMillisecondsSinceEpoch(int.parse(
date.substring(startIndex + start.length, endIndex),
))
;
if (date != null) {
const start = "/Date(";
const end = "+0300)";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
return DateTime.fromMillisecondsSinceEpoch(int.parse(
date.substring(startIndex + start.length, endIndex),
));
} else {
return DateTime.now();
}
}
static DateTime convertStringToDateSaudiTimezone(String date, int projectId) {
@ -36,10 +34,10 @@ class DateUtil {
// .add(Duration(hours: 4));
// } else {
return DateTime.fromMillisecondsSinceEpoch(
int.parse(
date.substring(startIndex + start.length, endIndex),
),
isUtc: true)
int.parse(
date.substring(startIndex + start.length, endIndex),
),
isUtc: true)
.add(Duration(hours: 3));
// }
} else {
@ -156,13 +154,7 @@ class DateUtil {
static String getDateFormatted(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) +
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString();
return DateUtil.getWeekDay(dateObj.weekday) + ", " + dateObj.day.toString() + " " + DateUtil.getMonth(dateObj.month) + " " + dateObj.year.toString();
}
static String getISODateFormat(DateTime dateTime) {
@ -358,41 +350,12 @@ class DateUtil {
if (dateTime != null) {
return lang == 'en'
? getWeekDayEnglish(dateTime.weekday) + ", " + getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString()
: getWeekDayArabic(dateTime.weekday) +
", " +
dateTime.day.toString() +
" " +
getMonthArabic(dateTime.month) +
" " +
dateTime.year.toString();
: getWeekDayArabic(dateTime.weekday) + ", " + dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
} else {
return "";
}
}
static String getDateStringForNearestSlot(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) +
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString() +
" " +
dateObj.hour.toString() +
":" +
getMinute(dateObj);
}
static String getMinute(DateTime dateObj) {
if (dateObj.minute == 0) {
return dateObj.minute.toString() + "0";
} else {
return dateObj.minute.toString();
}
}
static String getMonthDayYearLangDateFormatted(DateTime dateTime, String lang) {
if (dateTime != null) {
return lang == 'en'
@ -416,9 +379,7 @@ class DateUtil {
static String getMonthYearLangDateFormatted(DateTime dateTime, String lang) {
if (dateTime != null) {
return lang == 'en'
? getMonth(dateTime.month) + " " + dateTime.year.toString()
: getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
return lang == 'en' ? getMonth(dateTime.month) + " " + dateTime.year.toString() : getMonthArabic(dateTime.month) + " " + dateTime.year.toString();
} else {
return "";
}
@ -525,8 +486,10 @@ class DateUtil {
}
}
extension OnlyDate on DateTime {
DateTime provideDateOnly() {
extension OnlyDate on DateTime{
DateTime provideDateOnly(){
return DateTime(this.year, month, day);
}
}
}

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:easy_localization/easy_localization.dart';
import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
@ -98,7 +96,6 @@ class RequestUtils {
request.patientIdentificationID = request.nationalID = (registeredData.patientIdentificationId ?? 0);
request.dob = registeredData.dob;
request.isRegister = registeredData.isRegister;
log("nationIdText: ${nationIdText}");
} else {
if (fileNo) {
request.patientID = patientId ?? int.parse(nationIdText);
@ -202,8 +199,7 @@ class RequestUtils {
return request;
}
static dynamic getUserSignupCompletionRequest(
{String? fullName, String? emailAddress, GenderTypeEnum? gender, MaritalStatusTypeEnum? maritalStatus}) {
static dynamic getUserSignupCompletionRequest({String? fullName, String? emailAddress, GenderTypeEnum? gender, MaritalStatusTypeEnum? maritalStatus}) {
AppState appState = getIt.get<AppState>();
bool isDubai = appState.getUserRegistrationPayload.patientOutSa == 1 ? true : false;
@ -219,19 +215,11 @@ class RequestUtils {
return {
"Patientobject": {
"TempValue": true,
"PatientIdentificationType": (isDubai
? 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(),
"PatientIdentificationType":
(isDubai ? 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(),
"MobileNumber": appState.getUserRegistrationPayload.patientMobileNumber ?? 0,
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
appState.getUserRegistrationPayload.zipCode == '+966')
? 0
: 1,
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? 0 : 1,
"FirstNameN": isDubai ? "..." : appState.getNHICUserData.firstNameAr,
"FirstName": isDubai ? (names.isNotEmpty ? names[0] : "...") : appState.getNHICUserData.firstNameEn,
"MiddleNameN": isDubai ? "..." : appState.getNHICUserData.secondNameAr,
@ -245,10 +233,7 @@ class RequestUtils {
"eHealthIDField": isDubai ? null : appState.getNHICUserData.healthId,
"DateofBirthN": date,
"EmailAddress": emailAddress,
"SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode ||
appState.getUserRegistrationPayload.zipCode == '+966')
? "1"
: "2",
"SourceType": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? "1" : "2",
"PreferredLanguage": appState.getLanguageCode() == "ar" ? (isDubai ? "1" : 1) : (isDubai ? "2" : 2),
"Marital": isDubai
? (maritalStatus == MaritalStatusTypeEnum.single
@ -262,25 +247,20 @@ class RequestUtils {
? '1'
: '2'),
},
"PatientIdentificationID":
isDubai ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : appState.getNHICUserData.idNumber.toString(),
"PatientIdentificationID": 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')
? 0
: 1,
"PatientOutSA": (appState.getUserRegistrationPayload.zipCode == CountryEnum.saudiArabia.countryCode || appState.getUserRegistrationPayload.zipCode == '+966') ? 0 : 1,
"isDentalAllowedBackend": appState.getUserRegistrationPayload.isDentalAllowedBackend,
"ZipCode": appState.getUserRegistrationPayload.zipCode,
if (!isDubai) "HealthId": appState.getNHICUserData.healthId,
};
}
static Future<FamilyFileRequest> getAddFamilyRequest(
{required String nationalIDorFile, required String mobileNo, required String countryCode}) async {
static Future<FamilyFileRequest> getAddFamilyRequest({required String nationalIDorFile, required String mobileNo, required String countryCode}) async {
FamilyFileRequest request = FamilyFileRequest();
int? loginType = 0;

@ -11,107 +11,20 @@ extension ResponsiveExtension on num {
double get _screenHeight => SizeUtils.height;
/// Check if device is likely a foldable
bool get _isFoldable {
double aspectRatio = _screenWidth / _screenHeight;
// Foldable devices typically have aspect ratios close to 1:1 when unfolded
return (aspectRatio > 0.9 && aspectRatio < 1.1) && (_screenWidth > 700 || _screenHeight > 700);
}
/// Scale text size - enhanced for foldable devices
double get f {
double aspectRatio = _screenWidth / _screenHeight;
double scale = (_screenWidth < _screenHeight ? _screenWidth : _screenHeight) / figmaDesignWidth;
// Enhanced clamping for different device types
double clamp;
if (SizeUtils.deviceType == DeviceType.tablet || _isFoldable) {
// More conservative scaling for tablets and foldables
clamp = (aspectRatio > 1.5 || aspectRatio < 0.67) ? 1.4 : 1.1;
} else {
// Original logic for phones
clamp = (aspectRatio > 1.3 || aspectRatio < 0.77) ? 1.6 : 1.2;
}
if (scale > clamp) scale = clamp;
return this * scale;
}
/// Scale horizontally (width-based) - enhanced for foldable devices
double get w {
double baseScale = (this * _screenWidth) / figmaDesignWidth;
/// Scale horizontally (width-based)
double get w => (this * _screenWidth) / figmaDesignWidth;
if (_isFoldable) {
// For foldables, use more conservative width scaling
double scale = _screenWidth / figmaDesignWidth;
scale = scale.clamp(0.8, 1.4);
return this * scale;
}
return baseScale;
}
/// Scale vertically (height-based)
double get h => (this * _screenHeight) / figmaDesignHeight;
/// Scale vertically (height-based) - enhanced for foldable devices
double get h {
double baseScale = (this * _screenHeight) / figmaDesignHeight;
if (_isFoldable) {
// For foldables, use height-based scaling but with constraints
double scale = (_screenHeight / figmaDesignHeight).clamp(0.8, 1.4);
return this * scale;
}
//radius
double get r => (this * _screenWidth) / figmaDesignWidth;
return baseScale;
}
/// Radius - enhanced for foldable devices
double get r {
double baseScale = (this * _screenWidth) / figmaDesignWidth;
if (_isFoldable) {
// Use the same logic as enhanced width for foldables
double scale = _screenWidth / figmaDesignWidth;
scale = scale.clamp(0.8, 1.4);
return this * scale;
}
return baseScale;
}
// New enhanced getters (additional options)
/// Enhanced font scaling with device-specific adjustments
double get fh {
double baseScale = _screenHeight / figmaDesignHeight;
if (_isFoldable) {
// Special handling for foldable devices - use more conservative scaling
baseScale = baseScale.clamp(0.8, 1.3);
} else if (SizeUtils.deviceType == DeviceType.tablet) {
// Tablet-specific scaling
baseScale = baseScale.clamp(0.9, 1.5);
} else {
// Phone scaling
baseScale = baseScale.clamp(0.8, 1.8);
}
return this * baseScale;
}
/// Adaptive scaling - automatically chooses best scaling method
double get adaptive {
if (_isFoldable) {
return fh;
} else if (SizeUtils.deviceType == DeviceType.tablet) {
return f * 0.9; // Slightly smaller for tablets
}
return f;
}
/// Minimum size constraint (useful for touch targets)
double get minSize {
double scaled = adaptive;
return scaled < 44 ? 44 : scaled; // Minimum 44pt for accessibility
/// Scale text size
double get f {
double scale = _screenWidth / figmaDesignWidth;
if (scale > 1.6) scale = 1.6; // optional clamp for tablets
return this * scale;
}
/// Optional: direct accessors for full width/height
@ -178,7 +91,10 @@ class SizeUtils {
/// Device's Width
static double width = 375;
static void setScreenSize(BoxConstraints constraints, Orientation currentOrientation) {
static void setScreenSize(
BoxConstraints constraints,
Orientation currentOrientation,
) {
boxConstraints = constraints;
orientation = currentOrientation;
@ -214,9 +130,7 @@ class SizeUtils {
}
log("longerSide: $longerSide");
log("shorterSide: $shorterSide");
log("isTablet: $isTablet");
log("isFoldable: $isFoldable");
}
}
@ -226,9 +140,3 @@ bool get isTablet => SizeUtils.deviceType == DeviceType.tablet;
bool get isMobile => SizeUtils.deviceType == DeviceType.mobile;
bool get isDesktop => SizeUtils.deviceType == DeviceType.desktop;
bool get isFoldable {
double aspectRatio = SizeUtils.width / SizeUtils.height;
// Foldable devices typically have aspect ratios close to 1:1 when unfolded
return (aspectRatio > 0.9 && aspectRatio < 1.1) && (SizeUtils.width > 700 || SizeUtils.height > 700);
}

@ -18,8 +18,6 @@ import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
@ -103,13 +101,6 @@ class Utils {
: getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString();
}
static String getDayMonthYearDateFormatted(DateTime? dateTime) {
if (dateTime == null) return "";
return appState.isArabic()
? "${dateTime.day.toString()} ${getMonthArabic(dateTime.month)}, ${dateTime.year.toString()}"
: "${dateTime.day.toString()} ${getMonth(dateTime.month)}, ${dateTime.year.toString()}";
}
/// get month by
/// [month] convert month number in to month name
static getMonth(int month) {
@ -324,8 +315,7 @@ class Utils {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: isSmallWidget ? 0.h : 48.h),
Lottie.asset(AppAnimations.noData,
repeat: false, reverse: false, frameRate: FrameRate(60), width: width.h, height: height.h, fit: BoxFit.fill),
Lottie.asset(AppAnimations.noData, repeat: false, reverse: false, frameRate: FrameRate(60), width: width.h, height: height.h, fit: BoxFit.fill),
SizedBox(height: 16.h),
(noDataText ?? LocaleKeys.noDataAvailable.tr())
.toText16(weight: FontWeight.w500, color: AppColors.greyTextColor, isCenter: true)
@ -341,8 +331,7 @@ class Utils {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Lottie.asset(AppAnimations.loadingAnimation,
repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
Lottie.asset(AppAnimations.loadingAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
SizedBox(height: 8.h),
(loadingText ?? LocaleKeys.loadingText.tr()).toText16(color: AppColors.blackColor, isCenter: true),
SizedBox(height: 8.h),
@ -368,8 +357,7 @@ class Utils {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Lottie.asset(AppAnimations.errorAnimation,
repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
Lottie.asset(AppAnimations.errorAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
SizedBox(height: 8.h),
(loadingText ?? LocaleKeys.loadingText.tr()).toText16(color: AppColors.blackColor),
SizedBox(height: 8.h),
@ -377,21 +365,14 @@ class Utils {
).center;
}
static Widget getWarningWidget({
String? loadingText,
bool isShowActionButtons = false,
Widget? bodyWidget,
Function? onConfirmTap,
Function? onCancelTap,
}) {
static Widget getWarningWidget({String? loadingText, bool isShowActionButtons = false, Widget? bodyWidget, Function? onConfirmTap, Function? onCancelTap}) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Lottie.asset(AppAnimations.warningAnimation,
repeat: false, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
Lottie.asset(AppAnimations.warningAnimation, repeat: false, reverse: false, frameRate: FrameRate(60), width: 128.h, height: 128.h, fit: BoxFit.fill),
SizedBox(height: 8.h),
(loadingText ?? LocaleKeys.loadingText.tr()).toText15(color: AppColors.blackColor, letterSpacing: 0),
(loadingText ?? LocaleKeys.loadingText.tr()).toText14(color: AppColors.blackColor, letterSpacing: 0),
SizedBox(height: 16.h),
bodyWidget ?? SizedBox.shrink(),
SizedBox(height: 16.h),
@ -652,19 +633,17 @@ class Utils {
required String url,
required Color iconColor,
bool isDisabled = false,
double? width,
double? height,
double width = 24,
double height = 24,
}) {
final iconH = height ?? 24.h;
final iconW = width ?? 24.w;
return SvgPicture.network(
url,
colorFilter: ColorFilter.mode(
isDisabled ? iconColor.withOpacity(0.5) : iconColor,
BlendMode.srcIn,
),
width: iconW,
height: iconH,
width: width,
height: height,
);
}
@ -683,7 +662,7 @@ class Utils {
return Container(
decoration: BoxDecoration(
border: border != null ? Border.all(color: AppColors.whiteColor, width: border) : null,
borderRadius: border != null ? BorderRadius.circular(borderRadius ?? 12.r) : null,
borderRadius: border != null ? BorderRadius.circular(borderRadius ?? 0) : null,
),
child: Image.asset(icon, width: iconW, height: iconH, fit: fit),
);
@ -691,27 +670,17 @@ class Utils {
}
/// Widget to build an SVG from network
static Widget buildImgWithNetwork({
required String url,
required Color iconColor,
bool isDisabled = false,
double? width,
double? height,
BoxFit fit = BoxFit.cover,
ImageErrorWidgetBuilder? errorBuilder,
}) {
final iconH = height ?? 24.h;
final iconW = width ?? 24.w;
static Widget buildImgWithNetwork({required String url, required Color iconColor, bool isDisabled = false, double width = 24, double height = 24, BoxFit fit = BoxFit.cover, ImageErrorWidgetBuilder? errorBuilder}) {
return Image.network(
url,
width: iconW,
height: iconH,
width: width,
height: height,
fit: fit,
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);
},
errorBuilder: errorBuilder??(_,__,___){
//todo change the error builder icon that it is returning
return Utils.buildSvgWithAssets(width: width,
height: height,icon: AppAssets.no_visit_icon);
},
);
}
@ -759,17 +728,12 @@ class Utils {
);
}
static Widget getPaymentAmountWithSymbol2(
num habibWalletAmount, {
double iconSize = 14,
double? fontSize,
double? letterSpacing,
FontWeight? fontWeight,
Color iconColor = AppColors.textColor,
Color textColor = AppColors.blackColor,
bool isSaudiCurrency = true,
bool isExpanded = true,
}) {
static Widget getPaymentAmountWithSymbol2(num habibWalletAmount,
{double iconSize = 14,
Color iconColor = AppColors.textColor,
Color textColor = AppColors.blackColor,
bool isSaudiCurrency = true,
bool isExpanded = true}) {
return RichText(
maxLines: 1,
text: TextSpan(
@ -780,13 +744,8 @@ class Utils {
child: Utils.buildSvgWithAssets(icon: AppAssets.saudi_riyal_icon, width: iconSize.h, height: iconSize.h, iconColor: iconColor),
),
TextSpan(
text: NumberFormat.currency(locale: 'en_US', symbol: " ", decimalDigits: 0).format(habibWalletAmount),
style: TextStyle(
color: textColor,
fontSize: fontSize ?? 32.f,
letterSpacing: letterSpacing ?? -4,
fontWeight: fontWeight ?? FontWeight.w600,
height: 1),
text: " $habibWalletAmount",
style: TextStyle(color: textColor, fontSize: 32.f, letterSpacing: -4, fontWeight: FontWeight.w600, height: 1),
),
],
),
@ -828,32 +787,11 @@ class Utils {
static Future<String> createFileFromString(String encodedStr, String ext) async {
Uint8List bytes = base64.decode(encodedStr);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File("$dir/${DateTime.now().millisecondsSinceEpoch}.$ext");
File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext);
await file.writeAsBytes(bytes);
return file.path;
}
///method to be used to get the text as per the langauge of the application
static String getTextWRTCurrentLanguage(String? englishText, String? arabicText) {
String? text = appState.isArabic() ? arabicText : englishText;
return text ?? '';
}
static String formatNumberToInternationalFormat(num number, {String? currencySymbol, int decimalDigit = 0}) {
return NumberFormat.currency(locale: 'en_US', symbol: currencySymbol ?? "", decimalDigits: decimalDigit).format(number);
}
static PatientDoctorAppointmentList? convertToPatientDoctorAppointmentList(HospitalsModel? hospital) {
if (hospital == null) return null;
return PatientDoctorAppointmentList(
filterName: hospital.name,
distanceInKMs: hospital.distanceInKilometers?.toString(),
projectTopName: hospital.name,
projectBottomName: hospital.name,
model: hospital,
isHMC: hospital.isHMC);
}
static bool havePrivilege(int id) {
bool isHavePrivilege = false;
try {

@ -41,14 +41,12 @@ extension EmailValidator on String {
FontWeight? weight,
bool isBold = false,
bool isUnderLine = false,
bool isCenter = false,
int? maxlines,
FontStyle? fontStyle,
TextOverflow? textOverflow,
double letterSpacing = 0}) =>
Text(
this,
textAlign: isCenter ? TextAlign.center : null,
maxLines: maxlines,
overflow: textOverflow,
style: TextStyle(
@ -169,17 +167,16 @@ extension EmailValidator on String {
decoration: isUnderLine ? TextDecoration.underline : null),
);
Widget toText14({
Color? color,
bool isUnderLine = false,
bool isBold = false,
bool isCenter = false,
FontWeight? weight,
int? maxlines,
double? letterSpacing = 0,
double? height,
TextOverflow? textOverflow,
}) =>
Widget toText14(
{Color? color,
bool isUnderLine = false,
bool isBold = false,
bool isCenter = false,
FontWeight? weight,
int? maxlines,
double? letterSpacing = 0,
double? height,
TextOverflow? textOverflow}) =>
Text(
this,
textAlign: isCenter ? TextAlign.center : null,
@ -225,7 +222,6 @@ extension EmailValidator on String {
FontWeight? weight,
TextOverflow? textOverflow,
double? letterSpacing = -0.4,
Color decorationColor =AppColors.errorColor
}) =>
Text(
this,
@ -239,7 +235,6 @@ extension EmailValidator on String {
overflow: textOverflow,
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
decoration: isUnderLine ? TextDecoration.underline : null,
decorationColor: decorationColor
),
);
@ -283,11 +278,11 @@ extension EmailValidator on String {
height: 1, color: color ?? AppColors.blackColor, fontSize: 22.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal),
);
Widget toText24({Color? color, bool isBold = false, bool isCenter = false, FontWeight? fontWeight, double? letterSpacing}) => Text(
Widget toText24({Color? color, bool isBold = false, bool isCenter = false, FontWeight? fontWeight}) => Text(
this,
textAlign: isCenter ? TextAlign.center : null,
style: TextStyle(
height: 23 / 24, color: color ?? AppColors.blackColor, fontSize: 24.f, letterSpacing: letterSpacing??-1, fontWeight: isBold ? FontWeight.bold : fontWeight??FontWeight.normal),
height: 23 / 24, color: color ?? AppColors.blackColor, fontSize: 24.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal),
);
Widget toText26({Color? color, bool isBold = false, double? height, bool isCenter = false, FontWeight? weight, double? letterSpacing}) => Text(

@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:hmg_patient_app_new/extensions/int_extensions.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:shimmer/shimmer.dart';
import 'package:sizer/sizer.dart';
import 'package:smooth_corner/smooth_corner.dart';
@ -18,8 +19,7 @@ extension WidgetExtensions on Widget {
Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this);
Widget paddingSymmetrical(double horizontal, double vertical) =>
Padding(padding: EdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: this);
Widget paddingSymmetrical(double horizontal, double vertical) => Padding(padding: EdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: this);
Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) =>
Padding(padding: EdgeInsetsDirectional.only(start: left, end: right, top: top, bottom: bottom), child: this);
@ -99,7 +99,7 @@ extension WidgetExtensions on Widget {
bool disablePadding = false,
double radius = 20,
Color? color,
Color? borderColor,
Color borderColor = AppColors.buttonColor,
bool disableWidth = false,
bool isAlignment = false}) {
return Container(
@ -110,7 +110,7 @@ extension WidgetExtensions on Widget {
),
color: color,
border: Border.all(
color: borderColor ?? Colors.transparent,
color: borderColor,
width: disableWidth ? 2 : 1,
),
),

@ -245,7 +245,6 @@ class AuthenticationViewModel extends ChangeNotifier {
}
Future<void> _handleNewImeiRegistration() async {
await selectDeviceImei(onSuccess: (dynamic respData) async {
try {
if (respData != null) {
@ -339,7 +338,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_navigationService.pop();
});
},
activationCode: null, //todo_section silent login case halded on the repo itself..
activationCode: null, //todo silent login case halded on the repo itself..
);
}
}

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/location_util.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
@ -104,7 +105,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
List<String> searchedRegionList = [];
List<String> facilityList = ["hmgHospitals", "hmcMedicalClinic"];
List<String> searchedHospitalList = [];
List<PatientDoctorAppointmentList> searchedPatientDoctorAppointmentHospitalsList = [];
List<PatientDoctorAppointmentList>
searchedPatientDoctorAppointmentHospitalsList = [];
List<String> searchedClinicList = [];
PatientDoctorAppointmentList? selectedHospitalForFilters;
@ -112,14 +114,15 @@ class BookAppointmentsViewModel extends ChangeNotifier {
String? selectedClinicForFilters;
bool applyFilters = false;
///variables for laser clinic
List<LaserCategoryType> femaleLaserCategory = [
List<LaserCategoryType> femaleLaserCategory = [
LaserCategoryType(1, 'bodyString'),
LaserCategoryType(2, 'face'),
LaserCategoryType(10, 'bikini'),
LaserCategoryType(10,'bikini'),
LaserCategoryType(11, 'retouch'),
];
List<LaserCategoryType> maleLaserCategory = [
List<LaserCategoryType> maleLaserCategory =[
LaserCategoryType(1, 'body'),
LaserCategoryType(2, 'face'),
LaserCategoryType(11, 'retouch'),
@ -133,13 +136,9 @@ class BookAppointmentsViewModel extends ChangeNotifier {
bool isBodyPartsLoading = false;
int duration = 0;
BookAppointmentsViewModel(
{required this.bookAppointmentsRepo,
required this.errorHandlerService,
required this.navigationService,
required this.myAppointmentsViewModel,
required this.locationUtils,
required this.dialogService}) {
{required this.bookAppointmentsRepo, required this.errorHandlerService, required this.navigationService, required this.myAppointmentsViewModel, required this.locationUtils, required this.dialogService }) {
initBookAppointmentViewModel();
}
@ -288,8 +287,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
Future<void> getLiveCareScheduleClinics({Function(dynamic)? onSuccess, Function(String)? onError}) async {
liveCareClinicsList.clear();
final result =
await bookAppointmentsRepo.getLiveCareScheduleClinics(_appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!);
final result = await bookAppointmentsRepo.getLiveCareScheduleClinics(_appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
@ -311,9 +309,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
Future<void> getLiveCareDoctorsList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
doctorsList.clear();
final result = await bookAppointmentsRepo.getLiveCareDoctorsList(
selectedLiveCareClinic.serviceID!, _appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!,
onError: onError);
final result =
await bookAppointmentsRepo.getLiveCareDoctorsList(selectedLiveCareClinic.serviceID!, _appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!, onError: onError);
result.fold(
(failure) async {
@ -336,15 +333,10 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
//TODO: Make the API dynamic with parameters for ProjectID, isNearest, languageID, doctorId, doctorName
Future<void> getDoctorsList(
{int projectID = 0, bool isNearest = true, int doctorId = 0,
String doctorName = "",
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
Future<void> getDoctorsList({int projectID = 0, bool isNearest = false, int doctorId = 0, String doctorName = "", Function(dynamic)? onSuccess, Function(String)? onError}) async {
doctorsList.clear();
projectID = currentlySelectedHospitalFromRegionFlow != null ? int.parse(currentlySelectedHospitalFromRegionFlow!) : projectID;
final result =
await bookAppointmentsRepo.getDoctorsList(selectedClinic.clinicID ?? 0, projectID, doctorName.isNotEmpty ? false : isNearest, doctorId, doctorName, isContinueDentalPlan: isContinueDentalPlan);
final result = await bookAppointmentsRepo.getDoctorsList(selectedClinic.clinicID ?? 0, projectID, isNearest, doctorId, doctorName, isContinueDentalPlan: isContinueDentalPlan);
result.fold(
(failure) async {
@ -373,13 +365,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
Future<void> getMappedDoctors(
{int projectID = 0,
bool isNearest = false,
int doctorId = 0,
String doctorName = "",
isContinueDentalPlan = false,
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
{int projectID = 0, bool isNearest = false, int doctorId = 0, String doctorName = "", isContinueDentalPlan = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
filteredHospitalList = null;
hospitalList = null;
isRegionListLoading = true;
@ -388,10 +374,10 @@ class BookAppointmentsViewModel extends ChangeNotifier {
final result = await bookAppointmentsRepo.getDoctorsList(selectedClinic.clinicID ?? 0, projectID, isNearest, doctorId, doctorName);
result.fold(
(failure) async {
(failure) async {
onError?.call("No doctors found for the search criteria".needTranslation);
},
(apiResponse) async {
(apiResponse) async {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
@ -415,8 +401,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
Future<void> getDoctorProfile({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await bookAppointmentsRepo
.getDoctorProfile(selectedDoctor.clinicID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, onError: onError);
final result = await bookAppointmentsRepo.getDoctorProfile(selectedDoctor.clinicID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, onError: onError);
result.fold(
(failure) async {},
@ -472,8 +457,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
// :
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));
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();
@ -492,8 +476,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
Map<DateTime, List> _eventsParsed;
final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots(selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0,
selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare,
final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots(
selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare,
onError: onError);
result.fold(
@ -517,8 +501,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
// :
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));
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();
@ -530,10 +513,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
);
}
Future<void> cancelAppointment(
{required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel,
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
Future<void> cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await bookAppointmentsRepo.cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel);
result.fold(
@ -617,15 +597,13 @@ class BookAppointmentsViewModel extends ChangeNotifier {
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
navigationService.pop();
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
LoadingUtils.showFullScreenLoader(
barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
await insertSpecificAppointment(
onError: (err) {},
onSuccess: (apiResp) async {
LoadingUtils.hideFullScreenLoader();
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
LoadingUtils.showFullScreenLoader(
barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
LoadingUtils.hideFullScreenLoader();
Navigator.pushAndRemoveUntil(
@ -715,15 +693,13 @@ class BookAppointmentsViewModel extends ChangeNotifier {
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
navigationService.pop();
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
LoadingUtils.showFullScreenLoader(
barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
await insertSpecificAppointment(
onError: (err) {},
onSuccess: (apiResp) async {
LoadingUtils.hideFullScreenLoader();
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
LoadingUtils.showFullScreenLoader(
barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
LoadingUtils.hideFullScreenLoader();
Navigator.pushAndRemoveUntil(
@ -797,9 +773,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
} else {
filteredHospitalList = RegionList();
var list = isHMG
? hospitalList?.registeredDoctorMap![selectedRegionId]!.hmgDoctorList
: hospitalList?.registeredDoctorMap![selectedRegionId]!.hmcDoctorList;
var list = isHMG ? hospitalList?.registeredDoctorMap![selectedRegionId]!.hmgDoctorList : hospitalList?.registeredDoctorMap![selectedRegionId]!.hmcDoctorList;
if (list != null && list.isEmpty) {
notifyListeners();
@ -882,8 +856,12 @@ class BookAppointmentsViewModel extends ChangeNotifier {
notifyListeners();
}
void setSelections(List<String>? selectedFacilityForFilters, List<String>? selectedRegionForFilters, String? selectedClinicForFilters,
PatientDoctorAppointmentList? selectedHospitalForFilters, bool applyFilters) {
void setSelections(
List<String>? selectedFacilityForFilters,
List<String>? selectedRegionForFilters,
String? selectedClinicForFilters,
PatientDoctorAppointmentList? selectedHospitalForFilters,
bool applyFilters) {
this.selectedFacilityForFilters = selectedFacilityForFilters;
this.selectedClinicForFilters = selectedClinicForFilters;
this.selectedHospitalForFilters = selectedHospitalForFilters;
@ -894,14 +872,17 @@ class BookAppointmentsViewModel extends ChangeNotifier {
void getFiltersFromDoctorList() {
doctorsList.forEach((element) {
if (!searchedRegionList.contains(element.getRegionName(_appState.isArabic()))) {
searchedRegionList.add(element.getRegionName(_appState.isArabic()) ?? "");
if (!searchedRegionList
.contains(element.getRegionName(_appState.isArabic()))) {
searchedRegionList
.add(element.getRegionName(_appState.isArabic()) ?? "");
}
if (!searchedHospitalList.contains(element.projectName)) {
searchedPatientDoctorAppointmentHospitalsList.add(PatientDoctorAppointmentList()
..filterName = element.projectName
..isHMC = element.isHMC
..distanceInKMs = "0");
searchedPatientDoctorAppointmentHospitalsList
.add(PatientDoctorAppointmentList()
..filterName = element.projectName
..isHMC = element.isHMC
..distanceInKMs = "0");
searchedHospitalList.add(element.projectName ?? "");
}
if (!searchedClinicList.contains(element.clinicName)) {
@ -958,15 +939,27 @@ class BookAppointmentsViewModel extends ChangeNotifier {
return doctorsList;
}
var list = doctorsList.where((element) {
var isInSelectedRegion =
(selectedRegionForFilters?.isEmpty == true) ? true : selectedRegionForFilters?.any((region) => region == element.getRegionName(isArabic()));
var shouldApplyFacilityFilter = (selectedFacilityForFilters?.isEmpty == true) ? false : true;
var isHMC = (selectedFacilityForFilters?.isEmpty == true) ? true : selectedFacilityForFilters?.any((item) => item.contains("hmc"));
var isInSelectedClinic = (selectedClinicForFilters == null) ? true : selectedClinicForFilters == element.clinicName;
var isInSelectedHospital = (selectedHospitalForFilters == null) ? true : element.projectName == selectedHospitalForFilters?.filterName;
var isInSelectedRegion = (selectedRegionForFilters?.isEmpty == true)
? true
: selectedRegionForFilters
?.any((region) => region == element.getRegionName(isArabic()));
var shouldApplyFacilityFilter =
(selectedFacilityForFilters?.isEmpty == true) ? false : true;
var isHMC = (selectedFacilityForFilters?.isEmpty == true)
? true
: selectedFacilityForFilters?.any((item) => item.contains("hmc"));
var isInSelectedClinic = (selectedClinicForFilters == null)
? true
: selectedClinicForFilters == element.clinicName;
var isInSelectedHospital = (selectedHospitalForFilters == null)
? true
: element.projectName == selectedHospitalForFilters?.filterName;
var facilityFilter = ((shouldApplyFacilityFilter == true) ? isHMC : true);
return (isInSelectedRegion ?? true) && (facilityFilter ?? true) && isInSelectedClinic && isInSelectedHospital;
return (isInSelectedRegion ?? true) &&
(facilityFilter ?? true) &&
isInSelectedClinic &&
isInSelectedHospital;
}).toList();
return list;
}
@ -1010,8 +1003,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
dentalChiefComplaintsList.clear();
notifyListeners();
int patientID = _appState.isAuthenticated ? _appState.getAuthenticatedUser()!.patientId ?? -1 : -1;
final result = await bookAppointmentsRepo.getDentalChiefComplaintsList(
patientID: patientID, projectID: int.parse(currentlySelectedHospitalFromRegionFlow ?? "0"), clinicID: 17);
final result = await bookAppointmentsRepo.getDentalChiefComplaintsList(patientID: patientID, projectID: int.parse(currentlySelectedHospitalFromRegionFlow ?? "0"), clinicID: 17);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
@ -1059,7 +1051,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
);
}
setBodyType(int bodyType) {
setBodyType(int bodyType){
selectedBodyTypeIndex = bodyType;
selectedCategory = 0;
selectedBodyPartList = [];
@ -1067,33 +1059,33 @@ class BookAppointmentsViewModel extends ChangeNotifier {
notifyListeners();
}
FutureOr<void> getLaserClinic() async {
FutureOr<void> getLaserClinic() async{
isBodyPartsLoading = true;
int id = bodyTypes[selectedBodyTypeIndex][selectedCategory].laserCategoryID;
int projectID = currentlySelectedHospitalFromRegionFlow != null ? int.parse(currentlySelectedHospitalFromRegionFlow!) : 0;
int languageID = _appState.isArabic() ? 1 : 0;
final result = await bookAppointmentsRepo.getLaserClinics(id, projectID, languageID);
result.fold(
(failure) {
(failure) {
isBodyPartsLoading = false;
notifyListeners();
},
(apiResponse) {
isBodyPartsLoading = false;
(apiResponse) {isBodyPartsLoading = false;
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
List<LaserBodyPart> response = apiResponse.data!;
if (response.first.category == 2 || response.first.category == 10) response.remove(response.first);
List<LaserBodyPart> response =apiResponse.data!;
if(response.first.category == 2 || response.first.category == 10 ) response.remove(response.first);
laserBodyPartsList = response;
}
notifyListeners();
notifyListeners();
},
);
}
int getDuration() {
var duration = 0;
var duration = 0;
var lowerUpperLegsList = selectedBodyPartList.where((element) => element.mappingCode == "47" || element.mappingCode == "48")?.toList() ?? [];
var upperLowerArmsList = selectedBodyPartList.where((element) => element.mappingCode == "40" || element.mappingCode == "41")?.toList() ?? [];
@ -1118,25 +1110,21 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
void setSelectedBodyPart(LaserBodyPart part) {
if (selectedBodyPartList.contains(part)) {
if(selectedBodyPartList.contains(part)){
selectedBodyPartList.remove(part);
this.duration = getDuration();
notifyListeners();
} else {
if (this.duration == 90) {
dialogService.showErrorBottomSheet(
message: "Duration can not exceed 90 min".needTranslation,
);
if(this.duration == 90){
dialogService.showErrorBottomSheet(message: "Duration can not exceed 90 min".needTranslation,);
return;
}
selectedBodyPartList.add(part);
var duration = getDuration();
if (duration > 90) {
if(duration > 90){
selectedBodyPartList.remove(part);
dialogService.showErrorBottomSheet(
message: "Duration Exceeds 90 min".needTranslation,
);
dialogService.showErrorBottomSheet(message: "Duration Exceeds 90 min".needTranslation,);
return;
}
this.duration = duration;
@ -1149,10 +1137,10 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
String getLaserProcedureNameWRTLanguage(LaserBodyPart part) {
if (_appState.isArabic()) {
return part.bodyPartN ?? "";
} else {
return part.bodyPart ?? "";
if(_appState.isArabic()){
return part.bodyPartN??"";
}else {
return part.bodyPart??"";
}
}

@ -1,143 +0,0 @@
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/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/req_models/request_insert_coc_item.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_patient_ic_projects.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class ContactUsRepo {
Future<Either<Failure, GenericApiModel<List<GetHMGLocationsModel>>>> getHMGLocations();
Future<Either<Failure, GenericApiModel<List<GetPatientICProjectsModel>>>> getLiveChatProjectsList();
Future<Either<Failure, GenericApiModel<dynamic>>> insertCOCItem({required RequestInsertCOCItem requestInsertCOCItem, PatientAppointmentHistoryResponseModel? patientSelectedAppointment});
}
class ContactUsRepoImp implements ContactUsRepo {
final ApiClient apiClient;
final LoggerService loggerService;
ContactUsRepoImp({required this.apiClient, required this.loggerService});
@override
Future<Either<Failure, GenericApiModel<List<GetHMGLocationsModel>>>> getHMGLocations() async {
Map<String, dynamic> mapDevice = {};
try {
GenericApiModel<List<GetHMGLocationsModel>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_FINDUS_REQUEST,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['ListHMGLocation'];
final hmgLocations = list.map((item) => GetHMGLocationsModel.fromJson(item as Map<String, dynamic>)).toList().cast<GetHMGLocationsModel>();
apiResponse = GenericApiModel<List<GetHMGLocationsModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: hmgLocations,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<GetPatientICProjectsModel>>>> getLiveChatProjectsList() async {
Map<String, dynamic> mapDevice = {};
try {
GenericApiModel<List<GetPatientICProjectsModel>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_LIVECHAT_REQUEST,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['List_PatientICProjects'];
final liveChatProjectsList = list.map((item) => GetPatientICProjectsModel.fromJson(item as Map<String, dynamic>)).toList().cast<GetPatientICProjectsModel>();
apiResponse = GenericApiModel<List<GetPatientICProjectsModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: liveChatProjectsList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<dynamic>>> insertCOCItem({required RequestInsertCOCItem requestInsertCOCItem, PatientAppointmentHistoryResponseModel? patientSelectedAppointment}) async {
final Map<String, dynamic> body = requestInsertCOCItem.toJson();
if (patientSelectedAppointment != null) {
body['AppoinmentNo'] = patientSelectedAppointment.appointmentNo;
body['AppointmentDate'] = patientSelectedAppointment.appointmentDate;
body['ClinicID'] = patientSelectedAppointment.clinicID;
body['ClinicName'] = patientSelectedAppointment.clinicName;
body['DoctorID'] = patientSelectedAppointment.doctorID;
body['DoctorName'] = patientSelectedAppointment.doctorNameObj;
body['ProjectName'] = patientSelectedAppointment.projectName;
}
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
SEND_FEEDBACK,
body: body,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -1,198 +0,0 @@
import 'dart:io';
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/utils/utils.dart';
import 'package:hmg_patient_app_new/features/contact_us/contact_us_repo.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/feedback_type.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/req_models/request_insert_coc_item.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart';
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_patient_ic_projects.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
class ContactUsViewModel extends ChangeNotifier {
ContactUsRepo contactUsRepo;
ErrorHandlerService errorHandlerService;
AppState appState;
bool isHMGLocationsListLoading = false;
bool isHMGHospitalsListSelected = true;
bool isLiveChatProjectsListLoading = false;
bool isSendFeedbackTabSelected = true;
List<GetHMGLocationsModel> hmgHospitalsLocationsList = [];
List<GetHMGLocationsModel> hmgPharmacyLocationsList = [];
List<GetPatientICProjectsModel> liveChatProjectsList = [];
int selectedLiveChatProjectIndex = -1;
List<String> feedbackAttachmentList = [];
PatientAppointmentHistoryResponseModel? patientFeedbackSelectedAppointment;
List<FeedbackType> feedbackTypeList = [
FeedbackType(id: 1, nameEN: "Complaint for appointment", nameAR: 'شكوى على موعد'),
FeedbackType(id: 2, nameEN: "Complaint without appointment", nameAR: 'شكوى بدون موعد'),
FeedbackType(id: 3, nameEN: "Question", nameAR: 'سؤال'),
FeedbackType(id: 4, nameEN: "Appreciation", nameAR: 'تقدير'),
FeedbackType(id: 6, nameEN: "Suggestion", nameAR: 'إقتراح'),
FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'),
];
FeedbackType selectedFeedbackType = FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد');
ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState});
initContactUsViewModel() {
isHMGLocationsListLoading = true;
isHMGHospitalsListSelected = true;
isLiveChatProjectsListLoading = true;
hmgHospitalsLocationsList.clear();
hmgPharmacyLocationsList.clear();
liveChatProjectsList.clear();
feedbackAttachmentList.clear();
selectedFeedbackType = FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد');
setPatientFeedbackSelectedAppointment(null);
getHMGLocations();
notifyListeners();
}
setHMGHospitalsListSelected(bool isSelected) {
isHMGHospitalsListSelected = isSelected;
notifyListeners();
}
setSelectedLiveChatProjectIndex(int index) {
selectedLiveChatProjectIndex = index;
notifyListeners();
}
setIsSendFeedbackTabSelected(bool isSelected) {
isSendFeedbackTabSelected = isSelected;
notifyListeners();
}
setSelectedFeedbackType(FeedbackType feedbackType) {
selectedFeedbackType = feedbackType;
notifyListeners();
}
addFeedbackAttachment(String attachmentPath) {
feedbackAttachmentList.add(attachmentPath);
notifyListeners();
}
removeFeedbackAttachment(String attachmentPath) {
feedbackAttachmentList.remove(attachmentPath);
notifyListeners();
}
setPatientFeedbackSelectedAppointment(PatientAppointmentHistoryResponseModel? appointment) {
patientFeedbackSelectedAppointment = appointment;
notifyListeners();
}
Future<void> getHMGLocations({Function(dynamic)? onSuccess, Function(String)? onError}) async {
isHMGLocationsListLoading = true;
hmgHospitalsLocationsList.clear();
hmgPharmacyLocationsList.clear();
notifyListeners();
final result = await contactUsRepo.getHMGLocations();
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) {
// hmgLocationsList = apiResponse.data!;
for (var location in apiResponse.data!) {
if (location.locationType == 1) {
hmgHospitalsLocationsList.add(location);
} else if (location.locationType == 2) {
hmgPharmacyLocationsList.add(location);
}
}
isHMGLocationsListLoading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> getLiveChatProjectsList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
isLiveChatProjectsListLoading = true;
liveChatProjectsList.clear();
notifyListeners();
final result = await contactUsRepo.getLiveChatProjectsList();
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) {
liveChatProjectsList = apiResponse.data!;
liveChatProjectsList.sort((a, b) => b.distanceInKilometers.compareTo(a.distanceInKilometers));
isLiveChatProjectsListLoading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> insertCOCItem({required String subject, required String message, Function(dynamic)? onSuccess, Function(String)? onError}) async {
RequestInsertCOCItem requestInsertCOCItem = RequestInsertCOCItem();
requestInsertCOCItem.attachment = feedbackAttachmentList.isNotEmpty ? feedbackAttachmentList.first : "";
requestInsertCOCItem.title = subject;
requestInsertCOCItem.details = message;
requestInsertCOCItem.cOCTypeName = selectedFeedbackType.id.toString();
requestInsertCOCItem.formTypeID = selectedFeedbackType.id.toString();
requestInsertCOCItem.mobileNo = "966${Utils.getPhoneNumberWithoutZero(appState.getAuthenticatedUser()!.mobileNumber!)}";
requestInsertCOCItem.isUserLoggedIn = true;
requestInsertCOCItem.projectID = 0;
requestInsertCOCItem.patientName = "${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}";
requestInsertCOCItem.fileName = "";
requestInsertCOCItem.appVersion = ApiConsts.appVersionID;
requestInsertCOCItem.uILanguage = appState.isArabic() ? "ar" : "en"; //TODO Change it to be dynamic
requestInsertCOCItem.browserInfo = Platform.localHostname;
requestInsertCOCItem.deviceInfo = Platform.localHostname;
requestInsertCOCItem.resolution = "400x847";
requestInsertCOCItem.projectID = 0;
requestInsertCOCItem.tokenID = "C0c@@dm!n?T&A&A@Barcha202029582948";
requestInsertCOCItem.identificationNo = int.parse(appState.getAuthenticatedUser()!.patientIdentificationNo!);
if (BASE_URL.contains('uat')) {
requestInsertCOCItem.forDemo = true;
} else {
requestInsertCOCItem.forDemo = false;
}
final result = await contactUsRepo.insertCOCItem(requestInsertCOCItem: requestInsertCOCItem, patientSelectedAppointment: patientFeedbackSelectedAppointment);
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);
}
}
},
);
}
}

@ -1,11 +0,0 @@
class FeedbackType {
final int id;
final String nameEN;
final String nameAR;
FeedbackType({
required this.id,
required this.nameEN,
required this.nameAR,
});
}

@ -1,137 +0,0 @@
class RequestInsertCOCItem {
bool? isUserLoggedIn;
String? mobileNo;
int? identificationNo;
int? patientID;
int? patientOutSA;
int? patientTypeID;
String? tokenID;
String? patientName;
int? projectID;
String? fileName;
String? attachment;
String? uILanguage;
String? browserInfo;
String? cOCTypeName;
String? formTypeID;
String? details;
String? deviceInfo;
String? deviceType;
String? title;
String? resolution;
double? versionID;
int? channel;
int? languageID;
String? iPAdress;
String? generalid;
String? sessionID;
bool? isDentalAllowedBackend;
int? deviceTypeID;
int? patientType;
double? appVersion;
bool? forDemo;
RequestInsertCOCItem(
{this.isUserLoggedIn,
this.mobileNo,
this.identificationNo,
this.patientID,
this.patientOutSA,
this.patientTypeID,
this.tokenID,
this.patientName,
this.projectID,
this.fileName,
this.attachment,
this.uILanguage,
this.browserInfo,
this.cOCTypeName,
this.formTypeID,
this.details,
this.deviceInfo,
this.deviceType,
this.title,
this.resolution,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientType,
this.appVersion,
this.forDemo});
RequestInsertCOCItem.fromJson(Map<String, dynamic> json) {
isUserLoggedIn = json['IsUserLoggedIn'];
mobileNo = json['MobileNo'];
identificationNo = json['IdentificationNo'];
patientID = json['PatientID'];
patientOutSA = json['PatientOutSA'];
patientTypeID = json['PatientTypeID'];
tokenID = json['TokenID'];
patientName = json['PatientName'];
projectID = json['ProjectID'];
fileName = json['FileName'];
attachment = json['Attachment'];
uILanguage = json['UILanguage'];
browserInfo = json['BrowserInfo'];
cOCTypeName = json['COCTypeName'];
formTypeID = json['FormTypeID'];
details = json['Details'];
deviceInfo = json['DeviceInfo'];
deviceType = json['DeviceType'];
title = json['Title'];
resolution = json['Resolution'];
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientType = json['PatientType'];
appVersion = json['AppVersion'];
forDemo = json['ForDemo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['IsUserLoggedIn'] = this.isUserLoggedIn;
data['MobileNo'] = this.mobileNo;
data['IdentificationNo'] = this.identificationNo;
data['PatientID'] = this.patientID;
data['PatientOutSA'] = this.patientOutSA;
data['PatientTypeID'] = this.patientTypeID;
data['TokenID'] = this.tokenID;
data['PatientName'] = this.patientName;
data['ProjectID'] = this.projectID;
data['FileName'] = this.fileName;
data['Attachment'] = this.attachment;
data['UILanguage'] = this.uILanguage;
data['BrowserInfo'] = this.browserInfo;
data['COCTypeName'] = this.cOCTypeName;
data['FormTypeID'] = this.formTypeID;
data['Details'] = this.details;
data['DeviceInfo'] = this.deviceInfo;
data['DeviceType'] = this.deviceType;
data['Title'] = this.title;
data['Resolution'] = this.resolution;
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['PatientType'] = this.patientType;
data['AppVersion'] = this.appVersion;
data['ForDemo'] = this.forDemo;
return data;
}
}

@ -1,80 +0,0 @@
class GetHMGLocationsModel {
dynamic cityID;
String? cityName;
dynamic cityNameN;
dynamic distanceInKilometers;
bool? isActive;
String? latitude;
int? locationID;
String? locationName;
dynamic locationNameN;
dynamic locationType;
String? longitude;
int? pharmacyLocationID;
String? phoneNumber;
int? projectID;
String? projectImageURL;
int? setupID;
dynamic sortOrder;
GetHMGLocationsModel(
{this.cityID,
this.cityName,
this.cityNameN,
this.distanceInKilometers,
this.isActive,
this.latitude,
this.locationID,
this.locationName,
this.locationNameN,
this.locationType,
this.longitude,
this.pharmacyLocationID,
this.phoneNumber,
this.projectID,
this.projectImageURL,
this.setupID,
this.sortOrder});
GetHMGLocationsModel.fromJson(Map<String, dynamic> json) {
cityID = json['CityID'];
cityName = json['CityName'];
cityNameN = json['CityNameN'];
distanceInKilometers = json['DistanceInKilometers'];
isActive = json['IsActive'];
latitude = json['Latitude'];
locationID = json['LocationID'];
locationName = json['LocationName'];
locationNameN = json['LocationNameN'];
locationType = json['LocationType'];
longitude = json['Longitude'];
pharmacyLocationID = json['PharmacyLocationID'];
phoneNumber = json['PhoneNumber'];
projectID = json['ProjectID'];
projectImageURL = json['ProjectImageURL'];
setupID = json['SetupID'];
sortOrder = json['SortOrder'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['CityID'] = this.cityID;
data['CityName'] = this.cityName;
data['CityNameN'] = this.cityNameN;
data['DistanceInKilometers'] = this.distanceInKilometers;
data['IsActive'] = this.isActive;
data['Latitude'] = this.latitude;
data['LocationID'] = this.locationID;
data['LocationName'] = this.locationName;
data['LocationNameN'] = this.locationNameN;
data['LocationType'] = this.locationType;
data['Longitude'] = this.longitude;
data['PharmacyLocationID'] = this.pharmacyLocationID;
data['PhoneNumber'] = this.phoneNumber;
data['ProjectID'] = this.projectID;
data['ProjectImageURL'] = this.projectImageURL;
data['SetupID'] = this.setupID;
data['SortOrder'] = this.sortOrder;
return data;
}
}

@ -1,48 +0,0 @@
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
class GetPatientICProjectsModel {
int? id;
String? projectName;
String? projectNameN;
String? value;
dynamic languageId;
DateTime? createdOn;
String? createdBy;
dynamic editedOn;
dynamic editedBy;
bool? isActive;
dynamic distanceInKilometers;
GetPatientICProjectsModel(
{this.id, this.projectName, this.projectNameN, this.value, this.languageId, this.createdOn, this.createdBy, this.editedOn, this.editedBy, this.distanceInKilometers, this.isActive});
GetPatientICProjectsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
projectName = json['ProjectName'];
projectNameN = json['ProjectNameN'];
value = json['Value'];
languageId = json['LanguageId'];
createdOn = DateUtil.convertStringToDate(json['CreatedOn']);
createdBy = json['CreatedBy'];
editedOn = json['EditedOn'];
editedBy = json['EditedBy'];
isActive = json['IsActive'];
distanceInKilometers = json['DistanceInKilometers'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['ProjectName'] = this.projectName;
data['ProjectNameN'] = this.projectNameN;
data['Value'] = this.value;
data['LanguageId'] = this.languageId;
data['CreatedOn'] = this.createdOn;
data['CreatedBy'] = this.createdBy;
data['EditedOn'] = this.editedOn;
data['EditedBy'] = this.editedBy;
data['IsActive'] = this.isActive;
data['DistanceInKilometers'] = this.distanceInKilometers;
return data;
}
}

@ -1,63 +1,16 @@
import 'dart:developer';
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/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/request_model/PatientER_RC.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/request_model/RRTRequestModel.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/EROnlineCheckInPaymentDetailsResponse.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/ProjectAvgERWaitingTime.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/rrt_procedures_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
import 'package:hmg_patient_app_new/features/emergency_services/model/resp_model/ProjectAvgERWaitingTime.dart';
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_models/rrt_procedures_response_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'models/resp_model/PatientERTransportationMethod.dart';
abstract class EmergencyServicesRepo {
Future<Either<Failure, GenericApiModel<List<RRTProceduresResponseModel>>>> getRRTProcedures(int languageId);
Future<Either<Failure, GenericApiModel<List<RRTProceduresResponseModel>>>> getRRTProcedures();
Future<Either<Failure, GenericApiModel<List<ProjectAvgERWaitingTime>>>> getNearestEr({int? id, int? projectID});
Future<Either<Failure, GenericApiModel<dynamic>>> checkPatientERAdvanceBalance();
Future<Either<Failure, GenericApiModel<List<HospitalsModel>>>> getProjectList();
Future<Either<Failure, GenericApiModel<EROnlineCheckInPaymentDetailsResponse>>> checkPatientERPaymentInformation({int projectID});
Future<Either<Failure, GenericApiModel<dynamic>>> createAdvancePaymentForER(
{required int projectID,
required AuthenticatedUser authUser,
required num paymentAmount,
required String paymentMethodName,
required String paymentReference});
Future<Either<Failure, GenericApiModel<dynamic>>> addAdvanceNumberRequest(
{required String advanceNumber, required String paymentReference, required String appointmentNo});
Future<Either<Failure, GenericApiModel<dynamic>>> getProjectIDFromNFC({required String nfcCode});
Future<Either<Failure, GenericApiModel<dynamic>>> autoGenerateInvoiceERClinic({required int projectID});
Future<Either<Failure, GenericApiModel<List<PatientERTransportationMethod>>>> getTransportationMethods({int? id});
Future<Either<Failure, GenericApiModel<bool>>> submitAmbulanceRequest(PatientER_RC request);
Future<Either<Failure, GenericApiModel<List<AmbulanceRequestOrdersModel>>>> getTransportationOrders({int? id});
Future<Either<Failure, GenericApiModel<bool>>> cancelOrder(int? iD, int patientId);
Future<Either<Failure, GenericApiModel<bool>>> submitRRTRequest(RRTRequestModel request);
Future<Either<Failure, GenericApiModel<RRTServiceData>>> getRRTOrders({int? id});
Future<Either<Failure, GenericApiModel<bool>>> cancelRRTOrder(int? iD);
Future<Either<Failure, GenericApiModel<String>>> getTermsAndCondition();
}
class EmergencyServicesRepoImp implements EmergencyServicesRepo {
@ -82,8 +35,7 @@ class EmergencyServicesRepoImp implements EmergencyServicesRepo {
try {
final list = response['List_ProjectAvgERWaitingTime'];
final clinicsList =
list.map((item) => ProjectAvgERWaitingTime.fromJson(item as Map<String, dynamic>)).toList().cast<ProjectAvgERWaitingTime>();
final clinicsList = list.map((item) => ProjectAvgERWaitingTime.fromJson(item as Map<String, dynamic>)).toList().cast<ProjectAvgERWaitingTime>();
apiResponse = GenericApiModel<List<ProjectAvgERWaitingTime>>(
messageStatus: messageStatus,
statusCode: statusCode,
@ -104,8 +56,8 @@ class EmergencyServicesRepoImp implements EmergencyServicesRepo {
}
@override
Future<Either<Failure, GenericApiModel<List<RRTProceduresResponseModel>>>> getRRTProcedures(int languageId) async {
Map<String, dynamic> mapDevice = {"ProjectID": 15, "languageID":1};
Future<Either<Failure, GenericApiModel<List<RRTProceduresResponseModel>>>> getRRTProcedures() async {
Map<String, dynamic> mapDevice = {};
try {
GenericApiModel<List<RRTProceduresResponseModel>>? apiResponse;
@ -119,8 +71,7 @@ class EmergencyServicesRepoImp implements EmergencyServicesRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['Vida_ProcedureList'];
final proceduresList =
list.map((item) => RRTProceduresResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<RRTProceduresResponseModel>();
final proceduresList = list.map((item) => RRTProceduresResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<RRTProceduresResponseModel>();
apiResponse = GenericApiModel<List<RRTProceduresResponseModel>>(
messageStatus: messageStatus,
@ -140,582 +91,4 @@ class EmergencyServicesRepoImp implements EmergencyServicesRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<PatientERTransportationMethod>>>> getTransportationMethods({int? id}) async {
Map<String, dynamic> mapDevice = {};
try {
GenericApiModel<List<PatientERTransportationMethod>>? apiResponse;
Failure? failure;
await apiClient.get(
"$GET_ALL_TRANSPORTATIONS_RC?patientID=$id",
isRCService: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['response']['transportationservices'];
final proceduresList = list
.map((item) => PatientERTransportationMethod.fromJson(item as Map<String, dynamic>))
.toList()
.cast<PatientERTransportationMethod>();
apiResponse = GenericApiModel<List<PatientERTransportationMethod>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: proceduresList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<HospitalsModel>>>> getProjectList() async {
Map<String, dynamic> request = {};
try {
GenericApiModel<List<HospitalsModel>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_PROJECT_LIST,
body: request,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['ListProject'];
final appointmentsList = list.map((item) => HospitalsModel.fromJson(item as Map<String, dynamic>)).toList().cast<HospitalsModel>();
apiResponse = GenericApiModel<List<HospitalsModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: appointmentsList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<bool>>> submitAmbulanceRequest(PatientER_RC request) async {
try {
GenericApiModel<bool>? apiResponse;
Failure? failure;
await apiClient.post(
body: request.toJson(),
INSERT_TRANSPORTATION_ORDER_RC,
isRCService: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<bool>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: true,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<AmbulanceRequestOrdersModel>>>> getTransportationOrders({int? id}) async {
try {
GenericApiModel<List<AmbulanceRequestOrdersModel>>? apiResponse;
Failure? failure;
await apiClient.post(
body: {},
"$GET_ALL_TRANSPORTATIONS_ORDERS?patientID=$id",
isRCService: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['response'];
final proceduresList =
list.map((item) => AmbulanceRequestOrdersModel.fromJson(item as Map<String, dynamic>)).toList().cast<AmbulanceRequestOrdersModel>();
apiResponse = GenericApiModel<List<AmbulanceRequestOrdersModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: proceduresList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<bool>>> cancelOrder(int? iD, int patientID) async {
try {
GenericApiModel<bool>? apiResponse;
Map<String, dynamic> request = {};
request['Id'] = iD;
request['StatusId'] = 6;
request['ClickButton'] = 14;
request['PatientID'] = patientID;
Failure? failure;
await apiClient.post(
body: request,
CANCEL_AMBULANCE_REQUEST,
isRCService: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<bool>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: true,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> checkPatientERAdvanceBalance() async {
Map<String, dynamic> mapDevice = {"ClinicID": 10};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
CHECK_PATIENT_ER_ADVANCE_BALANCE,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) => failure = failureType,
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final bool patientHasERBalance = response['BalanceAmount'] > 0;
log(patientHasERBalance.toString());
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: patientHasERBalance,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<EROnlineCheckInPaymentDetailsResponse>>> checkPatientERPaymentInformation({int? projectID}) async {
Map<String, dynamic> mapDevice = {"ClinicID": 10, "ProjectID": projectID ?? 0};
try {
GenericApiModel<EROnlineCheckInPaymentDetailsResponse>? apiResponse;
Failure? failure;
await apiClient.post(
GET_ER_ONLINE_PAYMENT_DETAILS,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final erOnlineCheckInPaymentDetailsResponse = EROnlineCheckInPaymentDetailsResponse.fromJson(response["ResponsePatientShare"]);
apiResponse = GenericApiModel<EROnlineCheckInPaymentDetailsResponse>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: erOnlineCheckInPaymentDetailsResponse,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> createAdvancePaymentForER(
{required int projectID,
required AuthenticatedUser authUser,
required num paymentAmount,
required String paymentMethodName,
required String paymentReference}) async {
Map<String, dynamic> mapDevice = {
"LanguageID": 1,
"ERAdvanceAmount": {
"ProjectId": projectID,
"PatientId": authUser.patientId,
"ClinicId": 10,
"DepositorName": "${authUser.firstName!} ${authUser.lastName!}",
"MemberId": authUser.patientId,
"NationalityID": authUser.nationalityId,
"PaymentAmount": paymentAmount,
"PaymentDate": DateUtil.convertDateToString(DateTime.now()),
"PaymentMethodName": paymentMethodName,
"PaymentReferenceNumber": paymentReference,
"SourceType": 2
}
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
ER_CREATE_ADVANCE_PAYMENT,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final vidaAdvanceNumber = response['ER_AdvancePaymentResponse']['AdvanceNumber'].toString();
log(vidaAdvanceNumber);
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: vidaAdvanceNumber,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> addAdvanceNumberRequest(
{required String advanceNumber, required String paymentReference, required String appointmentNo}) async {
Map<String, dynamic> requestBody = {
"AdvanceNumber": advanceNumber,
"AdvanceNumber_VP": advanceNumber,
"PaymentReferenceNumber": paymentReference,
"AppointmentID": appointmentNo,
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
ADD_ADVANCE_NUMBER_REQUEST,
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<dynamic>>> getProjectIDFromNFC({required String nfcCode}) async {
Map<String, dynamic> mapDevice = {"nFC_Code": nfcCode};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
GET_PROJECT_FROM_NFC,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final projectID = response['GetProjectByNFC'][0]["ProjectID"];
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: projectID,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<dynamic>>> autoGenerateInvoiceERClinic({required int projectID}) async {
Map<String, dynamic> mapDevice = {
"ProjectID": projectID,
"ClinicID": "10",
"IsAdvanceAvailable": true,
"MemberID": 102,
"PaymentMethod": "VISA",
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
AUTO_GENERATE_INVOICE_ER,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: true,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<bool>>> submitRRTRequest(RRTRequestModel request) async {
try {
GenericApiModel<bool>? apiResponse;
Failure? failure;
await apiClient.post(
body: request.toJson(),
ADD_RRT_ORDER_RC,
isRCService: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<bool>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: true,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<bool>>> cancelRRTOrder(int? iD) async{
try {
GenericApiModel<bool>? apiResponse;
Map<String, dynamic> request = {"Id": iD, "ClickButton": 14};
Failure? failure;
await apiClient.post(
body: request,
UPDATE_RRT_ORDER_RC,
isRCService: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<bool>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: true,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<RRTServiceData>>> getRRTOrders({int? id}) async {
try {
GenericApiModel<RRTServiceData>? apiResponse;
Failure? failure;
await apiClient.post(
body: {},
GET_ALL_RRT_ORDERS_RC,
isRCService: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['response'];
RRTServiceData serviceData = RRTServiceData();
list.forEach((item) {
if (item["StatusId"] == 1 || item["StatusId"] == 2) {
// Pending
serviceData.pendingOrders.add(GetCMCAllOrdersResponseModel.fromJson(item));
}
serviceData.completedOrders.add(GetCMCAllOrdersResponseModel.fromJson(item));
});
apiResponse = GenericApiModel<RRTServiceData>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: serviceData,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<String>>> getTermsAndCondition() async {
try {
GenericApiModel<String>? apiResponse;
Failure? failure;
await apiClient.post(
body: {},
GET_USER_TERMS,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final agreement = response['UserAgreementContent'];
apiResponse = GenericApiModel<String>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: agreement,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -1,4 +0,0 @@
enum AmbulanceCallingPlace{
FROM_HOSPITAL,
TO_HOSPITAL
}

@ -1,3 +0,0 @@
enum OrderDislpay{
ALL,RRT,AMBULANCE
}

@ -1,3 +0,0 @@
enum AmbulanceDirection{
ONE_WAY, TWO_WAY
}

@ -1,205 +0,0 @@
import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/PatientERTransportationMethod.dart' show PatientERTransportationMethod;
class PatientER_RC {
double? versionID;
int? channel;
int? languageID;
String? iPAdress;
String? generalid;
bool? patientOutSA;
String? sessionID;
bool? isDentalAllowedBackend;
int? deviceTypeID;
int? patientID;
String? tokenID;
int? patientTypeID;
int? patientType;
int? orderServiceID;
String? patientIdentificationID;
dynamic patientOutSa;
int? projectID;
int? lineItemNo;
TransportationDetails? transportationDetails;
PatientERTransportationMethod? patientERTransportationMethod;
PatientER_RC(
{this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID,
this.tokenID,
this.patientTypeID,
this.patientType,
this.orderServiceID,
this.patientIdentificationID,
this.patientOutSa,
this.projectID,
this.lineItemNo,
this.transportationDetails });
PatientER_RC.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientID = json['PatientID'];
tokenID = json['TokenID'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
orderServiceID = json['OrderServiceID'];
patientIdentificationID = json['PatientIdentificationID'];
patientOutSa = json['patientOutSa'];
projectID = json['projectID'];
lineItemNo = json['lineItemNo'];
transportationDetails = json['transportationDetails'] != null
? new TransportationDetails.fromJson(json['transportationDetails'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['PatientID'] = this.patientID;
data['TokenID'] = this.tokenID;
data['PatientTypeID'] = this.patientTypeID;
data['PatientType'] = this.patientType;
data['OrderServiceID'] = this.orderServiceID;
data['PatientIdentificationID'] = this.patientIdentificationID;
data['patientOutSa'] = this.patientOutSa;
data['projectID'] = this.projectID;
data['lineItemNo'] = this.lineItemNo;
if (this.transportationDetails != null) {
data['transportationDetails'] = this.transportationDetails!.toJson();
}
return data;
}
}
class TransportationDetails {
int? direction;
int? haveAppointment;
int? tripType;
int? pickupUrgency;
int? pickupSpot;
String? pickupDateTime;
String? transportationType;
int? ambulate;
String? ambulateTitle;
String? notes;
int? requesterFileNo;
String? requesterMobileNo;
bool? requesterIsOutSA;
String? pickupLocationName;
String? dropoffLocationName;
String? pickupLatitude;
String? pickupLongitude;
String? dropoffLatitude;
String? dropoffLongitude;
String? appointmentNo;
String? appointmentClinicName;
String? appointmentDoctorName;
String? appointmentBranch;
String? appointmentTime;
TransportationDetails(
{this.direction,
this.haveAppointment = 0,
this.tripType,
this.pickupUrgency,
this.pickupSpot,
this.pickupDateTime,
this.transportationType,
this.ambulate,
this.ambulateTitle,
this.notes,
this.requesterFileNo,
this.requesterMobileNo,
this.requesterIsOutSA,
this.pickupLocationName,
this.dropoffLocationName,
this.pickupLatitude,
this.pickupLongitude,
this.dropoffLatitude,
this.dropoffLongitude,
this.appointmentNo = "0",
this.appointmentClinicName = "",
this.appointmentDoctorName = "",
this.appointmentBranch = "",
this.appointmentTime = ""});
TransportationDetails.fromJson(Map<String, dynamic> json) {
direction = json['direction'];
haveAppointment = json['haveAppointment'];
tripType = json['tripType'];
pickupUrgency = json['pickupUrgency'];
pickupSpot = json['pickupSpot'];
pickupDateTime = json['pickupDateTime'];
transportationType = json['transportationType'];
ambulate = json['ambulate'];
ambulateTitle = "";
notes = json['notes'];
requesterFileNo = json['requesterFileNo'];
requesterMobileNo = json['requesterMobileNo'];
requesterIsOutSA = json['requesterIsOutSA'];
pickupLocationName = json['pickupLocationName'];
dropoffLocationName = json['dropoffLocationName'];
pickupLatitude = json['pickup_Latitude'];
pickupLongitude = json['pickup_Longitude'];
dropoffLatitude = json['dropoff_Latitude'];
dropoffLongitude = json['dropoff_Longitude'];
appointmentNo = json['appointmentNo'];
appointmentClinicName = json['appointmentClinicName'];
appointmentDoctorName = json['appointmentDoctorName'];
appointmentBranch = json['appointmentBranch'];
appointmentTime = json['appointmentTime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['direction'] = this.direction;
data['haveAppointment'] = this.haveAppointment;
data['tripType'] = this.tripType;
data['pickupUrgency'] = this.pickupUrgency;
data['pickupSpot'] = this.pickupSpot;
data['pickupDateTime'] = this.pickupDateTime;
data['transportationType'] = this.transportationType;
data['ambulate'] = this.ambulate;
data['ambulateTitle'] = this.ambulateTitle;
data['notes'] = this.notes;
data['requesterFileNo'] = this.requesterFileNo;
data['requesterMobileNo'] = this.requesterMobileNo;
data['requesterIsOutSA'] = this.requesterIsOutSA;
data['pickupLocationName'] = this.pickupLocationName;
data['dropoffLocationName'] = this.dropoffLocationName;
data['pickup_Latitude'] = this.pickupLatitude;
data['pickup_Longitude'] = this.pickupLongitude;
data['dropoff_Latitude'] = this.dropoffLatitude;
data['dropoff_Longitude'] = this.dropoffLongitude;
data['appointmentNo'] = this.appointmentNo;
data['appointmentClinicName'] = this.appointmentClinicName;
data['appointmentDoctorName'] = this.appointmentDoctorName;
data['appointmentBranch'] = this.appointmentBranch;
data['appointmentTime'] = this.appointmentTime;
return data;
}
}

@ -1,75 +0,0 @@
class RRTRequestModel {
num? patientId;
int? patientOutSa;
bool? isOutPatient;
int? nearestProjectId;
num? longitude;
num? latitude;
String? additionalDetails;
String? nationality;
num? paymentAmount;
List<Procedures>? procedures;
RRTRequestModel(
{this.patientId,
this.patientOutSa,
this.isOutPatient,
this.nearestProjectId,
this.longitude,
this.latitude,
this.additionalDetails,
this.nationality,
this.paymentAmount,
this.procedures});
RRTRequestModel.fromJson(Map<String, dynamic> json) {
patientId = json['patientId'];
patientOutSa = json['patientOutSa'];
isOutPatient = json['isOutPatient'];
nearestProjectId = json['nearestProjectId'];
longitude = json['longitude'];
latitude = json['latitude'];
additionalDetails = json['additionalDetails'];
nationality = json['nationality'];
paymentAmount = json['paymentAmount'];
if (json['procedures'] != null) {
procedures = <Procedures>[];
json['procedures'].forEach((v) {
procedures!.add(new Procedures.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['patientId'] = this.patientId;
data['patientOutSa'] = this.patientOutSa;
data['isOutPatient'] = this.isOutPatient;
data['nearestProjectId'] = this.nearestProjectId;
data['longitude'] = this.longitude;
data['latitude'] = this.latitude;
data['additionalDetails'] = this.additionalDetails;
data['nationality'] = this.nationality;
data['paymentAmount'] = this.paymentAmount;
if (this.procedures != null) {
data['procedures'] = this.procedures!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Procedures {
String? serviceID;
Procedures({this.serviceID});
Procedures.fromJson(Map<String, dynamic> json) {
serviceID = json['ServiceID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ServiceID'] = this.serviceID;
return data;
}
}

@ -1,53 +0,0 @@
class ServicePrice {
String? currency;
dynamic maxPrice;
dynamic maxTotalPrice;
dynamic maxVAT;
dynamic minPrice;
dynamic minTotalPrice;
dynamic minVAT;
dynamic price;
dynamic totalPrice;
dynamic vat;
ServicePrice({
this.currency,
this.maxPrice,
this.maxTotalPrice,
this.maxVAT,
this.minPrice,
this.minTotalPrice,
this.minVAT,
this.price,
this.totalPrice,
this.vat});
ServicePrice.fromJson(dynamic json) {
currency = json["Currency"];
maxPrice = json["MaxPrice"];
maxTotalPrice = json["MaxTotalPrice"];
maxVAT = json["MaxVAT"];
minPrice = json["MinPrice"];
minTotalPrice = json["MinTotalPrice"];
minVAT = json["MinVAT"];
price = json["Price"];
totalPrice = json["TotalPrice"];
vat = json["VAT"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["Currency"] = currency;
map["MaxPrice"] = maxPrice;
map["MaxTotalPrice"] = maxTotalPrice;
map["MaxVAT"] = maxVAT;
map["MinPrice"] = minPrice;
map["MinTotalPrice"] = minTotalPrice;
map["MinVAT"] = minVAT;
map["Price"] = price;
map["TotalPrice"] = totalPrice;
map["VAT"] = vat;
return map;
}
}

@ -1,346 +0,0 @@
class AmbulanceRequestOrdersModel {
String? statusText;
num? paymentStatus;
dynamic clientRequestid;
dynamic paymentStatusText;
dynamic projectName;
String? nearestProjectName;
num? paymentAmount;
WFOrder? wFOrder;
String? serviceText;
bool? isSentForApproval;
num? exaCartOrderId;
String? exaCartGUID;
bool? isTimer;
num? timeSeconds;
num? totalPendingSeconds;
num? timeMinute;
num? timeHour;
num? timeTotalSeconds;
num? timeTotalMinute;
num? timeTotalHour;
dynamic approvalStatus;
bool? isActive;
num? clickButton;
dynamic orderHistory;
String? pickupLocation;
String? dropOffLocation;
String? clinicName;
String? doctorName;
String? branch;
String? time;
String? notes;
int? iD;
num? patientId;
num? patientOutSa;
bool? isOutPatient;
num? projectId;
num? nearestProjectId;
dynamic longitude;
dynamic latitude;
dynamic appointmentNo;
dynamic dischargeId;
int? statusId;
num? serviceId;
num? channel;
Orderpayment? orderpayment;
dynamic wforder;
dynamic orderapprovalobj;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
AmbulanceRequestOrdersModel(
{this.statusText,
this.paymentStatus,
this.clientRequestid,
this.paymentStatusText,
this.projectName,
this.nearestProjectName,
this.paymentAmount,
this.wFOrder,
this.serviceText,
this.isSentForApproval,
this.exaCartOrderId,
this.exaCartGUID,
this.isTimer,
this.timeSeconds,
this.totalPendingSeconds,
this.timeMinute,
this.timeHour,
this.timeTotalSeconds,
this.timeTotalMinute,
this.timeTotalHour,
this.approvalStatus,
this.isActive,
this.clickButton,
this.orderHistory,
this.pickupLocation,
this.dropOffLocation,
this.clinicName,
this.doctorName,
this.branch,
this.time,
this.notes,
this.iD,
this.patientId,
this.patientOutSa,
this.isOutPatient,
this.projectId,
this.nearestProjectId,
this.longitude,
this.latitude,
this.appointmentNo,
this.dischargeId,
this.statusId,
this.serviceId,
this.channel,
this.orderpayment,
this.wforder,
this.orderapprovalobj,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted});
AmbulanceRequestOrdersModel.fromJson(Map<String, dynamic> json) {
statusText = json['StatusText'];
paymentStatus = json['PaymentStatus'];
clientRequestid = json['ClientRequestid'];
paymentStatusText = json['PaymentStatusText'];
projectName = json['ProjectName'];
nearestProjectName = json['NearestProjectName'];
paymentAmount = json['PaymentAmount'];
wFOrder = json['WF_order'] != null
? new WFOrder.fromJson(json['WF_order'])
: null;
serviceText = json['ServiceText'];
isSentForApproval = json['isSentForApproval'];
exaCartOrderId = json['ExaCart_OrderId'];
exaCartGUID = json['ExaCart_GUID'];
isTimer = json['isTimer'];
timeSeconds = json['TimeSeconds'];
totalPendingSeconds = json['TotalPendingSeconds'];
timeMinute = json['TimeMinute'];
timeHour = json['TimeHour'];
timeTotalSeconds = json['TimeTotalSeconds'];
timeTotalMinute = json['TimeTotalMinute'];
timeTotalHour = json['TimeTotalHour'];
approvalStatus = json['ApprovalStatus'];
isActive = json['isActive'];
clickButton = json['ClickButton'];
orderHistory = json['OrderHistory'];
pickupLocation = json['PickupLocation'];
dropOffLocation = json['DropOffLocation'];
clinicName = json['clinicName'];
doctorName = json['DoctorName'];
branch = json['Branch'];
time = json['Time'];
notes = json['Notes'];
iD = json['ID'];
patientId = json['PatientId'];
patientOutSa = json['PatientOutSa'];
isOutPatient = json['IsOutPatient'];
projectId = json['ProjectId'];
nearestProjectId = json['NearestProjectId'];
longitude = json['Longitude'];
latitude = json['Latitude'];
appointmentNo = json['AppointmentNo'];
dischargeId = json['DischargeId'];
statusId = json['StatusId'];
serviceId = json['ServiceId'];
channel = json['Channel'];
orderpayment = json['orderpayment'] != null
? new Orderpayment.fromJson(json['orderpayment'])
: null;
wforder = json['wforder'];
orderapprovalobj = json['orderapprovalobj'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['StatusText'] = this.statusText;
data['PaymentStatus'] = this.paymentStatus;
data['ClientRequestid'] = this.clientRequestid;
data['PaymentStatusText'] = this.paymentStatusText;
data['ProjectName'] = this.projectName;
data['NearestProjectName'] = this.nearestProjectName;
data['PaymentAmount'] = this.paymentAmount;
if (this.wFOrder != null) {
data['WF_order'] = this.wFOrder!.toJson();
}
data['ServiceText'] = this.serviceText;
data['isSentForApproval'] = this.isSentForApproval;
data['ExaCart_OrderId'] = this.exaCartOrderId;
data['ExaCart_GUID'] = this.exaCartGUID;
data['isTimer'] = this.isTimer;
data['TimeSeconds'] = this.timeSeconds;
data['TotalPendingSeconds'] = this.totalPendingSeconds;
data['TimeMinute'] = this.timeMinute;
data['TimeHour'] = this.timeHour;
data['TimeTotalSeconds'] = this.timeTotalSeconds;
data['TimeTotalMinute'] = this.timeTotalMinute;
data['TimeTotalHour'] = this.timeTotalHour;
data['ApprovalStatus'] = this.approvalStatus;
data['isActive'] = this.isActive;
data['ClickButton'] = this.clickButton;
data['OrderHistory'] = this.orderHistory;
data['PickupLocation'] = this.pickupLocation;
data['DropOffLocation'] = this.dropOffLocation;
data['clinicName'] = this.clinicName;
data['DoctorName'] = this.doctorName;
data['Branch'] = this.branch;
data['Time'] = this.time;
data['Notes'] = this.notes;
data['ID'] = this.iD;
data['PatientId'] = this.patientId;
data['PatientOutSa'] = this.patientOutSa;
data['IsOutPatient'] = this.isOutPatient;
data['ProjectId'] = this.projectId;
data['NearestProjectId'] = this.nearestProjectId;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
data['AppointmentNo'] = this.appointmentNo;
data['DischargeId'] = this.dischargeId;
data['StatusId'] = this.statusId;
data['ServiceId'] = this.serviceId;
data['Channel'] = this.channel;
if (this.orderpayment != null) {
data['orderpayment'] = this.orderpayment!.toJson();
}
data['wforder'] = this.wforder;
data['orderapprovalobj'] = this.orderapprovalobj;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
return data;
}
}
class WFOrder {
dynamic wfButtonsDTO;
num? iD;
num? orderId;
num? previousStep;
num? nextStep;
num? serviceId;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
WFOrder(
{this.wfButtonsDTO,
this.iD,
this.orderId,
this.previousStep,
this.nextStep,
this.serviceId,
this.order,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted});
WFOrder.fromJson(Map<String, dynamic> json) {
wfButtonsDTO = json['wf_ButtonsDTO'];
iD = json['ID'];
orderId = json['OrderId'];
previousStep = json['PreviousStep'];
nextStep = json['NextStep'];
serviceId = json['ServiceId'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['wf_ButtonsDTO'] = this.wfButtonsDTO;
data['ID'] = this.iD;
data['OrderId'] = this.orderId;
data['PreviousStep'] = this.previousStep;
data['NextStep'] = this.nextStep;
data['ServiceId'] = this.serviceId;
data['Order'] = this.order;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
return data;
}
}
class Orderpayment {
num? iD;
num? orderId;
dynamic clientRequestId;
num? totalAmount;
num? paymentStatus;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
Orderpayment(
{this.iD,
this.orderId,
this.clientRequestId,
this.totalAmount,
this.paymentStatus,
this.order,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted});
Orderpayment.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
orderId = json['OrderId'];
clientRequestId = json['ClientRequestId'];
totalAmount = json['TotalAmount'];
paymentStatus = json['PaymentStatus'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['OrderId'] = this.orderId;
data['ClientRequestId'] = this.clientRequestId;
data['TotalAmount'] = this.totalAmount;
data['PaymentStatus'] = this.paymentStatus;
data['Order'] = this.order;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
return data;
}
}

@ -1,108 +0,0 @@
class EROnlineCheckInPaymentDetailsResponse {
num? cashPrice;
num? cashPriceTax;
num? cashPriceWithTax;
int? companyId;
String? companyName;
num? companyShareWithTax;
dynamic errCode;
int? groupID;
String? insurancePolicyNo;
String? message;
String? patientCardID;
num? patientShare;
num? patientShareWithTax;
num? patientTaxAmount;
int? policyId;
String? policyName;
String? procedureId;
String? procedureName;
dynamic setupID;
int? statusCode;
String? subPolicyNo;
bool? isCash;
bool? isEligible;
bool? isInsured;
EROnlineCheckInPaymentDetailsResponse(
{this.cashPrice,
this.cashPriceTax,
this.cashPriceWithTax,
this.companyId,
this.companyName,
this.companyShareWithTax,
this.errCode,
this.groupID,
this.insurancePolicyNo,
this.message,
this.patientCardID,
this.patientShare,
this.patientShareWithTax,
this.patientTaxAmount,
this.policyId,
this.policyName,
this.procedureId,
this.procedureName,
this.setupID,
this.statusCode,
this.subPolicyNo,
this.isCash,
this.isEligible,
this.isInsured});
EROnlineCheckInPaymentDetailsResponse.fromJson(Map<String, dynamic> json) {
cashPrice = json['CashPrice'];
cashPriceTax = json['CashPriceTax'];
cashPriceWithTax = json['CashPriceWithTax'];
companyId = json['CompanyId'];
companyName = json['CompanyName'];
companyShareWithTax = json['CompanyShareWithTax'];
errCode = json['ErrCode'];
groupID = json['GroupID'];
insurancePolicyNo = json['InsurancePolicyNo'];
message = json['Message'];
patientCardID = json['PatientCardID'];
patientShare = json['PatientShare'];
patientShareWithTax = json['PatientShareWithTax'];
patientTaxAmount = json['PatientTaxAmount'];
policyId = json['PolicyId'];
policyName = json['PolicyName'];
procedureId = json['ProcedureId'];
procedureName = json['ProcedureName'];
setupID = json['SetupID'];
statusCode = json['StatusCode'];
subPolicyNo = json['SubPolicyNo'];
isCash = json['IsCash'];
isEligible = json['IsEligible'];
isInsured = json['IsInsured'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['CashPrice'] = this.cashPrice;
data['CashPriceTax'] = this.cashPriceTax;
data['CashPriceWithTax'] = this.cashPriceWithTax;
data['CompanyId'] = this.companyId;
data['CompanyName'] = this.companyName;
data['CompanyShareWithTax'] = this.companyShareWithTax;
data['ErrCode'] = this.errCode;
data['GroupID'] = this.groupID;
data['InsurancePolicyNo'] = this.insurancePolicyNo;
data['Message'] = this.message;
data['PatientCardID'] = this.patientCardID;
data['PatientShare'] = this.patientShare;
data['PatientShareWithTax'] = this.patientShareWithTax;
data['PatientTaxAmount'] = this.patientTaxAmount;
data['PolicyId'] = this.policyId;
data['PolicyName'] = this.policyName;
data['ProcedureId'] = this.procedureId;
data['ProcedureName'] = this.procedureName;
data['SetupID'] = this.setupID;
data['StatusCode'] = this.statusCode;
data['SubPolicyNo'] = this.subPolicyNo;
data['IsCash'] = this.isCash;
data['IsEligible'] = this.isEligible;
data['IsInsured'] = this.isInsured;
return data;
}
}

@ -1,56 +0,0 @@
class PatientERTransportationMethod {
int? iD;
String? serviceID;
int? orderServiceID;
String? text;
String? textN;
dynamic price;
dynamic priceVAT;
dynamic priceTotal;
bool? isEnabled;
int? orderId;
int? quantity;
PatientERTransportationMethod(
{this.iD,
this.serviceID,
this.orderServiceID,
this.text,
this.textN,
this.price,
this.priceVAT,
this.priceTotal,
this.isEnabled,
this.orderId,
this.quantity});
PatientERTransportationMethod.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
serviceID = json['ServiceID'];
orderServiceID = json['OrderServiceID'];
text = json['Text'];
textN = json['TextN'];
price = json['Price'];
priceVAT = json['PriceVAT'];
priceTotal = json['PriceTotal'];
isEnabled = json['IsEnabled'];
orderId = json['OrderId'];
quantity = json['Quantity'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['ServiceID'] = this.serviceID;
data['OrderServiceID'] = this.orderServiceID;
data['Text'] = this.text;
data['TextN'] = this.textN;
data['Price'] = this.price;
data['PriceVAT'] = this.priceVAT;
data['PriceTotal'] = this.priceTotal;
data['IsEnabled'] = this.isEnabled;
data['OrderId'] = this.orderId;
data['Quantity'] = this.quantity;
return data;
}
}

@ -1,406 +0,0 @@
class RRTServiceData {
List<GetCMCAllOrdersResponseModel> pendingOrders = [];
List<GetCMCAllOrdersResponseModel> completedOrders = [];
ServicePrice servicePrice = ServicePrice();
}
class GetCMCAllOrdersResponseModel {
int? iD;
int? patientId;
int? patientOutSa;
bool? isOutPatient;
int? projectId;
int? nearestProjectId;
dynamic longitude;
dynamic latitude;
dynamic appointmentNo;
dynamic dischargeId;
int? statusId;
int? serviceId;
int? channel;
Orderpayment? orderpayment;
dynamic orderselectedservice;
dynamic wforder;
dynamic orderapprovalobj;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
String? statusText;
int? paymentStatus;
dynamic clientRequestid;
dynamic paymentStatusText;
String? projectName;
String? nearestProjectName;
dynamic paymentAmount;
WFOrder? wFOrder;
String? serviceText;
bool? isSentForApproval;
int? exaCartOrderId;
bool? isTimer;
int? timeSeconds;
int? totalPendingSeconds;
int? timeMinute;
int? timeHour;
int? timeTotalSeconds;
int? timeTotalMinute;
int? timeTotalHour;
dynamic approvalStatus;
bool? isActive;
int? clickButton;
List<dynamic>? procedures;
dynamic pickupLocation;
dynamic dropOffLocation;
dynamic clinicName;
dynamic doctorName;
dynamic branch;
dynamic time;
dynamic notes;
GetCMCAllOrdersResponseModel(
{this.iD,
this.patientId,
this.patientOutSa,
this.isOutPatient,
this.projectId,
this.nearestProjectId,
this.longitude,
this.latitude,
this.appointmentNo,
this.dischargeId,
this.statusId,
this.serviceId,
this.channel,
this.orderpayment,
this.orderselectedservice,
this.wforder,
this.orderapprovalobj,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted,
this.statusText,
this.paymentStatus,
this.clientRequestid,
this.paymentStatusText,
this.projectName,
this.nearestProjectName,
this.paymentAmount,
this.wFOrder,
this.serviceText,
this.isSentForApproval,
this.exaCartOrderId,
this.isTimer,
this.timeSeconds,
this.totalPendingSeconds,
this.timeMinute,
this.timeHour,
this.timeTotalSeconds,
this.timeTotalMinute,
this.timeTotalHour,
this.approvalStatus,
this.isActive,
this.clickButton,
this.procedures,
this.pickupLocation,
this.dropOffLocation,
this.clinicName,
this.doctorName,
this.branch,
this.time,
this.notes});
GetCMCAllOrdersResponseModel.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
patientId = json['PatientId'];
patientOutSa = json['PatientOutSa'];
isOutPatient = json['IsOutPatient'];
projectId = json['ProjectId'];
nearestProjectId = json['NearestProjectId'];
longitude = json['Longitude'];
latitude = json['Latitude'];
appointmentNo = json['AppointmentNo'];
dischargeId = json['DischargeId'];
statusId = json['StatusId'];
serviceId = json['ServiceId'];
channel = json['Channel'];
orderpayment = json['orderpayment'] != null
? new Orderpayment.fromJson(json['orderpayment'])
: null;
orderselectedservice = json['orderselectedservice'];
wforder = json['wforder'];
orderapprovalobj = json['orderapprovalobj'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
statusText = json['StatusText'];
paymentStatus = json['PaymentStatus'];
clientRequestid = json['ClientRequestid'];
paymentStatusText = json['PaymentStatusText'];
projectName = json['ProjectName'];
nearestProjectName = json['NearestProjectName'];
paymentAmount = json['PaymentAmount'];
wFOrder = json['WF_order'] != null
? new WFOrder.fromJson(json['WF_order'])
: null;
serviceText = json['ServiceText'];
isSentForApproval = json['isSentForApproval'];
exaCartOrderId = json['ExaCart_OrderId'];
isTimer = json['isTimer'];
timeSeconds = json['TimeSeconds'];
totalPendingSeconds = json['TotalPendingSeconds'];
timeMinute = json['TimeMinute'];
timeHour = json['TimeHour'];
timeTotalSeconds = json['TimeTotalSeconds'];
timeTotalMinute = json['TimeTotalMinute'];
timeTotalHour = json['TimeTotalHour'];
approvalStatus = json['ApprovalStatus'];
isActive = json['isActive'];
clickButton = json['ClickButton'];
pickupLocation = json['PickupLocation'];
dropOffLocation = json['DropOffLocation'];
clinicName = json['clinicName'];
doctorName = json['DoctorName'];
branch = json['Branch'];
time = json['Time'];
notes = json['Notes'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['PatientId'] = this.patientId;
data['PatientOutSa'] = this.patientOutSa;
data['IsOutPatient'] = this.isOutPatient;
data['ProjectId'] = this.projectId;
data['NearestProjectId'] = this.nearestProjectId;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
data['AppointmentNo'] = this.appointmentNo;
data['DischargeId'] = this.dischargeId;
data['StatusId'] = this.statusId;
data['ServiceId'] = this.serviceId;
data['Channel'] = this.channel;
if (this.orderpayment != null) {
data['orderpayment'] = this.orderpayment!.toJson();
}
data['orderselectedservice'] = this.orderselectedservice;
data['wforder'] = this.wforder;
data['orderapprovalobj'] = this.orderapprovalobj;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
data['StatusText'] = this.statusText;
data['PaymentStatus'] = this.paymentStatus;
data['ClientRequestid'] = this.clientRequestid;
data['PaymentStatusText'] = this.paymentStatusText;
data['ProjectName'] = this.projectName;
data['NearestProjectName'] = this.nearestProjectName;
data['PaymentAmount'] = this.paymentAmount;
if (this.wFOrder != null) {
data['WF_order'] = this.wFOrder!.toJson();
}
data['ServiceText'] = this.serviceText;
data['isSentForApproval'] = this.isSentForApproval;
data['ExaCart_OrderId'] = this.exaCartOrderId;
data['isTimer'] = this.isTimer;
data['TimeSeconds'] = this.timeSeconds;
data['TotalPendingSeconds'] = this.totalPendingSeconds;
data['TimeMinute'] = this.timeMinute;
data['TimeHour'] = this.timeHour;
data['TimeTotalSeconds'] = this.timeTotalSeconds;
data['TimeTotalMinute'] = this.timeTotalMinute;
data['TimeTotalHour'] = this.timeTotalHour;
data['ApprovalStatus'] = this.approvalStatus;
data['isActive'] = this.isActive;
data['ClickButton'] = this.clickButton;
data['PickupLocation'] = this.pickupLocation;
data['DropOffLocation'] = this.dropOffLocation;
data['clinicName'] = this.clinicName;
data['DoctorName'] = this.doctorName;
data['Branch'] = this.branch;
data['Time'] = this.time;
data['Notes'] = this.notes;
return data;
}
}
class Orderpayment {
int? iD;
int? orderId;
dynamic clientRequestId;
dynamic totalAmount;
int? paymentStatus;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
Orderpayment(
{this.iD,
this.orderId,
this.clientRequestId,
this.totalAmount,
this.paymentStatus,
this.order,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted});
Orderpayment.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
orderId = json['OrderId'];
clientRequestId = json['ClientRequestId'];
totalAmount = json['TotalAmount'];
paymentStatus = json['PaymentStatus'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['OrderId'] = this.orderId;
data['ClientRequestId'] = this.clientRequestId;
data['TotalAmount'] = this.totalAmount;
data['PaymentStatus'] = this.paymentStatus;
data['Order'] = this.order;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
return data;
}
}
class WFOrder {
dynamic wfButtonsDTO;
int? iD;
int? orderId;
int? previousStep;
int? nextStep;
int? serviceId;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
WFOrder(
{this.wfButtonsDTO,
this.iD,
this.orderId,
this.previousStep,
this.nextStep,
this.serviceId,
this.order,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted});
WFOrder.fromJson(Map<String, dynamic> json) {
wfButtonsDTO = json['wf_ButtonsDTO'];
iD = json['ID'];
orderId = json['OrderId'];
previousStep = json['PreviousStep'];
nextStep = json['NextStep'];
serviceId = json['ServiceId'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['wf_ButtonsDTO'] = this.wfButtonsDTO;
data['ID'] = this.iD;
data['OrderId'] = this.orderId;
data['PreviousStep'] = this.previousStep;
data['NextStep'] = this.nextStep;
data['ServiceId'] = this.serviceId;
data['Order'] = this.order;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
return data;
}
}
class ServicePrice {
String? currency;
dynamic maxPrice;
dynamic maxTotalPrice;
dynamic maxVAT;
dynamic minPrice;
dynamic minTotalPrice;
dynamic minVAT;
dynamic price;
dynamic totalPrice;
dynamic vat;
ServicePrice({
this.currency,
this.maxPrice,
this.maxTotalPrice,
this.maxVAT,
this.minPrice,
this.minTotalPrice,
this.minVAT,
this.price,
this.totalPrice,
this.vat});
ServicePrice.fromJson(dynamic json) {
currency = json["Currency"];
maxPrice = json["MaxPrice"];
maxTotalPrice = json["MaxTotalPrice"];
maxVAT = json["MaxVAT"];
minPrice = json["MinPrice"];
minTotalPrice = json["MinTotalPrice"];
minVAT = json["MinVAT"];
price = json["Price"];
totalPrice = json["TotalPrice"];
vat = json["VAT"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["Currency"] = currency;
map["MaxPrice"] = maxPrice;
map["MaxTotalPrice"] = maxTotalPrice;
map["MaxVAT"] = maxVAT;
map["MinPrice"] = minPrice;
map["MinTotalPrice"] = minTotalPrice;
map["MinVAT"] = minVAT;
map["Price"] = price;
map["TotalPrice"] = totalPrice;
map["VAT"] = vat;
return map;
}
}

@ -1,522 +0,0 @@
import 'dart:developer';
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/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/cmc_create_new_order_req_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/order_update_req_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class HmgServicesRepo {
Future<Either<Failure, GenericApiModel<List<GetCMCAllOrdersResponseModel>>>> getAllComprehensiveCheckupOrders();
Future<Either<Failure, GenericApiModel<List<GetCMCAllOrdersResponseModel>>>> getAllHomeHealthCareCheckupOrders();
Future<Either<Failure, GenericApiModel<bool>>> updateCmcPresOrder(OrderUpdateRequestModel requestModel);
Future<Either<Failure, GenericApiModel<bool>>> updateHhcPresOrder(OrderUpdateRequestModel requestModel);
Future<Either<Failure, GenericApiModel<List<GetCMCServicesResponseModel>>>> getAllCmcServices({required int patientID});
Future<Either<Failure, GenericApiModel<List<GetCMCServicesResponseModel>>>> getAllHhcServices({required int patientID});
Future<Either<Failure, GenericApiModel<List<HospitalsModel>>>> getHospitalsList();
Future<Either<Failure, GenericApiModel<int>>> addCmcOrder({
required int projectID,
required int orderServiceID,
required List<PatientERCMCInsertServicesList> services,
});
Future<Either<Failure, GenericApiModel<int>>> addHhcOrder({
required int projectID,
required int orderServiceID,
required List<PatientERCMCInsertServicesList> services,
});
}
class HmgServicesRepoImp implements HmgServicesRepo {
final ApiClient apiClient;
final LoggerService loggerService;
HmgServicesRepoImp({required this.apiClient, required this.loggerService});
@override
Future<Either<Failure, GenericApiModel<List<GetCMCAllOrdersResponseModel>>>> getAllComprehensiveCheckupOrders() async {
Map<String, dynamic> requestBody = {};
try {
GenericApiModel<List<GetCMCAllOrdersResponseModel>>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.allCMCOrdersRc,
isRCService: true,
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("CMC Orders API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
List<GetCMCAllOrdersResponseModel> cmcOrdersList = [];
// Log the full response for debugging
// Extract MessageStatus and ErrorEndUserMessage from root level
final apiErrorMessage = response['ErrorEndUserMessage'] as String?;
// Parse the response array
if (response['response'] != null && response['response'] is List) {
final ordersList = response['response'] as List;
for (var orderJson in ordersList) {
if (orderJson is Map<String, dynamic>) {
try {
cmcOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(orderJson));
} catch (e) {
loggerService.logError("Error parsing individual order: ${e.toString()}");
}
}
}
}
apiResponse = GenericApiModel<List<GetCMCAllOrdersResponseModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: apiErrorMessage ?? errorMessage,
data: cmcOrdersList,
);
} catch (e) {
loggerService.logError("Error parsing CMC orders: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
loggerService.logError("Unknown error in getAllCmcOrders: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<GetCMCAllOrdersResponseModel>>>> getAllHomeHealthCareCheckupOrders() async {
Map<String, dynamic> requestBody = {};
try {
GenericApiModel<List<GetCMCAllOrdersResponseModel>>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.allHHCOrdersRc,
isRCService: true,
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("HHC Orders API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
List<GetCMCAllOrdersResponseModel> cmcOrdersList = [];
// Log the full response for debugging
// Extract MessageStatus and ErrorEndUserMessage from root level
final apiErrorMessage = response['ErrorEndUserMessage'] as String?;
// Parse the response array
if (response['response'] != null && response['response'] is List) {
final ordersList = response['response'] as List;
for (var orderJson in ordersList) {
if (orderJson is Map<String, dynamic>) {
try {
cmcOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(orderJson));
} catch (e) {
loggerService.logError("Error parsing individual order: ${e.toString()}");
}
}
}
}
apiResponse = GenericApiModel<List<GetCMCAllOrdersResponseModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: apiErrorMessage ?? errorMessage,
data: cmcOrdersList,
);
} catch (e) {
loggerService.logError("Error parsing HHC orders: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
loggerService.logError("Unknown error in getAllHHCOrders: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<GetCMCServicesResponseModel>>>> getAllCmcServices({required int patientID}) async {
Map<String, dynamic> requestBody = {};
try {
GenericApiModel<List<GetCMCServicesResponseModel>>? apiResponse;
Failure? failure;
await apiClient.post(
'${ApiConsts.allCMCServicesRc}?patientID=$patientID',
isRCService: true,
isAllowAny: true,
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("CMC Services API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
List<GetCMCServicesResponseModel> cmcServicesList = [];
if (response['response'] != null && response['response'] is List) {
final servicesList = response['response'] as List;
for (var serviceJson in servicesList) {
if (serviceJson is Map<String, dynamic>) {
cmcServicesList.add(GetCMCServicesResponseModel.fromJson(serviceJson));
}
}
}
apiResponse = GenericApiModel<List<GetCMCServicesResponseModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: cmcServicesList,
);
} catch (e) {
loggerService.logError("Error parsing CMC services: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
log("Unknown error in getAllCmcServices: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<GetCMCServicesResponseModel>>>> getAllHhcServices({required int patientID}) async {
Map<String, dynamic> requestBody = {};
try {
GenericApiModel<List<GetCMCServicesResponseModel>>? apiResponse;
Failure? failure;
await apiClient.post(
'${ApiConsts.allHHCServicesRc}?patientID=$patientID',
isRCService: true,
isAllowAny: true,
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("HHC Services API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
List<GetCMCServicesResponseModel> hhcServicesList = [];
if (response['response'] != null && response['response'] is List) {
final servicesList = response['response'] as List;
for (var serviceJson in servicesList) {
if (serviceJson is Map<String, dynamic>) {
hhcServicesList.add(GetCMCServicesResponseModel.fromJson(serviceJson));
}
}
}
apiResponse = GenericApiModel<List<GetCMCServicesResponseModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: hhcServicesList,
);
} catch (e) {
loggerService.logError("Error parsing HHC services: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
log("Unknown error in getAllHhcServices: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<bool>>> updateCmcPresOrder(OrderUpdateRequestModel requestModel) async {
try {
GenericApiModel<bool>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.updateCMCOrder,
isRCService: true,
body: requestModel.toJson(),
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("Update CMC Order API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<bool>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: true,
);
loggerService.logInfo("CMC Order updated successfully: PresOrderID=${requestModel.presOrderID}");
} catch (e) {
loggerService.logError("Error processing update CMC order response: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
loggerService.logError("Unknown error in updateCmcPresOrder: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<bool>>> updateHhcPresOrder(OrderUpdateRequestModel requestModel) async {
try {
GenericApiModel<bool>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.updateHHCOrder,
isRCService: true,
body: requestModel.toJson(),
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("Update HHC Order API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<bool>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: true,
);
loggerService.logInfo("HHC Order updated successfully: PresOrderID=${requestModel.presOrderID}");
} catch (e) {
loggerService.logError("Error processing update HHC order response: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
loggerService.logError("Unknown error in updateHhcPresOrder: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<HospitalsModel>>>> getHospitalsList() async {
Map<String, dynamic> requestBody = {};
try {
GenericApiModel<List<HospitalsModel>>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.getHospitalsList,
isRCService: false, // This uses the base HIS API URL, not RC
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("Get Hospitals List API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
List<HospitalsModel> hospitalsList = [];
loggerService.logInfo("Hospitals List Raw Response: $response");
if (response['ListProject'] != null && response['ListProject'] is List) {
final projectsList = response['ListProject'] as List;
for (var projectJson in projectsList) {
try {
if (projectJson is Map<String, dynamic>) {
hospitalsList.add(HospitalsModel.fromJson(projectJson));
}
} catch (e) {
loggerService.logError('Error parsing hospital item: ${e.toString()}');
}
}
} else {
loggerService.logInfo('Hospitals list response array is empty or missing');
}
apiResponse = GenericApiModel<List<HospitalsModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: hospitalsList,
);
loggerService.logInfo("Hospitals fetched successfully: ${hospitalsList.length} hospitals");
} catch (e) {
loggerService.logError("Error parsing hospitals list: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
loggerService.logError("Unknown error in getHospitalsList: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<int>>> addCmcOrder({
required int projectID,
required int orderServiceID,
required List<PatientERCMCInsertServicesList> services,
}) async {
try {
GenericApiModel<int>? apiResponse;
Failure? failure;
final requestBody = {
'ProjectID': projectID,
'OrderServiceID': orderServiceID,
'procedures': services.map((service) => service.toJson()).toList(),
};
await apiClient.post(
ApiConsts.addCMCOrder,
isRCService: true,
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("Add CMC Order API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
int requestId = 0;
if (response is Map) {
requestId = response['response'];
}
try {
apiResponse = GenericApiModel<int>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: requestId,
);
loggerService.logInfo("CMC Order added successfully: ProjectID=$projectID, OrderServiceID=$orderServiceID");
} catch (e) {
loggerService.logError("Error processing add CMC order response: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
loggerService.logError("Unknown error in addCmcOrder: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<int>>> addHhcOrder({
required int projectID,
required int orderServiceID,
required List<PatientERCMCInsertServicesList> services,
}) async {
try {
GenericApiModel<int>? apiResponse;
Failure? failure;
final requestBody = {
'ProjectID': projectID,
'OrderServiceID': orderServiceID,
'procedures': services.map((service) => service.toJson()).toList(),
};
await apiClient.post(
ApiConsts.addHHCOrder,
isRCService: true,
body: requestBody,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
loggerService.logError("Add HHC Order API Failed: $error, Status: $statusCode");
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
int requestId = 0;
if (response is Map) {
requestId = response['response'];
}
try {
apiResponse = GenericApiModel<int>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: requestId,
);
loggerService.logInfo("HHC Order added successfully: ProjectID=$projectID, OrderServiceID=$orderServiceID");
} catch (e) {
loggerService.logError("Error processing add HHC order response: ${e.toString()}");
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
loggerService.logError("Unknown error in addHhcOrder: ${e.toString()}");
return Left(UnknownFailure(e.toString()));
}
}
}

@ -1,515 +0,0 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_repo.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_repo.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/cmc_create_new_order_req_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/req_models/order_update_req_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
class HmgServicesViewModel extends ChangeNotifier {
final HmgServicesRepo hmgServicesRepo;
final BookAppointmentsRepo bookAppointmentsRepo;
final ErrorHandlerService errorHandlerService;
HmgServicesViewModel({required this.bookAppointmentsRepo, required this.hmgServicesRepo, required this.errorHandlerService});
bool isCmcOrdersLoading = false;
bool isCmcServicesLoading = false;
bool isUpdatingOrder = false;
bool isHospitalListLoading = false;
// HHC specific loading states
bool isHhcOrdersLoading = false;
bool isHhcServicesLoading = false;
List<GetCMCAllOrdersResponseModel> cmcOrdersList = [];
List<GetCMCServicesResponseModel> cmcServicesList = [];
List<HospitalsModel> hospitalsList = [];
List<HospitalsModel> filteredHospitalsList = [];
HospitalsModel? selectedHospital;
// HHC specific lists
List<GetCMCAllOrdersResponseModel> hhcOrdersList = [];
List<GetCMCServicesResponseModel> hhcServicesList = [];
// CMC order creation state
HospitalsModel? selectedHospitalForOrder;
GetCMCServicesResponseModel? selectedServiceForOrder;
// HHC order creation state (no hospital selection needed for home healthcare)
GetCMCServicesResponseModel? selectedServiceForHhcOrder;
// HHC multiple services selection
List<GetCMCServicesResponseModel> selectedHhcServices = [];
Future<void> getCmcOrdersList() async {
cmcOrdersList.clear();
isCmcOrdersLoading = true;
notifyListeners();
await getAllCmcOrders();
}
// Helper to sort hospitals by distance (ascending). Safely converts distanceinkMS to double.
void _sortHospitalsByDistance(List<HospitalsModel> list) {
double toDouble(dynamic v) {
if (v == null) return double.infinity;
if (v is num) return v.toDouble();
if (v is String) return double.tryParse(v) ?? double.infinity;
return double.infinity;
}
list.sort((a, b) {
final da = toDouble(a.distanceInKilometers);
final db = toDouble(b.distanceInKilometers);
return da.compareTo(db);
});
}
Future<void> getAllCmcOrders({
Function(dynamic)? onSuccess,
Function(String)? onError,
}) async {
isCmcOrdersLoading = true;
notifyListeners();
final result = await hmgServicesRepo.getAllComprehensiveCheckupOrders();
result.fold(
(failure) async {
isCmcOrdersLoading = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isCmcOrdersLoading = false;
if (apiResponse.messageStatus == 1) {
cmcOrdersList = apiResponse.data ?? [];
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
}
Future<void> getAllCmcServices({required int patientID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
isCmcServicesLoading = true;
notifyListeners();
final result = await hmgServicesRepo.getAllCmcServices(patientID: patientID);
result.fold(
(failure) async {
isCmcServicesLoading = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isCmcServicesLoading = false;
if (apiResponse.messageStatus == 1) {
cmcServicesList = apiResponse.data ?? [];
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
}
Future<bool> updateCmcPresOrder({
required OrderUpdateRequestModel requestModel,
Function(dynamic)? onSuccess,
Function(String)? onError,
}) async {
isUpdatingOrder = true;
notifyListeners();
final result = await hmgServicesRepo.updateCmcPresOrder(requestModel);
bool success = false;
result.fold(
(failure) async {
isUpdatingOrder = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isUpdatingOrder = false;
if (apiResponse.messageStatus == 1) {
success = true;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
return success;
}
Future<void> getHospitalsList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
isHospitalListLoading = true;
notifyListeners();
final result = await hmgServicesRepo.getHospitalsList();
result.fold(
(failure) async {
isHospitalListLoading = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isHospitalListLoading = false;
if (apiResponse.messageStatus == 1) {
hospitalsList = apiResponse.data ?? [];
filteredHospitalsList = List.from(hospitalsList);
// ensure hospitals are sorted by distance before showing
_sortHospitalsByDistance(filteredHospitalsList);
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
}
void filterHospitalsByString(String searchText, bool isArabic) {
if (searchText.isEmpty) {
filteredHospitalsList = List.from(hospitalsList);
_sortHospitalsByDistance(filteredHospitalsList);
} else {
filteredHospitalsList = hospitalsList.where((HospitalsModel hospital) {
final name = isArabic ? (hospital.nameN ?? '') : (hospital.name ?? '');
return name.toLowerCase().contains(searchText.toLowerCase());
}).toList();
_sortHospitalsByDistance(filteredHospitalsList);
}
notifyListeners();
}
void setSelectedHospital(HospitalsModel? hospital) {
selectedHospital = hospital;
notifyListeners();
}
void clearHospitalSelection() {
selectedHospital = null;
filteredHospitalsList = List.from(hospitalsList);
_sortHospitalsByDistance(filteredHospitalsList);
notifyListeners();
}
// CMC Order management methods
void setSelectedHospitalForOrder(HospitalsModel? hospital) {
selectedHospitalForOrder = hospital;
notifyListeners();
}
void setSelectedServiceForOrder(GetCMCServicesResponseModel? service) {
selectedServiceForOrder = service;
notifyListeners();
}
void clearOrderSelection() {
selectedHospitalForOrder = null;
selectedServiceForOrder = null;
notifyListeners();
}
bool get isOrderReadyToConfirm => selectedHospitalForOrder != null && selectedServiceForOrder != null;
Future<int?> addCmcOrder({
required int projectID,
required int orderServiceID,
required List<PatientERCMCInsertServicesList> services,
Function(int)? onSuccess,
Function(String)? onError,
}) async {
isUpdatingOrder = true;
notifyListeners();
final result = await hmgServicesRepo.addCmcOrder(
projectID: projectID,
orderServiceID: orderServiceID,
services: services,
);
int requestId = 0;
result.fold(
(failure) async {
isUpdatingOrder = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isUpdatingOrder = false;
if (apiResponse.messageStatus == 1) {
requestId = apiResponse.data ?? 0;
notifyListeners();
if (onSuccess != null) {
onSuccess(requestId);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
return requestId;
}
// ******************* HOME HEALTHCARE APIs ********************
Future<void> getHhcOrdersList() async {
hhcOrdersList.clear();
isHhcOrdersLoading = true;
notifyListeners();
await getAllHhcOrders();
}
Future<void> getAllHhcOrders({
Function(dynamic)? onSuccess,
Function(String)? onError,
}) async {
isHhcOrdersLoading = true;
notifyListeners();
final result = await hmgServicesRepo.getAllHomeHealthCareCheckupOrders();
result.fold(
(failure) async {
isHhcOrdersLoading = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isHhcOrdersLoading = false;
if (apiResponse.messageStatus == 1) {
hhcOrdersList = apiResponse.data ?? [];
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
}
Future<void> getAllHhcServices({required int patientID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
isHhcServicesLoading = true;
notifyListeners();
final result = await hmgServicesRepo.getAllHhcServices(patientID: patientID);
result.fold(
(failure) async {
isHhcServicesLoading = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isHhcServicesLoading = false;
if (apiResponse.messageStatus == 1) {
hhcServicesList = apiResponse.data ?? [];
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
}
Future<bool> updateHhcPresOrder({
required OrderUpdateRequestModel requestModel,
Function(dynamic)? onSuccess,
Function(String)? onError,
}) async {
isUpdatingOrder = true;
notifyListeners();
final result = await hmgServicesRepo.updateHhcPresOrder(requestModel);
bool success = false;
result.fold(
(failure) async {
isUpdatingOrder = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isUpdatingOrder = false;
if (apiResponse.messageStatus == 1) {
success = true;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
return success;
}
Future<int?> addHhcOrder({
required int projectID,
required int orderServiceID,
required List<PatientERCMCInsertServicesList> services,
Function(int)? onSuccess,
Function(String)? onError,
}) async {
isUpdatingOrder = true;
notifyListeners();
final result = await hmgServicesRepo.addHhcOrder(
projectID: projectID,
orderServiceID: orderServiceID,
services: services,
);
int requestId = 0;
result.fold(
(failure) async {
isUpdatingOrder = false;
notifyListeners();
await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.toString());
}
},
(apiResponse) {
isUpdatingOrder = false;
if (apiResponse.messageStatus == 1) {
requestId = apiResponse.data ?? 0;
notifyListeners();
if (onSuccess != null) {
onSuccess(requestId);
}
} else {
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? 'Unknown error');
}
}
},
);
return requestId;
}
// HHC Order management methods (no hospital selection for home healthcare)
void setSelectedServiceForHhcOrder(GetCMCServicesResponseModel? service) {
selectedServiceForHhcOrder = service;
notifyListeners();
}
void clearHhcOrderSelection() {
selectedServiceForHhcOrder = null;
selectedHhcServices.clear();
notifyListeners();
}
bool get isHhcOrderReadyToConfirm => selectedServiceForHhcOrder != null;
// Multiple HHC services selection methods
void toggleHhcServiceSelection(GetCMCServicesResponseModel service) {
final index = selectedHhcServices.indexWhere((s) => s.iD == service.iD);
if (index != -1) {
selectedHhcServices.removeAt(index);
} else {
selectedHhcServices.add(service);
}
notifyListeners();
}
bool isHhcServiceSelected(GetCMCServicesResponseModel service) {
return selectedHhcServices.any((s) => s.iD == service.iD);
}
double getHhcSelectedServicesTotal() {
double total = 0.0;
for (var service in selectedHhcServices) {
total += (service.priceTotal ?? 0);
}
return total;
}
void clearHhcServicesSelection() {
selectedHhcServices.clear();
notifyListeners();
}
}

@ -1,131 +0,0 @@
class CMCInsertPresOrderRequestModel {
double? versionID;
int? channel;
int? languageID;
String? iPAdress;
String? generalid;
int? patientOutSA;
String? sessionID;
bool? isDentalAllowedBackend;
int? deviceTypeID;
int? patientID;
String? tokenID;
int? patientTypeID;
int? patientType;
double? latitude;
double? longitude;
int? createdBy;
int? orderServiceID;
int? projectID;
List<PatientERCMCInsertServicesList>? patientERCMCInsertServicesList;
CMCInsertPresOrderRequestModel(
{this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID,
this.tokenID,
this.patientTypeID,
this.patientType,
this.latitude,
this.longitude,
this.createdBy,
this.orderServiceID,
this.projectID,
this.patientERCMCInsertServicesList});
CMCInsertPresOrderRequestModel.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientID = json['PatientID'];
tokenID = json['TokenID'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
latitude = json['Latitude'];
longitude = json['Longitude'];
createdBy = json['CreatedBy'];
orderServiceID = json['OrderServiceID'];
projectID = json['ProjectId'];
if (json['PatientER_CMC_InsertServicesList'] != null) {
patientERCMCInsertServicesList = <PatientERCMCInsertServicesList>[];
json['PatientER_CMC_InsertServicesList'].forEach((v) {
patientERCMCInsertServicesList!.add(
new PatientERCMCInsertServicesList.fromJson(v),
);
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['isOutPatient'] = this.patientOutSA == 0 ? false : true;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['TokenID'] = this.tokenID;
data['PatientTypeID'] = this.patientTypeID;
data['PatientType'] = this.patientType;
data['latitude'] = this.latitude;
data['longitude'] = this.longitude;
// data['CreatedBy'] = this.createdBy;
data['OrderServiceID'] = this.orderServiceID;
data['ProjectID'] = this.projectID;
if (this.patientERCMCInsertServicesList != null) {
data['procedures'] = this.patientERCMCInsertServicesList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class PatientERCMCInsertServicesList {
int? recordID;
String? serviceID;
String? selectedServiceName;
String? selectedServiceNameAR;
dynamic price;
dynamic vAT;
dynamic totalPrice;
PatientERCMCInsertServicesList(
{this.recordID, this.serviceID, this.selectedServiceName, this.selectedServiceNameAR, this.price, this.vAT, this.totalPrice});
PatientERCMCInsertServicesList.fromJson(Map<String, dynamic> json) {
recordID = json['RecordID'];
serviceID = json['ServiceID'];
selectedServiceName = json['selectedServiceName'];
selectedServiceNameAR = json['selectedServiceNameAR'];
price = json['Price'];
vAT = json['VAT'];
totalPrice = json['TotalPrice'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['RecordID'] = this.recordID;
data['ServiceID'] = this.serviceID;
data['selectedServiceName'] = this.selectedServiceName;
data['selectedServiceNameAR'] = this.selectedServiceNameAR;
data['Price'] = this.price;
data['VAT'] = this.vAT;
data['TotalPrice'] = this.totalPrice;
return data;
}
}

@ -1,41 +0,0 @@
class CmcCreateServiceOrderReqModel {
int? recordID;
String? serviceID;
String? selectedServiceName;
String? selectedServiceNameAR;
dynamic price;
dynamic vAT;
dynamic totalPrice;
CmcCreateServiceOrderReqModel({
this.recordID,
this.serviceID,
this.selectedServiceName,
this.selectedServiceNameAR,
this.price,
this.vAT,
this.totalPrice,
});
CmcCreateServiceOrderReqModel.fromJson(Map<String, dynamic> json) {
recordID = json['RecordID'];
serviceID = json['ServiceID'];
selectedServiceName = json['selectedServiceName'];
selectedServiceNameAR = json['selectedServiceNameAR'];
price = json['Price'];
vAT = json['VAT'];
totalPrice = json['TotalPrice'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['RecordID'] = recordID;
data['ServiceID'] = serviceID;
data['selectedServiceName'] = selectedServiceName;
data['selectedServiceNameAR'] = selectedServiceNameAR;
data['Price'] = price;
data['VAT'] = vAT;
data['TotalPrice'] = totalPrice;
return data;
}
}

@ -1,82 +0,0 @@
class OrderUpdateRequestModel {
double? versionID;
int? channel;
int? languageID;
String? iPAdress;
String? generalid;
int? patientOutSA;
String? sessionID;
bool? isDentalAllowedBackend;
int? deviceTypeID;
int? patientID;
String? tokenID;
int? patientTypeID;
int? patientType;
int? presOrderID;
int? presOrderStatus;
int? editedBy;
String? rejectionReason;
OrderUpdateRequestModel({
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID,
this.tokenID,
this.patientTypeID,
this.patientType,
this.presOrderID,
this.presOrderStatus,
this.editedBy,
this.rejectionReason,
});
OrderUpdateRequestModel.fromJson(Map<String, dynamic> json) {
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientID = json['PatientID'];
tokenID = json['TokenID'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
presOrderID = json['PresOrderID'];
presOrderStatus = json['PresOrderStatus'];
editedBy = json['EditedBy'];
rejectionReason = json['RejectionReason'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['VersionID'] = versionID;
data['Channel'] = channel;
data['LanguageID'] = languageID;
data['IPAdress'] = iPAdress;
data['generalid'] = generalid;
data['PatientOutSA'] = patientOutSA;
data['SessionID'] = sessionID;
data['isDentalAllowedBackend'] = isDentalAllowedBackend;
data['DeviceTypeID'] = deviceTypeID;
data['PatientID'] = patientID;
data['TokenID'] = tokenID;
data['PatientTypeID'] = patientTypeID;
data['PatientType'] = patientType;
data['Id'] = presOrderID;
data['ClickButton'] = 14;
data['PresOrderStatus'] = presOrderStatus;
data['EditedBy'] = editedBy;
data['RejectionReason'] = rejectionReason;
return data;
}
}

@ -1,344 +0,0 @@
import 'dart:developer';
class GetCMCAllOrdersResponseModel {
int? iD;
int? patientId;
int? patientOutSa;
bool? isOutPatient;
int? projectId;
int? nearestProjectId;
dynamic longitude;
dynamic latitude;
dynamic appointmentNo;
dynamic dischargeId;
int? statusId;
int? serviceId;
int? channel;
Orderpayment? orderpayment;
dynamic orderselectedservice;
dynamic wforder;
dynamic orderapprovalobj;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
String? statusText;
int? paymentStatus;
dynamic clientRequestid;
dynamic paymentStatusText;
String? projectName;
String? nearestProjectName;
dynamic paymentAmount;
WFOrder? wFOrder;
String? serviceText;
bool? isSentForApproval;
int? exaCartOrderId;
bool? isTimer;
int? timeSeconds;
int? totalPendingSeconds;
int? timeMinute;
int? timeHour;
int? timeTotalSeconds;
int? timeTotalMinute;
int? timeTotalHour;
dynamic approvalStatus;
bool? isActive;
int? clickButton;
List<dynamic>? procedures;
dynamic pickupLocation;
dynamic dropOffLocation;
dynamic clinicName;
dynamic doctorName;
dynamic branch;
dynamic time;
dynamic notes;
GetCMCAllOrdersResponseModel(
{this.iD,
this.patientId,
this.patientOutSa,
this.isOutPatient,
this.projectId,
this.nearestProjectId,
this.longitude,
this.latitude,
this.appointmentNo,
this.dischargeId,
this.statusId,
this.serviceId,
this.channel,
this.orderpayment,
this.orderselectedservice,
this.wforder,
this.orderapprovalobj,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted,
this.statusText,
this.paymentStatus,
this.clientRequestid,
this.paymentStatusText,
this.projectName,
this.nearestProjectName,
this.paymentAmount,
this.wFOrder,
this.serviceText,
this.isSentForApproval,
this.exaCartOrderId,
this.isTimer,
this.timeSeconds,
this.totalPendingSeconds,
this.timeMinute,
this.timeHour,
this.timeTotalSeconds,
this.timeTotalMinute,
this.timeTotalHour,
this.approvalStatus,
this.isActive,
this.clickButton,
this.procedures,
this.pickupLocation,
this.dropOffLocation,
this.clinicName,
this.doctorName,
this.branch,
this.time,
this.notes});
GetCMCAllOrdersResponseModel.fromJson(Map<String, dynamic> json) {
log("responseJson: $json");
iD = json['ID'];
patientId = json['PatientId'];
patientOutSa = json['PatientOutSa'];
isOutPatient = json['IsOutPatient'];
projectId = json['ProjectId'];
nearestProjectId = json['NearestProjectId'];
longitude = json['Longitude'];
latitude = json['Latitude'];
appointmentNo = json['AppointmentNo'];
dischargeId = json['DischargeId'];
statusId = json['StatusId'];
serviceId = json['ServiceId'];
channel = json['Channel'];
orderpayment = json['orderpayment'] != null ? Orderpayment.fromJson(json['orderpayment']) : null;
orderselectedservice = json['orderselectedservice'];
wforder = json['wforder'];
orderapprovalobj = json['orderapprovalobj'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
statusText = json['StatusText'];
paymentStatus = json['PaymentStatus'];
clientRequestid = json['ClientRequestid'];
paymentStatusText = json['PaymentStatusText'];
projectName = json['ProjectName'];
nearestProjectName = json['NearestProjectName'];
paymentAmount = json['PaymentAmount'];
wFOrder = json['WF_order'] != null ? WFOrder.fromJson(json['WF_order']) : null;
serviceText = json['ServiceText'];
isSentForApproval = json['isSentForApproval'];
exaCartOrderId = json['ExaCart_OrderId'];
isTimer = json['isTimer'];
timeSeconds = json['TimeSeconds'];
totalPendingSeconds = json['TotalPendingSeconds'];
timeMinute = json['TimeMinute'];
timeHour = json['TimeHour'];
timeTotalSeconds = json['TimeTotalSeconds'];
timeTotalMinute = json['TimeTotalMinute'];
timeTotalHour = json['TimeTotalHour'];
approvalStatus = json['ApprovalStatus'];
isActive = json['isActive'];
clickButton = json['ClickButton'];
pickupLocation = json['PickupLocation'];
dropOffLocation = json['DropOffLocation'];
clinicName = json['clinicName'];
doctorName = json['DoctorName'];
branch = json['Branch'];
time = json['Time'];
notes = json['Notes'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['ID'] = iD;
data['PatientId'] = patientId;
data['PatientOutSa'] = patientOutSa;
data['IsOutPatient'] = isOutPatient;
data['ProjectId'] = projectId;
data['NearestProjectId'] = nearestProjectId;
data['Longitude'] = longitude;
data['Latitude'] = latitude;
data['AppointmentNo'] = appointmentNo;
data['DischargeId'] = dischargeId;
data['StatusId'] = statusId;
data['ServiceId'] = serviceId;
data['Channel'] = channel;
if (orderpayment != null) {
data['orderpayment'] = orderpayment!.toJson();
}
data['orderselectedservice'] = orderselectedservice;
data['wforder'] = wforder;
data['orderapprovalobj'] = orderapprovalobj;
data['Created'] = created;
data['CreatedBy'] = createdBy;
data['Modified'] = modified;
data['ModifiedBy'] = modifiedBy;
data['IsDeleted'] = isDeleted;
data['StatusText'] = statusText;
data['PaymentStatus'] = paymentStatus;
data['ClientRequestid'] = clientRequestid;
data['PaymentStatusText'] = paymentStatusText;
data['ProjectName'] = projectName;
data['NearestProjectName'] = nearestProjectName;
data['PaymentAmount'] = paymentAmount;
if (wFOrder != null) {
data['WF_order'] = wFOrder!.toJson();
}
data['ServiceText'] = serviceText;
data['isSentForApproval'] = isSentForApproval;
data['ExaCart_OrderId'] = exaCartOrderId;
data['isTimer'] = isTimer;
data['TimeSeconds'] = timeSeconds;
data['TotalPendingSeconds'] = totalPendingSeconds;
data['TimeMinute'] = timeMinute;
data['TimeHour'] = timeHour;
data['TimeTotalSeconds'] = timeTotalSeconds;
data['TimeTotalMinute'] = timeTotalMinute;
data['TimeTotalHour'] = timeTotalHour;
data['ApprovalStatus'] = approvalStatus;
data['isActive'] = isActive;
data['ClickButton'] = clickButton;
data['PickupLocation'] = pickupLocation;
data['DropOffLocation'] = dropOffLocation;
data['clinicName'] = clinicName;
data['DoctorName'] = doctorName;
data['Branch'] = branch;
data['Time'] = time;
data['Notes'] = notes;
return data;
}
}
class Orderpayment {
int? iD;
int? orderId;
dynamic clientRequestId;
dynamic totalAmount;
int? paymentStatus;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
Orderpayment(
{this.iD,
this.orderId,
this.clientRequestId,
this.totalAmount,
this.paymentStatus,
this.order,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted});
Orderpayment.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
orderId = json['OrderId'];
clientRequestId = json['ClientRequestId'];
totalAmount = json['TotalAmount'];
paymentStatus = json['PaymentStatus'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['ID'] = iD;
data['OrderId'] = orderId;
data['ClientRequestId'] = clientRequestId;
data['TotalAmount'] = totalAmount;
data['PaymentStatus'] = paymentStatus;
data['Order'] = order;
data['Created'] = created;
data['CreatedBy'] = createdBy;
data['Modified'] = modified;
data['ModifiedBy'] = modifiedBy;
data['IsDeleted'] = isDeleted;
return data;
}
}
class WFOrder {
dynamic wfButtonsDTO;
int? iD;
int? orderId;
int? previousStep;
int? nextStep;
int? serviceId;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
WFOrder(
{this.wfButtonsDTO,
this.iD,
this.orderId,
this.previousStep,
this.nextStep,
this.serviceId,
this.order,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted});
WFOrder.fromJson(Map<String, dynamic> json) {
wfButtonsDTO = json['wf_ButtonsDTO'];
iD = json['ID'];
orderId = json['OrderId'];
previousStep = json['PreviousStep'];
nextStep = json['NextStep'];
serviceId = json['ServiceId'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['wf_ButtonsDTO'] = wfButtonsDTO;
data['ID'] = iD;
data['OrderId'] = orderId;
data['PreviousStep'] = previousStep;
data['NextStep'] = nextStep;
data['ServiceId'] = serviceId;
data['Order'] = order;
data['Created'] = created;
data['CreatedBy'] = createdBy;
data['Modified'] = modified;
data['ModifiedBy'] = modifiedBy;
data['IsDeleted'] = isDeleted;
return data;
}
}

@ -1,57 +0,0 @@
class GetCMCServicesResponseModel {
int? iD;
String? serviceID;
int? orderServiceID;
String? text;
String? textN;
dynamic price;
dynamic priceVAT;
dynamic priceTotal;
bool? isEnabled;
int? orderId;
int? quantity;
GetCMCServicesResponseModel({
this.iD,
this.serviceID,
this.orderServiceID,
this.text,
this.textN,
this.price,
this.priceVAT,
this.priceTotal,
this.isEnabled,
this.orderId,
this.quantity,
});
GetCMCServicesResponseModel.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
serviceID = json['ServiceID'];
orderServiceID = json['OrderServiceID'];
text = json['Text'];
textN = json['TextN'];
price = json['Price'];
priceVAT = json['PriceVAT'];
priceTotal = json['PriceTotal'];
isEnabled = json['IsEnabled'];
orderId = json['OrderId'];
quantity = json['Quantity'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data['ID'] = this.iD;
data['ServiceID'] = this.serviceID;
data['OrderServiceID'] = this.orderServiceID;
data['Text'] = this.text;
data['TextN'] = this.textN;
data['Price'] = this.price;
data['PriceVAT'] = this.priceVAT;
data['PriceTotal'] = this.priceTotal;
data['IsEnabled'] = this.isEnabled;
data['OrderId'] = this.orderId;
data['Quantity'] = this.quantity;
return data;
}
}

@ -1,25 +0,0 @@
import 'package:flutter/material.dart';
class HmgServicesComponentModel {
int action;
String title;
String subTitle;
String icon;
bool isLogin;
bool isLocked;
Color bgColor;
Color textColor;
String route;
HmgServicesComponentModel(
this.action,
this.title,
this.subTitle,
this.icon,
this.isLogin, {
this.isLocked = false,
this.bgColor = Colors.white,
this.textColor = Colors.black,
this.route = '',
});
}

@ -21,7 +21,6 @@ abstract class LabRepo {
Future<Either<Failure, GenericApiModel<String>>> getLabResultReportPDF({required PatientLabOrdersResponseModel labOrder});
Future<Either<Failure, GenericApiModel<dynamic>>> getLabResultsByAppointmentNo({required num appointmentNo, required num projectID, required num clinicID});
}
class LabRepoImp implements LabRepo {
@ -136,7 +135,6 @@ class LabRepoImp implements LabRepo {
request['SetupID'] = laborder!.setupID;
request['ProjectID'] = laborder.projectID;
request['ClinicID'] = laborder.clinicID;
request['InvoiceType'] = laborder.invoiceType ?? "";
try {
GenericApiModel<List<LabResult>>? apiResponse;
Failure? failure;
@ -186,7 +184,6 @@ class LabRepoImp implements LabRepo {
request['SetupID'] = laborder!.setupID;
request['ProjectID'] = laborder.projectID;
request['ClinicID'] = laborder.clinicID;
request['InvoiceType'] = laborder.invoiceType ?? "";
try {
GenericApiModel<List<PatientLabSpecialResult>>? apiResponse;
Failure? failure;
@ -281,41 +278,4 @@ class LabRepoImp implements LabRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> getLabResultsByAppointmentNo({required num appointmentNo, required num projectID, required num clinicID}) async {
Map<String, dynamic> request = {};
request['AppointmentNo'] = appointmentNo;
request['ProjectID'] = projectID;
request['ClinicID'] = clinicID;
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT,
body: request,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response['ListLabResultsByAppNo'],
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -9,13 +9,11 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart' show Utils;
import 'package:hmg_patient_app_new/features/lab/lab_repo.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_results/lab_result_details.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:intl/intl.dart' show DateFormat;
import 'package:logger/logger.dart';
@ -77,14 +75,14 @@ class LabViewModel extends ChangeNotifier {
required this.navigationService});
initLabProvider() {
// if (isLabNeedToLoad) {
if (isLabNeedToLoad) {
patientLabOrders.clear();
filteredLabOrders.clear();
labOrderTests.clear();
isLabOrdersLoading = true;
isLabResultsLoading = true;
getPatientLabOrders();
// }
}
notifyListeners();
}
@ -94,7 +92,7 @@ class LabViewModel extends ChangeNotifier {
}
Future<void> getPatientLabOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async {
// if (!isLabNeedToLoad) return;
if (!isLabNeedToLoad) return;
isLabOrdersLoading = true;
patientLabOrders.clear();
@ -160,7 +158,7 @@ class LabViewModel extends ChangeNotifier {
filterSuggestions() {
final List<String> labels = patientLabOrders
.expand((order) => order.testDetails ?? [])
.expand((order) => order.testDetails!)
.map((detail) => detail.description)
.whereType<String>()
.toList();
@ -200,69 +198,6 @@ class LabViewModel extends ChangeNotifier {
}
}
Future<void> getLabResultsByAppointmentNo(
{required num appointmentNo,
required num projectID,
required num clinicID,
required int doctorID,
required String clinicName,
required String doctorName,
required String projectName,
required String appointmentDate,
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
bool isVidaPlus = Utils.isVidaPlusProject(projectID.toInt());
final result = await labRepo.getLabResultsByAppointmentNo(appointmentNo: appointmentNo, projectID: projectID, clinicID: clinicID);
result.fold(
(failure) async {
// await errorHandlerService.handleError(failure: failure);
if (onError != null) {
onError(failure.message);
}
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
if (onError != null) {
onError(apiResponse.errorMessage!);
}
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
PatientLabOrdersResponseModel labOrder = PatientLabOrdersResponseModel();
labOrder.invoiceNoVP = isVidaPlus ? apiResponse.data[0]['InvoiceNo'].toString() : "0";
labOrder.invoiceNo = isVidaPlus ? "0" : apiResponse.data[0]['InvoiceNo'].toString();
labOrder.orderNo = apiResponse.data[0]['OrderNo'].toString();
labOrder.invoiceType = apiResponse.data[0]['InvoiceType'].toString();
labOrder.setupID = apiResponse.data[0]['SetupID'].toString();
labOrder.projectID = projectID.toString();
labOrder.clinicID = clinicID.toInt();
labOrder.doctorID = doctorID;
labOrder.clinicDescription = clinicName;
labOrder.doctorName = doctorName;
labOrder.projectName = projectName;
labOrder.orderDate = appointmentDate;
currentlySelectedPatientOrder = labOrder;
getPatientLabResultByHospital(labOrder);
getPatientSpecialResult(labOrder);
if (onSuccess != null) {
onSuccess(apiResponse);
}
navigationService.push(
CustomPageRoute(
page: LabResultByClinic(labOrder: labOrder),
),
);
} else {}
notifyListeners();
}
},
);
}
Future<void> getPatientLabResultByHospital(
PatientLabOrdersResponseModel laborder) async {
isLabResultByHospitalLoading = true;

@ -1,80 +0,0 @@
class GeocodeResponse {
final List<GeocodeResult> results;
final String status;
GeocodeResponse({
required this.results,
required this.status,
});
factory GeocodeResponse.fromJson(Map<String, dynamic> json) {
final resultsList = (json['results'] as List<dynamic>? ?? [])
.map((e) => GeocodeResult.fromJson(e as Map<String, dynamic>))
.toList();
return GeocodeResponse(
results: resultsList,
status: json['status'] ?? '',
);
}
@override
String toString() {
return 'GeocodeResponse(status: $status, results: [${results.map((r) => r.toString()).join(', ')}])';
}
}
class GeocodeResult {
final String formattedAddress;
final Geometry geometry;
final String placeId;
GeocodeResult({
required this.formattedAddress,
required this.geometry,
required this.placeId,
});
factory GeocodeResult.fromJson(Map<String, dynamic> json) {
return GeocodeResult(
formattedAddress: json['formatted_address'] ?? '',
geometry: Geometry.fromJson(json['geometry']),
placeId: json['place_id'] ?? '',
);
}
@override
String toString() {
return 'GeocodeResult(formattedAddress: $formattedAddress, placeId: $placeId, geometry: ${geometry.toString()})';
}
}
class Geometry {
final Location location;
Geometry({required this.location});
factory Geometry.fromJson(Map<String, dynamic> json) {
return Geometry(
location: Location.fromJson(json['location']),
);
}
@override
String toString() => 'Geometry(location: ${location.toString()})';
}
class Location {
final double lat;
final double lng;
Location({required this.lat, required this.lng});
factory Location.fromJson(Map<String, dynamic> json) {
return Location(
lat: (json['lat'] as num).toDouble(),
lng: (json['lng'] as num).toDouble(),
);
}
@override
String toString() => 'Location(lat: $lat, lng: $lng)';
}

@ -1,14 +0,0 @@
class PlaceDetails {
final double lat;
final double lng;
PlaceDetails({required this.lat, required this.lng});
factory PlaceDetails.fromJson(Map<String, dynamic> json) {
final loc = json['result']['geometry']['location'];
return PlaceDetails(
lat: (loc['lat'] as num).toDouble(),
lng: (loc['lng'] as num).toDouble(),
);
}
}

@ -1,11 +0,0 @@
class PlacePrediction {
final String description;
final String placeID;
PlacePrediction({required this.description, required this.placeID});
factory PlacePrediction.fromJson(Map<String, dynamic> json) {
return PlacePrediction(
description: json['description'] ?? '',
placeID: json['place_id'] ?? '',
);
}
}

@ -1,153 +0,0 @@
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart';
import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart';
import '../../core/api_consts.dart';
import 'PlacePrediction.dart';
abstract class LocationRepo {
Future<Either<Failure, GenericApiModel<List<PlacePrediction>>>>
getPlacePredictionsAsInput(String input);
Future<Either<Failure, GenericApiModel<PlaceDetails>>>
getPlaceDetailsOfSelectedPrediction(String placeId);
Future<Either<Failure, GenericApiModel<GeocodeResponse>>>
getGeoCodeFromLatLng(double lat, double lng);
}
class LocationRepoImpl implements LocationRepo {
final ApiClient apiClient;
LocationRepoImpl({required this.apiClient});
@override
Future<Either<Failure, GenericApiModel<List<PlacePrediction>>>> getPlacePredictionsAsInput(
String input) async {
final url = Uri.parse(
'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$input&region=SA&key=$GOOGLE_API_KEY',
);
GenericApiModel<List<PlacePrediction>>? apiResponse;
Failure? failure;
try {
await apiClient.get(
url.toString(),
isExternal: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['predictions'];
final predictionsList = list
.map((item) =>
PlacePrediction.fromJson(item as Map<String, dynamic>))
.toList()
.cast<PlacePrediction>();
apiResponse = GenericApiModel<List<PlacePrediction>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: predictionsList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<GeocodeResponse>>> getGeoCodeFromLatLng(double lat, double lng) async {
final url = Uri.parse(
'https://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$lng&key=$GOOGLE_API_KEY',
);
GenericApiModel<GeocodeResponse>? apiResponse;
Failure? failure;
try {
await apiClient.get(
url.toString(),
isExternal: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final predictionsList = GeocodeResponse.fromJson(response);
apiResponse = GenericApiModel<GeocodeResponse>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: predictionsList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<PlaceDetails>>> getPlaceDetailsOfSelectedPrediction(String placeId) async {
final url = Uri.parse(
'https://maps.googleapis.com/maps/api/place/details/json'
'?place_id=$placeId&fields=geometry&key=$GOOGLE_API_KEY',
);
GenericApiModel<PlaceDetails>? apiResponse;
Failure? failure;
try {
await apiClient.get(
url.toString(),
isExternal: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final predictionsList = PlaceDetails.fromJson(response);
apiResponse = GenericApiModel<PlaceDetails>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: predictionsList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -1,172 +0,0 @@
import 'dart:async';
import 'package:flutter/foundation.dart' show ChangeNotifier;
import 'package:flutter/material.dart';
import 'package:google_maps_flutter_platform_interface/src/types/camera.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart';
import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart';
import 'package:hmg_patient_app_new/features/location/location_repo.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:huawei_map/huawei_map.dart' as HMSCameraServices;
import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices;
import 'PlacePrediction.dart';
class LocationViewModel extends ChangeNotifier {
final LocationRepo locationRepo;
final ErrorHandlerService errorHandlerService;
LocationViewModel({required this.locationRepo, required this.errorHandlerService}){
placeValueInController();
}
List<PlacePrediction> predictions = [];
PlacePrediction? selectedPrediction;
bool isPredictionLoading = false;
GeocodeResponse? geocodeResponse;
PlaceDetails? placeDetails;
Location? mapCapturedLocation;
Completer<GMSMapServices.GoogleMapController>? gmsController;
Completer<HMSCameraServices.HuaweiMapController>? hmsController;
HMSCameraServices.CameraPosition getHMSLocation() {
return HMSCameraServices.CameraPosition(target: HMSCameraServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18);
}
GMSMapServices.CameraPosition getGMSLocation() {
return GMSMapServices.CameraPosition(target: GMSMapServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18);
}
void placeValueInController() async{
if (await getIt<AppState>().isGMSAvailable) {
gmsController = Completer<GMSMapServices.GoogleMapController>();
} else {
hmsController = Completer<HMSCameraServices.HuaweiMapController>();
}
}
FutureOr<void> getPlacesPrediction(String input) async {
predictions = [];
isPredictionLoading= true;
final result = await locationRepo.getPlacePredictionsAsInput(input);
result.fold(
(failure) {
errorHandlerService.handleError(failure: failure);
},
(apiModel) {
predictions = apiModel.data??[];
},
);
isPredictionLoading = false;
notifyListeners();
}
FutureOr<void> getPlaceEncodedData(double? lat, double? lng) async {
geocodeResponse = null;
final result = await locationRepo.getGeoCodeFromLatLng(lat!, lng!);
result.fold(
(failure) {
errorHandlerService.handleError(failure: failure);
},
(apiModel) {
print("Geocode Response: ${apiModel.data}");
geocodeResponse = apiModel.data;
},
);
notifyListeners();
}
FutureOr<void> getPlaceDetails(String placeID) async {
placeDetails = null;
final result = await locationRepo.getPlaceDetailsOfSelectedPrediction(placeID);
result.fold(
(failure) {
errorHandlerService.handleError(failure: failure);
},
(apiModel) {
placeDetails = apiModel.data;
},
);
notifyListeners();
}
handleGMSMapCameraMoved(GMSMapServices.CameraPosition value) {
mapCapturedLocation = Location(lat: value.target.latitude, lng: value.target.longitude);
}
handleHMSMapCameraMoved(HMSCameraServices.CameraPosition value) {
mapCapturedLocation = Location(lat: value.target.lat, lng: value.target.lng);
}
handleOnCameraIdle(){
if(mapCapturedLocation != null) {
getPlaceEncodedData(mapCapturedLocation!.lat, mapCapturedLocation!.lng);
}
}
void updateSearchQuery(String? value) {
if(value == null || value.isEmpty){
predictions = [];
return;
}
getPlacesPrediction(value);
}
void flushSearchPredictions() {
predictions = [];
mapCapturedLocation= null;
placeDetails= null;
geocodeResponse= null;
selectedPrediction= null;
notifyListeners();
}
FutureOr<void> selectPlacePrediction(PlacePrediction placePrediction) async{
selectedPrediction= placePrediction;
await getPlaceDetails(placePrediction.placeID);
}
void moveToCurrentLocation() {
moveController(Location(lat: getIt<AppState>().userLat, lng: getIt<AppState>().userLong));
}
void moveController(Location location) {
print("moving to location");
print("gmsController is null or not $gmsController");
if (getIt<AppState>().isGMSAvailable) {
gmsController?.future.then((controller) {
controller.animateCamera(
GMSMapServices.CameraUpdate.newCameraPosition(
GMSMapServices.CameraPosition(
target: GMSMapServices.LatLng(location.lat, location.lng),
zoom: 18,
),
),
);
});
} else {
print("hmsController is null or not $hmsController");
hmsController?.future.then((controller) {
controller.animateCamera(
HMSCameraServices.CameraUpdate.newCameraPosition(
HMSCameraServices.CameraPosition(
target: HMSCameraServices.LatLng(location.lat, location.lng),
zoom: 18,
),
),
);
});
}
}
}

@ -122,7 +122,7 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier {
}
void handleLastStepForDentalAndLaser() {
//todo_section handle the routing here
//todo handle the routing here
navigationService.pop();
navigationService.push(
CustomPageRoute(

@ -1,92 +0,0 @@
class AskDocRequestType {
String? setupID;
int? parameterGroup;
int? parameterType;
int? parameterCode;
String? description;
String? descriptionN;
String? alias;
String? aliasN;
String? prefix;
String? suffix;
String? isColorCodingRequired;
String? backColor;
String? foreColor;
bool? isBuiltIn;
bool? isActive;
int? createdBy;
String? createdOn;
String? editedBy;
String? editedOn;
String? rowVer;
AskDocRequestType(
{this.setupID,
this.parameterGroup,
this.parameterType,
this.parameterCode,
this.description,
this.descriptionN,
this.alias,
this.aliasN,
this.prefix,
this.suffix,
this.isColorCodingRequired,
this.backColor,
this.foreColor,
this.isBuiltIn,
this.isActive,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.rowVer});
AskDocRequestType.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
parameterGroup = json['ParameterGroup'];
parameterType = json['ParameterType'];
parameterCode = json['ParameterCode'];
description = json['Description'];
descriptionN = json['DescriptionN'];
alias = json['Alias'];
aliasN = json['AliasN'];
prefix = json['Prefix'];
suffix = json['Suffix'];
isColorCodingRequired = json['IsColorCodingRequired'];
backColor = json['BackColor'];
foreColor = json['ForeColor'];
isBuiltIn = json['IsBuiltIn'];
isActive = json['IsActive'];
createdBy = json['CreatedBy'];
createdOn = json['CreatedOn'];
editedBy = json['EditedBy'];
editedOn = json['EditedOn'];
rowVer = json['RowVer'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['ParameterGroup'] = this.parameterGroup;
data['ParameterType'] = this.parameterType;
data['ParameterCode'] = this.parameterCode;
data['Description'] = this.description;
data['DescriptionN'] = this.descriptionN;
data['Alias'] = this.alias;
data['AliasN'] = this.aliasN;
data['Prefix'] = this.prefix;
data['Suffix'] = this.suffix;
data['IsColorCodingRequired'] = this.isColorCodingRequired;
data['BackColor'] = this.backColor;
data['ForeColor'] = this.foreColor;
data['IsBuiltIn'] = this.isBuiltIn;
data['IsActive'] = this.isActive;
data['CreatedBy'] = this.createdBy;
data['CreatedOn'] = this.createdOn;
data['EditedBy'] = this.editedBy;
data['EditedOn'] = this.editedOn;
data['RowVer'] = this.rowVer;
return data;
}
}

@ -62,9 +62,9 @@ class HospitalsModel {
mainProjectID = json['MainProjectID'];
projectOutSA = json['ProjectOutSA'];
usingInDoctorApp = json['UsingInDoctorApp'];
isHMC = json["IsHMC"];
regionArabic = json['RegionNameN'];
regionEnglish = json['RegionName'];
this.isHMC = json["IsHMC"];
this.regionArabic = json['RegionNameN'];
this.regionEnglish = json['RegionName'];
}
String? getRegionName(bool isArabic) {
@ -83,22 +83,22 @@ class HospitalsModel {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Desciption'] = desciption;
data['DesciptionN'] = desciptionN;
data['ID'] = iD;
data['LegalName'] = legalName;
data['LegalNameN'] = legalNameN;
data['Name'] = name;
data['NameN'] = nameN;
data['PhoneNumber'] = phoneNumber;
data['SetupID'] = setupID;
data['DistanceInKilometers'] = distanceInKilometers;
data['IsActive'] = isActive;
data['Latitude'] = latitude;
data['Longitude'] = longitude;
data['MainProjectID'] = mainProjectID;
data['ProjectOutSA'] = projectOutSA;
data['UsingInDoctorApp'] = usingInDoctorApp;
data['Desciption'] = this.desciption;
data['DesciptionN'] = this.desciptionN;
data['ID'] = this.iD;
data['LegalName'] = this.legalName;
data['LegalNameN'] = this.legalNameN;
data['Name'] = this.name;
data['NameN'] = this.nameN;
data['PhoneNumber'] = this.phoneNumber;
data['SetupID'] = this.setupID;
data['DistanceInKilometers'] = this.distanceInKilometers;
data['IsActive'] = this.isActive;
data['Latitude'] = this.latitude;
data['Longitude'] = this.longitude;
data['MainProjectID'] = this.mainProjectID;
data['ProjectOutSA'] = this.projectOutSA;
data['UsingInDoctorApp'] = this.usingInDoctorApp;
return data;
}
}

@ -55,8 +55,8 @@ class PatientAppointmentHistoryResponseModel {
bool? isMedicalReportRequested;
bool? isOnlineCheckedIN;
String? latitude;
List<ListHISGetContactLensPrescription>? listHISGetContactLensPrescription;
List<ListHISGetGlassPrescription>? listHISGetGlassPrescription;
dynamic listHISGetContactLensPerscription;
dynamic listHISGetGlassPerscription;
String? longitude;
dynamic nextAction;
dynamic noOfPatientsRate;
@ -130,8 +130,8 @@ class PatientAppointmentHistoryResponseModel {
this.isMedicalReportRequested,
this.isOnlineCheckedIN,
this.latitude,
this.listHISGetContactLensPrescription,
this.listHISGetGlassPrescription,
this.listHISGetContactLensPerscription,
this.listHISGetGlassPerscription,
this.longitude,
this.nextAction,
this.noOfPatientsRate,
@ -207,18 +207,8 @@ class PatientAppointmentHistoryResponseModel {
isMedicalReportRequested = json['IsMedicalReportRequested'];
isOnlineCheckedIN = json['IsOnlineCheckedIN'];
latitude = json['Latitude'];
if (json['List_HIS_GetContactLensPerscription'] != null) {
listHISGetContactLensPrescription = <ListHISGetContactLensPrescription>[];
json['List_HIS_GetContactLensPerscription'].forEach((v) {
listHISGetContactLensPrescription!.add(ListHISGetContactLensPrescription.fromJson(v));
});
}
if (json['List_HIS_GetGlassPerscription'] != null) {
listHISGetGlassPrescription = <ListHISGetGlassPrescription>[];
json['List_HIS_GetGlassPerscription'].forEach((v) {
listHISGetGlassPrescription!.add(ListHISGetGlassPrescription.fromJson(v));
});
}
listHISGetContactLensPerscription = json['List_HIS_GetContactLensPerscription'];
listHISGetGlassPerscription = json['List_HIS_GetGlassPerscription'];
longitude = json['Longitude'];
nextAction = json['NextAction'];
noOfPatientsRate = json['NoOfPatientsRate'];
@ -295,8 +285,8 @@ class PatientAppointmentHistoryResponseModel {
data['IsMedicalReportRequested'] = this.isMedicalReportRequested;
data['IsOnlineCheckedIN'] = this.isOnlineCheckedIN;
data['Latitude'] = this.latitude;
// data['List_HIS_GetContactLensPerscription'] = this.listHISGetContactLensPerscription;
// data['List_HIS_GetGlassPerscription'] = this.listHISGetGlassPerscription;
data['List_HIS_GetContactLensPerscription'] = this.listHISGetContactLensPerscription;
data['List_HIS_GetGlassPerscription'] = this.listHISGetGlassPerscription;
data['Longitude'] = this.longitude;
data['NextAction'] = this.nextAction;
data['NoOfPatientsRate'] = this.noOfPatientsRate;
@ -311,196 +301,6 @@ class PatientAppointmentHistoryResponseModel {
}
}
class ListHISGetContactLensPrescription {
String? setupId;
int? projectId;
int? patientType;
int? patientId;
int? encounterType;
int? encounterNo;
int? oDOS;
dynamic brand;
dynamic baseCurve;
dynamic power;
dynamic diameter;
dynamic oZ;
dynamic cT;
dynamic blend;
String? remarks;
int? status;
bool? isActive;
String? createdOn;
ListHISGetContactLensPrescription(
{this.setupId,
this.projectId,
this.patientType,
this.patientId,
this.encounterType,
this.encounterNo,
this.oDOS,
this.brand,
this.baseCurve,
this.power,
this.diameter,
this.oZ,
this.cT,
this.blend,
this.remarks,
this.status,
this.isActive,
this.createdOn});
ListHISGetContactLensPrescription.fromJson(Map<String, dynamic> json) {
setupId = json['SetupId'];
projectId = json['ProjectId'];
patientType = json['PatientType'];
patientId = json['PatientId'];
encounterType = json['EncounterType'];
encounterNo = json['EncounterNo'];
oDOS = json['OD_OS'];
brand = json['Brand'];
baseCurve = json['BaseCurve'];
power = json['Power'];
diameter = json['Diameter'];
oZ = json['OZ'];
cT = json['CT'];
blend = json['Blend'];
remarks = json['Remarks'];
status = json['Status'];
isActive = json['IsActive'];
createdOn = json['CreatedOn'];
}
Map<String?, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupId'] = this.setupId;
data['ProjectId'] = this.projectId;
data['PatientType'] = this.patientType;
data['PatientId'] = this.patientId;
data['EncounterType'] = this.encounterType;
data['EncounterNo'] = this.encounterNo;
data['OD_OS'] = this.oDOS;
data['Brand'] = this.brand;
data['BaseCurve'] = this.baseCurve;
data['Power'] = this.power;
data['Diameter'] = this.diameter;
data['OZ'] = this.oZ;
data['CT'] = this.cT;
data['Blend'] = this.blend;
data['Remarks'] = this.remarks;
data['Status'] = this.status;
data['IsActive'] = this.isActive;
data['CreatedOn'] = this.createdOn;
return data;
}
}
class ListHISGetGlassPrescription {
dynamic projectID;
String? setupID;
dynamic patientId;
dynamic encounterType;
dynamic encounterNo;
String? visionType;
double? rightEyeSpherical;
dynamic rightEyeCylinder;
dynamic rightEyeAxis;
dynamic rightEyePrism;
dynamic rightEyeVA;
String? rightEyeRemarks;
dynamic leftEyeSpherical;
dynamic leftEyeCylinder;
dynamic leftEyeAxis;
dynamic leftEyePrism;
dynamic leftEyeVA;
String? leftEyeRemarks;
dynamic pD;
dynamic bVD;
dynamic status;
bool? isActive;
String? createdOn;
ListHISGetGlassPrescription(
{this.projectID,
this.setupID,
this.patientId,
this.encounterType,
this.encounterNo,
this.visionType,
this.rightEyeSpherical,
this.rightEyeCylinder,
this.rightEyeAxis,
this.rightEyePrism,
this.rightEyeVA,
this.rightEyeRemarks,
this.leftEyeSpherical,
this.leftEyeCylinder,
this.leftEyeAxis,
this.leftEyePrism,
this.leftEyeVA,
this.leftEyeRemarks,
this.pD,
this.bVD,
this.status,
this.isActive,
this.createdOn});
ListHISGetGlassPrescription.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
setupID = json['SetupID'];
patientId = json['PatientId'];
encounterType = json['EncounterType'];
encounterNo = json['EncounterNo'];
visionType = json['VisionType'];
rightEyeSpherical = json['RightEyeSpherical'];
rightEyeCylinder = json['RightEyeCylinder'];
rightEyeAxis = json['RightEyeAxis'];
rightEyePrism = json['RightEyePrism'];
rightEyeVA = json['RightEyeVA'];
rightEyeRemarks = json['RightEyeRemarks'];
leftEyeSpherical = json['LeftEyeSpherical'];
leftEyeCylinder = json['LeftEyeCylinder'];
leftEyeAxis = json['LeftEyeAxis'];
leftEyePrism = json['LeftEyePrism'];
leftEyeVA = json['LeftEyeVA'];
leftEyeRemarks = json['LeftEyeRemarks'];
pD = json['PD'];
bVD = json['BVD'];
status = json['Status'];
isActive = json['IsActive'];
createdOn = json['CreatedOn'];
}
Map<String?, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['SetupID'] = this.setupID;
data['PatientId'] = this.patientId;
data['EncounterType'] = this.encounterType;
data['EncounterNo'] = this.encounterNo;
data['VisionType'] = this.visionType;
data['RightEyeSpherical'] = this.rightEyeSpherical;
data['RightEyeCylinder'] = this.rightEyeCylinder;
data['RightEyeAxis'] = this.rightEyeAxis;
data['RightEyePrism'] = this.rightEyePrism;
data['RightEyeVA'] = this.rightEyeVA;
data['RightEyeRemarks'] = this.rightEyeRemarks;
data['LeftEyeSpherical'] = this.leftEyeSpherical;
data['LeftEyeCylinder'] = this.leftEyeCylinder;
data['LeftEyeAxis'] = this.leftEyeAxis;
data['LeftEyePrism'] = this.leftEyePrism;
data['LeftEyeVA'] = this.leftEyeVA;
data['LeftEyeRemarks'] = this.leftEyeRemarks;
data['PD'] = this.pD;
data['BVD'] = this.bVD;
data['Status'] = this.status;
data['IsActive'] = this.isActive;
data['CreatedOn'] = this.createdOn;
return data;
}
}
class PatientAppointmentList {
String? filterName = "";
List<PatientAppointmentHistoryResponseModel>? patientDoctorAppointmentList = [];

@ -6,9 +6,7 @@ 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/common_models/generic_api_model.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/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.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/my_appointments/models/resp_models/hospital_model.dart' show HospitalsModel;
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
@ -16,7 +14,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class MyAppointmentsRepo {
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments({required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false});
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments({required bool isActiveAppointment, required bool isArrivedAppointments});
Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareAppointment(
{required int projectID, required int clinicID, required String appointmentNo, required bool isLiveCareAppointment});
@ -51,13 +49,6 @@ abstract class MyAppointmentsRepo {
Future<Either<Failure, GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>>> getTamaraInstallmentsDetails();
Future<Either<Failure, GenericApiModel<dynamic>>> getActiveAppointmentsCount();
Future<Either<Failure, GenericApiModel<List<AskDocRequestType>>>> getAskDoctorRequestTypes();
Future<Either<Failure, GenericApiModel<dynamic>>> isDoctorAvailable({required int projectID, required int clinicID, required int doctorID});
Future<Either<Failure, GenericApiModel<dynamic>>> sendAskDocCallRequest(
{required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, required String requestType, required String remarks, required String userMobileNumber});
}
class MyAppointmentsRepoImp implements MyAppointmentsRepo {
@ -67,14 +58,13 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
MyAppointmentsRepoImp({required this.loggerService, required this.apiClient});
@override
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments({required bool isActiveAppointment, required bool isArrivedAppointments, bool isForEyeMeasurement = false}) async {
Future<Either<Failure, GenericApiModel<List<PatientAppointmentHistoryResponseModel>>>> getPatientAppointments({required bool isActiveAppointment, required bool isArrivedAppointments}) async {
Map<String, dynamic> mapDevice = {
"IsActiveAppointment": isActiveAppointment,
"IsComingFromCOC": false,
"isForUpcomming": false,
"IsForMedicalReport": false,
"IsForArrived": isArrivedAppointments,
"IsIrisPrescription": isForEyeMeasurement
};
try {
@ -628,122 +618,4 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> isDoctorAvailable({required int projectID, required int clinicID, required int doctorID}) async {
Map<String, dynamic> mapDevice = {"isDentalAllowedBackend": false, "DoctorID": doctorID, "ProjectID": projectID, "ClinicID": clinicID};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
IS_DOCTOR_AVAILABLE_BY_CALENDAR_SCHEDULE,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final isDoctorAvailable = response['IsDoctorAvailable'];
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: isDoctorAvailable,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<AskDocRequestType>>>> getAskDoctorRequestTypes() async {
Map<String, dynamic> mapDevice = {};
try {
GenericApiModel<List<AskDocRequestType>>? apiResponse;
Failure? failure;
await apiClient.post(GET_CALL_REQUEST_TYPE, onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['ListReqTypes'];
final askDoctorRequestTypesList = list.map((item) => AskDocRequestType.fromJson(item as Map<String, dynamic>)).toList().cast<AskDocRequestType>();
apiResponse = GenericApiModel<List<AskDocRequestType>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: askDoctorRequestTypesList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, body: mapDevice);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> sendAskDocCallRequest(
{required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, required String requestType, required String remarks, required String userMobileNumber}) async {
Map<String, dynamic> body = {};
body['ProjectID'] = patientAppointmentHistoryResponseModel.projectID;
body['SetupID'] = patientAppointmentHistoryResponseModel.setupID;
body['DoctorID'] = patientAppointmentHistoryResponseModel.doctorID;
body['PatientMobileNumber'] = userMobileNumber;
body['IsMessageSent'] = false;
body['RequestDate'] = DateUtil.convertDateToString(DateTime.now());
body['RequestTime'] = DateUtil.convertDateToString(DateTime.now());
body['Remarks'] = remarks;
body['Status'] = 2; // 4 for testing only.."cancelled status insert" else should be changed to 1 in live version
body['CreatedBy'] = 102;
body['CreatedOn'] = DateUtil.convertDateToString(DateTime.now());
body['EditedBy'] = 102;
body['EditedOn'] = DateUtil.convertDateToString(DateTime.now());
body['isDentalAllowedBackend'] = false;
body['AppointmentNo'] = patientAppointmentHistoryResponseModel.appointmentNo;
body['ClinicID'] = patientAppointmentHistoryResponseModel.clinicID;
body['QuestionType'] = num.parse(requestType);
body['RequestType'] = num.parse(requestType);
body['RequestTypeID'] = num.parse(requestType);
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(INSERT_CALL_INFO, onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: true,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, body: body);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/appointemnet_filters.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.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/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_share_response_model.dart';
@ -14,8 +13,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
int selectedTabIndex = 0;
int previouslySelectedTab = -1;
int eyeMeasurementsTabSelectedIndex = 0;
MyAppointmentsRepo myAppointmentsRepo;
ErrorHandlerService errorHandlerService;
AppState appState;
@ -29,8 +26,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
bool isAppointmentDataToBeLoaded = true;
bool isEyeMeasurementsAppointmentsLoading = false;
List<AppointmentListingFilters> availableFilters = [];
List<AppointmentListingFilters>? selectedFilter = [];
bool isDateFilterSelected = false;
@ -47,10 +42,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
List<PatientAppointmentHistoryResponseModel> patientMyDoctorsList = [];
List<PatientAppointmentHistoryResponseModel> patientEyeMeasurementsAppointmentsHistoryList = [];
List<AskDocRequestType> askDoctorRequestTypeList = [];
PatientAppointmentShareResponseModel? patientAppointmentShareResponseModel;
GetTamaraInstallmentsDetailsResponseModel? getTamaraInstallmentsDetailsResponseModel;
@ -66,25 +57,18 @@ class MyAppointmentsViewModel extends ChangeNotifier {
notifyListeners();
}
void onEyeMeasurementsTabChanged(int index) {
eyeMeasurementsTabSelectedIndex = index;
notifyListeners();
}
initAppointmentsViewModel() {
if (isAppointmentDataToBeLoaded) {
patientAppointmentsHistoryList.clear();
patientUpcomingAppointmentsHistoryList.clear();
patientArrivedAppointmentsHistoryList.clear();
patientTimelineAppointmentsList.clear();
patientEyeMeasurementsAppointmentsHistoryList.clear();
isMyAppointmentsLoading = true;
isTimeLineAppointmentsLoading = true;
patientMyDoctorsList.clear();
}
isTamaraDetailsLoading = true;
isAppointmentPatientShareLoading = true;
isEyeMeasurementsAppointmentsLoading = true;
notifyListeners();
}
@ -121,11 +105,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
notifyListeners();
}
setIsEyeMeasurementsAppointmentsLoading(bool val) {
isEyeMeasurementsAppointmentsLoading = val;
notifyListeners();
}
setAppointmentReminder(bool value, PatientAppointmentHistoryResponseModel item) {
int index = patientAppointmentsHistoryList.indexOf(item);
if (index != -1) {
@ -134,29 +113,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
}
}
Future<void> getPatientEyeMeasurementAppointments({Function(dynamic)? onSuccess, Function(String)? onError}) async {
patientEyeMeasurementsAppointmentsHistoryList.clear();
notifyListeners();
final result = await myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true, isForEyeMeasurement: true);
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) {
patientEyeMeasurementsAppointmentsHistoryList = apiResponse.data!;
isEyeMeasurementsAppointmentsLoading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> getPatientAppointments(bool isActiveAppointment, bool isArrivedAppointments, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isAppointmentDataToBeLoaded) return;
@ -612,71 +568,4 @@ class MyAppointmentsViewModel extends ChangeNotifier {
},
);
}
Future<void> isDoctorAvailable({required int projectID, required int doctorId, required int clinicId, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await myAppointmentsRepo.isDoctorAvailable(projectID: projectID, doctorID: doctorId, clinicID: clinicId);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage!);
} else if (apiResponse.messageStatus == 1) {
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse.data);
}
}
},
);
}
Future<void> getAskDoctorRequestTypes({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await myAppointmentsRepo.getAskDoctorRequestTypes();
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage!);
} else if (apiResponse.messageStatus == 1) {
askDoctorRequestTypeList = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse.data);
}
}
},
);
}
Future<void> sendAskDocCallRequest({
required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel,
required String requestType,
required String remarks,
required String userMobileNumber,
Function(dynamic)? onSuccess,
Function(String)? onError,
}) async {
final result = await myAppointmentsRepo.sendAskDocCallRequest(
patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel, requestType: requestType, remarks: remarks, userMobileNumber: userMobileNumber);
result.fold(
// (failure) async => await errorHandlerService.handleError(failure: failure),
(failure) async {
await errorHandlerService.handleError(failure: failure);
if (onError != null) onError(failure.message);
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage!);
} else if (apiResponse.messageStatus == 1) {
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse.data);
}
}
},
);
}
}

@ -4,7 +4,6 @@ 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/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';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_check_payment_status_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_project_details_resp_model.dart';
@ -26,8 +25,6 @@ abstract class PayfortRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> updateTamaraRequestStatus(
{required String responseMessage, required String status, required String clientRequestID, required String tamaraOrderID});
Future<Either<Failure, GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>>> getTamaraInstallmentsDetails();
}
class PayfortRepoImp implements PayfortRepo {
@ -253,42 +250,4 @@ class PayfortRepoImp implements PayfortRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>>> getTamaraInstallmentsDetails() async {
try {
GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>? apiResponse;
Failure? failure;
await apiClient.get(
ApiConsts.GET_TAMARA_INSTALLMENTS_URL,
isExternal: true,
isAllowAny: true,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response;
final tamaraInstallmentsList = GetTamaraInstallmentsDetailsResponseModel.fromJson(list.first);
apiResponse = GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: tamaraInstallmentsList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -1,9 +1,6 @@
import 'dart:developer';
import 'package:amazon_payfort/amazon_payfort.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/api_consts.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';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_check_payment_status_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_project_details_resp_model.dart';
@ -24,9 +21,6 @@ class PayfortViewModel extends ChangeNotifier {
late AmazonPayfort _payfort;
final NetworkInfo _info = NetworkInfo();
GetTamaraInstallmentsDetailsResponseModel? getTamaraInstallmentsDetailsResponseModel;
bool isTamaraDetailsLoading = false;
PayfortViewModel({required this.payfortRepo, required this.errorHandlerService});
setIsApplePayConfigurationLoading(bool value) {
@ -42,8 +36,7 @@ class PayfortViewModel extends ChangeNotifier {
notifyListeners();
}
Future<void> getPayfortConfigurations(
{int? serviceId, int? projectId, int integrationId = 2, Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<void> getPayfortConfigurations({int? serviceId, int? projectId, int integrationId = 2, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.getPayfortConfigurations(serviceId: serviceId, projectId: projectId, integrationId: integrationId);
result.fold(
@ -63,8 +56,7 @@ class PayfortViewModel extends ChangeNotifier {
);
}
Future<void> applePayRequestInsert(
{required ApplePayInsertRequest applePayInsertRequest, Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<void> applePayRequestInsert({required ApplePayInsertRequest applePayInsertRequest, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest);
result.fold(
@ -110,7 +102,7 @@ class PayfortViewModel extends ChangeNotifier {
onError!(failure.message);
},
(apiResponse) {
log(apiResponse.data);
print(apiResponse.data);
if (onSuccess != null) {
onSuccess(apiResponse);
}
@ -120,21 +112,15 @@ class PayfortViewModel extends ChangeNotifier {
}
Future<void> updateTamaraRequestStatus(
{required String responseMessage,
required String status,
required String clientRequestID,
required String tamaraOrderID,
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
final result = await payfortRepo.updateTamaraRequestStatus(
responseMessage: responseMessage, status: status, clientRequestID: clientRequestID, tamaraOrderID: tamaraOrderID);
{required String responseMessage, required String status, required String clientRequestID, required String tamaraOrderID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.updateTamaraRequestStatus(responseMessage: responseMessage, status: status, clientRequestID: clientRequestID, tamaraOrderID: tamaraOrderID);
result.fold(
(failure) async {
onError!(failure.message);
},
(apiResponse) {
log(apiResponse.data);
print(apiResponse.data);
if (onSuccess != null) {
onSuccess(apiResponse);
}
@ -148,7 +134,7 @@ class PayfortViewModel extends ChangeNotifier {
String? applePayShaType,
String? applePayShaRequestPhrase,
}) async {
SdkTokenResponse? sdkTokenResponse;
var sdkTokenResponse;
try {
String? deviceId = await _payfort.getDeviceId();
@ -182,7 +168,7 @@ class PayfortViewModel extends ChangeNotifier {
},
);
} catch (e) {
log("Error here: ${e.toString()}");
print("Error here: ${e.toString()}");
}
return sdkTokenResponse;
}
@ -248,8 +234,7 @@ class PayfortViewModel extends ChangeNotifier {
}
}
Future<void> markAppointmentAsTamaraPaid(
{required int projectID, required int appointmentNo, Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<void> markAppointmentAsTamaraPaid({required int projectID, required int appointmentNo, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.markAppointmentAsTamaraPaid(projectID: projectID, appointmentNo: appointmentNo);
result.fold(
@ -257,28 +242,11 @@ class PayfortViewModel extends ChangeNotifier {
onError!(failure.message);
},
(apiResponse) {
log(apiResponse.data);
if (onSuccess != null) {
onSuccess(apiResponse);
}
},
);
}
Future<void> getTamaraInstallmentsDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.getTamaraInstallmentsDetails();
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
getTamaraInstallmentsDetailsResponseModel = apiResponse.data!;
isTamaraDetailsLoading = false;
notifyListeners();
print(apiResponse.data);
if (onSuccess != null) {
onSuccess(apiResponse);
}
},
);
}
}

@ -1,318 +0,0 @@
class PrescriptionDeliveryResponseModel {
int? iD;
int? patientId;
int? patientOutSa;
bool? isOutPatient;
int? projectId;
int? nearestProjectId;
dynamic longitude;
dynamic latitude;
dynamic appointmentNo;
dynamic dischargeId;
int? statusId;
int? serviceId;
int? channel;
Orderpayment? orderpayment;
dynamic orderselectedservice;
dynamic wforder;
dynamic orderapprovalobj;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
String? statusText;
int? paymentStatus;
dynamic clientRequestid;
dynamic paymentStatusText;
String? projectName;
String? nearestProjectName;
dynamic paymentAmount;
WFOrder? wFOrder;
String? serviceText;
bool? isSentForApproval;
int? exaCartOrderId;
bool? isTimer;
int? timeSeconds;
int? totalPendingSeconds;
int? timeMinute;
int? timeHour;
int? timeTotalSeconds;
int? timeTotalMinute;
int? timeTotalHour;
dynamic approvalStatus;
bool? isActive;
int? clickButton;
List<dynamic>? procedures;
dynamic pickupLocation;
dynamic dropOffLocation;
dynamic clinicName;
dynamic doctorName;
dynamic branch;
dynamic time;
dynamic notes;
PrescriptionDeliveryResponseModel(
{this.iD,
this.patientId,
this.patientOutSa,
this.isOutPatient,
this.projectId,
this.nearestProjectId,
this.longitude,
this.latitude,
this.appointmentNo,
this.dischargeId,
this.statusId,
this.serviceId,
this.channel,
this.orderpayment,
this.orderselectedservice,
this.wforder,
this.orderapprovalobj,
this.created,
this.createdBy,
this.modified,
this.modifiedBy,
this.isDeleted,
this.statusText,
this.paymentStatus,
this.clientRequestid,
this.paymentStatusText,
this.projectName,
this.nearestProjectName,
this.paymentAmount,
this.wFOrder,
this.serviceText,
this.isSentForApproval,
this.exaCartOrderId,
this.isTimer,
this.timeSeconds,
this.totalPendingSeconds,
this.timeMinute,
this.timeHour,
this.timeTotalSeconds,
this.timeTotalMinute,
this.timeTotalHour,
this.approvalStatus,
this.isActive,
this.clickButton,
this.procedures,
this.pickupLocation,
this.dropOffLocation,
this.clinicName,
this.doctorName,
this.branch,
this.time,
this.notes});
PrescriptionDeliveryResponseModel.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
patientId = json['PatientId'];
patientOutSa = json['PatientOutSa'];
isOutPatient = json['IsOutPatient'];
projectId = json['ProjectId'];
nearestProjectId = json['NearestProjectId'];
longitude = json['Longitude'];
latitude = json['Latitude'];
appointmentNo = json['AppointmentNo'];
dischargeId = json['DischargeId'];
statusId = json['StatusId'];
serviceId = json['ServiceId'];
channel = json['Channel'];
orderpayment = json['orderpayment'] != null ? new Orderpayment.fromJson(json['orderpayment']) : null;
orderselectedservice = json['orderselectedservice'];
wforder = json['wforder'];
orderapprovalobj = json['orderapprovalobj'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
statusText = json['StatusText'];
paymentStatus = json['PaymentStatus'];
clientRequestid = json['ClientRequestid'];
paymentStatusText = json['PaymentStatusText'];
projectName = json['ProjectName'];
nearestProjectName = json['NearestProjectName'];
paymentAmount = json['PaymentAmount'];
wFOrder = json['WF_order'] != null ? new WFOrder.fromJson(json['WF_order']) : null;
serviceText = json['ServiceText'];
isSentForApproval = json['isSentForApproval'];
exaCartOrderId = json['ExaCart_OrderId'];
isTimer = json['isTimer'];
timeSeconds = json['TimeSeconds'];
totalPendingSeconds = json['TotalPendingSeconds'];
timeMinute = json['TimeMinute'];
timeHour = json['TimeHour'];
timeTotalSeconds = json['TimeTotalSeconds'];
timeTotalMinute = json['TimeTotalMinute'];
timeTotalHour = json['TimeTotalHour'];
approvalStatus = json['ApprovalStatus'];
isActive = json['isActive'];
clickButton = json['ClickButton'];
pickupLocation = json['PickupLocation'];
dropOffLocation = json['DropOffLocation'];
clinicName = json['clinicName'];
doctorName = json['DoctorName'];
branch = json['Branch'];
time = json['Time'];
notes = json['Notes'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['PatientId'] = this.patientId;
data['PatientOutSa'] = this.patientOutSa;
data['IsOutPatient'] = this.isOutPatient;
data['ProjectId'] = this.projectId;
data['NearestProjectId'] = this.nearestProjectId;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
data['AppointmentNo'] = this.appointmentNo;
data['DischargeId'] = this.dischargeId;
data['StatusId'] = this.statusId;
data['ServiceId'] = this.serviceId;
data['Channel'] = this.channel;
if (this.orderpayment != null) {
data['orderpayment'] = this.orderpayment!.toJson();
}
data['orderselectedservice'] = this.orderselectedservice;
data['wforder'] = this.wforder;
data['orderapprovalobj'] = this.orderapprovalobj;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
data['StatusText'] = this.statusText;
data['PaymentStatus'] = this.paymentStatus;
data['ClientRequestid'] = this.clientRequestid;
data['PaymentStatusText'] = this.paymentStatusText;
data['ProjectName'] = this.projectName;
data['NearestProjectName'] = this.nearestProjectName;
data['PaymentAmount'] = this.paymentAmount;
if (this.wFOrder != null) {
data['WF_order'] = this.wFOrder!.toJson();
}
data['ServiceText'] = this.serviceText;
data['isSentForApproval'] = this.isSentForApproval;
data['ExaCart_OrderId'] = this.exaCartOrderId;
data['isTimer'] = this.isTimer;
data['TimeSeconds'] = this.timeSeconds;
data['TotalPendingSeconds'] = this.totalPendingSeconds;
data['TimeMinute'] = this.timeMinute;
data['TimeHour'] = this.timeHour;
data['TimeTotalSeconds'] = this.timeTotalSeconds;
data['TimeTotalMinute'] = this.timeTotalMinute;
data['TimeTotalHour'] = this.timeTotalHour;
data['ApprovalStatus'] = this.approvalStatus;
data['isActive'] = this.isActive;
data['ClickButton'] = this.clickButton;
data['PickupLocation'] = this.pickupLocation;
data['DropOffLocation'] = this.dropOffLocation;
data['clinicName'] = this.clinicName;
data['DoctorName'] = this.doctorName;
data['Branch'] = this.branch;
data['Time'] = this.time;
data['Notes'] = this.notes;
return data;
}
}
class Orderpayment {
int? iD;
int? orderId;
dynamic clientRequestId;
dynamic totalAmount;
int? paymentStatus;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
Orderpayment({this.iD, this.orderId, this.clientRequestId, this.totalAmount, this.paymentStatus, this.order, this.created, this.createdBy, this.modified, this.modifiedBy, this.isDeleted});
Orderpayment.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
orderId = json['OrderId'];
clientRequestId = json['ClientRequestId'];
totalAmount = json['TotalAmount'];
paymentStatus = json['PaymentStatus'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['OrderId'] = this.orderId;
data['ClientRequestId'] = this.clientRequestId;
data['TotalAmount'] = this.totalAmount;
data['PaymentStatus'] = this.paymentStatus;
data['Order'] = this.order;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
return data;
}
}
class WFOrder {
dynamic wfButtonsDTO;
int? iD;
int? orderId;
int? previousStep;
int? nextStep;
int? serviceId;
dynamic order;
String? created;
dynamic createdBy;
dynamic modified;
dynamic modifiedBy;
bool? isDeleted;
WFOrder({this.wfButtonsDTO, this.iD, this.orderId, this.previousStep, this.nextStep, this.serviceId, this.order, this.created, this.createdBy, this.modified, this.modifiedBy, this.isDeleted});
WFOrder.fromJson(Map<String, dynamic> json) {
wfButtonsDTO = json['wf_ButtonsDTO'];
iD = json['ID'];
orderId = json['OrderId'];
previousStep = json['PreviousStep'];
nextStep = json['NextStep'];
serviceId = json['ServiceId'];
order = json['Order'];
created = json['Created'];
createdBy = json['CreatedBy'];
modified = json['Modified'];
modifiedBy = json['ModifiedBy'];
isDeleted = json['IsDeleted'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['wf_ButtonsDTO'] = this.wfButtonsDTO;
data['ID'] = this.iD;
data['OrderId'] = this.orderId;
data['PreviousStep'] = this.previousStep;
data['NextStep'] = this.nextStep;
data['ServiceId'] = this.serviceId;
data['Order'] = this.order;
data['Created'] = this.created;
data['CreatedBy'] = this.createdBy;
data['Modified'] = this.modified;
data['ModifiedBy'] = this.modifiedBy;
data['IsDeleted'] = this.isDeleted;
return data;
}
}

@ -5,7 +5,6 @@ import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/prescription_delivery_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/prescription_detail_response_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
@ -16,13 +15,7 @@ abstract class PrescriptionsRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> getPrescriptionInstructionsPDF({required PatientPrescriptionsResponseModel prescriptionsResponseModel});
Future<Either<Failure, GenericApiModel<dynamic>>> getPrescriptionPDF(
{required PatientPrescriptionsResponseModel prescriptionsResponseModel, required List<PrescriptionDetailResponseModel> prescriptionDetailsList});
Future<Either<Failure, GenericApiModel<dynamic>>> submitPrescriptionDeliveryRequest(
{required String latitude, required String longitude, required String appointmentNo, required String dischargeID, required String projectID});
Future<Either<Failure, GenericApiModel<dynamic>>> getPrescriptionOrdersList();
Future<Either<Failure, GenericApiModel<dynamic>>> getPrescriptionPDF({required PatientPrescriptionsResponseModel prescriptionsResponseModel, required List<PrescriptionDetailResponseModel> prescriptionDetailsList});
}
class PrescriptionsRepoImp implements PrescriptionsRepo {
@ -165,8 +158,7 @@ class PrescriptionsRepoImp implements PrescriptionsRepo {
}
@override
Future<Either<Failure, GenericApiModel>> getPrescriptionPDF(
{required PatientPrescriptionsResponseModel prescriptionsResponseModel, required List<PrescriptionDetailResponseModel> prescriptionDetailsList}) async {
Future<Either<Failure, GenericApiModel>> getPrescriptionPDF({required PatientPrescriptionsResponseModel prescriptionsResponseModel, required List<PrescriptionDetailResponseModel> prescriptionDetailsList}) async {
Map<String, dynamic> mapDevice = {
"AppointmentDate": prescriptionsResponseModel.appointmentDate,
"ClinicName": prescriptionsResponseModel.clinicDescription,
@ -214,84 +206,4 @@ class PrescriptionsRepoImp implements PrescriptionsRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> submitPrescriptionDeliveryRequest(
{required String latitude, required String longitude, required String appointmentNo, required String dischargeID, required String projectID}) async {
Map<String, dynamic> mapDevice = {
"latitude": latitude,
"longitude": longitude,
"AppointmentNo": appointmentNo,
"DischargeID": dischargeID,
"ProjectID": projectID,
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
isRCService: true,
ADD_PRESCRIPTION_ORDER_RC,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> getPrescriptionOrdersList() async {
Map<String, dynamic> mapDevice = {};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
isRCService: true,
GET_ALL_PRESCRIPTION_ORDERS_RC,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final prescriptionOrders = response['response'].map((item) => PrescriptionDeliveryResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PrescriptionDeliveryResponseModel>();
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: prescriptionOrders,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -1,23 +1,8 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/location_util.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart';
import 'package:hmg_patient_app_new/features/location/PlaceDetails.dart';
import 'package:hmg_patient_app_new/features/location/PlacePrediction.dart';
import 'package:hmg_patient_app_new/features/location/location_view_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/prescription_delivery_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/prescription_detail_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_repo.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_delivery_order_summary_page.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/widgets/map/map_utility_screen.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
class PrescriptionsViewModel extends ChangeNotifier {
bool isPrescriptionsOrdersLoading = false;
@ -25,7 +10,6 @@ class PrescriptionsViewModel extends ChangeNotifier {
PrescriptionsRepo prescriptionsRepo;
ErrorHandlerService errorHandlerService;
NavigationService navServices;
// Prescription Orders Lists
List<PatientPrescriptionsResponseModel> patientPrescriptionOrders = [];
@ -43,22 +27,15 @@ class PrescriptionsViewModel extends ChangeNotifier {
String prescriptionPDFBase64Data = "";
late GeocodeResponse locationGeocodeResponse;
bool isPrescriptionsDeliveryOrdersLoading = false;
List<PrescriptionDeliveryResponseModel> prescriptionsOrderList = [];
PrescriptionsViewModel({required this.prescriptionsRepo, required this.errorHandlerService, required this.navServices});
PrescriptionsViewModel({required this.prescriptionsRepo, required this.errorHandlerService});
initPrescriptionsViewModel() {
patientPrescriptionOrders.clear();
patientPrescriptionOrdersByClinic.clear();
patientPrescriptionOrdersByHospital.clear();
patientPrescriptionOrdersViewList.clear();
prescriptionsOrderList.clear();
isPrescriptionsOrdersLoading = true;
isSortByClinic = true;
isPrescriptionsDeliveryOrdersLoading = true;
getPatientPrescriptionOrders();
notifyListeners();
}
@ -196,88 +173,4 @@ class PrescriptionsViewModel extends ChangeNotifier {
},
);
}
Future<void> submitPrescriptionDeliveryRequest(
{required String latitude,
required String longitude,
required String appointmentNo,
required String dischargeID,
required String projectID,
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
final result = await prescriptionsRepo.submitPrescriptionDeliveryRequest(latitude: latitude, longitude: longitude, appointmentNo: appointmentNo, dischargeID: dischargeID, projectID: projectID);
result.fold(
(failure) async {
onError!(failure.message);
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage!);
} else if (apiResponse.messageStatus == 1) {
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
void initiatePrescriptionDelivery() async {
getIt.get<LocationUtils>().getLocation(
isShowConfirmDialog: true,
onSuccess: (position) async {
bool result = await navServices.push(
CustomPageRoute(
page: MapUtilityScreen(
confirmButtonString: LocaleKeys.next.tr(),
titleString: "Select Location".needTranslation,
subTitleString: "Please select the location for prescription delivery".needTranslation,
isGmsAvailable: getIt.get<AppState>().isGMSAvailable,
),
direction: AxisDirection.down),
);
print("Location Selected: $result");
if (result) {
LocationViewModel locationViewModel = getIt.get<LocationViewModel>();
locationGeocodeResponse = locationViewModel.geocodeResponse!;
navServices.push(
CustomPageRoute(
page: PrescriptionDeliveryOrderSummaryPage(),
),
);
}
});
}
Future<void> getPrescriptionOrdersList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
isPrescriptionsDeliveryOrdersLoading = true;
prescriptionsOrderList.clear();
notifyListeners();
final result = await prescriptionsRepo.getPrescriptionOrdersList();
result.fold(
(failure) async {
isPrescriptionsDeliveryOrdersLoading = false;
notifyListeners();
onError!(failure.message);
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
isPrescriptionsDeliveryOrdersLoading = false;
notifyListeners();
onError!(apiResponse.errorMessage!);
} else if (apiResponse.messageStatus == 1) {
isPrescriptionsDeliveryOrdersLoading = false;
prescriptionsOrderList = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
}

@ -9,14 +9,11 @@ import 'package:hmg_patient_app_new/features/radiology/models/resp_models/patien
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class RadiologyRepo {
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrders();
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrders({required String patientId});
Future<Either<Failure, GenericApiModel<String>>> getRadiologyImage({required PatientRadiologyResponseModel patientRadiologyResponseModel});
Future<Either<Failure, GenericApiModel<String>>> getRadiologyReportPDF(
{required PatientRadiologyResponseModel patientRadiologyResponseModel, required AuthenticatedUser authenticatedUser});
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrderByAppointment({required num appointmentNo, required num projectID});
Future<Either<Failure, GenericApiModel<String>>> getRadiologyReportPDF({required PatientRadiologyResponseModel patientRadiologyResponseModel, required AuthenticatedUser authenticatedUser});
}
class RadiologyRepoImp implements RadiologyRepo {
@ -26,7 +23,7 @@ class RadiologyRepoImp implements RadiologyRepo {
RadiologyRepoImp({required this.loggerService, required this.apiClient});
@override
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrders() async {
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrders({required String patientId}) async {
Map<String, dynamic> mapDevice = {};
try {
@ -43,16 +40,10 @@ class RadiologyRepoImp implements RadiologyRepo {
try {
if (response['FinalRadiologyList'] != null && response['FinalRadiologyList'].length != 0) {
final list = response['FinalRadiologyList'];
radOrders = list
.map((item) => PatientRadiologyResponseModel.fromJson(item as Map<String, dynamic>))
.toList()
.cast<PatientRadiologyResponseModel>();
radOrders = list.map((item) => PatientRadiologyResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientRadiologyResponseModel>();
} else {
final list = response['FinalRadiologyListAPI'];
radOrders = list
.map((item) => PatientRadiologyResponseModel.fromJson(item as Map<String, dynamic>))
.toList()
.cast<PatientRadiologyResponseModel>();
radOrders = list.map((item) => PatientRadiologyResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientRadiologyResponseModel>();
}
apiResponse = GenericApiModel<List<PatientRadiologyResponseModel>>(
@ -116,8 +107,7 @@ class RadiologyRepoImp implements RadiologyRepo {
}
@override
Future<Either<Failure, GenericApiModel<String>>> getRadiologyReportPDF(
{required PatientRadiologyResponseModel patientRadiologyResponseModel, required AuthenticatedUser authenticatedUser}) async {
Future<Either<Failure, GenericApiModel<String>>> getRadiologyReportPDF({required PatientRadiologyResponseModel patientRadiologyResponseModel, required AuthenticatedUser authenticatedUser}) async {
Map<String, dynamic> mapDevice = {
"InvoiceNo": Utils.isVidaPlusProject(patientRadiologyResponseModel.projectID!) ? 0 : patientRadiologyResponseModel.invoiceNo,
"InvoiceNo_VP": Utils.isVidaPlusProject(patientRadiologyResponseModel.projectID!) ? patientRadiologyResponseModel.invoiceNo : 0,
@ -131,8 +121,7 @@ class RadiologyRepoImp implements RadiologyRepo {
'ClinicName': patientRadiologyResponseModel.clinicDescription,
'DateofBirth': authenticatedUser.dateofBirth,
'DoctorName': patientRadiologyResponseModel.doctorName,
'OrderDate':
'${patientRadiologyResponseModel.orderDate!.year}-${patientRadiologyResponseModel.orderDate!.month}-${patientRadiologyResponseModel.orderDate!.day}',
'OrderDate': '${patientRadiologyResponseModel.orderDate!.year}-${patientRadiologyResponseModel.orderDate!.month}-${patientRadiologyResponseModel.orderDate!.day}',
'PatientIditificationNum': authenticatedUser.patientIdentificationNo,
'PatientMobileNumber': authenticatedUser.mobileNumber,
'PatientName': "${authenticatedUser.firstName!} ${authenticatedUser.lastName!}",
@ -170,50 +159,4 @@ class RadiologyRepoImp implements RadiologyRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrderByAppointment({required num appointmentNo, required num projectID}) async {
Map<String, dynamic> mapDevice = {
"AppointmentNo": appointmentNo,
"ProjectID": projectID,
};
try {
GenericApiModel<List<PatientRadiologyResponseModel>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_PATIENT_ORDERS,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
final radOrders;
try {
if (response['FinalRadiologyList'] != null && response['FinalRadiologyList'].length != 0) {
final list = response['FinalRadiologyList'];
radOrders = list.map((item) => PatientRadiologyResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientRadiologyResponseModel>();
} else {
final list = response['FinalRadiologyListAPI'];
radOrders = list.map((item) => PatientRadiologyResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientRadiologyResponseModel>();
}
apiResponse = GenericApiModel<List<PatientRadiologyResponseModel>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: radOrders,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -1,11 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
import 'package:hmg_patient_app_new/features/radiology/radiology_repo.dart';
import 'package:hmg_patient_app_new/presentation/radiology/radiology_result_page.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'models/resp_models/patient_radiology_response_model.dart';
@ -15,25 +11,16 @@ class RadiologyViewModel extends ChangeNotifier {
RadiologyRepo radiologyRepo;
ErrorHandlerService errorHandlerService;
NavigationService navigationService;
List<PatientRadiologyResponseModel> patientRadiologyOrders = [];
List<PatientRadiologyResponseModel> filteredRadiologyOrders = [];
List<PatientRadiologyResponseModel> tempRadiologyOrders = [];
String radiologyImageURL = "";
String patientRadiologyReportPDFBase64 = "";
late List<String> _radiologySuggestionsList = [];
List<String> get radiologySuggestions => _radiologySuggestionsList;
late PatientRadiologyResponseModel patientRadiologyOrderByAppointment;
RadiologyViewModel({required this.radiologyRepo, required this.errorHandlerService});
RadiologyViewModel({required this.radiologyRepo, required this.errorHandlerService, required this.navigationService});
initRadiologyViewModel() {
initRadiologyProvider() {
patientRadiologyOrders.clear();
filteredRadiologyOrders.clear();
isRadiologyOrdersLoading = true;
isRadiologyPDFReportLoading = true;
radiologyImageURL = "";
@ -42,7 +29,7 @@ class RadiologyViewModel extends ChangeNotifier {
}
Future<void> getPatientRadiologyOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await radiologyRepo.getPatientRadiologyOrders();
final result = await radiologyRepo.getPatientRadiologyOrders(patientId: "1231755");
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
@ -51,10 +38,7 @@ class RadiologyViewModel extends ChangeNotifier {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
patientRadiologyOrders = apiResponse.data!;
filteredRadiologyOrders = List.from(patientRadiologyOrders);
tempRadiologyOrders = [...patientRadiologyOrders];
isRadiologyOrdersLoading = false;
filterSuggestions();
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
@ -64,37 +48,7 @@ class RadiologyViewModel extends ChangeNotifier {
);
}
Future<void> getPatientRadiologyOrdersByAppointment({required num appointmentNo, required num projectID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await radiologyRepo.getPatientRadiologyOrderByAppointment(appointmentNo: appointmentNo, projectID: projectID);
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 (apiResponse.data!.isNotEmpty) {
if (onSuccess != null) {
onSuccess(apiResponse);
}
navigationService.push(
CustomPageRoute(
page: RadiologyResultPage(patientRadiologyResponseModel: apiResponse.data!.first),
),
);
} else {
if (onError != null) {
onError("No Radiology Orders Found".needTranslation);
}
}
}
},
);
}
Future<void> getRadiologyImage(
{required PatientRadiologyResponseModel patientRadiologyResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<void> getRadiologyImage({required PatientRadiologyResponseModel patientRadiologyResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await radiologyRepo.getRadiologyImage(patientRadiologyResponseModel: patientRadiologyResponseModel);
result.fold(
@ -114,12 +68,8 @@ class RadiologyViewModel extends ChangeNotifier {
}
Future<void> getRadiologyPDF(
{required PatientRadiologyResponseModel patientRadiologyResponseModel,
required AuthenticatedUser authenticatedUser,
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
final result =
await radiologyRepo.getRadiologyReportPDF(patientRadiologyResponseModel: patientRadiologyResponseModel, authenticatedUser: authenticatedUser);
{required PatientRadiologyResponseModel patientRadiologyResponseModel, required AuthenticatedUser authenticatedUser, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await radiologyRepo.getRadiologyReportPDF(patientRadiologyResponseModel: patientRadiologyResponseModel, authenticatedUser: authenticatedUser);
result.fold(
(failure) async => await errorHandlerService.handleError(
@ -143,20 +93,4 @@ class RadiologyViewModel extends ChangeNotifier {
},
);
}
filterSuggestions() {
final List<String> labels = patientRadiologyOrders.map((detail) => detail.description).whereType<String>().toList();
_radiologySuggestionsList = labels.toSet().toList();
notifyListeners();
}
filterRadiologyReports(String query) {
if (query.isEmpty) {
patientRadiologyOrders = tempRadiologyOrders; // reset
} else {
filteredRadiologyOrders = filteredRadiologyOrders.where((desc) => desc.description!.toLowerCase().contains(query.toLowerCase())).toList();
patientRadiologyOrders = filteredRadiologyOrders;
}
notifyListeners();
}
}

@ -1,115 +0,0 @@
// Dart model for the "AncillaryOrderList" structure
// Uses DateUtil.convertStringToDate and DateUtil.dateToDotNetString from your project to parse/serialize .NET-style dates.
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
class AncillaryOrderListModel {
List<AncillaryOrderGroup>? ancillaryOrderList;
AncillaryOrderListModel({this.ancillaryOrderList});
factory AncillaryOrderListModel.fromJson(Map<String, dynamic> json) => AncillaryOrderListModel(
ancillaryOrderList: json['AncillaryOrderList'] != null
? List<AncillaryOrderGroup>.from(
(json['AncillaryOrderList'] as List).map(
(x) => AncillaryOrderGroup.fromJson(x as Map<String, dynamic>),
),
)
: null,
);
}
class AncillaryOrderGroup {
List<AncillaryOrderItem>? ancillaryOrderList;
dynamic errCode;
String? message;
int? patientID;
String? patientName;
int? patientType;
int? projectID;
String? projectName;
String? setupID;
int? statusCode;
AncillaryOrderGroup({
this.ancillaryOrderList,
this.errCode,
this.message,
this.patientID,
this.patientName,
this.patientType,
this.projectID,
this.projectName,
this.setupID,
this.statusCode,
});
factory AncillaryOrderGroup.fromJson(Map<String, dynamic> json) => AncillaryOrderGroup(
ancillaryOrderList: json['AncillaryOrderList'] != null
? List<AncillaryOrderItem>.from(
(json['AncillaryOrderList'] as List).map(
(x) => AncillaryOrderItem.fromJson(x as Map<String, dynamic>),
),
)
: null,
errCode: json['ErrCode'],
message: json['Message'] as String?,
patientID: json['PatientID'] as int?,
patientName: json['PatientName'] as String?,
patientType: json['PatientType'] as int?,
projectID: json['ProjectID'] as int?,
projectName: json['ProjectName'] as String?,
setupID: json['SetupID'] as String?,
statusCode: json['StatusCode'] as int?,
);
}
class AncillaryOrderItem {
dynamic ancillaryProcedureListModels;
DateTime? appointmentDate;
int? appointmentNo;
int? clinicID;
String? clinicName;
int? doctorID;
String? doctorName;
int? invoiceNo;
bool? isCheckInAllow;
bool? isQueued;
DateTime? orderDate;
int? orderNo;
String? projectName; // Added from parent AncillaryOrderGroup
int? projectID; // Added from parent AncillaryOrderGroup
AncillaryOrderItem({
this.ancillaryProcedureListModels,
this.appointmentDate,
this.appointmentNo,
this.clinicID,
this.clinicName,
this.doctorID,
this.doctorName,
this.invoiceNo,
this.isCheckInAllow,
this.isQueued,
this.orderDate,
this.orderNo,
this.projectName,
this.projectID,
});
factory AncillaryOrderItem.fromJson(Map<String, dynamic> json, {String? projectName, int? projectID}) => AncillaryOrderItem(
ancillaryProcedureListModels: json['AncillaryProcedureListModels'],
appointmentDate: DateUtil.convertStringToDate(json['AppointmentDate']),
appointmentNo: json['AppointmentNo'] as int?,
clinicID: json['ClinicID'] as int?,
clinicName: json['ClinicName'] as String?,
doctorID: json['DoctorID'] as int?,
doctorName: json['DoctorName'] as String?,
invoiceNo: json['Invoiceno'] as int?,
isCheckInAllow: json['IsCheckInAllow'] as bool?,
isQueued: json['IsQueued'] as bool?,
orderDate: DateUtil.convertStringToDate(json['OrderDate']),
orderNo: json['OrderNo'] as int?,
projectName: projectName,
projectID: projectID,
);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save