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'
}
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: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.huawei.agconnect'
android {
compileSdkVersion 33
@ -51,33 +44,18 @@ android {
defaultConfig {
// 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
targetSdkVersion 33
targetSdkVersion 32
versionCode flutterVersionCode.toInteger()
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 {
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

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

@ -3,14 +3,12 @@ buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.huawei.agconnect:agcp:1.8.0.300'
}
}
@ -18,7 +16,6 @@ allprojects {
repositories {
google()
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": "تحقق في",
"workList": "قائمة العمل",
"leaveBalance": "رصيد الاجازات",
"businessTripBalance": "رصيد رحلة العمل",
"missingSwipes": "تسجيل بصمة حضور",
"ticketBalance": "رصيد التذكرة",
"other": "آخر",
@ -307,7 +306,6 @@
"actionBy": "الرد بواسطة",
"pending": "معلق",
"pendingTransactions": "المعاملات المعلقه",
"notices": "إشعارات",
"selectRequestType": "الرجاء اختيار نوع الطلب",
"dateFrom": "من تاريخ",
"dateTo": "الى تاريخ",
@ -482,7 +480,6 @@
"gameTime": "وقت اللعب:",
"joinMarathon": "انضم إلى ماراثون",
"joinDemoMarathon": "انضم إلى الماراثون التجريبي",
"demo":"تجريبي",
"minutes": "الدقائق",
"seconds": "ثواني",
"note": "ملحوظة:",
@ -492,11 +489,9 @@
"sponsoredBy": "برعاية:",
"question": "سؤال",
"marathoners": "الماراثون",
"marathoner": "ماراثونر",
"prize": "جائزة:",
"winnerSelection": "اختيار الفائز",
"qualifiers": "تصفيات",
"qualifier": "المؤهل",
"getReadyForContest": "استعد للمسابقة القادمة:",
"winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.",
"fingersCrossed": "تشابك الاصابع!!!",
@ -519,26 +514,7 @@
"startingIn": "يبدأ في",
"youAreOutOfContest": "أنت خارج المسابقة.",
"winners": "الفائزين!!!",
"expireAfter":"تنتهي بعد",
"oneWeek":"أسبوع 1",
"twoWeek":"2 أسبوع",
"noUpcoming": "لا يوجد قادم",
"fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية",
"noWinner": "حزين! لم يفز أحد اليوم.",
"myTeam" : "فريقي",
"youCanPlayDemo": "لكن يمكنك لعب العرض",
"qualification": "مؤهلات",
"esteblishmentName": "اسم المؤسسة",
"gradeDescription": "وصف الصف",
"type": "يكتب",
"status": "حالة",
"leaveType": "نوع الإجازة",
"attendanceType": "نوع الحضور",
"help": "يساعد",
"dear": "عزيزي",
"assistant": "للحصول على المساعدة ، يمكنك تقديم الطلب على نظام سعيد أو الاتصال بمركز الاتصال الموحد على 8310200",
"employee_leaves_calender": "تقويم أوراق الموظفين",
"view_your_leave_information": "عرض معلومات إجازتك",
"view_details": "عرض التفاصيل",
"hierarchy": "تَسَلسُل"
"noWinner": "حزين! لم يفز أحد اليوم."
}

@ -25,7 +25,6 @@
"checkIn": "Check In",
"workList": "Work List",
"leaveBalance": "Leave Balance",
"businessTripBalance": "Business Trip Balance",
"missingSwipes": "Missing Swipes",
"ticketBalance": "Ticket Balance",
"other": "Other",
@ -303,7 +302,6 @@
"topic": "Topic",
"actionBy": "Action By",
"pendingTransactions": "Pending Transactions",
"notices": "Notices",
"selectRequestType": "Please select request type",
"dateFrom": "Date From",
"dateTo": "Date To",
@ -426,7 +424,7 @@
"typeCurrentPasswordBelow": "Type Your Current password below",
"currentPassword": "Current password",
"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",
"SelectChangeWantToMake": "Select the type of change you want to make",
"profile": {
@ -471,7 +469,6 @@
"gameTime": "Game Time:",
"joinMarathon": "Join Marathon",
"joinDemoMarathon": "Join Demo Marathon",
"demo": "Demo",
"minutes": "Minutes",
"seconds": "Seconds",
"note": "Note:",
@ -481,7 +478,6 @@
"sponsoredBy": "Sponsored By:",
"question": "Question",
"marathoners": "Marathoners",
"marathoner": "Marathoner",
"prize": "Prize:",
"advancedSearch": "Advanced Search",
"openNot": "Open Notifications",
@ -496,7 +492,6 @@
"none": "None",
"winnerSelection": "Winner Selection",
"qualifiers": "Qualifiers",
"qualifier": "Qualifier",
"getReadyForContest": "Get Ready for the coming contest:",
"winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.",
"fingersCrossed": "Fingers Crossed!!!",
@ -510,8 +505,8 @@
"favorite": "My Favorites",
"searchfromchat": "Search from chat",
"yourAnswerCorrect": "Your answer is correct",
"youMissedTheQuestion": "You ran out of time. 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 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 and as a viewer.",
"oops": "Ooopsss!!!!",
"winner": "WINNER",
"youWantToLeaveMarathon": "Are you sure you want to go back? You will be out of the contest.",
@ -519,27 +514,7 @@
"startingIn": "Starting in",
"youAreOutOfContest": "You are out of the contest.",
"winners": "WINNERS!!!",
"expireAfter": "Expires After",
"oneWeek": "1 Week",
"twoWeek": "2 Week",
"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.",
"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"
"noWinner": "Sad! No one won today."
}

@ -1,8 +1,5 @@
import UIKit
import Flutter
import Firebase
import flutter_local_notifications
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
@ -10,13 +7,6 @@ import flutter_local_notifications
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> 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)
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">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
@ -22,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>MOHEMM</string>
<string>mohem_flutter_app</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@ -42,7 +33,7 @@
<key>NFCReaderUsageDescription</key>
<string>This App requires access to NFC to mark your attendance.</string>
<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>
<string>This app requires Face ID to allow biometric authentication for app login.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
@ -57,11 +48,8 @@
<string>This app requires microphone access to for call.</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
@ -81,15 +69,13 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<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>
<array>
<string>TAG</string>
</array>
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>0000</string>
</array>
</dict>
</plist>

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

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

@ -32,7 +32,7 @@ class ItemsForSaleApiClient {
getSaleCategoriesListObj.titleAr = "الجميع";
getSaleCategoriesListObj.isActive = true;
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);

@ -88,10 +88,7 @@ class LoginApiClient {
AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEMAILADDRESS;
AppState().postParamsObject?.pSessionId = responseData.pSESSIONID;
AppState().postParamsObject?.pUserName = AppState().getUserName;
//TODO: employee id changed in SRCA instead of username
// AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName;
//TODO: need to fix emp number
AppState().postParamsObject?.pSelectedEmployeeNumber = responseData.memberInformationList!.first.eMPLOYEENUMBER;
AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName;
AppState().postParamsObject?.setPLegislationCode = responseData.basicMemberInformation!.pLEGISLATIONCODE;
AppState().postParamsObject?.setPayrollCodeStr = responseData.memberInformationList!.first.pAYROLLCODE;
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/ui/marathon/marathon_provider.dart';
import 'package:provider/provider.dart';
import 'package:signalr_netcore/hub_connection.dart';
class MarathonApiClient {
late HubConnection hubConnection;
L.Logger logger = L.Logger();
Future<String> getMarathonToken() async {
@ -27,6 +29,7 @@ class MarathonApiClient {
(json) {
MarathonGenericModel marathonModel = MarathonGenericModel.fromJson(json);
AppState().setMarathonToken = marathonModel.data["token"] ?? "";
print("marathonToken: ${"AppState(): ${AppState().getMarathonToken}"}");
return marathonModel.data["token"] ?? "";
},
ApiConsts.marathonParticipantLoginUrl,
@ -182,7 +185,6 @@ class MarathonApiClient {
return null;
}
// late HubConnection hubConnection;
// Future<void> buildHubConnection(BuildContext context, String prizeId) async {
// HttpConnectionOptions httpOptions = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
// hubConnection = HubConnectionBuilder()

@ -1,13 +1,14 @@
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/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/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_time_card_summary_list_model.dart';
import 'package:mohem_flutter_app/api/api_client.dart';
class MonthlyAttendanceApiClient {
static final MonthlyAttendanceApiClient _instance = MonthlyAttendanceApiClient._internal();
@ -51,24 +52,6 @@ class MonthlyAttendanceApiClient {
}, 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 {
String url = "${ApiConsts.erpRest}GET_SCHEDULE_SHIFTS_DETAILS";
@ -83,4 +66,5 @@ class MonthlyAttendanceApiClient {
return (responseData.getScheduleShiftsDetailsList?.length ?? 0) > 0 ? responseData.getScheduleShiftsDetailsList!.first : null;
}, url, postParams);
}
}
}

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
@ -75,14 +74,6 @@ class MyAttendanceApiClient {
};
postParams.addAll(AppState().postParamsJson);
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) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson());

@ -16,9 +16,9 @@ class MyRequestsApiClient {
factory MyRequestsApiClient() => _instance;
Future<List<GetConcurrentProgramsModel>> getConcurrentPrograms(int id) async {
Future<List<GetConcurrentProgramsModel>> getConcurrentPrograms() async {
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);
return await ApiClient().postJsonForObject((json) {
@ -60,28 +60,30 @@ class MyRequestsApiClient {
}, 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";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"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["EITTransactionTBL"] = list;
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData;
return responseData.submitCcpTransactionList;
}, 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";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"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);
@ -91,4 +93,5 @@ class MyRequestsApiClient {
return responseData.getCCPTransactionsModel ?? [];
}, url, postParams);
}
}

@ -17,7 +17,7 @@ class OffersAndDiscountsApiClient {
List<GetCategoriesList> getSaleCategoriesList = [];
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);
return await ApiClient().postJsonForObject(
@ -30,7 +30,7 @@ class OffersAndDiscountsApiClient {
getSaleCategoriesListObj.categoryNameAr = "الجميع";
getSaleCategoriesListObj.isActive = true;
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);
@ -55,12 +55,12 @@ class OffersAndDiscountsApiClient {
(response) {
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) {
getSaleCategoriesList.add(OffersListModel.fromJson(v));
});
getSaleCategoriesList.add(OffersListModel.fromJson(v));
});
}
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_contacts.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/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_details_list.dart';
import 'package:mohem_flutter_app/models/profile/get_countries_list_model.dart';
@ -60,19 +58,6 @@ class ProfileApiClient {
}, 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 {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_PHONES";
Map<String, dynamic> postParams = {
@ -418,19 +403,4 @@ class ProfileApiClient {
return responseData.getPerformanceAppraisalList ?? [];
}, 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);
}
Future<MemberInformationListModel> getUserInformation(int pSelectedResopID, String selectedEmployeeNumber, String noficationId) async {
String url = "${ApiConsts.erpRest}Get_Notification_UserInformation";
Future<MemberInformationListModel> getUserInformation(int pSelectedResopID, String selectedEmployeeNumber) async {
String url = "${ApiConsts.erpRest}Get_UserInformation";
Map<String, dynamic> postParams = {
"P_SELECTED_RESP_ID": pSelectedResopID,
"P_PAGE_LIMIT": 100,
"P_PAGE_NUM": 1,
"P_NOTIFICATION_ID": noficationId,
};
postParams.addAll(AppState().postParamsJson);
if (selectedEmployeeNumber != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber;
@ -414,7 +413,7 @@ class WorkListApiClient {
"EmployeeNumber": employeeNumber,
"Comments": "",
"AdditionalFields": null,
"NewUserEMPId": newUserEMPId
"NewUserEMPId":newUserEMPId
};
postParams.addAll(AppState().postParamsJson);
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/worklist_response_model.dart';
class AppState {
static final AppState _instance = AppState._internal();
@ -20,12 +17,6 @@ class AppState {
factory AppState() => _instance;
String? deviceToken = "";
set setDeviceToken(v) => deviceToken = v;
String? get getDeviceToken => deviceToken;
bool isAuthenticated = false;
set setIsAuthenticated(v) => isAuthenticated = v;
@ -73,25 +64,7 @@ class AppState {
String? get getMarathonProjectId => _projectID;
bool _isDemoMarathon = false;
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");
final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 3.8, mobileType: Platform.isAndroid ? "android" : "ios");
void setPostParamsInitConfig() {
isAuthenticated = false;
@ -192,6 +165,4 @@ class AppState {
set setemployeeSubordinatesList(List<GetEmployeeSubordinatesList> employeeSubordinatesList) {
_employeeSubordinatesList = employeeSubordinatesList;
}
bool cancelRequestTrancsection = true;
}

@ -6,8 +6,8 @@ class MyColors {
static const Color darkTextColor = Color(0xff2B353E);
static const Color normalTextColor = Color(0xff5A5A5A);
static const Color lightTextColor = Color(0xffBFBFBF);
static const Color gradiantStartColor = Color(0xff259db7);
static const Color gradiantEndColor = Color(0xff33c0a5);
static const Color gradiantStartColor = Color(0xff33c0a5);
static const Color gradiantEndColor = Color(0xff259db7);
static const Color textMixColor = Color(0xff2BB8A6);
static const Color backgroundColor = Color(0xffF8F8F8);
static const Color grey41Color = Color(0xff414141);
@ -30,7 +30,7 @@ class MyColors {
static const Color darkWhiteColor = Color(0xffE0E0E0);
static const Color redColor = Color(0xffD02127);
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 orange = Color(0xFFCC9B14);
static const Color yellowFavColor = Color(0xffEAC321);
@ -41,7 +41,6 @@ class MyColors {
static const Color borderColor = Color(0xffE8E8E8);
static const Color borderE3Color = Color(0xffE3E3E3);
static const Color borderCEColor = Color(0xffCECECE);
//static const Color grey67Color = Color(0xff676767);
static const Color whiteColor = Color(0xFFEEEEEE);
static const Color greenColor = Color(0xff1FA269);
@ -56,7 +55,7 @@ class MyColors {
static const Color lightGreyColor = Color(0xffC7C7C7);
static const Color green69Color = Color(0xff1FA169);
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 greyC4Color = Color(0xffC4C4C4);
static const Color grey35Color = Color(0xff535353);

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

@ -60,13 +60,13 @@ class DateUtil {
}
}
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;
}
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) {
@ -123,7 +123,7 @@ class DateUtil {
}
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) {
@ -419,7 +419,7 @@ class DateUtil {
/// [dateTime] convert DateTime to data formatted
static String getDayMonthDateFormatted(DateTime dateTime) {
if (dateTime != null)
return DateFormat('dd/MM', "en_US").format(dateTime);
return DateFormat('dd/MM').format(dateTime);
else
return "";
}
@ -466,7 +466,7 @@ class DateUtil {
/// [dateTime] convert DateTime to data formatted
static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) {
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
return "";
}
@ -491,11 +491,11 @@ class DateUtil {
}
static String getFormattedDate(DateTime dateTime, String formattedString) {
return DateFormat(formattedString, "en_US").format(dateTime);
return DateFormat(formattedString).format(dateTime);
}
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) {

@ -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_svg/flutter_svg.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/classes/colors.dart';
import 'package:mohem_flutter_app/config/routes.dart';
@ -99,8 +98,7 @@ class Utils {
static void handleException(dynamic exception, cxt, Function(String)? onErrorMessage) {
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);
} else {
if (exception is APIException) {
@ -117,14 +115,12 @@ class Utils {
} else {
if (!AppState().isAuthenticated) {
showDialog(
barrierDismissible: false,
context: cxt,
builder: (cxt) => ConfirmDialog(
message: errorMessage,
onTap: () {
Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route<dynamic> route) => false);
},
onCloseTap: () {},
),
);
} else {
@ -268,7 +264,7 @@ class Utils {
static String getMonthNamedFormat(DateTime date) {
/// 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) {
@ -337,17 +333,10 @@ class Utils {
}
return date;
} else {
if(date.toLowerCase().split("-").length == 1 && date.contains("/")) {
return reverseFormatDate(date);
}
else
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 {
if(date.contains(" ")) {
date = date.split(" ").first;
}
return DateFormat('dd-MM-yyyy', "en_US").format(DateFormat('yyyy-MM-dd', "en_US").parseLoose(date));
return DateFormat('dd-MM-yyyy').format(DateFormat('yyyy-MM-dd').parseLoose(date));
}
// return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MM-yyyy').parseLoose(date));
}
@ -399,15 +388,4 @@ class Utils {
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: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/moe_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/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_basic_details_screen.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/profile_screen.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 appUpdateScreen = "/appUpdateScreen";
static const String help = "/help";
static const String hierarchy = "/hierarchy";
static final Map<String, WidgetBuilder> routes = {
login: (BuildContext context) => LoginScreen(),
@ -231,8 +226,7 @@ class AppRoutes {
// addWorkFromHome: (BuildContext context) => AddWorkFromHomeScreen(),
profile: (BuildContext context) => ProfileScreen(),
//Attendance
// monthlyAttendance: (BuildContext context) => MonthlyAttendanceScreen(),
monthlyAttendance: (BuildContext context) => MoeMonthlyAttendanceScreen(),
monthlyAttendance: (BuildContext context) => MonthlyAttendanceScreen(),
vacationRule: (BuildContext context) => VacationRuleScreen(),
addVacationRule: (BuildContext context) => AddVacationRuleScreen(),
@ -309,7 +303,5 @@ class AppRoutes {
unsafeDeviceScreen: (BuildContext context) => const UnsafeDeviceScreen(),
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/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/otp_widget.dart';
import 'package:sizer/sizer.dart';
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(" ") : "";
}
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 {
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(
this,
maxLines: maxlines,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: color ?? MyColors.darkTextColor,
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),
);
Widget toText24({Color? color, bool isBold = false, bool isCentered = false}) => Text(
Widget toText24({Color? color, bool isBold = false}) => Text(
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),
);
Widget toText30({Color? color, bool isBold = false, bool isCentered = false}) => Text(
Widget toText30({Color? color, bool isBold = false}) => Text(
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),
);
@ -222,7 +210,7 @@ extension EmailValidator on String {
String date = this.split("T")[0];
String time = this.split("T")[1];
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) {

File diff suppressed because it is too large Load Diff

@ -27,7 +27,6 @@ abstract class LocaleKeys {
static const checkIn = 'checkIn';
static const workList = 'workList';
static const leaveBalance = 'leaveBalance';
static const businessTripBalance = 'businessTripBalance';
static const missingSwipes = 'missingSwipes';
static const ticketBalance = 'ticketBalance';
static const services = 'services';
@ -467,7 +466,6 @@ abstract class LocaleKeys {
static const gameTime = 'gameTime';
static const joinMarathon = 'joinMarathon';
static const joinDemoMarathon = 'joinDemoMarathon';
static const demo = 'demo';
static const minutes = 'minutes';
static const seconds = 'seconds';
static const note = 'note';
@ -477,11 +475,9 @@ abstract class LocaleKeys {
static const sponsoredBy = 'sponsoredBy';
static const question = 'question';
static const marathoners = 'marathoners';
static const marathoner = 'marathoner';
static const prize = 'prize';
static const winnerSelection = 'winnerSelection';
static const qualifiers = 'qualifiers';
static const qualifier = 'qualifier';
static const getReadyForContest = 'getReadyForContest';
static const winnerSelectedRandomly = 'winnerSelectedRandomly';
static const fingersCrossed = 'fingersCrossed';
@ -504,30 +500,8 @@ abstract class LocaleKeys {
static const startingIn = 'startingIn';
static const youAreOutOfContest = 'youAreOutOfContest';
static const winners = 'winners';
static const expireAfter = 'expireAfter';
static const oneWeek = 'oneWeek';
static const twoWeek = 'twoWeek';
static const noUpcoming = 'noUpcoming';
static const fakeLocation = 'fakeLocation';
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: 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:firebase_core_web/firebase_core_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:google_maps_flutter_web/google_maps_flutter_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:url_launcher_web/url_launcher_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
void registerPlugins(Registrar registrar) {
AudioSessionWeb.registerWith(registrar);
CameraPlugin.registerWith(registrar);
FilePickerWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FirebaseMessagingWeb.registerWith(registrar);
@ -34,8 +28,6 @@ void registerPlugins(Registrar registrar) {
GeolocatorPlugin.registerWith(registrar);
GoogleMapsPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
JustAudioPlugin.registerWith(registrar);
RecordPluginWeb.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);

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

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

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

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

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

@ -1,6 +1,6 @@
class GetMobileLoginInfoListModel {
int? iD;
String? employeeID;
int? employeeID;
int? channelID;
int? companyID;
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? currencyCode;
String? startDate;
DateTime? endDate;
String? endDate;
int? quotePrice;
int? employeeNumber;
String? profilePicture;
@ -29,32 +29,32 @@ class EmployeePostedAds {
EmployeePostedAds(
{this.itemSaleID,
this.title,
this.titleAr,
this.description,
this.descriptionAr,
this.categoryID,
this.categoryTitle,
this.regionID,
this.regionName,
this.countryName,
this.currencyCode,
this.startDate,
this.endDate,
this.quotePrice,
this.employeeNumber,
this.profilePicture,
this.fullName,
this.emailAddress,
this.mobileNumber,
this.isApproved,
this.status,
this.itemAttachments,
this.created,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
this.title,
this.titleAr,
this.description,
this.descriptionAr,
this.categoryID,
this.categoryTitle,
this.regionID,
this.regionName,
this.countryName,
this.currencyCode,
this.startDate,
this.endDate,
this.quotePrice,
this.employeeNumber,
this.profilePicture,
this.fullName,
this.emailAddress,
this.mobileNumber,
this.isApproved,
this.status,
this.itemAttachments,
this.created,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
EmployeePostedAds.fromJson(Map<String, dynamic> json) {
itemSaleID = json['itemSaleID'];
@ -115,7 +115,8 @@ class EmployeePostedAds {
data['isApproved'] = this.isApproved;
data['status'] = this.status;
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['isActive'] = this.isActive;
@ -137,7 +138,16 @@ class ItemAttachments {
String? content;
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) {
attachmentId = json['attachmentId'];

@ -9,8 +9,16 @@ class ItemReviewModel {
num? itemPrice;
List<String>? itemPhotos;
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> data = new Map<String, dynamic>();
@ -21,7 +29,7 @@ class ItemReviewModel {
data['itemPrice'] = this.itemPrice;
data['itemPhotos'] = this.itemPhotos;
data['selectedSaleCategory'] = this.selectedSaleCategory;
data['endDate'] = this.endDate;
return data;
}
}

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

@ -1,192 +1,96 @@
class OffersListModel {
int? offersDiscountId;
String? titleEn;
String? titleAr;
String? descriptionEn;
String? descriptionAr;
String? title;
String? titleAR;
String? description;
String? descriptionAR;
String? startDate;
String? endDate;
int? categoryId;
String? logo;
String? bannerImage;
String? discount;
String? rowID;
String? categoryNameEn;
String? categoryNameAr;
String? discount;
String? location;
int? statusId;
String? statusTitle;
bool? isHasLocation;
String? discountDescription;
String? websiteUrl;
bool? bookMarked;
bool? isHotDeal;
List<OffersDiscountImageColl>? offersDiscountImageColl;
dynamic locationList;
String? categoryID;
String? isHasLocation;
String? created;
String? bannerImage;
String? logo;
bool? isActive;
int? pageSize;
int? pageNo;
int? languageId;
String? publishedDesc;
String? published;
String? expireAfter;
String? status;
String? isActive;
String? totalItems;
OffersListModel(
{this.offersDiscountId,
this.titleEn,
this.titleAr,
this.descriptionEn,
this.descriptionAr,
this.startDate,
this.endDate,
this.categoryId,
this.categoryNameEn,
this.categoryNameAr,
this.discount,
this.location,
this.statusId,
this.statusTitle,
this.isHasLocation,
this.discountDescription,
this.websiteUrl,
this.bookMarked,
this.isHotDeal,
this.offersDiscountImageColl,
this.locationList,
this.created,
this.bannerImage,
this.logo,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId});
{this.title,
this.titleAR,
this.description,
this.descriptionAR,
this.startDate,
this.endDate,
this.logo,
this.bannerImage,
this.discount,
this.rowID,
this.categoryNameEn,
this.categoryNameAr,
this.categoryID,
this.isHasLocation,
this.created,
this.publishedDesc,
this.published,
this.expireAfter,
this.status,
this.isActive,
this.totalItems});
OffersListModel.fromJson(Map<String, dynamic> json) {
offersDiscountId = json['offersDiscountId'];
titleEn = json['titleEn'];
titleAr = json['titleAr'];
descriptionEn = json['descriptionEn'];
descriptionAr = json['descriptionAr'];
startDate = json['startDate'];
endDate = json['endDate'];
categoryId = json['categoryId'];
title = json['Title'];
titleAR = json['Title_AR'];
description = json['Description'];
descriptionAR = json['Description_AR'];
startDate = json['Start Date'];
endDate = json['End Date'];
logo = json['Logo'];
bannerImage = json['Banner_Image'];
discount = json['Discount'];
rowID = json['rowID'];
categoryNameEn = json['categoryName_en'];
categoryNameAr = json['categoryName_ar'];
discount = json['discount'];
location = json['location'];
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'];
categoryID = json['categoryID'];
isHasLocation = json['IsHasLocation'];
created = json['created'];
bannerImage = json['banner_Image'];
logo = json['logo'];
isActive = json['isActive'];
pageSize = json['pageSize'];
pageNo = json['pageNo'];
languageId = json['languageId'];
publishedDesc = json['PublishedDesc'];
published = json['Published'];
expireAfter = json['ExpireAfter'];
status = json['Status'];
isActive = json['IsActive'];
totalItems = json['TotalItems'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['offersDiscountId'] = this.offersDiscountId;
data['titleEn'] = this.titleEn;
data['titleAr'] = this.titleAr;
data['descriptionEn'] = this.descriptionEn;
data['descriptionAr'] = this.descriptionAr;
data['startDate'] = this.startDate;
data['endDate'] = this.endDate;
data['categoryId'] = this.categoryId;
data['Title'] = this.title;
data['Title_AR'] = this.titleAR;
data['Description'] = this.description;
data['Description_AR'] = this.descriptionAR;
data['Start Date'] = this.startDate;
data['End Date'] = this.endDate;
data['Logo'] = this.logo;
data['Banner_Image'] = this.bannerImage;
data['Discount'] = this.discount;
data['rowID'] = this.rowID;
data['categoryName_en'] = this.categoryNameEn;
data['categoryName_ar'] = this.categoryNameAr;
data['discount'] = this.discount;
data['location'] = this.location;
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['categoryID'] = this.categoryID;
data['IsHasLocation'] = this.isHasLocation;
data['created'] = this.created;
data['banner_Image'] = this.bannerImage;
data['logo'] = this.logo;
data['isActive'] = this.isActive;
data['pageSize'] = this.pageSize;
data['pageNo'] = this.pageNo;
data['languageId'] = this.languageId;
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;
data['PublishedDesc'] = this.publishedDesc;
data['Published'] = this.published;
data['ExpireAfter'] = this.expireAfter;
data['Status'] = this.status;
data['IsActive'] = this.isActive;
data['TotalItems'] = this.totalItems;
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:io';
import 'dart:typed_data';
import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:easy_localization/easy_localization.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/encryption.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/models/chat/chat_user_image_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/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/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
import 'package:mohem_flutter_app/widgets/image_picker.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/signalr_client.dart';
import 'package:uuid/uuid.dart';
import 'package:flutter/material.dart' as Material;
class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
ScrollController scrollController = ScrollController();
@ -68,19 +66,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
List<ChatUser> teamMembersList = [];
Material.TextDirection textDirection = Material.TextDirection.ltr;
bool isRTL = false;
String msgText = "";
//Chat Home Page Counter
int chatUConvCounter = 0;
/// Search Provider
List<ChatUser>? chatUsersList = [];
int pageNo = 1;
bool disbaleChatForThisUser = false;
Future<void> getUserAutoLoginToken() async {
userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
if (userLoginResponse.response != null) {
@ -90,8 +78,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Utils.showToast(
userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr",
);
disbaleChatForThisUser = true;
notifyListeners();
}
}
@ -109,7 +95,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
HubConnection hub;
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
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();
return hub;
}
@ -123,18 +109,27 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
// chatHubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
chatHubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
chatHubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus);
if (kDebugMode) {
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 favUList = await ChatApiClient().getFavUsers();
if (favUList.response != null && recentChat.response != null) {
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 favUser in favUList.response!) {
if (user.id == favUser.id) {
@ -144,10 +139,16 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
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;
isLoading = false;
await invokeUserChatHistoryNotDeliveredAsync(userId: int.parse(AppState().chatDetails!.response!.id.toString()));
await invokeUserChatHistoryNotDeliveredAsync(
userId: int.parse(
AppState().chatDetails!.response!.id.toString(),
),
);
sort();
notifyListeners();
if (searchedChats!.isNotEmpty || favUsersList.isNotEmpty) {
@ -170,7 +171,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (response.statusCode == 204) {
if (isNewChat) {
userChatHistory = [];
} else if (loadMore) {}
} else if (loadMore) {
Utils.showToast("No More Data To Load");
}
} else {
if (loadMore) {
List<SingleUserChatModel> temp = getSingleUserChatModel(response.body).reversed.toList();
@ -326,14 +329,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
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();
}
@ -919,12 +914,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
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);
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);
if (favoriteChatUser.response != null) {
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();
}
@ -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();
}
@ -1014,25 +984,23 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
void disposeData() {
if (!disbaleChatForThisUser) {
search.clear();
isChatScreenActive = false;
receiverID = 0;
paginationVal = 0;
message.text = '';
isTextMsg = false;
isAttachmentMsg = false;
isVoiceMsg = false;
isReplyMsg = false;
repliedMsg = [];
sFileType = "";
deleteData();
favUsersList.clear();
searchedChats?.clear();
pChatHistory?.clear();
chatHubConnection.stop();
AppState().chatDetails = null;
}
search.clear();
isChatScreenActive = false;
receiverID = 0;
paginationVal = 0;
message.text = '';
isTextMsg = false;
isAttachmentMsg = false;
isVoiceMsg = false;
isReplyMsg = false;
repliedMsg = [];
sFileType = "";
deleteData();
favUsersList.clear();
searchedChats?.clear();
pChatHistory?.clear();
chatHubConnection.stop();
AppState().chatDetails = null;
}
void deleteData() {
@ -1203,42 +1171,19 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
playerController.dispose();
}
void startRecoding(BuildContext context) async {
await Permission.microphone.request().then((PermissionStatus status) {
if (status.isPermanentlyDenied) {
Utils.confirmDialog(
context,
"The app needs microphone access to be able to record audio.",
onTap: () {
Navigator.of(context).pop();
openAppSettings();
},
);
} else if (status.isDenied) {
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();
void startRecoding() async {
PermissionStatus status = await Permission.microphone.request();
if (status.isDenied == true) {
startRecoding();
} else {
isVoiceMsg = true;
recorderController.reset();
await recorderController.record(path);
_recodeDuration = 0;
_startTimer();
isRecoding = !isRecoding;
notifyListeners();
}
}
Future<void> _startTimer() async {
@ -1313,23 +1258,15 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
return numberStr;
}
Future<File> downChatVoice(Uint8List bytes, String ext, SingleUserChatModel data) async {
File file;
try {
String dirPath = '${(await getApplicationDocumentsDirectory()).path}/chat_audios';
if (!await Directory(dirPath).exists()) {
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("");
Future<String> downChatVoice(Uint8List bytes, String ext, SingleUserChatModel data) async {
String dirPath = '${(await getApplicationDocumentsDirectory()).path}/chat_audios';
if (!await Directory(dirPath).exists()) {
await Directory(dirPath).create();
await File('$dirPath/.nomedia').create();
}
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) {
@ -1351,127 +1288,51 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
teamMembersList = [];
isLoading = true;
if (AppState().getemployeeSubordinatesList.isNotEmpty) {
print("=============== In App State =====================");
getEmployeeSubordinatesList = AppState().getemployeeSubordinatesList;
for (GetEmployeeSubordinatesList element in getEmployeeSubordinatesList) {
if (element.eMPLOYEEEMAILADDRESS != null) {
if (element.eMPLOYEEEMAILADDRESS!.isNotEmpty) {
teamMembersList.add(
ChatUser(
id: int.parse(element.eMPLOYEENUMBER!),
email: element.eMPLOYEEEMAILADDRESS,
userName: element.eMPLOYEENAME,
phone: element.eMPLOYEEMOBILENUMBER,
userStatus: 0,
unreadMessageCount: 0,
isFav: false,
isTyping: false,
isImageLoading: false,
image: element.eMPLOYEEIMAGE ?? "",
isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
userLocalDownlaodedImage: element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!),
),
);
}
}
print(element.eMPLOYEEEMAILADDRESS);
teamMembersList.add(
ChatUser(
id: int.parse(element.eMPLOYEENUMBER!),
email: element.eMPLOYEEEMAILADDRESS,
userName: element.eMPLOYEENAME,
phone: element.eMPLOYEEMOBILENUMBER,
userStatus: 0,
unreadMessageCount: 0,
isFav: false,
isTyping: false,
isImageLoading: false,
image: element.eMPLOYEEIMAGE ?? "",
isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
userLocalDownlaodedImage:element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!),
),
);
}
} else {
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates("", "", "");
AppState().setemployeeSubordinatesList = getEmployeeSubordinatesList;
for (GetEmployeeSubordinatesList element in getEmployeeSubordinatesList) {
if (element.eMPLOYEEEMAILADDRESS != null) {
if (element.eMPLOYEEEMAILADDRESS!.isNotEmpty) {
teamMembersList.add(
ChatUser(
id: int.parse(element.eMPLOYEENUMBER!),
email: element.eMPLOYEEEMAILADDRESS,
userName: element.eMPLOYEENAME,
phone: element.eMPLOYEEMOBILENUMBER,
userStatus: 0,
unreadMessageCount: 0,
isFav: false,
isTyping: false,
isImageLoading: false,
image: element.eMPLOYEEIMAGE ?? "",
isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
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;
}
print(element.eMPLOYEEEMAILADDRESS);
teamMembersList.add(
ChatUser(
id: int.parse(element.eMPLOYEENUMBER!),
email: element.eMPLOYEEEMAILADDRESS,
userName: element.eMPLOYEENAME,
phone: element.eMPLOYEEMOBILENUMBER,
userStatus: 0,
unreadMessageCount: 0,
isFav: false,
isTyping: false,
isImageLoading: false,
image: element.eMPLOYEEIMAGE ?? "",
isImageLoaded: element.eMPLOYEEIMAGE == null ? false : true,
userLocalDownlaodedImage: element.eMPLOYEEIMAGE == null ? null : await downloadImageLocal(element.eMPLOYEEIMAGE ?? "", element.eMPLOYEENUMBER!),
),
);
}
}
isLoading = false;
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/app_state/app_state.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/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/main.dart';
@ -41,23 +40,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
bool isMissingSwipeLoading = true;
int missingSwipeCounter = 0;
bool isMyRequestLoading = true;
ListMenu? myRequest;
//Leave and Ticket Balance
bool isLeaveTicketBalanceLoading = true;
List<GetAccrualBalancesList>? accrualList;
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;
//Menu Entries
@ -98,19 +86,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isWorkListLoading = true;
workListCounter = 0;
isMyRequestLoading = true;
myRequest = null;
isMissingSwipeLoading = true;
missingSwipeCounter = 0;
isWorkListLoading = true;
isLeaveTicketBalanceLoading = true;
accrualList = null;
leaveBalanceAccrual = null;
oldLeaveBalanceAccrual = null;
businessTripAccrual = null;
ticketBalance = 0;
isServicesMenusLoading = true;
@ -120,13 +101,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
getOffersList = [];
drawerMenuItemList = [
DrawerMenuItem("assets/images/drawer/profile_icon.png", LocaleKeys.myProfile.tr(), AppRoutes.profile),
// 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/notices.png", LocaleKeys.notices.tr(), AppRoutes.pendingTransactions),
// // 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/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile),
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/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions),
// DrawerMenuItem("assets/images/drawer/drawer_marathon.svg", LocaleKeys.brainMarathon.tr(), AppRoutes.marathonIntroScreen),
DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), AppRoutes.changePassword),
];
notifyListeners();
@ -158,17 +138,15 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
getOpenNotificationsList = genericResponseModel?.getOpenNotificationsList;
workListCounter = genericResponseModel?.pOPENNTFNUMBER ?? 0;
if (env.itg) itgFormsModel = await DashboardApiClient().getItgFormsPendingTask();
itgFormsModel = await DashboardApiClient().getItgFormsPendingTask();
workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0);
if (env.itg) {
GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications();
cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem;
if (cocCount != null) {
cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0);
workListCounter += cocFinalCount;
}
GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications();
cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem;
if (cocCount != null) {
cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0);
workListCounter += cocFinalCount;
}
if (showLoading) Utils.hideLoading(context);
notifyListeners();
} catch (ex) {
@ -209,13 +187,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
//Leave and Ticket Balance API's & Methods
Future fetchLeaveTicketBalance(context, DateTime date) async {
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;
leaveBalanceAccrual = accrualList!.singleWhere((element) => element.accuralPlanName == 'Annual Vacation Accrual' || element.accuralPlanName == "خطة استحقاق الاجازة الاعتيادية", orElse: null);
oldLeaveBalanceAccrual = accrualList!.singleWhere((element) => element.accuralPlanName == 'Old Leave Balance' || element.accuralPlanName == "خطة فصل الارصدة 1439", orElse: null);
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);
leaveBalanceAccrual = accrualList![0];
ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0);
notifyListeners();
} catch (ex) {
isLeaveTicketBalanceLoading = false;
@ -232,19 +207,17 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void fetchListMenu() async {
try {
List<ListMenu> menuList = await DashboardApiClient().getListMenu();
for (var menu in menuList) {
if (menu.menuType == "E") {
myRequest = menu;
} else if (menu.menuType == "M") {
AppState().setempStatusIsManager = true;
drawerMenuItemList.add(DrawerMenuItem("assets/images/drawer/my_team_icon.png", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam));
}
List findMyRequest = menuList.where((element) => element.menuType == "E").toList();
if (findMyRequest.isNotEmpty) {
drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myRequests));
}
List findMyTeam = menuList.where((element) => element.menuType == "M").toList();
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) {
logger.wtf(ex);
notifyListeners();
Utils.handleException(ex, null, null);
}
}
@ -255,14 +228,9 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
GenericResponseModel? genericResponseModel = await DashboardApiClient().getGetMenuEntries();
getMenuEntriesList = genericResponseModel!.getMenuEntriesList;
homeMenus = parseMenus(getMenuEntriesList ?? []);
if (homeMenus!.isNotEmpty) {
if (env.dashboard.monthlyAttendance) {
homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr()));
}
if (env.dashboard.vocationRules) {
homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.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()));
}
isServicesMenusLoading = false;
notifyListeners();
@ -276,7 +244,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void getCategoryOffersListAPI(BuildContext context) async {
try {
// Utils.showLoading(context);
getOffersList = await OffersAndDiscountsApiClient().getOffersList(0, 10);
getOffersList = await OffersAndDiscountsApiClient().getOffersList(0, 6);
isOffersLoading = false;
notifyListeners();
} catch (ex) {
@ -300,7 +268,6 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
MohemmItgResponseItem? res = await DashboardApiClient().getITGPageNotification();
return res;
}
void notify() {
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,
builder: (_, controller) {
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(
children: [
Container(

@ -140,7 +140,7 @@ class _VacationRuleScreenState extends State<VacationRuleScreen> {
}
String getParsedTime(String time) {
DateTime date = DateFormat("MM/dd/yyyy", "en_US").parse(time);
return DateFormat("d MMM yyyy", "en_US").format(date);
DateTime date = DateFormat("MM/dd/yyyy").parse(time);
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/main.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 {
CallDataModel outGoingCallData;
bool isVideoCall;
CallDataModel OutGoingCallData;
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
_OutGoingCallState createState() => _OutGoingCallState();
@ -25,25 +23,23 @@ class OutGoingCall extends StatefulWidget {
class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderStateMixin {
AnimationController? _animationController;
late CameraController controller;
late List<CameraDescription> _cameras;
CameraController? _controller;
Future<void>? _initializeControllerFuture;
bool isCameraReady = false;
bool isMicOff = false;
bool isLoudSpeaker = false;
bool isCamOff = false;
late ChatCallProvider callProviderd;
@override
void initState() {
callProviderd = Provider.of<ChatCallProvider>(context, listen: false);
_animationController = AnimationController(
vsync: this,
duration: const Duration(
milliseconds: 500,
),
);
// _runAnimation();
logger.d(jsonEncode(widget.OutGoingCallData));
//_runAnimation();
// connectSignaling();
WidgetsBinding.instance.addPostFrameCallback(
(_) => _runAnimation(),
@ -62,10 +58,13 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
return Stack(
alignment: FractionalOffset.center,
children: <Widget>[
if (widget.isVideoCall)
if (widget.isVideoCall!)
Positioned.fill(
child: CameraPreview(
controller,
child: AspectRatio(
aspectRatio: _controller!.value.aspectRatio,
child: CameraPreview(
_controller!,
),
),
),
Positioned.fill(
@ -75,7 +74,7 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
child: Container(
decoration: BoxDecoration(
color: MyColors.grey57Color.withOpacity(
0.3,
0.7,
),
),
child: Column(
@ -106,9 +105,9 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
fit: BoxFit.cover,
),
10.height,
Text(
widget.outGoingCallData.title,
style: const TextStyle(
const Text(
"Aamir Saleem Ahmad",
style: TextStyle(
fontSize: 21,
fontWeight: FontWeight.bold,
color: MyColors.white,
@ -180,7 +179,7 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (widget.isVideoCall)
if (widget.isVideoCall!)
RawMaterialButton(
onPressed: () {
_camOff();
@ -268,10 +267,13 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
}
void _runAnimation() async {
_cameras = await availableCameras();
CameraDescription firstCamera = _cameras[1];
controller = CameraController(firstCamera, ResolutionPreset.medium);
_initializeControllerFuture = controller.initialize();
List<CameraDescription> cameras = await availableCameras();
CameraDescription firstCamera = cameras[1];
_controller = CameraController(
firstCamera,
ResolutionPreset.medium,
);
_initializeControllerFuture = _controller!.initialize();
setState(() {});
// setAudioFile();
for (int i = 0; i < 100; i++) {
@ -302,7 +304,7 @@ class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderSt
try {
// backToHome();
// final roomModel = RoomModel(name: widget.OutGoingCallData.name, token: widget.OutGoingCallData.sessionId, identity: widget.OutGoingCallData.identity);
await controller?.dispose();
await _controller?.dispose();
// 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/string_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/provider/chat_provider_model.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 isVoice = false;
int? fileTypeID;
String? fileTypeName;
@ -52,7 +49,6 @@ class ChatBubble extends StatelessWidget {
isCurrentUser = cItem.currentUserId == AppState().chatDetails!.response!.id ? true : false;
isSeen = cItem.isSeen == true ? true : false;
isReplied = cItem.userChatReplyResponse != null ? true : false;
// isVoice = cItem.fileTypeId == 13 && cItem.voiceController != null ? true : false;
fileTypeID = cItem.fileTypeId;
fileTypeName = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeName : "";
fileTypeDescription = cItem.fileTypeResponse != null ? cItem.fileTypeResponse!.fileTypeDescription : "";
@ -65,46 +61,29 @@ class ChatBubble extends StatelessWidget {
required SingleUserChatModel data,
}) async {
if (data.voice != null && data.voice!.existsSync()) {
if (Platform.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!.setVolume(1.0);
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();
}
await data.voiceController!.setFilePath(data!.voice!.path);
await data.voiceController!.setLoopMode(LoopMode.off);
Duration? duration = await data.voiceController!.load();
await data.voiceController!.seek(duration);
await data.voiceController!.play();
} else {
Utils.showLoading(context);
Uint8List encodedString = await ChatApiClient().downloadURL(fileName: data.contant!, fileTypeDescription: provider.getFileTypeDescription(data.fileTypeResponse!.fileTypeName ?? ""));
// try {
File sFile = await provider.downChatVoice(encodedString, data.fileTypeResponse!.fileTypeName ?? "", data);
if (sFile.path.isEmpty) {
logger.d("Path Is Emptyyyyyyy");
} else {
logger.d("Path Exsists");
}
data.voice = sFile;
if (Platform.isIOS) {
logger.d("isIOS");
Duration? duration = await data.voiceController!.setAudioSource(MyCustomStream(data.voice!.readAsBytesSync()));
await data.voiceController!.seek(duration);
try {
String path = await provider.downChatVoice(encodedString, data.fileTypeResponse!.fileTypeName ?? "", data);
File file = File(path!);
await file.readAsBytes();
data.voice = file;
Duration? duration = await data.voiceController!.setFilePath(file.path);
await data.voiceController!.setLoopMode(LoopMode.off);
await data.voiceController!.seek(duration);
await data.voiceController!.setVolume(1.0);
await data.voiceController!.load();
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();
} catch (e) {
Utils.hideLoading(context);
Utils.showToast(e.toString());
}
}
}
@ -153,12 +132,9 @@ class ChatBubble extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5),
Directionality(
textDirection: provider.getTextDirection(cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : ""),
child: (cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "")
.toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
.paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
),
(cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "")
.toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
.paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
],
).expanded,
if (cItem.userChatReplyResponse != null)
@ -203,7 +179,7 @@ class ChatBubble extends StatelessWidget {
// || fileTypeID == 2
)
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
//|| fileTypeID == 2
)
@ -257,12 +233,9 @@ class ChatBubble extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(userName).toText12(color: MyColors.gradiantStartColor, isBold: false).paddingOnly(right: 5, top: 5, bottom: 0, left: 5),
Directionality(
textDirection: provider.getTextDirection(cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : ""),
child: (cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "")
.toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
.paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
),
(cItem.userChatReplyResponse != null ? cItem.userChatReplyResponse!.contant.toString() : "")
.toText10(color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5), isBold: false, maxlines: 4)
.paddingOnly(right: 5, top: 5, bottom: 8, left: 5),
],
).expanded,
if (cItem.userChatReplyResponse != null)
@ -308,7 +281,7 @@ class ChatBubble extends StatelessWidget {
// || fileTypeID == 2
)
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
//|| fileTypeID == 2
)
@ -326,10 +299,6 @@ class ChatBubble extends StatelessWidget {
).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}) {
if (cItem.isImageLoaded! && cItem.image != null) {
return Image.memory(
@ -450,7 +419,7 @@ class ChatBubble extends StatelessWidget {
playVoice(context, data: modelData);
});
} else if (processingState != ProcessingState.completed) {
return const Icon(
return Icon(
Icons.pause,
size: 30,
color: MyColors.lightGreenColor,
@ -458,7 +427,7 @@ class ChatBubble extends StatelessWidget {
pausePlaying(context, data: modelData);
});
} else {
return const Icon(
return Icon(
Icons.replay,
size: 30,
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:convert';
import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:easy_localization/easy_localization.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/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_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/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/chat_bubble.dart';
import 'package:mohem_flutter_app/ui/chat/common.dart';
@ -45,11 +41,8 @@ class ChatDetailScreen extends StatefulWidget {
class _ChatDetailScreenState extends State<ChatDetailScreen> {
final RefreshController _rc = RefreshController(initialRefresh: false);
late ChatProviderModel data;
late ChatCallProvider callPro;
ChatDetailedScreenParams? params;
// var textDirection = TextDirection.RTL;
void getMoreChat() async {
if (params != null) {
data.paginationVal = data.paginationVal + 10;
@ -78,7 +71,6 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
Widget build(BuildContext context) {
params = ModalRoute.of(context)!.settings.arguments as ChatDetailedScreenParams;
data = Provider.of<ChatProviderModel>(context, listen: false);
// callPro = Provider.of<ChatCallProvider>(context, listen: false);
if (params != null) {
data.getSingleUserChatHistory(
senderUID: AppState().chatDetails!.response!.id!.toInt(),
@ -95,15 +87,16 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
context,
title: params!.chatUser!.userName.toString().replaceAll(".", " ").capitalizeFirstofEach,
showHomeButton: false,
image: params!.chatUser!.image == null || params!.chatUser!.image.isEmpty ? null : params!.chatUser!.image,
showTyping: true,
chatUser: params!.chatUser,
actions: [
// SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() {
// makeCall(callType: "AUDIO");
// // makeCall(callType: "AUDIO", con: hubConnection);
// }),
// 24.width,
// SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() {
// makeCall(callType: "VIDEO");
// // makeCall(callType: "VIDEO", con: hubConnection);
// }),
// 21.width,
],
@ -210,7 +203,8 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
WaveBubble(
playerController: m.playerController,
isPlaying: m.playerController.playerState == PlayerState.playing,
onTap: () {},
onTap: () {
},
).expanded
else
AudioWaveforms(
@ -259,39 +253,38 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
if (!m.isRecoding)
Row(
children: [
CustomAutoDirection(
onDirectionChange: (bool isRTL) => m.onDirectionChange(isRTL),
text: m.msgText,
child: TextField(
// textDirection: m.textDirection,
controller: m.message,
decoration: InputDecoration(
hintTextDirection: m.textDirection,
hintText: m.isAttachmentMsg ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
hintStyle: TextStyle(color: m.isAttachmentMsg ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
filled: true,
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,
TextField(
controller: m.message,
decoration: InputDecoration(
hintText: m.isAttachmentMsg ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
hintStyle: TextStyle(color: m.isAttachmentMsg ? MyColors.darkTextColor : MyColors.grey98Color, fontSize: 14),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
filled: true,
fillColor: MyColors.white,
contentPadding: const EdgeInsets.only(
left: 21,
top: 20,
bottom: 20,
),
onChanged: (String val) {
m.inputBoxDirection(val);
m.userTypingInvoke(currentUser: AppState().chatDetails!.response!.id!, reciptUser: params!.chatUser!.id!);
},
).expanded,
),
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) {
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)
Row(
children: <Widget>[
@ -310,7 +303,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
Icons.mic,
color: MyColors.lightGreenColor,
).paddingOnly(right: 15).onPress(() {
m.startRecoding(context);
m.startRecoding();
}),
SvgPicture.asset("assets/icons/chat/chat_send_icon.svg", height: 26, width: 26)
.onPress(
@ -351,30 +344,45 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
}
}
void makeCall({required String callType}) async {
callPro.initCallListeners();
void makeCall({required String callType, required HubConnection con}) async {
print("================== Make call Triggered ============================");
Map<String, dynamic> json = {
"callerID": AppState().chatDetails!.response!.id!.toString(),
"callerDetails": AppState().chatDetails!.toJson(),
"receiverID": params!.chatUser!.id.toString(),
"receiverDetails": params!.chatUser!.toJson(),
"title": params!.chatUser!.userName!.replaceAll(".", " "),
"calltype": callType == "VIDEO" ? "Video" : "Audio",
"callReceiverID": params!.chatUser!.id.toString(),
"notification_foreground": "true",
"message": "Aamir is calling",
"title": "Video Call",
"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);
await Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => OutGoingCall(
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: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/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_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) {
data.isLoading = true;
data.getUserRecentChats().whenComplete(() async {
// String isAppOpendByChat = await Utils.getStringFromPrefs("isAppOpendByChat");
// String notificationData = await Utils.getStringFromPrefs("notificationData");
// if (isAppOpendByChat != "null" || isAppOpendByChat == "true" && notificationData != "null") {
// data.openChatByNoti(context);
// }
});
data.getUserRecentChats();
}
}
@ -90,7 +83,7 @@ class _ChatHomeState extends State<ChatHome> {
children: <Widget>[
myTab(LocaleKeys.mychats.tr(), 0),
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> {
TextEditingController search = TextEditingController();
late ChatProviderModel data;
final RefreshController _rc = RefreshController(initialRefresh: false);
@override
void initState() {
super.initState();
data = Provider.of<ChatProviderModel>(context, listen: false);
}
@override
@ -175,7 +179,6 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
m.favoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
fromSearch: false
);
} else if (m.searchedChats![index].isFav == true) {
m.unFavoriteUser(
@ -186,7 +189,6 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
m.favoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
fromSearch: false
);
}
},
@ -236,7 +238,6 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
),
),
onPressed: () async {
print(AppState().chatDetails!.response!.token);
showMyBottomSheet(
context,
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(
right: 5,
bottom: 1,
child: Container(
width: 10,
height: 10,
decoration: BoxDecoration(
color: m.teamMembersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
),
).circle(10),
)
// Positioned(
// right: 5,
// bottom: 1,
// child: Container(
// width: 10,
// height: 10,
// decoration: BoxDecoration(
// color: m.teamMembersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
// ),
// ).circle(10),
// )
],
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
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,
// 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/generated/locale_keys.g.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/main.dart';
class EmployeeDigitialIdDialog extends StatelessWidget {
@override

@ -3,15 +3,12 @@ import 'dart:io';
import 'dart:ui' as ui;
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.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/api/dashboard_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/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';
@ -35,6 +32,8 @@ import 'package:signalr_netcore/signalr_client.dart';
late HubConnection chatHubConnection;
class DashboardScreen extends StatefulWidget {
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 MarathonProvider marathonProvider;
late ChatProviderModel cProvider;
@ -56,109 +55,47 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
@override
void initState() {
WidgetsBinding.instance.addObserver(this);
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);
_bHubCon();
}
_onRefresh(true);
});
}
marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
cProvider = Provider.of<ChatProviderModel>(context, listen: false);
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
checkSession();
}
}
void checkSession() async {
try {
await DashboardApiClient().getOpenNotifications();
} catch (ex) {
Utils.handleException(ex, context, null);
}
_onRefresh();
});
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
if (!cProvider.disbaleChatForThisUser) {
chatHubConnection.stop();
}
chatHubConnection.stop();
}
void _bHubCon() {
cProvider.getUserAutoLoginToken().whenComplete(() async {
if (!cProvider.disbaleChatForThisUser) {
String isAppOpendByChat = await Utils.getStringFromPrefs("isAppOpendByChat");
if (isAppOpendByChat != null && isAppOpendByChat == "true") {
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!);
});
}
}
cProvider.getUserAutoLoginToken().whenComplete(() {
cProvider.buildHubConnection();
Future.delayed(const Duration(seconds: 2), () {
cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
});
});
}
Future<void> checkHubCon() 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 {
void _onRefresh() async {
data.initProvider();
_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.fetchAttendanceTracking(context);
data.fetchWorkListCounter(context);
if (env.dashboard.missingSwipe) {
data.fetchMissingSwipe(context);
}
data.fetchMissingSwipe(context);
data.fetchLeaveTicketBalance(context, DateTime.now());
data.fetchMenuEntries();
if (env.offersDiscount) {
data.getCategoryOffersListAPI(context);
}
if (env.marathon) {
marathonProvider.getMarathonDetailsFromApi();
}
if (env.chat) {
marathonProvider.getMarathonDetailsFromApi();
if (!cProvider.disbaleChatForThisUser && !isFromInit) checkHubCon();
}
data.getCategoryOffersListAPI(context);
marathonProvider.getMarathonDetailsFromApi();
_refreshController.refreshCompleted();
}
@ -209,11 +146,10 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
body: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Builder(builder: (BuildContext context) {
return Row(
// mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min,
children: [
Image.memory(
Utils.dataFromBase64String(
@ -230,6 +166,11 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
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"),
],
@ -237,14 +178,13 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
_scaffoldState.currentState!.openDrawer();
});
}),
Image.asset("assets/images/drawer/moe_logo_full.png", width: 130, height: 45),
SizedBox(width: 65),
// SvgPicture.asset(
// "assets/images/announcements.svg",
// matchTextDirection: true,
// ).onPress(() async {
// await Navigator.pushNamed(context, AppRoutes.announcements);
// })
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(
@ -255,9 +195,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
color: MyColors.gradiantEndColor,
),
controller: _refreshController,
onRefresh: () {
_onRefresh(false);
},
onRefresh: _onRefresh,
child: SingleChildScrollView(
child: Column(
children: [
@ -269,119 +207,118 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
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(
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: [
Expanded(
child: Column(
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: [
LocaleKeys.checkIn.tr().toText12(color: Colors.white),
(model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn)
.toString()
.toText14(color: Colors.white, isBold: true),
4.height,
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(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();
},
),
).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,
),
9.width,
Expanded(
child: MenusWidget(),
),
@ -389,150 +326,102 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
),
],
).paddingOnly(left: 21, right: 21, top: 7, bottom: 21),
if (env.monthlyAttendance)
InkWell(
child: Container(
width: double.infinity,
padding: EdgeInsets.all(12),
margin: EdgeInsets.symmetric(horizontal: 21),
decoration: const BoxDecoration(
color: MyColors.gradiantStartColor,
borderRadius: BorderRadius.all(Radius.circular(12)),
),
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.employee_leaves_calender.tr().toText18(isBold: true, color: Colors.white),
2.height,
LocaleKeys.view_your_leave_information.tr().toText12(color: Colors.white),
8.height,
Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.4),
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)),
],
),
],
),
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(
color: Colors.white,
borderRadius: const BorderRadius.all(
Radius.circular(100),
),
border: Border.all(color: MyColors.lightGreyE3Color, width: 1),
),
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(
color: Colors.white,
borderRadius: const BorderRadius.all(
Radius.circular(100),
),
child: ClipRRect(
borderRadius: const BorderRadius.all(
Radius.circular(50),
),
child: Hero(
tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString()!,
transitionOnUserGestures: true,
child: Image.network(
data.getOffersList[index].logo!,
fit: BoxFit.contain,
),
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].titleEn!.toText12(isCenter: true, maxLine: 1),
),
],
),
),
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: 9),
);
},
),
],
),
),
);
},
separatorBuilder: (BuildContext cxt, int index) => 8.width,
itemCount: 6),
);
},
),
],
),
Container(
width: double.infinity,
@ -545,9 +434,10 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (env.marathon)
context.watch<MarathonProvider>().isLoading ? const MarathonBannerShimmer().paddingAll(20) : const MarathonBanner().paddingOnly(left: 21, right: 21, bottom: 21, top: 8),
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(
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.mowadhafhiRequest.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),
),
);
},
bottomNavigationBar: 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
: cProvider.disbaleChatForThisUser
? MyColors.lightGreyE3Color
: 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: cProvider.disbaleChatForThisUser ? MyColors.pinkDarkColor : MyColors.redColor, borderRadius: BorderRadius.circular(17)),
child: data.chatUConvCounter.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) {
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) {
if (counter <= 4) {
if (element.offersDiscountId != offersListModelObj.offersDiscountId) {
if (element.rowID != offersListModelObj.rowID) {
getOffersDetailList.add(element);
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),
onPressed: () => Navigator.pop(context),
),
// actions: [
// IconButton(
// onPressed: () {
// data.fetchAttendanceTracking(context);
// },
// icon: const Icon(
// Icons.ac_unit,
// color: Colors.white,
// ),
// )
// ],
actions: [
IconButton(
onPressed: () {
data.fetchAttendanceTracking(context);
},
icon: const Icon(
Icons.ac_unit,
color: Colors.white,
),
)
],
),
backgroundColor: MyColors.backgroundBlackColor,
body: Consumer<DashboardProviderModel>(
builder: (context, model, child) {
return (model.isAttendanceTrackingLoading
? const Center(child: CircularProgressIndicator())
? Center(child: CircularProgressIndicator())
: Column(
children: [
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/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';
@ -30,14 +29,12 @@ class AppDrawer extends StatefulWidget {
class _AppDrawerState extends State<AppDrawer> {
List<DrawerMenuItem> drawerMenuItemList = [];
ChatProviderModel? chatData;
late ChatProviderModel chatData;
@override
void initState() {
super.initState();
if (env.chat) {
chatData = Provider.of<ChatProviderModel>(context, listen: false);
}
chatData = Provider.of<ChatProviderModel>(context, listen: false);
}
@override
@ -51,9 +48,9 @@ class _AppDrawerState extends State<AppDrawer> {
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
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)),
],
).paddingOnly(left: 4, right: 14),
@ -120,37 +117,29 @@ class _AppDrawerState extends State<AppDrawer> {
Navigator.pushNamed(context, drawerMenuItemList[index].routeName);
});
}),
// menuItem("assets/images/drawer/employee_id.svg", LocaleKeys.employeeDigitalID.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: EmployeeDigitialIdDialog())),
// 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/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/employee_id.svg", LocaleKeys.employeeDigitalID.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: EmployeeDigitialIdDialog())),
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/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,);
],
).expanded,
// const Divider(
// height: 1,
// thickness: 1,
// color: MyColors.lightGreyEFColor,
// ),
const Divider(
height: 1,
thickness: 1,
color: MyColors.lightGreyEFColor,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
// RichText(
// text: TextSpan(text: LocaleKeys.poweredBy.tr() + " ", style: const TextStyle(color: MyColors.grey98Color, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600), children: [
// TextSpan(
// text: LocaleKeys.cloudSolutions.tr(),
// style: const TextStyle(color: MyColors.grey3AColor, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600),
// ),
// ]),
// ).expanded,
Image.asset("assets/images/drawer/moe_logo.png", width: 60, height: 60)
RichText(
text: TextSpan(text: LocaleKeys.poweredBy.tr() + " ", style: const TextStyle(color: MyColors.grey98Color, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600), children: [
TextSpan(
text: LocaleKeys.cloudSolutions.tr(),
style: const TextStyle(color: MyColors.grey3AColor, fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600),
),
]),
).expanded,
Image.asset("assets/images/logos/bn_cloud_soloution.jpg", width: 40, height: 40)
],
).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}) {
return Row(
children: [
if (icon.contains("png")) Image.asset(icon, height: 20, width: 20),
if (icon.contains("svg")) SvgPicture.asset(icon, height: 20, width: 20),
SvgPicture.asset(icon, height: 20, width: 20),
9.width,
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().isLogged = false;
AppState().setPostParamsInitConfig();
chatData?.disposeData();
chatData.disposeData();
// SharedPreferences prefs = await SharedPreferences.getInstance();
// await prefs.clear();
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_svg/svg.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/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/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/screens/my_requests/new_request.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
@ -21,7 +19,7 @@ class MenusWidget extends StatelessWidget {
return Consumer<DashboardProviderModel>(
builder: (cxt, data, child) {
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,
shrinkWrap: true,
primary: false,
@ -54,52 +52,24 @@ class MenusWidget extends StatelessWidget {
).onPress(() {
Navigator.pushNamed(context, AppRoutes.workList);
}),
if (env.dashboard.missingSwipe)
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
data.isMissingSwipeLoading
? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context);
})
: Container(
decoration: BoxDecoration(
color: Color(namesColor[2]),
color: Color(namesColor[1]),
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.leaveBalance.tr().toText12(color: Colors.white),
LocaleKeys.missingSwipes.tr().toText12(color: Colors.white),
Row(
children: [
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)),
],
@ -107,7 +77,7 @@ class MenusWidget extends StatelessWidget {
],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(() {
Navigator.pushNamed(context, AppRoutes.leaveBalance);
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS"));
}),
data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() {
@ -122,11 +92,11 @@ class MenusWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.businessTripBalance.tr().toText12(color: Colors.white),
LocaleKeys.leaveBalance.tr().toText12(color: Colors.white),
Row(
children: [
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)),
],
@ -134,44 +104,11 @@ class MenusWidget extends StatelessWidget {
],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(() {
//Navigator.pushNamed(context, AppRoutes.leaveBalance);
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.business_mission.tr(), "XXX_HR_EIT_BUSINESS_MISSION_SS"));
Navigator.pushNamed(context, AppRoutes.leaveBalance);
}),
if (env.dashboard.ticketBalance)
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
data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() {
data.fetchListMenu();
data.fetchWorkListCounter(context);
})
: Container(
decoration: BoxDecoration(
@ -182,13 +119,12 @@ class MenusWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.myRequest.tr().toText12(color: Colors.white),
LocaleKeys.ticketBalance.tr().toText12(color: Colors.white),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
// Expanded(
// child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
// ),
Expanded(
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)),
],
)
@ -196,7 +132,7 @@ class MenusWidget extends StatelessWidget {
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).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:flutter/material.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/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/screens/my_requests/new_request.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
@ -33,7 +30,7 @@ class ServicesWidget extends StatelessWidget {
];
return Consumer<DashboardProviderModel>(
builder: (BuildContext context, DashboardProviderModel data, Widget? child) {
builder: (context, data, child) {
return data.isServicesMenusLoading
? whileLoading()
: ListView.separated(
@ -72,15 +69,12 @@ class ServicesWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.memory(
const Base64Decoder().convert(data.homeMenus![parentIndex].menuEntiesList[index].icon ?? ""),
scale: 1.25,
),
SvgPicture.asset(AppState().isArabic(context) ? getMenuIconAr(data.homeMenus![parentIndex].menuEntiesList[index].prompt!) : getMenuIconEn(data.homeMenus![parentIndex].menuEntiesList[index].prompt!)),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
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)),
],
@ -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),
),
],
);
},
separatorBuilder: (BuildContext context, int index) {
separatorBuilder: (context, index) {
return 12.height;
},
shrinkWrap: true,
@ -195,25 +189,8 @@ class ServicesWidget extends StatelessWidget {
}
void handleOnPress(context, GetMenuEntriesList menuEntry) {
print(menuEntry.requestType);
var pro = Provider.of<DashboardProviderModel>(context, listen: false);
// if (menuEntry.requestType == "PMS") {
// 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") {
if (menuEntry.requestType == "MONTHLY_ATTENDANCE") {
Navigator.pushNamed(context, AppRoutes.monthlyAttendance);
return;
} 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() ?? [];
menuEntry.icon = "";
menuList = [];
if (menuList.isEmpty) {
if (menuEntry.requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!));
@ -265,13 +241,13 @@ class ServicesWidget extends StatelessWidget {
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13),
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext cxt, int index) {
itemBuilder: (cxt, index) {
return AspectRatio(
aspectRatio: 105 / 105,
child: ServicesMenuShimmer(),
);
},
separatorBuilder: (BuildContext cxt, int index) => 9.width,
separatorBuilder: (cxt, index) => 9.width,
itemCount: 4,
),
),

@ -4,7 +4,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
@ -142,13 +141,12 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
empID: selectedID);
Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance", selectedEmployeeID: selectedID));
if (!AppState().cancelRequestTrancsection) {
return;
var res = await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
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!);
Utils.hideLoading(context);
} catch (ex) {
@ -236,27 +234,27 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
},
),
12.height,
// DynamicTextFieldWidget(
// LocaleKeys.selectEmployee.tr(),
// selectedReplacementEmployee == null ? LocaleKeys.searchForEmployee.tr() : selectedReplacementEmployee!.employeeDisplayName ?? "",
// isEnable: false,
// onTap: () {
// showMyBottomSheet(
// context,
// callBackFunc: () {},
// child: SearchEmployeeBottomSheet(
// title: LocaleKeys.searchForEmployee.tr(),
// apiMode: LocaleKeys.delegate.tr(),
// fromChat: false,
// onSelectEmployee: (_selectedEmployee) {
// // Navigator.pop(context);
// selectedReplacementEmployee = _selectedEmployee;
// setState(() {});
// },
// ),
// );
// },
// ),
DynamicTextFieldWidget(
LocaleKeys.selectEmployee.tr(),
selectedReplacementEmployee == null ? LocaleKeys.searchForEmployee.tr() : selectedReplacementEmployee!.employeeDisplayName ?? "",
isEnable: false,
onTap: () {
showMyBottomSheet(
context,
callBackFunc: () {},
child: SearchEmployeeBottomSheet(
title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(),
fromChat: false,
onSelectEmployee: (_selectedEmployee) {
// Navigator.pop(context);
selectedReplacementEmployee = _selectedEmployee;
setState(() {});
},
),
);
},
),
12.height,
DynamicTextFieldWidget(
LocaleKeys.comments.tr(),
@ -313,7 +311,6 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
isReadOnly: model.rEADONLY == "Y",
isInputTypeNum: true,
length: model.mAXIMUMSIZE,
onChange: (text) {
model.eSERVICESDV ??= ESERVICESDV();
model.eSERVICESDV!.pIDCOLUMNNAME = text;
@ -502,7 +499,6 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
isReadOnly: model.rEADONLY == "Y",
length: model.mAXIMUMSIZE,
onChange: (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/generated/locale_keys.g.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/balances_dashboard_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(),
padding: const EdgeInsets.all(21),
children: [
BalancesDashboardWidget(LocaleKeys.currentLeaveBalance.tr(), true, selectedEmp: employeeId, showLoading: false),
BalancesDashboardWidget(LocaleKeys.currentLeaveBalance.tr(), true, selectedEmp: employeeId),
12.height,
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
@ -118,9 +117,7 @@ class _LeaveBalanceState extends State<LeaveBalance> {
),
child: const Icon(Icons.add, color: Colors.white, size: 30),
).onPress(() {
//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"));
Navigator.pushNamed(context, AppRoutes.addLeaveBalance, arguments: employeeId);
}),
);
}

@ -8,14 +8,11 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.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/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.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/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';
@ -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/input_widget.dart';
import 'package:safe_device/safe_device.dart';
import 'package:wifi_iot/wifi_iot.dart';
class LoginScreen extends StatefulWidget {
LoginScreen({Key? key}) : super(key: key);
@ -58,12 +54,9 @@ class _LoginScreenState extends State<LoginScreen> {
bool isOnExternalStorage = false;
bool isDevelopmentModeEnable = false;
late HmsApiAvailability hmsApiAvailability;
@override
void initState() {
super.initState();
hmsApiAvailability = HmsApiAvailability();
// checkFirebaseToken();
// if (kReleaseMode) {
// checkDeviceSafety();
@ -97,52 +90,30 @@ class _LoginScreenState extends State<LoginScreen> {
Future<void> checkFirebaseToken() async {
try {
Utils.showLoading(context);
if (Platform.isAndroid) {
try {
await hmsApiAvailability.isHMSAvailable().then((value) async {
if (value == 0) {
AppState().setIsHuawei = true;
AppNotifications().initHuaweiPush(checkLoginInfo);
} else {
await Firebase.initializeApp();
_firebaseMessaging = FirebaseMessaging.instance;
firebaseToken = await _firebaseMessaging.getToken();
AppNotifications().init(firebaseToken);
checkLoginInfo();
}
});
} catch (ex) {}
await Firebase.initializeApp();
_firebaseMessaging = FirebaseMessaging.instance;
firebaseToken = await _firebaseMessaging.getToken();
loginInfo = await LoginApiClient().getMobileLoginInfoNEW(firebaseToken ?? "", Platform.isAndroid ? "android" : "ios");
if (loginInfo == null) {
await checkPrefs();
_autoLogin = false;
Utils.hideLoading(context);
return;
} else {
await Firebase.initializeApp();
_firebaseMessaging = FirebaseMessaging.instance;
firebaseToken = await _firebaseMessaging.getToken();
AppNotifications().init(firebaseToken);
checkLoginInfo();
loginInfo!.deviceToken = firebaseToken;
await checkPrefs();
Utils.hideLoading(context);
performLogin();
}
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
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();
Utils.handleException(ex, context, (errorMsg) {});
}
}
Future<void> checkPrefs() async {
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 firebaseToken = await Utils.getStringFromPrefs(SharedPrefsConsts.firebaseToken);
// print("firebaseToken:$firebaseToken");
@ -152,7 +123,6 @@ class _LoginScreenState extends State<LoginScreen> {
}
}
void performLogin() async {
Utils.showLoading(context);
try {
@ -186,33 +156,18 @@ class _LoginScreenState extends State<LoginScreen> {
@override
Widget build(BuildContext context) {
username.text = "1002528733";
password.text = "moe123456";
if (isAppOpenBySystem == null) {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
if (!kReleaseMode) {
// username.text = "1100313582";
// password.text = "moe123456";
// username.text = "15444"; // Maha User
// username.text = "15153"; // Tamer User
// password.text = "Abcd@1234";
username.text = "1024056812";
password.text = "moe123456";
// username.text = "206535"; // Hashim User
// password.text = "Namira786";
// 1) Normal user :
// Username: 1100313582
// 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
// 13777
// Ab12345cd
}
if (isAppOpenBySystem!) checkFirebaseToken();
}
@ -230,24 +185,24 @@ class _LoginScreenState extends State<LoginScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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"));
}),
],)
Expanded(child: SizedBox()),
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"));
}),
],
),
],
),
Expanded(
@ -263,21 +218,12 @@ class _LoginScreenState extends State<LoginScreen> {
12.height,
InputWidget(LocaleKeys.password.tr(), "xxxxxx", password, isTextIsPassword: true),
9.height,
if (env.login.forgetPassword)
Align(
alignment: Alignment.centerRight,
child: LocaleKeys.forgotPassword.tr().toText12(isUnderLine: true, color: MyColors.textMixColor).onPress(() {
Navigator.pushNamed(context, AppRoutes.forgotPassword);
}),
),
20.height,
// DefaultButton(
// "Connect HMG Network",
// () async {
// SystemChannels.textInput.invokeMethod('TextInput.hide');
// connectWithHmgNetwork();
// },
// ),
Align(
alignment: Alignment.centerRight,
child: LocaleKeys.forgotPassword.tr().toText12(isUnderLine: true, color: MyColors.textMixColor).onPress(() {
Navigator.pushNamed(context, AppRoutes.forgotPassword);
}),
),
],
),
)
@ -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/date_uitl.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/dialogs/otp_dialog.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/generic_response_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/dialogs/dialogs.dart';
// WhatsApp 4
// SMS 1
@ -60,54 +62,29 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
String empName = mobileLoginInfoListModel!.employeeName!;
return Scaffold(
// appBar: AppBar(
//
// backgroundColor: Colors.transparent,
// automaticallyImplyLeading: false,
// title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false)
// ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
// showMDialog(context, child: BusinessCardDialog());
// })
// : Container(),
// actions: [
// Center(
// child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
// showMDialog(context, child: EmployeeDigitialIdDialog());
// })),
// 21.width
// ],
// ),
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false)
? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
showMDialog(context, child: BusinessCardDialog());
})
: Container(),
actions: [
Center(
child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {
showMDialog(context, child: EmployeeDigitialIdDialog());
})),
21.width
],
),
body: Column(
children: [
ListView(
padding: const EdgeInsets.all(21),
physics: const BouncingScrollPhysics(),
children: [
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,
//12.height,
if (true)
Column(
mainAxisSize: MainAxisSize.min,
@ -164,7 +141,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
children: [
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3),
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4),
if (env.login.verificationMethod.whatsapp) getButton(2),
getButton(2),
getButton(1),
],
)
@ -312,7 +289,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
width: 38,
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 {
try {
if (isDirectLogin) {
if (isDirectLogin)
setState(() {
Utils.showLoading(context);
});
} else {
else
Utils.showLoading(context);
}
await LoginApiClient().checkMobileAppVersion();
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
if (!isDirectLogin) {
if (!isDirectLogin)
BasicMemberInformationModel? memberInformationModel =
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
}
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "", null);
if (!isDirectLogin) Utils.hideLoading(context);
if (!isDirectLogin) {
if (!isDirectLogin)
OtpDialog(
context,
sendVerificationFlat,
@ -378,7 +353,6 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
performApiCall(_title, _icon, _flag, sendVerificationFlat, isDirectLogin: isDirectLogin);
},
).displayDialog(context);
}
} catch (ex) {
Utils.hideLoading(context);
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 {
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(
AppState().memberLoginList?.pEMAILADDRESS ?? "",
genericResponseModel?.pSESSIONID ?? 0,
@ -395,10 +369,9 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
_flag,
AppState().memberLoginList?.pMOBILENUMBER ?? "",
AppState().getUserName!,
AppState().getIsHuawei ? AppState().getHuaweiPushToken : mobileLoginInfoListModel!.deviceToken!,
mobileLoginInfoListModel!.deviceToken!,
Platform.isAndroid ? "android" : "ios");
AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first;
AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? [];
if (genericResponseModel.errorMessage != null) {
Utils.showToast(genericResponseModel.errorMessage ?? "");
// 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/consts.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/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/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/basic_member_information_model.dart';
@ -78,7 +78,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
children: [
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3),
if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4),
if (env.login.verificationMethod.whatsapp) getButton(2),
getButton(2),
getButton(1),
],
)
@ -572,7 +572,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
width: 38,
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 ?? ""),
(value, TextEditingController _pinPutController) async {
Utils.showLoading(context);
try {
try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
AppState().memberLoginList?.pEMAILADDRESS ?? "",
@ -628,7 +628,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
_flag,
AppState().memberLoginList?.pMOBILENUMBER ?? "",
AppState().getUserName!,
AppState().getIsHuawei ? AppState().getHuaweiPushToken : firebaseToken!,
firebaseToken!,
Platform.isAndroid ? "android" : "ios");
if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? "");
@ -637,13 +637,13 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first;
MemberInformationListModel.saveToPrefs(genericResponseModel.memberInformationList ?? []);
PrivilegeListModel.saveToPrefs(genericResponseModel.privilegeList ?? []);
// AppState().setMohemmWifiSSID = genericResponseModel.mohemmWifiSSID;
// AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
// AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
AppState().setMohemmWifiSSID = genericResponseModel.mohemmWifiSSID;
AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword;
Utils.saveStringFromPrefs(SharedPrefsConsts.username, AppState().getUserName!);
Utils.saveStringFromPrefs(SharedPrefsConsts.password, AppState().password!);
// Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiSSID, genericResponseModel.mohemmWifiSSID ?? "");
// Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiPassword, genericResponseModel.mohemmWifiPassword!);
Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiSSID, genericResponseModel.mohemmWifiSSID!);
Utils.saveStringFromPrefs(SharedPrefsConsts.mohemmWifiPassword, genericResponseModel.mohemmWifiPassword!);
}
Utils.hideLoading(context);
Navigator.pop(context);

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

@ -1,10 +1,8 @@
import 'dart:async';
import 'dart:developer';
import 'package:appinio_swiper/appinio_swiper.dart';
import 'package:flutter/cupertino.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/app_state/app_state.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';
class MarathonProvider extends ChangeNotifier {
//************************************************ VARIABLES **********************************************************
//****************VARIABLES**********
final AppinioSwiperController swiperController = AppinioSwiperController();
MarathonDetailModel marathonDetailModel = MarathonDetailModel();
MarathonDetailModel demoMarathonDetailModel = MarathonDetailModel();
List<CardContent> cardContentList = <CardContent>[];
QuestionModel currentQuestion = QuestionModel();
List<QuestionCardStatus> answerStatusesList = <QuestionCardStatus>[];
@ -56,7 +53,6 @@ class MarathonProvider extends ChangeNotifier {
set isUpComingMarathon(bool value) {
_isUpComingMarathon = value;
notifyListeners();
}
@ -69,15 +65,6 @@ class MarathonProvider extends ChangeNotifier {
notifyListeners();
}
bool _canPlayDemo = true;
bool get canPlayDemo => _canPlayDemo;
set canPlayDemo(bool value) {
_canPlayDemo = value;
notifyListeners();
}
bool _isButtonEnabled = false;
bool get isButtonEnabled => _isButtonEnabled;
@ -135,7 +122,6 @@ class MarathonProvider extends ChangeNotifier {
late VideoPlayerController videoController;
Future<void> initializeVideoPlayer() async {
log("VIDEO PLAYER INITIALIZED!!!");
videoController = VideoPlayerController.network(ApiConsts.marathonBaseUrlServices + marathonDetailModel.sponsors!.first.video!);
await videoController.initialize();
await videoController.play();
@ -150,9 +136,7 @@ class MarathonProvider extends ChangeNotifier {
notifyListeners();
}
// 9c47d281-c5b5-4b5d-a90a-08dacb8cbdb6
// MarathonI
//************************************************ TIMERS **********************************************************
//****************TIMERS**********
int sponsorsSecondsCounter = 0;
int totalSponsorVideoSeconds = 0;
@ -192,7 +176,6 @@ class MarathonProvider extends ChangeNotifier {
oneSec,
(Timer timer) async {
if (totalSecondsToWaitForMarathon == 0) {
timer.cancel();
if (isUserWaiting) {
MarathonApiClient().joinMarathonAsParticipant().whenComplete(() async {
await callNextQuestionApi();
@ -200,6 +183,7 @@ class MarathonProvider extends ChangeNotifier {
} else {
isButtonEnabled = false;
}
timer.cancel();
return;
} else {
totalSecondsToWaitForMarathon--;
@ -212,44 +196,32 @@ class MarathonProvider extends ChangeNotifier {
int totalCurrentQuestionTime = 0;
int currentGapTime = 0;
Timer timerForQuestion = Timer.periodic(const Duration(seconds: 1), (Timer timer) {});
int callCountThreshold = 0;
void startTimerForQuestion() {
const Duration oneSec = Duration(seconds: 1);
timerForQuestion = Timer.periodic(
oneSec,
(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 (callCountThreshold == 0) {
getCorrectAnswerAndUpdateAnswerColor();
}
getCorrectAnswerAndUpdateAnswerColor();
}
if (totalCurrentQuestionTime - currentGapTime == -2) {
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();
}
if (totalCurrentQuestionTime == currentGapTime) {
totalCurrentQuestionTime--;
callCountThreshold = 0;
updateCardStatusToAnswer();
scheduleMicrotask(() async {
if (isUserOutOfGame) {
await callNextQuestionApi();
} else {
await callSubmitOptionApi().then((bool value) async {
updateIsUserOutOfGame = !value;
await callNextQuestionApi();
});
}
});
}
if (totalCurrentQuestionTime == 0) {
@ -257,12 +229,17 @@ class MarathonProvider extends ChangeNotifier {
gapTimeText = currentQuestion.gapText;
gapTimeType = currentQuestion.gapType;
updateCardData();
if (currentQuestionNumber - 1 == marathonDetailModel.totalQuestions!) {
isGettingQualifiers = true;
updateQuestionCardStatus(QuestionCardStatus.findingWinner);
timer.cancel();
cancelTimer();
notifyListeners();
}
return;
} else {
if (totalCurrentQuestionTime - currentGapTime != -2) {
if (totalCurrentQuestionTime != currentGapTime) {
totalCurrentQuestionTime--;
callCountThreshold = 0;
}
}
@ -295,26 +272,19 @@ class MarathonProvider extends ChangeNotifier {
);
}
//************************************************ FUNCTIONS **********************************************************
//****************FUNCTIONS*********
Future<bool> callSubmitOptionApi() async {
return await MarathonApiClient().submitSelectedOption(marathonId: marathonDetailModel.id!, questionId: currentQuestion.id, selectedAnswerId: selectedOptionId);
}
Future<void> callGetQualifiersApi() async {
if (AppState().getIsDemoMarathon) {
totalQualifiers = isUserOutOfGame ? 0 : 1;
} else {
totalQualifiers = await MarathonApiClient().getQualifiers(marathonId: marathonDetailModel.id!);
}
totalQualifiers = await MarathonApiClient().getQualifiers(marathonId: marathonDetailModel.id!);
isGettingQualifiers = false;
notifyListeners();
}
Future<void> callGetSelectedWinnersApi() async {
if (AppState().getIsDemoMarathon) {
return;
}
selectedWinners = await MarathonApiClient().getSelectedWinner(marathonId: marathonDetailModel.id!);
if (selectedWinners != null) {
selectedWinners!.removeWhere((WinnerModel element) {
@ -331,14 +301,10 @@ class MarathonProvider extends ChangeNotifier {
}
Future<void> callNextQuestionApi() async {
if (currentQuestionNumber < (AppState().getIsDemoMarathon ? demoMarathonDetailModel.totalQuestions! : marathonDetailModel.totalQuestions!)) {
if (currentQuestionNumber < marathonDetailModel.totalQuestions!) {
if (currentQuestionNumber == 0) {
if (!AppState().getIsDemoMarathon) {
Utils.showLoading(AppRoutes.navigatorKey.currentContext!);
}
currentQuestion = AppState().getIsDemoMarathon
? await DemoMarathonRepo().getDemoNextQuestion(currentQuestionNumber: currentQuestionNumber)
: (await MarathonApiClient().getNextQuestion(questionId: null, marathonId: marathonDetailModel.id!));
Utils.showLoading(AppRoutes.navigatorKey.currentContext!);
currentQuestion = (await MarathonApiClient().getNextQuestion(questionId: null, marathonId: marathonDetailModel.id!));
gapTimeImage = currentQuestion.gapImage;
gapTimeText = currentQuestion.gapText;
gapTimeType = currentQuestion.gapType;
@ -349,9 +315,7 @@ class MarathonProvider extends ChangeNotifier {
updateCardData();
Navigator.pushReplacementNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.marathonScreen);
} else {
currentQuestion = AppState().getIsDemoMarathon
? await DemoMarathonRepo().getDemoNextQuestion(currentQuestionNumber: currentQuestionNumber)
: (await MarathonApiClient().getNextQuestion(questionId: currentQuestion.id, marathonId: marathonDetailModel.id!));
currentQuestion = (await MarathonApiClient().getNextQuestion(questionId: currentQuestion.id, marathonId: marathonDetailModel.id!));
}
notifyListeners();
}
@ -373,21 +337,12 @@ class MarathonProvider extends ChangeNotifier {
}
void populateQuestionStatusesList() {
answerStatusesList.clear();
if (demoMarathonDetailModel.totalQuestions != null) {
for (int i = 0; i < demoMarathonDetailModel.totalQuestions!; i++) {
if (marathonDetailModel.totalQuestions != null) {
for (int i = 0; i < marathonDetailModel.totalQuestions!; i++) {
answerStatusesList.add(QuestionCardStatus.question);
}
notifyListeners();
}
if (isUpComingMarathon) {
if (marathonDetailModel.totalQuestions != null) {
for (int i = 0; i < marathonDetailModel.totalQuestions!; i++) {
answerStatusesList.add(QuestionCardStatus.question);
}
notifyListeners();
}
}
}
void updateAnswerStatusesList(QuestionCardStatus status) {
@ -411,43 +366,19 @@ class MarathonProvider extends ChangeNotifier {
}
void updateQuestionCardStatus(QuestionCardStatus status) {
if (status == QuestionCardStatus.wrongAnswer || status == QuestionCardStatus.skippedAnswer) {
if (AppState().getIsDemoMarathon) {
updateIsUserOutOfGame = true;
}
}
// if (status == QuestionCardStatus.wrongAnswer || status == QuestionCardStatus.skippedAnswer) {
// updateIsUserOutOfGame = true;
// }
questionCardStatus = status;
notifyListeners();
}
void getCorrectAnswerAndUpdateAnswerColor() {
callCountThreshold = 1;
if (selectedOptionIndex != null) {
scheduleMicrotask(() async {
if (AppState().getIsDemoMarathon) {
if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) {
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.correct, 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;
});
});
if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) {
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.correct, selectedOptionIndex!);
} else {
updateCurrentQuestionOptionStatus(QuestionsOptionStatus.wrong, selectedOptionIndex!);
}
}
}
@ -456,17 +387,8 @@ class MarathonProvider extends ChangeNotifier {
if (currentQuestionNumber == 0) {
return;
}
callCountThreshold = 1;
scheduleMicrotask(() async {
await callNextQuestionApi();
});
if (selectedOptionIndex == null) {
updateQuestionCardStatus(QuestionCardStatus.skippedAnswer);
updateAnswerStatusesList(QuestionCardStatus.skippedAnswer);
return;
}
if (AppState().getIsDemoMarathon) {
if (selectedOptionIndex != null) {
if (currentQuestion.questionOptions![selectedOptionIndex!].isCorrectOption!) {
updateQuestionCardStatus(QuestionCardStatus.correctAnswer);
updateAnswerStatusesList(QuestionCardStatus.correctAnswer);
@ -474,20 +396,14 @@ class MarathonProvider extends ChangeNotifier {
updateQuestionCardStatus(QuestionCardStatus.wrongAnswer);
updateAnswerStatusesList(QuestionCardStatus.wrongAnswer);
}
return;
}
if (!isUserOutOfGame) {
updateQuestionCardStatus(QuestionCardStatus.correctAnswer);
updateAnswerStatusesList(QuestionCardStatus.correctAnswer);
return;
} else {
updateQuestionCardStatus(QuestionCardStatus.skippedAnswer);
updateAnswerStatusesList(QuestionCardStatus.skippedAnswer);
}
updateQuestionCardStatus(QuestionCardStatus.wrongAnswer);
updateAnswerStatusesList(QuestionCardStatus.wrongAnswer);
}
void resetValues() async {
_currentQuestionNumber = 0;
iAmWinner = false;
cardContentList.clear();
itsMarathonTime = false;
timerForWinnerSelection.cancel();
@ -498,13 +414,11 @@ class MarathonProvider extends ChangeNotifier {
isUserOutOfGame = false;
isButtonEnabled = false;
isUserWaiting = false;
canPlayDemo = true;
totalCurrentQuestionTime = 0;
sponsorsSecondsCounter = 0;
totalSponsorVideoSeconds = 0;
totalSecondsToWaitForWinner = 30;
totalSecondsToWaitForMarathon = 30;
AppState().setIsDemoMarathon = false;
currentGapTime = 0;
currentQuestion = QuestionModel();
if (answerStatusesList.isNotEmpty) {
@ -535,19 +449,15 @@ class MarathonProvider extends ChangeNotifier {
isLoading = true;
notifyListeners();
isPrivilegedWithMarathon = checkIfPrivilegedForMarathon();
demoMarathonDetailModel = await DemoMarathonRepo().getDemoMarathonDetails();
if (isPrivilegedWithMarathon) {
marathonDetailModel = await MarathonApiClient().getMarathonDetails();
updateTotalSecondsToWaitForMarathon = marathonDetailModel.marathonBufferTime ?? 30;
if (marathonDetailModel.id == null) {
isUpComingMarathon = false;
isLoading = false;
populateQuestionStatusesList();
notifyListeners();
return;
}
isUpComingMarathon = true;
if (DateTime.parse(marathonDetailModel.startTime!).isAfter(DateTime.now())) {
itsMarathonTime = false;
}
@ -565,9 +475,4 @@ class MarathonProvider extends ChangeNotifier {
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);
}
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}) {
return Container(
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: (AppState().getIsDemoMarathon)
? getDemoWinnerWidget(context, provider: provider)
: provider.selectedWinners == null || (provider.selectedWinners!.isEmpty && !provider.iAmWinner)
? Column(
child: provider.selectedWinners == null || (provider.selectedWinners!.isEmpty && !provider.iAmWinner)
? 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>[
Lottie.asset(MyLottieConsts.noWinnerLottie),
Center(
child: LocaleKeys.noWinner.tr().toText18(color: MyColors.grey3AColor, isCentered: true),
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: ((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),
)
],
),
),
],
)
: Stack(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 50,
child: Stack(
16.height,
provider.iAmWinner
? Column(
children: <Widget>[
Align(
alignment: Alignment.center,
child: SvgPicture.asset("assets/images/winner_ribbon.svg", height: 50),
(AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn)!.toText22(
color: MyColors.grey3AColor,
isCentered: true,
),
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),
)
8.height,
AppState().memberInformationList!.eMPLOYEENUMBER!.toText22(color: MyColors.grey57Color),
],
),
),
16.height,
provider.iAmWinner
? 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),
],
)
: 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,
)
: const SizedBox(),
36.height,
if (provider.selectedWinners != null) ...<Widget>[
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>[
"${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,
(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>[
"${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);
},
)
],
],
),
Lottie.asset(MyLottieConsts.celebrate1Lottie),
),
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);
},
)
],
],
),
Lottie.asset(MyLottieConsts.celebrate1Lottie),
],
),
);
}
@ -309,7 +226,7 @@ class MarathonScreen extends StatelessWidget {
else ...<Widget>[
MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21),
],
if (provider.questionCardStatus == QuestionCardStatus.findingWinner && !provider.isUserOutOfGame) ...<Widget>[
if (provider.questionCardStatus == QuestionCardStatus.findingWinner) ...<Widget>[
getNameContainer(context),
],
QuestionCardBuilder(
@ -336,7 +253,7 @@ class MarathonScreen extends StatelessWidget {
subTitle: LocaleKeys.youMissedTheQuestion.tr().toText18(color: MyColors.darkTextColor, isCentered: true),
),
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),
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 {
const SponsorVideoScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
MarathonProvider provider = context.read<MarathonProvider>();
MarathonProvider provider = context.watch<MarathonProvider>();
return WillPopScope(
onWillPop: () {
provider.timerForSponsorVideo.cancel();
provider.videoController.pause();
provider.disposeVideoPlayer();
provider.videoController.dispose();
provider.sponsorsSecondsCounter = 0;
provider.totalSponsorVideoSeconds = 0;
provider.timerForSponsorVideo.cancel();
return Future<bool>.value(true);
},
child: Scaffold(
@ -49,56 +49,47 @@ class SponsorVideoScreen extends StatelessWidget {
borderRadius: provider.totalSponsorVideoSeconds == 0 ? null : BorderRadius.circular(15),
),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8),
child: Consumer<MarathonProvider>(
builder: (BuildContext context, MarathonProvider provider, Widget? child) {
return provider.totalSponsorVideoSeconds == 0
? InkWell(
onTap: () {
Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen);
provider.videoController.pause();
provider.disposeVideoPlayer();
provider.sponsorsSecondsCounter = 0;
provider.totalSponsorVideoSeconds = 0;
provider.timerForSponsorVideo.cancel();
},
child: const Icon(Icons.close, size: 12),
)
: Directionality(
textDirection: ui.TextDirection.ltr,
child: ("${LocaleKeys.ourSponsor.tr()} ${provider.totalSponsorVideoSeconds < 10 ? "0" : ""}${provider.totalSponsorVideoSeconds}").toText12(color: MyColors.darkTextColor),
);
},
),
child: provider.totalSponsorVideoSeconds == 0
? InkWell(
onTap: () {
provider.videoController.dispose();
provider.sponsorsSecondsCounter = 0;
provider.totalSponsorVideoSeconds = 0;
provider.timerForSponsorVideo.cancel();
Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen);
},
child: const Icon(Icons.close, size: 12),
)
: Directionality(
textDirection: ui.TextDirection.ltr,
child: ("${LocaleKeys.ourSponsor.tr()} ${provider.totalSponsorVideoSeconds < 10 ? "0" : ""}${provider.totalSponsorVideoSeconds}").toText12(color: MyColors.darkTextColor),
),
),
).paddingOnly(top: 20, right: 18),
Consumer<MarathonProvider>(
builder: (BuildContext context, MarathonProvider provider, Widget? child) {
//TODO: WE WILL INCREASE THIS 2 BEFORE GOING LIVE
return provider.sponsorsSecondsCounter >= 2
? Align(
alignment: Alignment.topLeft,
child: InkWell(
onTap: () {
Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen);
provider.videoController.pause();
provider.disposeVideoPlayer();
provider.sponsorsSecondsCounter = 0;
provider.totalSponsorVideoSeconds = 0;
provider.timerForSponsorVideo.cancel();
},
child: Container(
decoration: BoxDecoration(color: MyColors.white, borderRadius: BorderRadius.circular(15)),
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 6),
child: Directionality(
textDirection: ui.TextDirection.ltr,
child: LocaleKeys.skip.tr().toText11(color: MyColors.darkTextColor),
),
),
//TODO: WE WILL INCREASE THIS 2 BEFORE GOING LIVE
provider.sponsorsSecondsCounter >= 2
? Align(
alignment: Alignment.topLeft,
child: InkWell(
onTap: () {
provider.videoController.dispose();
provider.sponsorsSecondsCounter = 0;
provider.totalSponsorVideoSeconds = 0;
provider.timerForSponsorVideo.cancel();
Navigator.pushReplacementNamed(context, AppRoutes.marathonIntroScreen);
},
child: Container(
decoration: BoxDecoration(color: MyColors.white, borderRadius: BorderRadius.circular(15)),
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 6),
child: Directionality(
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) {
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 (!provider.itsMarathonTime) {
scheduleMicrotask(() {
@ -204,7 +192,6 @@ class CountdownTimerForDetailScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CountdownTimer(
// endTime: dummyTime,
endTime: timeToMarathon,
onEnd: null,
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/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/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:provider/provider.dart';
// It is used to pass a dummy time to test Marathon
int dummyTime = DateTime.now().millisecondsSinceEpoch + 8690;
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) {
return Container(
@ -272,16 +274,6 @@ class MarathonBanner extends StatelessWidget {
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(
left: AppState().isArabic(context) ? 12 : 3,
@ -339,21 +331,16 @@ class MarathonBanner extends StatelessWidget {
).paddingOnly(top: 5),
],
),
).onPress(() {
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
});
);
}
@override
Widget build(BuildContext context) {
MarathonProvider provider = context.read<MarathonProvider>();
// if(provider.isUserWaiting) {
// provider.isUserWaiting = false;
// provider.getMarathonDetailsFromApi();
// }
return !provider.isPrivilegedWithMarathon
? getUnPrivilegedMarathon(context)
: provider.isUpComingMarathon
: provider.marathonDetailModel.startTime != null
? Container(
decoration: MyDecorations.shadowDecoration,
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,
),
),
Flexible(
child: Text(
(AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "").trimString(isTablet ? 25 : 15),
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: isTablet ? 30 : 19,
fontWeight: FontWeight.bold,
color: MyColors.white.withOpacity(0.83),
height: 32 / 22,
),
Text(
AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "",
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: isTablet ? 30 : 19,
fontWeight: FontWeight.bold,
color: MyColors.white.withOpacity(0.83),
height: 32 / 22,
),
),
isTablet ? 10.height : 3.height,
CountdownTimerForMainScreen(
timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch,
// timeToMarathon: dummyTime,
provider: provider,
),
],
@ -526,9 +511,7 @@ class MarathonBanner extends StatelessWidget {
).onPress(() async {
int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes;
if (remainingTimeInMinutes > 5 && provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) {
log("IF CALLED!!!");
log("Remaining Time: $remainingTimeInMinutes");
if (remainingTimeInMinutes > 2 && provider.marathonDetailModel.sponsors != null && provider.marathonDetailModel.sponsors!.isNotEmpty) {
Utils.showLoading(context);
try {
await provider.initializeVideoPlayer().then((_) {
@ -537,19 +520,14 @@ class MarathonBanner extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.marathonSponsorVideoScreen);
});
} catch (e) {
// if (kDebugMode) {
if (kDebugMode) {
log("Error in VideoPlayer: ${e.toString()}");
// }
}
Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen).then((value) {
print("Back to home!!!");
});
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
}
} else {
log("ELSE CALLED!!!");
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen).then((value) {
print("Back to home!!!");
});
Navigator.pushNamed(context, AppRoutes.marathonIntroScreen);
}
}),
)

@ -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/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/marathon/marathon_model.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:provider/provider.dart';
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
Widget build(BuildContext context) {
return Container(
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 14),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
context.read<MarathonProvider>().isUpComingMarathon
? const SizedBox()
: 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),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey77Color),
"${AppState().isArabic(context) ? provider.marathonDetailModel.titleAr : provider.marathonDetailModel.titleEn}".toText20(color: MyColors.textMixColor, isBold: true),
Row(
children: <Widget>[
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,
LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey77Color),
"${AppState().isArabic(context) ? marathonDetailModel.titleAr : marathonDetailModel.titleEn}".toText20(color: MyColors.textMixColor, isBold: true),
Row(
children: <Widget>[
Flexible(
child: "${AppState().isArabic(context) ? marathonDetailModel.descAr : marathonDetailModel.descEn}".toText14(color: MyColors.grey77Color),
)
10.height,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
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);
},
)
],
),
]
],
),
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
Widget build(BuildContext context) {
return provider.isUpComingMarathon && !provider.canPlayDemo
? DefaultButton(
LocaleKeys.joinMarathon.tr(),
provider.isButtonEnabled ? () => provider.onJoinMarathonPressed(context) : null,
).insideContainer
: DefaultButton(
LocaleKeys.joinDemoMarathon.tr(),
() => provider.onJoinDemoMarathonPressed(context),
color: MyColors.yellowColorII,
).insideContainer;
return DefaultButton(
LocaleKeys.joinMarathon.tr(),
provider.isButtonEnabled ? () => provider.onJoinMarathonPressed(context) : null,
).insideContainer;
}
}

@ -1,6 +1,5 @@
import 'package:easy_localization/easy_localization.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/decorations_helper.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);
Widget getDemoMarathonerText() {
if (provider.isUserOutOfGame) {
return "0 ${LocaleKeys.marathoner.tr()}".toText14();
}
return "1 ${LocaleKeys.marathoner.tr()}".toText14();
}
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: EdgeInsets.fromLTRB(13, AppState().getIsDemoMarathon ? 5 : 18, 13, 18),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 13),
child: Column(
mainAxisSize: MainAxisSize.min,
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(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
decoration: BoxDecoration(color: MyColors.greenColor, borderRadius: BorderRadius.circular(5)),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8),
child:
"${provider.currentQuestionNumber.toString()} / ${AppState().getIsDemoMarathon ? provider.demoMarathonDetailModel.totalQuestions.toString() : provider.marathonDetailModel.totalQuestions.toString()} ${LocaleKeys.question.tr()}"
.toText12(color: MyColors.white),
child: "${provider.currentQuestionNumber.toString()} / ${provider.marathonDetailModel.totalQuestions.toString()} ${LocaleKeys.question.tr()}".toText12(color: MyColors.white),
),
AppState().getIsDemoMarathon
? getDemoMarathonerText()
: "${provider.totalMarathoners} ${provider.totalMarathoners == 1 ? LocaleKeys.marathoner.tr() : LocaleKeys.marathoners.tr()}".toText14(),
"${provider.totalMarathoners} ${LocaleKeys.marathoners.tr()}".toText14(),
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)
: const SizedBox(),
],
),
12.height,
stepper(
provider.currentQuestionNumber,
provider.answerStatusesList,
(provider.demoMarathonDetailModel.totalQuestions != null || provider.marathonDetailModel.totalQuestions != null)
? AppState().getIsDemoMarathon
? provider.demoMarathonDetailModel.totalQuestions!
: provider.marathonDetailModel.totalQuestions!
: 10,
provider.isUserOutOfGame,
),
stepper(provider.currentQuestionNumber, provider.answerStatusesList, provider.marathonDetailModel.totalQuestions!, provider.isUserOutOfGame),
8.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
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(),
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) {
if (isNeedLeftBorder) {
return Row(
children: <Widget>[
Divider(
thickness: 6,
color: color,
).expanded,
children: [
Divider(thickness: 6, color: color).expanded,
Container(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: 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;
}
return Container(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: 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>[
widget.provider.totalQualifiers != null ? widget.provider.totalQualifiers.toString().toText30(color: MyColors.greenColor, isBold: true) : const SizedBox(),
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 'package:easy_localization/easy_localization.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/api/my_attendance_api_client.dart';
@ -56,7 +58,6 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
@override
void initState() {
super.initState();
AppState().cancelRequestTrancsection = true;
}
void getApproverList() async {
@ -137,9 +138,9 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
params!.transactionId,
);
} else {}
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true);
AppState().cancelRequestTrancsection = false;
Navigator.of(context).popUntil((route) => route.settings.name == AppRoutes.dashboard);
Navigator.pushNamed(context, AppRoutes.workList);
} catch (ex) {
@ -261,7 +262,7 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
title.toText16().expanded,
6.width,
SimpleButton(LocaleKeys.add.tr(), () async {
ImageOptions.showImageOptionsNew(context, true, (String image, File file) {
ImageOptions.showImageOptionsNew(context, false, (String image, File file) {
setState(() {
attachmentFiles.add(file);
attachments.add(image);

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

@ -159,7 +159,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
children: [
Row(
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),
],
).onPress(
@ -439,7 +439,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
expand: false,
builder: (_, controller) {
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(
children: [
Container(
@ -468,7 +468,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
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),
12.height,
CircularStepProgressBar(

@ -105,7 +105,7 @@ class _MonthlyPaySlipScreenState extends State<MonthlyPaySlipScreen> {
Container(alignment: Alignment.centerLeft, child: LocaleKeys.month.tr().toText17(isBold: true, color: MyColors.darkIconColor)),
Row(
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),
],
).onPress(() async {

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

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

Loading…
Cancel
Save