Compare commits

..

No commits in common. 'master' and 'fatima' have entirely different histories.

@ -1,57 +0,0 @@
{
"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.hispace.dbankcloud.ru",
"RU_back":"connect-drru.hispace.dbankcloud.cn",
"SG":"connect-dra.dbankcloud.cn",
"SG_back":"connect-dra.hispace.hicloud.com"
},
"websocketgw_all":{
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
},
"client":{
"cp_id":"2640966000002322881",
"product_id":"737518067793559971",
"client_id":"715996003571874624",
"client_secret":"B5B89A56A53847C6BB9D216A8747E75952760DF9A8232239D8744CD847A8FFDA",
"project_id":"737518067793559971",
"app_id":"104737117",
"api_key":"DAEDACKDrYgyco9mjPV9ZUjCSh1kCr/GBV0nseHH0z2mnxlZ41RksOKmyTi+PUTwmGEPK+VxCup4F9oUf4VbDnCsjB7aNBShYcjR+g==",
"package_name":"hmg.cloudSolutions.mohem"
},
"oauth_client":{
"client_id":"104737117",
"client_type":1
},
"app_info":{
"app_id":"104737117",
"package_name":"hmg.cloudSolutions.mohem"
},
"configuration_version":"3.0",
"appInfos":[
{
"package_name":"hmg.cloudSolutions.mohem",
"client":{
"app_id":"104737117"
},
"app_info":{
"package_name":"hmg.cloudSolutions.mohem",
"app_id":"104737117"
},
"oauth_client":{
"client_type":1,
"client_id":"104737117"
}
}
]
}

@ -21,17 +21,10 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0' flutterVersionName = '1.0'
} }
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.huawei.agconnect'
android { android {
compileSdkVersion 33 compileSdkVersion 33
@ -51,33 +44,18 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "hmg.cloudSolutions.mohem" applicationId "com.cloudSolutions.mohemmtest"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 33 targetSdkVersion 32
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
signingConfigs {
// debug {
// keyAlias keystoreProperties['keyAlias']
// keyPassword keystoreProperties['keyPassword']
// storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
// storePassword keystoreProperties['storePassword']
// }
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes { buildTypes {
release { release {
signingConfig signingConfigs.release // TODO: Add your own signing config for the release build.
minifyEnabled true // Signing with the debug keys for now, so `flutter run --release` works.
shrinkResources true signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
} }

@ -7,20 +7,11 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.NFC" /> <uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- Chat Web RTC Calling -->
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<application <application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="Mohemm" android:label="Mohemm"
android:allowBackup="false"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"> android:roundIcon="@mipmap/ic_launcher_round">
<activity <activity
@ -46,21 +37,15 @@
<meta-data <meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable" android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" /> android:resource="@drawable/launch_background" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity> </activity>
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
</application> </application>
</manifest> </manifest>

@ -3,14 +3,12 @@ buildscript {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.0.3' classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8' classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.huawei.agconnect:agcp:1.8.0.300'
} }
} }
@ -18,7 +16,6 @@ allprojects {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

@ -1,522 +0,0 @@
[
{
"id": "b8f10b10-221c-495d-b99b-6a8094892549",
"titleEn": "How many time Uruguay won FIFA World Cups?",
"titleAr": "How many time Uruguay won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/51b598b6-c837-45be-8734-1374978bd426_congratulations-gif.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 1,
"questionOptions": [
{
"id": "772e6062-543c-4ddc-e516-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "b8f10b10-221c-495d-b99b-6a8094892549",
"sequence": 1,
"image": "null",
"isCorrectOption": false
},
{
"id": "ea3c673e-78c7-41dd-e517-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "b8f10b10-221c-495d-b99b-6a8094892549",
"sequence": 3,
"image": "null",
"isCorrectOption": true
},
{
"id": "7adbdfec-ef77-417e-e518-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "b8f10b10-221c-495d-b99b-6a8094892549",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "895eab85-e321-4d3e-e519-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "b8f10b10-221c-495d-b99b-6a8094892549",
"sequence": 4,
"image": "null",
"isCorrectOption": false
}
]
},
{
"id": "0d60d55f-4067-48f9-9ace-b6309c6a7cf0",
"titleEn": "Who is the current FIFA World Cup Winner?",
"titleAr": "Who is the current FIFA World Cup Winner?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/24dddc50-7583-48b4-9fec-8a490d246191_great-thumbs.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "dd0ba127-26ed-4308-e50e-08dae8b36b35",
"titleEn": "Brazil",
"titleAr": "Brazil",
"questionId": "0d60d55f-4067-48f9-9ace-b6309c6a7cf0",
"sequence": 1,
"image": "null",
"isCorrectOption": false
},
{
"id": "4748df31-95f0-4fee-e50f-08dae8b36b35",
"titleEn": "Argentina",
"titleAr": "Argentina",
"questionId": "0d60d55f-4067-48f9-9ace-b6309c6a7cf0",
"sequence": 4,
"image": "null",
"isCorrectOption": true
},
{
"id": "4079d32a-891b-4e83-e510-08dae8b36b35",
"titleEn": "Germany",
"titleAr": "Germany",
"questionId": "0d60d55f-4067-48f9-9ace-b6309c6a7cf0",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "1c17cfcd-9f19-4020-e511-08dae8b36b35",
"titleEn": "France",
"titleAr": "France",
"questionId": "0d60d55f-4067-48f9-9ace-b6309c6a7cf0",
"sequence": 2,
"image": "null",
"isCorrectOption": false
}
]
},
{
"id": "489659b0-0400-4b64-8ce2-e6fe48db61db",
"titleEn": "How many times England won FIFA World Cups?",
"titleAr": "How many times England won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/a9ffa364-231c-4877-824f-84febac51086_thumbs-up-simon-cowell.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "7f63cd45-ce2c-417f-e502-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "489659b0-0400-4b64-8ce2-e6fe48db61db",
"sequence": 1,
"image": "null",
"isCorrectOption": true
},
{
"id": "34690bfa-0ffd-453f-e503-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "489659b0-0400-4b64-8ce2-e6fe48db61db",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "4526efdd-ff6f-4340-e504-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "489659b0-0400-4b64-8ce2-e6fe48db61db",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "65d06188-fa63-49fd-e505-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "489659b0-0400-4b64-8ce2-e6fe48db61db",
"sequence": 4,
"image": "null",
"isCorrectOption": false
}
]
},
{
"id": "253fc396-dab9-41ca-82bd-511f98c5dee8",
"titleEn": "How many time Germany won FIFA World Cups?",
"titleAr": "How many time Germany won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/012d6493-3612-42c9-8f6f-84417d4736d4_good-job-well-done.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "dce4999c-5629-45f4-e4f6-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "253fc396-dab9-41ca-82bd-511f98c5dee8",
"sequence": 1,
"image": "null",
"isCorrectOption": false
},
{
"id": "00913ba1-5ccc-4d7c-e4f7-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "253fc396-dab9-41ca-82bd-511f98c5dee8",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "9e5f5e89-608e-4fc9-e4f8-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "253fc396-dab9-41ca-82bd-511f98c5dee8",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "a535cacf-ee4d-4895-e4f9-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "253fc396-dab9-41ca-82bd-511f98c5dee8",
"sequence": 4,
"image": "null",
"isCorrectOption": true
}
]
},
{
"id": "669c4fe2-a3e6-4e29-8c56-ae09efa9ba6c",
"titleEn": "How many times Portugal won FIFA World Cups?",
"titleAr": "How many times Portugal won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/ca3f32a1-ed9f-45df-b2fb-3d1df78d5651_congrats-14.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "597c308e-3f09-4a05-e506-08dae8b36b35",
"titleEn": "0",
"titleAr": "0",
"questionId": "669c4fe2-a3e6-4e29-8c56-ae09efa9ba6c",
"sequence": 1,
"image": "null",
"isCorrectOption": true
},
{
"id": "2face927-7c8e-4945-e507-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "669c4fe2-a3e6-4e29-8c56-ae09efa9ba6c",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "bde21640-798e-4750-e508-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "669c4fe2-a3e6-4e29-8c56-ae09efa9ba6c",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "9312acac-f0c3-4ed4-e509-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "669c4fe2-a3e6-4e29-8c56-ae09efa9ba6c",
"sequence": 4,
"image": "null",
"isCorrectOption": false
}
]
},
{
"id": "f91774ce-14f0-4af0-9a77-e649bc013b44",
"titleEn": "How many times Spain won FIFA World Cups?",
"titleAr": "How many times Spain won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/6484c5bc-09fd-4586-8036-67868afbe27b_good-job-well-done.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "2f968964-ce91-4478-e512-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "f91774ce-14f0-4af0-9a77-e649bc013b44",
"sequence": 1,
"image": "null",
"isCorrectOption": true
},
{
"id": "4fed9355-2c9f-458d-e513-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "f91774ce-14f0-4af0-9a77-e649bc013b44",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "8f232a43-3792-4cd0-e514-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "f91774ce-14f0-4af0-9a77-e649bc013b44",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "24478e43-bf4c-4852-e515-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "f91774ce-14f0-4af0-9a77-e649bc013b44",
"sequence": 4,
"image": "null",
"isCorrectOption": false
}
]
},
{
"id": "fd3a90e6-5b35-4035-bc1c-4483facaf6d3",
"titleEn": "How many times France won FIFA World Cups?",
"titleAr": "How many times France won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/24dddc50-7583-48b4-9fec-8a490d246191_great-thumbs.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "9d0743e0-9f3f-48d0-e4fa-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "fd3a90e6-5b35-4035-bc1c-4483facaf6d3",
"sequence": 1,
"image": "null",
"isCorrectOption": false
},
{
"id": "a81eda99-d9ad-49e0-e4fb-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "fd3a90e6-5b35-4035-bc1c-4483facaf6d3",
"sequence": 2,
"image": "null",
"isCorrectOption": true
},
{
"id": "7ca78891-890d-4023-e4fc-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "fd3a90e6-5b35-4035-bc1c-4483facaf6d3",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "d1a98bd9-8afa-49c1-e4fd-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "fd3a90e6-5b35-4035-bc1c-4483facaf6d3",
"sequence": 4,
"image": "null",
"isCorrectOption": false
}
]
},
{
"id": "3a35855d-3ed7-4d45-8864-9135d71378de",
"titleEn": "How many time Argentina won FIFA World Cups?",
"titleAr": "How many time Argentina won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/24dddc50-7583-48b4-9fec-8a490d246191_great-thumbs.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "f0766816-837f-47e6-e51a-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "3a35855d-3ed7-4d45-8864-9135d71378de",
"sequence": 1,
"image": "null",
"isCorrectOption": false
},
{
"id": "dc9c68de-afa4-4b63-e51b-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "3a35855d-3ed7-4d45-8864-9135d71378de",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "52f2d024-8a29-4781-e51c-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "3a35855d-3ed7-4d45-8864-9135d71378de",
"sequence": 3,
"image": "null",
"isCorrectOption": true
},
{
"id": "122636e4-5e98-499e-e51d-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "3a35855d-3ed7-4d45-8864-9135d71378de",
"sequence": 4,
"image": "null",
"isCorrectOption": false
}
]
},
{
"id": "6c9d809d-683b-4d77-b98e-62a0d083488a",
"titleEn": "How many times Brazil won FIFA World Cups?",
"titleAr": "How many times Brazil won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/a9ffa364-231c-4877-824f-84febac51086_thumbs-up-simon-cowell.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "4e94437a-b10d-46c6-e4fe-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "6c9d809d-683b-4d77-b98e-62a0d083488a",
"sequence": 1,
"image": "null",
"isCorrectOption": false
},
{
"id": "6e0e8baa-c13e-45f1-e4ff-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "6c9d809d-683b-4d77-b98e-62a0d083488a",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "3065d26a-9aa4-4626-e500-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "6c9d809d-683b-4d77-b98e-62a0d083488a",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "6cc3ff60-02cc-4e59-e501-08dae8b36b35",
"titleEn": "5",
"titleAr": "5",
"questionId": "6c9d809d-683b-4d77-b98e-62a0d083488a",
"sequence": 4,
"image": "null",
"isCorrectOption": true
}
]
},
{
"id": "e8c8442e-f370-444d-bee9-f7f75d146e5c",
"titleEn": "How many times Italy won FIFA World Cups?",
"titleAr": "How many times Italy won FIFA World Cups?",
"marathonId": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"questionTypeId": 1,
"questionTime": 10,
"nextQuestGap": 5,
"gapType": 0,
"gapText": null,
"gapImage": "Questions/34f3c402-1244-4320-98c2-751cb2a347c5_congrats-1.gif",
"questOptionsLimit": 0,
"remainingParticipantCount": 0,
"questionOptions": [
{
"id": "53d456b7-8f56-4c58-e50a-08dae8b36b35",
"titleEn": "1",
"titleAr": "1",
"questionId": "e8c8442e-f370-444d-bee9-f7f75d146e5c",
"sequence": 1,
"image": "null",
"isCorrectOption": false
},
{
"id": "280df6d7-ca61-4d78-e50b-08dae8b36b35",
"titleEn": "2",
"titleAr": "2",
"questionId": "e8c8442e-f370-444d-bee9-f7f75d146e5c",
"sequence": 2,
"image": "null",
"isCorrectOption": false
},
{
"id": "769939dc-4a46-4f4f-e50c-08dae8b36b35",
"titleEn": "3",
"titleAr": "3",
"questionId": "e8c8442e-f370-444d-bee9-f7f75d146e5c",
"sequence": 3,
"image": "null",
"isCorrectOption": false
},
{
"id": "c389fae7-0019-4922-e50d-08dae8b36b35",
"titleEn": "4",
"titleAr": "4",
"questionId": "e8c8442e-f370-444d-bee9-f7f75d146e5c",
"sequence": 4,
"image": "null",
"isCorrectOption": true
}
]
}
]

@ -1,46 +0,0 @@
{
"id": "979813be-eafa-4d3e-d27e-08dae8a08a3b",
"titleEn": "FIFA World Cup",
"titleAr": "undefined",
"descEn": "FIFA World Cup Description",
"descAr": "undefined",
"questionTime": 10,
"winDeciderTime": 30,
"winnersCount": 1,
"questGapTime": 5,
"startTime": "2022-12-28T10:44:41",
"endTime": null,
"marathoneStatusId": 4,
"scheduleTime": "2022-12-28T10:14:41",
"selectedLanguage": 0,
"projects": {
"id": "b1cd3fa3-bb27-422e-a4c1-08dac09254df",
"nameEn": "Cloud Solutions",
"nameAr": "333شركة حلول السحابة للاتصالات وتقنية المعلومات",
"projectCode": "CS"
},
"sponsors": [
{
"id": "3272b127-b388-4f09-425b-08dac2eb788e",
"nameEn": "Cloud Solutions",
"nameAr": "حل السحابة",
"image": "SponsorImage/b9aed4a8-42b2-45fc-b6f1-47ee0c7b4138_sponsor.jpeg",
"video": "SponsorVideo/9ab678ab-1b4c-4ea4-aaf2-32ce1353d3fe_sample-10s.mp4",
"logo": "SponsorLogo/eb029f0d-bce1-4a61-b0c0-abaa484912a0_sponsor.jpeg",
"videoDuration": null,
"sponsorPrizes": [
{
"id": "e657a18c-6fb2-4099-07c8-08dae89efcd3",
"marathonPrizeEn": "SAR 500",
"marathonPrizeAr": "SAR 500"
}
]
}
],
"questions": null,
"isEmailSent": false,
"totalQuestions": 10,
"cancelReason": null,
"marathonBufferTime": 30,
"currentTime": "2022-12-28T08:03:24.3671803Z"
}

@ -25,7 +25,6 @@
"checkIn": "تحقق في", "checkIn": "تحقق في",
"workList": "قائمة العمل", "workList": "قائمة العمل",
"leaveBalance": "رصيد الاجازات", "leaveBalance": "رصيد الاجازات",
"businessTripBalance": "رصيد رحلة العمل",
"missingSwipes": "تسجيل بصمة حضور", "missingSwipes": "تسجيل بصمة حضور",
"ticketBalance": "رصيد التذكرة", "ticketBalance": "رصيد التذكرة",
"other": "آخر", "other": "آخر",
@ -307,7 +306,6 @@
"actionBy": "الرد بواسطة", "actionBy": "الرد بواسطة",
"pending": "معلق", "pending": "معلق",
"pendingTransactions": "المعاملات المعلقه", "pendingTransactions": "المعاملات المعلقه",
"notices": "إشعارات",
"selectRequestType": "الرجاء اختيار نوع الطلب", "selectRequestType": "الرجاء اختيار نوع الطلب",
"dateFrom": "من تاريخ", "dateFrom": "من تاريخ",
"dateTo": "الى تاريخ", "dateTo": "الى تاريخ",
@ -482,7 +480,6 @@
"gameTime": "وقت اللعب:", "gameTime": "وقت اللعب:",
"joinMarathon": "انضم إلى ماراثون", "joinMarathon": "انضم إلى ماراثون",
"joinDemoMarathon": "انضم إلى الماراثون التجريبي", "joinDemoMarathon": "انضم إلى الماراثون التجريبي",
"demo":"تجريبي",
"minutes": "الدقائق", "minutes": "الدقائق",
"seconds": "ثواني", "seconds": "ثواني",
"note": "ملحوظة:", "note": "ملحوظة:",
@ -492,11 +489,9 @@
"sponsoredBy": "برعاية:", "sponsoredBy": "برعاية:",
"question": "سؤال", "question": "سؤال",
"marathoners": "الماراثون", "marathoners": "الماراثون",
"marathoner": "ماراثونر",
"prize": "جائزة:", "prize": "جائزة:",
"winnerSelection": "اختيار الفائز", "winnerSelection": "اختيار الفائز",
"qualifiers": "تصفيات", "qualifiers": "تصفيات",
"qualifier": "المؤهل",
"getReadyForContest": "استعد للمسابقة القادمة:", "getReadyForContest": "استعد للمسابقة القادمة:",
"winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.",
"fingersCrossed": "تشابك الاصابع!!!", "fingersCrossed": "تشابك الاصابع!!!",
@ -519,26 +514,7 @@
"startingIn": "يبدأ في", "startingIn": "يبدأ في",
"youAreOutOfContest": "أنت خارج المسابقة.", "youAreOutOfContest": "أنت خارج المسابقة.",
"winners": "الفائزين!!!", "winners": "الفائزين!!!",
"expireAfter":"تنتهي بعد",
"oneWeek":"أسبوع 1",
"twoWeek":"2 أسبوع",
"noUpcoming": "لا يوجد قادم", "noUpcoming": "لا يوجد قادم",
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية", "fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية",
"noWinner": "حزين! لم يفز أحد اليوم.", "noWinner": "حزين! لم يفز أحد اليوم."
"myTeam" : "فريقي",
"youCanPlayDemo": "لكن يمكنك لعب العرض",
"qualification": "مؤهلات",
"esteblishmentName": "اسم المؤسسة",
"gradeDescription": "وصف الصف",
"type": "يكتب",
"status": "حالة",
"leaveType": "نوع الإجازة",
"attendanceType": "نوع الحضور",
"help": "يساعد",
"dear": "عزيزي",
"assistant": "للحصول على المساعدة ، يمكنك تقديم الطلب على نظام سعيد أو الاتصال بمركز الاتصال الموحد على 8310200",
"employee_leaves_calender": "تقويم أوراق الموظفين",
"view_your_leave_information": "عرض معلومات إجازتك",
"view_details": "عرض التفاصيل",
"hierarchy": "تَسَلسُل"
} }

@ -25,7 +25,6 @@
"checkIn": "Check In", "checkIn": "Check In",
"workList": "Work List", "workList": "Work List",
"leaveBalance": "Leave Balance", "leaveBalance": "Leave Balance",
"businessTripBalance": "Business Trip Balance",
"missingSwipes": "Missing Swipes", "missingSwipes": "Missing Swipes",
"ticketBalance": "Ticket Balance", "ticketBalance": "Ticket Balance",
"other": "Other", "other": "Other",
@ -303,7 +302,6 @@
"topic": "Topic", "topic": "Topic",
"actionBy": "Action By", "actionBy": "Action By",
"pendingTransactions": "Pending Transactions", "pendingTransactions": "Pending Transactions",
"notices": "Notices",
"selectRequestType": "Please select request type", "selectRequestType": "Please select request type",
"dateFrom": "Date From", "dateFrom": "Date From",
"dateTo": "Date To", "dateTo": "Date To",
@ -426,7 +424,7 @@
"typeCurrentPasswordBelow": "Type Your Current password below", "typeCurrentPasswordBelow": "Type Your Current password below",
"currentPassword": "Current password", "currentPassword": "Current password",
"concurrentReports": "Concurrent Reports", "concurrentReports": "Concurrent Reports",
"EnterNewAddressMoved": "Enter a new address if you have moved", "EnterNewAddressMoved" : "Enter a new address if you have moved",
"CorrectAddress": "Correct or amend this address", "CorrectAddress": "Correct or amend this address",
"SelectChangeWantToMake": "Select the type of change you want to make", "SelectChangeWantToMake": "Select the type of change you want to make",
"profile": { "profile": {
@ -471,7 +469,6 @@
"gameTime": "Game Time:", "gameTime": "Game Time:",
"joinMarathon": "Join Marathon", "joinMarathon": "Join Marathon",
"joinDemoMarathon": "Join Demo Marathon", "joinDemoMarathon": "Join Demo Marathon",
"demo": "Demo",
"minutes": "Minutes", "minutes": "Minutes",
"seconds": "Seconds", "seconds": "Seconds",
"note": "Note:", "note": "Note:",
@ -481,7 +478,6 @@
"sponsoredBy": "Sponsored By:", "sponsoredBy": "Sponsored By:",
"question": "Question", "question": "Question",
"marathoners": "Marathoners", "marathoners": "Marathoners",
"marathoner": "Marathoner",
"prize": "Prize:", "prize": "Prize:",
"advancedSearch": "Advanced Search", "advancedSearch": "Advanced Search",
"openNot": "Open Notifications", "openNot": "Open Notifications",
@ -496,7 +492,6 @@
"none": "None", "none": "None",
"winnerSelection": "Winner Selection", "winnerSelection": "Winner Selection",
"qualifiers": "Qualifiers", "qualifiers": "Qualifiers",
"qualifier": "Qualifier",
"getReadyForContest": "Get Ready for the coming contest:", "getReadyForContest": "Get Ready for the coming contest:",
"winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.",
"fingersCrossed": "Fingers Crossed!!!", "fingersCrossed": "Fingers Crossed!!!",
@ -510,8 +505,8 @@
"favorite": "My Favorites", "favorite": "My Favorites",
"searchfromchat": "Search from chat", "searchfromchat": "Search from chat",
"yourAnswerCorrect": "Your answer is correct", "yourAnswerCorrect": "Your answer is correct",
"youMissedTheQuestion": "You ran out of time. You are out of the game. But you can continue as a viewer.", "youMissedTheQuestion": "You ran out of time. You are out of the game. But you can continue and as a viewer.",
"wrongAnswer": "Your answer is Incorrect. You are out of the game. But you can continue as a viewer.", "wrongAnswer": "Your answer is Incorrect. You are out of the game. But you can continue and as a viewer.",
"oops": "Ooopsss!!!!", "oops": "Ooopsss!!!!",
"winner": "WINNER", "winner": "WINNER",
"youWantToLeaveMarathon": "Are you sure you want to go back? You will be out of the contest.", "youWantToLeaveMarathon": "Are you sure you want to go back? You will be out of the contest.",
@ -519,27 +514,7 @@
"startingIn": "Starting in", "startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest.", "youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!", "winners": "WINNERS!!!",
"expireAfter": "Expires After",
"oneWeek": "1 Week",
"twoWeek": "2 Week",
"noUpcoming": "There is no upcoming", "noUpcoming": "There is no upcoming",
"fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified.", "fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified.",
"noWinner": "Sad! No one won today.", "noWinner": "Sad! No one won today."
"myTeam": "My Team",
"youCanPlayDemo": "But you can play demo",
"qualification": "Qualifications",
"esteblishmentName": "Establishment Name",
"gradeDescription": "Grade Description",
"type": "Type",
"status": "Status",
"leaveType": "Leave Type",
"attendanceType": "Attendance Type",
"help": "Help",
"dear": "Dear",
"assistant": "For assistance, you can submit the request on the Saeed system or call the unified call center on 8310200",
"employee_leaves_calender": "Employee Leaves Calender",
"view_your_leave_information": "View Your Leave Information",
"view_details": "View Details",
"hierarchy": "Hierarchy"
} }

@ -1,8 +1,5 @@
import UIKit import UIKit
import Flutter import Flutter
import Firebase
import flutter_local_notifications
@UIApplicationMain @UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
@ -10,13 +7,6 @@ import flutter_local_notifications
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
FirebaseApp.configure()
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
GeneratedPluginRegistrant.register(with: registry)
}
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }

@ -2,15 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>CADisableMinimumFrameDurationOnPhone</key>
<true/> <true/>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
@ -22,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>MOHEMM</string> <string>mohem_flutter_app</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
@ -42,7 +33,7 @@
<key>NFCReaderUsageDescription</key> <key>NFCReaderUsageDescription</key>
<string>This App requires access to NFC to mark your attendance.</string> <string>This App requires access to NFC to mark your attendance.</string>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>This app requires camera access to capture &amp; upload picture as profile image.</string> <string>This app requires camera access to capture &amp; upload pictures.</string>
<key>NSFaceIDUsageDescription</key> <key>NSFaceIDUsageDescription</key>
<string>This app requires Face ID to allow biometric authentication for app login.</string> <string>This app requires Face ID to allow biometric authentication for app login.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
@ -57,11 +48,8 @@
<string>This app requires microphone access to for call.</string> <string>This app requires microphone access to for call.</string>
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>
<string>fetch</string>
<string>remote-notification</string> <string>remote-notification</string>
</array> </array>
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
@ -81,15 +69,13 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>0000</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>com.apple.developer.nfc.readersession.formats</key> <key>com.apple.developer.nfc.readersession.formats</key>
<array> <array>
<string>TAG</string> <string>TAG</string>
</array> </array>
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>0000</string>
</array>
</dict> </dict>
</plist> </plist>

@ -19,11 +19,7 @@ class APIError {
APIError(this.errorCode, this.errorMessage, this.errorType); APIError(this.errorCode, this.errorMessage, this.errorType);
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage, 'errorType': errorType,};
'errorCode': errorCode,
'errorMessage': errorMessage,
'errorType': errorType,
};
@override @override
String toString() { String toString() {
@ -77,35 +73,34 @@ class ApiClient {
if (headers != null && headers.isNotEmpty) { if (headers != null && headers.isNotEmpty) {
_headers.addAll(headers); _headers.addAll(headers);
} }
if (!kReleaseMode) {
print("Url:$url"); print("Url:$url");
var bodyJson = json.encode(jsonObject); var bodyJson = json.encode(jsonObject);
print("body:$bodyJson"); print("body:$bodyJson");
}
var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes, isFormData: isFormData); var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes, isFormData: isFormData);
try { // try {
if (!kReleaseMode) { if (!kReleaseMode) {
logger.i("res: " + response.body); logger.i("res: " + response.body);
} }
var jsonData = jsonDecode(response.body);
var jsonData = jsonDecode(response.body); if (jsonData["IsAuthenticated"] != null) {
if (jsonData["IsAuthenticated"] != null) { AppState().setIsAuthenticated = jsonData["IsAuthenticated"];
AppState().setIsAuthenticated = jsonData["IsAuthenticated"]; }
} if (jsonData["ErrorMessage"] == null) {
if (jsonData["ErrorMessage"] == null) { return factoryConstructor(jsonData);
return factoryConstructor(jsonData); } else {
} else { APIError? apiError;
APIError? apiError; apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage'], jsonData['ErrorType']);
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage'], jsonData['ErrorType'] ?? 0); throw APIException(APIException.BAD_REQUEST, error: apiError);
throw APIException(APIException.BAD_REQUEST, error: apiError);
}
} catch (ex) {
if (ex is APIException) {
rethrow;
} else {
throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex);
}
} }
// } catch (ex) {
// if (ex is APIException) {
// rethrow;
// } else {
// throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex);
// }
// }
} }
Future<Response> postJsonForResponse<T>(String url, T jsonObject, Future<Response> postJsonForResponse<T>(String url, T jsonObject,

@ -30,13 +30,10 @@ class ChatApiClient {
{ {
"employeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(), "employeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
"password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG", "password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG",
"isMobile": true,
"deviceToken": AppState().getDeviceToken,
}, },
); );
if (!kReleaseMode) { if (!kReleaseMode) {
logger.i("login-res: " + response.body); logger.i("res: " + response.body);
} }
if (response.statusCode == 200) { if (response.statusCode == 200) {
userLoginResponse = user.userAutoLoginModelFromJson(response.body); userLoginResponse = user.userAutoLoginModelFromJson(response.body);
@ -49,15 +46,15 @@ class ChatApiClient {
return userLoginResponse; return userLoginResponse;
} }
Future<ChatUserModel> getChatMemberFromSearch(String searchParam, int cUserId, int pageNo) async { Future<List<ChatUser>?> getChatMemberFromSearch(String sName, int cUserId) async {
ChatUserModel chatUserModel; Response response = await ApiClient().getJsonForResponse(
Response response = await ApiClient().postJsonForResponse("${ApiConsts.chatLoginTokenUrl}getUserWithStatusAndFavAsync", {"employeeNumber": cUserId, "userName": searchParam, "pageNumber": pageNo}, "${ApiConsts.chatLoginTokenUrl}getUserWithStatusAndFavAsync/$sName/$cUserId",
token: AppState().chatDetails!.response!.token); token: AppState().chatDetails!.response!.token,
);
if (!kReleaseMode) { if (!kReleaseMode) {
logger.i("res: " + response.body); logger.i("res: " + response.body);
} }
chatUserModel = chatUserModelFromJson(response.body); return List<ChatUser>.from(json.decode(response.body).map((x) => ChatUser.fromJson(x)));
return chatUserModel;
} }
//Get User Recent Chats //Get User Recent Chats

@ -32,7 +32,7 @@ class ItemsForSaleApiClient {
getSaleCategoriesListObj.titleAr = "الجميع"; getSaleCategoriesListObj.titleAr = "الجميع";
getSaleCategoriesListObj.isActive = true; getSaleCategoriesListObj.isActive = true;
getSaleCategoriesListObj.content = getSaleCategoriesListObj.content =
'<svg xmlns="http://www.w3.org/2000/svg" width="26.213" height="26.213" viewBox="0 0 26.213 26.213"> <g id="More_Select" data-name="More Select" transform="translate(-1 -1)"> <path id="Path_4860" data-name="Path 4860" d="M26.844,1H5.874A.874.874,0,0,0,5,1.874v.874H23.349A2.621,2.621,0,0,1,25.97,5.369V23.718h.874a.874.874,0,0,0,.874-.874V1.874A.874.874,0,0,0,26.844,1Z" transform="translate(-0.505)" fill="#2bb8a6"/> <path id="Path_4861" data-name="Path 4861" d="M22.844,5H1.874A.874.874,0,0,0,1,5.874v20.97a.874.874,0,0,0,.874.874h20.97a.874.874,0,0,0,.874-.874V5.874A.874.874,0,0,0,22.844,5ZM18.7,13.164,11.07,20.789a.874.874,0,0,1-1.236,0L6.022,16.977a.874.874,0,1,1,1.236-1.236l3.2,3.195,7.008-7.007A.874.874,0,1,1,18.7,13.165Z" transform="translate(0 -0.505)" fill="#125765"/> </g> </svg>'; '<svg xmlns="http://www.w3.org/2000/svg" width="33.925" height="25.841" viewBox="0 0 33.925 25.841"><g id="More_Select" data-name="More Select"><path d="m30 1h-24a1 1 0 0 0 -1 1v1h21a3 3 0 0 1 3 3v21h1a1 1 0 0 0 1-1v-24a1 1 0 0 0 -1-1z"/><path d="m26 5h-24a1 1 0 0 0 -1 1v24a1 1 0 0 0 1 1h24a1 1 0 0 0 1-1v-24a1 1 0 0 0 -1-1zm-4.747 9.344-8.728 8.726a1 1 0 0 1 -1.414 0l-4.364-4.363a1 1 0 0 1 1.414-1.414l3.657 3.656 8.021-8.019a1 1 0 0 1 1.414 1.414z"/></g></svg>';
getSaleCategoriesList.add(getSaleCategoriesListObj); getSaleCategoriesList.add(getSaleCategoriesListObj);

@ -88,10 +88,7 @@ class LoginApiClient {
AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEMAILADDRESS; AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEMAILADDRESS;
AppState().postParamsObject?.pSessionId = responseData.pSESSIONID; AppState().postParamsObject?.pSessionId = responseData.pSESSIONID;
AppState().postParamsObject?.pUserName = AppState().getUserName; AppState().postParamsObject?.pUserName = AppState().getUserName;
//TODO: employee id changed in SRCA instead of username AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName;
// AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName;
//TODO: need to fix emp number
AppState().postParamsObject?.pSelectedEmployeeNumber = responseData.memberInformationList!.first.eMPLOYEENUMBER;
AppState().postParamsObject?.setPLegislationCode = responseData.basicMemberInformation!.pLEGISLATIONCODE; AppState().postParamsObject?.setPLegislationCode = responseData.basicMemberInformation!.pLEGISLATIONCODE;
AppState().postParamsObject?.setPayrollCodeStr = responseData.memberInformationList!.first.pAYROLLCODE; AppState().postParamsObject?.setPayrollCodeStr = responseData.memberInformationList!.first.pAYROLLCODE;
AppState().setBusinessCardPrivilege = responseData.businessCardPrivilege ?? false; AppState().setBusinessCardPrivilege = responseData.businessCardPrivilege ?? false;

@ -1,25 +0,0 @@
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:logger/logger.dart' as L;
import 'package:mohem_flutter_app/models/marathon/marathon_model.dart';
import 'package:mohem_flutter_app/models/marathon/question_model.dart';
class DemoMarathonRepo {
L.Logger logger = L.Logger();
Future<MarathonDetailModel> getDemoMarathonDetails() async {
String response = await rootBundle.loadString('assets/json/demo_upcoming_marathon');
var json = jsonDecode(response);
MarathonDetailModel marathonDetailModel = MarathonDetailModel.fromJson(json);
return marathonDetailModel;
}
Future<QuestionModel> getDemoNextQuestion({required int currentQuestionNumber}) async {
String response = await rootBundle.loadString('assets/json/demo_questions_marathon');
List json = jsonDecode(response);
QuestionModel currentQuestion = QuestionModel.fromJson(json.elementAt(currentQuestionNumber));
return currentQuestion;
}
}

@ -14,8 +14,10 @@ import 'package:mohem_flutter_app/models/marathon/question_model.dart';
import 'package:mohem_flutter_app/models/marathon/winner_model.dart'; import 'package:mohem_flutter_app/models/marathon/winner_model.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:signalr_netcore/hub_connection.dart';
class MarathonApiClient { class MarathonApiClient {
late HubConnection hubConnection;
L.Logger logger = L.Logger(); L.Logger logger = L.Logger();
Future<String> getMarathonToken() async { Future<String> getMarathonToken() async {
@ -27,6 +29,7 @@ class MarathonApiClient {
(json) { (json) {
MarathonGenericModel marathonModel = MarathonGenericModel.fromJson(json); MarathonGenericModel marathonModel = MarathonGenericModel.fromJson(json);
AppState().setMarathonToken = marathonModel.data["token"] ?? ""; AppState().setMarathonToken = marathonModel.data["token"] ?? "";
print("marathonToken: ${"AppState(): ${AppState().getMarathonToken}"}");
return marathonModel.data["token"] ?? ""; return marathonModel.data["token"] ?? "";
}, },
ApiConsts.marathonParticipantLoginUrl, ApiConsts.marathonParticipantLoginUrl,
@ -182,7 +185,6 @@ class MarathonApiClient {
return null; return null;
} }
// late HubConnection hubConnection;
// Future<void> buildHubConnection(BuildContext context, String prizeId) async { // Future<void> buildHubConnection(BuildContext context, String prizeId) async {
// HttpConnectionOptions httpOptions = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true); // HttpConnectionOptions httpOptions = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
// hubConnection = HubConnectionBuilder() // hubConnection = HubConnectionBuilder()

@ -1,13 +1,14 @@
import 'dart:async'; import 'dart:async';
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/models/employee_leaves_list.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart';
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
import 'package:mohem_flutter_app/api/api_client.dart';
class MonthlyAttendanceApiClient { class MonthlyAttendanceApiClient {
static final MonthlyAttendanceApiClient _instance = MonthlyAttendanceApiClient._internal(); static final MonthlyAttendanceApiClient _instance = MonthlyAttendanceApiClient._internal();
@ -51,24 +52,6 @@ class MonthlyAttendanceApiClient {
}, url, postParams); }, url, postParams);
} }
Future<List<EmployeeLeavesList>> getEmployeeLeaves(String startDate, String endDate) async {
// String url = "${ApiConsts.erpRest}GET_TIME_CARD_SUMMARY";
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_LEAVES";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999,
// "SearchMonth": month,
// "SearchYear": year,
"P_DATE_FROM_STR": startDate,
"P_DATE_TO_STR": endDate
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getEmployeeLeavesList ?? [];
}, url, postParams);
}
Future<GetScheduleShiftsDetailsList?> getScheduleShiftsDetails(int pRTPID) async { Future<GetScheduleShiftsDetailsList?> getScheduleShiftsDetails(int pRTPID) async {
String url = "${ApiConsts.erpRest}GET_SCHEDULE_SHIFTS_DETAILS"; String url = "${ApiConsts.erpRest}GET_SCHEDULE_SHIFTS_DETAILS";
@ -83,4 +66,5 @@ class MonthlyAttendanceApiClient {
return (responseData.getScheduleShiftsDetailsList?.length ?? 0) > 0 ? responseData.getScheduleShiftsDetailsList!.first : null; return (responseData.getScheduleShiftsDetailsList?.length ?? 0) > 0 ? responseData.getScheduleShiftsDetailsList!.first : null;
}, url, postParams); }, url, postParams);
} }
} }

@ -1,5 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:mohem_flutter_app/api/api_client.dart'; import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
@ -75,14 +74,6 @@ class MyAttendanceApiClient {
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID; if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID;
// below commneted lines when need to verify payload
// print(jsonEncode(postParams));
// for (var value in list) {
// print(jsonEncode(value));
// }
//postParams["GetValueSetValuesTBL"] = list;
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson()); return ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson());

@ -16,9 +16,9 @@ class MyRequestsApiClient {
factory MyRequestsApiClient() => _instance; factory MyRequestsApiClient() => _instance;
Future<List<GetConcurrentProgramsModel>> getConcurrentPrograms(int id) async { Future<List<GetConcurrentProgramsModel>> getConcurrentPrograms() async {
String url = "${ApiConsts.erpRest}GET_CONCURRENT_PROGRAMS"; String url = "${ApiConsts.erpRest}GET_CONCURRENT_PROGRAMS";
Map<String, dynamic> postParams = {"P_REQUEST_GROUP_ID": id}; Map<String, dynamic> postParams = {"P_REQUEST_GROUP_ID": 3290};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
@ -60,28 +60,30 @@ class MyRequestsApiClient {
}, url, postParams); }, url, postParams);
} }
Future<GenericResponseModel> getSubmitNewRequest(List<Map<String, dynamic>> list, {String? functionName}) async { Future<SubmitCcpTransactionList?> getSubmitNewRequest(List<Map<String, dynamic>> list) async
{
String url = "${ApiConsts.erpRest}SUBMIT_CCP_TRANSACTION"; String url = "${ApiConsts.erpRest}SUBMIT_CCP_TRANSACTION";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E", "P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999, "P_SELECTED_RESP_ID": -999,
"P_DESC_FLEX_NAME": functionName ?? "HMG_EMP_BUS_TRIP_SET_SS", "P_DESC_FLEX_NAME": "HMG_EMP_BUS_TRIP_SET_SS",
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
postParams["EITTransactionTBL"] = list; postParams["EITTransactionTBL"] = list;
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData; return responseData.submitCcpTransactionList;
}, url, postParams); }, url, postParams);
} }
Future<List<GetCCPTransactionsModel>> getCcpTransactions(List<Map<String, dynamic>> list, {String? functionName}) async { Future<List<GetCCPTransactionsModel>> getCcpTransactions(List<Map<String, dynamic>> list) async
{
String url = "${ApiConsts.erpRest}GET_CCP_TRANSACTIONS"; String url = "${ApiConsts.erpRest}GET_CCP_TRANSACTIONS";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E", "P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999, "P_SELECTED_RESP_ID": -999,
"P_DESC_FLEX_NAME": functionName ?? "HMG_EMP_BUS_TRIP_SET_SS", "P_DESC_FLEX_NAME": "HMG_EMP_BUS_TRIP_SET_SS",
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
@ -91,4 +93,5 @@ class MyRequestsApiClient {
return responseData.getCCPTransactionsModel ?? []; return responseData.getCCPTransactionsModel ?? [];
}, url, postParams); }, url, postParams);
} }
} }

@ -17,7 +17,7 @@ class OffersAndDiscountsApiClient {
List<GetCategoriesList> getSaleCategoriesList = []; List<GetCategoriesList> getSaleCategoriesList = [];
String url = "${ApiConsts.cocRest}Mohemm_ITG_GetCategories"; String url = "${ApiConsts.cocRest}Mohemm_ITG_GetCategories";
Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgPageSize": 100, "ItgPageNo": 1, "ItgIsActive": true}; Map<String, dynamic> postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgPageSize": 100, "ItgPageNo": 1};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject( return await ApiClient().postJsonForObject(
@ -30,7 +30,7 @@ class OffersAndDiscountsApiClient {
getSaleCategoriesListObj.categoryNameAr = "الجميع"; getSaleCategoriesListObj.categoryNameAr = "الجميع";
getSaleCategoriesListObj.isActive = true; getSaleCategoriesListObj.isActive = true;
getSaleCategoriesListObj.content = getSaleCategoriesListObj.content =
'<svg xmlns="http://www.w3.org/2000/svg" width="26.213" height="26.213" viewBox="0 0 26.213 26.213"> <g id="More_Select" data-name="More Select" transform="translate(-1 -1)"> <path id="Path_4860" data-name="Path 4860" d="M26.844,1H5.874A.874.874,0,0,0,5,1.874v.874H23.349A2.621,2.621,0,0,1,25.97,5.369V23.718h.874a.874.874,0,0,0,.874-.874V1.874A.874.874,0,0,0,26.844,1Z" transform="translate(-0.505)" fill="#2bb8a6"/> <path id="Path_4861" data-name="Path 4861" d="M22.844,5H1.874A.874.874,0,0,0,1,5.874v20.97a.874.874,0,0,0,.874.874h20.97a.874.874,0,0,0,.874-.874V5.874A.874.874,0,0,0,22.844,5ZM18.7,13.164,11.07,20.789a.874.874,0,0,1-1.236,0L6.022,16.977a.874.874,0,1,1,1.236-1.236l3.2,3.195,7.008-7.007A.874.874,0,1,1,18.7,13.165Z" transform="translate(0 -0.505)" fill="#125765"/> </g> </svg>'; '<svg xmlns="http://www.w3.org/2000/svg" width="33.925" height="25.841" viewBox="0 0 33.925 25.841"><g id="More_Select" data-name="More Select"><path d="m30 1h-24a1 1 0 0 0 -1 1v1h21a3 3 0 0 1 3 3v21h1a1 1 0 0 0 1-1v-24a1 1 0 0 0 -1-1z"/><path d="m26 5h-24a1 1 0 0 0 -1 1v24a1 1 0 0 0 1 1h24a1 1 0 0 0 1-1v-24a1 1 0 0 0 -1-1zm-4.747 9.344-8.728 8.726a1 1 0 0 1 -1.414 0l-4.364-4.363a1 1 0 0 1 1.414-1.414l3.657 3.656 8.021-8.019a1 1 0 0 1 1.414 1.414z"/></g></svg>';
getSaleCategoriesList.add(getSaleCategoriesListObj); getSaleCategoriesList.add(getSaleCategoriesListObj);
@ -55,12 +55,12 @@ class OffersAndDiscountsApiClient {
(response) { (response) {
var body = json.decode(response['Mohemm_ITG_ResponseItem']); var body = json.decode(response['Mohemm_ITG_ResponseItem']);
var bodyData = body['result']['data']; var bodyData = json.decode(body['result']['data']);
if (bodyData != null) { if(bodyData != null) {
bodyData.forEach((v) { bodyData.forEach((v) {
getSaleCategoriesList.add(OffersListModel.fromJson(v)); getSaleCategoriesList.add(OffersListModel.fromJson(v));
}); });
} }
return getSaleCategoriesList; return getSaleCategoriesList;
}, },

@ -12,10 +12,8 @@ import 'package:mohem_flutter_app/models/get_employee_address_model.dart';
import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; import 'package:mohem_flutter_app/models/get_employee_phones_model.dart';
import 'package:mohem_flutter_app/models/hierarchy_lists.dart';
import 'package:mohem_flutter_app/models/performance.dart'; import 'package:mohem_flutter_app/models/performance.dart';
import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart';
import 'package:mohem_flutter_app/models/profile/employee_qualifications_list.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart'; import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart'; import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart';
import 'package:mohem_flutter_app/models/profile/get_countries_list_model.dart'; import 'package:mohem_flutter_app/models/profile/get_countries_list_model.dart';
@ -60,19 +58,6 @@ class ProfileApiClient {
}, url, postParams); }, url, postParams);
} }
Future<List<EmployeeQualificationsList>> getEmployeeQualifications() async {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_QUALIFICATIONS";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getEmployeeQualificationsList ?? [];
}, url, postParams);
}
Future<List<GetEmployeePhonesList>> getEmployeePhones() async { Future<List<GetEmployeePhonesList>> getEmployeePhones() async {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_PHONES"; String url = "${ApiConsts.erpRest}GET_EMPLOYEE_PHONES";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
@ -418,19 +403,4 @@ class ProfileApiClient {
return responseData.getPerformanceAppraisalList ?? []; return responseData.getPerformanceAppraisalList ?? [];
}, url, postParams); }, url, postParams);
} }
Future<SupervisorHierarchyLists?> getHierarchy(String empNum) async {
String url = "${ApiConsts.erpRest}GET_SUPERVISOR_HIERARCHY";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999
};
postParams.addAll(AppState().postParamsJson);
postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empNum;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.supervisorHierarchyLists;
}, url, postParams);
}
} }

@ -149,13 +149,12 @@ class WorkListApiClient {
}, url, postParams); }, url, postParams);
} }
Future<MemberInformationListModel> getUserInformation(int pSelectedResopID, String selectedEmployeeNumber, String noficationId) async { Future<MemberInformationListModel> getUserInformation(int pSelectedResopID, String selectedEmployeeNumber) async {
String url = "${ApiConsts.erpRest}Get_Notification_UserInformation"; String url = "${ApiConsts.erpRest}Get_UserInformation";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_SELECTED_RESP_ID": pSelectedResopID, "P_SELECTED_RESP_ID": pSelectedResopID,
"P_PAGE_LIMIT": 100, "P_PAGE_LIMIT": 100,
"P_PAGE_NUM": 1, "P_PAGE_NUM": 1,
"P_NOTIFICATION_ID": noficationId,
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (selectedEmployeeNumber != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber; if (selectedEmployeeNumber != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber;
@ -414,7 +413,7 @@ class WorkListApiClient {
"EmployeeNumber": employeeNumber, "EmployeeNumber": employeeNumber,
"Comments": "", "Comments": "",
"AdditionalFields": null, "AdditionalFields": null,
"NewUserEMPId": newUserEMPId "NewUserEMPId":newUserEMPId
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {

@ -10,9 +10,6 @@ import 'package:mohem_flutter_app/models/post_params_model.dart';
import 'package:mohem_flutter_app/models/privilege_list_model.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/models/worklist_response_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart';
class AppState { class AppState {
static final AppState _instance = AppState._internal(); static final AppState _instance = AppState._internal();
@ -20,12 +17,6 @@ class AppState {
factory AppState() => _instance; factory AppState() => _instance;
String? deviceToken = "";
set setDeviceToken(v) => deviceToken = v;
String? get getDeviceToken => deviceToken;
bool isAuthenticated = false; bool isAuthenticated = false;
set setIsAuthenticated(v) => isAuthenticated = v; set setIsAuthenticated(v) => isAuthenticated = v;
@ -73,25 +64,7 @@ class AppState {
String? get getMarathonProjectId => _projectID; String? get getMarathonProjectId => _projectID;
bool _isDemoMarathon = false; final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 3.8, mobileType: Platform.isAndroid ? "android" : "ios");
set setIsDemoMarathon(bool value) => _isDemoMarathon = value;
bool get getIsDemoMarathon => _isDemoMarathon;
bool _isHuawei = false;
set setIsHuawei(bool value) => _isHuawei = value;
bool get getIsHuawei => _isHuawei;
String _huaweiPushToken = "";
set setHuaweiPushToken(String value) => _huaweiPushToken = value;
String get getHuaweiPushToken => _huaweiPushToken;
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 6.1, mobileType: Platform.isAndroid ? "android" : "ios");
void setPostParamsInitConfig() { void setPostParamsInitConfig() {
isAuthenticated = false; isAuthenticated = false;
@ -192,6 +165,4 @@ class AppState {
set setemployeeSubordinatesList(List<GetEmployeeSubordinatesList> employeeSubordinatesList) { set setemployeeSubordinatesList(List<GetEmployeeSubordinatesList> employeeSubordinatesList) {
_employeeSubordinatesList = employeeSubordinatesList; _employeeSubordinatesList = employeeSubordinatesList;
} }
bool cancelRequestTrancsection = true;
} }

@ -6,8 +6,8 @@ class MyColors {
static const Color darkTextColor = Color(0xff2B353E); static const Color darkTextColor = Color(0xff2B353E);
static const Color normalTextColor = Color(0xff5A5A5A); static const Color normalTextColor = Color(0xff5A5A5A);
static const Color lightTextColor = Color(0xffBFBFBF); static const Color lightTextColor = Color(0xffBFBFBF);
static const Color gradiantStartColor = Color(0xff259db7); static const Color gradiantStartColor = Color(0xff33c0a5);
static const Color gradiantEndColor = Color(0xff33c0a5); static const Color gradiantEndColor = Color(0xff259db7);
static const Color textMixColor = Color(0xff2BB8A6); static const Color textMixColor = Color(0xff2BB8A6);
static const Color backgroundColor = Color(0xffF8F8F8); static const Color backgroundColor = Color(0xffF8F8F8);
static const Color grey41Color = Color(0xff414141); static const Color grey41Color = Color(0xff414141);
@ -30,7 +30,7 @@ class MyColors {
static const Color darkWhiteColor = Color(0xffE0E0E0); static const Color darkWhiteColor = Color(0xffE0E0E0);
static const Color redColor = Color(0xffD02127); static const Color redColor = Color(0xffD02127);
static const Color pinkColor = Color(0xffEBA9A9); static const Color pinkColor = Color(0xffEBA9A9);
static const Color pinkDarkColor = Color(0xffdb5b6a); static const Color pinkDarkColor = Color(0xffe3797d);
static const Color yellowColor = Color(0xffF4E31C); static const Color yellowColor = Color(0xffF4E31C);
static const Color orange = Color(0xFFCC9B14); static const Color orange = Color(0xFFCC9B14);
static const Color yellowFavColor = Color(0xffEAC321); static const Color yellowFavColor = Color(0xffEAC321);
@ -41,7 +41,6 @@ class MyColors {
static const Color borderColor = Color(0xffE8E8E8); static const Color borderColor = Color(0xffE8E8E8);
static const Color borderE3Color = Color(0xffE3E3E3); static const Color borderE3Color = Color(0xffE3E3E3);
static const Color borderCEColor = Color(0xffCECECE); static const Color borderCEColor = Color(0xffCECECE);
//static const Color grey67Color = Color(0xff676767); //static const Color grey67Color = Color(0xff676767);
static const Color whiteColor = Color(0xFFEEEEEE); static const Color whiteColor = Color(0xFFEEEEEE);
static const Color greenColor = Color(0xff1FA269); static const Color greenColor = Color(0xff1FA269);
@ -56,7 +55,7 @@ class MyColors {
static const Color lightGreyColor = Color(0xffC7C7C7); static const Color lightGreyColor = Color(0xffC7C7C7);
static const Color green69Color = Color(0xff1FA169); static const Color green69Color = Color(0xff1FA169);
static const Color redA3Color = Color(0xffCA3332); static const Color redA3Color = Color(0xffCA3332);
static const Color green9CColor = Color(0xff259CB8); static const Color green9CColor = Color(0xff259CB8);
static const Color green2DColor = Color(0xff32D892); static const Color green2DColor = Color(0xff32D892);
static const Color greyC4Color = Color(0xffC4C4C4); static const Color greyC4Color = Color(0xffC4C4C4);
static const Color grey35Color = Color(0xff535353); static const Color grey35Color = Color(0xff535353);

@ -1,10 +1,12 @@
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart'; import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
class ApiConsts { class ApiConsts {
static String baseUrl = "https://uathrmsys.moenergy.gov.sa"; //MOE UAT //static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "https://hrmsys.moenergy.gov.sa"; // MOE ;LIVE // static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";
static String erpRest = baseUrlServices + "ERP.svc/REST/"; static String erpRest = baseUrlServices + "ERP.svc/REST/";
static String swpRest = baseUrlServices + "SWP.svc/REST/"; static String swpRest = baseUrlServices + "SWP.svc/REST/";
@ -42,6 +44,7 @@ class ApiConsts {
static int tabletMinLength = 500; static int tabletMinLength = 500;
} }
class SharedPrefsConsts { class SharedPrefsConsts {
static String isRememberMe = "remember_me"; static String isRememberMe = "remember_me";
static String username = "username"; static String username = "username";

@ -60,13 +60,13 @@ class DateUtil {
} }
} }
date = date + " $hours:$mins:$secs"; date = date + " $hours:$mins:$secs";
DateTime returnDate = DateFormat("MM/dd/yyyy HH:mm:ss", "en_US").parse(date); DateTime returnDate = DateFormat("MM/dd/yyyy HH:mm:ss").parse(date);
return returnDate; return returnDate;
} }
static DateTime convertSimpleStringDateToDateddMMyyyy(String date) { static DateTime convertSimpleStringDateToDateddMMyyyy(String date) {
return DateFormat("MM/dd/yyyy hh:mm:ss", "en_US").parse(date); return DateFormat("MM/dd/yyyy hh:mm:ss").parse(date);
} }
static DateTime convertStringToDateNoTimeZone(String date) { static DateTime convertStringToDateNoTimeZone(String date) {
@ -123,7 +123,7 @@ class DateUtil {
} }
static String formatDateToTime(DateTime date) { static String formatDateToTime(DateTime date) {
return DateFormat('hh:mm a', "en_US").format(date); return DateFormat('hh:mm a').format(date);
} }
static String yearMonthDay(DateTime dateTime) { static String yearMonthDay(DateTime dateTime) {
@ -419,7 +419,7 @@ class DateUtil {
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getDayMonthDateFormatted(DateTime dateTime) { static String getDayMonthDateFormatted(DateTime dateTime) {
if (dateTime != null) if (dateTime != null)
return DateFormat('dd/MM', "en_US").format(dateTime); return DateFormat('dd/MM').format(dateTime);
else else
return ""; return "";
} }
@ -466,7 +466,7 @@ class DateUtil {
/// [dateTime] convert DateTime to data formatted /// [dateTime] convert DateTime to data formatted
static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) { static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) {
if (dateTime != null) if (dateTime != null)
return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString() + " " + DateFormat('HH:mm', "en_US").format(dateTime); return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString() + " " + DateFormat('HH:mm').format(dateTime);
else else
return ""; return "";
} }
@ -491,11 +491,11 @@ class DateUtil {
} }
static String getFormattedDate(DateTime dateTime, String formattedString) { static String getFormattedDate(DateTime dateTime, String formattedString) {
return DateFormat(formattedString, "en_US").format(dateTime); return DateFormat(formattedString).format(dateTime);
} }
static String convertISODateToJsonDate(String isoDate) { static String convertISODateToJsonDate(String isoDate) {
return "/Date(" + DateFormat('mm-dd-yyy', "en_US").parse(isoDate).millisecondsSinceEpoch.toString() + ")/"; return "/Date(" + DateFormat('mm-dd-yyy').parse(isoDate).millisecondsSinceEpoch.toString() + ")/";
} }
// static String getDay(DayOfWeek dayOfWeek) { // static String getDay(DayOfWeek dayOfWeek) {

@ -1,279 +0,0 @@
// import 'dart:io';
//
// import 'package:firebase_core/firebase_core.dart';
// import 'package:firebase_messaging/firebase_messaging.dart';
// import 'package:flutter/foundation.dart';
// import 'package:flutter_local_notifications/flutter_local_notifications.dart';
// import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
// import 'package:huawei_push/huawei_push.dart' as huawei_push;
// import 'package:mohem_flutter_app/app_state/app_state.dart';
// import 'package:mohem_flutter_app/classes/utils.dart';
// import 'package:permission_handler/permission_handler.dart';
//
// final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
//
// class AppNotifications {
// static final AppNotifications _instance = AppNotifications._internal();
//
// AppNotifications._internal();
//
// factory AppNotifications() => _instance;
//
// late HmsApiAvailability hmsApiAvailability;
//
// String _huaweiToken = '';
//
// Future<void> requestPermissions() async {
// if (Platform.isIOS) {
// await flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()?.requestPermissions(alert: true, badge: true, sound: true);
// } else if (Platform.isAndroid) {
// AndroidFlutterLocalNotificationsPlugin? androidImplementation = flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>();
// bool? granted = await androidImplementation?.requestPermission();
// if (granted == false) {
// if (kDebugMode) {
// print("-------------------- Permission Granted ------------------------");
// print(granted);
// }
// await Permission.notification.request();
// }
// }
// }
//
// void init(String? firebaseToken) async {
// hmsApiAvailability = HmsApiAvailability();
// await requestPermissions();
// AppState().setDeviceToken = firebaseToken;
// await Permission.notification.isDenied.then((bool value) {
// if (value) {
// Permission.notification.request();
// }
// });
// RemoteMessage? initialMessage = await FirebaseMessaging.instance.getInitialMessage();
//
// if (initialMessage != null) _handleMessage(initialMessage);
//
// FirebaseMessaging.onMessage.listen((RemoteMessage message) {
// if (message.notification != null) _handleMessage(message);
// });
//
// FirebaseMessaging.onMessageOpenedApp.listen(_handleOpenApp);
//
// FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
//
// FirebaseMessaging.instance.onTokenRefresh.listen((String token) {
// AppState().setDeviceToken = token;
// });
//
// if (Platform.isAndroid) {
// await hmsApiAvailability.isHMSAvailable().then((value) async {
// if (value == 0) {
// huawei_push.Push.enableLogger();
// var result = await huawei_push.Push.setAutoInitEnabled(true);
//
// huawei_push.Push.onNotificationOpenedApp.listen((message) {
// // newMessage(toFirebaseRemoteMessage(message));
// }, onError: (e) => print(e.toString()));
//
// huawei_push.Push.onMessageReceivedStream.listen((message) {
// // newMessage(toFirebaseRemoteMessage(message));
// }, onError: (e) => print(e.toString()));
// }
// }).catchError((err) {
// print(err);
// });
// }
// }
//
// void initHuaweiPush(Function loginCallback) {
// AppState().setIsHuawei = true;
// initTokenStream(loginCallback);
// huawei_push.Push.getToken("");
// }
//
// // HUAWEI PUSH TOKEN IMPLEMENTATION
// void _onTokenEvent(String event) {
// _huaweiToken = event;
// AppState().setHuaweiPushToken = _huaweiToken;
// debugPrint("HUAWEI PUSH TOKEN: $_huaweiToken");
// }
//
// void _onTokenError(Object error) {}
//
// Future<void> initTokenStream(Function loginCallback) async {
// huawei_push.Push.getTokenStream.listen(_onTokenEvent, onError: _onTokenError).onData((data) {
// AppState().setHuaweiPushToken = data;
// debugPrint("HUAWEI PUSH TOKEN: $data");
// loginCallback();
// });
// }
//
// void _handleMessage(RemoteMessage message) {
// Utils.saveStringFromPrefs("isAppOpendByChat", "false");
// }
//
// void _handleOpenApp(RemoteMessage message) {
// Utils.saveStringFromPrefs("isAppOpendByChat", "true");
// Utils.saveStringFromPrefs("notificationData", message.data["user_chat_history_response"].toString());
// }
// }
//
// AndroidNotificationChannel channel = const AndroidNotificationChannel(
// "high_importance_channel",
// "High Importance Notifications",
// importance: Importance.high,
// );
//
// Future<dynamic> backgroundMessageHandler(RemoteMessage message) async {
// await Firebase.initializeApp();
// Utils.saveStringFromPrefs("isAppOpendByChat", "false");
// Utils.saveStringFromPrefs("notificationData", message.data["user_chat_history_response"].toString());
// }
//************** NEW fILE *****************
import 'dart:io';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
// import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:huawei_push/huawei_push.dart' as huawei_push;
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:permission_handler/permission_handler.dart';
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
class AppNotifications {
static final AppNotifications _instance = AppNotifications._internal();
AppNotifications._internal();
factory AppNotifications() => _instance;
// late HmsApiAvailability hmsApiAvailability;
String _huaweiToken = '';
Future<void> requestPermissions() async {
if (Platform.isIOS) {
await flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()?.requestPermissions(alert: true, badge: true, sound: true);
} else if (Platform.isAndroid) {
AndroidFlutterLocalNotificationsPlugin? androidImplementation = flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>();
bool? granted = await androidImplementation?.requestPermission();
if (granted == false) {
if (kDebugMode) {
print("-------------------- Permission Granted ------------------------");
print(granted);
}
await Permission.notification.request();
}
}
}
void init(String? firebaseToken) async {
// if (Platform.isAndroid) {
// hmsApiAvailability = HmsApiAvailability();
// }
await requestPermissions();
AppState().setDeviceToken = firebaseToken;
await Permission.notification.isDenied.then((bool value) {
if (value) {
Permission.notification.request();
}
});
RemoteMessage? initialMessage = await FirebaseMessaging.instance.getInitialMessage();
if (initialMessage != null) _handleMessage(initialMessage);
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
if (message.notification != null) _handleMessage(message);
});
FirebaseMessaging.onMessageOpenedApp.listen(_handleOpenApp);
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
FirebaseMessaging.instance.onTokenRefresh.listen((String token) {
AppState().setDeviceToken = token;
});
if (Platform.isAndroid) {
// await hmsApiAvailability.isHMSAvailable().then((value) async {
if (!(await Utils.isGoogleServicesAvailable())) {
huawei_push.Push.enableLogger();
var result = await huawei_push.Push.setAutoInitEnabled(true);
huawei_push.Push.onNotificationOpenedApp.listen((message) {
// newMessage(toFirebaseRemoteMessage(message));
}, onError: (e) => print(e.toString()));
huawei_push.Push.onMessageReceivedStream.listen((message) {
// newMessage(toFirebaseRemoteMessage(message));
}, onError: (e) => print(e.toString()));
}
// }).catchError((err) {
// print(err);
// });
}
}
void initHuaweiPush(Function loginCallback) {
AppState().setIsHuawei = true;
initTokenStream(loginCallback);
huawei_push.Push.getToken("");
}
// HUAWEI PUSH TOKEN IMPLEMENTATION
void _onTokenEvent(String event) {
_huaweiToken = event;
AppState().setHuaweiPushToken = _huaweiToken;
debugPrint("HUAWEI PUSH TOKEN: $_huaweiToken");
}
void _onTokenError(Object error) {}
Future<void> initTokenStream(Function loginCallback) async {
huawei_push.Push.getTokenStream.listen(_onTokenEvent, onError: _onTokenError).onData((data) {
AppState().setHuaweiPushToken = data;
debugPrint("HUAWEI PUSH TOKEN: $data");
loginCallback();
});
}
void _handleMessage(RemoteMessage message) {
Utils.saveStringFromPrefs("isAppOpendByChat", "false");
}
void _handleOpenApp(RemoteMessage message) {
if (message.data.isNotEmpty && message.data["type"] == 'chat') {
Utils.saveStringFromPrefs("isAppOpendByChat", "true");
Utils.saveStringFromPrefs("notificationData", message.data["user_chat_history_response"].toString());
}
}
}
AndroidNotificationChannel channel = const AndroidNotificationChannel(
"high_importance_channel",
"High Importance Notifications",
importance: Importance.high,
);
Future<dynamic> backgroundMessageHandler(RemoteMessage message) async {
await Firebase.initializeApp();
Utils.saveStringFromPrefs("isAppOpendByChat", "false");
Utils.saveStringFromPrefs("notificationData", message.data["user_chat_history_response"].toString());
if (message.data.isNotEmpty && message.data["type"] == 'call') {
// ChatVoipCall().showCallkitIncoming(uuid: const Uuid().v4(), data: message);
}
}

@ -7,7 +7,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:google_api_availability/google_api_availability.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
@ -99,8 +98,7 @@ class Utils {
static void handleException(dynamic exception, cxt, Function(String)? onErrorMessage) { static void handleException(dynamic exception, cxt, Function(String)? onErrorMessage) {
String errorMessage; String errorMessage;
print("exception:$exception"); if (exception.error.errorType != null && exception.error.errorType == 4) {
if (exception?.error?.errorType != null && exception.error.errorType == 4) {
Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.appUpdateScreen, (_) => false, arguments: exception.error?.errorMessage); Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.appUpdateScreen, (_) => false, arguments: exception.error?.errorMessage);
} else { } else {
if (exception is APIException) { if (exception is APIException) {
@ -117,14 +115,12 @@ class Utils {
} else { } else {
if (!AppState().isAuthenticated) { if (!AppState().isAuthenticated) {
showDialog( showDialog(
barrierDismissible: false,
context: cxt, context: cxt,
builder: (cxt) => ConfirmDialog( builder: (cxt) => ConfirmDialog(
message: errorMessage, message: errorMessage,
onTap: () { onTap: () {
Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route<dynamic> route) => false); Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route<dynamic> route) => false);
}, },
onCloseTap: () {},
), ),
); );
} else { } else {
@ -268,7 +264,7 @@ class Utils {
static String getMonthNamedFormat(DateTime date) { static String getMonthNamedFormat(DateTime date) {
/// it will return like "29-Sep-2022" /// it will return like "29-Sep-2022"
return DateFormat('dd-MMM-yyyy', "en_US").format(date); return DateFormat('dd-MMM-yyyy').format(date);
} }
static String reverseFormatDate(String date) { static String reverseFormatDate(String date) {
@ -337,17 +333,10 @@ class Utils {
} }
return date; return date;
} else { } else {
if(date.toLowerCase().split("-").length == 1 && date.contains("/")) {
return reverseFormatDate(date);
}
else
if (date.toLowerCase().split("-")[1].length == 3) { if (date.toLowerCase().split("-")[1].length == 3) {
return DateFormat('dd-MM-yyyy', "en_US").format(DateFormat('dd-MMM-yyyy', "en_US").parseLoose(date)); return DateFormat('dd-MM-yyyy').format(DateFormat('dd-MMM-yyyy').parseLoose(date));
} else { } else {
if(date.contains(" ")) { return DateFormat('dd-MM-yyyy').format(DateFormat('yyyy-MM-dd').parseLoose(date));
date = date.split(" ").first;
}
return DateFormat('dd-MM-yyyy', "en_US").format(DateFormat('yyyy-MM-dd', "en_US").parseLoose(date));
} }
// return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MM-yyyy').parseLoose(date)); // return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MM-yyyy').parseLoose(date));
} }
@ -399,15 +388,4 @@ class Utils {
print(err); print(err);
}); });
} }
//HUAWEI DECISION MAKING
static Future<bool> isGoogleServicesAvailable() async {
GooglePlayServicesAvailability availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability();
String status = availability.toString().split('.').last;
if (status == "success") {
return true;
}
return false;
}
} }

@ -1,206 +0,0 @@
// ignore_for_file: prefer_single_quotes, lines_longer_than_80_chars final
// link to generate dart class https://www.webinovers.com/web-tools/json-to-dart-convertor
Map<String, dynamic> _env = {
"appConfig": "lib/config/config_en.json",
"login": {
"verification": true,
"verificationMethod": {
"whatsapp": false,
},
"forgetPassword": false
},
"bottomBar": false,
"dashboard": {
"attendance": false,
"worklist": true,
"ticketBalance": false,
"leaveBalance": true,
"missingSwipe": false,
"monthlyAttendance": false,
"vocationRules": false,
},
"itg": false,
"marathon": false,
"offersDiscount": false,
"myTeams": false,
"modifiy": false,
"myRequest": false,
"pendingTransactions": false,
"myProfile": false,
"itemsForSale": false,
"chat": false,
"monthlyAttendance": true,
"vocationRules": false,
"canEdit": false,
};
Env env = Env.fromJson(_env);
class Env {
Env({
required this.appConfig,
required this.login,
required this.bottomBar,
required this.dashboard,
required this.itg,
required this.marathon,
required this.offersDiscount,
required this.myTeams,
required this.modifiy,
required this.myRequest,
required this.pendingTransactions,
required this.myProfile,
required this.itemsForSale,
required this.chat,
required this.monthlyAttendance,
required this.vocationRules,
required this.canEdit,
});
late final String appConfig;
late final Login login;
late final bool bottomBar;
late final Dashboard dashboard;
late final bool itg;
late final bool marathon;
late final bool offersDiscount;
late final bool myTeams;
late final bool modifiy;
late final bool myRequest;
late final bool pendingTransactions;
late final bool myProfile;
late final bool itemsForSale;
late final bool chat;
late final bool monthlyAttendance;
late final bool vocationRules;
late final bool canEdit;
Env.fromJson(Map<String, dynamic> json) {
appConfig = json['appConfig'];
login = Login.fromJson(json['login']);
bottomBar = json['bottomBar'];
dashboard = Dashboard.fromJson(json['dashboard']);
marathon = json['marathon'];
itg = json['itg'];
offersDiscount = json['offersDiscount'];
myTeams = json['myTeams'];
modifiy = json['modifiy'];
myRequest = json['myRequest'];
pendingTransactions = json['pendingTransactions'];
myProfile = json['myProfile'];
itemsForSale = json['itemsForSale'];
chat = json['chat'];
monthlyAttendance = json['monthlyAttendance'];
vocationRules = json['vocationRules'];
canEdit = json['canEdit'];
}
Map<String, dynamic> toJson() {
var _data = <String, dynamic>{};
_data['appConfig'] = appConfig;
_data['login'] = login.toJson();
_data['bottomBar'] = bottomBar;
_data['dashboard'] = dashboard.toJson();
_data['marathon'] = marathon;
_data['itg'] = itg;
_data['offersDiscount'] = offersDiscount;
_data['myTeams'] = myTeams;
_data['modifiy'] = modifiy;
_data['myRequest'] = myRequest;
_data['pendingTransactions'] = pendingTransactions;
_data['myProfile'] = myProfile;
_data['itemsForSale'] = itemsForSale;
_data['chat'] = chat;
_data['monthlyAttendance'] = monthlyAttendance;
_data['vocationRules'] = vocationRules;
_data['canEdit'] = canEdit;
return _data;
}
}
class Login {
Login({
required this.verification,
required this.verificationMethod,
required this.forgetPassword,
});
late final bool verification;
late final VerificationMethod verificationMethod;
late final bool forgetPassword;
Login.fromJson(Map<String, dynamic> json) {
verification = json['verification'];
verificationMethod = VerificationMethod.fromJson(json['verificationMethod']);
forgetPassword = json['forgetPassword'];
}
Map<String, dynamic> toJson() {
var _data = <String, dynamic>{};
_data['verification'] = verification;
_data['verificationMethod'] = verificationMethod.toJson();
_data['forgetPassword'] = forgetPassword;
return _data;
}
}
class VerificationMethod {
VerificationMethod({
required this.whatsapp,
});
late final bool whatsapp;
VerificationMethod.fromJson(Map<String, dynamic> json) {
whatsapp = json['whatsapp'];
}
Map<String, dynamic> toJson() {
var _data = <String, dynamic>{};
_data['whatsapp'] = whatsapp;
return _data;
}
}
class Dashboard {
Dashboard({
required this.attendance,
required this.worklist,
required this.ticketBalance,
required this.leaveBalance,
required this.missingSwipe,
required this.monthlyAttendance,
required this.vocationRules,
});
late final bool attendance;
late final bool worklist;
late final bool ticketBalance;
late final bool leaveBalance;
late final bool missingSwipe;
late final bool monthlyAttendance;
late final bool vocationRules;
Dashboard.fromJson(Map<String, dynamic> json) {
attendance = json['attendance'];
worklist = json['worklist'];
ticketBalance = json['ticketBalance'];
leaveBalance = json['leaveBalance'];
missingSwipe = json['missingSwipe'];
monthlyAttendance = json['monthlyAttendance'];
vocationRules = json['vocationRules'];
}
Map<String, dynamic> toJson() {
var _data = <String, dynamic>{};
_data['attendance'] = attendance;
_data['worklist'] = worklist;
_data['ticketBalance'] = ticketBalance;
_data['leaveBalance'] = leaveBalance;
_data['missingSwipe'] = missingSwipe;
_data['monthlyAttendance'] = monthlyAttendance;
_data['vocationRules'] = vocationRules;
return _data;
}
}

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/ui/app_update_screen.dart'; import 'package:mohem_flutter_app/ui/app_update_screen.dart';
import 'package:mohem_flutter_app/ui/attendance/add_vacation_rule_screen.dart'; import 'package:mohem_flutter_app/ui/attendance/add_vacation_rule_screen.dart';
import 'package:mohem_flutter_app/ui/attendance/moe_monthly_attendance_screen.dart';
import 'package:mohem_flutter_app/ui/attendance/monthly_attendance_screen.dart'; import 'package:mohem_flutter_app/ui/attendance/monthly_attendance_screen.dart';
import 'package:mohem_flutter_app/ui/attendance/vacation_rule_screen.dart'; import 'package:mohem_flutter_app/ui/attendance/vacation_rule_screen.dart';
import 'package:mohem_flutter_app/ui/bottom_sheets/attendence_details_bottom_sheet.dart'; import 'package:mohem_flutter_app/ui/bottom_sheets/attendence_details_bottom_sheet.dart';
@ -46,8 +45,6 @@ import 'package:mohem_flutter_app/ui/profile/delete_family_member.dart';
import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_address_screen.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_address_screen.dart';
import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart';
import 'package:mohem_flutter_app/ui/profile/family_members.dart'; import 'package:mohem_flutter_app/ui/profile/family_members.dart';
import 'package:mohem_flutter_app/ui/profile/help_screen.dart';
import 'package:mohem_flutter_app/ui/profile/hierarchy_screen.dart';
import 'package:mohem_flutter_app/ui/profile/personal_info.dart'; import 'package:mohem_flutter_app/ui/profile/personal_info.dart';
import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/ui/profile/profile_screen.dart';
import 'package:mohem_flutter_app/ui/screens/announcements/announcement_details.dart'; import 'package:mohem_flutter_app/ui/screens/announcements/announcement_details.dart';
@ -195,8 +192,6 @@ class AppRoutes {
static const String unsafeDeviceScreen = "/unsafeDeviceScreen"; static const String unsafeDeviceScreen = "/unsafeDeviceScreen";
static const String appUpdateScreen = "/appUpdateScreen"; static const String appUpdateScreen = "/appUpdateScreen";
static const String help = "/help";
static const String hierarchy = "/hierarchy";
static final Map<String, WidgetBuilder> routes = { static final Map<String, WidgetBuilder> routes = {
login: (BuildContext context) => LoginScreen(), login: (BuildContext context) => LoginScreen(),
@ -231,8 +226,7 @@ class AppRoutes {
// addWorkFromHome: (BuildContext context) => AddWorkFromHomeScreen(), // addWorkFromHome: (BuildContext context) => AddWorkFromHomeScreen(),
profile: (BuildContext context) => ProfileScreen(), profile: (BuildContext context) => ProfileScreen(),
//Attendance //Attendance
// monthlyAttendance: (BuildContext context) => MonthlyAttendanceScreen(), monthlyAttendance: (BuildContext context) => MonthlyAttendanceScreen(),
monthlyAttendance: (BuildContext context) => MoeMonthlyAttendanceScreen(),
vacationRule: (BuildContext context) => VacationRuleScreen(), vacationRule: (BuildContext context) => VacationRuleScreen(),
addVacationRule: (BuildContext context) => AddVacationRuleScreen(), addVacationRule: (BuildContext context) => AddVacationRuleScreen(),
@ -309,7 +303,5 @@ class AppRoutes {
unsafeDeviceScreen: (BuildContext context) => const UnsafeDeviceScreen(), unsafeDeviceScreen: (BuildContext context) => const UnsafeDeviceScreen(),
appUpdateScreen: (BuildContext context) => const AppUpdateScreen(), appUpdateScreen: (BuildContext context) => const AppUpdateScreen(),
help: (BuildContext context) => HelpScreen(),
hierarchy: (BuildContext context) => HierarchyScreen(),
}; };
} }

@ -9,6 +9,7 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/otp_widget.dart'; import 'package:mohem_flutter_app/widgets/otp_widget.dart';
import 'package:sizer/sizer.dart';
final ValueNotifier<String> otpFieldClear = ValueNotifier<String>(""); final ValueNotifier<String> otpFieldClear = ValueNotifier<String>("");

@ -13,15 +13,6 @@ extension CapExtension on String {
String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : "";
} }
extension TrimString on String {
String trimString(int minThreshold) {
if (length > minThreshold) {
return "${substring(0, 10)}...${substring(length - 4, length)}";
}
return this;
}
}
extension EmailValidator on String { extension EmailValidator on String {
Widget get toWidget => Text(this); Widget get toWidget => Text(this);
@ -114,7 +105,6 @@ extension EmailValidator on String {
Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines, double? height}) => Text( Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines, double? height}) => Text(
this, this,
maxLines: maxlines, maxLines: maxlines,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: color ?? MyColors.darkTextColor, color: color ?? MyColors.darkTextColor,
fontSize: 16, fontSize: 16,
@ -159,15 +149,13 @@ extension EmailValidator on String {
style: TextStyle(height: 1, color: color ?? MyColors.darkTextColor, fontSize: 22, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), style: TextStyle(height: 1, color: color ?? MyColors.darkTextColor, fontSize: 22, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
); );
Widget toText24({Color? color, bool isBold = false, bool isCentered = false}) => Text( Widget toText24({Color? color, bool isBold = false}) => Text(
this, this,
textAlign: isCentered ? TextAlign.center : null,
style: TextStyle(height: 23 / 24, color: color ?? MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), style: TextStyle(height: 23 / 24, color: color ?? MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
); );
Widget toText30({Color? color, bool isBold = false, bool isCentered = false}) => Text( Widget toText30({Color? color, bool isBold = false}) => Text(
this, this,
textAlign: isCentered ? TextAlign.center : null,
style: TextStyle(height: 20 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.2, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), style: TextStyle(height: 20 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.2, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
); );
@ -222,7 +210,7 @@ extension EmailValidator on String {
String date = this.split("T")[0]; String date = this.split("T")[0];
String time = this.split("T")[1]; String time = this.split("T")[1];
var dates = date.split("-"); var dates = date.split("-");
return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a', "en_US").format(DateFormat('hh:mm:ss', "en_US").parse(time))}"; return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a').format(DateFormat('hh:mm:ss').parse(time))}";
} }
String getMonth(int month) { String getMonth(int month) {

File diff suppressed because it is too large Load Diff

@ -27,7 +27,6 @@ abstract class LocaleKeys {
static const checkIn = 'checkIn'; static const checkIn = 'checkIn';
static const workList = 'workList'; static const workList = 'workList';
static const leaveBalance = 'leaveBalance'; static const leaveBalance = 'leaveBalance';
static const businessTripBalance = 'businessTripBalance';
static const missingSwipes = 'missingSwipes'; static const missingSwipes = 'missingSwipes';
static const ticketBalance = 'ticketBalance'; static const ticketBalance = 'ticketBalance';
static const services = 'services'; static const services = 'services';
@ -467,7 +466,6 @@ abstract class LocaleKeys {
static const gameTime = 'gameTime'; static const gameTime = 'gameTime';
static const joinMarathon = 'joinMarathon'; static const joinMarathon = 'joinMarathon';
static const joinDemoMarathon = 'joinDemoMarathon'; static const joinDemoMarathon = 'joinDemoMarathon';
static const demo = 'demo';
static const minutes = 'minutes'; static const minutes = 'minutes';
static const seconds = 'seconds'; static const seconds = 'seconds';
static const note = 'note'; static const note = 'note';
@ -477,11 +475,9 @@ abstract class LocaleKeys {
static const sponsoredBy = 'sponsoredBy'; static const sponsoredBy = 'sponsoredBy';
static const question = 'question'; static const question = 'question';
static const marathoners = 'marathoners'; static const marathoners = 'marathoners';
static const marathoner = 'marathoner';
static const prize = 'prize'; static const prize = 'prize';
static const winnerSelection = 'winnerSelection'; static const winnerSelection = 'winnerSelection';
static const qualifiers = 'qualifiers'; static const qualifiers = 'qualifiers';
static const qualifier = 'qualifier';
static const getReadyForContest = 'getReadyForContest'; static const getReadyForContest = 'getReadyForContest';
static const winnerSelectedRandomly = 'winnerSelectedRandomly'; static const winnerSelectedRandomly = 'winnerSelectedRandomly';
static const fingersCrossed = 'fingersCrossed'; static const fingersCrossed = 'fingersCrossed';
@ -504,30 +500,8 @@ abstract class LocaleKeys {
static const startingIn = 'startingIn'; static const startingIn = 'startingIn';
static const youAreOutOfContest = 'youAreOutOfContest'; static const youAreOutOfContest = 'youAreOutOfContest';
static const winners = 'winners'; static const winners = 'winners';
static const expireAfter = 'expireAfter';
static const oneWeek = 'oneWeek';
static const twoWeek = 'twoWeek';
static const noUpcoming = 'noUpcoming'; static const noUpcoming = 'noUpcoming';
static const fakeLocation = 'fakeLocation'; static const fakeLocation = 'fakeLocation';
static const noWinner = 'noWinner'; static const noWinner = 'noWinner';
static const myTeam = 'myTeam';
static const youCanPlayDemo = 'youCanPlayDemo';
static const qualification = 'qualification';
static const esteblishmentName = 'esteblishmentName';
static const gradeDescription = 'gradeDescription';
static const type = 'type';
static const status = 'status';
static const leaveType = 'leaveType';
static const attendanceType = 'attendanceType';
static const help = 'help';
static const dear = 'dear';
static const assistant = 'assistant';
static const employee_leaves_calender = 'employee_leaves_calender';
static const view_your_leave_information = 'view_your_leave_information';
static const view_details = 'view_details';
static const notices = 'notices';
static const hierarchy = 'hierarchy';
static const create_absence_request = 'create_absence_request';
static const business_mission = 'business_mission';
} }

@ -6,8 +6,6 @@
// ignore_for_file: lines_longer_than_80_chars // ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: depend_on_referenced_packages // ignore_for_file: depend_on_referenced_packages
import 'package:audio_session/audio_session_web.dart';
import 'package:camera_web/camera_web.dart';
import 'package:file_picker/_internal/file_picker_web.dart'; import 'package:file_picker/_internal/file_picker_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart'; import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_messaging_web/firebase_messaging_web.dart'; import 'package:firebase_messaging_web/firebase_messaging_web.dart';
@ -15,8 +13,6 @@ import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:geolocator_web/geolocator_web.dart'; import 'package:geolocator_web/geolocator_web.dart';
import 'package:google_maps_flutter_web/google_maps_flutter_web.dart'; import 'package:google_maps_flutter_web/google_maps_flutter_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart'; import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:just_audio_web/just_audio_web.dart';
import 'package:record_web/record_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart'; import 'package:video_player_web/video_player_web.dart';
@ -25,8 +21,6 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs // ignore: public_member_api_docs
void registerPlugins(Registrar registrar) { void registerPlugins(Registrar registrar) {
AudioSessionWeb.registerWith(registrar);
CameraPlugin.registerWith(registrar);
FilePickerWeb.registerWith(registrar); FilePickerWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar); FirebaseCoreWeb.registerWith(registrar);
FirebaseMessagingWeb.registerWith(registrar); FirebaseMessagingWeb.registerWith(registrar);
@ -34,8 +28,6 @@ void registerPlugins(Registrar registrar) {
GeolocatorPlugin.registerWith(registrar); GeolocatorPlugin.registerWith(registrar);
GoogleMapsPlugin.registerWith(registrar); GoogleMapsPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar); ImagePickerPlugin.registerWith(registrar);
JustAudioPlugin.registerWith(registrar);
RecordPluginWeb.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar); SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar); UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar); VideoPlayerPlugin.registerWith(registrar);

@ -6,11 +6,9 @@ import 'package:flutter/services.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/generated/codegen_loader.g.dart'; import 'package:mohem_flutter_app/generated/codegen_loader.g.dart';
import 'package:mohem_flutter_app/models/post_params_model.dart'; import 'package:mohem_flutter_app/models/post_params_model.dart';
import 'package:mohem_flutter_app/provider/chat_call_provider.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/provider/eit_provider_model.dart'; import 'package:mohem_flutter_app/provider/eit_provider_model.dart';
@ -22,11 +20,14 @@ import 'package:provider/single_child_widget.dart';
import 'package:sizer/sizer.dart'; import 'package:sizer/sizer.dart';
Logger logger = Logger( Logger logger = Logger(
// filter: null, // Use the default LogFilter (-> only log in debug mode)
printer: PrettyPrinter( printer: PrettyPrinter(
lineLength: 0, lineLength: 0,
), ), // Use the PrettyPrinter to format and print log
// output: null, // U
); );
class MyHttpOverrides extends HttpOverrides { class MyHttpOverrides extends HttpOverrides {
@override @override
HttpClient createHttpClient(SecurityContext? context) { HttpClient createHttpClient(SecurityContext? context) {
@ -63,17 +64,12 @@ Future<void> main() async {
ChangeNotifierProvider<EITProviderModel>( ChangeNotifierProvider<EITProviderModel>(
create: (_) => EITProviderModel(), create: (_) => EITProviderModel(),
), ),
if (env.chat) ChangeNotifierProvider<ChatProviderModel>(
ChangeNotifierProvider<ChatProviderModel>( create: (_) => ChatProviderModel(),
create: (_) => ChatProviderModel(), ),
), ChangeNotifierProvider<MarathonProvider>(
if (env.marathon) create: (_) => MarathonProvider(),
ChangeNotifierProvider<MarathonProvider>( )
create: (_) => MarathonProvider(),
),
// ChangeNotifierProvider<ChatCallProvider>(
// create: (_) => ChatCallProvider(),
// ),
], ],
child: const MyApp(), child: const MyApp(),
), ),
@ -265,3 +261,4 @@ class MyApp extends StatelessWidget {
// }); // });
// } // }
// } // }

@ -7,191 +7,127 @@ import 'dart:convert';
class CallDataModel { class CallDataModel {
CallDataModel({ CallDataModel({
this.callerId, this.callerId,
this.callerDetails, this.callReceiverID,
this.receiverId, this.notificationForeground,
this.receiverDetails, this.message,
this.title, this.title,
this.calltype, this.type,
this.identity,
this.name,
this.isCall,
this.isWebrtc,
this.contant,
this.contantNo,
this.chatEventId,
this.fileTypeId,
this.currentUserId,
this.chatSource,
this.userChatHistoryLineRequestList,
this.server,
}); });
String? callerId; String? callerId;
CallerDetails? callerDetails; String? callReceiverID;
String? receiverId; String? notificationForeground;
ReceiverDetails? receiverDetails; String? message;
dynamic title; String? title;
String? calltype; String? type;
String? identity;
String? name;
String? isCall;
String? isWebrtc;
String? contant;
String? contantNo;
String? chatEventId;
dynamic? fileTypeId;
String? currentUserId;
String? chatSource;
List<UserChatHistoryLineRequestList>? userChatHistoryLineRequestList;
String? server;
factory CallDataModel.fromRawJson(String str) => CallDataModel.fromJson(json.decode(str)); factory CallDataModel.fromRawJson(String str) => CallDataModel.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory CallDataModel.fromJson(Map<String, dynamic> json) => CallDataModel( factory CallDataModel.fromJson(Map<String, dynamic> json) => CallDataModel(
callerId: json["callerID"], callerId: json["callerID"] == null ? null : json["callerID"],
callerDetails: json["callerDetails"] == null ? null : CallerDetails.fromJson(json["callerDetails"]), callReceiverID: json["callReceiverID"] == null ? null : json["callReceiverID"],
receiverId: json["receiverID"], notificationForeground: json["notification_foreground"] == null ? null : json["notification_foreground"],
receiverDetails: json["receiverDetails"] == null ? null : ReceiverDetails.fromJson(json["receiverDetails"]), message: json["message"] == null ? null : json["message"],
title: json["title"], title: json["title"] == null ? null : json["title"],
calltype: json["calltype"], type: json["type"] == null ? null : json["type"],
); identity: json["identity"] == null ? null : json["identity"],
name: json["name"] == null ? null : json["name"],
Map<String, dynamic> toJson() => { isCall: json["is_call"] == null ? null : json["is_call"],
"callerID": callerId, isWebrtc: json["is_webrtc"] == null ? null : json["is_webrtc"],
"callerDetails": callerDetails?.toJson(), contant: json["contant"] == null ? null : json["contant"],
"receiverID": receiverId, contantNo: json["contantNo"] == null ? null : json["contantNo"],
"receiverDetails": receiverDetails?.toJson(), chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
"title": title, fileTypeId: json["fileTypeId"],
"calltype": calltype, currentUserId: json["currentUserId"] == null ? null : json["currentUserId"],
}; chatSource: json["chatSource"] == null ? null : json["chatSource"],
} userChatHistoryLineRequestList: json["userChatHistoryLineRequestList"] == null
? null
class CallerDetails { : List<UserChatHistoryLineRequestList>.from(
CallerDetails({ json["userChatHistoryLineRequestList"].map(
this.response, (x) => UserChatHistoryLineRequestList.fromJson(x),
this.errorResponses, ),
}); ),
server: json["server"] == null ? null : json["server"],
Response? response; );
dynamic errorResponses;
factory CallerDetails.fromRawJson(String str) => CallerDetails.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory CallerDetails.fromJson(Map<String, dynamic> json) => CallerDetails(
response: json["response"] == null ? null : Response.fromJson(json["response"]),
errorResponses: json["errorResponses"],
);
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"response": response?.toJson(), "callerID": callerId == null ? null : callerId,
"errorResponses": errorResponses, "callReceiverID": callReceiverID == null ? null : callReceiverID,
}; "notification_foreground": notificationForeground == null ? null : notificationForeground,
"message": message == null ? null : message,
"title": title == null ? null : title,
"type": type == null ? null : type,
"identity": identity == null ? null : identity,
"name": name == null ? null : name,
"is_call": isCall == null ? null : isCall,
"is_webrtc": isWebrtc == null ? null : isWebrtc,
"contant": contant == null ? null : contant,
"contantNo": contantNo == null ? null : contantNo,
"chatEventId": chatEventId == null ? null : chatEventId,
"fileTypeId": fileTypeId,
"currentUserId": currentUserId == null ? null : currentUserId,
"chatSource": chatSource == null ? null : chatSource,
"userChatHistoryLineRequestList": userChatHistoryLineRequestList == null
? null
: List<dynamic>.from(
userChatHistoryLineRequestList!.map(
(x) => x.toJson(),
),
),
"server": server == null ? null : server,
};
} }
class Response { class UserChatHistoryLineRequestList {
Response({ UserChatHistoryLineRequestList({
this.id, this.isSeen,
this.userName, this.isDelivered,
this.email, this.targetUserId,
this.phone, this.targetUserStatus,
this.title,
this.token,
this.isDomainUser,
this.isActiveCode,
this.encryptedUserId,
this.encryptedUserName,
}); });
int? id; bool? isSeen;
String? userName; bool? isDelivered;
String? email; int? targetUserId;
dynamic phone; int? targetUserStatus;
String? title;
String? token;
bool? isDomainUser;
bool? isActiveCode;
String? encryptedUserId;
String? encryptedUserName;
factory Response.fromRawJson(String str) => Response.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Response.fromJson(Map<String, dynamic> json) => Response(
id: json["id"],
userName: json["userName"],
email: json["email"],
phone: json["phone"],
title: json["title"],
token: json["token"],
isDomainUser: json["isDomainUser"],
isActiveCode: json["isActiveCode"],
encryptedUserId: json["encryptedUserId"],
encryptedUserName: json["encryptedUserName"],
);
Map<String, dynamic> toJson() => {
"id": id,
"userName": userName,
"email": email,
"phone": phone,
"title": title,
"token": token,
"isDomainUser": isDomainUser,
"isActiveCode": isActiveCode,
"encryptedUserId": encryptedUserId,
"encryptedUserName": encryptedUserName,
};
}
class ReceiverDetails {
ReceiverDetails({
this.id,
this.userName,
this.email,
this.phone,
this.title,
this.userStatus,
this.image,
this.unreadMessageCount,
this.userAction,
this.isPin,
this.isFav,
this.isAdmin,
this.rKey,
this.totalCount,
});
int? id;
String? userName;
String? email;
dynamic phone;
dynamic title;
int? userStatus;
String? image;
int? unreadMessageCount;
dynamic userAction;
bool? isPin;
bool? isFav;
bool? isAdmin;
String? rKey;
int? totalCount;
factory ReceiverDetails.fromRawJson(String str) => ReceiverDetails.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory ReceiverDetails.fromJson(Map<String, dynamic> json) => ReceiverDetails( factory UserChatHistoryLineRequestList.fromJson(Map<String, dynamic> json) => UserChatHistoryLineRequestList(
id: json["id"], isSeen: json["isSeen"] == null ? null : json["isSeen"],
userName: json["userName"], isDelivered: json["isDelivered"] == null ? null : json["isDelivered"],
email: json["email"], targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
phone: json["phone"], targetUserStatus: json["targetUserStatus"] == null ? null : json["targetUserStatus"],
title: json["title"], );
userStatus: json["userStatus"],
image: json["image"],
unreadMessageCount: json["unreadMessageCount"],
userAction: json["userAction"],
isPin: json["isPin"],
isFav: json["isFav"],
isAdmin: json["isAdmin"],
rKey: json["rKey"],
totalCount: json["totalCount"],
);
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"id": id, "isSeen": isSeen == null ? null : isSeen,
"userName": userName, "isDelivered": isDelivered == null ? null : isDelivered,
"email": email, "targetUserId": targetUserId == null ? null : targetUserId,
"phone": phone, "targetUserStatus": targetUserStatus == null ? null : targetUserStatus,
"title": title, };
"userStatus": userStatus,
"image": image,
"unreadMessageCount": unreadMessageCount,
"userAction": userAction,
"isPin": isPin,
"isFav": isFav,
"isAdmin": isAdmin,
"rKey": rKey,
"totalCount": totalCount,
};
} }

@ -1,10 +1,5 @@
import 'dart:convert';
import 'dart:io'; import 'dart:io';
ChatUserModel chatUserModelFromJson(String str) => ChatUserModel.fromJson(json.decode(str));
String chatUserModelToJson(ChatUserModel data) => json.encode(data.toJson());
class ChatUserModel { class ChatUserModel {
ChatUserModel({ ChatUserModel({
this.response, this.response,
@ -12,40 +7,16 @@ class ChatUserModel {
}); });
List<ChatUser>? response; List<ChatUser>? response;
List<ErrorResponse>? errorResponses; dynamic errorResponses;
factory ChatUserModel.fromJson(Map<String, dynamic> json) => ChatUserModel( factory ChatUserModel.fromJson(Map<String, dynamic> json) => ChatUserModel(
response: json["response"] == null ? null : List<ChatUser>.from(json["response"].map((x) => ChatUser.fromJson(x))), response: json["response"] == null ? null : List<ChatUser>.from(json["response"].map((x) => ChatUser.fromJson(x))),
errorResponses: json["errorResponses"] == null ? null : List<ErrorResponse>.from(json["errorResponses"].map((x) => ErrorResponse.fromJson(x))), errorResponses: json["errorResponses"],
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"response": response == null ? null : List<dynamic>.from(response!.map((x) => x.toJson())), "response": response == null ? null : List<dynamic>.from(response!.map((x) => x.toJson())),
"errorResponses": errorResponses == null ? null : List<dynamic>.from(errorResponses!.map((x) => x.toJson())), "errorResponses": errorResponses,
};
}
class ErrorResponse {
ErrorResponse({
this.fieldName,
this.message,
});
dynamic? fieldName;
String? message;
factory ErrorResponse.fromRawJson(String str) => ErrorResponse.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory ErrorResponse.fromJson(Map<String, dynamic> json) => ErrorResponse(
fieldName: json["fieldName"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"fieldName": fieldName,
"message": message == null ? null : message,
}; };
} }
@ -63,8 +34,6 @@ class ChatUser {
this.isPin, this.isPin,
this.isFav, this.isFav,
this.isAdmin, this.isAdmin,
this.rKey,
this.totalCount,
this.isTyping, this.isTyping,
this.isImageLoaded, this.isImageLoaded,
this.isImageLoading, this.isImageLoading,
@ -75,7 +44,7 @@ class ChatUser {
String? userName; String? userName;
String? email; String? email;
dynamic? phone; dynamic? phone;
String? title; dynamic? title;
int? userStatus; int? userStatus;
dynamic? image; dynamic? image;
int? unreadMessageCount; int? unreadMessageCount;
@ -83,23 +52,17 @@ class ChatUser {
bool? isPin; bool? isPin;
bool? isFav; bool? isFav;
bool? isAdmin; bool? isAdmin;
dynamic? rKey;
int? totalCount;
bool? isTyping; bool? isTyping;
bool? isImageLoaded; bool? isImageLoaded;
bool? isImageLoading; bool? isImageLoading;
File? userLocalDownlaodedImage; File? userLocalDownlaodedImage;
factory ChatUser.fromRawJson(String str) => ChatUser.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory ChatUser.fromJson(Map<String, dynamic> json) => ChatUser( factory ChatUser.fromJson(Map<String, dynamic> json) => ChatUser(
id: json["id"] == null ? null : json["id"], id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"], userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"], email: json["email"] == null ? null : json["email"],
phone: json["phone"], phone: json["phone"],
title: json["title"] == null ? null : json["title"], title: json["title"],
userStatus: json["userStatus"] == null ? null : json["userStatus"], userStatus: json["userStatus"] == null ? null : json["userStatus"],
image: json["image"], image: json["image"],
unreadMessageCount: json["unreadMessageCount"] == null ? null : json["unreadMessageCount"], unreadMessageCount: json["unreadMessageCount"] == null ? null : json["unreadMessageCount"],
@ -107,8 +70,6 @@ class ChatUser {
isPin: json["isPin"] == null ? null : json["isPin"], isPin: json["isPin"] == null ? null : json["isPin"],
isFav: json["isFav"] == null ? null : json["isFav"], isFav: json["isFav"] == null ? null : json["isFav"],
isAdmin: json["isAdmin"] == null ? null : json["isAdmin"], isAdmin: json["isAdmin"] == null ? null : json["isAdmin"],
rKey: json["rKey"],
totalCount: json["totalCount"] == null ? null : json["totalCount"],
isTyping: false, isTyping: false,
isImageLoaded: false, isImageLoaded: false,
isImageLoading: true, isImageLoading: true,
@ -119,7 +80,7 @@ class ChatUser {
"userName": userName == null ? null : userName, "userName": userName == null ? null : userName,
"email": email == null ? null : email, "email": email == null ? null : email,
"phone": phone, "phone": phone,
"title": title == null ? null : title, "title": title,
"userStatus": userStatus == null ? null : userStatus, "userStatus": userStatus == null ? null : userStatus,
"image": image, "image": image,
"unreadMessageCount": unreadMessageCount == null ? null : unreadMessageCount, "unreadMessageCount": unreadMessageCount == null ? null : unreadMessageCount,
@ -127,7 +88,5 @@ class ChatUser {
"isPin": isPin == null ? null : isPin, "isPin": isPin == null ? null : isPin,
"isFav": isFav == null ? null : isFav, "isFav": isFav == null ? null : isFav,
"isAdmin": isAdmin == null ? null : isAdmin, "isAdmin": isAdmin == null ? null : isAdmin,
"rKey": rKey,
"totalCount": totalCount == null ? null : totalCount,
}; };
} }

@ -2,8 +2,6 @@ class DrawerMenuItem {
String icon; String icon;
String title; String title;
String routeName; String routeName;
int? requestGroupId;
String? requestGroupName;
DrawerMenuItem(this.icon, this.title, this.routeName, {this.requestGroupId, this.requestGroupName}); DrawerMenuItem(this.icon, this.title, this.routeName);
} }

@ -1,45 +0,0 @@
// To parse this JSON data, do
//
// final employeeLeavesList = employeeLeavesListFromJson(jsonString);
import 'dart:convert';
EmployeeLeavesList employeeLeavesListFromJson(String str) => EmployeeLeavesList.fromJson(json.decode(str));
String employeeLeavesListToJson(EmployeeLeavesList data) => json.encode(data.toJson());
class EmployeeLeavesList {
EmployeeLeavesList({
this.absenceAttendanceTypeName,
this.dateEnd,
this.dateStart,
this.eventDate,
this.holidayType,
this.leaveType,
});
String? absenceAttendanceTypeName;
String? dateEnd;
String? dateStart;
String? eventDate;
String? holidayType;
String? leaveType;
factory EmployeeLeavesList.fromJson(Map<String, dynamic> json) => EmployeeLeavesList(
absenceAttendanceTypeName: json["ABSENCE_ATTENDANCE_TYPE_NAME"],
dateEnd: json["DATE_END"],
dateStart: json["DATE_START"],
eventDate: json["EVENT_DATE"],
holidayType: json["HOLIDAY_TYPE"],
leaveType: json["LEAVE_TYPE"],
);
Map<String, dynamic> toJson() => {
"ABSENCE_ATTENDANCE_TYPE_NAME": absenceAttendanceTypeName,
"DATE_END": dateEnd,
"DATE_START": dateStart,
"EVENT_DATE": eventDate,
"HOLIDAY_TYPE": holidayType,
"LEAVE_TYPE": leaveType,
};
}

@ -8,7 +8,6 @@ import 'package:mohem_flutter_app/models/dashboard/get_open_notifications_list.d
import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/dashboard/list_menu.dart';
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
import 'package:mohem_flutter_app/models/dashboard/mohemm_itg_pending_task_responseitem.dart'; import 'package:mohem_flutter_app/models/dashboard/mohemm_itg_pending_task_responseitem.dart';
import 'package:mohem_flutter_app/models/employee_leaves_list.dart';
import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_approves_list_model.dart'; import 'package:mohem_flutter_app/models/get_approves_list_model.dart';
@ -36,7 +35,6 @@ import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_mod
import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
import 'package:mohem_flutter_app/models/get_user_item_type_list.dart'; import 'package:mohem_flutter_app/models/get_user_item_type_list.dart';
import 'package:mohem_flutter_app/models/hierarchy_lists.dart';
import 'package:mohem_flutter_app/models/leave_balance/calculate_absence_duration_model.dart'; import 'package:mohem_flutter_app/models/leave_balance/calculate_absence_duration_model.dart';
import 'package:mohem_flutter_app/models/leave_balance/cancel_hr_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/leave_balance/cancel_hr_transaction_list_model.dart';
import 'package:mohem_flutter_app/models/leave_balance/get_absence_attendance_types_list_model.dart'; import 'package:mohem_flutter_app/models/leave_balance/get_absence_attendance_types_list_model.dart';
@ -75,7 +73,6 @@ import 'package:mohem_flutter_app/models/performance.dart';
import 'package:mohem_flutter_app/models/privilege_list_model.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart';
import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart';
import 'package:mohem_flutter_app/models/profile/employee_qualifications_list.dart';
import 'package:mohem_flutter_app/models/profile/get_address_dff_structure_list.dart'; import 'package:mohem_flutter_app/models/profile/get_address_dff_structure_list.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart'; import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart'; import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart';
@ -199,7 +196,6 @@ class GenericResponseModel {
List<GetEmployeeBasicDetailsList>? getEmployeeBasicDetailsList; List<GetEmployeeBasicDetailsList>? getEmployeeBasicDetailsList;
List<GetEmployeeContactsList>? getEmployeeContactsList; List<GetEmployeeContactsList>? getEmployeeContactsList;
List<GetEmployeePhonesList>? getEmployeePhonesList; List<GetEmployeePhonesList>? getEmployeePhonesList;
List<EmployeeQualificationsList>? getEmployeeQualificationsList;
List<GetEmployeeSubordinatesList>? getEmployeeSubordinatesList; List<GetEmployeeSubordinatesList>? getEmployeeSubordinatesList;
List<String>? getFliexfieldStructureList; List<String>? getFliexfieldStructureList;
List<String>? getHrCollectionNotificationBodyList; List<String>? getHrCollectionNotificationBodyList;
@ -253,7 +249,6 @@ class GenericResponseModel {
List<GetTermDffStructureList>? getTermDffStructureList; List<GetTermDffStructureList>? getTermDffStructureList;
List<String>? getTermNotificationBodyList; List<String>? getTermNotificationBodyList;
List<GetTimeCardSummaryList>? getTimeCardSummaryList; List<GetTimeCardSummaryList>? getTimeCardSummaryList;
List<EmployeeLeavesList>? getEmployeeLeavesList;
List<GetTicketsByEmployeeList>? getTicketsByEmployeeList; List<GetTicketsByEmployeeList>? getTicketsByEmployeeList;
List<GetTicketDetailsByEmployee>? getTicketDetailsByEmployee; List<GetTicketDetailsByEmployee>? getTicketDetailsByEmployee;
List<GetTicketTransactions>? getTicketTransactions; List<GetTicketTransactions>? getTicketTransactions;
@ -383,274 +378,269 @@ class GenericResponseModel {
String? ePharmacyGetItemOnHandList; String? ePharmacyGetItemOnHandList;
bool? isActiveCode; bool? isActiveCode;
bool? isSMSSent; bool? isSMSSent;
SupervisorHierarchyLists? supervisorHierarchyLists;
GenericResponseModel(
GenericResponseModel({ {this.date,
this.date, this.languageID,
this.languageID, this.serviceName,
this.serviceName, this.time,
this.time, this.androidLink,
this.androidLink, this.authenticationTokenID,
this.authenticationTokenID, this.data,
this.data, this.dataw,
this.dataw, this.dietType,
this.dietType, this.dietTypeID,
this.dietTypeID, this.errorCode,
this.errorCode, this.errorEndUserMessage,
this.errorEndUserMessage, this.errorEndUserMessageN,
this.errorEndUserMessageN, this.errorMessage,
this.errorMessage, this.errorType,
this.errorType, this.foodCategory,
this.foodCategory, this.iOSLink,
this.iOSLink, this.isAuthenticated,
this.isAuthenticated, this.mealOrderStatus,
this.mealOrderStatus, this.mealType,
this.mealType, this.messageStatus,
this.messageStatus, this.numberOfResultRecords,
this.numberOfResultRecords, this.patientBlodType,
this.patientBlodType, this.successMsg,
this.successMsg, this.successMsgN,
this.successMsgN, this.vidaUpdatedResponse,
this.vidaUpdatedResponse, this.addAttSuccessList,
this.addAttSuccessList, this.addAttachmentList,
this.addAttachmentList, this.bCDomain,
this.bCDomain, this.bCLogo,
this.bCLogo, this.basicMemberInformation,
this.basicMemberInformation, this.businessCardPrivilege,
this.businessCardPrivilege, this.calculateAbsenceDuration,
this.calculateAbsenceDuration, this.cancelHRTransactionLIst,
this.cancelHRTransactionLIst, this.chatEmployeeLoginList,
this.chatEmployeeLoginList, this.companyBadge,
this.companyBadge, this.companyImage,
this.companyImage, this.companyImageDescription,
this.companyImageDescription, this.companyImageURL,
this.companyImageURL, this.companyMainCompany,
this.companyMainCompany, this.countryList,
this.countryList, this.createVacationRuleList,
this.createVacationRuleList, this.deleteAttachmentList,
this.deleteAttachmentList, this.deleteVacationRuleList,
this.deleteVacationRuleList, this.disableSessionList,
this.disableSessionList, this.employeeQR,
this.employeeQR, this.forgetPasswordTokenID,
this.forgetPasswordTokenID, this.getAbsenceAttachmentsList,
this.getAbsenceAttachmentsList, this.getAbsenceAttendanceTypesList,
this.getAbsenceAttendanceTypesList, this.getAbsenceCollectionNotificationBodyList,
this.getAbsenceCollectionNotificationBodyList, this.getAbsenceDffStructureList,
this.getAbsenceDffStructureList, this.getAbsenceTransactionList,
this.getAbsenceTransactionList, this.getAccrualBalancesList,
this.getAccrualBalancesList, this.getActionHistoryList,
this.getActionHistoryList, this.getAddressDffStructureList,
this.getAddressDffStructureList, this.getAddressNotificationBodyList,
this.getAddressNotificationBodyList, this.getApprovesList,
this.getApprovesList, this.getAttachementList,
this.getAttachementList, this.getAttendanceTrackingList,
this.getAttendanceTrackingList, this.getBasicDetColsStructureList,
this.getBasicDetColsStructureList, this.getBasicDetDffStructureList,
this.getBasicDetDffStructureList, this.getBasicDetNtfBodyList,
this.getBasicDetNtfBodyList, this.getCEICollectionNotificationBodyList,
this.getCEICollectionNotificationBodyList, this.getCEIDFFStructureList,
this.getCEIDFFStructureList, this.getCEITransactionList,
this.getCEITransactionList, this.getCcpTransactionsList,
this.getCcpTransactionsList, this.getCcpTransactionsListNew,
this.getCcpTransactionsListNew, this.getConcurrentProgramsList,
this.getConcurrentProgramsList, this.getContactColsStructureList,
this.getContactColsStructureList, this.getContactDetailsList,
this.getContactDetailsList, this.getContactDffStructureList,
this.getContactDffStructureList, this.getContactNotificationBodyList,
this.getContactNotificationBodyList, this.getCountriesList,
this.getCountriesList, this.getDayHoursTypeDetailsList,
this.getDayHoursTypeDetailsList, this.getDeductionsList,
this.getDeductionsList, this.getDefaultValueList,
this.getDefaultValueList, this.getEITCollectionNotificationBodyList,
this.getEITCollectionNotificationBodyList, this.getEITDFFStructureList,
this.getEITDFFStructureList, this.getEITTransactionList,
this.getEITTransactionList, this.getEarningsList,
this.getEarningsList, this.getEmployeeAddressList,
this.getEmployeeAddressList, this.getEmployeeBasicDetailsList,
this.getEmployeeBasicDetailsList, this.getEmployeeContactsList,
this.getEmployeeContactsList, this.getEmployeePhonesList,
this.getEmployeePhonesList, this.getEmployeeSubordinatesList,
this.getEmployeeQualificationsList, this.getFliexfieldStructureList,
this.getEmployeeSubordinatesList, this.getHrCollectionNotificationBodyList,
this.getFliexfieldStructureList, this.getHrTransactionList,
this.getHrCollectionNotificationBodyList, this.getItemCreationNtfBodyList,
this.getHrTransactionList, this.getItemTypeNotificationsList,
this.getItemCreationNtfBodyList, this.getItemTypesList,
this.getItemTypeNotificationsList, this.getLookupValuesList,
this.getItemTypesList, this.getMenuEntriesList,
this.getLookupValuesList, this.getMoItemHistoryList,
this.getMenuEntriesList, this.getMoNotificationBodyList,
this.getMoItemHistoryList, this.getNotificationButtonsList,
this.getMoNotificationBodyList, this.getNotificationReassignModeList,
this.getNotificationButtonsList, this.getObjectValuesList,
this.getNotificationReassignModeList, this.getOpenMissingSwipesList,
this.getObjectValuesList, this.getOpenNotificationsList,
this.getOpenMissingSwipesList, this.getOpenNotificationsNumList,
this.getOpenNotificationsList, this.getOpenPeriodDatesList,
this.getOpenNotificationsNumList, this.getOrganizationsSalariesList,
this.getOpenPeriodDatesList, this.getPaymentInformationList,
this.getOrganizationsSalariesList, this.getPayslipList,
this.getPaymentInformationList, this.getPerformanceAppraisalList,
this.getPayslipList, this.getPhonesNotificationBodyList,
this.getPerformanceAppraisalList, this.getPoItemHistoryList,
this.getPhonesNotificationBodyList, this.getPoNotificationBodyList,
this.getPoItemHistoryList, this.getPrNotificationBodyList,
this.getPoNotificationBodyList, this.getQuotationAnalysisList,
this.getPrNotificationBodyList, this.getRFCEmployeeListList,
this.getQuotationAnalysisList, this.getRespondAttributeValueList,
this.getRFCEmployeeListList, this.getSITCollectionNotificationBodyList,
this.getRespondAttributeValueList, this.getSITDFFStructureList,
this.getSITCollectionNotificationBodyList, this.getSITTransactionList,
this.getSITDFFStructureList, this.getScheduleShiftsDetailsList,
this.getSITTransactionList, this.getShiftTypesList,
this.getScheduleShiftsDetailsList, this.getStampMsNotificationBodyList,
this.getShiftTypesList, this.getStampNsNotificationBodyList,
this.getStampMsNotificationBodyList, this.getSubordinatesAttdStatusList,
this.getStampNsNotificationBodyList, this.getSubordinatesLeavesList,
this.getSubordinatesAttdStatusList, this.getSubordinatesLeavesTotalVacationsList,
this.getSubordinatesLeavesList, this.getSummaryOfPaymentList,
this.getSubordinatesLeavesTotalVacationsList, this.getSwipesList,
this.getSummaryOfPaymentList, this.getTermColsStructureList,
this.getSwipesList, this.getTermDffStructureList,
this.getTermColsStructureList, this.getTermNotificationBodyList,
this.getTermDffStructureList, this.getTimeCardSummaryList,
this.getTermNotificationBodyList, this.getTicketsByEmployeeList,
this.getTimeCardSummaryList, this.getTicketDetailsByEmployee,
this.getEmployeeLeavesList, this.getTicketTransactions,
this.getTicketsByEmployeeList, this.getTicketTypes,
this.getTicketDetailsByEmployee, this.getSectionTopics,
this.getTicketTransactions, this.getMowadhafhiProjects,
this.getTicketTypes, this.getProjectDepartments,
this.getSectionTopics, this.getDepartmentSections,
this.getMowadhafhiProjects, this.getPendingTransactionsFunctions,
this.getProjectDepartments, this.getPendingTransactionsDetails,
this.getDepartmentSections, this.getConcurrentProgramsModel,
this.getPendingTransactionsFunctions, this.getCCPTransactionsModel,
this.getPendingTransactionsDetails, this.getCCPOutputModel,
this.getConcurrentProgramsModel, this.getCCPDFFStructureModel,
this.getCCPTransactionsModel, this.getUserItemTypesList,
this.getCCPOutputModel, this.getVacationRulesList,
this.getCCPDFFStructureModel, this.getVaccinationOnHandList,
this.getUserItemTypesList, this.getVaccinationsList,
this.getVacationRulesList, this.getValueSetValuesList,
this.getVaccinationOnHandList, this.getWorkList,
this.getVaccinationsList, this.hRCertificateTemplate,
this.getValueSetValuesList, this.imgURLsList,
this.getWorkList, this.insertApInv,
this.hRCertificateTemplate, this.insertBooked,
this.imgURLsList, this.insertEmpSwipesList,
this.insertApInv, this.insertJournal,
this.insertBooked, this.insertOrders,
this.insertEmpSwipesList, this.intPortalGetEmployeeList,
this.insertJournal, this.isDeviceTokenEmpty,
this.insertOrders, this.isPasswordExpired,
this.intPortalGetEmployeeList, this.isRegisterAllowed,
this.isDeviceTokenEmpty, this.isRequriedValueSetEmpty,
this.isPasswordExpired, this.isUserSMSExcluded,
this.isRegisterAllowed, this.itemOnHand,
this.isRequriedValueSetEmpty, this.languageAvailable,
this.isUserSMSExcluded, this.listSupplier,
this.itemOnHand, this.listUserAgreement,
this.languageAvailable, this.listEITStrucrure,
this.listSupplier, this.listItemImagesDetails,
this.listUserAgreement, this.listItemMaster,
this.listEITStrucrure, this.listMedicineDetails,
this.listItemImagesDetails, this.listMenu,
this.listItemMaster, this.listNewEmployees,
this.listMedicineDetails, this.listRadScreen,
this.listMenu, this.logInTokenID,
this.listNewEmployees, this.memberInformationList,
this.listRadScreen, this.memberLoginList,
this.logInTokenID, this.mohemmGetBusinessCardEnabledList,
this.memberInformationList, this.mohemmGetFavoriteReplacementsList,
this.memberLoginList, this.mohemmGetMobileDeviceInfobyEmpInfoList,
this.mohemmGetBusinessCardEnabledList, this.mohemmGetMobileLoginInfoList,
this.mohemmGetFavoriteReplacementsList, this.mohemmGetPatientIDList,
this.mohemmGetMobileDeviceInfobyEmpInfoList, this.mohemmITGResponseItem,
this.mohemmGetMobileLoginInfoList, this.mohemmIsChangeIsActiveBusinessCardEnable,
this.mohemmGetPatientIDList, this.mohemmIsInsertBusinessCardEnable,
this.mohemmITGResponseItem, this.mohemmWifiPassword,
this.mohemmIsChangeIsActiveBusinessCardEnable, this.mohemmWifiSSID,
this.mohemmIsInsertBusinessCardEnable, this.notificationAction,
this.mohemmWifiPassword, this.notificationGetRespondAttributesList,
this.mohemmWifiSSID, this.notificationRespondRolesList,
this.notificationAction, this.oracleOutPutNumber,
this.notificationGetRespondAttributesList, this.pASSWORDEXPIREDMSG,
this.notificationRespondRolesList, this.pCOUNTRYCODE,
this.oracleOutPutNumber, this.pCOUNTRYNAME,
this.pASSWORDEXPIREDMSG, this.pDESCFLEXCONTEXTCODE,
this.pCOUNTRYCODE, this.pDESCFLEXCONTEXTNAME,
this.pCOUNTRYNAME, this.pForm,
this.pDESCFLEXCONTEXTCODE, this.pINFORMATION,
this.pDESCFLEXCONTEXTNAME, this.pMBLID,
this.pForm, this.pNUMOFSUBORDINATES,
this.pINFORMATION, this.pOPENNTFNUMBER,
this.pMBLID, this.pQUESTION,
this.pNUMOFSUBORDINATES, this.pSESSIONID,
this.pOPENNTFNUMBER, this.pSchema,
this.pQUESTION, this.pharmacyStockAddPharmacyStockList,
this.pSESSIONID, this.pharmacyStockGetOnHandList,
this.pSchema, this.privilegeList,
this.pharmacyStockAddPharmacyStockList, this.processTransactions,
this.pharmacyStockGetOnHandList, this.registerUserNameList,
this.privilegeList, this.replacementList,
this.processTransactions, this.respondAttributesList,
this.registerUserNameList, this.respondRolesList,
this.replacementList, this.resubmitAbsenceTransactionList,
this.respondAttributesList, this.resubmitEITTransactionList,
this.respondRolesList, this.resubmitHrTransactionList,
this.resubmitAbsenceTransactionList, this.sFHGetPoNotificationBodyList,
this.resubmitEITTransactionList, this.sFHGetPrNotificationBodyList,
this.resubmitHrTransactionList, this.startAbsenceApprovalProccess,
this.sFHGetPoNotificationBodyList, this.startAddressApprovalProcessList,
this.sFHGetPrNotificationBodyList, this.startBasicDetApprProcessList,
this.startAbsenceApprovalProccess, this.startCeiApprovalProcess,
this.startAddressApprovalProcessList, this.startContactApprovalProcessList,
this.startBasicDetApprProcessList, this.startEitApprovalProcess,
this.startCeiApprovalProcess, this.startHrApprovalProcessList,
this.startContactApprovalProcessList, this.startPhonesApprovalProcessList,
this.startEitApprovalProcess, this.startSitApprovalProcess,
this.startHrApprovalProcessList, this.startTermApprovalProcessList,
this.startPhonesApprovalProcessList, this.submitAddressTransactionList,
this.startSitApprovalProcess, this.submitBasicDetTransactionList,
this.startTermApprovalProcessList, this.submitCEITransactionList,
this.submitAddressTransactionList, this.submitCcpTransactionList,
this.submitBasicDetTransactionList, this.submitContactTransactionList,
this.submitCEITransactionList, this.submitEITTransactionList,
this.submitCcpTransactionList, this.submitHrTransactionList,
this.submitContactTransactionList, this.submitPhonesTransactionList,
this.submitEITTransactionList, this.submitSITTransactionList,
this.submitHrTransactionList, this.submitTermTransactionList,
this.submitPhonesTransactionList, this.subordinatesOnLeavesList,
this.submitSITTransactionList, this.sumbitAbsenceTransactionList,
this.submitTermTransactionList, this.tokenID,
this.subordinatesOnLeavesList, this.updateAttachmentList,
this.sumbitAbsenceTransactionList, this.updateEmployeeImageList,
this.tokenID, this.updateItemTypeSuccessList,
this.updateAttachmentList, this.updateUserItemTypesList,
this.updateEmployeeImageList, this.updateVacationRuleList,
this.updateItemTypeSuccessList, this.vHREmployeeLoginList,
this.updateUserItemTypesList, this.vHRGetEmployeeDetailsList,
this.updateVacationRuleList, this.vHRGetManagersDetailsList,
this.vHREmployeeLoginList, this.vHRGetProjectByCodeList,
this.vHRGetEmployeeDetailsList, this.vHRIsVerificationCodeValid,
this.vHRGetManagersDetailsList, this.validateAbsenceTransactionList,
this.vHRGetProjectByCodeList, this.validateEITTransactionList,
this.vHRIsVerificationCodeValid, this.validatePhonesTransactionList,
this.validateAbsenceTransactionList, this.vrItemTypesList,
this.validateEITTransactionList, this.wFLookUpList,
this.validatePhonesTransactionList, this.eLearningGETEMPLOYEEPROFILEList,
this.vrItemTypesList, this.eLearningLOGINList,
this.wFLookUpList, this.eLearningValidateLoginList,
this.eLearningGETEMPLOYEEPROFILEList, this.eLearningValidate_LoginList,
this.eLearningLOGINList, this.ePharmacyGetItemOnHandList,
this.eLearningValidateLoginList, this.isActiveCode,
this.eLearningValidate_LoginList, this.isSMSSent});
this.ePharmacyGetItemOnHandList,
this.isActiveCode,
this.isSMSSent,
this.supervisorHierarchyLists,
});
GenericResponseModel.fromJson(Map<String, dynamic> json) { GenericResponseModel.fromJson(Map<String, dynamic> json) {
date = json['Date']; date = json['Date'];
@ -899,12 +889,6 @@ class GenericResponseModel {
getEmployeePhonesList!.add(GetEmployeePhonesList.fromJson(v)); getEmployeePhonesList!.add(GetEmployeePhonesList.fromJson(v));
}); });
} }
if (json['EmployeeQualificationsList'] != null) {
getEmployeeQualificationsList = <EmployeeQualificationsList>[];
json['EmployeeQualificationsList'].forEach((v) {
getEmployeeQualificationsList!.add(EmployeeQualificationsList.fromJson(v));
});
}
if (json['GetEmployeeSubordinatesList'] != null) { if (json['GetEmployeeSubordinatesList'] != null) {
getEmployeeSubordinatesList = <GetEmployeeSubordinatesList>[]; getEmployeeSubordinatesList = <GetEmployeeSubordinatesList>[];
json['GetEmployeeSubordinatesList'].forEach((v) { json['GetEmployeeSubordinatesList'].forEach((v) {
@ -1079,12 +1063,6 @@ class GenericResponseModel {
getTimeCardSummaryList!.add(GetTimeCardSummaryList.fromJson(v)); getTimeCardSummaryList!.add(GetTimeCardSummaryList.fromJson(v));
}); });
} }
if (json['EmployeeLeavesList'] != null) {
getEmployeeLeavesList = <EmployeeLeavesList>[];
json['EmployeeLeavesList'].forEach((v) {
getEmployeeLeavesList!.add(EmployeeLeavesList.fromJson(v));
});
}
if (json['Mohemm_ITG_TicketsByEmployeeList'] != null) { if (json['Mohemm_ITG_TicketsByEmployeeList'] != null) {
getTicketsByEmployeeList = <GetTicketsByEmployeeList>[]; getTicketsByEmployeeList = <GetTicketsByEmployeeList>[];
@ -1313,7 +1291,7 @@ class GenericResponseModel {
if (json['RespondRolesList'] != null) { if (json['RespondRolesList'] != null) {
respondRolesList = <String>[]; respondRolesList = <String>[];
json['RespondRolesList'].forEach((v) { json['RespondRolesList'].forEach((v) {
// respondRolesList!.add(v); // respondRolesList!.add(v);
}); });
} }
resubmitAbsenceTransactionList = json['ResubmitAbsenceTransactionList']; resubmitAbsenceTransactionList = json['ResubmitAbsenceTransactionList'];
@ -1339,7 +1317,10 @@ class GenericResponseModel {
submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null;
submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null;
submitCEITransactionList = json['SubmitCEITransactionList']; submitCEITransactionList = json['SubmitCEITransactionList'];
submitCcpTransactionList = json['SubmitCcpTransactionList'] != null ? new SubmitCcpTransactionList.fromJson(json['SubmitCcpTransactionList']) : null; submitCcpTransactionList = json['SubmitCcpTransactionList'] != null
? new SubmitCcpTransactionList.fromJson(
json['SubmitCcpTransactionList'])
: null;
submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null;
submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null;
@ -1399,8 +1380,6 @@ class GenericResponseModel {
ePharmacyGetItemOnHandList = json['ePharmacy_GetItemOnHandList']; ePharmacyGetItemOnHandList = json['ePharmacy_GetItemOnHandList'];
isActiveCode = json['isActiveCode']; isActiveCode = json['isActiveCode'];
isSMSSent = json['isSMSSent']; isSMSSent = json['isSMSSent'];
supervisorHierarchyLists= json["SupervisorHierarchyLists"] == null ? null : SupervisorHierarchyLists.fromJson(json["SupervisorHierarchyLists"]);
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -1562,9 +1541,6 @@ class GenericResponseModel {
if (this.getEmployeePhonesList != null) { if (this.getEmployeePhonesList != null) {
data['GetEmployeePhonesList'] = this.getEmployeePhonesList!.map((v) => v.toJson()).toList(); data['GetEmployeePhonesList'] = this.getEmployeePhonesList!.map((v) => v.toJson()).toList();
} }
if (this.getEmployeeQualificationsList != null) {
data['EmployeeQualificationsList'] = this.getEmployeeQualificationsList!.map((v) => v.toJson()).toList();
}
if (this.getEmployeeSubordinatesList != null) { if (this.getEmployeeSubordinatesList != null) {
data['GetEmployeeSubordinatesList'] = this.getEmployeeSubordinatesList!.map((v) => v.toJson()).toList(); data['GetEmployeeSubordinatesList'] = this.getEmployeeSubordinatesList!.map((v) => v.toJson()).toList();
} }
@ -1675,10 +1651,6 @@ class GenericResponseModel {
if (this.getTimeCardSummaryList != null) { if (this.getTimeCardSummaryList != null) {
data['GetTimeCardSummaryList'] = this.getTimeCardSummaryList!.map((v) => v.toJson()).toList(); data['GetTimeCardSummaryList'] = this.getTimeCardSummaryList!.map((v) => v.toJson()).toList();
} }
if (this.getEmployeeLeavesList != null) {
data['EmployeeLeavesList'] = this.getEmployeeLeavesList!.map((v) => v.toJson()).toList();
}
data['GetUserItemTypesList'] = this.getUserItemTypesList; data['GetUserItemTypesList'] = this.getUserItemTypesList;
if (this.getVacationRulesList != null) { if (this.getVacationRulesList != null) {
data['GetVacationRulesList'] = this.getVacationRulesList!.map((v) => v.toJson()).toList(); data['GetVacationRulesList'] = this.getVacationRulesList!.map((v) => v.toJson()).toList();
@ -1804,7 +1776,8 @@ class GenericResponseModel {
data['SubmitCEITransactionList'] = this.submitCEITransactionList; data['SubmitCEITransactionList'] = this.submitCEITransactionList;
if (this.submitCcpTransactionList != null) { if (this.submitCcpTransactionList != null) {
data['SubmitCcpTransactionList'] = this.submitCcpTransactionList!.toJson(); data['SubmitCcpTransactionList'] =
this.submitCcpTransactionList!.toJson();
} }
data['SubmitContactTransactionList'] = this.submitContactTransactionList; data['SubmitContactTransactionList'] = this.submitContactTransactionList;
@ -1866,7 +1839,6 @@ class GenericResponseModel {
data['ePharmacy_GetItemOnHandList'] = this.ePharmacyGetItemOnHandList; data['ePharmacy_GetItemOnHandList'] = this.ePharmacyGetItemOnHandList;
data['isActiveCode'] = this.isActiveCode; data['isActiveCode'] = this.isActiveCode;
data['isSMSSent'] = this.isSMSSent; data['isSMSSent'] = this.isSMSSent;
data["SupervisorHierarchyLists"]= supervisorHierarchyLists?.toJson();
return data; return data;
} }
} }

@ -31,7 +31,6 @@ class GetEITDFFStructureList {
List<PARENTSEGMENTSVSSplitedVS>? pARENTSEGMENTSVSSplitedVS; List<PARENTSEGMENTSVSSplitedVS>? pARENTSEGMENTSVSSplitedVS;
String? rEADONLY; String? rEADONLY;
String? rEQUIREDFLAG; String? rEQUIREDFLAG;
String? rEQCOLTIP;
String? sEGMENTNAME; String? sEGMENTNAME;
String? sEGMENTPROMPT; String? sEGMENTPROMPT;
int? sEGMENTSEQNUM; int? sEGMENTSEQNUM;
@ -74,7 +73,6 @@ class GetEITDFFStructureList {
this.pARENTSEGMENTSVSSplitedVS, this.pARENTSEGMENTSVSSplitedVS,
this.rEADONLY, this.rEADONLY,
this.rEQUIREDFLAG, this.rEQUIREDFLAG,
this.rEQCOLTIP,
this.sEGMENTNAME, this.sEGMENTNAME,
this.sEGMENTPROMPT, this.sEGMENTPROMPT,
this.sEGMENTSEQNUM, this.sEGMENTSEQNUM,
@ -134,6 +132,7 @@ class GetEITDFFStructureList {
}); });
} }
pARENTSEGMENTSVS = json['PARENT_SEGMENTS_VS']; pARENTSEGMENTSVS = json['PARENT_SEGMENTS_VS'];
if (json['PARENT_SEGMENTS_VS_SplitedVS'] != null) { if (json['PARENT_SEGMENTS_VS_SplitedVS'] != null) {
pARENTSEGMENTSVSSplitedVS = <PARENTSEGMENTSVSSplitedVS>[]; pARENTSEGMENTSVSSplitedVS = <PARENTSEGMENTSVSSplitedVS>[];
json['PARENT_SEGMENTS_VS_SplitedVS'].forEach((v) { json['PARENT_SEGMENTS_VS_SplitedVS'].forEach((v) {
@ -142,7 +141,6 @@ class GetEITDFFStructureList {
} }
rEADONLY = json['READ_ONLY']; rEADONLY = json['READ_ONLY'];
rEQUIREDFLAG = json['REQUIRED_FLAG']; rEQUIREDFLAG = json['REQUIRED_FLAG'];
rEQCOLTIP = json['REQ_COL_TIP'];
sEGMENTNAME = json['SEGMENT_NAME']; sEGMENTNAME = json['SEGMENT_NAME'];
sEGMENTPROMPT = json['SEGMENT_PROMPT']; sEGMENTPROMPT = json['SEGMENT_PROMPT'];
sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM'];
@ -173,6 +171,9 @@ class GetEITDFFStructureList {
if (this.eSERVICESVS != null) { if (this.eSERVICESVS != null) {
data['E_SERVICES_VS'] = this.eSERVICESVS!.map((v) => v.toJson()).toList(); data['E_SERVICES_VS'] = this.eSERVICESVS!.map((v) => v.toJson()).toList();
} }
// if (this.eSERVICESVS != null) {
// data['E_SERVICES_VS'] = this.eSERVICESVS!.toList();
// }
data['FLEX_VALUE_SET_NAME'] = this.fLEXVALUESETNAME; data['FLEX_VALUE_SET_NAME'] = this.fLEXVALUESETNAME;
data['FORMAT_TYPE'] = this.fORMATTYPE; data['FORMAT_TYPE'] = this.fORMATTYPE;
data['FORMAT_TYPE_DSP'] = this.fORMATTYPEDSP; data['FORMAT_TYPE_DSP'] = this.fORMATTYPEDSP;
@ -192,9 +193,9 @@ class GetEITDFFStructureList {
if (this.pARENTSEGMENTSVSSplitedVS != null) { if (this.pARENTSEGMENTSVSSplitedVS != null) {
data['PARENT_SEGMENTS_VS_SplitedVS'] = this.pARENTSEGMENTSVSSplitedVS!.map((v) => v.toJson()).toList(); data['PARENT_SEGMENTS_VS_SplitedVS'] = this.pARENTSEGMENTSVSSplitedVS!.map((v) => v.toJson()).toList();
} }
data['READ_ONLY'] = this.rEADONLY; data['READ_ONLY'] = this.rEADONLY;
data['REQUIRED_FLAG'] = this.rEQUIREDFLAG; data['REQUIRED_FLAG'] = this.rEQUIREDFLAG;
data['REQ_COL_TIP'] = this.rEQCOLTIP;
data['SEGMENT_NAME'] = this.sEGMENTNAME; data['SEGMENT_NAME'] = this.sEGMENTNAME;
data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT;
data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM;

@ -1,6 +1,6 @@
class GetMobileLoginInfoListModel { class GetMobileLoginInfoListModel {
int? iD; int? iD;
String? employeeID; int? employeeID;
int? channelID; int? channelID;
int? companyID; int? companyID;
String? deviceType; String? deviceType;

@ -1,71 +0,0 @@
class SupervisorHierarchyLists {
SupervisorHierarchyLists({
this.subordinateHierarchyList,
this.supervisorHierarchyList,
});
List<HierarchyList>? subordinateHierarchyList;
List<HierarchyList>? supervisorHierarchyList;
factory SupervisorHierarchyLists.fromJson(Map<String, dynamic> json) => SupervisorHierarchyLists(
subordinateHierarchyList: json["SubordinateHierarchyList"] == null ? [] : List<HierarchyList>.from(json["SubordinateHierarchyList"]!.map((x) => HierarchyList.fromJson(x))),
supervisorHierarchyList: json["SupervisorHierarchyList"] == null ? [] : List<HierarchyList>.from(json["SupervisorHierarchyList"]!.map((x) => HierarchyList.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"SubordinateHierarchyList": subordinateHierarchyList == null ? [] : List<dynamic>.from(subordinateHierarchyList!.map((x) => x.toJson())),
"SupervisorHierarchyList": supervisorHierarchyList == null ? [] : List<dynamic>.from(supervisorHierarchyList!.map((x) => x.toJson())),
};
}
class HierarchyList {
HierarchyList({
this.employeeEmailAddress,
this.employeeImage,
this.employeeMobileNumber,
this.employeeName,
this.employeeNumber,
this.employeeWorkNumber,
this.lvl,
this.numOfSubordinates,
this.organizationName,
this.positionName,
});
String? employeeEmailAddress;
dynamic employeeImage;
String? employeeMobileNumber;
String? employeeName;
String? employeeNumber;
String? employeeWorkNumber;
int? lvl;
int? numOfSubordinates;
String? organizationName;
String? positionName;
factory HierarchyList.fromJson(Map<String, dynamic> json) => HierarchyList(
employeeEmailAddress: json["EMPLOYEE_EMAIL_ADDRESS"],
employeeImage: json["EMPLOYEE_IMAGE"],
employeeMobileNumber: json["EMPLOYEE_MOBILE_NUMBER"],
employeeName: json["EMPLOYEE_NAME"],
employeeNumber: json["EMPLOYEE_NUMBER"],
employeeWorkNumber: json["EMPLOYEE_WORK_NUMBER"],
lvl: json["LVL"],
numOfSubordinates: json["NUM_OF_SUBORDINATES"],
organizationName: json["ORGANIZATION_NAME"],
positionName: json["POSITION_NAME"],
);
Map<String, dynamic> toJson() => {
"EMPLOYEE_EMAIL_ADDRESS": employeeEmailAddress,
"EMPLOYEE_IMAGE": employeeImage,
"EMPLOYEE_MOBILE_NUMBER": employeeMobileNumber,
"EMPLOYEE_NAME": employeeName,
"EMPLOYEE_NUMBER": employeeNumber,
"EMPLOYEE_WORK_NUMBER": employeeWorkNumber,
"LVL": lvl,
"NUM_OF_SUBORDINATES": numOfSubordinates,
"ORGANIZATION_NAME": organizationName,
"POSITION_NAME": positionName,
};
}

@ -11,7 +11,7 @@ class EmployeePostedAds {
String? countryName; String? countryName;
String? currencyCode; String? currencyCode;
String? startDate; String? startDate;
DateTime? endDate; String? endDate;
int? quotePrice; int? quotePrice;
int? employeeNumber; int? employeeNumber;
String? profilePicture; String? profilePicture;
@ -29,32 +29,32 @@ class EmployeePostedAds {
EmployeePostedAds( EmployeePostedAds(
{this.itemSaleID, {this.itemSaleID,
this.title, this.title,
this.titleAr, this.titleAr,
this.description, this.description,
this.descriptionAr, this.descriptionAr,
this.categoryID, this.categoryID,
this.categoryTitle, this.categoryTitle,
this.regionID, this.regionID,
this.regionName, this.regionName,
this.countryName, this.countryName,
this.currencyCode, this.currencyCode,
this.startDate, this.startDate,
this.endDate, this.endDate,
this.quotePrice, this.quotePrice,
this.employeeNumber, this.employeeNumber,
this.profilePicture, this.profilePicture,
this.fullName, this.fullName,
this.emailAddress, this.emailAddress,
this.mobileNumber, this.mobileNumber,
this.isApproved, this.isApproved,
this.status, this.status,
this.itemAttachments, this.itemAttachments,
this.created, this.created,
this.isActive, this.isActive,
this.pageSize, this.pageSize,
this.pageNo, this.pageNo,
this.languageId}); this.languageId});
EmployeePostedAds.fromJson(Map<String, dynamic> json) { EmployeePostedAds.fromJson(Map<String, dynamic> json) {
itemSaleID = json['itemSaleID']; itemSaleID = json['itemSaleID'];
@ -115,7 +115,8 @@ class EmployeePostedAds {
data['isApproved'] = this.isApproved; data['isApproved'] = this.isApproved;
data['status'] = this.status; data['status'] = this.status;
if (this.itemAttachments != null) { if (this.itemAttachments != null) {
data['itemAttachments'] = this.itemAttachments!.map((v) => v.toJson()).toList(); data['itemAttachments'] =
this.itemAttachments!.map((v) => v.toJson()).toList();
} }
data['created'] = this.created; data['created'] = this.created;
data['isActive'] = this.isActive; data['isActive'] = this.isActive;
@ -137,7 +138,16 @@ class ItemAttachments {
String? content; String? content;
String? filePath; String? filePath;
ItemAttachments({this.attachmentId, this.fileName, this.contentType, this.attachFileStream, this.base64String, this.isActive, this.referenceItemId, this.content, this.filePath}); ItemAttachments(
{this.attachmentId,
this.fileName,
this.contentType,
this.attachFileStream,
this.base64String,
this.isActive,
this.referenceItemId,
this.content,
this.filePath});
ItemAttachments.fromJson(Map<String, dynamic> json) { ItemAttachments.fromJson(Map<String, dynamic> json) {
attachmentId = json['attachmentId']; attachmentId = json['attachmentId'];

@ -9,8 +9,16 @@ class ItemReviewModel {
num? itemPrice; num? itemPrice;
List<String>? itemPhotos; List<String>? itemPhotos;
GetSaleCategoriesList? selectedSaleCategory; GetSaleCategoriesList? selectedSaleCategory;
DateTime endDate;
ItemReviewModel(this.itemTitle, this.itemDescription, this.itemCondition, this.selectedRegion, this.itemPrice, this.itemPhotos, this.selectedSaleCategory, this.endDate); ItemReviewModel(
this.itemTitle,
this.itemDescription,
this.itemCondition,
this.selectedRegion,
this.itemPrice,
this.itemPhotos,
this.selectedSaleCategory,
);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>(); Map<String, dynamic> data = new Map<String, dynamic>();
@ -21,7 +29,7 @@ class ItemReviewModel {
data['itemPrice'] = this.itemPrice; data['itemPrice'] = this.itemPrice;
data['itemPhotos'] = this.itemPhotos; data['itemPhotos'] = this.itemPhotos;
data['selectedSaleCategory'] = this.selectedSaleCategory; data['selectedSaleCategory'] = this.selectedSaleCategory;
data['endDate'] = this.endDate;
return data; return data;
} }
} }

@ -51,7 +51,6 @@ class QuestionModel {
json['questionOptions'].forEach((v) { json['questionOptions'].forEach((v) {
questionOptions!.add(QuestionOptions.fromJson(v)); questionOptions!.add(QuestionOptions.fromJson(v));
}); });
questionOptions!.sort((QuestionOptions a, QuestionOptions b) => a.sequence!.compareTo(b.sequence!));
} }
} }

@ -1,192 +1,96 @@
class OffersListModel { class OffersListModel {
int? offersDiscountId; String? title;
String? titleEn; String? titleAR;
String? titleAr; String? description;
String? descriptionEn; String? descriptionAR;
String? descriptionAr;
String? startDate; String? startDate;
String? endDate; String? endDate;
int? categoryId; String? logo;
String? bannerImage;
String? discount;
String? rowID;
String? categoryNameEn; String? categoryNameEn;
String? categoryNameAr; String? categoryNameAr;
String? discount; String? categoryID;
String? location; String? isHasLocation;
int? statusId;
String? statusTitle;
bool? isHasLocation;
String? discountDescription;
String? websiteUrl;
bool? bookMarked;
bool? isHotDeal;
List<OffersDiscountImageColl>? offersDiscountImageColl;
dynamic locationList;
String? created; String? created;
String? bannerImage; String? publishedDesc;
String? logo; String? published;
bool? isActive; String? expireAfter;
int? pageSize; String? status;
int? pageNo; String? isActive;
int? languageId; String? totalItems;
OffersListModel( OffersListModel(
{this.offersDiscountId, {this.title,
this.titleEn, this.titleAR,
this.titleAr, this.description,
this.descriptionEn, this.descriptionAR,
this.descriptionAr, this.startDate,
this.startDate, this.endDate,
this.endDate, this.logo,
this.categoryId, this.bannerImage,
this.categoryNameEn, this.discount,
this.categoryNameAr, this.rowID,
this.discount, this.categoryNameEn,
this.location, this.categoryNameAr,
this.statusId, this.categoryID,
this.statusTitle, this.isHasLocation,
this.isHasLocation, this.created,
this.discountDescription, this.publishedDesc,
this.websiteUrl, this.published,
this.bookMarked, this.expireAfter,
this.isHotDeal, this.status,
this.offersDiscountImageColl, this.isActive,
this.locationList, this.totalItems});
this.created,
this.bannerImage,
this.logo,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
OffersListModel.fromJson(Map<String, dynamic> json) { OffersListModel.fromJson(Map<String, dynamic> json) {
offersDiscountId = json['offersDiscountId']; title = json['Title'];
titleEn = json['titleEn']; titleAR = json['Title_AR'];
titleAr = json['titleAr']; description = json['Description'];
descriptionEn = json['descriptionEn']; descriptionAR = json['Description_AR'];
descriptionAr = json['descriptionAr']; startDate = json['Start Date'];
startDate = json['startDate']; endDate = json['End Date'];
endDate = json['endDate']; logo = json['Logo'];
categoryId = json['categoryId']; bannerImage = json['Banner_Image'];
discount = json['Discount'];
rowID = json['rowID'];
categoryNameEn = json['categoryName_en']; categoryNameEn = json['categoryName_en'];
categoryNameAr = json['categoryName_ar']; categoryNameAr = json['categoryName_ar'];
discount = json['discount']; categoryID = json['categoryID'];
location = json['location']; isHasLocation = json['IsHasLocation'];
statusId = json['statusId'];
statusTitle = json['statusTitle'];
isHasLocation = json['isHasLocation'];
discountDescription = json['discountDescription'];
websiteUrl = json['websiteUrl'];
bookMarked = json['bookMarked'];
isHotDeal = json['isHotDeal'];
if (json['offersDiscountImageColl'] != null) {
offersDiscountImageColl = <OffersDiscountImageColl>[];
json['offersDiscountImageColl'].forEach((v) {
offersDiscountImageColl!.add(new OffersDiscountImageColl.fromJson(v));
});
}
locationList = json['locationList'];
created = json['created']; created = json['created'];
bannerImage = json['banner_Image']; publishedDesc = json['PublishedDesc'];
logo = json['logo']; published = json['Published'];
isActive = json['isActive']; expireAfter = json['ExpireAfter'];
pageSize = json['pageSize']; status = json['Status'];
pageNo = json['pageNo']; isActive = json['IsActive'];
languageId = json['languageId']; totalItems = json['TotalItems'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>(); Map<String, dynamic> data = new Map<String, dynamic>();
data['offersDiscountId'] = this.offersDiscountId; data['Title'] = this.title;
data['titleEn'] = this.titleEn; data['Title_AR'] = this.titleAR;
data['titleAr'] = this.titleAr; data['Description'] = this.description;
data['descriptionEn'] = this.descriptionEn; data['Description_AR'] = this.descriptionAR;
data['descriptionAr'] = this.descriptionAr; data['Start Date'] = this.startDate;
data['startDate'] = this.startDate; data['End Date'] = this.endDate;
data['endDate'] = this.endDate; data['Logo'] = this.logo;
data['categoryId'] = this.categoryId; data['Banner_Image'] = this.bannerImage;
data['Discount'] = this.discount;
data['rowID'] = this.rowID;
data['categoryName_en'] = this.categoryNameEn; data['categoryName_en'] = this.categoryNameEn;
data['categoryName_ar'] = this.categoryNameAr; data['categoryName_ar'] = this.categoryNameAr;
data['discount'] = this.discount; data['categoryID'] = this.categoryID;
data['location'] = this.location; data['IsHasLocation'] = this.isHasLocation;
data['statusId'] = this.statusId;
data['statusTitle'] = this.statusTitle;
data['isHasLocation'] = this.isHasLocation;
data['discountDescription'] = this.discountDescription;
data['websiteUrl'] = this.websiteUrl;
data['bookMarked'] = this.bookMarked;
data['isHotDeal'] = this.isHotDeal;
if (this.offersDiscountImageColl != null) {
data['offersDiscountImageColl'] = this.offersDiscountImageColl!.map((v) => v.toJson()).toList();
}
data['locationList'] = this.locationList;
data['created'] = this.created; data['created'] = this.created;
data['banner_Image'] = this.bannerImage; data['PublishedDesc'] = this.publishedDesc;
data['logo'] = this.logo; data['Published'] = this.published;
data['isActive'] = this.isActive; data['ExpireAfter'] = this.expireAfter;
data['pageSize'] = this.pageSize; data['Status'] = this.status;
data['pageNo'] = this.pageNo; data['IsActive'] = this.isActive;
data['languageId'] = this.languageId; data['TotalItems'] = this.totalItems;
return data;
}
}
class OffersDiscountImageColl {
int? imageAttachmentId;
String? fileName;
String? contentType;
String? attachFileStream;
String? base64String;
int? referenceItemId;
String? filePath;
String? imageTag;
bool? isActive;
int? pageSize;
int? pageNo;
int? languageId;
OffersDiscountImageColl(
{this.imageAttachmentId,
this.fileName,
this.contentType,
this.attachFileStream,
this.base64String,
this.referenceItemId,
this.filePath,
this.imageTag,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
OffersDiscountImageColl.fromJson(Map<String, dynamic> json) {
imageAttachmentId = json['imageAttachmentId'];
fileName = json['fileName'];
contentType = json['contentType'];
attachFileStream = json['attachFileStream'];
base64String = json['base64String'];
referenceItemId = json['referenceItemId'];
filePath = json['filePath'];
imageTag = json['imageTag'];
isActive = json['isActive'];
pageSize = json['pageSize'];
pageNo = json['pageNo'];
languageId = json['languageId'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['imageAttachmentId'] = this.imageAttachmentId;
data['fileName'] = this.fileName;
data['contentType'] = this.contentType;
data['attachFileStream'] = this.attachFileStream;
data['base64String'] = this.base64String;
data['referenceItemId'] = this.referenceItemId;
data['filePath'] = this.filePath;
data['imageTag'] = this.imageTag;
data['isActive'] = this.isActive;
data['pageSize'] = this.pageSize;
data['pageNo'] = this.pageNo;
data['languageId'] = this.languageId;
return data; return data;
} }
} }

@ -1,41 +0,0 @@
// To parse this JSON data, do
//
// final employeeQualificationsList = employeeQualificationsListFromJson(jsonString);
import 'dart:convert';
EmployeeQualificationsList employeeQualificationsListFromJson(String str) => EmployeeQualificationsList.fromJson(json.decode(str));
String employeeQualificationsListToJson(EmployeeQualificationsList data) => json.encode(data.toJson());
class EmployeeQualificationsList {
EmployeeQualificationsList({
this.establishment,
this.grade,
this.gradeDescription,
this.qualificationType,
this.status,
});
String? establishment;
String? grade;
String? gradeDescription;
String? qualificationType;
String? status;
factory EmployeeQualificationsList.fromJson(Map<String, dynamic> json) => EmployeeQualificationsList(
establishment: json["ESTABLISHMENT"],
grade: json["GRADE"],
gradeDescription: json["GRADE_DESCRIPTION"],
qualificationType: json["QUALIFICATION_TYPE"],
status: json["STATUS"],
);
Map<String, dynamic> toJson() => {
"ESTABLISHMENT": establishment,
"GRADE": grade,
"GRADE_DESCRIPTION": gradeDescription,
"QUALIFICATION_TYPE": qualificationType,
"STATUS": status,
};
}

@ -1,187 +0,0 @@
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin {
///////////////////// Web RTC Video Calling //////////////////////
// Video Call
late RTCPeerConnection _peerConnection;
RTCVideoRenderer _localVideoRenderer = RTCVideoRenderer();
final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer();
MediaStream? _localStream;
MediaStream? _remoteStream;
void initCallListeners() {
chatHubConnection.on("OnCallAcceptedAsync", onCallAcceptedAsync);
chatHubConnection.on("OnIceCandidateAsync", onIceCandidateAsync);
chatHubConnection.on("OnOfferAsync", onOfferAsync);
chatHubConnection.on("OnAnswerOffer", onAnswerOffer);
chatHubConnection.on("OnHangUpAsync", onHangUpAsync);
chatHubConnection.on("OnCallDeclinedAsync", onCallDeclinedAsync);
}
//Video Constraints
var videoConstraints = {
"video": {
"mandatory": {
"width": {"min": 320},
"height": {"min": 180}
},
"optional": [
{
"width": {"max": 1280}
},
{"frameRate": 25},
{"facingMode": "user"}
]
},
"frameRate": 25,
"width": 420, //420,//640,//1280,
"height": 240 //240//480//720
};
// Audio Constraints
var audioConstraints = {
"sampleRate": 8000,
"sampleSize": 16,
"channelCount": 2,
"echoCancellation": true,
"audio": true,
};
Future<RTCPeerConnection> _createPeerConnection() async {
// {"url": "stun:stun.l.google.com:19302"},
Map<String, dynamic> configuration = {
"iceServers": [
{"urls": 'stun:15.185.116.59:3478'},
{"urls": "turn:15.185.116.59:3479", "username": "admin", "credential": "admin"}
]
};
Map<String, dynamic> offerSdpConstraints = {
"mandatory": {
"OfferToReceiveAudio": true,
"OfferToReceiveVideo": true,
},
"optional": [],
};
RTCPeerConnection pc = await createPeerConnection(configuration, offerSdpConstraints);
// if (pc != null) print(pc);
//pc.addStream(widget.localStream);
pc.onIceCandidate = (e) {
if (e.candidate != null) {
print(json.encode({
'candidate': e.candidate.toString(),
'sdpMid': e.sdpMid.toString(),
'sdpMlineIndex': e.sdpMLineIndex,
}));
}
};
pc.onIceConnectionState = (e) {
print(e);
};
pc.onAddStream = (stream) {
print('addStream: ' + stream.id);
_remoteRenderer.srcObject = stream;
};
return pc;
}
void init() {
initRenderers();
_createPeerConnection().then((pc) {
_peerConnection = pc;
// _setRemoteDescription(widget.info);
});
}
void initRenderers() {
_localVideoRenderer.initialize();
_remoteRenderer.initialize();
initLocalCamera();
}
void initLocalCamera() async {
_localStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true});
_localVideoRenderer.srcObject = _localStream;
// _localVideoRenderer.srcObject = await navigator.mediaDevices
// .getUserMedia({'video': true, 'audio': true});
print('this source Object');
print('this suarce ${_localVideoRenderer.srcObject != null}');
notifyListeners();
}
void startCall({required String callType}) {}
void endCall() {}
void checkCall(Map<String, dynamic> message) {
switch (message["callStatus"]) {
case 'connected':
{}
break;
case 'offer':
{}
break;
case 'accept':
{}
break;
case 'candidate':
{}
break;
case 'bye':
{}
break;
case 'leave':
{}
break;
}
}
//// Listeners Methods ////
void onCallAcceptedAsync(List<Object?>? params) {}
void onIceCandidateAsync(List<Object?>? params) {}
void onOfferAsync(List<Object?>? params) {}
void onAnswerOffer(List<Object?>? params) {}
void onHangUpAsync(List<Object?>? params) {}
void onCallDeclinedAsync(List<Object?>? params) {}
//// Invoke Methods
Future<void> invoke({required String invokeMethod, required String currentUserID, required String targetUserID, bool isVideoCall = false, var data}) async {
List<Object> args = [];
if (invokeMethod == "answerCallAsync") {
args = [currentUserID, targetUserID];
} else if (invokeMethod == "CallUserAsync") {
args = [currentUserID, targetUserID, isVideoCall];
} else if (invokeMethod == "IceCandidateAsync") {
args = [targetUserID, data];
} else if (invokeMethod == "OfferAsync") {
args = [targetUserID, data];
} else if (invokeMethod == "AnswerOfferAsync") {
args = [targetUserID, data];
//json In Data
}
await chatHubConnection.invoke(invokeMethod, args: args);
}
void stopListeners() async {
chatHubConnection.off('OnCallDeclinedAsync');
chatHubConnection.off('OnCallAcceptedAsync');
chatHubConnection.off('OnIceCandidateAsync');
chatHubConnection.off('OnAnswerOffer');
}
}

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:audio_waveforms/audio_waveforms.dart'; import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -16,7 +17,6 @@ import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/encryption.dart'; import 'package:mohem_flutter_app/classes/encryption.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/main.dart'; import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/chat_user_image_model.dart'; import 'package:mohem_flutter_app/models/chat/chat_user_image_model.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart'; import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
@ -24,7 +24,6 @@ import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.da
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as userLoginToken; import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as userLoginToken;
import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' as fav; import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' as fav;
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart'; import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
import 'package:mohem_flutter_app/widgets/image_picker.dart'; import 'package:mohem_flutter_app/widgets/image_picker.dart';
import 'package:open_file/open_file.dart'; import 'package:open_file/open_file.dart';
@ -33,7 +32,6 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:signalr_netcore/hub_connection.dart'; import 'package:signalr_netcore/hub_connection.dart';
import 'package:signalr_netcore/signalr_client.dart'; import 'package:signalr_netcore/signalr_client.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:flutter/material.dart' as Material;
class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
ScrollController scrollController = ScrollController(); ScrollController scrollController = ScrollController();
@ -68,19 +66,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = []; List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
List<ChatUser> teamMembersList = []; List<ChatUser> teamMembersList = [];
Material.TextDirection textDirection = Material.TextDirection.ltr;
bool isRTL = false;
String msgText = "";
//Chat Home Page Counter //Chat Home Page Counter
int chatUConvCounter = 0; int chatUConvCounter = 0;
/// Search Provider
List<ChatUser>? chatUsersList = [];
int pageNo = 1;
bool disbaleChatForThisUser = false;
Future<void> getUserAutoLoginToken() async { Future<void> getUserAutoLoginToken() async {
userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken(); userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
if (userLoginResponse.response != null) { if (userLoginResponse.response != null) {
@ -90,8 +78,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Utils.showToast( Utils.showToast(
userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr", userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr",
); );
disbaleChatForThisUser = true;
notifyListeners();
} }
} }
@ -109,7 +95,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
HubConnection hub; HubConnection hub;
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true); HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
hub = HubConnectionBuilder() hub = HubConnectionBuilder()
.withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Desktop&access_token=${AppState().chatDetails!.response!.token}", options: httpOp) .withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Web&access_token=${AppState().chatDetails!.response!.token}", options: httpOp)
.withAutomaticReconnect(retryDelays: <int>[2000, 5000, 10000, 20000]).build(); .withAutomaticReconnect(retryDelays: <int>[2000, 5000, 10000, 20000]).build();
return hub; return hub;
} }
@ -123,18 +109,27 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
// chatHubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); // chatHubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
chatHubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); chatHubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
chatHubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); chatHubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus);
if (kDebugMode) { if (kDebugMode) {
logger.i("All listeners registered"); logger.i("All listeners registered");
} }
} }
Future<void> getUserRecentChats() async { void getUserRecentChats() async {
if (chatHubConnection.state != HubConnectionState.Connected) {
getUserAutoLoginToken().whenComplete(() async {
await buildHubConnection();
getUserRecentChats();
});
return;
}
ChatUserModel recentChat = await ChatApiClient().getRecentChats(); ChatUserModel recentChat = await ChatApiClient().getRecentChats();
ChatUserModel favUList = await ChatApiClient().getFavUsers(); ChatUserModel favUList = await ChatApiClient().getFavUsers();
if (favUList.response != null && recentChat.response != null) { if (favUList.response != null && recentChat.response != null) {
favUsersList = favUList.response!; favUsersList = favUList.response!;
favUsersList.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase())); favUsersList.sort(
(ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()),
);
for (dynamic user in recentChat.response!) { for (dynamic user in recentChat.response!) {
for (dynamic favUser in favUList.response!) { for (dynamic favUser in favUList.response!) {
if (user.id == favUser.id) { if (user.id == favUser.id) {
@ -144,10 +139,16 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
} }
pChatHistory = recentChat.response ?? []; pChatHistory = recentChat.response ?? [];
pChatHistory!.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase())); pChatHistory!.sort(
(ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()),
);
searchedChats = pChatHistory; searchedChats = pChatHistory;
isLoading = false; isLoading = false;
await invokeUserChatHistoryNotDeliveredAsync(userId: int.parse(AppState().chatDetails!.response!.id.toString())); await invokeUserChatHistoryNotDeliveredAsync(
userId: int.parse(
AppState().chatDetails!.response!.id.toString(),
),
);
sort(); sort();
notifyListeners(); notifyListeners();
if (searchedChats!.isNotEmpty || favUsersList.isNotEmpty) { if (searchedChats!.isNotEmpty || favUsersList.isNotEmpty) {
@ -170,7 +171,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (response.statusCode == 204) { if (response.statusCode == 204) {
if (isNewChat) { if (isNewChat) {
userChatHistory = []; userChatHistory = [];
} else if (loadMore) {} } else if (loadMore) {
Utils.showToast("No More Data To Load");
}
} else { } else {
if (loadMore) { if (loadMore) {
List<SingleUserChatModel> temp = getSingleUserChatModel(response.body).reversed.toList(); List<SingleUserChatModel> temp = getSingleUserChatModel(response.body).reversed.toList();
@ -326,14 +329,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
user.userStatus = items.first["userStatus"]; user.userStatus = items.first["userStatus"];
} }
} }
if (teamMembersList.isNotEmpty) {
for (ChatUser user in teamMembersList!) {
if (user.id == items.first["id"]) {
user.userStatus = items.first["userStatus"];
}
}
}
notifyListeners(); notifyListeners();
} }
@ -919,12 +914,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
String dateFormte(DateTime data) { String dateFormte(DateTime data) {
DateFormat f = DateFormat('hh:mm a dd MMM yyyy', "en_US"); DateFormat f = DateFormat('hh:mm a dd MMM yyyy');
f.format(data); f.format(data);
return f.format(data); return f.format(data);
} }
Future<void> favoriteUser({required int userID, required int targetUserID, required bool fromSearch}) async { Future<void> favoriteUser({required int userID, required int targetUserID}) async {
fav.FavoriteChatUser favoriteChatUser = await ChatApiClient().favUser(userID: userID, targetUserID: targetUserID); fav.FavoriteChatUser favoriteChatUser = await ChatApiClient().favUser(userID: userID, targetUserID: targetUserID);
if (favoriteChatUser.response != null) { if (favoriteChatUser.response != null) {
for (ChatUser user in searchedChats!) { for (ChatUser user in searchedChats!) {
@ -936,25 +931,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
} }
} }
for (ChatUser user in chatUsersList!) {
if (user.id == favoriteChatUser.response!.targetUserId!) {
user.isFav = favoriteChatUser.response!.isFav;
dynamic contain = favUsersList!.where((ChatUser element) => element.id == favoriteChatUser.response!.targetUserId!);
if (contain.isEmpty) {
favUsersList.add(user);
}
}
}
}
if (fromSearch) {
for (ChatUser user in favUsersList) {
if (user.id == targetUserID) {
user.userLocalDownlaodedImage = null;
user.isImageLoading = false;
user.isImageLoaded = false;
}
}
} }
notifyListeners(); notifyListeners();
} }
@ -973,12 +949,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
); );
} }
for (ChatUser user in chatUsersList!) {
if (user.id == favoriteChatUser.response!.targetUserId!) {
user.isFav = favoriteChatUser.response!.isFav;
}
}
notifyListeners(); notifyListeners();
} }
@ -1014,25 +984,23 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
void disposeData() { void disposeData() {
if (!disbaleChatForThisUser) { search.clear();
search.clear(); isChatScreenActive = false;
isChatScreenActive = false; receiverID = 0;
receiverID = 0; paginationVal = 0;
paginationVal = 0; message.text = '';
message.text = ''; isTextMsg = false;
isTextMsg = false; isAttachmentMsg = false;
isAttachmentMsg = false; isVoiceMsg = false;
isVoiceMsg = false; isReplyMsg = false;
isReplyMsg = false; repliedMsg = [];
repliedMsg = []; sFileType = "";
sFileType = ""; deleteData();
deleteData(); favUsersList.clear();
favUsersList.clear(); searchedChats?.clear();
searchedChats?.clear(); pChatHistory?.clear();
pChatHistory?.clear(); chatHubConnection.stop();
chatHubConnection.stop(); AppState().chatDetails = null;
AppState().chatDetails = null;
}
} }
void deleteData() { void deleteData() {
@ -1203,42 +1171,19 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
playerController.dispose(); playerController.dispose();
} }
void startRecoding(BuildContext context) async { void startRecoding() async {
await Permission.microphone.request().then((PermissionStatus status) { PermissionStatus status = await Permission.microphone.request();
if (status.isPermanentlyDenied) { if (status.isDenied == true) {
Utils.confirmDialog( startRecoding();
context, } else {
"The app needs microphone access to be able to record audio.", isVoiceMsg = true;
onTap: () { recorderController.reset();
Navigator.of(context).pop(); await recorderController.record(path);
openAppSettings(); _recodeDuration = 0;
}, _startTimer();
); isRecoding = !isRecoding;
} else if (status.isDenied) { notifyListeners();
Utils.confirmDialog( }
context,
"The app needs microphone access to be able to record audio.",
onTap: () {
Navigator.of(context).pop();
openAppSettings();
},
);
} else if (status.isGranted) {
sRecoding();
} else {
startRecoding(context);
}
});
}
void sRecoding() async {
isVoiceMsg = true;
recorderController.reset();
await recorderController.record(path);
_recodeDuration = 0;
_startTimer();
isRecoding = !isRecoding;
notifyListeners();
} }
Future<void> _startTimer() async { Future<void> _startTimer() async {
@ -1313,23 +1258,15 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
return numberStr; return numberStr;
} }
Future<File> downChatVoice(Uint8List bytes, String ext, SingleUserChatModel data) async { Future<String> downChatVoice(Uint8List bytes, String ext, SingleUserChatModel data) async {
File file; String dirPath = '${(await getApplicationDocumentsDirectory()).path}/chat_audios';
try { if (!await Directory(dirPath).exists()) {
String dirPath = '${(await getApplicationDocumentsDirectory()).path}/chat_audios'; await Directory(dirPath).create();
if (!await Directory(dirPath).exists()) { await File('$dirPath/.nomedia').create();
await Directory(dirPath).create();
await File('$dirPath/.nomedia').create();
}
file = File("$dirPath/${data.currentUserId}-${data.targetUserId}-${DateTime.now().microsecondsSinceEpoch}" + ext);
await file.writeAsBytes(bytes);
} catch (e) {
if (kDebugMode) {
print(e);
}
file = File("");
} }
return file; File file = File("$dirPath/${data.currentUserId}-${data.targetUserId}-${DateTime.now().microsecondsSinceEpoch}" + ext);
await file.writeAsBytes(bytes);
return file.path;
} }
void scrollToMsg(SingleUserChatModel data) { void scrollToMsg(SingleUserChatModel data) {
@ -1351,127 +1288,51 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
teamMembersList = []; teamMembersList = [];
isLoading = true; isLoading = true;
if (AppState().getemployeeSubordinatesList.isNotEmpty) { if (AppState().getemployeeSubordinatesList.isNotEmpty) {
print("=============== In App State =====================");
getEmployeeSubordinatesList = AppState().getemployeeSubordinatesList; getEmployeeSubordinatesList = AppState().getemployeeSubordinatesList;
for (GetEmployeeSubordinatesList element in getEmployeeSubordinatesList) { for (GetEmployeeSubordinatesList element in getEmployeeSubordinatesList) {
if (element.eMPLOYEEEMAILADDRESS != null) { print(element.eMPLOYEEEMAILADDRESS);
if (element.eMPLOYEEEMAILADDRESS!.isNotEmpty) { teamMembersList.add(
teamMembersList.add( ChatUser(
ChatUser( id: int.parse(element.eMPLOYEENUMBER!),
id: int.parse(element.eMPLOYEENUMBER!), email: element.eMPLOYEEEMAILADDRESS,
email: element.eMPLOYEEEMAILADDRESS, userName: element.eMPLOYEENAME,
userName: element.eMPLOYEENAME, phone: element.eMPLOYEEMOBILENUMBER,
phone: element.eMPLOYEEMOBILENUMBER, userStatus: 0,
userStatus: 0, unreadMessageCount: 0,
unreadMessageCount: 0, isFav: false,
isFav: false, isTyping: false,
isTyping: false, isImageLoading: false,
isImageLoading: false, image: element.eMPLOYEEIMAGE ?? "",
image: element.eMPLOYEEIMAGE ?? "", isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true, userLocalDownlaodedImage:element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!),
userLocalDownlaodedImage: element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!), ),
), );
);
}
}
} }
} else { } else {
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates("", "", ""); getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates("", "", "");
AppState().setemployeeSubordinatesList = getEmployeeSubordinatesList; AppState().setemployeeSubordinatesList = getEmployeeSubordinatesList;
for (GetEmployeeSubordinatesList element in getEmployeeSubordinatesList) { for (GetEmployeeSubordinatesList element in getEmployeeSubordinatesList) {
if (element.eMPLOYEEEMAILADDRESS != null) { print(element.eMPLOYEEEMAILADDRESS);
if (element.eMPLOYEEEMAILADDRESS!.isNotEmpty) { teamMembersList.add(
teamMembersList.add( ChatUser(
ChatUser( id: int.parse(element.eMPLOYEENUMBER!),
id: int.parse(element.eMPLOYEENUMBER!), email: element.eMPLOYEEEMAILADDRESS,
email: element.eMPLOYEEEMAILADDRESS, userName: element.eMPLOYEENAME,
userName: element.eMPLOYEENAME, phone: element.eMPLOYEEMOBILENUMBER,
phone: element.eMPLOYEEMOBILENUMBER, userStatus: 0,
userStatus: 0, unreadMessageCount: 0,
unreadMessageCount: 0, isFav: false,
isFav: false, isTyping: false,
isTyping: false, isImageLoading: false,
isImageLoading: false, image: element.eMPLOYEEIMAGE ?? "",
image: element.eMPLOYEEIMAGE ?? "", isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true, userLocalDownlaodedImage: element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!),
userLocalDownlaodedImage: element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!), ),
), );
);
}
}
}
}
for (ChatUser user in searchedChats!) {
for (ChatUser teamUser in teamMembersList!) {
if (user.id == teamUser.id) {
teamUser.userStatus = user.userStatus;
}
} }
} }
isLoading = false; isLoading = false;
notifyListeners(); notifyListeners();
} }
void inputBoxDirection(String val) {
if (val.isNotEmpty) {
isTextMsg = true;
} else {
isTextMsg = false;
}
msgText = val;
notifyListeners();
}
void onDirectionChange(bool val) {
isRTL = val;
notifyListeners();
}
Material.TextDirection getTextDirection(String v) {
String str = v.trim();
if (str.isEmpty) return Material.TextDirection.ltr;
int firstUnit = str.codeUnitAt(0);
if (firstUnit > 0x0600 && firstUnit < 0x06FF ||
firstUnit > 0x0750 && firstUnit < 0x077F ||
firstUnit > 0x07C0 && firstUnit < 0x07EA ||
firstUnit > 0x0840 && firstUnit < 0x085B ||
firstUnit > 0x08A0 && firstUnit < 0x08B4 ||
firstUnit > 0x08E3 && firstUnit < 0x08FF ||
firstUnit > 0xFB50 && firstUnit < 0xFBB1 ||
firstUnit > 0xFBD3 && firstUnit < 0xFD3D ||
firstUnit > 0xFD50 && firstUnit < 0xFD8F ||
firstUnit > 0xFD92 && firstUnit < 0xFDC7 ||
firstUnit > 0xFDF0 && firstUnit < 0xFDFC ||
firstUnit > 0xFE70 && firstUnit < 0xFE74 ||
firstUnit > 0xFE76 && firstUnit < 0xFEFC ||
firstUnit > 0x10800 && firstUnit < 0x10805 ||
firstUnit > 0x1B000 && firstUnit < 0x1B0FF ||
firstUnit > 0x1D165 && firstUnit < 0x1D169 ||
firstUnit > 0x1D16D && firstUnit < 0x1D172 ||
firstUnit > 0x1D17B && firstUnit < 0x1D182 ||
firstUnit > 0x1D185 && firstUnit < 0x1D18B ||
firstUnit > 0x1D1AA && firstUnit < 0x1D1AD ||
firstUnit > 0x1D242 && firstUnit < 0x1D244) {
return Material.TextDirection.rtl;
}
return Material.TextDirection.ltr;
}
void openChatByNoti(BuildContext context) async {
SingleUserChatModel nUser = SingleUserChatModel();
Utils.saveStringFromPrefs("isAppOpendByChat", "false");
if (await Utils.getStringFromPrefs("notificationData") != "null") {
nUser = SingleUserChatModel.fromJson(jsonDecode(await Utils.getStringFromPrefs("notificationData")));
Utils.saveStringFromPrefs("notificationData", "null");
Future.delayed(const Duration(seconds: 2));
for (ChatUser user in searchedChats!) {
if (user.id == nUser.targetUserId) {
Navigator.pushNamed(context, AppRoutes.chatDetailed, arguments: ChatDetailedScreenParams(user, false));
return;
}
}
}
Utils.saveStringFromPrefs("notificationData", "null");
}
} }

@ -5,7 +5,6 @@ import 'package:mohem_flutter_app/api/dashboard_api_client.dart';
import 'package:mohem_flutter_app/api/offers_and_discounts_api_client.dart'; import 'package:mohem_flutter_app/api/offers_and_discounts_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/main.dart'; import 'package:mohem_flutter_app/main.dart';
@ -41,23 +40,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
bool isMissingSwipeLoading = true; bool isMissingSwipeLoading = true;
int missingSwipeCounter = 0; int missingSwipeCounter = 0;
bool isMyRequestLoading = true;
ListMenu? myRequest;
//Leave and Ticket Balance //Leave and Ticket Balance
bool isLeaveTicketBalanceLoading = true; bool isLeaveTicketBalanceLoading = true;
List<GetAccrualBalancesList>? accrualList; List<GetAccrualBalancesList>? accrualList;
GetAccrualBalancesList? leaveBalanceAccrual; GetAccrualBalancesList? leaveBalanceAccrual;
GetAccrualBalancesList? oldLeaveBalanceAccrual;
double? get leaveBalance => ((leaveBalanceAccrual?.accrualNetEntitlement! ?? 0) + (oldLeaveBalanceAccrual?.accrualNetEntitlement! ??0));
GetAccrualBalancesList? businessTripAccrual;
double get businessTrip => businessTripAccrual?.accrualNetEntitlement ?? 0;
double get leaveBalance => leaveBalanceAccrual?.accrualNetEntitlement ?? 0;
double ticketBalance = 0; double ticketBalance = 0;
//Menu Entries //Menu Entries
@ -98,19 +86,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isWorkListLoading = true; isWorkListLoading = true;
workListCounter = 0; workListCounter = 0;
isMyRequestLoading = true;
myRequest = null;
isMissingSwipeLoading = true; isMissingSwipeLoading = true;
missingSwipeCounter = 0; missingSwipeCounter = 0;
isWorkListLoading = true;
isLeaveTicketBalanceLoading = true; isLeaveTicketBalanceLoading = true;
accrualList = null; accrualList = null;
leaveBalanceAccrual = null; leaveBalanceAccrual = null;
oldLeaveBalanceAccrual = null;
businessTripAccrual = null;
ticketBalance = 0; ticketBalance = 0;
isServicesMenusLoading = true; isServicesMenusLoading = true;
@ -120,13 +101,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
getOffersList = []; getOffersList = [];
drawerMenuItemList = [ drawerMenuItemList = [
DrawerMenuItem("assets/images/drawer/profile_icon.png", LocaleKeys.myProfile.tr(), AppRoutes.profile), DrawerMenuItem("assets/images/drawer/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile),
// DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation),
// DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi),
DrawerMenuItem("assets/images/drawer/notices.png", LocaleKeys.notices.tr(), AppRoutes.pendingTransactions), DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions),
// // DrawerMenuItem("assets/images/drawer/drawer_marathon.svg", LocaleKeys.brainMarathon.tr(), AppRoutes.marathonIntroScreen), // DrawerMenuItem("assets/images/drawer/drawer_marathon.svg", LocaleKeys.brainMarathon.tr(), AppRoutes.marathonIntroScreen),
// DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), AppRoutes.changePassword), DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), AppRoutes.changePassword),
//
]; ];
notifyListeners(); notifyListeners();
@ -158,17 +138,15 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
getOpenNotificationsList = genericResponseModel?.getOpenNotificationsList; getOpenNotificationsList = genericResponseModel?.getOpenNotificationsList;
workListCounter = genericResponseModel?.pOPENNTFNUMBER ?? 0; workListCounter = genericResponseModel?.pOPENNTFNUMBER ?? 0;
if (env.itg) itgFormsModel = await DashboardApiClient().getItgFormsPendingTask();
itgFormsModel = await DashboardApiClient().getItgFormsPendingTask();
workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0); workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0);
if (env.itg) { GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications();
GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications(); cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem;
cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem; if (cocCount != null) {
if (cocCount != null) { cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0);
cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0); workListCounter += cocFinalCount;
workListCounter += cocFinalCount;
}
} }
if (showLoading) Utils.hideLoading(context); if (showLoading) Utils.hideLoading(context);
notifyListeners(); notifyListeners();
} catch (ex) { } catch (ex) {
@ -209,13 +187,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
//Leave and Ticket Balance API's & Methods //Leave and Ticket Balance API's & Methods
Future fetchLeaveTicketBalance(context, DateTime date) async { Future fetchLeaveTicketBalance(context, DateTime date) async {
try { try {
accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy", "en_US").format(date)); accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(date));
isLeaveTicketBalanceLoading = false; isLeaveTicketBalanceLoading = false;
leaveBalanceAccrual = accrualList!.singleWhere((element) => element.accuralPlanName == 'Annual Vacation Accrual' || element.accuralPlanName == "خطة استحقاق الاجازة الاعتيادية", orElse: null); leaveBalanceAccrual = accrualList![0];
oldLeaveBalanceAccrual = accrualList!.singleWhere((element) => element.accuralPlanName == 'Old Leave Balance' || element.accuralPlanName == "خطة فصل الارصدة 1439", orElse: null); ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0);
businessTripAccrual = accrualList!.singleWhere((element) => element.accuralPlanName == 'Business Trip Accrual' || element.accuralPlanName == "خطة استحقاق الإنتدابات", orElse: null);
ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0) + (accrualList![3].accrualNetEntitlement ?? 0.0);
notifyListeners(); notifyListeners();
} catch (ex) { } catch (ex) {
isLeaveTicketBalanceLoading = false; isLeaveTicketBalanceLoading = false;
@ -232,19 +207,17 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void fetchListMenu() async { void fetchListMenu() async {
try { try {
List<ListMenu> menuList = await DashboardApiClient().getListMenu(); List<ListMenu> menuList = await DashboardApiClient().getListMenu();
for (var menu in menuList) { List findMyRequest = menuList.where((element) => element.menuType == "E").toList();
if (menu.menuType == "E") { if (findMyRequest.isNotEmpty) {
myRequest = menu; drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myRequests));
} else if (menu.menuType == "M") { }
AppState().setempStatusIsManager = true; List findMyTeam = menuList.where((element) => element.menuType == "M").toList();
drawerMenuItemList.add(DrawerMenuItem("assets/images/drawer/my_team_icon.png", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); if (findMyTeam.isNotEmpty) {
} AppState().setempStatusIsManager = true;
drawerMenuItemList.insert(2, DrawerMenuItem("assets/images/drawer/my_team.svg", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam));
} }
isMyRequestLoading = false;
notifyListeners();
} catch (ex) { } catch (ex) {
logger.wtf(ex); logger.wtf(ex);
notifyListeners();
Utils.handleException(ex, null, null); Utils.handleException(ex, null, null);
} }
} }
@ -255,14 +228,9 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
GenericResponseModel? genericResponseModel = await DashboardApiClient().getGetMenuEntries(); GenericResponseModel? genericResponseModel = await DashboardApiClient().getGetMenuEntries();
getMenuEntriesList = genericResponseModel!.getMenuEntriesList; getMenuEntriesList = genericResponseModel!.getMenuEntriesList;
homeMenus = parseMenus(getMenuEntriesList ?? []); homeMenus = parseMenus(getMenuEntriesList ?? []);
if (homeMenus!.isNotEmpty) { if (homeMenus!.isNotEmpty) {
if (env.dashboard.monthlyAttendance) { homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr()));
homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr())); homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.tr()));
}
if (env.dashboard.vocationRules) {
homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.tr()));
}
} }
isServicesMenusLoading = false; isServicesMenusLoading = false;
notifyListeners(); notifyListeners();
@ -276,7 +244,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void getCategoryOffersListAPI(BuildContext context) async { void getCategoryOffersListAPI(BuildContext context) async {
try { try {
// Utils.showLoading(context); // Utils.showLoading(context);
getOffersList = await OffersAndDiscountsApiClient().getOffersList(0, 10); getOffersList = await OffersAndDiscountsApiClient().getOffersList(0, 6);
isOffersLoading = false; isOffersLoading = false;
notifyListeners(); notifyListeners();
} catch (ex) { } catch (ex) {
@ -300,7 +268,6 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
MohemmItgResponseItem? res = await DashboardApiClient().getITGPageNotification(); MohemmItgResponseItem? res = await DashboardApiClient().getITGPageNotification();
return res; return res;
} }
void notify() { void notify() {
notifyListeners(); notifyListeners();
} }

@ -1,358 +0,0 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:intl/intl.dart';
import 'package:mohem_flutter_app/api/monthly_attendance_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/employee_leaves_list.dart';
import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart';
import 'package:month_picker_dialog_2/month_picker_dialog_2.dart';
import 'package:pie_chart/pie_chart.dart';
import 'package:sizer/sizer.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
enum LeaveType { ABSENCE, BUSINESS_TRIP, HOLIDAY, NORMAL }
class MoeMonthlyAttendanceScreen extends StatefulWidget {
@override
State<MoeMonthlyAttendanceScreen> createState() => _MoeMonthlyAttendanceScreenState();
}
class _MoeMonthlyAttendanceScreenState extends State<MoeMonthlyAttendanceScreen> {
DateTime currentDate = DateTime.now();
int searchYear = DateTime.now().year;
final CalendarController _calendarController = CalendarController();
List<EmployeeLeavesList> employeeLeavesList = [];
@override
void initState() {
super.initState();
getLeavesData(currentDate);
// callTimeCardAndHourDetails(date.day, searchMonth, searchYear);
}
void getLeavesData(DateTime date) async {
try {
Utils.showLoading(context);
String startDate = '${date.year}-${date.month}-${date.day}';
int lastday = DateTime(date.year, date.month + 1, 0).day;
String endDate = '${date.year}-${date.month}-$lastday';
employeeLeavesList = await MonthlyAttendanceApiClient().getEmployeeLeaves(startDate, endDate);
Utils.hideLoading(context);
_calendarController.displayDate = date;
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
// title: LocaleKeys.mowadhafhiRequest.tr(),
title: "",
// showHomeButton: true,
),
body: ListView(
scrollDirection: Axis.vertical,
children: [
Column(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.grey3AColor),
Row(
children: [
"${DateFormat("MMMM-yyyy").format(currentDate)}".toText16(color: MyColors.greyACColor),
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor),
],
).onPress(() async {
showMonthPicker(
context: context,
//locale: EasyLocalization.of(context)?.locale,
initialDate: currentDate,
firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(),
confirmText: Text(LocaleKeys.confirm.tr()),
cancelText: Text(LocaleKeys.cancel.tr()),
).then((selectedDate) {
if (selectedDate != null) {
getLeavesData(selectedDate);
setState(() {
currentDate = selectedDate;
});
}
});
}),
18.height,
AspectRatio(aspectRatio: 304 / 244, child: calendarWidget()),
12.height,
SizedBox(
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
showColorItem("Absence", MyColors.pinkDarkColor),
showColorItem("Business Trip", MyColors.gradiantStartColor),
showColorItem("Holiday", MyColors.gradiantEndColor),
],
),
),
],
).paddingOnly(left: 21, right: 21, top: 21),
],
),
],
),
);
}
Widget showColorItem(String title, Color color) {
return Row(
children: [
Container(
width: 20,
height: 20,
color: color,
).circle(2000),
8.width,
title.toText12()
],
);
}
Widget calendarWidget() {
return SfCalendar(
view: CalendarView.month,
showDatePickerButton: false,
controller: _calendarController,
backgroundColor: Colors.white,
headerHeight: 0,
viewNavigationMode: ViewNavigationMode.none,
todayHighlightColor: MyColors.grey3AColor,
showNavigationArrow: false,
showCurrentTimeIndicator: false,
showWeekNumber: false,
cellBorderColor: Colors.white,
onTap: (v) {
dynamic index = v.date?.day;
if (index != null) {
index = index - 1;
}
EmployeeLeavesList leaves = employeeLeavesList[index];
if (leaves.leaveType != LeaveType.NORMAL.name) {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25.0),
topRight: Radius.circular(25.0),
)),
isScrollControlled: true,
backgroundColor: MyColors.white,
builder: (_) {
return DraggableScrollableSheet(
maxChildSize: 0.75,
expand: false,
initialChildSize: 0.75,
builder: (_, controller) {
return Column(
children: [
Container(
width: 49,
height: 7,
margin: const EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
color: MyColors.darkGreyColor,
),
),
16.height,
Container(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 40),
margin: const EdgeInsets.only(left: 20, right: 20),
decoration: BoxDecoration(
border: Border.all(
color: Colors.black,
),
borderRadius: BorderRadius.circular(12)),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
DateUtil.getWeekDay(DateUtil.convertStringToDateTime(leaves.eventDate ?? "").weekday).toString().toText14(),
DateUtil.convertStringToDateTime(leaves.eventDate ?? "").day.toString().toText20(),
DateUtil.getMonth(DateUtil.convertStringToDateTime(leaves.eventDate ?? "").month).toString().toText14(),
DateUtil.convertStringToDateTime(leaves.eventDate ?? "").year.toString().toText14(),
],
),
),
6.height,
showText(LocaleKeys.leaveType.tr(), leaves.leaveType.toString()),
// if (leaves.absenceAttendanceTypeName.toString().isNotEmpty)
// const Divider(
// color: MyColors.borderCEColor,
// ),
// if (leaves.absenceAttendanceTypeName.toString().isNotEmpty) showText(LocaleKeys.attendanceType.tr(), leaves.absenceAttendanceTypeName.toString()),
const Divider(
color: MyColors.borderCEColor,
),
showText(LocaleKeys.startDateT.tr(), leaves.dateStart.toString()),
const Divider(
color: MyColors.borderCEColor,
),
showText(LocaleKeys.endDate.tr(), leaves.dateEnd.toString()),
],
);
},
);
},
);
}
},
selectionDecoration: BoxDecoration(
border: Border.all(color: MyColors.white, width: 1),
shape: BoxShape.circle,
),
dataSource: MeetingDataSource(_getDataSource()),
// onTap: calendarTapped,
monthViewSettings: const MonthViewSettings(
dayFormat: 'EEE',
showTrailingAndLeadingDates: false,
showAgenda: false,
),
viewHeaderStyle: const ViewHeaderStyle(
dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600),
),
monthCellBuilder: (build, details) {
LeaveType leaveType = LeaveType.NORMAL;
for (int i = 0; i < employeeLeavesList.length; i++) {
if (details.date.day == DateUtil.convertSimpleStringDateToDateddMMyyyy(employeeLeavesList[i].eventDate ?? "").day) {
if (employeeLeavesList[i].leaveType == LeaveType.ABSENCE.name) {
leaveType = LeaveType.ABSENCE;
} else if (employeeLeavesList[i].leaveType == LeaveType.BUSINESS_TRIP.name) {
leaveType = LeaveType.BUSINESS_TRIP;
} else if (employeeLeavesList[i].leaveType == LeaveType.HOLIDAY.name) {
leaveType = LeaveType.HOLIDAY;
}
}
}
return Container(
margin: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: leaveType == LeaveType.ABSENCE
? MyColors.pinkDarkColor
: leaveType == LeaveType.BUSINESS_TRIP
? MyColors.gradiantStartColor
: leaveType == LeaveType.HOLIDAY
? MyColors.gradiantEndColor
: MyColors.white,
shape: BoxShape.circle,
border: Border.all(
color: leaveType == LeaveType.ABSENCE
? MyColors.pinkDarkColor
: leaveType == LeaveType.BUSINESS_TRIP
? MyColors.gradiantStartColor
: leaveType == LeaveType.HOLIDAY
? MyColors.gradiantEndColor
: MyColors.black,
width: 2,
),
),
alignment: Alignment.center,
child: Text(
"${details.date.day}",
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: leaveType == LeaveType.NORMAL ? MyColors.black : MyColors.white),
),
);
},
);
}
List<Meeting> _getDataSource() {
List<Meeting> meetings = <Meeting>[];
return meetings;
}
Widget showText(String title, String value) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
value.toText18(color: MyColors.gradiantEndColor, isBold: true),
title.toText14(color: MyColors.greyACColor, isBold: false),
],
),
);
}
}
class MeetingDataSource extends CalendarDataSource {
MeetingDataSource(List<Meeting> source) {
appointments = source;
}
@override
DateTime getStartTime(int index) {
return _getMeetingData(index).from;
}
@override
DateTime getEndTime(int index) {
return _getMeetingData(index).to;
}
@override
String getSubject(int index) {
return _getMeetingData(index).eventName;
}
@override
Color getColor(int index) {
return _getMeetingData(index).background;
}
@override
bool isAllDay(int index) {
return _getMeetingData(index).isAllDay;
}
Meeting _getMeetingData(int index) {
dynamic meeting = appointments;
Meeting meetingData;
if (meeting is Meeting) {
meetingData = meeting;
}
return meeting;
}
}
class Meeting {
Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay);
String eventName;
DateTime from;
DateTime to;
Color background;
bool isAllDay;
}

@ -432,7 +432,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
expand: false, expand: false,
builder: (_, controller) { builder: (_, controller) {
dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE; dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE;
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss", "en_US").parse(dmyString); DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss").parse(dmyString);
return Column( return Column(
children: [ children: [
Container( Container(

@ -140,7 +140,7 @@ class _VacationRuleScreenState extends State<VacationRuleScreen> {
} }
String getParsedTime(String time) { String getParsedTime(String time) {
DateTime date = DateFormat("MM/dd/yyyy", "en_US").parse(time); DateTime date = DateFormat("MM/dd/yyyy").parse(time);
return DateFormat("d MMM yyyy", "en_US").format(date); return DateFormat("d MMM yyyy").format(date);
} }
} }

@ -10,14 +10,12 @@ import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/main.dart'; import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/call.dart'; import 'package:mohem_flutter_app/models/chat/call.dart';
import 'package:mohem_flutter_app/provider/chat_call_provider.dart';
import 'package:provider/provider.dart';
class OutGoingCall extends StatefulWidget { class OutGoingCall extends StatefulWidget {
CallDataModel outGoingCallData; CallDataModel OutGoingCallData;
bool isVideoCall; bool? isVideoCall;
OutGoingCall({Key? key, required this.outGoingCallData, required this.isVideoCall}) : super(key: key); OutGoingCall({Key? key, required this.OutGoingCallData, this.isVideoCall}) : super(key: key);
@override @override
_OutGoingCallState createState() => _OutGoingCallState(); _OutGoingCallState createState() => _OutGoingCallState();
@ -25,25 +23,23 @@ class OutGoingCall extends StatefulWidget {
class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderStateMixin { class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderStateMixin {
AnimationController? _animationController; AnimationController? _animationController;
late CameraController controller; CameraController? _controller;
late List<CameraDescription> _cameras;
Future<void>? _initializeControllerFuture; Future<void>? _initializeControllerFuture;
bool isCameraReady = false; bool isCameraReady = false;
bool isMicOff = false; bool isMicOff = false;
bool isLoudSpeaker = false; bool isLoudSpeaker = false;
bool isCamOff = false; bool isCamOff = false;
late ChatCallProvider callProviderd;
@override @override
void initState() { void initState() {
callProviderd = Provider.of<ChatCallProvider>(context, listen: false);
_animationController = AnimationController( _animationController = AnimationController(
vsync: this, vsync: this,
duration: const Duration( duration: const Duration(
milliseconds: 500, milliseconds: 500,
), ),
); );
// _runAnimation(); logger.d(jsonEncode(widget.OutGoingCallData));
//_runAnimation();
// connectSignaling(); // connectSignaling();
WidgetsBinding.instance.addPostFrameCallback( WidgetsBinding.instance.addPostFrameCallback(
(_) => _runAnimation(), (_) => _runAnimation(),
@ -62,10 +58,13 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
return Stack( return Stack(
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
children: <Widget>[ children: <Widget>[
if (widget.isVideoCall) if (widget.isVideoCall!)
Positioned.fill( Positioned.fill(
child: CameraPreview( child: AspectRatio(
controller, aspectRatio: _controller!.value.aspectRatio,
child: CameraPreview(
_controller!,
),
), ),
), ),
Positioned.fill( Positioned.fill(
@ -75,7 +74,7 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: MyColors.grey57Color.withOpacity( color: MyColors.grey57Color.withOpacity(
0.3, 0.7,
), ),
), ),
child: Column( child: Column(
@ -106,9 +105,9 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
10.height, 10.height,
Text( const Text(
widget.outGoingCallData.title, "Aamir Saleem Ahmad",
style: const TextStyle( style: TextStyle(
fontSize: 21, fontSize: 21,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: MyColors.white, color: MyColors.white,
@ -180,7 +179,7 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
if (widget.isVideoCall) if (widget.isVideoCall!)
RawMaterialButton( RawMaterialButton(
onPressed: () { onPressed: () {
_camOff(); _camOff();
@ -268,10 +267,13 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
} }
void _runAnimation() async { void _runAnimation() async {
_cameras = await availableCameras(); List<CameraDescription> cameras = await availableCameras();
CameraDescription firstCamera = _cameras[1]; CameraDescription firstCamera = cameras[1];
controller = CameraController(firstCamera, ResolutionPreset.medium); _controller = CameraController(
_initializeControllerFuture = controller.initialize(); firstCamera,
ResolutionPreset.medium,
);
_initializeControllerFuture = _controller!.initialize();
setState(() {}); setState(() {});
// setAudioFile(); // setAudioFile();
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
@ -302,7 +304,7 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
try { try {
// backToHome(); // backToHome();
// final roomModel = RoomModel(name: widget.OutGoingCallData.name, token: widget.OutGoingCallData.sessionId, identity: widget.OutGoingCallData.identity); // final roomModel = RoomModel(name: widget.OutGoingCallData.name, token: widget.OutGoingCallData.sessionId, identity: widget.OutGoingCallData.identity);
await controller?.dispose(); await _controller?.dispose();
// changeCallStatusAPI(4); // changeCallStatusAPI(4);

@ -12,7 +12,6 @@ import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart'; import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/ui/chat/chat_full_image_preview.dart'; import 'package:mohem_flutter_app/ui/chat/chat_full_image_preview.dart';
@ -32,8 +31,6 @@ class ChatBubble extends StatelessWidget {
bool isReplied = false; bool isReplied = false;
bool isVoice = false;
int? fileTypeID; int? fileTypeID;
String? fileTypeName; String? fileTypeName;
@ -52,7 +49,6 @@ class ChatBubble extends StatelessWidget {
isCurrentUser = cItem.currentUserId == AppState().chatDetails!.response!.id ? true : false; isCurrentUser = cItem.currentUserId == AppState().chatDetails!.response!.id ? true : false;
isSeen = cItem.isSeen == true ? true : false; isSeen = cItem.isSeen == true ? true : false;
isReplied = cItem.userChatReplyResponse != null ? true : false; isReplied = cItem.userChatReplyResponse != null ? true : false;
// isVoice = cItem.fileTypeId == 13 && cItem.voiceController != null ? true : false;
fileTypeID = cItem.fileTypeId; fileTypeID = cItem.fileTypeId;
fileTypeName = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeName : ""; fileTypeName = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeName : "";
fileTypeDescription = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeDescription : ""; fileTypeDescription = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeDescription : "";
@ -65,46 +61,29 @@ class ChatBubble extends StatelessWidget {
required SingleUserChatModel data, required SingleUserChatModel data,
}) async { }) async {
if (data.voice != null && data.voice!.existsSync()) { if (data.voice != null && data.voice!.existsSync()) {
if (Platform.isIOS) { await data.voiceController!.setFilePath(data!.voice!.path);
Duration? duration = await data.voiceController!.setAudioSource(MyCustomStream(data.voice!.readAsBytesSync())); await data.voiceController!.setLoopMode(LoopMode.off);
await data.voiceController!.seek(duration); Duration? duration = await data.voiceController!.load();
await data.voiceController!.setLoopMode(LoopMode.off); await data.voiceController!.seek(duration);
await data.voiceController!.setVolume(1.0); await data.voiceController!.play();
await data.voiceController!.load();
data.voiceController!.play();
} else {
await data.voiceController!.setFilePath(data!.voice!.path);
Duration? duration = await data.voiceController!.load();
await data.voiceController!.seek(duration);
await data.voiceController!.setLoopMode(LoopMode.off);
await data.voiceController!.play();
}
} else { } else {
Utils.showLoading(context); Utils.showLoading(context);
Uint8List encodedString = await ChatApiClient().downloadURL(fileName: data.contant!, fileTypeDescription: provider.getFileTypeDescription(data.fileTypeResponse!.fileTypeName ?? "")); Uint8List encodedString = await ChatApiClient().downloadURL(fileName: data.contant!, fileTypeDescription: provider.getFileTypeDescription(data.fileTypeResponse!.fileTypeName ?? ""));
// try { try {
File sFile = await provider.downChatVoice(encodedString, data.fileTypeResponse!.fileTypeName ?? "", data); String path = await provider.downChatVoice(encodedString, data.fileTypeResponse!.fileTypeName ?? "", data);
if (sFile.path.isEmpty) { File file = File(path!);
logger.d("Path Is Emptyyyyyyy"); await file.readAsBytes();
} else { data.voice = file;
logger.d("Path Exsists"); Duration? duration = await data.voiceController!.setFilePath(file.path);
}
data.voice = sFile;
if (Platform.isIOS) {
logger.d("isIOS");
Duration? duration = await data.voiceController!.setAudioSource(MyCustomStream(data.voice!.readAsBytesSync()));
await data.voiceController!.seek(duration);
await data.voiceController!.setLoopMode(LoopMode.off); await data.voiceController!.setLoopMode(LoopMode.off);
await data.voiceController!.seek(duration);
await data.voiceController!.setVolume(1.0); await data.voiceController!.setVolume(1.0);
await data.voiceController!.load(); await data.voiceController!.load();
Utils.hideLoading(context); Utils.hideLoading(context);
data.voiceController!.play();
} else {
Duration? duration = await data.voiceController!.setFilePath(sFile.path);
await data.voiceController!.setLoopMode(LoopMode.off);
await data.voiceController!.seek(duration);
Utils.hideLoading(context);
await data.voiceController!.play(); await data.voiceController!.play();
} catch (e) {
Utils.hideLoading(context);
Utils.showToast(e.toString());
} }
} }
} }
@ -153,12 +132,9 @@ class ChatBubble extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
(userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5), (userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5),
Directionality( (cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "")
textDirection: provider.getTextDirection(cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : ""), .toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
child: (cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "") .paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
.toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
.paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
),
], ],
).expanded, ).expanded,
if (cItem.userChatReplyResponse != null) if (cItem.userChatReplyResponse != null)
@ -203,7 +179,7 @@ class ChatBubble extends StatelessWidget {
// || fileTypeID == 2 // || fileTypeID == 2
) )
SvgPicture.asset(provider.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10), SvgPicture.asset(provider.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10),
Directionality(textDirection: provider.getTextDirection(cItem.contant ?? ""), child: (cItem.contant ?? "").toText12().expanded), (cItem.contant ?? "").toText12().expanded,
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8
//|| fileTypeID == 2 //|| fileTypeID == 2
) )
@ -257,12 +233,9 @@ class ChatBubble extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
(userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5), (userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5),
Directionality( (cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "")
textDirection: provider.getTextDirection(cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : ""), .toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
child: (cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "") .paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
.toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
.paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
),
], ],
).expanded, ).expanded,
if (cItem.userChatReplyResponse != null) if (cItem.userChatReplyResponse != null)
@ -308,7 +281,7 @@ class ChatBubble extends StatelessWidget {
// || fileTypeID == 2 // || fileTypeID == 2
) )
SvgPicture.asset(provider.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10), SvgPicture.asset(provider.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10),
Directionality(textDirection: provider.getTextDirection(cItem.contant ?? ""), child: (cItem.contant ?? "").toText12(color: Colors.white).expanded), (cItem.contant ?? "").toText12(color: Colors.white).expanded,
if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8
//|| fileTypeID == 2 //|| fileTypeID == 2
) )
@ -326,10 +299,6 @@ class ChatBubble extends StatelessWidget {
).paddingOnly(right: MediaQuery.of(context).size.width * 0.3); ).paddingOnly(right: MediaQuery.of(context).size.width * 0.3);
} }
Widget voiceMsg(BuildContext context) {
return Container();
}
Widget showImage({required bool isReplyPreview, required String fileName, required String fileTypeDescription}) { Widget showImage({required bool isReplyPreview, required String fileName, required String fileTypeDescription}) {
if (cItem.isImageLoaded! && cItem.image != null) { if (cItem.isImageLoaded! && cItem.image != null) {
return Image.memory( return Image.memory(
@ -450,7 +419,7 @@ class ChatBubble extends StatelessWidget {
playVoice(context, data: modelData); playVoice(context, data: modelData);
}); });
} else if (processingState != ProcessingState.completed) { } else if (processingState != ProcessingState.completed) {
return const Icon( return Icon(
Icons.pause, Icons.pause,
size: 30, size: 30,
color: MyColors.lightGreenColor, color: MyColors.lightGreenColor,
@ -458,7 +427,7 @@ class ChatBubble extends StatelessWidget {
pausePlaying(context, data: modelData); pausePlaying(context, data: modelData);
}); });
} else { } else {
return const Icon( return Icon(
Icons.replay, Icons.replay,
size: 30, size: 30,
color: MyColors.lightGreenColor, color: MyColors.lightGreenColor,
@ -470,22 +439,3 @@ class ChatBubble extends StatelessWidget {
); );
} }
} }
class MyCustomStream extends StreamAudioSource {
final Uint8List bytes;
MyCustomStream(this.bytes);
@override
Future<StreamAudioResponse> request([int? start, int? end]) async {
start ??= 0;
end ??= bytes.length;
return StreamAudioResponse(
sourceLength: bytes.length,
contentLength: end - start,
offset: start,
stream: Stream.value(bytes.sublist(start, end)),
contentType: 'audio/aac',
);
}
}

@ -1,5 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:audio_waveforms/audio_waveforms.dart'; import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -14,10 +13,7 @@ import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/call.dart'; import 'package:mohem_flutter_app/models/chat/call.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart'; import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart'; import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart';
import 'package:mohem_flutter_app/provider/chat_call_provider.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:mohem_flutter_app/ui/chat/custom_auto_direction.dart';
import 'package:mohem_flutter_app/ui/chat/call/chat_outgoing_call_screen.dart'; import 'package:mohem_flutter_app/ui/chat/call/chat_outgoing_call_screen.dart';
import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart'; import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart';
import 'package:mohem_flutter_app/ui/chat/common.dart'; import 'package:mohem_flutter_app/ui/chat/common.dart';
@ -45,11 +41,8 @@ class ChatDetailScreen extends StatefulWidget {
class _ChatDetailScreenState extends State<ChatDetailScreen> { class _ChatDetailScreenState extends State<ChatDetailScreen> {
final RefreshController _rc = RefreshController(initialRefresh: false); final RefreshController _rc = RefreshController(initialRefresh: false);
late ChatProviderModel data; late ChatProviderModel data;
late ChatCallProvider callPro;
ChatDetailedScreenParams? params; ChatDetailedScreenParams? params;
// var textDirection = TextDirection.RTL;
void getMoreChat() async { void getMoreChat() async {
if (params != null) { if (params != null) {
data.paginationVal = data.paginationVal + 10; data.paginationVal = data.paginationVal + 10;
@ -78,7 +71,6 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
params = ModalRoute.of(context)!.settings.arguments as ChatDetailedScreenParams; params = ModalRoute.of(context)!.settings.arguments as ChatDetailedScreenParams;
data = Provider.of<ChatProviderModel>(context, listen: false); data = Provider.of<ChatProviderModel>(context, listen: false);
// callPro = Provider.of<ChatCallProvider>(context, listen: false);
if (params != null) { if (params != null) {
data.getSingleUserChatHistory( data.getSingleUserChatHistory(
senderUID: AppState().chatDetails!.response!.id!.toInt(), senderUID: AppState().chatDetails!.response!.id!.toInt(),
@ -95,15 +87,16 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
context, context,
title: params!.chatUser!.userName.toString().replaceAll(".", " ").capitalizeFirstofEach, title: params!.chatUser!.userName.toString().replaceAll(".", " ").capitalizeFirstofEach,
showHomeButton: false, showHomeButton: false,
image: params!.chatUser!.image == null || params!.chatUser!.image.isEmpty ? null : params!.chatUser!.image,
showTyping: true, showTyping: true,
chatUser: params!.chatUser, chatUser: params!.chatUser,
actions: [ actions: [
// SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() { // SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() {
// makeCall(callType: "AUDIO"); // // makeCall(callType: "AUDIO", con: hubConnection);
// }), // }),
// 24.width, // 24.width,
// SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() { // SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() {
// makeCall(callType: "VIDEO"); // // makeCall(callType: "VIDEO", con: hubConnection);
// }), // }),
// 21.width, // 21.width,
], ],
@ -210,7 +203,8 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
WaveBubble( WaveBubble(
playerController: m.playerController, playerController: m.playerController,
isPlaying: m.playerController.playerState == PlayerState.playing, isPlaying: m.playerController.playerState == PlayerState.playing,
onTap: () {}, onTap: () {
},
).expanded ).expanded
else else
AudioWaveforms( AudioWaveforms(
@ -259,39 +253,38 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
if (!m.isRecoding) if (!m.isRecoding)
Row( Row(
children: [ children: [
CustomAutoDirection( TextField(
onDirectionChange: (bool isRTL) => m.onDirectionChange(isRTL), controller: m.message,
text: m.msgText, decoration: InputDecoration(
child: TextField( hintText: m.isAttachmentMsg ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
// textDirection: m.textDirection, hintStyle: TextStyle(color: m.isAttachmentMsg ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14),
controller: m.message, border: InputBorder.none,
decoration: InputDecoration( focusedBorder: InputBorder.none,
hintTextDirection: m.textDirection, enabledBorder: InputBorder.none,
hintText: m.isAttachmentMsg ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(), errorBorder: InputBorder.none,
hintStyle: TextStyle(color: m.isAttachmentMsg ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14), disabledBorder: InputBorder.none,
border: InputBorder.none, filled: true,
focusedBorder: InputBorder.none, fillColor: MyColors.white,
enabledBorder: InputBorder.none, contentPadding: const EdgeInsets.only(
errorBorder: InputBorder.none, left: 21,
disabledBorder: InputBorder.none, top: 20,
filled: true, bottom: 20,
fillColor: MyColors.white,
contentPadding: const EdgeInsets.only(
left: 21,
top: 20,
bottom: 20,
),
prefixIconConstraints: const BoxConstraints(),
prefixIcon: m.sFileType.isNotEmpty
? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 21, right: 15)
: null,
), ),
onChanged: (String val) { prefixIconConstraints: const BoxConstraints(),
m.inputBoxDirection(val); prefixIcon: m.sFileType.isNotEmpty
m.userTypingInvoke(currentUser: AppState().chatDetails!.response!.id!, reciptUser: params!.chatUser!.id!); ? SvgPicture.asset(m.getType(m.sFileType), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 21, right: 15)
}, : null,
).expanded, ),
), onChanged: (String val) {
print(val.length);
if (val.isNotEmpty) {
m.isTextMsg = true;
} else {
m.isTextMsg = false;
}
m.userTypingInvoke(currentUser: AppState().chatDetails!.response!.id!, reciptUser: params!.chatUser!.id!);
},
).expanded,
if (m.sFileType.isNotEmpty) if (m.sFileType.isNotEmpty)
Row( Row(
children: <Widget>[ children: <Widget>[
@ -310,7 +303,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
Icons.mic, Icons.mic,
color: MyColors.lightGreenColor, color: MyColors.lightGreenColor,
).paddingOnly(right: 15).onPress(() { ).paddingOnly(right: 15).onPress(() {
m.startRecoding(context); m.startRecoding();
}), }),
SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26) SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26)
.onPress( .onPress(
@ -351,30 +344,45 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
} }
} }
void makeCall({required String callType}) async { void makeCall({required String callType, required HubConnection con}) async {
callPro.initCallListeners();
print("================== Make call Triggered ============================"); print("================== Make call Triggered ============================");
Map<String, dynamic> json = { Map<String, dynamic> json = {
"callerID": AppState().chatDetails!.response!.id!.toString(), "callerID": AppState().chatDetails!.response!.id!.toString(),
"callerDetails": AppState().chatDetails!.toJson(), "callReceiverID": params!.chatUser!.id.toString(),
"receiverID": params!.chatUser!.id.toString(), "notification_foreground": "true",
"receiverDetails": params!.chatUser!.toJson(), "message": "Aamir is calling",
"title": params!.chatUser!.userName!.replaceAll(".", " "), "title": "Video Call",
"calltype": callType == "VIDEO" ? "Video" : "Audio", "type": callType == "VIDEO" ? "Video" : "Audio",
"identity": AppState().chatDetails!.response!.userName,
"name": AppState().chatDetails!.response!.title,
"is_call": "true",
"is_webrtc": "true",
"contant": "Start video Call ${AppState().chatDetails!.response!.userName}",
"contantNo": "775d1f11-62d9-6fcc-91f6-21f8c14559fb",
"chatEventId": "3",
"fileTypeId": null,
"currentUserId": AppState().chatDetails!.response!.id!.toString(),
"chatSource": "1",
"userChatHistoryLineRequestList": [
{
"isSeen": false,
"isDelivered": false,
"targetUserId": params!.chatUser!.id!,
"targetUserStatus": 4,
}
],
// "server": "https://192.168.8.163:8086",
"server": "https://livecareturn.hmg.com:8086",
}; };
logger.w(json);
CallDataModel callData = CallDataModel.fromJson(json); CallDataModel callData = CallDataModel.fromJson(json);
await Navigator.push( await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => OutGoingCall( builder: (BuildContext context) => OutGoingCall(
isVideoCall: callType == "VIDEO" ? true : false, isVideoCall: callType == "VIDEO" ? true : false,
outGoingCallData: callData, OutGoingCallData: callData,
), ),
), ),
).then((value) { );
print("then");
callPro.stopListeners();
});
} }
} }

@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
@ -51,13 +50,7 @@ class _ChatHomeState extends State<ChatHome> {
} }
if (data.searchedChats == null || data.searchedChats!.isEmpty) { if (data.searchedChats == null || data.searchedChats!.isEmpty) {
data.isLoading = true; data.isLoading = true;
data.getUserRecentChats().whenComplete(() async { data.getUserRecentChats();
// String isAppOpendByChat = await Utils.getStringFromPrefs("isAppOpendByChat");
// String notificationData = await Utils.getStringFromPrefs("notificationData");
// if (isAppOpendByChat != "null" || isAppOpendByChat == "true" && notificationData != "null") {
// data.openChatByNoti(context);
// }
});
} }
} }
@ -90,7 +83,7 @@ class _ChatHomeState extends State<ChatHome> {
children: <Widget>[ children: <Widget>[
myTab(LocaleKeys.mychats.tr(), 0), myTab(LocaleKeys.mychats.tr(), 0),
myTab(LocaleKeys.favorite.tr(), 1), myTab(LocaleKeys.favorite.tr(), 1),
AppState().getempStatusIsManager ? myTab(LocaleKeys.myTeam.tr(), 2) : const SizedBox(), AppState().getempStatusIsManager ? myTab("My Team", 2) : const SizedBox(),
], ],
), ),
), ),

@ -26,10 +26,14 @@ class ChatHomeScreen extends StatefulWidget {
class _ChatHomeScreenState extends State<ChatHomeScreen> { class _ChatHomeScreenState extends State<ChatHomeScreen> {
TextEditingController search = TextEditingController(); TextEditingController search = TextEditingController();
late ChatProviderModel data;
final RefreshController _rc = RefreshController(initialRefresh: false);
@override @override
void initState() { void initState() {
super.initState(); super.initState();
data = Provider.of<ChatProviderModel>(context, listen: false);
} }
@override @override
@ -175,7 +179,6 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
m.favoriteUser( m.favoriteUser(
userID: AppState().chatDetails!.response!.id!, userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!, targetUserID: m.searchedChats![index].id!,
fromSearch: false
); );
} else if (m.searchedChats![index].isFav == true) { } else if (m.searchedChats![index].isFav == true) {
m.unFavoriteUser( m.unFavoriteUser(
@ -186,7 +189,6 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
m.favoriteUser( m.favoriteUser(
userID: AppState().chatDetails!.response!.id!, userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!, targetUserID: m.searchedChats![index].id!,
fromSearch: false
); );
} }
}, },
@ -236,7 +238,6 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
), ),
), ),
onPressed: () async { onPressed: () async {
print(AppState().chatDetails!.response!.token);
showMyBottomSheet( showMyBottomSheet(
context, context,
callBackFunc: () {}, callBackFunc: () {},

@ -1,38 +0,0 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart' as intl;
class CustomAutoDirection extends StatefulWidget {
final String text;
final Widget child;
final void Function(bool isRTL)? onDirectionChange;
const CustomAutoDirection({Key? key, required this.text, required this.child, this.onDirectionChange}) : super(key: key);
@override
_CustomAutoDirectionState createState() => _CustomAutoDirectionState();
}
class _CustomAutoDirectionState extends State<CustomAutoDirection> {
late String text;
late Widget childWidget;
@override
Widget build(BuildContext context) {
text = widget.text;
childWidget = widget.child;
return Directionality(textDirection: isRTL(text) ? TextDirection.rtl : TextDirection.ltr, child: childWidget);
}
@override
void didUpdateWidget(CustomAutoDirection oldWidget) {
if (isRTL(oldWidget.text) != isRTL(widget.text)) {
WidgetsBinding.instance.addPostFrameCallback((_) => widget.onDirectionChange?.call(isRTL(widget.text)));
}
super.didUpdateWidget(oldWidget);
}
bool isRTL(String text) {
if (text.isEmpty) return Directionality.of(context) == TextDirection.rtl;
return intl.Bidi.detectRtlDirectionality(text);
}
}

@ -84,24 +84,24 @@ class _MyTeamScreenState extends State<MyTeamScreen> {
), ),
), ),
), ),
Positioned( // Positioned(
right: 5, // right: 5,
bottom: 1, // bottom: 1,
child: Container( // child: Container(
width: 10, // width: 10,
height: 10, // height: 10,
decoration: BoxDecoration( // decoration: BoxDecoration(
color: m.teamMembersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red, // color: m.teamMembersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
), // ),
).circle(10), // ).circle(10),
) // )
], ],
), ),
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
(m.teamMembersList[index].userName! ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13), (m.teamMembersList![index].userName! ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13),
], ],
).expanded, ).expanded,
// SizedBox( // SizedBox(

@ -6,8 +6,10 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/main.dart';
class EmployeeDigitialIdDialog extends StatelessWidget { class EmployeeDigitialIdDialog extends StatelessWidget {
@override @override

@ -3,15 +3,12 @@ import 'dart:io';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/dashboard_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -35,6 +32,8 @@ import 'package:signalr_netcore/signalr_client.dart';
late HubConnection chatHubConnection; late HubConnection chatHubConnection;
class DashboardScreen extends StatefulWidget { class DashboardScreen extends StatefulWidget {
DashboardScreen({Key? key}) : super(key: key); DashboardScreen({Key? key}) : super(key: key);
@ -44,7 +43,7 @@ class DashboardScreen extends StatefulWidget {
} }
} }
class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingObserver { class _DashboardScreenState extends State<DashboardScreen> {
late DashboardProviderModel data; late DashboardProviderModel data;
late MarathonProvider marathonProvider; late MarathonProvider marathonProvider;
late ChatProviderModel cProvider; late ChatProviderModel cProvider;
@ -56,109 +55,47 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
@override @override
void initState() { void initState() {
WidgetsBinding.instance.addObserver(this);
super.initState(); super.initState();
scheduleMicrotask(() { scheduleMicrotask(() {
data = Provider.of<DashboardProviderModel>(context, listen: false); data = Provider.of<DashboardProviderModel>(context, listen: false);
if (env.marathon) { marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
marathonProvider = Provider.of<MarathonProvider>(context, listen: false); cProvider = Provider.of<ChatProviderModel>(context, listen: false);
}
if (env.chat) {
cProvider = Provider.of<ChatProviderModel>(context, listen: false);
_bHubCon();
}
_onRefresh(true);
});
}
@override _onRefresh();
void didChangeAppLifecycleState(AppLifecycleState state) { });
if (state == AppLifecycleState.resumed) {
checkSession();
}
}
void checkSession() async {
try {
await DashboardApiClient().getOpenNotifications();
} catch (ex) {
Utils.handleException(ex, context, null);
}
} }
@override @override
void dispose() { void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose(); super.dispose();
if (!cProvider.disbaleChatForThisUser) { chatHubConnection.stop();
chatHubConnection.stop();
}
} }
void _bHubCon() { void _bHubCon() {
cProvider.getUserAutoLoginToken().whenComplete(() async { cProvider.getUserAutoLoginToken().whenComplete(() {
if (!cProvider.disbaleChatForThisUser) { cProvider.buildHubConnection();
String isAppOpendByChat = await Utils.getStringFromPrefs("isAppOpendByChat"); Future.delayed(const Duration(seconds: 2), () {
if (isAppOpendByChat != null && isAppOpendByChat == "true") { cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
Utils.showLoading(context); });
cProvider.buildHubConnection();
Future.delayed(const Duration(seconds: 2), () async {
cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
gotoChat(context);
});
} else {
cProvider.buildHubConnection();
Future.delayed(const Duration(seconds: 2), () {
cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
});
}
}
}); });
} }
Future<void> checkHubCon() async { void _onRefresh() async {
if (chatHubConnection.state == HubConnectionState.Connected) {
await chatHubConnection.stop();
await chatHubConnection.start();
} else if (chatHubConnection.state != HubConnectionState.Connected) {
await chatHubConnection.start();
}
}
void gotoChat(BuildContext context) async {
if (chatHubConnection.state == HubConnectionState.Connected) {
Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.chat);
}
}
void _onRefresh(bool isFromInit) async {
data.initProvider(); data.initProvider();
_bHubCon();
// data.getITGNotification().then((value) { // data.getITGNotification().then((value) {
// print("--------------------detail_1-----------------"); // print("--------------------detail_1-----------------");
// print(value!.result!.data!.notificationMasterId); // print(value!.result!.data!.notificationMasterId);
// print(value.result!.data!.notificationTitle); // print(value.result!.data!.notificationTitle);
// }); // });
data.fetchListMenu(); data.fetchListMenu();
if (env.dashboard.attendance) { data.fetchAttendanceTracking(context);
data.fetchAttendanceTracking(context);
}
data.fetchWorkListCounter(context); data.fetchWorkListCounter(context);
if (env.dashboard.missingSwipe) { data.fetchMissingSwipe(context);
data.fetchMissingSwipe(context);
}
data.fetchLeaveTicketBalance(context, DateTime.now()); data.fetchLeaveTicketBalance(context, DateTime.now());
data.fetchMenuEntries(); data.fetchMenuEntries();
if (env.offersDiscount) { data.getCategoryOffersListAPI(context);
data.getCategoryOffersListAPI(context); marathonProvider.getMarathonDetailsFromApi();
}
if (env.marathon) {
marathonProvider.getMarathonDetailsFromApi();
}
if (env.chat) {
marathonProvider.getMarathonDetailsFromApi();
if (!cProvider.disbaleChatForThisUser && !isFromInit) checkHubCon();
}
_refreshController.refreshCompleted(); _refreshController.refreshCompleted();
} }
@ -209,11 +146,10 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
body: Column( body: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Builder(builder: (BuildContext context) { Builder(builder: (BuildContext context) {
return Row( return Row(
// mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Image.memory( Image.memory(
Utils.dataFromBase64String( Utils.dataFromBase64String(
@ -230,6 +166,11 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
height: 34, height: 34,
fit: BoxFit.cover, fit: BoxFit.cover,
).circle(50), ).circle(50),
// CircularAvatar(
// width: 34,
// height: 34,
// url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png",
// ),
8.width, 8.width,
SvgPicture.asset("assets/images/side_nav.svg"), SvgPicture.asset("assets/images/side_nav.svg"),
], ],
@ -237,14 +178,13 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
_scaffoldState.currentState!.openDrawer(); _scaffoldState.currentState!.openDrawer();
}); });
}), }),
Image.asset("assets/images/drawer/moe_logo_full.png", width: 130, height: 45), Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded,
SizedBox(width: 65), SvgPicture.asset(
// SvgPicture.asset( "assets/images/announcements.svg",
// "assets/images/announcements.svg", matchTextDirection: true,
// matchTextDirection: true, ).onPress(() async {
// ).onPress(() async { await Navigator.pushNamed(context, AppRoutes.announcements);
// await Navigator.pushNamed(context, AppRoutes.announcements); })
// })
], ],
).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7),
Expanded( Expanded(
@ -255,9 +195,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
color: MyColors.gradiantEndColor, color: MyColors.gradiantEndColor,
), ),
controller: _refreshController, controller: _refreshController,
onRefresh: () { onRefresh: _onRefresh,
_onRefresh(false);
},
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
@ -269,119 +207,118 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
16.height, 16.height,
Row( Row(
children: [ children: [
if (env.dashboard.attendance) Expanded(
Expanded( child: AspectRatio(
child: AspectRatio( aspectRatio: 159 / 159,
aspectRatio: 159 / 159, child: Consumer<DashboardProviderModel>(
child: Consumer<DashboardProviderModel>( builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
builder: (BuildContext context, DashboardProviderModel model, Widget? child) { return (model.isAttendanceTrackingLoading
return (model.isAttendanceTrackingLoading ? GetAttendanceTrackingShimmer()
? GetAttendanceTrackingShimmer() : Container(
: Container( decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(15),
borderRadius: BorderRadius.circular(15), gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [
gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ MyColors.gradiantEndColor,
MyColors.gradiantEndColor, MyColors.gradiantStartColor,
MyColors.gradiantStartColor, ]),
]), ),
), child: Stack(
child: Stack( alignment: Alignment.center,
alignment: Alignment.center, children: [
children: [ if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"),
if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), Column(
Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Expanded(
Expanded( child: Column(
child: Column( mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true),
if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white),
if (model.isTimeRemainingInSeconds != 0)
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
9.height,
Directionality(
textDirection: ui.TextDirection.ltr,
child: CountdownTimer(
endTime: model.endTime,
onEnd: null,
endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold),
),
),
LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white),
9.height,
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(20)),
child: LinearProgressIndicator(
value: model.progress,
minHeight: 8,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white),
backgroundColor: const Color(0xff196D73),
),
),
],
),
],
).paddingOnly(top: 12, right: 15, left: 12),
),
Row(
children: [ children: [
Expanded( LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true),
child: Column( if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white),
if (model.isTimeRemainingInSeconds != 0)
Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.checkIn.tr().toText12(color: Colors.white), 9.height,
(model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) Directionality(
.toString() textDirection: ui.TextDirection.ltr,
.toText14(color: Colors.white, isBold: true), child: CountdownTimer(
4.height, endTime: model.endTime,
onEnd: null,
endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold),
),
),
LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white),
9.height,
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(20)),
child: LinearProgressIndicator(
value: model.progress,
minHeight: 8,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white),
backgroundColor: const Color(0xff196D73),
),
),
], ],
).paddingOnly(left: 12, right: 12),
),
Container(
margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
width: 45,
height: 45,
padding: const EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
color: Color(0xff259EA4),
borderRadius: BorderRadius.only(
bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15),
bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0),
),
), ),
child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/attendance.svg" : "assets/images/attendance.svg"),
).onPress(() {
showMyBottomSheet(
context,
callBackFunc: () {},
child: MarkAttendanceWidget(model, isFromDashboard: true),
);
}),
], ],
), ).paddingOnly(top: 12, right: 15, left: 12),
], ),
), Row(
], children: [
), Expanded(
).onPress( child: Column(
() { mainAxisSize: MainAxisSize.min,
Navigator.pushNamed(context, AppRoutes.todayAttendance); crossAxisAlignment: CrossAxisAlignment.start,
}, children: [
)) LocaleKeys.checkIn.tr().toText12(color: Colors.white),
.animatedSwither(); (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn)
}, .toString()
), .toText14(color: Colors.white, isBold: true),
4.height,
],
).paddingOnly(left: 12, right: 12),
),
Container(
margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
width: 45,
height: 45,
padding: const EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
color: Color(0xff259EA4),
borderRadius: BorderRadius.only(
bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15),
bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0),
),
),
child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/attendance.svg" : "assets/images/attendance.svg"),
).onPress(() {
showMyBottomSheet(
context,
callBackFunc: () {},
child: MarkAttendanceWidget(model, isFromDashboard: true),
);
}),
],
),
],
),
],
),
).onPress(
() {
Navigator.pushNamed(context, AppRoutes.todayAttendance);
},
))
.animatedSwither();
},
), ),
), ),
if (env.dashboard.attendance) 9.width, ),
9.width,
Expanded( Expanded(
child: MenusWidget(), child: MenusWidget(),
), ),
@ -389,150 +326,102 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
), ),
], ],
).paddingOnly(left: 21, right: 21, top: 7, bottom: 21), ).paddingOnly(left: 21, right: 21, top: 7, bottom: 21),
if (env.monthlyAttendance) Column(
InkWell( mainAxisSize: MainAxisSize.min,
child: Container( crossAxisAlignment: CrossAxisAlignment.start,
width: double.infinity, children: [
padding: EdgeInsets.all(12), Row(
margin: EdgeInsets.symmetric(horizontal: 21), crossAxisAlignment: CrossAxisAlignment.center,
decoration: const BoxDecoration( children: [
color: MyColors.gradiantStartColor, Expanded(
borderRadius: BorderRadius.all(Radius.circular(12)), child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
child: Row( mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded( LocaleKeys.offers.tr().toText12(),
child: Column( Row(
mainAxisAlignment: MainAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start, LocaleKeys.discounts.tr().toText24(isBold: true),
children: [ 6.width,
LocaleKeys.employee_leaves_calender.tr().toText18(isBold: true, color: Colors.white), Container(
2.height, padding: const EdgeInsets.only(left: 8, right: 8),
LocaleKeys.view_your_leave_information.tr().toText12(color: Colors.white), decoration: BoxDecoration(
8.height, color: MyColors.yellowColor,
Container( borderRadius: BorderRadius.circular(10),
decoration: BoxDecoration( ),
color: Colors.white.withOpacity(0.4), child: LocaleKeys.newString.tr().toText10(isBold: true)),
borderRadius: const BorderRadius.all(Radius.circular(12)), ],
), ),
padding: EdgeInsets.all(8), ],
child: LocaleKeys.view_details.tr().toText14(color: Colors.white),
),
],
),
),
const Icon(
Icons.calendar_month,
color: Colors.white,
size: 80,
),
],
),
),
onTap: () {
Navigator.pushNamed(context, AppRoutes.monthlyAttendance);
},
),
21.height,
Visibility(
visible: env.offersDiscount,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
LocaleKeys.offers.tr().toText12(),
Row(
children: [
LocaleKeys.discounts.tr().toText24(isBold: true),
6.width,
Container(
padding: const EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
color: MyColors.yellowColor,
borderRadius: BorderRadius.circular(10),
),
child: LocaleKeys.newString.tr().toText10(isBold: true)),
],
),
],
),
), ),
LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { ),
Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() {
}) Navigator.pushNamed(context, AppRoutes.offersAndDiscounts);
], })
).paddingOnly(left: 21, right: 21), ],
Consumer<DashboardProviderModel>( ).paddingOnly(left: 21, right: 21),
builder: (BuildContext context, DashboardProviderModel model, Widget? child) { Consumer<DashboardProviderModel>(
return SizedBox( builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
height: 103 + 33, return SizedBox(
child: ListView.separated( height: 103 + 33,
shrinkWrap: true, child: ListView.separated(
physics: const BouncingScrollPhysics(), shrinkWrap: true,
padding: const EdgeInsets.only(left: 21, right: 21, top: 13), physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal, padding: const EdgeInsets.only(left: 21, right: 21, top: 13),
itemBuilder: (BuildContext cxt, int index) { scrollDirection: Axis.horizontal,
return model.isOffersLoading itemBuilder: (BuildContext cxt, int index) {
? const OffersShimmerWidget() return model.isOffersLoading
: InkWell( ? const OffersShimmerWidget()
onTap: () { : InkWell(
navigateToDetails(data.getOffersList[index]); onTap: () {
}, navigateToDetails(data.getOffersList[index]);
child: SizedBox( },
width: 73, child: SizedBox(
child: Column( width: 73,
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.center,
Container( children: [
width: 73, Container(
height: 73, width: 73,
decoration: BoxDecoration( height: 73,
color: Colors.white, decoration: BoxDecoration(
borderRadius: const BorderRadius.all( color: Colors.white,
Radius.circular(100), borderRadius: const BorderRadius.all(
), Radius.circular(100),
border: Border.all(color: MyColors.lightGreyE3Color, width: 1),
), ),
child: ClipRRect( border: Border.all(color: MyColors.lightGreyE3Color, width: 1),
borderRadius: const BorderRadius.all( ),
Radius.circular(50), child: ClipRRect(
), borderRadius: const BorderRadius.all(
child: Hero( Radius.circular(50),
tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString()!, ),
transitionOnUserGestures: true, child: Hero(
child: Image.network( tag: "ItemImage" + data.getOffersList[index].rowID!,
data.getOffersList[index].logo!, transitionOnUserGestures: true,
fit: BoxFit.contain, child: Image.network(
), data.getOffersList[index].bannerImage!,
fit: BoxFit.contain,
), ),
), ),
), ),
4.height, ),
Expanded( 4.height,
child: AppState().isArabic(context) Expanded(
? data.getOffersList[index].titleAr!.toText12(isCenter: true, maxLine: 1) child: AppState().isArabic(context)
: data.getOffersList[index].titleEn!.toText12(isCenter: true, maxLine: 1), ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1)
), : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1),
], ),
), ],
), ),
); ),
}, );
separatorBuilder: (BuildContext cxt, int index) => 8.width, },
itemCount: 9), separatorBuilder: (BuildContext cxt, int index) => 8.width,
); itemCount: 6),
}, );
), },
], ),
), ],
), ),
Container( Container(
width: double.infinity, width: double.infinity,
@ -545,9 +434,10 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (env.marathon)
context.watch<MarathonProvider>().isLoading ? const MarathonBannerShimmer().paddingAll(20) : const MarathonBanner().paddingOnly(left: 21, right: 21, bottom: 21, top: 8),
ServicesWidget(), ServicesWidget(),
context.watch<MarathonProvider>().isLoading
? const MarathonBannerShimmer().paddingAll(20)
: MarathonBanner(isMarathonUpcoming: context.watch<MarathonProvider>().isUpComingMarathon).paddingOnly(left: 21, right: 21, bottom: 21, top: 8),
], ],
), ),
), ),
@ -561,116 +451,108 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
drawer: SafeArea( drawer: SafeArea(
child: AppDrawer(onLanguageChange: _onRefresh), child: AppDrawer(onLanguageChange: _onRefresh),
), ),
bottomNavigationBar: !env.bottomBar bottomNavigationBar: SizedBox(
? null height: Platform.isAndroid ? 70 : 100,
: SizedBox( child: BottomNavigationBar(
height: Platform.isAndroid ? 70 : 100, items: <BottomNavigationBarItem>[
child: BottomNavigationBar( BottomNavigationBarItem(
items: <BottomNavigationBarItem>[ icon: SvgPicture.asset(
BottomNavigationBarItem( "assets/icons/home.svg",
icon: SvgPicture.asset( color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color,
"assets/icons/home.svg", ).paddingAll(4),
color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color, label: LocaleKeys.home.tr(),
).paddingAll(4), ),
label: LocaleKeys.home.tr(), BottomNavigationBarItem(
), icon: SvgPicture.asset(
BottomNavigationBarItem( "assets/icons/create_req.svg",
icon: SvgPicture.asset( color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color,
"assets/icons/create_req.svg", ).paddingAll(4),
color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color, label: LocaleKeys.createRequest.tr(),
).paddingAll(4), ),
label: LocaleKeys.mowadhafhiRequest.tr(), BottomNavigationBarItem(
), icon: Stack(
BottomNavigationBarItem( alignment: Alignment.centerLeft,
icon: Stack( children: [
alignment: Alignment.centerLeft, SvgPicture.asset(
children: [ "assets/icons/work_list.svg",
SvgPicture.asset( color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color,
"assets/icons/work_list.svg", ).paddingAll(4),
color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color, Consumer<DashboardProviderModel>(
).paddingAll(4), builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) {
Consumer<DashboardProviderModel>( if (data.workListCounter == 0) {
builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) { return const SizedBox();
if (data.workListCounter == 0) { }
return const SizedBox(); return Positioned(
} right: 0,
return Positioned( top: 0,
right: 0, child: Container(
top: 0, padding: const EdgeInsets.only(left: 4, right: 4),
child: Container( alignment: Alignment.center,
padding: const EdgeInsets.only(left: 4, right: 4), decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)),
alignment: Alignment.center, child: data.workListCounter.toString().toText10(color: Colors.white),
decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)),
child: data.workListCounter.toString().toText10(color: Colors.white),
),
);
},
), ),
], );
), },
label: LocaleKeys.workList.tr(),
),
BottomNavigationBarItem(
icon: SvgPicture.asset(
"assets/icons/item_for_sale.svg",
color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color,
).paddingAll(4),
label: LocaleKeys.itemsForSale.tr(),
), ),
BottomNavigationBarItem( ],
icon: Stack( ),
alignment: Alignment.centerLeft, label: LocaleKeys.workList.tr(),
children: [ ),
SvgPicture.asset( BottomNavigationBarItem(
"assets/icons/chat/chat.svg", icon: SvgPicture.asset(
color: currentIndex == 4 "assets/icons/item_for_sale.svg",
? MyColors.grey3AColor color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color,
: cProvider.disbaleChatForThisUser ).paddingAll(4),
? MyColors.lightGreyE3Color label: LocaleKeys.itemsForSale.tr(),
: MyColors.grey98Color, ),
).paddingAll(4), BottomNavigationBarItem(
Consumer<ChatProviderModel>( icon: Stack(
builder: (BuildContext cxt, ChatProviderModel data, Widget? child) { alignment: Alignment.centerLeft,
return Positioned( children: [
right: 0, SvgPicture.asset(
top: 0, "assets/icons/chat/chat.svg",
child: Container( color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color,
padding: const EdgeInsets.only(left: 4, right: 4), ).paddingAll(4),
alignment: Alignment.center, Consumer<ChatProviderModel>(
decoration: BoxDecoration(color: cProvider.disbaleChatForThisUser ? MyColors.pinkDarkColor : MyColors.redColor, borderRadius: BorderRadius.circular(17)), builder: (BuildContext cxt, ChatProviderModel data, Widget? child) {
child: data.chatUConvCounter.toString().toText10(color: Colors.white), return Positioned(
), right: 0,
); top: 0,
}, child: Container(
padding: const EdgeInsets.only(left: 4, right: 4),
alignment: Alignment.center,
decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)),
child: data.chatUConvCounter.toString().toText10(color: Colors.white),
), ),
], );
), },
label: LocaleKeys.chat.tr(),
), ),
], ],
currentIndex: currentIndex,
selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600),
unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600),
type: BottomNavigationBarType.fixed,
selectedItemColor: MyColors.grey3AColor,
backgroundColor: MyColors.backgroundColor,
selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28),
unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28),
onTap: (int index) {
if (index == 1) {
Navigator.pushNamed(context, AppRoutes.mowadhafhi);
} else if (index == 2) {
Navigator.pushNamed(context, AppRoutes.workList);
} else if (index == 3) {
Navigator.pushNamed(context, AppRoutes.itemsForSale);
} else if (index == 4) {
if (!cProvider.disbaleChatForThisUser) {
Navigator.pushNamed(context, AppRoutes.chat);
}
}
},
), ),
label: LocaleKeys.chat.tr(),
), ),
],
currentIndex: currentIndex,
selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600),
unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600),
type: BottomNavigationBarType.fixed,
selectedItemColor: MyColors.grey3AColor,
backgroundColor: MyColors.backgroundColor,
selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28),
unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28),
onTap: (int index) {
if (index == 1) {
Navigator.pushNamed(context, AppRoutes.mowadhafhi);
} else if (index == 2) {
Navigator.pushNamed(context, AppRoutes.workList);
} else if (index == 3) {
Navigator.pushNamed(context, AppRoutes.itemsForSale);
} else if (index == 4) {
Navigator.pushNamed(context, AppRoutes.chat);
}
},
),
),
); );
} }
@ -683,7 +565,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
data.getOffersList.forEach((OffersListModel element) { data.getOffersList.forEach((OffersListModel element) {
if (counter <= 4) { if (counter <= 4) {
if (element.offersDiscountId != offersListModelObj.offersDiscountId) { if (element.rowID != offersListModelObj.rowID) {
getOffersDetailList.add(element); getOffersDetailList.add(element);
counter++; counter++;
} }

@ -1,594 +0,0 @@
// import 'dart:async';
// import 'dart:io';
//
// import 'dart:ui' as ui;
// import 'package:easy_localization/easy_localization.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
// import 'package:flutter_svg/flutter_svg.dart';
// import 'package:mohem_flutter_app/app_state/app_state.dart';
// import 'package:mohem_flutter_app/classes/colors.dart';
// import 'package:mohem_flutter_app/classes/utils.dart';
// import 'package:mohem_flutter_app/config/env.dart';
// import 'package:mohem_flutter_app/config/routes.dart';
// import 'package:mohem_flutter_app/extensions/int_extensions.dart';
// import 'package:mohem_flutter_app/extensions/string_extensions.dart';
// import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
// import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
// import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart';
// import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
// import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
// import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart';
// import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart';
// import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart';
// import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
// import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_banner.dart';
// import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
// import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart';
// import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
// import 'package:mohem_flutter_app/widgets/shimmer/offers_shimmer_widget.dart';
// import 'package:provider/provider.dart';
// import 'package:pull_to_refresh/pull_to_refresh.dart';
// import 'package:signalr_netcore/signalr_client.dart';
//
// late HubConnection chatHubConnection;
//
// class DashboardScreen extends StatefulWidget {
// DashboardScreen({Key? key}) : super(key: key);
//
// @override
// _DashboardScreenState createState() {
// return _DashboardScreenState();
// }
// }
//
// class _DashboardScreenState extends State<DashboardScreen> {
// late DashboardProviderModel data;
// late MarathonProvider marathonProvider;
// late ChatProviderModel cProvider;
// final GlobalKey<ScaffoldState> _scaffoldState = GlobalKey();
//
// final RefreshController _refreshController = RefreshController(initialRefresh: false);
//
// int currentIndex = 0;
//
// @override
// void initState() {
// super.initState();
// scheduleMicrotask(() {
// data = Provider.of<DashboardProviderModel>(context, listen: false);
// if (env["marathon"]) {
// marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
// }
// if (env["chat"]) {
// cProvider = Provider.of<ChatProviderModel>(context, listen: false);
// }
// _onRefresh();
// });
// }
//
// @override
// void dispose() {
// super.dispose();
// chatHubConnection.stop();
// }
//
// void _bHubCon() {
// cProvider.getUserAutoLoginToken().whenComplete(() {
// cProvider.buildHubConnection();
// Future.delayed(const Duration(seconds: 2), () {
// cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
// });
// });
// }
//
// void _onRefresh() async {
// data.initProvider();
// if (env["chat"]) {
// _bHubCon();
// }
// // data.getITGNotification().then((value) {
// // print("--------------------detail_1-----------------");
// // print(value!.result!.data!.notificationMasterId);
// // print(value.result!.data!.notificationTitle);
// // });
// data.fetchListMenu();
// if (env["dashboard"]["attendance"]) {
// data.fetchAttendanceTracking(context);
// }
// data.fetchWorkListCounter(context);
// if (env["dashboard"]["missingSwipe"]) {
// data.fetchMissingSwipe(context);
// }
// data.fetchLeaveTicketBalance(context, DateTime.now());
// data.fetchMenuEntries();
// data.getCategoryOffersListAPI(context);
// if (env["marathon"]) {
// marathonProvider.getMarathonDetailsFromApi();
// }
// _refreshController.refreshCompleted();
// }
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// key: _scaffoldState,
// // appBar: AppBar(
// // actions: [
// // IconButton(
// // onPressed: () {
// // data.getITGNotification().then((val) {
// // if (val!.result!.data != null) {
// // print("-------------------- Survey ----------------------------");
// // if (val.result!.data!.notificationType == "Survey") {
// // Navigator.pushNamed(context, AppRoutes.survey, arguments: val.result!.data);
// // } else {
// // print("------------------------------------------- Ads --------------------");
// // DashboardApiClient().getAdvertisementDetail(val.result!.data!.notificationMasterId ?? "").then(
// // (value) {
// // if (value!.mohemmItgResponseItem!.statusCode == 200) {
// // if (value.mohemmItgResponseItem!.result!.data != null) {
// // Navigator.pushNamed(context, AppRoutes.advertisement, arguments: {
// // "masterId": val.result!.data!.notificationMasterId,
// // "advertisement": value.mohemmItgResponseItem!.result!.data!.advertisement,
// // });
// //
// // // Navigator.push(
// // // context,
// // // MaterialPageRoute(
// // // builder: (BuildContext context) => ITGAdsScreen(
// // // addMasterId: val.result!.data!.notificationMasterId!,
// // // advertisement: value.mohemmItgResponseItem!.result!.data!.advertisement!,
// // // ),
// // // ),
// // // );
// // }
// // }
// // },
// // );
// // }
// // }
// // });
// // },
// // icon: Icon(Icons.add))
// // ],
// // ),
// body: Column(
// children: [
// Row(
// children: [
// Builder(builder: (BuildContext context) {
// return Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image.memory(
// Utils.dataFromBase64String(
// AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
// ),
// errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) {
// return SvgPicture.asset(
// "assets/images/user.svg",
// height: 34,
// width: 34,
// );
// },
// width: 34,
// height: 34,
// fit: BoxFit.cover,
// ).circle(50),
// // CircularAvatar(
// // width: 34,
// // height: 34,
// // url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png",
// // ),
// 8.width,
// SvgPicture.asset("assets/images/side_nav.svg"),
// ],
// ).onPress(() {
// _scaffoldState.currentState!.openDrawer();
// });
// }),
// Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded,
// SvgPicture.asset(
// "assets/images/announcements.svg",
// matchTextDirection: true,
// ).onPress(
// () async {
// await Navigator.pushNamed(context, AppRoutes.announcements);
// },
// )
// ],
// ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7),
// Expanded(
// child: SmartRefresher(
// enablePullDown: true,
// enablePullUp: false,
// header: const MaterialClassicHeader(
// color: MyColors.gradiantEndColor,
// ),
// controller: _refreshController,
// onRefresh: _onRefresh,
// child: SingleChildScrollView(
// child: Column(
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color),
// (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true),
// 16.height,
// Row(
// children: [
// if (env["dashboard"]["attendance"])
// Expanded(
// child: AspectRatio(
// aspectRatio: 159 / 159,
// child: Consumer<DashboardProviderModel>(
// builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
// return (model.isAttendanceTrackingLoading
// ? GetAttendanceTrackingShimmer()
// : Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(15),
// gradient: const LinearGradient(
// transform: GradientRotation(.46),
// begin: Alignment.topRight,
// end: Alignment.bottomLeft,
// colors: [
// MyColors.gradiantEndColor,
// MyColors.gradiantStartColor,
// ],
// ),
// ),
// child: Stack(
// alignment: Alignment.center,
// children: [
// if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Expanded(
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true),
// if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white),
// if (model.isTimeRemainingInSeconds != 0)
// Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// 9.height,
// Directionality(
// textDirection: ui.TextDirection.ltr,
// child: CountdownTimer(
// endTime: model.endTime,
// onEnd: null,
// endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
// textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold),
// ),
// ),
// LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white),
// 9.height,
// ClipRRect(
// borderRadius: const BorderRadius.all(Radius.circular(20)),
// child: LinearProgressIndicator(
// value: model.progress,
// minHeight: 8,
// valueColor: const AlwaysStoppedAnimation<Color>(Colors.white),
// backgroundColor: const Color(0xff196D73),
// ),
// ),
// ],
// ),
// ],
// ).paddingOnly(top: 12, right: 15, left: 12),
// ),
// Row(
// children: [
// Expanded(
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// LocaleKeys.checkIn.tr().toText12(color: Colors.white),
// (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn)
// .toString()
// .toText14(color: Colors.white, isBold: true),
// 4.height,
// ],
// ).paddingOnly(left: 12, right: 12),
// ),
// Container(
// margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
// width: 45,
// height: 45,
// padding: const EdgeInsets.only(left: 10, right: 10),
// decoration: BoxDecoration(
// color: Color(0xff259EA4),
// borderRadius: BorderRadius.only(
// bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15),
// bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0),
// ),
// ),
// child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/attendance.svg" : "assets/images/attendance.svg"),
// ).onPress(() {
// showMyBottomSheet(
// context,
// callBackFunc: () {},
// child: MarkAttendanceWidget(model, isFromDashboard: true),
// );
// }),
// ],
// ),
// ],
// ),
// ],
// ),
// ).onPress(
// () {
// Navigator.pushNamed(context, AppRoutes.todayAttendance);
// },
// ))
// .animatedSwither();
// },
// ),
// ),
// ),
// if (env["dashboard"]["attendance"]) 9.width,
// Expanded(
// child: MenusWidget(),
// ),
// ],
// ),
// ],
// ).paddingOnly(left: 21, right: 21, top: 7),
// if (env["marathon"])
// context.watch<MarathonProvider>().isLoading
// ? const MarathonBannerShimmer().paddingAll(20)
// : MarathonBanner(isMarathonUpcoming: context.watch<MarathonProvider>().isUpComingMarathon).paddingAll(20),
// ServicesWidget(),
// 8.height,
// if (env["offersDiscount"])
// Container(
// width: double.infinity,
// padding: const EdgeInsets.only(top: 31),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)),
// border: Border.all(color: MyColors.lightGreyEDColor, width: 1),
// ),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Expanded(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// LocaleKeys.offers.tr().toText12(),
// Row(
// children: [
// LocaleKeys.discounts.tr().toText24(isBold: true),
// 6.width,
// Container(
// padding: const EdgeInsets.only(left: 8, right: 8),
// decoration: BoxDecoration(
// color: MyColors.yellowColor,
// borderRadius: BorderRadius.circular(10),
// ),
// child: LocaleKeys.newString.tr().toText10(isBold: true)),
// ],
// ),
// ],
// ),
// ),
// LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() {
// Navigator.pushNamed(context, AppRoutes.offersAndDiscounts);
// })
// ],
// ).paddingOnly(left: 21, right: 21),
// Consumer<DashboardProviderModel>(
// builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
// return SizedBox(
// height: 103 + 33,
// child: ListView.separated(
// shrinkWrap: true,
// physics: const BouncingScrollPhysics(),
// padding: const EdgeInsets.only(left: 21, right: 21, top: 13),
// scrollDirection: Axis.horizontal,
// itemBuilder: (BuildContext cxt, int index) {
// return model.isOffersLoading
// ? const OffersShimmerWidget()
// : InkWell(
// onTap: () {
// navigateToDetails(data.getOffersList[index]);
// },
// child: SizedBox(
// width: 73,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Container(
// width: 73,
// height: 73,
// decoration: BoxDecoration(
// borderRadius: const BorderRadius.all(
// Radius.circular(100),
// ),
// border: Border.all(color: MyColors.lightGreyE3Color, width: 1),
// ),
// child: ClipRRect(
// borderRadius: const BorderRadius.all(
// Radius.circular(50),
// ),
// child: Hero(
// tag: "ItemImage" + data.getOffersList[index].rowID!,
// transitionOnUserGestures: true,
// child: Image.network(
// data.getOffersList[index].bannerImage!,
// fit: BoxFit.contain,
// ),
// ),
// ),
// ),
// 4.height,
// Expanded(
// child: AppState().isArabic(context)
// ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1)
// : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1),
// ),
// ],
// ),
// ),
// );
// },
// separatorBuilder: (BuildContext cxt, int index) => 8.width,
// itemCount: 6),
// );
// },
// ),
// ],
// ),
// )
// ],
// ),
// ),
// ),
// )
// ],
// ),
// drawer: SafeArea(
// child: AppDrawer(onLanguageChange: _onRefresh),
// ),
// bottomNavigationBar: !env["bottomBar"]
// ? null
// : SizedBox(
// height: Platform.isAndroid ? 70 : 100,
// child: BottomNavigationBar(
// items: <BottomNavigationBarItem>[
// BottomNavigationBarItem(
// icon: SvgPicture.asset(
// "assets/icons/home.svg",
// color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color,
// ).paddingAll(4),
// label: LocaleKeys.home.tr(),
// ),
// BottomNavigationBarItem(
// icon: SvgPicture.asset(
// "assets/icons/create_req.svg",
// color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color,
// ).paddingAll(4),
// label: LocaleKeys.createRequest.tr(),
// ),
// BottomNavigationBarItem(
// icon: Stack(
// alignment: Alignment.centerLeft,
// children: [
// SvgPicture.asset(
// "assets/icons/work_list.svg",
// color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color,
// ).paddingAll(4),
// Consumer<DashboardProviderModel>(
// builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) {
// if (data.workListCounter == 0) {
// return const SizedBox();
// }
// return Positioned(
// right: 0,
// top: 0,
// child: Container(
// padding: const EdgeInsets.only(left: 4, right: 4),
// alignment: Alignment.center,
// decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)),
// child: data.workListCounter.toString().toText10(color: Colors.white),
// ),
// );
// },
// ),
// ],
// ),
// label: LocaleKeys.workList.tr(),
// ),
// BottomNavigationBarItem(
// icon: SvgPicture.asset(
// "assets/icons/item_for_sale.svg",
// color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color,
// ).paddingAll(4),
// label: LocaleKeys.itemsForSale.tr(),
// ),
// BottomNavigationBarItem(
// icon: Stack(
// alignment: Alignment.centerLeft,
// children: [
// SvgPicture.asset(
// "assets/icons/chat/chat.svg",
// color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color,
// ).paddingAll(4),
// Consumer<ChatProviderModel>(
// builder: (BuildContext cxt, ChatProviderModel data, Widget? child) {
// return Positioned(
// right: 0,
// top: 0,
// child: Container(
// padding: const EdgeInsets.only(left: 4, right: 4),
// alignment: Alignment.center,
// decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)),
// child: data.chatUConvCounter.toString().toText10(color: Colors.white),
// ),
// );
// },
// ),
// ],
// ),
// label: LocaleKeys.chat.tr(),
// ),
// ],
// currentIndex: currentIndex,
// selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600),
// unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600),
// type: BottomNavigationBarType.fixed,
// selectedItemColor: MyColors.grey3AColor,
// backgroundColor: MyColors.backgroundColor,
// selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28),
// unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28),
// onTap: (int index) {
// if (index == 1) {
// Navigator.pushNamed(context, AppRoutes.mowadhafhi);
// } else if (index == 2) {
// Navigator.pushNamed(context, AppRoutes.workList);
// } else if (index == 3) {
// Navigator.pushNamed(context, AppRoutes.itemsForSale);
// } else if (index == 4) {
// Navigator.pushNamed(context, AppRoutes.chat);
// }
// },
// ),
// ),
// );
// }
//
// void navigateToDetails(OffersListModel offersListModelObj) {
// List<OffersListModel> getOffersDetailList = [];
// getOffersDetailList.clear();
// int counter = 1;
//
// getOffersDetailList.add(offersListModelObj);
//
// for (OffersListModel element in data.getOffersList) {
// if (counter <= 4) {
// if (element.rowID != offersListModelObj.rowID) {
// getOffersDetailList.add(element);
// counter++;
// }
// }
// }
//
// Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList);
// }
// }

@ -50,23 +50,23 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen2> {
icon: const Icon(Icons.arrow_back_ios, color: Colors.white), icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
), ),
// actions: [ actions: [
// IconButton( IconButton(
// onPressed: () { onPressed: () {
// data.fetchAttendanceTracking(context); data.fetchAttendanceTracking(context);
// }, },
// icon: const Icon( icon: const Icon(
// Icons.ac_unit, Icons.ac_unit,
// color: Colors.white, color: Colors.white,
// ), ),
// ) )
// ], ],
), ),
backgroundColor: MyColors.backgroundBlackColor, backgroundColor: MyColors.backgroundBlackColor,
body: Consumer<DashboardProviderModel>( body: Consumer<DashboardProviderModel>(
builder: (context, model, child) { builder: (context, model, child) {
return (model.isAttendanceTrackingLoading return (model.isAttendanceTrackingLoading
? const Center(child: CircularProgressIndicator()) ? Center(child: CircularProgressIndicator())
: Column( : Column(
children: [ children: [
Container( Container(

@ -5,7 +5,6 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -30,14 +29,12 @@ class AppDrawer extends StatefulWidget {
class _AppDrawerState extends State<AppDrawer> { class _AppDrawerState extends State<AppDrawer> {
List<DrawerMenuItem> drawerMenuItemList = []; List<DrawerMenuItem> drawerMenuItemList = [];
ChatProviderModel? chatData; late ChatProviderModel chatData;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (env.chat) { chatData = Provider.of<ChatProviderModel>(context, listen: false);
chatData = Provider.of<ChatProviderModel>(context, listen: false);
}
} }
@override @override
@ -51,9 +48,9 @@ class _AppDrawerState extends State<AppDrawer> {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
// Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 24), Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 24),
const Icon(Icons.clear).onPress(() => Navigator.pop(context)), const Icon(Icons.clear).onPress(() => Navigator.pop(context)),
], ],
).paddingOnly(left: 4, right: 14), ).paddingOnly(left: 4, right: 14),
@ -120,37 +117,29 @@ class _AppDrawerState extends State<AppDrawer> {
Navigator.pushNamed(context, drawerMenuItemList[index].routeName); Navigator.pushNamed(context, drawerMenuItemList[index].routeName);
}); });
}), }),
// menuItem("assets/images/drawer/employee_id.svg", LocaleKeys.employeeDigitalID.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: EmployeeDigitialIdDialog())), menuItem("assets/images/drawer/employee_id.svg", LocaleKeys.employeeDigitalID.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: EmployeeDigitialIdDialog())),
// if (AppState().businessCardPrivilege) if (AppState().businessCardPrivilege)
// menuItem("assets/images/drawer/view_business_card.svg", LocaleKeys.viewBusinessCard.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: BusinessCardDialog())), menuItem("assets/images/drawer/view_business_card.svg", LocaleKeys.viewBusinessCard.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: BusinessCardDialog())),
//
menuItem("assets/images/drawer/help.png", LocaleKeys.help.tr(), "", closeDrawer: true, onPress: () {
Navigator.pushNamed(context, AppRoutes.help);
}),
menuItem("assets/images/drawer/hierarchy.png", LocaleKeys.hierarchy.tr(), "", closeDrawer: true, onPress: () {
Navigator.pushNamed(context, AppRoutes.hierarchy);
}),
menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: performLogout), menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: performLogout),
// menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: () {Navigator.pushNamed(context, AppRoutes.survey,); // menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: () {Navigator.pushNamed(context, AppRoutes.survey,);
], ],
).expanded, ).expanded,
// const Divider( const Divider(
// height: 1, height: 1,
// thickness: 1, thickness: 1,
// color: MyColors.lightGreyEFColor, color: MyColors.lightGreyEFColor,
// ), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
// RichText( RichText(
// text: TextSpan(text: LocaleKeys.poweredBy.tr() + " ", style: const TextStyle(color: MyColors.grey98Color, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600), children: [ text: TextSpan(text: LocaleKeys.poweredBy.tr() + " ", style: const TextStyle(color: MyColors.grey98Color, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600), children: [
// TextSpan( TextSpan(
// text: LocaleKeys.cloudSolutions.tr(), text: LocaleKeys.cloudSolutions.tr(),
// style: const TextStyle(color: MyColors.grey3AColor, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600), style: const TextStyle(color: MyColors.grey3AColor, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600),
// ), ),
// ]), ]),
// ).expanded, ).expanded,
Image.asset("assets/images/drawer/moe_logo.png", width: 60, height: 60) Image.asset("assets/images/logos/bn_cloud_soloution.jpg", width: 40, height: 40)
], ],
).paddingOnly(left: 21, right: 21, top: 21) ).paddingOnly(left: 21, right: 21, top: 21)
], ],
@ -161,8 +150,7 @@ class _AppDrawerState extends State<AppDrawer> {
Widget menuItem(String icon, String title, String routeName, {Color? color, bool closeDrawer = true, VoidCallback? onPress}) { Widget menuItem(String icon, String title, String routeName, {Color? color, bool closeDrawer = true, VoidCallback? onPress}) {
return Row( return Row(
children: [ children: [
if (icon.contains("png")) Image.asset(icon, height: 20, width: 20), SvgPicture.asset(icon, height: 20, width: 20),
if (icon.contains("svg")) SvgPicture.asset(icon, height: 20, width: 20),
9.width, 9.width,
title.toText14(color: color, textAlign: AppState().isArabic(context) ? TextAlign.right : null).expanded, title.toText14(color: color, textAlign: AppState().isArabic(context) ? TextAlign.right : null).expanded,
], ],
@ -187,7 +175,7 @@ class _AppDrawerState extends State<AppDrawer> {
AppState().isAuthenticated = false; AppState().isAuthenticated = false;
AppState().isLogged = false; AppState().isLogged = false;
AppState().setPostParamsInitConfig(); AppState().setPostParamsInitConfig();
chatData?.disposeData(); chatData.disposeData();
// SharedPreferences prefs = await SharedPreferences.getInstance(); // SharedPreferences prefs = await SharedPreferences.getInstance();
// await prefs.clear(); // await prefs.clear();
Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route<dynamic> route) => false, arguments: null); Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route<dynamic> route) => false, arguments: null);

@ -2,14 +2,12 @@ import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/ui/screens/my_requests/new_request.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -21,7 +19,7 @@ class MenusWidget extends StatelessWidget {
return Consumer<DashboardProviderModel>( return Consumer<DashboardProviderModel>(
builder: (cxt, data, child) { builder: (cxt, data, child) {
return GridView( return GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.75, crossAxisSpacing: 9, mainAxisSpacing: 9), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
shrinkWrap: true, shrinkWrap: true,
primary: false, primary: false,
@ -54,52 +52,24 @@ class MenusWidget extends StatelessWidget {
).onPress(() { ).onPress(() {
Navigator.pushNamed(context, AppRoutes.workList); Navigator.pushNamed(context, AppRoutes.workList);
}), }),
if (env.dashboard.missingSwipe) data.isMissingSwipeLoading
data.isMissingSwipeLoading
? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context);
})
: Container(
decoration: BoxDecoration(
color: Color(namesColor[1]),
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.missingSwipes.tr().toText12(color: Colors.white),
Row(
children: [
Expanded(
child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
],
)
],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS"));
}),
data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() { ? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context); data.fetchWorkListCounter(context);
}) })
: Container( : Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(namesColor[2]), color: Color(namesColor[1]),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.leaveBalance.tr().toText12(color: Colors.white), LocaleKeys.missingSwipes.tr().toText12(color: Colors.white),
Row( Row(
children: [ children: [
Expanded( Expanded(
child: (data.leaveBalance)!.toStringAsFixed(0).toText16(color: Colors.white, isBold: true, maxlines: 1), child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
), ),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
], ],
@ -107,7 +77,7 @@ class MenusWidget extends StatelessWidget {
], ],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(() { ).onPress(() {
Navigator.pushNamed(context, AppRoutes.leaveBalance); Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS"));
}), }),
data.isLeaveTicketBalanceLoading data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() { ? MenuShimmer().onPress(() {
@ -122,11 +92,11 @@ class MenusWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.businessTripBalance.tr().toText12(color: Colors.white), LocaleKeys.leaveBalance.tr().toText12(color: Colors.white),
Row( Row(
children: [ children: [
Expanded( Expanded(
child: data.businessTrip.toStringAsFixed(0).toText16(color: Colors.white, isBold: true, maxlines: 1), child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
), ),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
], ],
@ -134,44 +104,11 @@ class MenusWidget extends StatelessWidget {
], ],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(() { ).onPress(() {
//Navigator.pushNamed(context, AppRoutes.leaveBalance); Navigator.pushNamed(context, AppRoutes.leaveBalance);
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.business_mission.tr(), "XXX_HR_EIT_BUSINESS_MISSION_SS"));
}), }),
if (env.dashboard.ticketBalance) data.isLeaveTicketBalanceLoading
data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context);
})
: Container(
decoration: BoxDecoration(
color: Color(namesColor[3]),
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.ticketBalance.tr().toText12(color: Colors.white),
Row(
children: [
Expanded(
child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
],
)
],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(
() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
},
),
data.isMyRequestLoading
? MenuShimmer().onPress(() { ? MenuShimmer().onPress(() {
data.fetchListMenu(); data.fetchWorkListCounter(context);
}) })
: Container( : Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -182,13 +119,12 @@ class MenusWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.myRequest.tr().toText12(color: Colors.white), LocaleKeys.ticketBalance.tr().toText12(color: Colors.white),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
// Expanded( Expanded(
// child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
// ), ),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
], ],
) )
@ -196,7 +132,7 @@ class MenusWidget extends StatelessWidget {
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress( ).onPress(
() { () {
Navigator.pushNamed(context, AppRoutes.myRequests, arguments: NewRequestModel(groupID: data.myRequest!.requestGroupId)); Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
}, },
) )
], ],

@ -1,5 +1,3 @@
import 'dart:convert';
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
@ -13,7 +11,6 @@ import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart';
import 'package:mohem_flutter_app/ui/screens/my_requests/new_request.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -33,7 +30,7 @@ class ServicesWidget extends StatelessWidget {
]; ];
return Consumer<DashboardProviderModel>( return Consumer<DashboardProviderModel>(
builder: (BuildContext context, DashboardProviderModel data, Widget? child) { builder: (context, data, child) {
return data.isServicesMenusLoading return data.isServicesMenusLoading
? whileLoading() ? whileLoading()
: ListView.separated( : ListView.separated(
@ -72,15 +69,12 @@ class ServicesWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.memory( SvgPicture.asset(AppState().isArabic(context) ? getMenuIconAr(data.homeMenus![parentIndex].menuEntiesList[index].prompt!) : getMenuIconEn(data.homeMenus![parentIndex].menuEntiesList[index].prompt!)),
const Base64Decoder().convert(data.homeMenus![parentIndex].menuEntiesList[index].icon ?? ""),
scale: 1.25,
),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Expanded( Expanded(
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText10(isBold: true), child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true),
), ),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)),
], ],
@ -92,13 +86,13 @@ class ServicesWidget extends StatelessWidget {
}), }),
); );
}, },
separatorBuilder: (BuildContext cxt, int index) => 9.width, separatorBuilder: (cxt, index) => 9.width,
itemCount: data.homeMenus![parentIndex].menuEntiesList.length), itemCount: data.homeMenus![parentIndex].menuEntiesList.length),
), ),
], ],
); );
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (context, index) {
return 12.height; return 12.height;
}, },
shrinkWrap: true, shrinkWrap: true,
@ -195,25 +189,8 @@ class ServicesWidget extends StatelessWidget {
} }
void handleOnPress(context, GetMenuEntriesList menuEntry) { void handleOnPress(context, GetMenuEntriesList menuEntry) {
print(menuEntry.requestType);
var pro = Provider.of<DashboardProviderModel>(context, listen: false); var pro = Provider.of<DashboardProviderModel>(context, listen: false);
// if (menuEntry.requestType == "PMS") { if (menuEntry.requestType == "MONTHLY_ATTENDANCE") {
// Navigator.pushNamed(context, AppRoutes.newRequest, arguments: NewRequestModel(functionName: menuEntry.functionName, prompt: menuEntry.prompt));
// } else
if (menuEntry.requestType == "CCP") {
Navigator.pushNamed(context, AppRoutes.newRequest, arguments: NewRequestModel(functionName: menuEntry.functionName, prompt: menuEntry.prompt));
} else if (menuEntry.requestType == "PAR") {
Navigator.pushNamed(context, AppRoutes.performanceEvaluation);
} else if (menuEntry.requestType == "BASIC_DETAILS") {
Navigator.pushNamed(context, AppRoutes.basicDetails);
return;
} else if (menuEntry.requestType == "PHONE_NUMBERS") {
Navigator.pushNamed(context, AppRoutes.contactDetails);
return;
} else if (menuEntry.requestType == "ADDRESS") {
Navigator.pushNamed(context, AppRoutes.contactDetails);
return;
} else if (menuEntry.requestType == "MONTHLY_ATTENDANCE") {
Navigator.pushNamed(context, AppRoutes.monthlyAttendance); Navigator.pushNamed(context, AppRoutes.monthlyAttendance);
return; return;
} else if (menuEntry.requestType == "VACATION_RULE") { } else if (menuEntry.requestType == "VACATION_RULE") {
@ -225,7 +202,6 @@ class ServicesWidget extends StatelessWidget {
} }
List<GetMenuEntriesList> menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION")).toList() ?? []; List<GetMenuEntriesList> menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION")).toList() ?? [];
menuEntry.icon = ""; menuEntry.icon = "";
menuList = [];
if (menuList.isEmpty) { if (menuList.isEmpty) {
if (menuEntry.requestType == "EIT") { if (menuEntry.requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!)); Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!));
@ -265,13 +241,13 @@ class ServicesWidget extends StatelessWidget {
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext cxt, int index) { itemBuilder: (cxt, index) {
return AspectRatio( return AspectRatio(
aspectRatio: 105 / 105, aspectRatio: 105 / 105,
child: ServicesMenuShimmer(), child: ServicesMenuShimmer(),
); );
}, },
separatorBuilder: (BuildContext cxt, int index) => 9.width, separatorBuilder: (cxt, index) => 9.width,
itemCount: 4, itemCount: 4,
), ),
), ),

@ -4,7 +4,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
@ -142,13 +141,12 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
empID: selectedID); empID: selectedID);
Utils.hideLoading(context); Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance", selectedEmployeeID: selectedID));
if (!AppState().cancelRequestTrancsection) { var res = await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
return; arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance", selectedEmployeeID: selectedID));
if (res != null && res == true) {
Utils.showLoading(context);
} }
Utils.showLoading(context);
await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!); await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!);
Utils.hideLoading(context); Utils.hideLoading(context);
} catch (ex) { } catch (ex) {
@ -236,27 +234,27 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
}, },
), ),
12.height, 12.height,
// DynamicTextFieldWidget( DynamicTextFieldWidget(
// LocaleKeys.selectEmployee.tr(), LocaleKeys.selectEmployee.tr(),
// selectedReplacementEmployee == null ? LocaleKeys.searchForEmployee.tr() : selectedReplacementEmployee!.employeeDisplayName ?? "", selectedReplacementEmployee == null ? LocaleKeys.searchForEmployee.tr() : selectedReplacementEmployee!.employeeDisplayName ?? "",
// isEnable: false, isEnable: false,
// onTap: () { onTap: () {
// showMyBottomSheet( showMyBottomSheet(
// context, context,
// callBackFunc: () {}, callBackFunc: () {},
// child: SearchEmployeeBottomSheet( child: SearchEmployeeBottomSheet(
// title: LocaleKeys.searchForEmployee.tr(), title: LocaleKeys.searchForEmployee.tr(),
// apiMode: LocaleKeys.delegate.tr(), apiMode: LocaleKeys.delegate.tr(),
// fromChat: false, fromChat: false,
// onSelectEmployee: (_selectedEmployee) { onSelectEmployee: (_selectedEmployee) {
// // Navigator.pop(context); // Navigator.pop(context);
// selectedReplacementEmployee = _selectedEmployee; selectedReplacementEmployee = _selectedEmployee;
// setState(() {}); setState(() {});
// }, },
// ), ),
// ); );
// }, },
// ), ),
12.height, 12.height,
DynamicTextFieldWidget( DynamicTextFieldWidget(
LocaleKeys.comments.tr(), LocaleKeys.comments.tr(),
@ -313,7 +311,6 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
model.eSERVICESDV?.pIDCOLUMNNAME ?? "", model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
isReadOnly: model.rEADONLY == "Y", isReadOnly: model.rEADONLY == "Y",
isInputTypeNum: true, isInputTypeNum: true,
length: model.mAXIMUMSIZE,
onChange: (text) { onChange: (text) {
model.eSERVICESDV ??= ESERVICESDV(); model.eSERVICESDV ??= ESERVICESDV();
model.eSERVICESDV!.pIDCOLUMNNAME = text; model.eSERVICESDV!.pIDCOLUMNNAME = text;
@ -502,7 +499,6 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.eSERVICESDV?.pIDCOLUMNNAME ?? "", model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
isReadOnly: model.rEADONLY == "Y", isReadOnly: model.rEADONLY == "Y",
length: model.mAXIMUMSIZE,
onChange: (text) { onChange: (text) {
//model.fieldAnswer = text; //model.fieldAnswer = text;
}, },

@ -8,7 +8,6 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/leave_balance/get_absence_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/leave_balance/get_absence_transaction_list_model.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/balances_dashboard_widget.dart'; import 'package:mohem_flutter_app/widgets/balances_dashboard_widget.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
@ -73,7 +72,7 @@ class _LeaveBalanceState extends State<LeaveBalance> {
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
children: [ children: [
BalancesDashboardWidget(LocaleKeys.currentLeaveBalance.tr(), true, selectedEmp: employeeId, showLoading: false), BalancesDashboardWidget(LocaleKeys.currentLeaveBalance.tr(), true, selectedEmp: employeeId),
12.height, 12.height,
ListView.separated( ListView.separated(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@ -118,9 +117,7 @@ class _LeaveBalanceState extends State<LeaveBalance> {
), ),
child: const Icon(Icons.add, color: Colors.white, size: 30), child: const Icon(Icons.add, color: Colors.white, size: 30),
).onPress(() { ).onPress(() {
//Navigator.pushNamed(context, AppRoutes.addLeaveBalance, arguments: employeeId); Navigator.pushNamed(context, AppRoutes.addLeaveBalance, arguments: employeeId);
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.create_absence_request.tr(), "XXX_HR_EIT_LOA_CREATE_SS"));
}), }),
); );
} }

@ -8,14 +8,11 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:mohem_flutter_app/api/login_api_client.dart'; import 'package:mohem_flutter_app/api/login_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/notifications.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -29,7 +26,6 @@ import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/input_widget.dart'; import 'package:mohem_flutter_app/widgets/input_widget.dart';
import 'package:safe_device/safe_device.dart'; import 'package:safe_device/safe_device.dart';
import 'package:wifi_iot/wifi_iot.dart';
class LoginScreen extends StatefulWidget { class LoginScreen extends StatefulWidget {
LoginScreen({Key? key}) : super(key: key); LoginScreen({Key? key}) : super(key: key);
@ -58,12 +54,9 @@ class _LoginScreenState extends State<LoginScreen> {
bool isOnExternalStorage = false; bool isOnExternalStorage = false;
bool isDevelopmentModeEnable = false; bool isDevelopmentModeEnable = false;
late HmsApiAvailability hmsApiAvailability;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
hmsApiAvailability = HmsApiAvailability();
// checkFirebaseToken(); // checkFirebaseToken();
// if (kReleaseMode) { // if (kReleaseMode) {
// checkDeviceSafety(); // checkDeviceSafety();
@ -97,52 +90,30 @@ class _LoginScreenState extends State<LoginScreen> {
Future<void> checkFirebaseToken() async { Future<void> checkFirebaseToken() async {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
if (Platform.isAndroid) { await Firebase.initializeApp();
try { _firebaseMessaging = FirebaseMessaging.instance;
await hmsApiAvailability.isHMSAvailable().then((value) async { firebaseToken = await _firebaseMessaging.getToken();
if (value == 0) { loginInfo = await LoginApiClient().getMobileLoginInfoNEW(firebaseToken ?? "", Platform.isAndroid ? "android" : "ios");
AppState().setIsHuawei = true; if (loginInfo == null) {
AppNotifications().initHuaweiPush(checkLoginInfo); await checkPrefs();
} else { _autoLogin = false;
await Firebase.initializeApp(); Utils.hideLoading(context);
_firebaseMessaging = FirebaseMessaging.instance; return;
firebaseToken = await _firebaseMessaging.getToken();
AppNotifications().init(firebaseToken);
checkLoginInfo();
}
});
} catch (ex) {}
} else { } else {
await Firebase.initializeApp(); loginInfo!.deviceToken = firebaseToken;
_firebaseMessaging = FirebaseMessaging.instance; await checkPrefs();
firebaseToken = await _firebaseMessaging.getToken(); Utils.hideLoading(context);
AppNotifications().init(firebaseToken); performLogin();
checkLoginInfo();
} }
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, (errorMsg) {});
}
}
void checkLoginInfo() async {
loginInfo = await LoginApiClient().getMobileLoginInfoNEW(AppState().getIsHuawei ? AppState().getHuaweiPushToken : firebaseToken ?? "", Platform.isAndroid ? "android" : "ios");
if (loginInfo == null) {
await checkPrefs();
_autoLogin = false;
Utils.hideLoading(context);
return;
} else {
loginInfo!.deviceToken = firebaseToken;
await checkPrefs();
Utils.hideLoading(context);
performLogin();
} }
} }
Future<void> checkPrefs() async { Future<void> checkPrefs() async {
String username = await Utils.getStringFromPrefs(SharedPrefsConsts.username); String username = await Utils.getStringFromPrefs(SharedPrefsConsts.username);
if (username.isNotEmpty) { // for test purpose i added ! if (username.isNotEmpty) {
String password = await Utils.getStringFromPrefs(SharedPrefsConsts.password); String password = await Utils.getStringFromPrefs(SharedPrefsConsts.password);
// String firebaseToken = await Utils.getStringFromPrefs(SharedPrefsConsts.firebaseToken); // String firebaseToken = await Utils.getStringFromPrefs(SharedPrefsConsts.firebaseToken);
// print("firebaseToken:$firebaseToken"); // print("firebaseToken:$firebaseToken");
@ -152,7 +123,6 @@ class _LoginScreenState extends State<LoginScreen> {
} }
} }
void performLogin() async { void performLogin() async {
Utils.showLoading(context); Utils.showLoading(context);
try { try {
@ -186,33 +156,18 @@ class _LoginScreenState extends State<LoginScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
username.text = "1002528733";
password.text = "moe123456";
if (isAppOpenBySystem == null) { if (isAppOpenBySystem == null) {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
if (!kReleaseMode) { if (!kReleaseMode) {
// username.text = "1100313582"; // username.text = "15444"; // Maha User
// password.text = "moe123456"; // username.text = "15153"; // Tamer User
// password.text = "Abcd@1234";
username.text = "1024056812"; // username.text = "206535"; // Hashim User
password.text = "moe123456"; // password.text = "Namira786";
// 1) Normal user : // 13777
// Username: 1100313582 // Ab12345cd
// Employee # and Name: 210624 - شهد خالد ابراهيم الشامخ
// Password: moe123456
//
// 2) Normal user :
// Username: 1002528733
// Employee # and Name: 221142 - فؤاد محمدامين بكر موسى
// moe123456
//
//
// 3) HR User Account
// Username: 1087779144
// Employee # and Name: 190089 - عبدالله عبدالرحمن محمد الشهري
// Password: moe123456
} }
if (isAppOpenBySystem!) checkFirebaseToken(); if (isAppOpenBySystem!) checkFirebaseToken();
} }
@ -230,24 +185,24 @@ class _LoginScreenState extends State<LoginScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Image.asset("assets/images/drawer/moe_logo.png", width: 60, height: 60), Expanded(child: SizedBox()),
Row(
Row(children: [ children: [
LocaleKeys.english.tr().toText14(color: AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() { LocaleKeys.english.tr().toText14(color: AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
context.setLocale(const Locale("en", "US")); context.setLocale(const Locale("en", "US"));
}), }),
Container( Container(
width: 1, width: 1,
color: MyColors.darkWhiteColor, color: MyColors.darkWhiteColor,
height: 16, height: 16,
margin: const EdgeInsets.only(left: 10, right: 10), margin: const EdgeInsets.only(left: 10, right: 10),
), ),
LocaleKeys.arabic.tr().toText14(color: !AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() { LocaleKeys.arabic.tr().toText14(color: !AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
context.setLocale(const Locale("ar", "SA")); context.setLocale(const Locale("ar", "SA"));
}), }),
],) ],
),
], ],
), ),
Expanded( Expanded(
@ -263,21 +218,12 @@ class _LoginScreenState extends State<LoginScreen> {
12.height, 12.height,
InputWidget(LocaleKeys.password.tr(), "xxxxxx", password, isTextIsPassword: true), InputWidget(LocaleKeys.password.tr(), "xxxxxx", password, isTextIsPassword: true),
9.height, 9.height,
if (env.login.forgetPassword) Align(
Align( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, child: LocaleKeys.forgotPassword.tr().toText12(isUnderLine: true, color: MyColors.textMixColor).onPress(() {
child: LocaleKeys.forgotPassword.tr().toText12(isUnderLine: true, color: MyColors.textMixColor).onPress(() { Navigator.pushNamed(context, AppRoutes.forgotPassword);
Navigator.pushNamed(context, AppRoutes.forgotPassword); }),
}), ),
),
20.height,
// DefaultButton(
// "Connect HMG Network",
// () async {
// SystemChannels.textInput.invokeMethod('TextInput.hide');
// connectWithHmgNetwork();
// },
// ),
], ],
), ),
) )
@ -293,30 +239,4 @@ class _LoginScreenState extends State<LoginScreen> {
), ),
); );
} }
void connectWithHmgNetwork() async {
try {
bool isConnected = await WiFiForIoTPlugin.connect("MOHEMM-CONNECT", password: "0987654321", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false);
if (isConnected) {
await WiFiForIoTPlugin.forceWifiUsage(true);
// if (Platform.isIOS) {
// await closeWifiRequest();
// await Future.delayed(Duration(seconds: 6));
// } else {
// await WiFiForIoTPlugin.forceWifiUsage(true);
// }
}
} catch (e) {
print("----------------o----");
print(e);
}
}
Future<bool> closeWifiRequest() async {
if (Platform.isAndroid) {
await WiFiForIoTPlugin.forceWifiUsage(false);
}
return await WiFiForIoTPlugin.disconnect();
}
} }

@ -11,7 +11,6 @@ import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/dialogs/otp_dialog.dart'; import 'package:mohem_flutter_app/dialogs/otp_dialog.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
@ -21,7 +20,10 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/basic_member_information_model.dart'; import 'package:mohem_flutter_app/models/basic_member_information_model.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart'; import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart';
import 'package:mohem_flutter_app/ui/dialogs/id/business_card_dialog.dart';
import 'package:mohem_flutter_app/ui/dialogs/id/employee_digital_id_dialog.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart';
// WhatsApp 4 // WhatsApp 4
// SMS 1 // SMS 1
@ -60,54 +62,29 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
String empName = mobileLoginInfoListModel!.employeeName!; String empName = mobileLoginInfoListModel!.employeeName!;
return Scaffold( return Scaffold(
// appBar: AppBar( appBar: AppBar(
// backgroundColor: Colors.transparent,
// backgroundColor: Colors.transparent, automaticallyImplyLeading: false,
// automaticallyImplyLeading: false, title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false)
// title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false) ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
// ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { showMDialog(context, child: BusinessCardDialog());
// showMDialog(context, child: BusinessCardDialog()); })
// }) : Container(),
// : Container(), actions: [
// actions: [ Center(
// Center( child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
// child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { showMDialog(context, child: EmployeeDigitialIdDialog());
// showMDialog(context, child: EmployeeDigitialIdDialog()); })),
// })), 21.width
// 21.width ],
// ], ),
// ),
body: Column( body: Column(
children: [ children: [
ListView( ListView(
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
children: [ children: [
12.height, //12.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset("assets/images/drawer/moe_logo.png", width: 60, height: 60),
Row(
children: [
LocaleKeys.english.tr().toText14(color: AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
context.setLocale(const Locale("en", "US"));
}),
Container(
width: 1,
color: MyColors.darkWhiteColor,
height: 16,
margin: const EdgeInsets.only(left: 10, right: 10),
),
LocaleKeys.arabic.tr().toText14(color: !AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
context.setLocale(const Locale("ar", "SA"));
}),
],
)
],
),
12.height,
if (true) if (true)
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -164,7 +141,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
children: [ children: [
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3), if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3),
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4), if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4),
if (env.login.verificationMethod.whatsapp) getButton(2), getButton(2),
getButton(1), getButton(1),
], ],
) )
@ -312,7 +289,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
width: 38, width: 38,
color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
), ),
_title.toText16(height: 20 / 16, maxlines: 2), _title.toText16(height: 20/16)
], ],
), ),
), ),
@ -347,22 +324,20 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
Future<void> performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async { Future<void> performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async {
try { try {
if (isDirectLogin) { if (isDirectLogin)
setState(() { setState(() {
Utils.showLoading(context); Utils.showLoading(context);
}); });
} else { else
Utils.showLoading(context); Utils.showLoading(context);
}
await LoginApiClient().checkMobileAppVersion(); await LoginApiClient().checkMobileAppVersion();
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
if (!isDirectLogin) { if (!isDirectLogin)
BasicMemberInformationModel? memberInformationModel = BasicMemberInformationModel? memberInformationModel =
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
}
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "", null); if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "", null);
if (!isDirectLogin) Utils.hideLoading(context); if (!isDirectLogin) Utils.hideLoading(context);
if (!isDirectLogin) { if (!isDirectLogin)
OtpDialog( OtpDialog(
context, context,
sendVerificationFlat, sendVerificationFlat,
@ -378,7 +353,6 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
performApiCall(_title, _icon, _flag, sendVerificationFlat, isDirectLogin: isDirectLogin); performApiCall(_title, _icon, _flag, sendVerificationFlat, isDirectLogin: isDirectLogin);
}, },
).displayDialog(context); ).displayDialog(context);
}
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
@ -387,7 +361,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
Future<void> performDirectApiCall(String _title, String _icon, int _flag, String value, TextEditingController? _pinPutController, {bool isDirectLogin = false}) async { Future<void> performDirectApiCall(String _title, String _icon, int _flag, String value, TextEditingController? _pinPutController, {bool isDirectLogin = false}) async {
try { try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
AppState().memberLoginList?.pEMAILADDRESS ?? "", AppState().memberLoginList?.pEMAILADDRESS ?? "",
genericResponseModel?.pSESSIONID ?? 0, genericResponseModel?.pSESSIONID ?? 0,
@ -395,10 +369,9 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
_flag, _flag,
AppState().memberLoginList?.pMOBILENUMBER ?? "", AppState().memberLoginList?.pMOBILENUMBER ?? "",
AppState().getUserName!, AppState().getUserName!,
AppState().getIsHuawei ? AppState().getHuaweiPushToken : mobileLoginInfoListModel!.deviceToken!, mobileLoginInfoListModel!.deviceToken!,
Platform.isAndroid ? "android" : "ios"); Platform.isAndroid ? "android" : "ios");
AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first; AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first;
AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? [];
if (genericResponseModel.errorMessage != null) { if (genericResponseModel.errorMessage != null) {
Utils.showToast(genericResponseModel.errorMessage ?? ""); Utils.showToast(genericResponseModel.errorMessage ?? "");
// Navigator.pop(context); // Navigator.pop(context);

@ -11,9 +11,9 @@ import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/env.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/dialogs/otp_dialog.dart'; import 'package:mohem_flutter_app/dialogs/otp_dialog.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/basic_member_information_model.dart'; import 'package:mohem_flutter_app/models/basic_member_information_model.dart';
@ -78,7 +78,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
children: [ children: [
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3), if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3),
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4), if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4),
if (env.login.verificationMethod.whatsapp) getButton(2), getButton(2),
getButton(1), getButton(1),
], ],
) )
@ -572,7 +572,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
width: 38, width: 38,
color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
), ),
_title.toText16(height: 20 / 16, maxlines: 2) _title.toText16(height: 20/16)
], ],
), ),
), ),
@ -619,7 +619,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""), int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value, TextEditingController _pinPutController) async { (value, TextEditingController _pinPutController) async {
Utils.showLoading(context); Utils.showLoading(context);
try { try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
AppState().memberLoginList?.pEMAILADDRESS ?? "", AppState().memberLoginList?.pEMAILADDRESS ?? "",
@ -628,7 +628,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
_flag, _flag,
AppState().memberLoginList?.pMOBILENUMBER ?? "", AppState().memberLoginList?.pMOBILENUMBER ?? "",
AppState().getUserName!, AppState().getUserName!,
AppState().getIsHuawei ? AppState().getHuaweiPushToken : firebaseToken!, firebaseToken!,
Platform.isAndroid ? "android" : "ios"); Platform.isAndroid ? "android" : "ios");
if (genericResponseModel?.errorMessage != null) { if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? ""); Utils.showToast(genericResponseModel?.errorMessage ?? "");
@ -637,13 +637,13 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first; AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first;
MemberInformationListModel.saveToPrefs(genericResponseModel.memberInformationList ?? []); MemberInformationListModel.saveToPrefs(genericResponseModel.memberInformationList ?? []);
PrivilegeListModel.saveToPrefs(genericResponseModel.privilegeList ?? []); PrivilegeListModel.saveToPrefs(genericResponseModel.privilegeList ?? []);
// AppState().setMohemmWifiSSID = genericResponseModel.mohemmWifiSSID; AppState().setMohemmWifiSSID = genericResponseModel.mohemmWifiSSID;
// AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword; AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
// AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword; AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
Utils.saveStringFromPrefs(SharedPrefsConsts.username, AppState().getUserName!); Utils.saveStringFromPrefs(SharedPrefsConsts.username, AppState().getUserName!);
Utils.saveStringFromPrefs(SharedPrefsConsts.password, AppState().password!); Utils.saveStringFromPrefs(SharedPrefsConsts.password, AppState().password!);
// Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiSSID, genericResponseModel.mohemmWifiSSID ?? ""); Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiSSID, genericResponseModel.mohemmWifiSSID!);
// Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiPassword, genericResponseModel.mohemmWifiPassword!); Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiPassword, genericResponseModel.mohemmWifiPassword!);
} }
Utils.hideLoading(context); Utils.hideLoading(context);
Navigator.pop(context); Navigator.pop(context);

@ -23,14 +23,12 @@ class MarathonIntroScreen extends StatelessWidget {
ListView( ListView(
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
children: <Widget>[ children: <Widget>[
MarathonDetailsCard(marathonDetailModel: provider.isUpComingMarathon ? provider.marathonDetailModel : provider.demoMarathonDetailModel), MarathonDetailsCard(provider: provider),
20.height, 10.height,
provider.isUpComingMarathon MarathonTimerCard(
? MarathonTimerCard( provider: provider,
provider: provider, timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch,
timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch, ),
)
: const SizedBox(),
], ],
).expanded, ).expanded,
1.divider, 1.divider,

@ -1,10 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'dart:developer';
import 'package:appinio_swiper/appinio_swiper.dart'; import 'package:appinio_swiper/appinio_swiper.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/marathon/demo_marathon_repo.dart';
import 'package:mohem_flutter_app/api/marathon/marathon_api_client.dart'; import 'package:mohem_flutter_app/api/marathon/marathon_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
@ -18,12 +16,11 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
class MarathonProvider extends ChangeNotifier { class MarathonProvider extends ChangeNotifier {
//************************************************ VARIABLES ********************************************************** //****************VARIABLES**********
final AppinioSwiperController swiperController = AppinioSwiperController(); final AppinioSwiperController swiperController = AppinioSwiperController();
MarathonDetailModel marathonDetailModel = MarathonDetailModel(); MarathonDetailModel marathonDetailModel = MarathonDetailModel();
MarathonDetailModel demoMarathonDetailModel = MarathonDetailModel();
List<CardContent> cardContentList = <CardContent>[]; List<CardContent> cardContentList = <CardContent>[];
QuestionModel currentQuestion = QuestionModel(); QuestionModel currentQuestion = QuestionModel();
List<QuestionCardStatus> answerStatusesList = <QuestionCardStatus>[]; List<QuestionCardStatus> answerStatusesList = <QuestionCardStatus>[];
@ -56,7 +53,6 @@ class MarathonProvider extends ChangeNotifier {
set isUpComingMarathon(bool value) { set isUpComingMarathon(bool value) {
_isUpComingMarathon = value; _isUpComingMarathon = value;
notifyListeners(); notifyListeners();
} }
@ -69,15 +65,6 @@ class MarathonProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
bool _canPlayDemo = true;
bool get canPlayDemo => _canPlayDemo;
set canPlayDemo(bool value) {
_canPlayDemo = value;
notifyListeners();
}
bool _isButtonEnabled = false; bool _isButtonEnabled = false;
bool get isButtonEnabled => _isButtonEnabled; bool get isButtonEnabled => _isButtonEnabled;
@ -135,7 +122,6 @@ class MarathonProvider extends ChangeNotifier {
late VideoPlayerController videoController; late VideoPlayerController videoController;
Future<void> initializeVideoPlayer() async { Future<void> initializeVideoPlayer() async {
log("VIDEO PLAYER INITIALIZED!!!");
videoController = VideoPlayerController.network(ApiConsts.marathonBaseUrlServices + marathonDetailModel.sponsors!.first.video!); videoController = VideoPlayerController.network(ApiConsts.marathonBaseUrlServices + marathonDetailModel.sponsors!.first.video!);
await videoController.initialize(); await videoController.initialize();
await videoController.play(); await videoController.play();
@ -150,9 +136,7 @@ class MarathonProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
// 9c47d281-c5b5-4b5d-a90a-08dacb8cbdb6 //****************TIMERS**********
// MarathonI
//************************************************ TIMERS **********************************************************
int sponsorsSecondsCounter = 0; int sponsorsSecondsCounter = 0;
int totalSponsorVideoSeconds = 0; int totalSponsorVideoSeconds = 0;
@ -192,7 +176,6 @@ class MarathonProvider extends ChangeNotifier {
oneSec, oneSec,
(Timer timer) async { (Timer timer) async {
if (totalSecondsToWaitForMarathon == 0) { if (totalSecondsToWaitForMarathon == 0) {
timer.cancel();
if (isUserWaiting) { if (isUserWaiting) {
MarathonApiClient().joinMarathonAsParticipant().whenComplete(() async { MarathonApiClient().joinMarathonAsParticipant().whenComplete(() async {
await callNextQuestionApi(); await callNextQuestionApi();
@ -200,6 +183,7 @@ class MarathonProvider extends ChangeNotifier {
} else { } else {
isButtonEnabled = false; isButtonEnabled = false;
} }
timer.cancel();
return; return;
} else { } else {
totalSecondsToWaitForMarathon--; totalSecondsToWaitForMarathon--;
@ -212,44 +196,32 @@ class MarathonProvider extends ChangeNotifier {
int totalCurrentQuestionTime = 0; int totalCurrentQuestionTime = 0;
int currentGapTime = 0; int currentGapTime = 0;
Timer timerForQuestion = Timer.periodic(const Duration(seconds: 1), (Timer timer) {}); Timer timerForQuestion = Timer.periodic(const Duration(seconds: 1), (Timer timer) {});
int callCountThreshold = 0;
void startTimerForQuestion() { void startTimerForQuestion() {
const Duration oneSec = Duration(seconds: 1); const Duration oneSec = Duration(seconds: 1);
timerForQuestion = Timer.periodic( timerForQuestion = Timer.periodic(
oneSec, oneSec,
(Timer timer) async { (Timer timer) async {
// This 1 is just to show the color of answer tile for 1 and then update card status // This 2 is just to show the color of answer tile for 1 and then update card status
if (totalCurrentQuestionTime - currentGapTime == 1) { if (totalCurrentQuestionTime - currentGapTime == 1) {
if (callCountThreshold == 0) { getCorrectAnswerAndUpdateAnswerColor();
getCorrectAnswerAndUpdateAnswerColor();
}
} }
if (totalCurrentQuestionTime - currentGapTime == -2) { if (totalCurrentQuestionTime == currentGapTime) {
if (callCountThreshold == 0) {
updateCardStatusToAnswer();
}
// scheduleMicrotask(() async {
// if (AppState().getIsDemoMarathon || isUserOutOfGame) {
// await callNextQuestionApi();
// } else {
// await callSubmitOptionApi().then((bool value) async {
// updateIsUserOutOfGame = !value;
// await callNextQuestionApi();
// });
// }
// });
if (currentQuestionNumber == (AppState().getIsDemoMarathon ? demoMarathonDetailModel.totalQuestions! : marathonDetailModel.totalQuestions!)) {
isGettingQualifiers = true;
updateQuestionCardStatus(QuestionCardStatus.findingWinner);
timer.cancel();
cancelTimer();
notifyListeners();
}
totalCurrentQuestionTime--; totalCurrentQuestionTime--;
callCountThreshold = 0;
updateCardStatusToAnswer();
scheduleMicrotask(() async {
if (isUserOutOfGame) {
await callNextQuestionApi();
} else {
await callSubmitOptionApi().then((bool value) async {
updateIsUserOutOfGame = !value;
await callNextQuestionApi();
});
}
});
} }
if (totalCurrentQuestionTime == 0) { if (totalCurrentQuestionTime == 0) {
@ -257,12 +229,17 @@ class MarathonProvider extends ChangeNotifier {
gapTimeText = currentQuestion.gapText; gapTimeText = currentQuestion.gapText;
gapTimeType = currentQuestion.gapType; gapTimeType = currentQuestion.gapType;
updateCardData(); updateCardData();
if (currentQuestionNumber - 1 == marathonDetailModel.totalQuestions!) {
isGettingQualifiers = true;
updateQuestionCardStatus(QuestionCardStatus.findingWinner);
timer.cancel();
cancelTimer();
notifyListeners();
}
return; return;
} else { } else {
if (totalCurrentQuestionTime - currentGapTime != -2) { if (totalCurrentQuestionTime != currentGapTime) {
totalCurrentQuestionTime--; totalCurrentQuestionTime--;
callCountThreshold = 0;
} }
} }
@ -295,26 +272,19 @@ class MarathonProvider extends ChangeNotifier {
); );
} }
//************************************************ FUNCTIONS ********************************************************** //****************FUNCTIONS*********
Future<bool> callSubmitOptionApi() async { Future<bool> callSubmitOptionApi() async {
return await MarathonApiClient().submitSelectedOption(marathonId: marathonDetailModel.id!, questionId: currentQuestion.id, selectedAnswerId: selectedOptionId); return await MarathonApiClient().submitSelectedOption(marathonId: marathonDetailModel.id!, questionId: currentQuestion.id, selectedAnswerId: selectedOptionId);
} }
Future<void> callGetQualifiersApi() async { Future<void> callGetQualifiersApi() async {
if (AppState().getIsDemoMarathon) { totalQualifiers = await MarathonApiClient().getQualifiers(marathonId: marathonDetailModel.id!);
totalQualifiers = isUserOutOfGame ? 0 : 1;
} else {
totalQualifiers = await MarathonApiClient().getQualifiers(marathonId: marathonDetailModel.id!);
}
isGettingQualifiers = false; isGettingQualifiers = false;
notifyListeners(); notifyListeners();
} }
Future<void> callGetSelectedWinnersApi() async { Future<void> callGetSelectedWinnersApi() async {
if (AppState().getIsDemoMarathon) {
return;
}
selectedWinners = await MarathonApiClient().getSelectedWinner(marathonId: marathonDetailModel.id!); selectedWinners = await MarathonApiClient().getSelectedWinner(marathonId: marathonDetailModel.id!);
if (selectedWinners != null) { if (selectedWinners != null) {
selectedWinners!.removeWhere((WinnerModel element) { selectedWinners!.removeWhere((WinnerModel element) {
@ -331,14 +301,10 @@ class MarathonProvider extends ChangeNotifier {
} }
Future<void> callNextQuestionApi() async { Future<void> callNextQuestionApi() async {
if (currentQuestionNumber < (AppState().getIsDemoMarathon ? demoMarathonDetailModel.totalQuestions! : marathonDetailModel.totalQuestions!)) { if (currentQuestionNumber < marathonDetailModel.totalQuestions!) {
if (currentQuestionNumber == 0) { if (currentQuestionNumber == 0) {
if (!AppState().getIsDemoMarathon) { Utils.showLoading(AppRoutes.navigatorKey.currentContext!);
Utils.showLoading(AppRoutes.navigatorKey.currentContext!); currentQuestion = (await MarathonApiClient().getNextQuestion(questionId: null, marathonId: marathonDetailModel.id!));
}
currentQuestion = AppState().getIsDemoMarathon
? await DemoMarathonRepo().getDemoNextQuestion(currentQuestionNumber: currentQuestionNumber)
: (await MarathonApiClient().getNextQuestion(questionId: null, marathonId: marathonDetailModel.id!));
gapTimeImage = currentQuestion.gapImage; gapTimeImage = currentQuestion.gapImage;
gapTimeText = currentQuestion.gapText; gapTimeText = currentQuestion.gapText;
gapTimeType = currentQuestion.gapType; gapTimeType = currentQuestion.gapType;
@ -349,9 +315,7 @@ class MarathonProvider extends ChangeNotifier {
updateCardData(); updateCardData();
Navigator.pushReplacementNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.marathonScreen); Navigator.pushReplacementNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.marathonScreen);
} else { } else {
currentQuestion = AppState().getIsDemoMarathon currentQuestion = (await MarathonApiClient().getNextQuestion(questionId: currentQuestion.id, marathonId: marathonDetailModel.id!));
? await DemoMarathonRepo().getDemoNextQuestion(currentQuestionNumber: currentQuestionNumber)
: (await MarathonApiClient().getNextQuestion(questionId: currentQuestion.id, marathonId: marathonDetailModel.id!));
} }
notifyListeners(); notifyListeners();
} }
@ -373,21 +337,12 @@ class MarathonProvider extends ChangeNotifier {
} }
void populateQuestionStatusesList() { void populateQuestionStatusesList() {
answerStatusesList.clear(); if (marathonDetailModel.totalQuestions != null) {
if (demoMarathonDetailModel.totalQuestions != null) { for (int i = 0; i < marathonDetailModel.totalQuestions!; i++) {
for (int i = 0; i < demoMarathonDetailModel.totalQuestions!; i++) {
answerStatusesList.add(QuestionCardStatus.question); answerStatusesList.add(QuestionCardStatus.question);
} }
notifyListeners(); notifyListeners();
} }
if (isUpComingMarathon) {
if (marathonDetailModel.totalQuestions != null) {
for (int i = 0; i < marathonDetailModel.totalQuestions!; i++) {
answerStatusesList.add(QuestionCardStatus.question);
}
notifyListeners();
}
}
} }
void updateAnswerStatusesList(QuestionCardStatus status) { void updateAnswerStatusesList(QuestionCardStatus status) {
@ -411,43 +366,19 @@ class MarathonProvider extends ChangeNotifier {
} }
void updateQuestionCardStatus(QuestionCardStatus status) { void updateQuestionCardStatus(QuestionCardStatus status) {
if (status == QuestionCardStatus.wrongAnswer || status == QuestionCardStatus.skippedAnswer) { // if (status == QuestionCardStatus.wrongAnswer || status == QuestionCardStatus.skippedAnswer) {
if (AppState().getIsDemoMarathon) { // updateIsUserOutOfGame = true;
updateIsUserOutOfGame = true; // }
}
}
questionCardStatus = status; questionCardStatus = status;
notifyListeners(); notifyListeners();
} }
void getCorrectAnswerAndUpdateAnswerColor() { void getCorrectAnswerAndUpdateAnswerColor() {
callCountThreshold = 1;
if (selectedOptionIndex != null) { if (selectedOptionIndex != null) {
scheduleMicrotask(() async { if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) {
if (AppState().getIsDemoMarathon) { updateCurrentQuestionOptionStatus(QuestionsOptionStatus.correct, selectedOptionIndex!);
if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) { } else {
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.correct, selectedOptionIndex!); updateCurrentQuestionOptionStatus(QuestionsOptionStatus.wrong, selectedOptionIndex!);
} else {
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.wrong, selectedOptionIndex!);
}
} else {
await callSubmitOptionApi().then((bool value) async {
updateIsUserOutOfGame = !value;
if (value) {
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.correct, selectedOptionIndex!);
} else {
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.wrong, selectedOptionIndex!);
}
});
}
});
} else {
if (!AppState().getIsDemoMarathon) {
scheduleMicrotask(() async {
await callSubmitOptionApi().then((bool value) async {
updateIsUserOutOfGame = !value;
});
});
} }
} }
} }
@ -456,17 +387,8 @@ class MarathonProvider extends ChangeNotifier {
if (currentQuestionNumber == 0) { if (currentQuestionNumber == 0) {
return; return;
} }
callCountThreshold = 1;
scheduleMicrotask(() async {
await callNextQuestionApi();
});
if (selectedOptionIndex == null) { if (selectedOptionIndex != null) {
updateQuestionCardStatus(QuestionCardStatus.skippedAnswer);
updateAnswerStatusesList(QuestionCardStatus.skippedAnswer);
return;
}
if (AppState().getIsDemoMarathon) {
if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) { if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) {
updateQuestionCardStatus(QuestionCardStatus.correctAnswer); updateQuestionCardStatus(QuestionCardStatus.correctAnswer);
updateAnswerStatusesList(QuestionCardStatus.correctAnswer); updateAnswerStatusesList(QuestionCardStatus.correctAnswer);
@ -474,20 +396,14 @@ class MarathonProvider extends ChangeNotifier {
updateQuestionCardStatus(QuestionCardStatus.wrongAnswer); updateQuestionCardStatus(QuestionCardStatus.wrongAnswer);
updateAnswerStatusesList(QuestionCardStatus.wrongAnswer); updateAnswerStatusesList(QuestionCardStatus.wrongAnswer);
} }
return; } else {
} updateQuestionCardStatus(QuestionCardStatus.skippedAnswer);
if (!isUserOutOfGame) { updateAnswerStatusesList(QuestionCardStatus.skippedAnswer);
updateQuestionCardStatus(QuestionCardStatus.correctAnswer);
updateAnswerStatusesList(QuestionCardStatus.correctAnswer);
return;
} }
updateQuestionCardStatus(QuestionCardStatus.wrongAnswer);
updateAnswerStatusesList(QuestionCardStatus.wrongAnswer);
} }
void resetValues() async { void resetValues() async {
_currentQuestionNumber = 0; _currentQuestionNumber = 0;
iAmWinner = false;
cardContentList.clear(); cardContentList.clear();
itsMarathonTime = false; itsMarathonTime = false;
timerForWinnerSelection.cancel(); timerForWinnerSelection.cancel();
@ -498,13 +414,11 @@ class MarathonProvider extends ChangeNotifier {
isUserOutOfGame = false; isUserOutOfGame = false;
isButtonEnabled = false; isButtonEnabled = false;
isUserWaiting = false; isUserWaiting = false;
canPlayDemo = true;
totalCurrentQuestionTime = 0; totalCurrentQuestionTime = 0;
sponsorsSecondsCounter = 0; sponsorsSecondsCounter = 0;
totalSponsorVideoSeconds = 0; totalSponsorVideoSeconds = 0;
totalSecondsToWaitForWinner = 30; totalSecondsToWaitForWinner = 30;
totalSecondsToWaitForMarathon = 30; totalSecondsToWaitForMarathon = 30;
AppState().setIsDemoMarathon = false;
currentGapTime = 0; currentGapTime = 0;
currentQuestion = QuestionModel(); currentQuestion = QuestionModel();
if (answerStatusesList.isNotEmpty) { if (answerStatusesList.isNotEmpty) {
@ -535,19 +449,15 @@ class MarathonProvider extends ChangeNotifier {
isLoading = true; isLoading = true;
notifyListeners(); notifyListeners();
isPrivilegedWithMarathon = checkIfPrivilegedForMarathon(); isPrivilegedWithMarathon = checkIfPrivilegedForMarathon();
demoMarathonDetailModel = await DemoMarathonRepo().getDemoMarathonDetails();
if (isPrivilegedWithMarathon) { if (isPrivilegedWithMarathon) {
marathonDetailModel = await MarathonApiClient().getMarathonDetails(); marathonDetailModel = await MarathonApiClient().getMarathonDetails();
updateTotalSecondsToWaitForMarathon = marathonDetailModel.marathonBufferTime ?? 30; updateTotalSecondsToWaitForMarathon = marathonDetailModel.marathonBufferTime ?? 30;
if (marathonDetailModel.id == null) { if (marathonDetailModel.id == null) {
isUpComingMarathon = false; isUpComingMarathon = false;
isLoading = false; isLoading = false;
populateQuestionStatusesList();
notifyListeners(); notifyListeners();
return; return;
} }
isUpComingMarathon = true;
if (DateTime.parse(marathonDetailModel.startTime!).isAfter(DateTime.now())) { if (DateTime.parse(marathonDetailModel.startTime!).isAfter(DateTime.now())) {
itsMarathonTime = false; itsMarathonTime = false;
} }
@ -565,9 +475,4 @@ class MarathonProvider extends ChangeNotifier {
Utils.confirmDialog(context, e.toString()); Utils.confirmDialog(context, e.toString());
} }
} }
Future<void> onJoinDemoMarathonPressed(BuildContext context) async {
AppState().setIsDemoMarathon = true;
await callNextQuestionApi();
}
} }

@ -45,189 +45,106 @@ class MarathonScreen extends StatelessWidget {
return Image.asset(MyLottieConsts.congratsGif, height: 200); return Image.asset(MyLottieConsts.congratsGif, height: 200);
} }
Widget getDemoWinnerWidget(BuildContext context, {required MarathonProvider provider}) {
return provider.isUserOutOfGame
? Column(
children: <Widget>[
Lottie.asset(MyLottieConsts.noWinnerLottie),
Center(
child: LocaleKeys.noWinner.tr().toText18(color: MyColors.grey3AColor, isCentered: true),
),
],
)
: Stack(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 50,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: SvgPicture.asset("assets/images/winner_ribbon.svg", height: 50),
),
Align(
alignment: Alignment.center,
child: LocaleKeys.winner.tr().toText32(color: MyColors.white, isBold: true, isCentered: true).paddingOnly(top: 07),
)
],
),
),
16.height,
Column(
children: <Widget>[
(AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn)!.toText22(
color: MyColors.grey3AColor,
isCentered: true,
),
8.height,
AppState().memberInformationList!.eMPLOYEENUMBER!.toText22(color: MyColors.grey57Color),
],
),
60.height,
if (provider.demoMarathonDetailModel.sponsors != null && provider.demoMarathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
"${LocaleKeys.sponsoredBy.tr()} ".toText14(color: MyColors.grey77Color),
(AppState().isArabic(context) ? provider.demoMarathonDetailModel.sponsors!.first.nameAr ?? "" : provider.demoMarathonDetailModel.sponsors!.first.nameEn ?? "").toText14(
color: MyColors.darkTextColor,
isBold: true,
),
],
),
5.height,
Image.network(
ApiConsts.marathonBaseUrlServices + provider.demoMarathonDetailModel.sponsors!.first.logo!,
height: 50,
width: 150,
fit: BoxFit.contain,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/logos/main_mohemm_logo.png", height: 50, width: 150);
},
)
],
],
),
Lottie.asset(MyLottieConsts.celebrate1Lottie),
],
);
}
Widget getWinnerWidget(BuildContext context, {required MarathonProvider provider}) { Widget getWinnerWidget(BuildContext context, {required MarathonProvider provider}) {
return Container( return Container(
width: double.infinity, width: double.infinity,
decoration: MyDecorations.shadowDecoration, decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20), padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: (AppState().getIsDemoMarathon) child: provider.selectedWinners == null || (provider.selectedWinners!.isEmpty && !provider.iAmWinner)
? getDemoWinnerWidget(context, provider: provider) ? Column(
: provider.selectedWinners == null || (provider.selectedWinners!.isEmpty && !provider.iAmWinner) children: <Widget>[
? Column( Lottie.asset(MyLottieConsts.noWinnerLottie),
Center(
child: LocaleKeys.noWinner.tr().toText18(color: MyColors.grey3AColor, isCentered: true),
),
],
)
: Stack(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Lottie.asset(MyLottieConsts.noWinnerLottie), SizedBox(
Center( height: 50,
child: LocaleKeys.noWinner.tr().toText18(color: MyColors.grey3AColor, isCentered: true), child: Stack(
children: <Widget>[
Align(
alignment: Alignment.center,
child: SvgPicture.asset("assets/images/winner_ribbon.svg", height: 50),
),
Align(
alignment: Alignment.center,
child: ((provider.selectedWinners!.length == 1 && !provider.iAmWinner) || (provider.selectedWinners!.isEmpty && provider.iAmWinner)
? LocaleKeys.winner.tr()
: LocaleKeys.winners.tr())
.toText32(color: MyColors.white, isBold: true, isCentered: true)
.paddingOnly(top: 07),
)
],
),
), ),
], 16.height,
) provider.iAmWinner
: Stack( ? Column(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 50,
child: Stack(
children: <Widget>[ children: <Widget>[
Align( (AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn)!.toText22(
alignment: Alignment.center, color: MyColors.grey3AColor,
child: SvgPicture.asset("assets/images/winner_ribbon.svg", height: 50), isCentered: true,
), ),
Align( 8.height,
alignment: Alignment.center, AppState().memberInformationList!.eMPLOYEENUMBER!.toText22(color: MyColors.grey57Color),
child: ((provider.selectedWinners!.length == 1 && !provider.iAmWinner) || (provider.selectedWinners!.isEmpty && provider.iAmWinner)
? LocaleKeys.winner.tr()
: LocaleKeys.winners.tr())
.toText32(color: MyColors.white, isBold: true, isCentered: true)
.paddingOnly(top: 07),
)
], ],
), )
), : const SizedBox(),
16.height, 36.height,
provider.iAmWinner if (provider.selectedWinners != null) ...<Widget>[
? Column( ListView.separated(
children: <Widget>[ shrinkWrap: true,
(AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn)!.toText22( itemCount: provider.selectedWinners!.length,
color: MyColors.grey3AColor, separatorBuilder: (BuildContext context, int index) {
isCentered: true, return const Divider();
), },
8.height, itemBuilder: (BuildContext context, int index) {
AppState().memberInformationList!.eMPLOYEENUMBER!.toText22(color: MyColors.grey57Color), return Column(
], crossAxisAlignment: CrossAxisAlignment.start,
)
: const SizedBox(),
if (provider.selectedWinners != null) ...<Widget>[
provider.selectedWinners!.length == 1
? Column(
children: <Widget>[
(AppState().isArabic(context) ? provider.selectedWinners![0].nameEn : provider.selectedWinners![0].nameEn)!.toText24(
color: MyColors.grey3AColor,
isCentered: true,
),
8.height,
provider.selectedWinners![0].employeeId!.toText22(color: MyColors.grey57Color),
],
)
: ListView.separated(
shrinkWrap: true,
itemCount: provider.selectedWinners!.length,
separatorBuilder: (BuildContext context, int index) {
return const Divider();
},
itemBuilder: (BuildContext context, int index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(AppState().isArabic(context) ? provider.selectedWinners![index].nameEn : provider.selectedWinners![index].nameEn)!.toText16(
color: MyColors.grey3AColor,
),
provider.selectedWinners!.first.employeeId!.toText16(color: MyColors.grey57Color),
],
);
},
),
],
60.height,
if (provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
"${LocaleKeys.sponsoredBy.tr()} ".toText14(color: MyColors.grey77Color), (AppState().isArabic(context) ? provider.selectedWinners![index].nameEn : provider.selectedWinners![index].nameEn)!.toText16(
(AppState().isArabic(context) ? provider.marathonDetailModel.sponsors!.first.nameAr ?? "" : provider.marathonDetailModel.sponsors!.first.nameEn ?? "").toText14( color: MyColors.grey3AColor,
color: MyColors.darkTextColor,
isBold: true,
), ),
provider.selectedWinners!.first.employeeId!.toText16(color: MyColors.grey57Color),
], ],
);
},
),
],
60.height,
if (provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
"${LocaleKeys.sponsoredBy.tr()} ".toText14(color: MyColors.grey77Color),
(AppState().isArabic(context) ? provider.marathonDetailModel.sponsors!.first.nameAr ?? "" : provider.marathonDetailModel.sponsors!.first.nameEn ?? "").toText14(
color: MyColors.darkTextColor,
isBold: true,
), ),
5.height,
Image.network(
ApiConsts.marathonBaseUrlServices + provider.marathonDetailModel.sponsors!.first.logo!,
height: 50,
width: 150,
fit: BoxFit.contain,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/logos/main_mohemm_logo.png", height: 50, width: 150);
},
)
], ],
], ),
), 5.height,
Lottie.asset(MyLottieConsts.celebrate1Lottie), Image.network(
ApiConsts.marathonBaseUrlServices + provider.marathonDetailModel.sponsors!.first.logo!,
height: 50,
width: 150,
fit: BoxFit.contain,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/logos/main_mohemm_logo.png", height: 50, width: 150);
},
)
],
], ],
), ),
Lottie.asset(MyLottieConsts.celebrate1Lottie),
],
),
); );
} }
@ -309,7 +226,7 @@ class MarathonScreen extends StatelessWidget {
else ...<Widget>[ else ...<Widget>[
MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21), MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21),
], ],
if (provider.questionCardStatus == QuestionCardStatus.findingWinner && !provider.isUserOutOfGame) ...<Widget>[ if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
getNameContainer(context), getNameContainer(context),
], ],
QuestionCardBuilder( QuestionCardBuilder(
@ -336,7 +253,7 @@ class MarathonScreen extends StatelessWidget {
subTitle: LocaleKeys.youMissedTheQuestion.tr().toText18(color: MyColors.darkTextColor, isCentered: true), subTitle: LocaleKeys.youMissedTheQuestion.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
), ),
onFindingWinner: (BuildContext context) => CustomStatusWidget( onFindingWinner: (BuildContext context) => CustomStatusWidget(
asset: Lottie.asset(MyLottieConsts.winnerLottie, height: 168, reverse: false, repeat: true), asset: Lottie.asset(MyLottieConsts.winnerLottie, height: 168, reverse: false),
title: LocaleKeys.fingersCrossed.tr().toText22(color: MyColors.greenColor), title: LocaleKeys.fingersCrossed.tr().toText22(color: MyColors.greenColor),
subTitle: LocaleKeys.winnerSelectedRandomly.tr().toText18(color: MyColors.darkTextColor, isCentered: true), subTitle: LocaleKeys.winnerSelectedRandomly.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
), ),

@ -15,16 +15,16 @@ import 'package:video_player/video_player.dart';
class SponsorVideoScreen extends StatelessWidget { class SponsorVideoScreen extends StatelessWidget {
const SponsorVideoScreen({Key? key}) : super(key: key); const SponsorVideoScreen({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
MarathonProvider provider = context.read<MarathonProvider>(); MarathonProvider provider = context.watch<MarathonProvider>();
return WillPopScope( return WillPopScope(
onWillPop: () { onWillPop: () {
provider.timerForSponsorVideo.cancel(); provider.videoController.dispose();
provider.videoController.pause();
provider.disposeVideoPlayer();
provider.sponsorsSecondsCounter = 0; provider.sponsorsSecondsCounter = 0;
provider.totalSponsorVideoSeconds = 0; provider.totalSponsorVideoSeconds = 0;
provider.timerForSponsorVideo.cancel();
return Future<bool>.value(true); return Future<bool>.value(true);
}, },
child: Scaffold( child: Scaffold(
@ -49,56 +49,47 @@ class SponsorVideoScreen extends StatelessWidget {
borderRadius: provider.totalSponsorVideoSeconds == 0 ? null : BorderRadius.circular(15), borderRadius: provider.totalSponsorVideoSeconds == 0 ? null : BorderRadius.circular(15),
), ),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8),
child: Consumer<MarathonProvider>( child: provider.totalSponsorVideoSeconds == 0
builder: (BuildContext context, MarathonProvider provider, Widget? child) { ? InkWell(
return provider.totalSponsorVideoSeconds == 0 onTap: () {
? InkWell( provider.videoController.dispose();
onTap: () { provider.sponsorsSecondsCounter = 0;
Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen); provider.totalSponsorVideoSeconds = 0;
provider.videoController.pause(); provider.timerForSponsorVideo.cancel();
provider.disposeVideoPlayer(); Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen);
provider.sponsorsSecondsCounter = 0; },
provider.totalSponsorVideoSeconds = 0; child: const Icon(Icons.close, size: 12),
provider.timerForSponsorVideo.cancel(); )
}, : Directionality(
child: const Icon(Icons.close, size: 12), textDirection: ui.TextDirection.ltr,
) child: ("${LocaleKeys.ourSponsor.tr()} ${provider.totalSponsorVideoSeconds < 10 ? "0" : ""}${provider.totalSponsorVideoSeconds}").toText12(color: MyColors.darkTextColor),
: Directionality( ),
textDirection: ui.TextDirection.ltr,
child: ("${LocaleKeys.ourSponsor.tr()} ${provider.totalSponsorVideoSeconds < 10 ? "0" : ""}${provider.totalSponsorVideoSeconds}").toText12(color: MyColors.darkTextColor),
);
},
),
), ),
).paddingOnly(top: 20, right: 18), ).paddingOnly(top: 20, right: 18),
Consumer<MarathonProvider>(
builder: (BuildContext context, MarathonProvider provider, Widget? child) { //TODO: WE WILL INCREASE THIS 2 BEFORE GOING LIVE
//TODO: WE WILL INCREASE THIS 2 BEFORE GOING LIVE provider.sponsorsSecondsCounter >= 2
return provider.sponsorsSecondsCounter >= 2 ? Align(
? Align( alignment: Alignment.topLeft,
alignment: Alignment.topLeft, child: InkWell(
child: InkWell( onTap: () {
onTap: () { provider.videoController.dispose();
Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen); provider.sponsorsSecondsCounter = 0;
provider.videoController.pause(); provider.totalSponsorVideoSeconds = 0;
provider.disposeVideoPlayer(); provider.timerForSponsorVideo.cancel();
provider.sponsorsSecondsCounter = 0; Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen);
provider.totalSponsorVideoSeconds = 0; },
provider.timerForSponsorVideo.cancel(); child: Container(
}, decoration: BoxDecoration(color: MyColors.white, borderRadius: BorderRadius.circular(15)),
child: Container( padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 6),
decoration: BoxDecoration(color: MyColors.white, borderRadius: BorderRadius.circular(15)), child: Directionality(
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 6), textDirection: ui.TextDirection.ltr,
child: Directionality( child: LocaleKeys.skip.tr().toText11(color: MyColors.darkTextColor),
textDirection: ui.TextDirection.ltr,
child: LocaleKeys.skip.tr().toText11(color: MyColors.darkTextColor),
),
),
), ),
).paddingOnly(top: 20, left: 18) ),
: const SizedBox(); ),
}, ).paddingOnly(top: 20, left: 18)
), : const SizedBox(),
], ],
), ),
), ),

@ -121,18 +121,6 @@ class CountdownTimerForDetailScreen extends StatelessWidget {
} }
Widget buildCountdownTimer(CurrentRemainingTime? time) { Widget buildCountdownTimer(CurrentRemainingTime? time) {
if (provider.marathonDetailModel.startTime != null) {
int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes;
if (remainingTimeInMinutes <= 30 && provider.canPlayDemo == true) {
// scheduleMicrotask(() {
// print("Timer TRUE!!!: ${time?.min.toString()}");
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
provider.canPlayDemo = false;
});
// });
}
}
if (time == null) { if (time == null) {
if (!provider.itsMarathonTime) { if (!provider.itsMarathonTime) {
scheduleMicrotask(() { scheduleMicrotask(() {
@ -204,7 +192,6 @@ class CountdownTimerForDetailScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CountdownTimer( return CountdownTimer(
// endTime: dummyTime,
endTime: timeToMarathon, endTime: timeToMarathon,
onEnd: null, onEnd: null,
widgetBuilder: (BuildContext context, CurrentRemainingTime? time) { widgetBuilder: (BuildContext context, CurrentRemainingTime? time) {

@ -11,7 +11,6 @@ import 'package:mohem_flutter_app/classes/decorations_helper.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/main.dart'; import 'package:mohem_flutter_app/main.dart';
@ -19,11 +18,14 @@ import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:mohem_flutter_app/ui/marathon/widgets/countdown_timer_main_screen.dart'; import 'package:mohem_flutter_app/ui/marathon/widgets/countdown_timer_main_screen.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// It is used to pass a dummy time to test Marathon // It is used to pass a dummy time to test Marathon
int dummyTime = DateTime.now().millisecondsSinceEpoch + 8690; int dummyTime = DateTime.now().millisecondsSinceEpoch + 8690;
class MarathonBanner extends StatelessWidget { class MarathonBanner extends StatelessWidget {
const MarathonBanner({Key? key}) : super(key: key); final bool isMarathonUpcoming;
const MarathonBanner({Key? key, required this.isMarathonUpcoming}) : super(key: key);
Widget getUnPrivilegedMarathon(BuildContext context) { Widget getUnPrivilegedMarathon(BuildContext context) {
return Container( return Container(
@ -272,16 +274,6 @@ class MarathonBanner extends StatelessWidget {
height: 32 / 22, height: 32 / 22,
), ),
), ),
Text(
LocaleKeys.youCanPlayDemo.tr(),
style: TextStyle(
fontSize: isTablet ? 20 : 11,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w600,
color: MyColors.white.withOpacity(0.83),
letterSpacing: -0.4,
),
),
], ],
).paddingOnly( ).paddingOnly(
left: AppState().isArabic(context) ? 12 : 3, left: AppState().isArabic(context) ? 12 : 3,
@ -339,21 +331,16 @@ class MarathonBanner extends StatelessWidget {
).paddingOnly(top: 5), ).paddingOnly(top: 5),
], ],
), ),
).onPress(() { );
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
MarathonProvider provider = context.read<MarathonProvider>(); MarathonProvider provider = context.read<MarathonProvider>();
// if(provider.isUserWaiting) {
// provider.isUserWaiting = false;
// provider.getMarathonDetailsFromApi();
// }
return !provider.isPrivilegedWithMarathon return !provider.isPrivilegedWithMarathon
? getUnPrivilegedMarathon(context) ? getUnPrivilegedMarathon(context)
: provider.isUpComingMarathon : provider.marathonDetailModel.startTime != null
? Container( ? Container(
decoration: MyDecorations.shadowDecoration, decoration: MyDecorations.shadowDecoration,
height: isTablet ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.11, height: isTablet ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.11,
@ -432,22 +419,20 @@ class MarathonBanner extends StatelessWidget {
letterSpacing: -0.4, letterSpacing: -0.4,
), ),
), ),
Flexible( Text(
child: Text( AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "",
(AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "").trimString(isTablet ? 25 : 15), style: TextStyle(
overflow: TextOverflow.ellipsis, fontStyle: FontStyle.italic,
style: TextStyle( fontSize: isTablet ? 30 : 19,
fontStyle: FontStyle.italic, fontWeight: FontWeight.bold,
fontSize: isTablet ? 30 : 19, color: MyColors.white.withOpacity(0.83),
fontWeight: FontWeight.bold, height: 32 / 22,
color: MyColors.white.withOpacity(0.83),
height: 32 / 22,
),
), ),
), ),
isTablet ? 10.height : 3.height, isTablet ? 10.height : 3.height,
CountdownTimerForMainScreen( CountdownTimerForMainScreen(
timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch, timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch,
// timeToMarathon: dummyTime,
provider: provider, provider: provider,
), ),
], ],
@ -526,9 +511,7 @@ class MarathonBanner extends StatelessWidget {
).onPress(() async { ).onPress(() async {
int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes; int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes;
if (remainingTimeInMinutes > 5 && provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) { if (remainingTimeInMinutes > 2 && provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) {
log("IF CALLED!!!");
log("Remaining Time: $remainingTimeInMinutes");
Utils.showLoading(context); Utils.showLoading(context);
try { try {
await provider.initializeVideoPlayer().then((_) { await provider.initializeVideoPlayer().then((_) {
@ -537,19 +520,14 @@ class MarathonBanner extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.marathonSponsorVideoScreen); Navigator.pushNamed(context, AppRoutes.marathonSponsorVideoScreen);
}); });
} catch (e) { } catch (e) {
// if (kDebugMode) { if (kDebugMode) {
log("Error in VideoPlayer: ${e.toString()}"); log("Error in VideoPlayer: ${e.toString()}");
// } }
Utils.hideLoading(context); Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen).then((value) { Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
print("Back to home!!!");
});
} }
} else { } else {
log("ELSE CALLED!!!"); Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen).then((value) {
print("Back to home!!!");
});
} }
}), }),
) )

@ -6,96 +6,72 @@ import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/decorations_helper.dart'; import 'package:mohem_flutter_app/classes/decorations_helper.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/marathon/marathon_model.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:provider/provider.dart';
class MarathonDetailsCard extends StatelessWidget { class MarathonDetailsCard extends StatelessWidget {
final MarathonDetailModel marathonDetailModel; final MarathonProvider provider;
const MarathonDetailsCard({Key? key, required this.marathonDetailModel}) : super(key: key); const MarathonDetailsCard({Key? key, required this.provider}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity, width: double.infinity,
decoration: MyDecorations.shadowDecoration, decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14), padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 14),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
context.read<MarathonProvider>().isUpComingMarathon Column(
? const SizedBox() crossAxisAlignment: CrossAxisAlignment.start,
: Row( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.end, LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey77Color),
children: [ "${AppState().isArabic(context) ? provider.marathonDetailModel.titleAr : provider.marathonDetailModel.titleEn}".toText20(color: MyColors.textMixColor, isBold: true),
Container( Row(
decoration: BoxDecoration(color: MyColors.yellowColorII, borderRadius: BorderRadius.circular(100)), children: <Widget>[
child: LocaleKeys.demo.tr().toText10(color: MyColors.white).paddingAll(4), Flexible(
), child: "${AppState().isArabic(context) ? provider.marathonDetailModel.descAr : provider.marathonDetailModel.descEn}".toText14(color: MyColors.grey77Color),
)
],
),
if (provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
5.height,
provider.marathonDetailModel.sponsors!.first.sponsorPrizes != null
? Row(
children: <Widget>[
"${LocaleKeys.prize.tr()} ".toText16(color: MyColors.grey77Color, isBold: true),
"${AppState().isArabic(context) ? provider.marathonDetailModel.sponsors?.first.sponsorPrizes?.first.marathonPrizeAr : provider.marathonDetailModel.sponsors?.first.sponsorPrizes?.first.marathonPrizeAr}"
.toText16(color: MyColors.greenColor, isBold: true),
],
)
: const SizedBox(),
Row(
children: <Widget>[
"${LocaleKeys.sponsoredBy.tr()} ".toText16(color: MyColors.grey77Color),
"${AppState().isArabic(context) ? provider.marathonDetailModel.sponsors?.first.nameAr : provider.marathonDetailModel.sponsors?.first.nameEn}"
.toText16(color: MyColors.darkTextColor, isBold: true),
], ],
), ),
7.height, 10.height,
LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey77Color), Row(
"${AppState().isArabic(context) ? marathonDetailModel.titleAr : marathonDetailModel.titleEn}".toText20(color: MyColors.textMixColor, isBold: true), mainAxisAlignment: MainAxisAlignment.center,
Row( children: <Widget>[
children: <Widget>[ Image.network(
Flexible( ApiConsts.marathonBaseUrlServices + provider.marathonDetailModel.sponsors!.first.logo!,
child: "${AppState().isArabic(context) ? marathonDetailModel.descAr : marathonDetailModel.descEn}".toText14(color: MyColors.grey77Color), height: 50,
) width: 150,
fit: BoxFit.contain,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/logos/main_mohemm_logo.png", height: 50, width: 150);
},
)
],
),
]
], ],
), ),
if (marathonDetailModel.sponsors != null && marathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
5.height,
marathonDetailModel.sponsors!.first.sponsorPrizes != null
? Row(
children: <Widget>[
"${LocaleKeys.prize.tr()} ".toText16(color: MyColors.grey77Color, isBold: true),
Expanded(
child: SizedBox(
height: 30,
child: ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount: marathonDetailModel.sponsors!.first.sponsorPrizes!.length,
itemBuilder: (BuildContext context, int index) {
SponsorPrizes prizes = marathonDetailModel.sponsors!.first.sponsorPrizes![index];
return Container(
decoration: BoxDecoration(color: MyColors.backgroundColor, borderRadius: BorderRadius.circular(100), border: Border.all(color: MyColors.grey57Color.withOpacity(0.1))),
child: "${AppState().isArabic(context) ? prizes.marathonPrizeAr : prizes.marathonPrizeEn}"
.toText16(color: MyColors.greenColor, isBold: true)
.paddingOnly(left: 5, right: 5),
).paddingOnly(left: 5);
}),
),
)
],
)
: const SizedBox(),
Row(
children: <Widget>[
"${LocaleKeys.sponsoredBy.tr()} ".toText16(color: MyColors.grey77Color),
"${AppState().isArabic(context) ? marathonDetailModel.sponsors?.first.nameAr : marathonDetailModel.sponsors?.first.nameEn}".toText16(color: MyColors.darkTextColor, isBold: true),
],
),
10.height,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.network(
ApiConsts.marathonBaseUrlServices + marathonDetailModel.sponsors!.first.logo!,
height: 50,
width: 150,
fit: BoxFit.contain,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/logos/main_mohemm_logo.png", height: 50, width: 150);
},
)
],
),
]
], ],
), ),
); );

@ -41,15 +41,9 @@ class MarathonFooter extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return provider.isUpComingMarathon && !provider.canPlayDemo return DefaultButton(
? DefaultButton( LocaleKeys.joinMarathon.tr(),
LocaleKeys.joinMarathon.tr(), provider.isButtonEnabled ? () => provider.onJoinMarathonPressed(context) : null,
provider.isButtonEnabled ? () => provider.onJoinMarathonPressed(context) : null, ).insideContainer;
).insideContainer
: DefaultButton(
LocaleKeys.joinDemoMarathon.tr(),
() => provider.onJoinDemoMarathonPressed(context),
color: MyColors.yellowColorII,
).insideContainer;
} }
} }

@ -1,6 +1,5 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/decorations_helper.dart'; import 'package:mohem_flutter_app/classes/decorations_helper.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
@ -15,71 +14,41 @@ class MarathonProgressContainer extends StatelessWidget {
const MarathonProgressContainer({Key? key, required this.provider}) : super(key: key); const MarathonProgressContainer({Key? key, required this.provider}) : super(key: key);
Widget getDemoMarathonerText() {
if (provider.isUserOutOfGame) {
return "0 ${LocaleKeys.marathoner.tr()}".toText14();
}
return "1 ${LocaleKeys.marathoner.tr()}".toText14();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity, width: double.infinity,
decoration: MyDecorations.shadowDecoration, decoration: MyDecorations.shadowDecoration,
padding: EdgeInsets.fromLTRB(13, AppState().getIsDemoMarathon ? 5 : 18, 13, 18), padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 13),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
AppState().getIsDemoMarathon
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
decoration: BoxDecoration(color: MyColors.yellowColorII, borderRadius: BorderRadius.circular(100)),
child: LocaleKeys.demo.tr().toText10(color: MyColors.white).paddingAll(4),
),
],
)
: const SizedBox(),
5.height,
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: BoxDecoration(color: MyColors.greenColor, borderRadius: BorderRadius.circular(5)), decoration: BoxDecoration(color: MyColors.greenColor, borderRadius: BorderRadius.circular(5)),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8),
child: child: "${provider.currentQuestionNumber.toString()} / ${provider.marathonDetailModel.totalQuestions.toString()} ${LocaleKeys.question.tr()}".toText12(color: MyColors.white),
"${provider.currentQuestionNumber.toString()} / ${AppState().getIsDemoMarathon ? provider.demoMarathonDetailModel.totalQuestions.toString() : provider.marathonDetailModel.totalQuestions.toString()} ${LocaleKeys.question.tr()}"
.toText12(color: MyColors.white),
), ),
AppState().getIsDemoMarathon "${provider.totalMarathoners} ${LocaleKeys.marathoners.tr()}".toText14(),
? getDemoMarathonerText()
: "${provider.totalMarathoners} ${provider.totalMarathoners == 1 ? LocaleKeys.marathoner.tr() : LocaleKeys.marathoners.tr()}".toText14(),
provider.questionCardStatus == QuestionCardStatus.question provider.questionCardStatus == QuestionCardStatus.question
? "00:${provider.totalCurrentQuestionTime - provider.currentGapTime < 0 ? "00" : (provider.totalCurrentQuestionTime - provider.currentGapTime) < 10 ? "0${provider.totalCurrentQuestionTime - provider.currentGapTime}" : provider.totalCurrentQuestionTime - provider.currentGapTime}" ? "00:${(provider.totalCurrentQuestionTime - provider.currentGapTime) < 10 ? "0${provider.totalCurrentQuestionTime - provider.currentGapTime}" : provider.totalCurrentQuestionTime - provider.currentGapTime}"
.toText18(color: provider.totalCurrentQuestionTime - provider.currentGapTime < 5 ? MyColors.redColor : MyColors.black) .toText18(color: provider.totalCurrentQuestionTime - provider.currentGapTime < 5 ? MyColors.redColor : MyColors.black)
: const SizedBox(), : const SizedBox(),
], ],
), ),
12.height, 12.height,
stepper( stepper(provider.currentQuestionNumber, provider.answerStatusesList, provider.marathonDetailModel.totalQuestions!, provider.isUserOutOfGame),
provider.currentQuestionNumber,
provider.answerStatusesList,
(provider.demoMarathonDetailModel.totalQuestions != null || provider.marathonDetailModel.totalQuestions != null)
? AppState().getIsDemoMarathon
? provider.demoMarathonDetailModel.totalQuestions!
: provider.marathonDetailModel.totalQuestions!
: 10,
provider.isUserOutOfGame,
),
8.height, 8.height,
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
"${provider.currentQuestionNumber == 1 ? 0 : (((provider.currentQuestionNumber - 1) / (AppState().getIsDemoMarathon ? provider.demoMarathonDetailModel.totalQuestions! : provider.marathonDetailModel.totalQuestions!)) * 100).toInt()}% ${LocaleKeys.completed.tr()}" "${provider.currentQuestionNumber == 1 ? 0 : (((provider.currentQuestionNumber - 1) / provider.marathonDetailModel.totalQuestions!) * 100).toInt()}% ${LocaleKeys.completed.tr()}"
.toText14(), .toText14(),
provider.isUserOutOfGame ? LocaleKeys.youAreOutOfContest.tr().toText13(color: MyColors.redColor) : const SizedBox(), provider.isUserOutOfGame
? LocaleKeys.youAreOutOfContest.tr().toText14(color: MyColors.redColor)
: const SizedBox(),
], ],
), ),
], ],
@ -128,28 +97,21 @@ class MarathonProgressContainer extends StatelessWidget {
Widget roundContainer(Color color, bool isNeedLeftBorder) { Widget roundContainer(Color color, bool isNeedLeftBorder) {
if (isNeedLeftBorder) { if (isNeedLeftBorder) {
return Row( return Row(
children: <Widget>[ children: [
Divider( Divider(thickness: 6, color: color).expanded,
thickness: 6,
color: color,
).expanded,
Container( Container(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: 10, width: 10,
height: 10, height: 10,
decoration: BoxDecoration(shape: BoxShape.circle, color: color, border: Border.all(color: color, width: 2)), decoration: BoxDecoration(shape: BoxShape.circle, color: color),
), ),
], ],
).expanded; ).expanded;
} }
return Container( return Container(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: 10, width: 10,
height: 10, height: 10,
decoration: BoxDecoration(shape: BoxShape.circle, color: color, border: Border.all(color: color, width: 2)), decoration: BoxDecoration(shape: BoxShape.circle, color: color),
); );
} }
} }

@ -57,7 +57,7 @@ class _QualifiersContainerState extends State<QualifiersContainer> {
children: <Widget>[ children: <Widget>[
widget.provider.totalQualifiers != null ? widget.provider.totalQualifiers.toString().toText30(color: MyColors.greenColor, isBold: true) : const SizedBox(), widget.provider.totalQualifiers != null ? widget.provider.totalQualifiers.toString().toText30(color: MyColors.greenColor, isBold: true) : const SizedBox(),
2.width, 2.width,
(widget.provider.totalQualifiers == 1 ? LocaleKeys.qualifier.tr() : LocaleKeys.qualifiers.tr()).toText16(color: MyColors.greenColor), LocaleKeys.qualifiers.tr().toText16(color: MyColors.greenColor),
], ],
), ),
], ],

@ -1,6 +1,8 @@
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/api/my_attendance_api_client.dart';
@ -56,7 +58,6 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
AppState().cancelRequestTrancsection = true;
} }
void getApproverList() async { void getApproverList() async {
@ -137,9 +138,9 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
params!.transactionId, params!.transactionId,
); );
} else {} } else {}
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true); Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true);
AppState().cancelRequestTrancsection = false;
Navigator.of(context).popUntil((route) => route.settings.name == AppRoutes.dashboard); Navigator.of(context).popUntil((route) => route.settings.name == AppRoutes.dashboard);
Navigator.pushNamed(context, AppRoutes.workList); Navigator.pushNamed(context, AppRoutes.workList);
} catch (ex) { } catch (ex) {
@ -261,7 +262,7 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
title.toText16().expanded, title.toText16().expanded,
6.width, 6.width,
SimpleButton(LocaleKeys.add.tr(), () async { SimpleButton(LocaleKeys.add.tr(), () async {
ImageOptions.showImageOptionsNew(context, true, (String image, File file) { ImageOptions.showImageOptionsNew(context, false, (String image, File file) {
setState(() { setState(() {
attachmentFiles.add(file); attachmentFiles.add(file);
attachments.add(image); attachments.add(image);

@ -5,7 +5,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/api/my_attendance_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
@ -58,7 +57,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
} }
void validateTransaction() async { void validateTransaction() async {
try { // try {
Utils.showLoading(context); Utils.showLoading(context);
List<Map<String, dynamic>> values = getEitDffStructureList!.map((e) { List<Map<String, dynamic>> values = getEitDffStructureList!.map((e) {
String tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? ""; String tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? "";
@ -67,8 +66,8 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? ""; tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? "";
if (tempVar.isNotEmpty) { if (tempVar.isNotEmpty) {
if (!tempVar.contains("/")) { if (!tempVar.contains("/")) {
DateTime date = DateFormat('yyyy-MM-dd', "en_US").parse(tempVar); DateTime date = DateFormat('yyyy-MM-dd').parse(tempVar);
tempVar = DateFormat('yyyy/MM/dd HH:mm:ss', "en_US").format(date); tempVar = DateFormat('yyyy/MM/dd HH:mm:ss').format(date);
} }
} }
} }
@ -96,16 +95,13 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
Utils.hideLoading(context); Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!, 'eit')); arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!, 'eit'));
if (!AppState().cancelRequestTrancsection) {
return;
}
Utils.showLoading(context); Utils.showLoading(context);
await LeaveBalanceApiClient().cancelHrTransaction(submitEITTransactionList.pTRANSACTIONID!); await LeaveBalanceApiClient().cancelHrTransaction(submitEITTransactionList.pTRANSACTIONID!);
Utils.hideLoading(context); Utils.hideLoading(context);
} catch (ex) { // } catch (ex) {
Utils.hideLoading(context); // Utils.hideLoading(context);
Utils.handleException(ex, context, null); // Utils.handleException(ex, context, null);
} // }
} }
String dESCFLEXCONTEXTCODE = ""; String dESCFLEXCONTEXTCODE = "";
@ -137,7 +133,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
getEitDffStructureList = abc; getEitDffStructureList = abc;
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
getEitDffStructureList![index].eSERVICESVS!.clear(); getEitDffStructureList![index].eSERVICESVS!.clear();
getEitDffStructureList![index].eSERVICESDV = ESERVICESDV();
if (eServicesResponseModel.isNotEmpty) getEitDffStructureList![index].eSERVICESVS!.addAll(eServicesResponseModel); if (eServicesResponseModel.isNotEmpty) getEitDffStructureList![index].eSERVICESVS!.addAll(eServicesResponseModel);
// getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? [];
//getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList();
@ -156,58 +151,54 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
Future getDefaultValues(GetEITDFFStructureList structureList, {bool showLoading = true}) async { Future getDefaultValues(GetEITDFFStructureList structureList, {bool showLoading = true}) async {
try { try {
if (showLoading) Utils.showLoading(context); if (showLoading) Utils.showLoading(context);
for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) { for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) {
String segmentId = structureList.cHILDSEGMENTSDVSplited![i]; String segmentId = structureList.cHILDSEGMENTSDVSplited![i];
GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
List<PARENTSEGMENTSDVSplited> parentDvRequired = parent.pARENTSEGMENTSDVSplited ?? []; List<PARENTSEGMENTSDVSplited> parentDvRequired = parent.pARENTSEGMENTSDVSplited ?? [];
List<PARENTSEGMENTSVSSplitedVS> parentVsRequired = parent.pARENTSEGMENTSVSSplitedVS ?? []; List<PARENTSEGMENTSVSSplitedVS> parentVsRequired = parent.pARENTSEGMENTSVSSplitedVS ?? [];
List<GetEITDFFStructureList> filteredList =
getEitDffStructureList!.where((outerElement) => parentDvRequired.any((element) => outerElement.sEGMENTNAME == element.name && element.isRequired == "REQUIRED")).toList();
List<Map<String, dynamic>> values = filteredList.map((e) {
if (e.fORMATTYPE == "X" && e.isDefaultTypeIsCDPS && e.eSERVICESDV!.pIDCOLUMNNAME!=null) {
e.eSERVICESDV!.pVALUECOLUMNNAME = Utils.reverseFormatDate(e.eSERVICESDV!.pIDCOLUMNNAME ?? "");
e.eSERVICESDV!.pIDCOLUMNNAME = Utils.reverseFormatDate(e.eSERVICESDV!.pIDCOLUMNNAME ?? "");
}
return GetSetValuesRequestModel(
sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
.toJson();
}).toList();
List<Map<String, dynamic>> getSetList = getDefaultValuesIonicLogic(parent); List<GetEITDFFStructureList> filteredList =
if (getSetList.isNotEmpty) { getEitDffStructureList!.where((outerElement) => parentDvRequired.any((element) => outerElement.sEGMENTNAME == element.name && element.isRequired == "REQUIRED")).toList();
ESERVICESDV defaultValue =
await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, getSetList, empID: dynamicParams!.selectedEmp); List<Map<String, dynamic>> values = filteredList
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); .map((e) => GetSetValuesRequestModel(
getEitDffStructureList![index].eSERVICESDV = defaultValue; sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
GetEITDFFStructureList defaultValueCheck = getEitDffStructureList!.where((GetEITDFFStructureList element) => element.sEGMENTNAME == segmentId).toList().first; .toJson())
.toList();
if (defaultValueCheck.cHILDSEGMENTSDVSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
await getDefaultValues(defaultValueCheck, showLoading: false); List<Map<String, dynamic>> getSetList = getDefaultValuesIonicLogic(parent);
if (getSetList.isNotEmpty) {
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); ESERVICESDV defaultValue =
// List<Map<String, dynamic>> getSetList = getDefaultValuesIonicLogic(parent); await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, getSetList, empID: dynamicParams!.selectedEmp);
// ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, defaultValueCheck.dESCFLEXCONTEXTCODE!, defaultValueCheck.dESCFLEXNAME!, getSetList); int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); getEitDffStructureList![index].eSERVICESDV = defaultValue;
// getEitDffStructureList![index].eSERVICESDV = defaultValue; GetEITDFFStructureList defaultValueCheck = getEitDffStructureList!.where((GetEITDFFStructureList element) => element.sEGMENTNAME == segmentId).toList().first;
} else if (defaultValueCheck.cHILDSEGMENTSVSSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
await calGetValueSetValues(defaultValueCheck, showLoading: false); if (defaultValueCheck.cHILDSEGMENTSDVSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
// Utils.hideLoading(context); await getDefaultValues(defaultValueCheck, showLoading: false);
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
// List<Map<String, dynamic>> getSetList = getDefaultValuesIonicLogic(parent);
// ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, defaultValueCheck.dESCFLEXCONTEXTCODE!, defaultValueCheck.dESCFLEXNAME!, getSetList);
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// getEitDffStructureList![index].eSERVICESDV = defaultValue;
} else if (defaultValueCheck.cHILDSEGMENTSVSSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
await calGetValueSetValues(defaultValueCheck, showLoading: false);
// Utils.hideLoading(context);
}
} else if (values.isNotEmpty) {
ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values, empID: dynamicParams!.selectedEmp);
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
getEitDffStructureList![index].eSERVICESDV = defaultValue;
} }
} else if (values.isNotEmpty) {
ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values, empID: dynamicParams!.selectedEmp);
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
getEitDffStructureList![index].eSERVICESDV = defaultValue;
} }
} if (showLoading) {
if (showLoading) { await Future.delayed(const Duration(seconds: 1));
await Future.delayed(const Duration(seconds: 1)); Utils.hideLoading(context);
Utils.hideLoading(context); }
}
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
if (showLoading) Utils.hideLoading(context); if (showLoading) Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
@ -225,79 +216,79 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
// } // }
List<Map<String, dynamic>> getDefaultValuesIonicLogic(GetEITDFFStructureList structureElement) { List<Map<String, dynamic>> getDefaultValuesIonicLogic(GetEITDFFStructureList structureElement) {
// try { try {
List<PARENTSEGMENTSVSSplitedVS> parentValue = structureElement.pARENTSEGMENTSVSSplitedVS ?? []; List<PARENTSEGMENTSVSSplitedVS> parentValue = structureElement.pARENTSEGMENTSVSSplitedVS ?? [];
List<PARENTSEGMENTSDVSplited> parentsList = structureElement.pARENTSEGMENTSDVSplited ?? []; List<PARENTSEGMENTSDVSplited> parentsList = structureElement.pARENTSEGMENTSDVSplited ?? [];
List<Map<String, dynamic>> dependenciesList = []; List<Map<String, dynamic>> dependenciesList = [];
String? parentVal; String? parentVal;
bool isStandardDate = false; bool isStandardDate = false;
bool isStandardTimeDate = false; bool isStandardTimeDate = false;
bool isStandardTime = false; bool isStandardTime = false;
bool isHidden = false; bool isHidden = false;
bool isReadOnlyList = false; bool isReadOnlyList = false;
bool isSelectElement = false; bool isSelectElement = false;
// isStandardDate = this.isStandardDate(obj); // isStandardDate = this.isStandardDate(obj);
// isStandardTimeDate = this.isStandardDateTime(obj); // isStandardTimeDate = this.isStandardDateTime(obj);
// isStandardTime = this.isStandardTime(obj); // isStandardTime = this.isStandardTime(obj);
if (structureElement.dISPLAYFLAG == "N") isHidden = true; if (structureElement.dISPLAYFLAG == "N") isHidden = true;
if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "Y") { if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "Y") {
isReadOnlyList = true; isReadOnlyList = true;
} }
if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "N") { if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "N") {
isSelectElement = true; isSelectElement = true;
} }
if (parentValue.isNotEmpty && (structureElement.vALIDATIONTYPE == "D" || structureElement.vALIDATIONTYPE == "Y")) { if (parentValue.isNotEmpty && (structureElement.vALIDATIONTYPE == "D" || structureElement.vALIDATIONTYPE == "Y")) {
List parValue = getDependenciesParams(parentValue); List parValue = getDependenciesParams(parentValue);
if (parValue.isNotEmpty) { if (parValue.isNotEmpty) {
parentVal = parValue.first.ID_COLUMN_NAME; parentVal = parValue.first.ID_COLUMN_NAME;
} }
if (parentVal == null) { if (parentVal == null) {
return []; return [];
}
} }
} if (parentsList.isNotEmpty) {
if (parentsList.isNotEmpty) { if (parentValue.isNotEmpty) {
if (parentValue.isNotEmpty) { parentsList = parentsList + parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson())).toList();
parentsList = parentsList + parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson())).toList(); // parentsList.addAll(parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson())));
// parentsList.addAll(parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson()))); // parentsList.concat(parentValue);
// parentsList.concat(parentValue); }
dependenciesList = getDependenciesParams(parentsList);
} }
dependenciesList = getDependenciesParams(parentsList); return dependenciesList;
// for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) {
// String segmentId = structureList.cHILDSEGMENTSDVSplited![i];
// print("segmentId:$segmentId");
// print("segmentName:${structureList.sEGMENTNAME}");
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
// List<PARENTSEGMENTSDVSplited> parentDvRequired = parent.pARENTSEGMENTSDVSplited ?? [];
// List<PARENTSEGMENTSVSSplitedVS> parentVsRequired = parent.pARENTSEGMENTSVSSplitedVS ?? [];
//
// List<GetEITDFFStructureList> filteredList =
// getEitDffStructureList!.where((outerElement) => parentDvRequired.any((element) => outerElement.sEGMENTNAME == element.name && element.isRequired == "REQUIRED")).toList();
//
// List<Map<String, dynamic>> values = filteredList
// .map((e) => GetSetValuesRequestModel(
// sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
// .toJson())
// .toList();
// print("values:$values");
//
// ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values);
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// getEitDffStructureList![index].eSERVICESDV = defaultValue;
// }
// Utils.hideLoading(context);
// setState(() {});
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
return [];
} }
return dependenciesList;
// for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) {
// String segmentId = structureList.cHILDSEGMENTSDVSplited![i];
// print("segmentId:$segmentId");
// print("segmentName:${structureList.sEGMENTNAME}");
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
// List<PARENTSEGMENTSDVSplited> parentDvRequired = parent.pARENTSEGMENTSDVSplited ?? [];
// List<PARENTSEGMENTSVSSplitedVS> parentVsRequired = parent.pARENTSEGMENTSVSSplitedVS ?? [];
//
// List<GetEITDFFStructureList> filteredList =
// getEitDffStructureList!.where((outerElement) => parentDvRequired.any((element) => outerElement.sEGMENTNAME == element.name && element.isRequired == "REQUIRED")).toList();
//
// List<Map<String, dynamic>> values = filteredList
// .map((e) => GetSetValuesRequestModel(
// sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
// .toJson())
// .toList();
// print("values:$values");
//
// ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values);
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// getEitDffStructureList![index].eSERVICESDV = defaultValue;
// }
// Utils.hideLoading(context);
// setState(() {});
// } catch (ex) {
// Utils.hideLoading(context);
// Utils.handleException(ex, context, null);
// return [];
// }
} }
List<Map<String, dynamic>> getDependenciesParams(parentsList) { List<Map<String, dynamic>> getDependenciesParams(parentsList) {
@ -343,10 +334,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
idColName = val; idColName = val;
if (getEitDffStructureList![j].fORMATTYPE == "X") { if (getEitDffStructureList![j].fORMATTYPE == "X") {
if(!getEitDffStructureList![j].isDefaultTypeIsCDPS) { idColName = Utils.formatDateDefault(idColName!);
idColName = Utils.formatDateDefault(idColName!);
}
// commenting to test // commenting to test
// DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!); // DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!);
// idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date); // idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date);
@ -486,7 +474,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.eSERVICESDV?.pIDCOLUMNNAME ?? "", model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
isReadOnly: model.rEADONLY == "Y", isReadOnly: model.rEADONLY == "Y",
toolTip: model.rEQCOLTIP,
onChange: (text) { onChange: (text) {
model.fieldAnswer = text; model.fieldAnswer = text;
model.eSERVICESDV ??= ESERVICESDV(); model.eSERVICESDV ??= ESERVICESDV();
@ -499,8 +486,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
model.eSERVICESDV?.pIDCOLUMNNAME ?? "", model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
isReadOnly: model.rEADONLY == "Y", isReadOnly: model.rEADONLY == "Y",
isInputTypeNum: true, isInputTypeNum: true,
length: model.mAXIMUMSIZE,
toolTip: model.rEQCOLTIP,
onChange: (text) { onChange: (text) {
model.fieldAnswer = text; model.fieldAnswer = text;
model.eSERVICESDV ??= ESERVICESDV(); model.eSERVICESDV ??= ESERVICESDV();
@ -515,7 +500,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
displayText = displayText.replaceAll(" 00:00:00", ""); displayText = displayText.replaceAll(" 00:00:00", "");
} }
if (displayText.contains("/")) { if (displayText.contains("/")) {
displayText = DateFormat('yyyy-MM-dd', "en_US").format(DateFormat("yyyy/MM/dd", "en_US").parse(displayText)); displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText));
} }
} }
return DynamicTextFieldWidget( return DynamicTextFieldWidget(
@ -523,15 +508,10 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
displayText, displayText,
suffixIconData: Icons.calendar_today, suffixIconData: Icons.calendar_today,
isEnable: false, isEnable: false,
isReadOnly: model.rEADONLY == "Y",
toolTip: model.rEQCOLTIP,
onTap: () async { onTap: () async {
if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { if (getEitDffStructureList![index].isDefaultTypeIsCDPS) {
// Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) selectedDate = DateFormat("yyyy/MM/dd").parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", ""));
selectedDate = DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", ""));
// selectedDate = DateFormat("yyyy/MM/dd", "en_US").parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", ""));
} else { } else {
selectedDate = DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); selectedDate = DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
} }
@ -581,8 +561,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
displayText, displayText,
suffixIconData: Icons.calendar_today, suffixIconData: Icons.calendar_today,
toolTip: model.rEQCOLTIP,
isReadOnly: model.rEADONLY == "Y",
isEnable: false, isEnable: false,
onTap: () async { onTap: () async {
if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
@ -592,9 +570,9 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
tempDate = tempDate.replaceAll("00:00:00", '').trim(); tempDate = tempDate.replaceAll("00:00:00", '').trim();
} }
if (tempDate.contains("/")) { if (tempDate.contains("/")) {
selectedDate = DateFormat("yyyy/MM/dd", "en_US").parse(tempDate); selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate);
} else { } else {
selectedDate = DateFormat("yyyy-MM-dd", "en_US").parse(tempDate); selectedDate = DateFormat("yyyy-MM-dd").parse(tempDate);
} }
} else { } else {
selectedDate = DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); selectedDate = DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
@ -636,7 +614,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
child: DynamicTextFieldWidget( child: DynamicTextFieldWidget(
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", model.eSERVICESDV?.pVALUECOLUMNNAME ?? "",
toolTip: model.rEQCOLTIP,
isEnable: false, isEnable: false,
isPopup: true, isPopup: true,
isInputTypeNum: true, isInputTypeNum: true,
@ -681,7 +658,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", model.eSERVICESDV?.pVALUECOLUMNNAME ?? "",
isEnable: false, isEnable: false,
isPopup: true, isPopup: true,
toolTip: model.rEQCOLTIP,
isInputTypeNum: true, isInputTypeNum: true,
isReadOnly: model.rEADONLY == "Y", isReadOnly: model.rEADONLY == "Y",
).paddingOnly(bottom: 12), ).paddingOnly(bottom: 12),
@ -707,8 +683,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.eSERVICESDV?.pIDCOLUMNNAME ?? "", model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
isReadOnly: model.rEADONLY == "Y", isReadOnly: model.rEADONLY == "Y",
length: model.mAXIMUMSIZE,
toolTip: model.rEQCOLTIP,
onChange: (text) { onChange: (text) {
model.fieldAnswer = text; model.fieldAnswer = text;
}, },
@ -720,7 +694,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
displayText = displayText.replaceAll(" 00:00:00", ""); displayText = displayText.replaceAll(" 00:00:00", "");
} }
if (!displayText.contains("-")) { if (!displayText.contains("-")) {
displayText = DateFormat('yyyy-MM-dd', "en_US").format(DateFormat("yyyy/MM/dd", "en_US").parse(displayText)); displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText));
} }
} }
return DynamicTextFieldWidget( return DynamicTextFieldWidget(
@ -728,8 +702,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
displayText, displayText,
suffixIconData: Icons.calendar_today, suffixIconData: Icons.calendar_today,
isEnable: false, isEnable: false,
isReadOnly: model.rEADONLY == "Y",
toolTip: model.rEQCOLTIP,
onTap: () async { onTap: () async {
if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { if (getEitDffStructureList![index].isDefaultTypeIsCDPS) {
@ -741,7 +713,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
DateTime date = await _selectDate(context); DateTime date = await _selectDate(context);
String dateString = date.toString().split(' ').first; String dateString = date.toString().split(' ').first;
getEitDffStructureList![index].fieldAnswer = date.toString(); getEitDffStructureList![index].fieldAnswer = date.toString();
ESERVICESDV eservicesdv = ESERVICESDV( ESERVICESDV eservicesdv = ESERVICESDV(
pIDCOLUMNNAME: dateString, pIDCOLUMNNAME: dateString,
pRETURNMSG: "null", pRETURNMSG: "null",
@ -763,8 +734,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
model.eSERVICESDV?.pIDCOLUMNNAME ?? (getEitDffStructureList![index].fieldAnswer ?? ""), model.eSERVICESDV?.pIDCOLUMNNAME ?? (getEitDffStructureList![index].fieldAnswer ?? ""),
suffixIconData: Icons.access_time_filled_rounded, suffixIconData: Icons.access_time_filled_rounded,
isEnable: false, isEnable: false,
isReadOnly: model.rEADONLY == "Y",
toolTip: model.rEQCOLTIP,
onTap: () async { onTap: () async {
if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
var timeString = getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":"); var timeString = getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":");

@ -159,7 +159,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
children: [ children: [
Row( Row(
children: [ children: [
"${DateFormat("MMMM-yyyy", "en_US").format(formattedDate)}".toText16(color: MyColors.grey3AColor), "${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.grey3AColor),
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.grey3AColor), const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.grey3AColor),
], ],
).onPress( ).onPress(
@ -439,7 +439,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
expand: false, expand: false,
builder: (_, controller) { builder: (_, controller) {
dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE; dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE;
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss", "en_US").parse(dmyString); DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss").parse(dmyString);
return Column( return Column(
children: [ children: [
Container( Container(
@ -468,7 +468,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
"${DateFormat("MMMM-dd-yyyy", "en_US").format(dateTime1).replaceAll('-', " ")}".toText24(isBold: true, color: Colors.white), "${DateFormat("MMMM-dd-yyyy").format(dateTime1).replaceAll('-', " ")}".toText24(isBold: true, color: Colors.white),
LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.greyACColor), LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.greyACColor),
12.height, 12.height,
CircularStepProgressBar( CircularStepProgressBar(

@ -105,7 +105,7 @@ class _MonthlyPaySlipScreenState extends State<MonthlyPaySlipScreen> {
Container(alignment: Alignment.centerLeft, child: LocaleKeys.month.tr().toText17(isBold: true, color: MyColors.darkIconColor)), Container(alignment: Alignment.centerLeft, child: LocaleKeys.month.tr().toText17(isBold: true, color: MyColors.darkIconColor)),
Row( Row(
children: [ children: [
DateFormat("MMMM-yyyy", "en_US").format(DateFormat("MM/dd/yyyy", "en_US").parse(paySlipList[selectedMonthIndex!].pAYMENTDATE!)).toText16(color: MyColors.greyACColor), DateFormat("MMMM-yyyy").format(DateFormat("MM/dd/yyyy").parse(paySlipList[selectedMonthIndex!].pAYMENTDATE!)).toText16(color: MyColors.greyACColor),
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor),
], ],
).onPress(() async { ).onPress(() async {

@ -1,16 +1,11 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/api/profile_api_client.dart'; import 'package:mohem_flutter_app/api/profile_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_model.dart'; import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_model.dart';
@ -22,8 +17,11 @@ import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart';
import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart';
import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
import 'package:easy_localization/src/public_ext.dart';
class FamilyMemberScreenParams { class FamilyMemberScreenParams {
String? actionType; String? actionType;
@ -46,7 +44,6 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
List<GetContactDffStructureList?> getContactDffStructureList = []; List<GetContactDffStructureList?> getContactDffStructureList = [];
List<GetContactDetailsList?> getContactDetailsList = []; List<GetContactDetailsList?> getContactDetailsList = [];
SubmitContactTransactionList? submitContactTransactionList; SubmitContactTransactionList? submitContactTransactionList;
//dynamic args; //dynamic args;
FamilyMemberScreenParams? params; FamilyMemberScreenParams? params;
String? date = "MM/DD/YYYY"; String? date = "MM/DD/YYYY";
@ -113,37 +110,33 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
body: params!.flag == 1 body: params!.flag == 1
? Column( ? Column(
children: [ children: [
ListView( ListView(physics: const BouncingScrollPhysics(), padding: const EdgeInsets.all(21), children: [
physics: const BouncingScrollPhysics(), ListView.separated(
padding: const EdgeInsets.all(21), physics: const NeverScrollableScrollPhysics(),
children: [ shrinkWrap: true,
ListView.separated( itemBuilder: (BuildContext cxt, int parentIndex) {
physics: const NeverScrollableScrollPhysics(), return parseDynamicFormatTypeCols(getContactColsStructureList![parentIndex], parentIndex);
shrinkWrap: true, },
itemBuilder: (BuildContext cxt, int parentIndex) { separatorBuilder: (BuildContext cxt, int index) => 0.height,
return parseDynamicFormatTypeCols(getContactColsStructureList![parentIndex], parentIndex); itemCount: getContactColsStructureList!.length),
}, 12.height,
separatorBuilder: (BuildContext cxt, int index) => 0.height, ListView.separated(
itemCount: getContactColsStructureList!.length), physics: const NeverScrollableScrollPhysics(),
12.height, shrinkWrap: true,
ListView.separated( itemBuilder: (BuildContext cxt, int parentIndex) {
physics: const NeverScrollableScrollPhysics(), return parseDynamicFormatTypeBasicDetDff(getBasicDetDffStructureList![parentIndex], parentIndex);
shrinkWrap: true, },
itemBuilder: (BuildContext cxt, int parentIndex) { separatorBuilder: (BuildContext cxt, int index) => 0.height,
return parseDynamicFormatTypeBasicDetDff(getBasicDetDffStructureList![parentIndex], parentIndex); itemCount: getBasicDetDffStructureList!.length),
}, ListView.separated(
separatorBuilder: (BuildContext cxt, int index) => 0.height, physics: const NeverScrollableScrollPhysics(),
itemCount: getBasicDetDffStructureList!.length), shrinkWrap: true,
ListView.separated( itemBuilder: (BuildContext cxt, int parentIndex) {
physics: const NeverScrollableScrollPhysics(), return parseDynamicFormatTypeContactDff(getContactDffStructureList![parentIndex], parentIndex);
shrinkWrap: true, },
itemBuilder: (BuildContext cxt, int parentIndex) { separatorBuilder: (BuildContext cxt, int index) => 0.height,
return parseDynamicFormatTypeContactDff(getContactDffStructureList![parentIndex], parentIndex); itemCount: getContactDffStructureList!.length),
}, ],).expanded,
separatorBuilder: (BuildContext cxt, int index) => 0.height,
itemCount: getContactDffStructureList!.length),
],
).expanded,
DefaultButton(LocaleKeys.next.tr(), () async { DefaultButton(LocaleKeys.next.tr(), () async {
submitUpdateForm(); submitUpdateForm();
}).insideContainer, }).insideContainer,
@ -196,22 +189,21 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
if (model.dATATYPE == "VARCHAR2") { if (model.dATATYPE == "VARCHAR2") {
if (model!.objectValuesList?.isNotEmpty ?? false) { if (model!.objectValuesList?.isNotEmpty ?? false) {
return PopupMenuButton( return PopupMenuButton(
child: DynamicTextFieldWidget( child: DynamicTextFieldWidget(
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""), (model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "", model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
isEnable: false, isEnable: false,
isPopup: true, isPopup: true,
).paddingOnly(bottom: 12), ).paddingOnly(bottom: 12),
itemBuilder: (_) => <PopupMenuItem<int>>[ itemBuilder: (_) => <PopupMenuItem<int>>[
for (int i = 0; i < getContactColsStructureList[index]!.objectValuesList!.length; i++) for (int i = 0; i < getContactColsStructureList[index]!.objectValuesList!.length; i++)
PopupMenuItem<int>(child: Text(getContactColsStructureList[index]!.objectValuesList![i].mEANING.toString()), value: i), PopupMenuItem<int>(child: Text(getContactColsStructureList[index]!.objectValuesList![i].mEANING.toString()), value: i),
], ],
onSelected: (int popupIndex) { onSelected: (int popupIndex) {
model.getContactDetailsList!.sEGMENTVALUEDSP = getContactColsStructureList[index]!.objectValuesList![popupIndex].mEANING.toString(); model.getContactDetailsList!.sEGMENTVALUEDSP = getContactColsStructureList[index]!.objectValuesList![popupIndex].mEANING.toString();
model.getContactDetailsList!.vARCHAR2VALUE = getContactColsStructureList[index]!.objectValuesList![popupIndex].cODE.toString(); model.getContactDetailsList!.vARCHAR2VALUE = getContactColsStructureList[index]!.objectValuesList![popupIndex].cODE.toString();
setState(() {}); setState(() {});
}, },);
);
} else { } else {
return DynamicTextFieldWidget( return DynamicTextFieldWidget(
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""), (model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
@ -238,7 +230,7 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
isEnable: false, isEnable: false,
onTap: () async { onTap: () async {
DateTime dateValue = await _selectDate(context); DateTime dateValue = await _selectDate(context);
date = (DateFormat('yyyy-MM-dd', "en_US").format(dateValue)); date = (DateFormat('yyyy-MM-dd').format(dateValue));
model!.getContactDetailsList!.sEGMENTVALUEDSP = date; model!.getContactDetailsList!.sEGMENTVALUEDSP = date;
setState(() {}); setState(() {});
}, },
@ -255,23 +247,22 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
if (model!.fORMATTYPE == "C") { if (model!.fORMATTYPE == "C") {
if (model!.eSERVICESVS?.isNotEmpty ?? false) { if (model!.eSERVICESVS?.isNotEmpty ?? false) {
return PopupMenuButton( return PopupMenuButton(
child: DynamicTextFieldWidget( child: DynamicTextFieldWidget(
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.getContactDetailsList!.sEGMENTVALUEDSP ?? "", model.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
isEnable: false, isEnable: false,
isPopup: true, isPopup: true,
).paddingOnly(bottom: 12), ).paddingOnly(bottom: 12),
itemBuilder: (_) => <PopupMenuItem<int>>[ itemBuilder: (_) => <PopupMenuItem<int>>[
for (int i = 0; i < getBasicDetDffStructureList[index]!.eSERVICESVS!.length; i++) for (int i = 0; i < getBasicDetDffStructureList[index]!.eSERVICESVS!.length; i++)
PopupMenuItem<int>(child: Text(getBasicDetDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i), PopupMenuItem<int>(child: Text(getBasicDetDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i),
], ],
onSelected: (int popupIndex) { onSelected: (int popupIndex) {
model.getContactDetailsList!.sEGMENTVALUEDSP = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString(); model.getContactDetailsList!.sEGMENTVALUEDSP = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString();
model.getContactDetailsList!.vARCHAR2VALUE = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString(); model.getContactDetailsList!.vARCHAR2VALUE = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString();
setState(() {}); setState(() {});
}, },);
);
} else { } else {
return DynamicTextFieldWidget( return DynamicTextFieldWidget(
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
@ -286,7 +277,6 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.getContactDetailsList!.sEGMENTVALUEDSP ?? "", model.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
isInputTypeNum: true, isInputTypeNum: true,
length: model.mAXIMUMSIZE,
onChange: (String text) { onChange: (String text) {
model.getContactDetailsList!.sEGMENTVALUEDSP = text; model.getContactDetailsList!.sEGMENTVALUEDSP = text;
}, },
@ -299,7 +289,7 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
isEnable: false, isEnable: false,
onTap: () async { onTap: () async {
DateTime dateValue = await _selectDate(context); DateTime dateValue = await _selectDate(context);
date = (DateFormat('yyyy-MM-dd', "en_US").format(dateValue)); date = (DateFormat('yyyy-MM-dd').format(dateValue));
model!.getContactDetailsList!.sEGMENTVALUEDSP = date; model!.getContactDetailsList!.sEGMENTVALUEDSP = date;
setState(() {}); setState(() {});
}, },
@ -316,22 +306,21 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
if (model!.fORMATTYPE == "C") { if (model!.fORMATTYPE == "C") {
if (model.eSERVICESVS?.isNotEmpty ?? false) { if (model.eSERVICESVS?.isNotEmpty ?? false) {
return PopupMenuButton( return PopupMenuButton(
child: DynamicTextFieldWidget( child: DynamicTextFieldWidget(
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""), (model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "", model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
isEnable: false, isEnable: false,
isPopup: true, isPopup: true,
).paddingOnly(bottom: 12), ).paddingOnly(bottom: 12),
itemBuilder: (_) => <PopupMenuItem<int>>[ itemBuilder: (_) => <PopupMenuItem<int>>[
for (int i = 0; i < getContactDffStructureList[index]!.eSERVICESVS!.length; i++) for (int i = 0; i < getContactDffStructureList[index]!.eSERVICESVS!.length; i++)
PopupMenuItem<int>(child: Text(getContactDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i), PopupMenuItem<int>(child: Text(getContactDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i),
], ],
onSelected: (int popupIndex) { onSelected: (int popupIndex) {
model.getContactDetailsList!.sEGMENTVALUEDSP = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString(); model.getContactDetailsList!.sEGMENTVALUEDSP = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString();
model.getContactDetailsList!.vARCHAR2VALUE = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString(); model.getContactDetailsList!.vARCHAR2VALUE = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString();
setState(() {}); setState(() {});
}, },);
);
} else { } else {
return DynamicTextFieldWidget( return DynamicTextFieldWidget(
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
@ -346,7 +335,6 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.getContactDetailsList!.sEGMENTVALUEDSP ?? "", model.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
isInputTypeNum: true, isInputTypeNum: true,
length: model.mAXIMUMSIZE,
onChange: (String text) { onChange: (String text) {
model.getContactDetailsList!.sEGMENTVALUEDSP = text; model.getContactDetailsList!.sEGMENTVALUEDSP = text;
}, },
@ -359,7 +347,7 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
isEnable: false, isEnable: false,
onTap: () async { onTap: () async {
DateTime dateValue = await _selectDate(context); DateTime dateValue = await _selectDate(context);
date = (DateFormat('yyyy-MM-dd', "en_US").format(dateValue)); date = (DateFormat('yyyy-MM-dd').format(dateValue));
model!.getContactDetailsList!.sEGMENTVALUEDSP = date; model!.getContactDetailsList!.sEGMENTVALUEDSP = date;
setState(() {}); setState(() {});
}, },
@ -449,9 +437,8 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
}).toList(); }).toList();
List<Map<String, dynamic>> values3 = getContactColsStructureList!.map((e) { List<Map<String, dynamic>> values3 = getContactColsStructureList!.map((e) {
String? dateVal = ''; String? dateVal = '';
String? varChar1 = ''; dynamic? varChar1 = '';
int? numberVal; int? numberVal;
if (e!.dATATYPE == 'VARCHAR2') { if (e!.dATATYPE == 'VARCHAR2') {
dateVal = null; dateVal = null;
numberVal = null; numberVal = null;
@ -473,16 +460,12 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
}).toList(); }).toList();
List<Map<String, dynamic>> valuesFinal = [...values1, ...values2, ...values3]; List<Map<String, dynamic>> valuesFinal = [...values1, ...values2, ...values3];
Utils.showLoading(context); Utils.showLoading(context);
submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(params!.actionType!, params!.relationID, valuesFinal); submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(params!.actionType.toString(), params!.relationID, valuesFinal);
Utils.hideLoading(context); int? transactionId = submitContactTransactionList!.pTRANSACTIONID;
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, String? itemKey = submitContactTransactionList!.pITEMKEY;
arguments: RequestSubmitScreenParams(LocaleKeys.profile_familyDetails.tr(), submitContactTransactionList!.pTRANSACTIONID!, submitContactTransactionList!.pITEMKEY!, 'family_member'));
if (!AppState().cancelRequestTrancsection) {
return;
}
Utils.showLoading(context);
await LeaveBalanceApiClient().cancelHrTransaction(submitContactTransactionList!.pTRANSACTIONID!);
Utils.hideLoading(context); Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
arguments: RequestSubmitScreenParams(LocaleKeys.profile_familyDetails.tr(), transactionId!.toInt(), itemKey.toString(), 'family_member'));
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);

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

Loading…
Cancel
Save