Version 2.0

master-Api2.0_update3.29
Aamir Muhammad 5 months ago
parent 3418472c1d
commit a336789aeb

@ -1,63 +1,58 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
plugins {
id "com.android.application"
id "kotlin-android"
id "com.google.gms.google-services"
id "dev.flutter.flutter-gradle-plugin"
// id 'com.huawei.agconnect'
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
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 34
namespace = "hmg.cloudSolutions.mohem"
compileSdkVersion 35
ndkVersion = "27.0.12077973"
// compileOptions {
// sourceCompatibility JavaVersion.VERSION_21
// targetCompatibility JavaVersion.VERSION_21
// coreLibraryDesugaringEnabled true
// }
//
// kotlinOptions {
// jvmTarget = '21'
// }
// kotlin {
// compilerOptions {
// jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21
// }
// }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11 // Changed from VERSION_21
targetCompatibility JavaVersion.VERSION_11 // Changed from VERSION_21
coreLibraryDesugaringEnabled true // (Optional, for using Java 8+ APIs on older Android versions)
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
jvmTarget = '11' // Changed from '21'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "hmg.cloudSolutions.mohem"
minSdkVersion 28
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
minSdkVersion 24
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
@ -66,15 +61,26 @@ android {
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
buildTypes {
release {
shrinkResources false // Optional: Set to true to shrink resources
minifyEnabled false // Set to true to enable code shrinking and obfuscation
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
packaging {
jniLibs {
useLegacyPackaging true
}
}
}
@ -83,6 +89,14 @@ flutter {
source '../..'
}
repositories {
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform("com.google.firebase:firebase-bom:33.14.0") // Firebase BoM
implementation "com.google.firebase:firebase-analytics" // Firebase Analytics
implementation"com.google.firebase:firebase-messaging"// Firebase Messaging
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
// implementation 'com.huawei.agconnect:agconnect-apms:1.8.0.300'
}

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mohem_flutter_app">
package="hmg.cloudSolutions.mohem">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mohem_flutter_app">
package="hmg.cloudSolutions.mohem">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
@ -34,7 +34,6 @@
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="MoheM"
android:extractNativeLibs="true"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round">
<provider

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mohem_flutter_app">
package="hmg.cloudSolutions.mohem">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

@ -1,33 +1,32 @@
buildscript {
ext.kotlin_version = '1.8.20'
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.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'
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
delete rootProject.layout.buildDirectory
}

@ -1,3 +1,5 @@
org.gradle.jvmargs=-Xmx1836M
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
android.enableR8.fullMode=false
kotlin.jvm.target.validation.mode = IGNORE

@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
#Wed May 21 09:27:10 AST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip

@ -1,11 +1,61 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
// Add Huawei's Maven repo for plugins
maven { url 'https://developer.huawei.com/repo/' }
}
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://developer.huawei.com/repo/' }
}
}
resolutionStrategy {
eachPlugin {
if (it.requested.id.getNamespace() == 'com.huawei.agconnect') {
println ">> ${it.requested.id.id}"
if (it.requested.id.id == 'com.huawei.agconnect.agcp') {
it.useModule('com.huawei.agconnect:agcp:1.7.3.302')
}
if (it.requested.id.id == 'com.huawei.agconnect.apms') {
it.useModule('com.huawei.agconnect:agconnect-apms-plugin:1.6.1.300')
}
println ">> ${it.target}"
} else {
println "> ${it.target}"
}
}
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.10.0' apply false
id("org.jetbrains.kotlin.android") version "2.1.10" apply false
id("com.google.gms.google-services") version "4.4.2" apply false
id("com.google.firebase.crashlytics") version "3.0.3" apply false
id ("com.huawei.agconnect.agcp") version "1.7.3.302" apply false
id ("com.huawei.agconnect.apms") version "1.6.1.300" apply false
}
include ":app"

@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>

@ -144,6 +144,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
C4CFBC4C5CAC00182015ACD5 /* [CP] Embed Pods Frameworks */,
D0EDD598DA741D20703260CF /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@ -160,7 +161,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@ -232,6 +233,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@ -272,6 +274,23 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
D0EDD598DA741D20703260CF /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -48,6 +48,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">

@ -4,7 +4,7 @@ import Firebase
import flutter_local_notifications
@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,

@ -1,3 +1,262 @@
// import 'dart:async';
// import 'dart:convert';
// import 'dart:io';
//
// import 'package:flutter/foundation.dart';
// import 'package:http/http.dart';
// import 'package:http/io_client.dart';
// import 'package:mohem_flutter_app/exceptions/api_exception.dart';
// import 'package:mohem_flutter_app/main.dart';
// import 'package:mohem_flutter_app/models/generic_mapper_model.dart';
// // ignore_for_file: avoid_annotating_with_dynamic
//
// typedef FactoryConstructor<U> = U Function(dynamic);
//
// class APIError {
// int? errorCode;
// int? errorType;
// String? errorMessage;
// int? errorStatusCode;
//
// APIError(this.errorCode, this.errorMessage, this.errorType, this.errorStatusCode);
//
// Map<String, dynamic> toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage, 'errorType': errorType, 'ErrorStatusCode': errorStatusCode};
//
// @override
// String toString() {
// return jsonEncode(this);
// }
// }
//
// APIException _throwAPIException(Response response) {
// switch (response.statusCode) {
// case 200:
// APIError? apiError;
// if (response.body != null && response.body.isNotEmpty) {
// var jsonError = jsonDecode(response.body);
// print(jsonError);
// apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType'], jsonError['ErrorStatusCode']);
// }
// return APIException(APIException.BAD_REQUEST, error: apiError);
// case 400:
// APIError? apiError;
// if (response.body != null && response.body.isNotEmpty) {
// var jsonError = jsonDecode(response.body);
// apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType'], jsonError['ErrorStatusCode']);
// }
// return APIException(APIException.BAD_REQUEST, error: apiError);
// case 401:
// return const APIException(APIException.UNAUTHORIZED);
// case 403:
// return const APIException(APIException.FORBIDDEN);
// case 404:
// return const APIException(APIException.NOT_FOUND);
// case 500:
// return const APIException(APIException.INTERNAL_SERVER_ERROR);
// case 444:
// var downloadUrl = response.headers["location"];
// return APIException(APIException.UPGRADE_REQUIRED, arguments: downloadUrl);
// default:
// return const APIException(APIException.OTHER);
// }
// }
//
// class ApiClient {
// static final ApiClient _instance = ApiClient._internal();
//
// ApiClient._internal();
//
// factory ApiClient() => _instance;
//
// Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject,
// {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isFormData = false, bool returnJsonData = true}) async {
// var _headers = {'Accept': 'application/json'};
// 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);
// if (!kReleaseMode) {
// logger.i("res: " + response.body);
// }
//
// var jsonData = jsonDecode(response.body);
// GenericMapperModel res = GenericMapperModel.fromJson(jsonData);
// if (jsonData["IsAuthenticated"] != null) {
// AppState().setIsAuthenticated = jsonData["IsAuthenticated"];
// }
//
// if (res.messageStatus == 1 && res.errorMessage == null) {
//
// return res.data;
// return factoryConstructor(returnJsonData ? res.data : jsonData);
// } else {
// APIError? apiError;
// apiError = APIError(jsonData['ErrorCode'], res.errorEndUserMessage, jsonData['ErrorType'] ?? 0, jsonData['ErrorStatusCode']);
// throw APIException(APIException.BAD_REQUEST, error: apiError);
// }
// }
//
// Future<Response> postJsonForResponse<T>(String url, T jsonObject,
// {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isFormData = false}) async {
// String? requestBody;
// late Map<String, String> stringObj;
// if (jsonObject != null) {
// requestBody = jsonEncode(jsonObject);
// if (headers == null) {
// headers = {'Content-Type': 'application/json'};
// } else {
// headers['Content-Type'] = 'application/json';
// }
// }
//
// if (isFormData) {
// headers = {'Content-Type': 'application/x-www-form-urlencoded'};
// stringObj = ((jsonObject ?? {}) as Map<String, dynamic>).map((key, value) => MapEntry(key, value?.toString() ?? ""));
// }
//
// return await _postForResponse(url, isFormData ? stringObj : requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
// }
//
// Future<Response> _postForResponse(String url, requestBody, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
// try {
// var _headers = <String, String>{};
// if (token != null) {
// _headers['Authorization'] = 'Bearer $token';
// }
//
// if (headers != null && headers.isNotEmpty) {
// _headers.addAll(headers);
// }
//
// if (queryParameters != null) {
// var queryString = new Uri(queryParameters: queryParameters).query;
// url = url + '?' + queryString;
// }
// var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(const Duration(seconds: 120));
//
// if (response.statusCode >= 200 && response.statusCode < 300) {
// return response;
// } else {
// throw _throwAPIException(response);
// }
// } on SocketException catch (e) {
// if (retryTimes > 0) {
// print('will retry after 3 seconds...');
// await Future.delayed(const Duration(seconds: 3));
// return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
// } else {
// throw APIException(APIException.OTHER, arguments: e);
// }
// } on HttpException catch (e) {
// if (retryTimes > 0) {
// print('will retry after 3 seconds...');
// await Future.delayed(const Duration(seconds: 3));
// return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
// } else {
// throw APIException(APIException.OTHER, arguments: e);
// }
// } on TimeoutException catch (e) {
// throw APIException(APIException.TIMEOUT, arguments: e);
// } on ClientException catch (e) {
// if (retryTimes > 0) {
// print('will retry after 3 seconds...');
// await Future.delayed(const Duration(seconds: 3));
// return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
// } else {
// throw APIException(APIException.OTHER, arguments: e);
// }
// }
// }
//
// Future<Response> getJsonForResponse<T>(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
// if (headers == null) {
// headers = {'Content-Type': 'application/json'};
// } else {
// headers['Content-Type'] = 'application/json';
// }
//
// if (!kReleaseMode) {
// print("Url:$url");
// // var bodyJson = json.encode(jsonObject);
// // print("body:$bodyJson");
// }
//
// return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
// }
//
// Future<Response> _getForResponse(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
// try {
// var _headers = <String, String>{};
// if (token != null) {
// _headers['Authorization'] = 'Bearer $token';
// }
//
// if (headers != null && headers.isNotEmpty) {
// _headers.addAll(headers);
// }
//
// if (queryParameters != null) {
// var queryString = new Uri(queryParameters: queryParameters).query;
// url = url + '?' + queryString;
// }
// var response = await _get(Uri.parse(url), headers: _headers).timeout(const Duration(seconds: 60));
//
// if (response.statusCode >= 200 && response.statusCode < 300) {
// return response;
// } else {
// throw _throwAPIException(response);
// }
// } on SocketException catch (e) {
// if (retryTimes > 0) {
// print('will retry after 3 seconds...');
// await Future.delayed(const Duration(seconds: 3));
// return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
// } else {
// throw APIException(APIException.OTHER, arguments: e);
// }
// } on HttpException catch (e) {
// if (retryTimes > 0) {
// print('will retry after 3 seconds...');
// await Future.delayed(const Duration(seconds: 3));
// return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
// } else {
// throw APIException(APIException.OTHER, arguments: e);
// }
// } on TimeoutException catch (e) {
// throw APIException(APIException.TIMEOUT, arguments: e);
// } on ClientException catch (e) {
// if (retryTimes > 0) {
// print('will retry after 3 seconds...');
// await Future.delayed(const Duration(seconds: 3));
// return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
// } else {
// throw APIException(APIException.OTHER, arguments: e);
// }
// }
// }
//
// Future<Response> _get(url, {Map<String, String>? headers}) => _withClient((client) => client.get(url, headers: headers));
//
// bool _certificateCheck(X509Certificate cert, String host, int port) => true;
//
// Future<T> _withClient<T>(Future<T> Function(Client) fn) async {
// var httpClient = HttpClient()..badCertificateCallback = _certificateCheck;
// var client = IOClient(httpClient);
// try {
// return await fn(client);
// } finally {
// client.close();
// }
// }
//
// Future<Response> _post(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding));
// }
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@ -5,7 +264,6 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart';
import 'package:http/io_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/exceptions/api_exception.dart';
import 'package:mohem_flutter_app/main.dart';
// ignore_for_file: avoid_annotating_with_dynamic
@ -28,6 +286,34 @@ class APIError {
}
}
class ApiResponse<T> {
final int? totalItemsCount;
final T data;
final int? messageStatus;
final String? errorMessage;
final String? errorEndUserMessage;
ApiResponse({
required this.totalItemsCount,
required this.data,
required this.messageStatus,
this.errorMessage,
this.errorEndUserMessage,
});
factory ApiResponse.fromJson(Map<String, dynamic> json, T Function(dynamic) fromJsonT) {
return ApiResponse<T>(
totalItemsCount: json['totalItemsCount'],
data: fromJsonT(json['data']),
messageStatus: json['messageStatus'],
errorMessage: json['errorMessage'],
errorEndUserMessage: json['errorEndUserMessage'],
);
}
bool get isSuccess => messageStatus == 1 && errorMessage == null;
}
APIException _throwAPIException(Response response) {
switch (response.statusCode) {
case 200:
@ -35,29 +321,39 @@ APIException _throwAPIException(Response response) {
if (response.body != null && response.body.isNotEmpty) {
var jsonError = jsonDecode(response.body);
print(jsonError);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType'], jsonError['ErrorStatusCode']);
apiError = APIError(
jsonError['ErrorCode'] ?? jsonError['errorCode'],
jsonError['ErrorMessage'] ?? jsonError['errorMessage'],
jsonError['ErrorType'] ?? jsonError['errorType'],
jsonError['ErrorStatusCode'] ?? jsonError['errorStatusCode'],
);
}
return APIException(APIException.BAD_REQUEST, error: apiError);
case 400:
APIError? apiError;
if (response.body != null && response.body.isNotEmpty) {
var jsonError = jsonDecode(response.body);
apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage'], jsonError['ErrorType'], jsonError['ErrorStatusCode']);
apiError = APIError(
jsonError['ErrorCode'] ?? jsonError['errorCode'],
jsonError['ErrorMessage'] ?? jsonError['errorMessage'],
jsonError['ErrorType'] ?? jsonError['errorType'],
jsonError['ErrorStatusCode'] ?? jsonError['errorStatusCode'],
);
}
return APIException(APIException.BAD_REQUEST, error: apiError);
case 401:
return APIException(APIException.UNAUTHORIZED);
return const APIException(APIException.UNAUTHORIZED);
case 403:
return APIException(APIException.FORBIDDEN);
return const APIException(APIException.FORBIDDEN);
case 404:
return APIException(APIException.NOT_FOUND);
return const APIException(APIException.NOT_FOUND);
case 500:
return APIException(APIException.INTERNAL_SERVER_ERROR);
return const APIException(APIException.INTERNAL_SERVER_ERROR);
case 444:
var downloadUrl = response.headers["location"];
return APIException(APIException.UPGRADE_REQUIRED, arguments: downloadUrl);
default:
return APIException(APIException.OTHER);
return const APIException(APIException.OTHER);
}
}
@ -68,47 +364,80 @@ class ApiClient {
factory ApiClient() => _instance;
Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject,
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isFormData = false, bool returnJsonData = true}) async {
Future<U> postJsonForObject<T, U>(
FactoryConstructor<U> factoryConstructor,
String url,
T jsonObject, {
String? token,
Map<String, dynamic>? queryParameters,
Map<String, String>? headers,
int retryTimes = 0,
bool isFormData = false,
bool returnJsonData = true,
}) async {
var _headers = {'Accept': 'application/json'};
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 {
var response = await postJsonForResponse(
url,
jsonObject,
token: token,
queryParameters: queryParameters,
headers: _headers,
retryTimes: retryTimes,
isFormData: isFormData,
);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
var jsonData = jsonDecode(response.body);
// Handle authentication flag if present
if (jsonData["IsAuthenticated"] != null) {
AppState().setIsAuthenticated = jsonData["IsAuthenticated"];
print("IsAuthenticated Need to be upated: ${jsonData["IsAuthenticated"]}");
// AppState().setIsAuthenticated = jsonData["IsAuthenticated"];
}
if (jsonData["ErrorMessage"] == null) {
return factoryConstructor(returnJsonData ? jsonData["Data"] : jsonData);
// Create ApiResponse from the json
var apiResponse = ApiResponse.fromJson(jsonData, (res) => returnJsonData ? res : jsonData);
if (apiResponse.isSuccess) {
return factoryConstructor(apiResponse);
} else {
APIError? apiError;
apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage'], jsonData['ErrorType'] ?? 0, jsonData['ErrorStatusCode']);
throw APIException(APIException.BAD_REQUEST, error: apiError);
throw APIException(
APIException.BAD_REQUEST,
error: APIError(
null,
apiResponse.errorEndUserMessage ?? apiResponse.errorMessage,
null,
response.statusCode,
),
);
}
// } catch (ex) {
// if (ex is APIException) {
// rethrow;
// } else {
// throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex);
// }
// }
}
Future<Response> postJsonForResponse<T>(String url, T jsonObject,
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0, bool isFormData = false}) async {
Future<Response> postJsonForResponse<T>(
String url,
T jsonObject, {
String? token,
Map<String, dynamic>? queryParameters,
Map<String, String>? headers,
int retryTimes = 0,
bool isFormData = false,
}) async {
String? requestBody;
late Map<String, String> stringObj;
if (jsonObject != null) {
requestBody = jsonEncode(jsonObject);
if (headers == null) {
@ -120,13 +449,29 @@ class ApiClient {
if (isFormData) {
headers = {'Content-Type': 'application/x-www-form-urlencoded'};
stringObj = ((jsonObject ?? {}) as Map<String, dynamic>).map((key, value) => MapEntry(key, value?.toString() ?? ""));
stringObj = ((jsonObject ?? {}) as Map<String, dynamic>).map(
(key, value) => MapEntry(key, value?.toString() ?? ""),
);
}
return await _postForResponse(url, isFormData ? stringObj : requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
return await _postForResponse(
url,
isFormData ? stringObj : requestBody,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes,
);
}
Future<Response> _postForResponse(String url, requestBody, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
Future<Response> _postForResponse(
String url,
requestBody, {
String? token,
Map<String, dynamic>? queryParameters,
Map<String, String>? headers,
int retryTimes = 0,
}) async {
try {
var _headers = <String, String>{};
if (token != null) {
@ -138,10 +483,15 @@ class ApiClient {
}
if (queryParameters != null) {
var queryString = new Uri(queryParameters: queryParameters).query;
var queryString = Uri(queryParameters: queryParameters).query;
url = url + '?' + queryString;
}
var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(Duration(seconds: 120));
var response = await _post(
Uri.parse(url),
body: requestBody,
headers: _headers,
).timeout(const Duration(seconds: 120));
if (response.statusCode >= 200 && response.statusCode < 300) {
return response;
@ -151,16 +501,30 @@ class ApiClient {
} on SocketException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
await Future.delayed(const Duration(seconds: 3));
return await _postForResponse(
url,
requestBody,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
} on HttpException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
await Future.delayed(const Duration(seconds: 3));
return await _postForResponse(
url,
requestBody,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
@ -169,15 +533,28 @@ class ApiClient {
} on ClientException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
await Future.delayed(const Duration(seconds: 3));
return await _postForResponse(
url,
requestBody,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
}
}
Future<Response> getJsonForResponse<T>(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
Future<Response> getJsonForResponse<T>(
String url, {
String? token,
Map<String, dynamic>? queryParameters,
Map<String, String>? headers,
int retryTimes = 0,
}) async {
if (headers == null) {
headers = {'Content-Type': 'application/json'};
} else {
@ -186,14 +563,76 @@ class ApiClient {
if (!kReleaseMode) {
print("Url:$url");
// var bodyJson = json.encode(jsonObject);
// print("body:$bodyJson");
}
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes);
return await _getForResponse(
url,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes,
);
}
Future<ApiResponse<U>> getJsonForObject<T, U>(
FactoryConstructor<U> factoryConstructor,
String url, {
String? token,
Map<String, dynamic>? queryParameters,
Map<String, String>? headers,
int retryTimes = 0,
bool returnJsonData = true,
}) async {
var response = await getJsonForResponse(
url,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes,
);
var jsonData = jsonDecode(response.body);
// Handle authentication flag if present
if (jsonData["IsAuthenticated"] != null) {
print("IsAuthenticated Need to be upated: ${jsonData["IsAuthenticated"]}");
// AppState().setIsAuthenticated = jsonData["IsAuthenticated"];
}
var apiResponse = ApiResponse.fromJson(
jsonData,
(data) => returnJsonData ? data : jsonData,
);
if (apiResponse.isSuccess) {
return ApiResponse<U>(
totalItemsCount: apiResponse.totalItemsCount,
data: factoryConstructor(apiResponse.data),
messageStatus: apiResponse.messageStatus,
errorMessage: apiResponse.errorMessage,
errorEndUserMessage: apiResponse.errorEndUserMessage,
);
} else {
throw APIException(
APIException.BAD_REQUEST,
error: APIError(
null,
apiResponse.errorEndUserMessage ?? apiResponse.errorMessage,
null,
response.statusCode,
),
);
}
}
Future<Response> _getForResponse(String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
Future<Response> _getForResponse(
String url, {
String? token,
Map<String, dynamic>? queryParameters,
Map<String, String>? headers,
int retryTimes = 0,
}) async {
try {
var _headers = <String, String>{};
if (token != null) {
@ -205,10 +644,14 @@ class ApiClient {
}
if (queryParameters != null) {
var queryString = new Uri(queryParameters: queryParameters).query;
var queryString = Uri(queryParameters: queryParameters).query;
url = url + '?' + queryString;
}
var response = await _get(Uri.parse(url), headers: _headers).timeout(Duration(seconds: 60));
var response = await _get(
Uri.parse(url),
headers: _headers,
).timeout(const Duration(seconds: 60));
if (response.statusCode >= 200 && response.statusCode < 300) {
return response;
@ -218,16 +661,28 @@ class ApiClient {
} on SocketException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
await Future.delayed(const Duration(seconds: 3));
return await _getForResponse(
url,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
} on HttpException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
await Future.delayed(const Duration(seconds: 3));
return await _getForResponse(
url,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
@ -236,8 +691,14 @@ class ApiClient {
} on ClientException catch (e) {
if (retryTimes > 0) {
print('will retry after 3 seconds...');
await Future.delayed(Duration(seconds: 3));
return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1);
await Future.delayed(const Duration(seconds: 3));
return await _getForResponse(
url,
token: token,
queryParameters: queryParameters,
headers: headers,
retryTimes: retryTimes - 1,
);
} else {
throw APIException(APIException.OTHER, arguments: e);
}
@ -258,5 +719,16 @@ class ApiClient {
}
}
Future<Response> _post(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding));
Future<Response> _post(
url, {
Map<String, String>? headers,
body,
Encoding? encoding,
}) =>
_withClient((client) => client.post(
url,
headers: headers,
body: body,
encoding: encoding,
));
}

@ -0,0 +1,385 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/basic_member_information_model.dart';
import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart';
import 'package:mohem_flutter_app/models/eit/get_eit_transaction_model.dart';
import 'package:mohem_flutter_app/models/generic_mapper_model.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/itg/itg_main_response.dart';
import 'package:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:mohem_flutter_app/models/member_login_list_model.dart';
class ApiClassMapper {
Future<dynamic> handleApiEndpoint({required String endpoint, required var jsonData}) async {
switch (endpoint) {
case 'MemberLogin':
return MemberLoginListModel.fromRawJson(json.encode(jsonData.data));
case 'Mohemm_SendActivationCodebyOTPNotificationType':
logger.d("Mohemm_SendActivationCodebyOTPNotificationType");
BasicMemberInformationModel response = BasicMemberInformationModel.fromRawJson(json.encode(jsonData.data));
AppState().postParamsObject?.setLogInTokenID = response.logInTokenId;
return response;
case 'CheckActivationCode':
return;
case 'RefreshToken':
return;
case 'Logout':
return;
case 'Mohemm_Insert_MobileDeviceInfo':
return;
case 'Mohemm_GetMobileLoginInfo_NEW':
return;
case 'ChangePassword_FromActiveSession':
return;
case 'Get_BasicUserInformation':
return;
case 'SendPublicActivationCode':
return;
case 'CheckPublicActivationCode':
return;
case 'ChangePassword_Forget':
return;
case 'CheckMobileAppVersion':
GenericMapperModel response = GenericMapperModel.fromRawJson(json.encode(jsonData.data));
return CheckMobileAppVersionModel.fromRawJson(json.encode(response));
// COCWS endpoints
case 'Mohemm_ITG_GetCategories':
return;
case 'ITGGetTaskCountRequestType':
return;
case 'Mohemm_ITG_ReviewerAdmin_Pending_Tasks':
return GenericResponseModel.fromJson(jsonData["data"]);
case 'Mohemm_ITG_CreateTicketMobile':
return;
case 'Mohemm_ITG_GetTicketsByEmployee':
return;
case 'Mohemm_ITG_AddItemForSaleMobile':
return;
case 'Mohemm_ITG_GetItemForSale':
return;
case 'Mohemm_ITG_GetRegion':
return;
case 'Mohemm_ITG_GetItemForSaleByEmployee':
return;
case 'Mohemm_ITG_GetItemSaleCategory':
return;
case 'Mohemm_ITG_UpdateItemForSale':
return;
case 'GetAnnouncementDiscountsConfigData':
return;
case 'GetOfferDiscountsConfigData':
return;
case 'Mohemm_ITG_OffersDiscount_GetAll':
return;
case 'Mohemm_ITG_GetPageNotification':
return MohemmItgResponseItem();
case 'Mohemm_ITG_Survey_Response':
return ItgMainRes();
case 'Mohemm_ITG_GetPageNotificationDetails':
return ItgMainRes();
case 'Mohemm_ITG_UpdateAdvertisementAsViewed':
return dynamic;
case 'Mohemm_ITG_GetTicketDetails':
return;
case 'Mohemm_ITG_GetTicketTransaction':
return;
case 'Mohemm_ITG_GetTicketAttachment':
return;
case 'Mohemm_ITG_GetTicketTypes':
return;
case 'Mohemm_ITG_GetProjectDepartments':
return;
case 'Mohemm_ITG_GetDepartmentSections':
return;
case 'Mohemm_ITG_GetSectionTopics':
return;
case 'Mohemm_ITG_GetProjects':
return;
case 'ITGApproveRequest':
return;
case 'ITGRejectRequest':
return;
case 'ITGDelegateRequest':
return;
case 'ITGAnswer':
return;
case 'ITGRequestInformation':
return;
case 'ITGGrantAccess':
return;
case 'ITGGetFormDetials':
return;
case 'ITGFormsPendingTasks':
return ItgFormsModel();
case 'ITGGetFormDetialsAttachment':
return;
case 'Mohemm_GetFavoriteReplacements':
return;
case 'Mohemm_ITG_GetMyFavorites_Images':
return;
// ERP endpoints
case 'VALIDATE_ABSENCE_TRANSACTION':
return;
case 'SUBMIT_ABSENCE_TRANSACTION':
return;
case 'START_ABSENCE_APPROVAL_PROCESS':
return;
case 'GET_EIT_TRANSACTIONS':
return CollectionTransaction();
case 'GET_TIME_CARD_SUMMARY':
return;
case 'GET_DAY_HOURS_TYPE_DETAILS':
return;
case 'GET_CONCURRENT_PROGRAMS':
return;
case 'GET_SCHEDULE_SHIFTS_DETAILS':
return;
case 'GET_CONTACT_DETAILS':
return;
case 'GET_PENDING_REQ_DETAILS':
return;
case 'GET_EMPLOYEE_CONTACTS':
return;
case 'GET_OBJECT_VALUES':
return;
case 'GET_COUNTRIES':
return;
case 'START_PHONES_APPROVAL_PROCESS':
return;
case 'GET_NOTIFICATION_REASSIGN_MODE':
return;
case 'START_TERM_APPROVAL_PROCESS':
return;
case 'GET_PENDING_REQ_FUNCTIONS':
return;
case 'GET_CCP_TRANSACTIONS':
return;
case 'GET_CCP_OUTPUT':
return;
case 'GET_USER_ITEM_TYPES':
return;
case 'GET_ADDRESS_NOTIFICATION_BODY':
return;
case 'UPDATE_USER_ITEM_TYPES':
return;
case 'GET_ATTACHMENTS':
return;
case 'GET_WORKLIST':
return;
case 'GET_RFC_EMPLOYEE_LIST':
return;
case 'GET_TERM_NOTIFICATION_BODY':
return;
case 'GET_MO_ITEM_HISTORY':
return;
case 'GET_ABSENCE_DFF_STRUCTURE':
return;
case 'GET_CCP_DFF_STRUCTURE':
return;
case 'GET_TERM_DFF_STRUCTURE':
return;
case 'GET_EIT_DFF_STRUCTURE':
return;
case 'GET_CONTACT_DFF_STRUCTURE':
return;
case 'GET_BASIC_DET_DFF_STRUCTURE':
return;
case 'SUBMIT_CONTACT_TRANSACTION':
return;
case 'SUBMIT_PHONES_TRANSACTION':
return;
case 'VHR_GetManagersDetails':
return;
case 'START_CONTACT_APPROVAL_PROCESS':
return;
case 'GET_PO_ITEM_HISTORY':
return;
case 'GET_CEI_TRANSACTIONS':
return;
case 'START_CEI_APPROVAL_PROCESS':
return;
case 'VHR_GetProjectByCode':
return;
case 'Mohemm_LicenseInfoByID':
return;
case 'GET_PR_INFORMATION':
return;
case 'GET_PAY_REQ_NOTIFICATION_BODY':
return;
case 'GET_SUBORDINATES_LEAVES_TOTAL_VACATIONS':
return;
case 'GET_EMPLOYEE_SUBORDINATES':
return;
case 'GET_PR_NOTIFICATION_BODY':
return;
case 'GET_PO_NOTIFICATION_BODY':
return;
case 'GET_EIT_NOTIFICATION_BODY':
return;
case 'GET_STAMP_MS_NOTIFICATION_BODY':
return;
case 'GET_ABSENCE_NOTIFICATION_BODY':
return;
case 'GET_SUBORDINATES_LEAVES':
return;
case 'GET_NOTIFICATION_BUTTONS':
return;
case 'GET_REPLACEMENT_LIST':
return;
case 'Get_UserInformation':
return;
case 'SUBMIT_BASIC_DET_TRANSACTION':
return;
case 'CreateIssueInfo':
return GenericResponseModel();
case 'AuthenticateAndSwipeUserSupportNFC':
return GenericResponseModel();
case 'ErrorCount_Get':
return;
case 'GET_Menu_Entries':
return;
case 'GET_Open_Notifications':
return GenericResponseModel();
case 'Get_Open_Missing_Swipes':
return;
case 'GET_CONTACT_COLS_STRUCTURE':
return;
case 'GET_EMPLOYEE_ADDRESS':
return;
case 'START_BASIC_DET_APPR_PROCESS':
return;
case 'GET_BASIC_DET_COLS_STRUCTURE':
return;
case 'START_ADDRESS_APPROVAL_PROCESS':
return;
case 'SUBMIT_TERM_TRANSACTION':
return;
case 'GET_PAYSLIP':
return;
case 'GET_EARNINGS':
return;
case 'GET_DEDUCTIONS':
return;
case 'GET_SUMMARY_OF_PAYMENT':
return;
case 'GET_PAYMENT_INFORMATION':
return;
case 'GET_VALUE_SET_VALUES':
return;
case 'UPDATE_EMPLOYEE_IMAGE':
return;
case 'GET_EMPLOYEE_DOCUMENTS':
return;
case 'GET_EMPLOYEE_BASIC_DETAILS':
return;
case 'GET_EMPLOYEE_PHONES':
return;
case 'GET_PERFORMANCE_APPRAISAL':
return;
case 'START_EIT_APPROVAL_PROCESS':
return;
case 'SUBMIT_CCP_TRANSACTION':
return;
case 'SUBMIT_EIT_TRANSACTION':
return;
case 'VALIDATE_EIT_TRANSACTION':
return;
case 'SUBMIT_ADDRESS_TRANSACTION':
return;
case 'RESUBMIT_EIT_TRANSACTION':
return;
case 'GET_APPROVERS_LIST':
return;
case 'GET_WF_LOOKUP':
return;
case 'ADD_ATTACHMENT':
return;
case 'CREATE_VACATION_RULE':
return;
case 'GET_ITEM_TYPE_NOTIFICATIONS':
return;
case 'GET_VR_ITEM_TYPES':
return;
case 'GET_TERM_COLS_STRUCTURE':
return;
case 'Mohemm_ChangeFavoriteReplacements':
return;
case 'NOTIFICATION_ACTIONS':
return;
case 'GET_MO_NOTIFICATION_BODY':
return;
case 'GET_QUOTATION_ANALYSIS':
return;
case 'GET_ITEM_CREATION_NTF_BODY':
return;
case 'GET_BASIC_DET_NTF_BODY':
return;
case 'GET_ACTION_HISTORY':
return;
case 'GET_PR_ATTACHMENTS':
return;
case 'NOTIFICATION_GET_RESPOND_ATTRIBUTES':
return;
case 'GET_PHONES_NOTIFICATION_BODY':
return;
case 'GET_PR_ACTION_HISTORY':
return;
case 'GET_CONTACT_NOTIFICATION_BODY':
return;
case 'VHR_EmployeeLogin':
return;
case 'VHR_SendActivationCodebyOTPNotificationType':
return;
case 'VHR_CheckVerificationCode':
return;
case 'SetPassword':
return;
case 'GET_STAMP_NS_NOTIFICATION_BODY':
return;
case 'GET_DEFAULT_VALUE':
return;
case 'GET_ACCRUAL_BALANCES':
return GetAccrualBalancesList();
case 'DisableSession':
return;
case 'GET_VACATION_RULES':
return;
case 'Get_NewEmployees':
return;
case 'GET_EIT_STRUCTURE':
return;
case 'GET_ItemOnHand':
return;
case 'PROCESS_TRANSACTIONS':
return;
case 'INSERT_BOOKED_ORDERS_INTO_STG':
return;
case 'INSERT_AP_INV_INTO_STG':
return;
case 'INSERT_GL_JOURNALS_INTO_STG':
return;
case 'GET_Attendance_Tracking':
return GetAttendanceTracking();
case 'GET_OPEN_NOTIFICATIONS':
return GenericResponseModel();
case 'GET_ABSENCE_TRANSACTIONS':
return;
case 'GET_ABSENCE_ATTENDANCE_TYPES':
return;
case 'CALCULATE_ABSENCE_DURATION':
return;
case 'CANCEL_HR_TRANSACTION':
return;
default:
return;
}
}
}

@ -12,7 +12,7 @@ import 'package:mohem_flutter_app/models/dashboard/list_menu.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/itg/itg_main_response.dart';
import 'package:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:platform_device_id/platform_device_id.dart';
import 'package:platform_device_id_v2/platform_device_id_v2.dart';
import 'package:uuid/uuid.dart';
class DashboardApiClient {

@ -1,10 +1,12 @@
import 'dart:async';
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/api/api_mapper_class.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/basic_member_information_model.dart';
import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart';
import 'package:mohem_flutter_app/models/generic_mapper_model.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart';
import 'package:mohem_flutter_app/models/member_login_list_model.dart';
@ -51,37 +53,34 @@ class LoginApiClient {
}, url, postParams);
}
Future<CheckMobileAppVersionModel> checkMobileAppVersion() async {
Future<CheckMobileAppVersionModel?> checkMobileAppVersion() async {
String url = "${ApiConsts.authRest}CheckMobileAppVersion";
Map<String, dynamic> postParams = {};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) => CheckMobileAppVersionModel.fromJson(json), url, postParams,returnJsonData: false);
dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams, returnJsonData: false);
CheckMobileAppVersionModel res = await ApiClassMapper().handleApiEndpoint(endpoint: "CheckMobileAppVersion", jsonData: response);
return res;
}
Future<MemberLoginListModel?> memberLogin(String username, String password) async {
Future<MemberLoginListModel> memberLogin(String username, String password) async {
String url = "${ApiConsts.authRest}MemberLogin";
Map<String, dynamic> postParams = {"P_APP_VERSION": "CS", "P_LANGUAGE": "US", "P_PASSWORD": password, "P_USER_NAME": username};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
AppState().postParamsObject?.setLogInTokenID = responseData.logInTokenID;
print("setLogInTokenID:${AppState().postParamsObject?.logInTokenID}");
return responseData.memberLoginList;
}, url, postParams);
dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams);
MemberLoginListModel res = await ApiClassMapper().handleApiEndpoint(endpoint: "MemberLogin", jsonData: response);
AppState().postParamsObject?.setLogInTokenID = res.logInTokenId;
print("setLogInTokenID: ${AppState().postParamsObject?.logInTokenID}");
return res;
}
Future<BasicMemberInformationModel?> mohemmSendActivationCodeByOTPNotificationType(int isMobileFingerPrint, String? mobileNumber, int optSendType, String? pUserName) async {
String url = "${ApiConsts.authRest}Mohemm_SendActivationCodebyOTPNotificationType";
Map<String, dynamic> postParams = {"IsMobileFingerPrint": isMobileFingerPrint, "MobileNumber": mobileNumber, "OTP_SendType": optSendType, "P_USER_NAME": pUserName};
postParams.addAll(AppState().postParamsJson);
postParams["LogInTokenID"]=AppState().postParamsObject?.logInTokenID;
postParams["LogInTokenID"] = AppState().postParamsObject?.logInTokenID;
print(postParams);
return await ApiClient().postJsonForObject((json) {
AppState().postParamsObject?.setLogInTokenID = json["LogInTokenID"];
return BasicMemberInformationModel.fromJson(json);
// GenericResponseModel.fromJson(json).basicMemberInformation;
}, url, postParams);
dynamic response = await ApiClient().postJsonForObject((json) => json, url, postParams);
return await ApiClassMapper().handleApiEndpoint(endpoint: "Mohemm_SendActivationCodebyOTPNotificationType", jsonData: response);
}
Future<GenericResponseModel?> checkActivationCode(bool isDeviceNFC, String? mobileNumber, String activationCode, String? pUserName) async {
@ -89,15 +88,15 @@ class LoginApiClient {
Map<String, dynamic> postParams = {"IsDeviceNFC": isDeviceNFC, "MobileNumber": mobileNumber, "ActivationCode": activationCode, "P_USER_NAME": pUserName};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
GenericResponseModel responseData = GenericResponseModel.fromJson(json.data);
AppState().postParamsObject?.setTokenID = responseData.tokenID;
AppState().postParamsObject?.mobileNumber = responseData.basicMemberInformation!.pMOBILENUMBER;
AppState().postParamsObject?.mobileNumber = responseData.basicMemberInformation!.pMobileNumber;
AppState().postParamsObject?.userName = AppState().getUserName;
AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEMAILADDRESS;
AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEmailAddress;
AppState().postParamsObject?.pSessionId = responseData.pSESSIONID;
AppState().postParamsObject?.pUserName = AppState().getUserName;
AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName;
AppState().postParamsObject?.setPLegislationCode = responseData.basicMemberInformation!.pLEGISLATIONCODE;
AppState().postParamsObject?.setPLegislationCode = responseData.basicMemberInformation!.pLegislationCode;
AppState().postParamsObject?.setPayrollCodeStr = responseData.memberInformationList!.first.pAYROLLCODE;
AppState().setBusinessCardPrivilege = responseData.businessCardPrivilege ?? false;
return responseData;

@ -1,4 +1,3 @@
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
class ApiConsts {
// static String baseUrl = "http://10.200.204.11"; // Local server
@ -99,3 +98,8 @@ class SharedPrefsConsts {
}

@ -7,7 +7,7 @@ import 'package:flutter/material.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:huawei_push/huawei_push.dart' as huawei_push;
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';
@ -35,7 +35,7 @@ class AppNotifications {
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();
bool? granted = await androidImplementation?.requestNotificationsPermission();
if (granted == false) {
if (kDebugMode) {
print("-------------------- Permission Granted ------------------------");
@ -79,16 +79,16 @@ class AppNotifications {
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()));
// 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);
@ -99,7 +99,7 @@ class AppNotifications {
void initHuaweiPush(Function loginCallback) {
AppState().setIsHuawei = true;
initTokenStream(loginCallback);
huawei_push.Push.getToken("");
// huawei_push.Push.getToken("");
}
// HUAWEI PUSH TOKEN IMPLEMENTATION
@ -115,11 +115,11 @@ class AppNotifications {
}
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();
});
// huawei_push.Push.getTokenStream.listen(_onTokenEvent, onError: _onTokenError).onData((data) {
// AppState().setHuaweiPushToken = data;
// debugPrint("HUAWEI PUSH TOKEN: $data");
// loginCallback();
// });
}
void _handleMessage(RemoteMessage message) {

@ -377,17 +377,19 @@ class Utils {
}
static void readNFc({required Function(String) onRead}) {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
MifareUltralight f;
if (Platform.isAndroid) {
f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
} else {
f = MifareUltralight(tag: tag, identifier: tag.data["mifare"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
}
String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join('');
NfcManager.instance.stopSession();
onRead(identifier);
}).catchError((err) {
NfcManager.instance.startSession(
onDiscovered: (NfcTag tag) async {
MifareUltralight f;
if (Platform.isAndroid) {
f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
} else {
f = MifareUltralight(tag: tag, identifier: tag.data["mifare"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22);
}
String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join('');
NfcManager.instance.stopSession();
onRead(identifier);
},
).catchError((err) {
print(err);
});
}

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class AppProvider extends StatelessWidget {
final Widget child;
@ -9,11 +8,5 @@ class AppProvider extends StatelessWidget {
@override
Widget build(BuildContext context) {
return child;
return MultiProvider(
providers: [
// ChangeNotifierProvider(create: (_) => Counter()),
],
child: child,
);
}
}

@ -32,6 +32,7 @@ import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart';
// import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart';
import 'package:mohem_flutter_app/ui/my_team/create_request.dart';
import 'package:mohem_flutter_app/ui/my_team/employee_details.dart';
@ -54,6 +55,7 @@ import 'package:mohem_flutter_app/ui/profile/profile_screen.dart';
import 'package:mohem_flutter_app/ui/screens/announcements/announcement_details.dart';
import 'package:mohem_flutter_app/ui/screens/announcements/announcements.dart';
import 'package:mohem_flutter_app/ui/screens/child_education/child_education_assistance.dart';
// import 'package:mohem_flutter_app/ui/my_attendance/work_from_home_screen.dart';
import 'package:mohem_flutter_app/ui/screens/eit/add_eit.dart';
import 'package:mohem_flutter_app/ui/screens/items_for_sale/add_new_item_for_sale.dart';
@ -260,7 +262,8 @@ class AppRoutes {
addDynamicInputProfile: (BuildContext context) => DynamicInputScreenProfile(),
addDynamicAddressScreen: (BuildContext context) => DynamicInputScreenAddress(),
deleteFamilyMember: (BuildContext context) => DeleteFamilyMember(ModalRoute.of(context)!.settings.arguments as int),
deleteFamilyMember: (BuildContext context) => DeleteFamilyMember(relationId: ModalRoute.of(context)!.settings.arguments as int),
requestSubmitScreen: (BuildContext context) => RequestSubmitScreen(),
addUpdateFamilyMember: (BuildContext context) => AddUpdateFamilyMember(),

@ -202,11 +202,11 @@ class OtpDialog {
),
errorBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor),
borderSide: BorderSide(color: Theme.of(context).colorScheme.error),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor),
borderSide: BorderSide(color: Theme.of(context).colorScheme.error),
),
);
}

@ -19,7 +19,6 @@ import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
import 'package:sizer/sizer.dart';
// test uat account
// username 199067
// pass h123456
@ -96,11 +95,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Sizer(
builder: (
BuildContext context,
Orientation orientation,
DeviceType deviceType,
) {
builder: (context, orientation, deviceType) {
PostParamsModel? obj = AppState().postParamsObject;
obj?.languageID = EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2;
AppState().setPostParamsModel(obj!);

@ -1,32 +1,41 @@
import 'dart:convert';
class BasicMemberInformationModel {
String? pEMAILADDRESS;
String? pLEGISLATIONCODE;
String? pMOBILENUMBER;
String? pRETURNMSG;
String? pRETURNSTATUS;
String? pReturnStatus;
dynamic pReturnMsg;
String? pMobileNumber;
String? pEmailAddress;
String? pLegislationCode;
String? logInTokenId;
BasicMemberInformationModel({
this.pReturnStatus,
this.pReturnMsg,
this.pMobileNumber,
this.pEmailAddress,
this.pLegislationCode,
this.logInTokenId,
});
factory BasicMemberInformationModel.fromRawJson(String str) => BasicMemberInformationModel.fromJson(json.decode(str));
BasicMemberInformationModel(
{this.pEMAILADDRESS,
this.pLEGISLATIONCODE,
this.pMOBILENUMBER,
this.pRETURNMSG,
this.pRETURNSTATUS});
String toRawJson() => json.encode(toJson());
BasicMemberInformationModel.fromJson(Map<String, dynamic> json) {
pEMAILADDRESS = json['P_EMAIL_ADDRESS'];
pLEGISLATIONCODE = json['P_LEGISLATION_CODE'];
pMOBILENUMBER = json['P_MOBILE_NUMBER'];
pRETURNMSG = json['P_RETURN_MSG'];
pRETURNSTATUS = json['P_RETURN_STATUS'];
}
factory BasicMemberInformationModel.fromJson(Map<String, dynamic> json) => BasicMemberInformationModel(
pReturnStatus: json["p_RETURN_STATUS"],
pReturnMsg: json["p_RETURN_MSG"],
pMobileNumber: json["p_MOBILE_NUMBER"],
pEmailAddress: json["p_EMAIL_ADDRESS"],
pLegislationCode: json["p_LEGISLATION_CODE"],
logInTokenId: json["logInTokenID"],
);
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['P_EMAIL_ADDRESS'] = this.pEMAILADDRESS;
data['P_LEGISLATION_CODE'] = this.pLEGISLATIONCODE;
data['P_MOBILE_NUMBER'] = this.pMOBILENUMBER;
data['P_RETURN_MSG'] = this.pRETURNMSG;
data['P_RETURN_STATUS'] = this.pRETURNSTATUS;
return data;
}
Map<String, dynamic> toJson() => {
"p_RETURN_STATUS": pReturnStatus,
"p_RETURN_MSG": pReturnMsg,
"p_MOBILE_NUMBER": pMobileNumber,
"p_EMAIL_ADDRESS": pEmailAddress,
"p_LEGISLATION_CODE": pLegislationCode,
"logInTokenID": logInTokenId,
};
}

@ -1,191 +1,21 @@
import 'dart:convert';
class CheckMobileAppVersionModel {
String? date;
int? languageID;
int? serviceName;
String? time;
String? androidLink;
String? authenticationTokenID;
String? data;
bool? dataw;
int? dietType;
int? dietTypeID;
int? errorCode;
String? errorEndUserMessage;
String? errorEndUserMessageN;
String? errorMessage;
int? errorType;
int? foodCategory;
String? iOSLink;
bool? isAuthenticated;
int? mealOrderStatus;
int? mealType;
int? messageStatus;
int? numberOfResultRecords;
String? patientBlodType;
String? successMsg;
String? successMsgN;
String? vidaUpdatedResponse;
String? encryprURL;
bool? kioskHelp;
List<Null>? listRssItems;
List<Null>? listKioskFingerPrint;
List<Null>? listKioskFingerPrintGetByID;
List<Null>? listKioskGetLastTransaction;
List<Null>? listRegKioskFingerPrint;
String? message;
String? ramadanTimeObj;
String? habibTwitterList;
CheckMobileAppVersionModel(
{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.encryprURL,
this.kioskHelp,
this.listRssItems,
this.listKioskFingerPrint,
this.listKioskFingerPrintGetByID,
this.listKioskGetLastTransaction,
this.listRegKioskFingerPrint,
this.message,
this.ramadanTimeObj,
this.habibTwitterList});
CheckMobileAppVersionModel({
this.data,
});
factory CheckMobileAppVersionModel.fromRawJson(String str) => CheckMobileAppVersionModel.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
CheckMobileAppVersionModel.fromJson(Map<String, dynamic> json) {
date = json['Date'];
languageID = json['LanguageID'];
serviceName = json['ServiceName'];
time = json['Time'];
androidLink = json['AndroidLink'];
authenticationTokenID = json['AuthenticationTokenID'];
data = json['Data'];
dataw = json['Dataw'];
dietType = json['DietType'];
dietTypeID = json['DietTypeID'];
errorCode = json['ErrorCode'];
errorEndUserMessage = json['ErrorEndUserMessage'];
errorEndUserMessageN = json['ErrorEndUserMessageN'];
errorMessage = json['ErrorMessage'];
errorType = json['ErrorType'];
foodCategory = json['FoodCategory'];
iOSLink = json['IOSLink'];
isAuthenticated = json['IsAuthenticated'];
mealOrderStatus = json['MealOrderStatus'];
mealType = json['MealType'];
messageStatus = json['MessageStatus'];
numberOfResultRecords = json['NumberOfResultRecords'];
patientBlodType = json['PatientBlodType'];
successMsg = json['SuccessMsg'];
successMsgN = json['SuccessMsgN'];
vidaUpdatedResponse = json['VidaUpdatedResponse'];
encryprURL = json['EncryprURL'];
kioskHelp = json['KioskHelp'];
if (json['ListRssItems'] != null) {
listRssItems = <Null>[];
json['ListRssItems'].forEach((v) {
//listRssItems!.add(new Null.fromJson(v));
});
}
if (json['List_Kiosk_FingerPrint'] != null) {
listKioskFingerPrint = <Null>[];
json['List_Kiosk_FingerPrint'].forEach((v) {
// listKioskFingerPrint!.add(new Null.fromJson(v));
});
}
if (json['List_Kiosk_FingerPrintGetByID'] != null) {
listKioskFingerPrintGetByID = <Null>[];
json['List_Kiosk_FingerPrintGetByID'].forEach((v) {
// listKioskFingerPrintGetByID!.add(new Null.fromJson(v));
});
}
if (json['List_Kiosk_GetLastTransaction'] != null) {
listKioskGetLastTransaction = <Null>[];
json['List_Kiosk_GetLastTransaction'].forEach((v) {
// listKioskGetLastTransaction!.add(new Null.fromJson(v));
});
}
if (json['List_RegKiosk_FingerPrint'] != null) {
listRegKioskFingerPrint = <Null>[];
json['List_RegKiosk_FingerPrint'].forEach((v) {
// listRegKioskFingerPrint!.add(new Null.fromJson(v));
});
}
message = json['Message'];
ramadanTimeObj = json['RamadanTimeObj'];
habibTwitterList = json['habibTwitterList'];
}
factory CheckMobileAppVersionModel.fromJson(Map<String, dynamic> json) => CheckMobileAppVersionModel(
data: json["data"],
);
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['Date'] = this.date;
data['LanguageID'] = this.languageID;
data['ServiceName'] = this.serviceName;
data['Time'] = this.time;
data['AndroidLink'] = this.androidLink;
data['AuthenticationTokenID'] = this.authenticationTokenID;
data['Data'] = this.data;
data['Dataw'] = this.dataw;
data['DietType'] = this.dietType;
data['DietTypeID'] = this.dietTypeID;
data['ErrorCode'] = this.errorCode;
data['ErrorEndUserMessage'] = this.errorEndUserMessage;
data['ErrorEndUserMessageN'] = this.errorEndUserMessageN;
data['ErrorMessage'] = this.errorMessage;
data['ErrorType'] = this.errorType;
data['FoodCategory'] = this.foodCategory;
data['IOSLink'] = this.iOSLink;
data['IsAuthenticated'] = this.isAuthenticated;
data['MealOrderStatus'] = this.mealOrderStatus;
data['MealType'] = this.mealType;
data['MessageStatus'] = this.messageStatus;
data['NumberOfResultRecords'] = this.numberOfResultRecords;
data['PatientBlodType'] = this.patientBlodType;
data['SuccessMsg'] = this.successMsg;
data['SuccessMsgN'] = this.successMsgN;
data['VidaUpdatedResponse'] = this.vidaUpdatedResponse;
data['EncryprURL'] = this.encryprURL;
data['KioskHelp'] = this.kioskHelp;
if (this.listRssItems != null) {
//data['ListRssItems'] = this.listRssItems!.map((v) => v.toJson()).toList();
}
if (this.listKioskFingerPrint != null) {
// data['List_Kiosk_FingerPrint'] = this.listKioskFingerPrint!.map((v) => v.toJson()).toList();
}
if (this.listKioskFingerPrintGetByID != null) {
//data['List_Kiosk_FingerPrintGetByID'] = this.listKioskFingerPrintGetByID!.map((v) => v.toJson()).toList();
}
if (this.listKioskGetLastTransaction != null) {
//data['List_Kiosk_GetLastTransaction'] = this.listKioskGetLastTransaction!.map((v) => v.toJson()).toList();
}
if (this.listRegKioskFingerPrint != null) {
//data['List_RegKiosk_FingerPrint'] = this.listRegKioskFingerPrint!.map((v) => v.toJson()).toList();
}
data['Message'] = this.message;
data['RamadanTimeObj'] = this.ramadanTimeObj;
data['habibTwitterList'] = this.habibTwitterList;
return data;
}
Map<String, dynamic> toJson() => {
"data": data,
};
}

@ -0,0 +1,37 @@
import 'dart:convert';
class GenericMapperModel {
int? totalItemsCount;
dynamic data;
int? messageStatus;
dynamic errorMessage;
dynamic errorEndUserMessage;
GenericMapperModel({
this.totalItemsCount,
this.data,
this.messageStatus,
this.errorMessage,
this.errorEndUserMessage,
});
factory GenericMapperModel.fromRawJson(String str) => GenericMapperModel.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory GenericMapperModel.fromJson(Map<String, dynamic> json) => GenericMapperModel(
totalItemsCount: json["totalItemsCount"],
data: json["data"],
messageStatus: json["messageStatus"],
errorMessage: json["errorMessage"],
errorEndUserMessage: json["errorEndUserMessage"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount,
"data": data,
"messageStatus": messageStatus,
"errorMessage": errorMessage,
"errorEndUserMessage": errorEndUserMessage,
};
}

@ -1,48 +1,49 @@
import 'dart:convert';
class MemberLoginListModel {
String? pEMAILADDRESS;
String? pINVALIDLOGINMSG;
String? pLEGISLATIONCODE;
String? pMOBILENUMBER;
String? pPASSOWRDEXPIRED;
String? pPASSWORDEXPIREDMSG;
String? pRETURNMSG;
String? pRETURNSTATUS;
int? pSESSIONID;
String? pReturnStatus;
String? pReturnMsg;
String? pPassowrdExpired;
String? pPasswordExpiredMsg;
String? pMobileNumber;
String? pEmailAddress;
String? pLegislationCode;
String? logInTokenId;
MemberLoginListModel({
this.pReturnStatus,
this.pReturnMsg,
this.pPassowrdExpired,
this.pPasswordExpiredMsg,
this.pMobileNumber,
this.pEmailAddress,
this.pLegislationCode,
this.logInTokenId,
});
factory MemberLoginListModel.fromRawJson(String str) => MemberLoginListModel.fromJson(json.decode(str));
MemberLoginListModel(
{this.pEMAILADDRESS,
this.pINVALIDLOGINMSG,
this.pLEGISLATIONCODE,
this.pMOBILENUMBER,
this.pPASSOWRDEXPIRED,
this.pPASSWORDEXPIREDMSG,
this.pRETURNMSG,
this.pRETURNSTATUS,
this.pSESSIONID});
String toRawJson() => json.encode(toJson());
MemberLoginListModel.fromJson(Map<String, dynamic> json) {
pEMAILADDRESS = json['P_EMAIL_ADDRESS'];
pINVALIDLOGINMSG = json['P_INVALID_LOGIN_MSG'];
pLEGISLATIONCODE = json['P_LEGISLATION_CODE'];
pMOBILENUMBER = json['P_MOBILE_NUMBER'];
pPASSOWRDEXPIRED = json['P_PASSOWRD_EXPIRED'];
pPASSWORDEXPIREDMSG = json['P_PASSWORD_EXPIRED_MSG'];
pRETURNMSG = json['P_RETURN_MSG'];
pRETURNSTATUS = json['P_RETURN_STATUS'];
pSESSIONID = json['P_SESSION_ID'];
}
factory MemberLoginListModel.fromJson(Map<String, dynamic> json) => MemberLoginListModel(
pReturnStatus: json["p_RETURN_STATUS"],
pReturnMsg: json["p_RETURN_MSG"],
pPassowrdExpired: json["p_PASSOWRD_EXPIRED"],
pPasswordExpiredMsg: json["p_PASSWORD_EXPIRED_MSG"],
pMobileNumber: json["p_MOBILE_NUMBER"],
pEmailAddress: json["p_EMAIL_ADDRESS"],
pLegislationCode: json["p_LEGISLATION_CODE"],
logInTokenId: json["logInTokenID"],
);
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['P_EMAIL_ADDRESS'] = this.pEMAILADDRESS;
data['P_INVALID_LOGIN_MSG'] = this.pINVALIDLOGINMSG;
data['P_LEGISLATION_CODE'] = this.pLEGISLATIONCODE;
data['P_MOBILE_NUMBER'] = this.pMOBILENUMBER;
data['P_PASSOWRD_EXPIRED'] = this.pPASSOWRDEXPIRED;
data['P_PASSWORD_EXPIRED_MSG'] = this.pPASSWORDEXPIREDMSG;
data['P_RETURN_MSG'] = this.pRETURNMSG;
data['P_RETURN_STATUS'] = this.pRETURNSTATUS;
data['P_SESSION_ID'] = this.pSESSIONID;
return data;
}
Map<String, dynamic> toJson() => {
"p_RETURN_STATUS": pReturnStatus,
"p_RETURN_MSG": pReturnMsg,
"p_PASSOWRD_EXPIRED": pPassowrdExpired,
"p_PASSWORD_EXPIRED_MSG": pPasswordExpiredMsg,
"p_MOBILE_NUMBER": pMobileNumber,
"p_EMAIL_ADDRESS": pEmailAddress,
"p_LEGISLATION_CODE": pLegislationCode,
"logInTokenID": logInTokenId,
};
}

@ -76,7 +76,15 @@ class PostParamsModel {
return data;
}
set setLogInTokenID(String? token) => logInTokenID = token;
// setLogInTokenID(String? token) => logInTokenID = token;
String? _LogInTokenID;
String? get getLogInTokenID => _LogInTokenID;
set setLogInTokenID(String? value) {
logInTokenID = value;
_LogInTokenID = value;
}
set setTokenID(String? token) => tokenID = token;

@ -399,8 +399,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (data.first.userChatReplyResponse != null) {
if (data.first.fileTypeResponse != null) {
if (data.first.userChatReplyResponse!.fileTypeId == 12 || data.first.userChatReplyResponse!.fileTypeId == 4 || data.first.userChatReplyResponse!.fileTypeId == 3) {
data.first.userChatReplyResponse!.image =
await ChatApiClient().downloadURL(fileName: data.first.userChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 1);
data.first.userChatReplyResponse!.image = await ChatApiClient()
.downloadURL(fileName: data.first.userChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 1);
data.first.userChatReplyResponse!.isImageLoaded = true;
}
}
@ -476,8 +476,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (data.first.groupChatReplyResponse != null) {
if (data.first.fileTypeResponse != null) {
if (data.first.groupChatReplyResponse!.fileTypeId == 12 || data.first.groupChatReplyResponse!.fileTypeId == 4 || data.first.groupChatReplyResponse!.fileTypeId == 3) {
data.first.groupChatReplyResponse!.image =
await ChatApiClient().downloadURL(fileName: data.first.groupChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 2);
data.first.groupChatReplyResponse!.image = await ChatApiClient()
.downloadURL(fileName: data.first.groupChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 2);
data.first.groupChatReplyResponse!.isImageLoaded = true;
}
}
@ -1653,7 +1653,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void sRecoding() async {
isVoiceMsg = true;
recorderController.reset();
await recorderController.record(path);
await recorderController.record(path: path);
_recodeDuration = 0;
_startTimer();
isRecoding = !isRecoding;
@ -1685,7 +1685,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
File file = File(path!);
file.readAsBytesSync();
path = file.path;
await playerController.preparePlayer(file.path, 1.0);
await playerController.preparePlayer(path: file.path, volume: 1.0);
_timer?.cancel();
notifyListeners();
}
@ -1704,8 +1704,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
double fileSizeInMB = fileSizeInKB / 1024;
if (kDebugMode) {
debugPrint("Deleted file size: ${delFile.lengthSync()}");
debugPrint("Deleted file size in KB: " + fileSizeInKB.toString());
debugPrint("Deleted file size in MB: " + fileSizeInMB.toString());
debugPrint("Deleted file size in KB: $fileSizeInKB");
debugPrint("Deleted file size in MB: $fileSizeInMB");
}
if (await delFile.exists()) {
delFile.delete();

@ -2,12 +2,20 @@ import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/theme/colors.dart';
import 'package:flutter/material.dart';
class AppTheme {
static ThemeData getTheme(isArabic) => ThemeData(
static ThemeData getTheme(bool isArabic) => ThemeData(
useMaterial3: true,
// Added Material 3 support
fontFamily: isArabic ? 'Cairo' : 'Poppins',
primarySwatch: Colors.red,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.red,
brightness: Brightness.light,
secondary: MyColors.backgroundColor, // Replaces accentColor
error: const Color.fromRGBO(235, 80, 60, 1.0),
),
visualDensity: VisualDensity.adaptivePlatformDensity,
brightness: Brightness.light,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
@ -15,42 +23,92 @@ class AppTheme {
},
),
hintColor: Colors.grey[400],
colorScheme: ColorScheme.fromSwatch(accentColor: MyColors.backgroundColor),
disabledColor: Colors.grey[300],
errorColor: const Color.fromRGBO(235, 80, 60, 1.0),
scaffoldBackgroundColor: MyColors.backgroundColor,
textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.grey, selectionColor: Color.fromRGBO(80, 100, 253, 0.5), selectionHandleColor: Colors.grey),
textSelectionTheme: const TextSelectionThemeData(
cursorColor: Colors.grey,
selectionColor: Color.fromRGBO(80, 100, 253, 0.5),
selectionHandleColor: Colors.grey,
),
canvasColor: Colors.white,
backgroundColor: const Color.fromRGBO(255, 255, 255, 1),
highlightColor: Colors.grey[100]!.withOpacity(0.4),
splashColor: Colors.transparent,
primaryColor: primaryColor,
primaryColorDark: primaryColor,
buttonColor: Colors.black,
toggleableActiveColor: secondaryColor,
indicatorColor: secondaryColor,
bottomSheetTheme: const BottomSheetThemeData(
backgroundColor: Color(0xFFE0E0E0),
),
primaryTextTheme: const TextTheme(
bodyText2: TextStyle(color: Colors.white),
surfaceTintColor: Colors.transparent, // Added for Material 3
),
iconTheme: const IconThemeData(color: MyColors.darkIconColor),
textTheme: const TextTheme(
bodyText1: TextStyle(color: Colors.black, letterSpacing: 0.6),
headline1: TextStyle(color: Colors.white, letterSpacing: 0.6),
headline2: TextStyle(color: Colors.white, letterSpacing: 0.6),
bodyLarge: TextStyle(color: Colors.black, letterSpacing: 0.6), // Updated from bodyText1
bodyMedium: TextStyle(color: Colors.black, letterSpacing: 0.6), // Added for better coverage
displayLarge: TextStyle(color: Colors.white, letterSpacing: 0.6), // Updated from headline1
displayMedium: TextStyle(color: Colors.white, letterSpacing: 0.6), // Updated from headline2
),
floatingActionButtonTheme: const FloatingActionButtonThemeData(
highlightElevation: 2,
disabledElevation: 0,
elevation: 2,
),
floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2),
appBarTheme: AppBarTheme(
color: const Color(0xff515A5D),
brightness: Brightness.light,
backgroundColor: const Color(0xff515A5D),
surfaceTintColor: Colors.transparent,
// Added for Material 3
elevation: 0.0,
actionsIconTheme: IconThemeData(
color: Colors.grey[800],
),
iconTheme: IconThemeData(
color: Colors.grey[800],
),
),
checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return secondaryColor;
}
return null;
}),
),
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return secondaryColor;
}
return null;
}),
),
switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return secondaryColor;
}
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return null;
}
if (states.contains(MaterialState.selected)) {
return secondaryColor;
}
return null;
}),
),
);
static Color get primaryColor => Colors.red;
static Color get secondaryColor => MyColors.backgroundColor;
}
extension ExtendedRevoCheckTheme on TextTheme {

@ -16,7 +16,7 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.
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:month_picker_dialog/month_picker_dialog.dart';
import 'package:pie_chart/pie_chart.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
@ -117,8 +117,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
initialDate: formattedDate,
firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(),
confirmText: Text(LocaleKeys.confirm.tr()),
cancelText: Text(LocaleKeys.cancel.tr()),
// Need to Fix Here
// confirmWidget: Text(LocaleKeys.confirm.tr()),
// cancelWidget: Text(LocaleKeys.cancel.tr()),
).then((selectedDate) {
if (selectedDate != null) {
searchMonth = getMonth(selectedDate.month);

@ -170,7 +170,7 @@ class WaveBubble extends StatelessWidget {
padding: EdgeInsets.zero,
margin: EdgeInsets.zero,
enableSeekGesture: true,
density: 1,
// density: 1,
playerWaveStyle: const PlayerWaveStyle(
fixedWaveColor: Colors.white,
liveWaveColor: MyColors.greenColor,
@ -178,7 +178,7 @@ class WaveBubble extends StatelessWidget {
showBottom: true,
waveCap: StrokeCap.round,
seekLineThickness: 2,
visualizerHeight: 4,
// visualizerHeight: 4,
backgroundColor: Colors.transparent,
),
),

@ -44,12 +44,12 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
Utils.showLoading(context);
try {
_basicMemberInformation = await LoginApiClient().getBasicUserInformation("CS", employeeId.text);
genericResponseModel = await LoginApiClient().sendPublicActivationCode(_basicMemberInformation?.pMOBILENUMBER, employeeId.text);
genericResponseModel = await LoginApiClient().sendPublicActivationCode(_basicMemberInformation?.pMobileNumber, employeeId.text);
Utils.hideLoading(context);
OtpDialog(
context,
1,
int.tryParse(_basicMemberInformation?.pMOBILENUMBER ?? ""),
int.tryParse(_basicMemberInformation?.pMobileNumber ?? ""),
(value,TextEditingController _pinPutController) async {
Utils.showLoading(context);
try{

@ -73,7 +73,7 @@ class _LoginScreenState extends State<LoginScreen> {
// hmsApiAvailability = HmsApiAvailability();
// checkFirebaseToken();
if (kReleaseMode) {
checkDeviceSafety();
// checkDeviceSafety();
}
}
@ -239,12 +239,12 @@ class _LoginScreenState extends State<LoginScreen> {
Utils.showLoading(context);
try {
_basicMemberInformation = await LoginApiClient().getBasicUserInformation("CS", username.text);
genericResponseModel = await LoginApiClient().sendPublicActivationCode(_basicMemberInformation?.pMOBILENUMBER, username.text);
genericResponseModel = await LoginApiClient().sendPublicActivationCode(_basicMemberInformation?.pMobileNumber, username.text);
Utils.hideLoading(context);
OtpDialog(
context,
1,
int.tryParse(_basicMemberInformation?.pMOBILENUMBER ?? ""),
int.tryParse(_basicMemberInformation?.pMobileNumber ?? ""),
(value, TextEditingController _pinPutController) async {
Utils.showLoading(context);
try {

@ -4,7 +4,6 @@ import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:local_auth/auth_strings.dart';
import 'package:local_auth/local_auth.dart';
import 'package:mohem_flutter_app/api/login_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
@ -24,6 +23,7 @@ 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';
import 'package:local_auth_darwin/local_auth_darwin.dart';
// WhatsApp 4
// SMS 1
@ -225,7 +225,10 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID');
bool authenticated = false;
try {
authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings);
authenticated = await auth.authenticate(
localizedReason: 'Scan your fingerprint to authenticate',
authMessages: [iosStrings],
options: const AuthenticationOptions(stickyAuth: true, useErrorDialogs: true, biometricOnly: true, sensitiveTransaction: false));
} on PlatformException catch (e) {
print(e);
Utils.hideLoading(context);
@ -337,7 +340,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
if (!isDirectLogin) {
BasicMemberInformationModel? memberInformationModel =
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMobileNumber, sendVerificationFlat, AppState().getUserName);
}
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "", null);
if (!isDirectLogin) Utils.hideLoading(context);
@ -345,7 +348,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
OtpDialog(
context,
sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
int.tryParse(AppState().memberLoginList?.pMobileNumber ?? ""),
(value, TextEditingController _pinPutController) async {
Utils.showLoading(context);
performDirectApiCall(_title, _icon, _flag, value, _pinPutController);
@ -366,18 +369,18 @@ 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(true, AppState().memberLoginList?.pMobileNumber, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
AppState().memberLoginList?.pEMAILADDRESS ?? "",
AppState().memberLoginList?.pEmailAddress ?? "",
genericResponseModel?.pSESSIONID ?? 0,
genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "",
_flag,
AppState().memberLoginList?.pMOBILENUMBER ?? "",
AppState().memberLoginList?.pMobileNumber ?? "",
AppState().getUserName!,
AppState().getIsHuawei ? AppState().getHuaweiPushToken : mobileLoginInfoListModel!.deviceToken!,
Platform.isAndroid ? "android" : "ios");
AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first;
AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? [];
AppState().setPrivilegeListModel = genericResponseModel.privilegeList ?? [];
if (genericResponseModel.errorMessage != null) {
Utils.showToast(genericResponseModel.errorMessage ?? "");
// Navigator.pop(context);

@ -4,7 +4,6 @@ import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:local_auth/auth_strings.dart';
import 'package:local_auth/local_auth.dart';
import 'package:mohem_flutter_app/api/login_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
@ -20,6 +19,7 @@ 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/member_information_list_model.dart';
import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:local_auth_darwin/local_auth_darwin.dart';
// WhatsApp 2
// SMS 1
@ -516,7 +516,11 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID');
bool authenticated = false;
try {
authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings);
authenticated = await auth.authenticate(
localizedReason: 'Scan your fingerprint to authenticate',
authMessages: [iosStrings],
options: const AuthenticationOptions(stickyAuth: true, useErrorDialogs: true, biometricOnly: true, sensitiveTransaction: false));
// authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings);
} on PlatformException catch (e) {
print(e);
Utils.hideLoading(context);
@ -611,22 +615,22 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
await LoginApiClient().checkMobileAppVersion();
await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!);
BasicMemberInformationModel? memberInformationModel =
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMobileNumber, sendVerificationFlat, AppState().getUserName);
Utils.hideLoading(context);
OtpDialog(
context,
sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
int.tryParse(AppState().memberLoginList?.pMobileNumber ?? ""),
(value, TextEditingController _pinPutController) async {
Utils.showLoading(context);
//try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMobileNumber, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
AppState().memberLoginList?.pEMAILADDRESS ?? "",
AppState().memberLoginList?.pEmailAddress ?? "",
genericResponseModel?.pSESSIONID ?? 0,
genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "",
_flag,
AppState().memberLoginList?.pMOBILENUMBER ?? "",
AppState().memberLoginList?.pMobileNumber ?? "",
AppState().getUserName!,
AppState().getIsHuawei ? AppState().getHuaweiPushToken : firebaseToken!,
Platform.isAndroid ? "android" : "ios");
@ -674,7 +678,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
).displayDialog(context);
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
Utils.handleException(ex, context, null);
}
}
//

@ -30,12 +30,10 @@ class QuestionCard extends StatelessWidget {
width: double.infinity,
child: AppinioSwiper(
duration: const Duration(milliseconds: 400),
padding: EdgeInsets.zero,
// padding: EdgeInsets.zero,
isDisabled: true,
controller: provider.swiperController,
unswipe: (int index, AppinioSwiperDirection direction) {},
onSwipe: (int index, AppinioSwiperDirection direction) {},
cards: provider.cardContentList,
cardCount: provider.cardContentList.length, cardBuilder: (BuildContext context, int index) => provider.cardContentList.first,
),
),
);

@ -15,7 +15,7 @@ import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.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:month_picker_dialog/month_picker_dialog.dart';
import 'package:pie_chart/pie_chart.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
@ -169,8 +169,8 @@ class _ViewAttendanceState extends State<ViewAttendance> {
initialDate: formattedDate,
firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(),
confirmText: Text(LocaleKeys.confirm.tr()),
cancelText: Text(LocaleKeys.cancel.tr()),
// confirmWidget: Text(LocaleKeys.confirm.tr()),
// cancelWidget: Text(LocaleKeys.cancel.tr()),
).then(
(selectedDate) {
if (selectedDate != null) {

@ -21,7 +21,7 @@ import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget
class DeleteFamilyMember extends StatefulWidget {
int relationId;
DeleteFamilyMember(@required this.relationId, {Key? key}) : super(key: key);
DeleteFamilyMember({Key? key, required this.relationId}) : super(key: key);
@override
_DeleteFamilyMemberState createState() => _DeleteFamilyMemberState();
@ -115,8 +115,7 @@ class _DeleteFamilyMemberState extends State<DeleteFamilyMember> {
padding: EdgeInsets.only(left: 50, right: 50),
child: TextButton(
style: TextButton.styleFrom(
primary: MyColors.white,
onSurface: MyColors.white,
foregroundColor: MyColors.white, disabledForegroundColor: MyColors.white.withOpacity(0.38),
backgroundColor: MyColors.gradiantEndColor,
),
onPressed: () {

@ -92,11 +92,13 @@ class _MyDocumentDetailScreenState extends State<MyDocumentDetailScreen> {
),
12.height,
DottedBorder(
borderType: BorderType.RRect,
radius: const Radius.circular(10),
padding: const EdgeInsets.all(12),
dashPattern: const <double>[2, 1],
color: MyColors.selectedBorderColor,
options: RectDottedBorderOptions(
// borderType: BorderType.RRect,
// borderRadius: const BorderRadius.all(Radius.circular(10)),
padding: const EdgeInsets.all(12),
dashPattern: const <double>[2, 1],
color: MyColors.selectedBorderColor,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [

@ -76,7 +76,7 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
: getOffersList[0].titleEn!.toText22(isBold: true, color: const Color(0xff2B353E)).center,
Html(
data: AppState().isArabic(context) ? getOffersList[0].descriptionAr! : getOffersList[0].descriptionEn ?? "",
onLinkTap: (String? url, RenderContext context, Map<String, String> attributes, _) {
onLinkTap: (String? url, Map<String, String> attributes, _) {
launchUrl(Uri.parse(url!));
},
),

@ -2,8 +2,7 @@ import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:easy_localization/easy_localization.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart';
@ -61,21 +60,13 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
int tabIndex = 0;
PageController controller = PageController();
final ScrollController _horizontalScrollController = ScrollController();
final ScrollController _horizontalHeaderScrollController = ScrollController();
@override
void initState() {
super.initState();
_horizontalScrollController.addListener(() {
_horizontalHeaderScrollController.jumpTo(_horizontalScrollController.offset);
});
}
@override
void dispose() {
_horizontalScrollController.dispose();
_horizontalHeaderScrollController.dispose();
super.dispose();
actionHistoryList.clear();
}
@ -138,231 +129,23 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
}
}
TableRow rowChildren(GetPoItemHistoryList poData, int index) {
return TableRow(
decoration: BoxDecoration(color: index % 2 == 0 ? Colors.white : Colors.grey[100]),
children: [
rowCell(poData.cREATIONDATE!, index),
rowCell(poData.pURCHASEPRICE!.toString(), index),
rowCell(poData.sUPPLIER!, index),
rowCell(poData.pONUMBER!.toString(), index),
rowCell(poData.oUNAME!, index),
rowCell(poData.rEVISIONNUM!.toString(), index),
rowCell(poData.bUYER!, index),
rowCell(poData.uOM!, index),
rowCell(poData.qUANTITYORDERED!.toString(), index),
rowCell(poData.qUANTITYRECEIVED!.toString(), index),
rowCell(poData.bONUSQUANTITY!.toString(), index),
rowCell(poData.dISCOUNTPERCENTAGE!.toString(), index),
rowCell(poData.bALANCEQUANTITY!.toString(), index),
rowCell(poData.nETPRICE!.toString(), index),
rowCell(poData.cLOSEDCODE!, index),
],
);
}
Widget rowCell(String data, int index) {
return TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Center(
child: Text(
data,
style: TextStyle(fontSize: 12, color: MyColors.normalTextColor, fontWeight: FontWeight.w500),
),
// data.toText12(color: MyColors.normalTextColor),
).paddingAll(8));
}
Widget headerCell(String data) {
return Container(
padding: const EdgeInsets.only(top: 16, bottom: 16, left: 8, right: 8),
width: 120,
alignment: Alignment.center,
decoration: BoxDecoration(color: Colors.grey[300]),
child: data.toText14(color: MyColors.darkIconColor),
);
}
List<Color> gradientColors = [MyColors.gradiantEndColor, MyColors.gradiantEndColor];
LineChartData drawLineChart(List<FlSpot> spots, List<GetPoItemHistoryList> reversedList) {
return LineChartData(
lineTouchData: LineTouchData(enabled: true, touchTooltipData: LineTouchTooltipData(tooltipBgColor: Colors.grey[300])),
gridData: FlGridData(
show: true,
drawHorizontalLine: true,
drawVerticalLine: true,
verticalInterval: 1,
horizontalInterval: 1,
getDrawingVerticalLine: (value) {
return FlLine(color: Color(0xff37434d), strokeWidth: .3);
},
getDrawingHorizontalLine: (value) {
return FlLine(color: Color(0xff37434d), strokeWidth: .3);
},
),
titlesData: FlTitlesData(
show: true,
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 30,
interval: 1,
getTitlesWidget: (double value, TitleMeta meta) {
return SideTitleWidget(
axisSide: meta.axisSide,
child: Text(reversedList[int.parse(meta.formattedValue)].cREATIONDATE!, style: TextStyle(fontSize: 10)),
);
})),
leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 30,
interval: 1,
getTitlesWidget: (double value, TitleMeta meta) {
return SideTitleWidget(
axisSide: meta.axisSide,
child: Text(meta.formattedValue, style: TextStyle(fontSize: 10)),
);
})),
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
rightTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 15,
getTitlesWidget: (double value, TitleMeta meta) {
return SideTitleWidget(
axisSide: meta.axisSide,
child: Text("", style: TextStyle(fontSize: 10)),
);
})),
),
borderData: FlBorderData(show: true, border: Border.all(color: const Color(0xff37434d))),
minX: 0,
maxX: poItemHistoryList.length.toDouble() - 1,
minY: poItemHistoryList.map((e) => e.pURCHASEPRICE!.toDouble()).reduce((curr, next) => curr < next ? curr : next) - 1,
maxY: poItemHistoryList.map((e) => e.pURCHASEPRICE!.toDouble()).reduce((curr, next) => curr > next ? curr : next) + 1,
lineBarsData: [
LineChartBarData(
spots: spots,
isCurved: true,
gradient: LinearGradient(
colors: [
ColorTween(begin: gradientColors[0], end: gradientColors[1]).lerp(0.2)!,
ColorTween(begin: gradientColors[0], end: gradientColors[1]).lerp(0.2)!,
],
),
barWidth: 2,
isStrokeCapRound: true,
dotData: FlDotData(show: true),
belowBarData: BarAreaData(
show: true,
gradient: LinearGradient(
colors: [
ColorTween(begin: gradientColors[0], end: gradientColors[1]).lerp(0.2)!.withOpacity(0.1),
ColorTween(begin: gradientColors[0], end: gradientColors[1]).lerp(0.2)!.withOpacity(0.1),
],
),
),
),
],
);
}
@override
Widget build(BuildContext context) {
loadData();
Widget? chartWidget;
if (_screenParams!.isItemHistory && poItemHistoryList.isNotEmpty) {
try {
List<GetPoItemHistoryList> reversedList = poItemHistoryList.reversed.toList();
List<FlSpot> dataPoints = List.generate(
reversedList.length,
(index) => FlSpot(index.toDouble(), reversedList[index].pURCHASEPRICE!.toDouble()),
);
double chartWidth = dataPoints.length * 70.0;
chartWidget = Column(
mainAxisSize: MainAxisSize.min,
children: [
LocaleKeys.graphicalAnalysis.tr().toText14(color: MyColors.darkIconColor),
SizedBox(
height: 400,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
width: chartWidth,
padding: const EdgeInsets.all(16.0),
child: LineChart(drawLineChart(dataPoints, reversedList)),
),
),
),
],
);
} catch (ex) {}
}
return Scaffold(
appBar: AppBarWidget(context, title: _screenParams?.title ?? ""),
backgroundColor: Colors.white,
body: (_screenParams!.isItemHistory && poItemHistoryList.isNotEmpty)
? Column(
children: [
if (chartWidget != null) chartWidget,
if (poItemHistoryList.isNotEmpty) ...[
LocaleKeys.itemHistoryAnalysis.tr().toText14(color: MyColors.darkIconColor),
16.height,
SingleChildScrollView(
scrollDirection: Axis.horizontal,
physics: const NeverScrollableScrollPhysics(),
controller: _horizontalHeaderScrollController,
child: Row(
children: [
headerCell(LocaleKeys.creationDate.tr()),
headerCell(LocaleKeys.purchasePrice.tr()),
headerCell(LocaleKeys.supplier.tr()),
headerCell(LocaleKeys.pOno.tr()),
headerCell(LocaleKeys.oprUnit.tr()),
headerCell(LocaleKeys.revision.tr()),
headerCell(LocaleKeys.buyer.tr()),
headerCell(LocaleKeys.uom.tr()),
headerCell(LocaleKeys.qtyOrdered.tr()),
headerCell(LocaleKeys.qtyReceived.tr()),
headerCell(LocaleKeys.bonusQty.tr()),
headerCell(LocaleKeys.discountPer.tr()),
headerCell(LocaleKeys.balQty.tr()),
headerCell(LocaleKeys.netPrice.tr()),
headerCell(LocaleKeys.closureStatus.tr()),
],
),
),
SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _horizontalScrollController,
child: Table(
defaultColumnWidth: const FixedColumnWidth(120.0),
children: [for (int index = 0; index < poItemHistoryList.length; index++) rowChildren(poItemHistoryList[index], index)],
),
),
).expanded,
],
],
)
: ListView(
padding: _screenParams!.isPRInfo ? const EdgeInsets.all(0) : const EdgeInsets.all(21),
// physics: const NeverScrollableScrollPhysics(),
children: [
if (_screenParams!.isPRInfo) prLinesDataView(),
if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(),
if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(),
if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData(),
if (moItemHistoryList.isEmpty && poItemHistoryList.isEmpty && quotationAnalysisList.isEmpty && !_screenParams!.isPRInfo) Utils.getNoDataWidget(context),
],
),
body: ListView(
padding: _screenParams!.isPRInfo ? const EdgeInsets.all(0) : const EdgeInsets.all(21),
physics: const NeverScrollableScrollPhysics(),
children: [
if (_screenParams!.isPRInfo) prLinesDataView(),
if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(),
if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(),
if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData(),
if (moItemHistoryList.isEmpty && poItemHistoryList.isEmpty && quotationAnalysisList.isEmpty && !_screenParams!.isPRInfo) Utils.getNoDataWidget(context),
],
),
);
}
@ -417,26 +200,26 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column(
children: [
ItemDetailGrid(
ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""),
ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""),
ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""),
ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""),
ItemDetailViewCol("PR Number", _screenParams!.getPRInformationList!.pRHeader![0].pRNUMBER!.toString() ?? ""),
isItLast: true,
),
],
).objectContainerView(),
children: [
ItemDetailGrid(
ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""),
ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""),
ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""),
ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""),
ItemDetailViewCol("PR Number", _screenParams!.getPRInformationList!.pRHeader![0].pRNUMBER!.toString() ?? ""),
isItLast: true,
),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: _screenParams!.getPRInformationList!.pRLines!.length),
getPRActionsHistory(), //"ACTIONS".toText14().paddingOnly(top: 20, right: 21, left: 21),
@ -630,44 +413,44 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.requestNumber.tr(), moItemHistoryList[index].rEQUESTNUMBER ?? ""),
ItemDetailViewCol(LocaleKeys.uom.tr(), moItemHistoryList[index].uNITOFMEASURE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantity.tr(), moItemHistoryList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.dateRequired.tr(), moItemHistoryList[index].dATEREQUIRED ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.lineStatus.tr(), moItemHistoryList[index].lINESTATUSDIS ?? ""),
ItemDetailViewCol(LocaleKeys.statusDate.tr(), moItemHistoryList[index].sTATUSDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.transactionType.tr(), moItemHistoryList[index].tRANSACTIONTYPENAME ?? ""),
ItemDetailViewCol(LocaleKeys.organization.tr(), moItemHistoryList[index].oRGANIZATIONNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.operatingCode.tr(), moItemHistoryList[index].oRGANIZATIONCODE ?? ""),
ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), moItemHistoryList[index].oPERATINGUNITNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.fromSubInventory.tr(), moItemHistoryList[index].fROMSUBINVENTORYCODE ?? ""),
ItemDetailViewCol(LocaleKeys.fromLocator.tr(), moItemHistoryList[index].fROMLOCATOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.toSubInventory.tr(), moItemHistoryList[index].tOSUBINVENTORYCODE ?? ""),
ItemDetailViewCol(LocaleKeys.toLocator.tr(), moItemHistoryList[index].tOLOCATOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.shipToLocation.tr(), moItemHistoryList[index].sHIPTOLOCATION ?? ""),
Container(),
isItLast: true,
),
],
).objectContainerView(),
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.requestNumber.tr(), moItemHistoryList[index].rEQUESTNUMBER ?? ""),
ItemDetailViewCol(LocaleKeys.uom.tr(), moItemHistoryList[index].uNITOFMEASURE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantity.tr(), moItemHistoryList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.dateRequired.tr(), moItemHistoryList[index].dATEREQUIRED ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.lineStatus.tr(), moItemHistoryList[index].lINESTATUSDIS ?? ""),
ItemDetailViewCol(LocaleKeys.statusDate.tr(), moItemHistoryList[index].sTATUSDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.transactionType.tr(), moItemHistoryList[index].tRANSACTIONTYPENAME ?? ""),
ItemDetailViewCol(LocaleKeys.organization.tr(), moItemHistoryList[index].oRGANIZATIONNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.operatingCode.tr(), moItemHistoryList[index].oRGANIZATIONCODE ?? ""),
ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), moItemHistoryList[index].oPERATINGUNITNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.fromSubInventory.tr(), moItemHistoryList[index].fROMSUBINVENTORYCODE ?? ""),
ItemDetailViewCol(LocaleKeys.fromLocator.tr(), moItemHistoryList[index].fROMLOCATOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.toSubInventory.tr(), moItemHistoryList[index].tOSUBINVENTORYCODE ?? ""),
ItemDetailViewCol(LocaleKeys.toLocator.tr(), moItemHistoryList[index].tOLOCATOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.shipToLocation.tr(), moItemHistoryList[index].sHIPTOLOCATION ?? ""),
Container(),
isItLast: true,
),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: moItemHistoryList.length);
}
@ -677,44 +460,44 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), poItemHistoryList[index].oUNAME ?? ""),
ItemDetailViewCol(LocaleKeys.poNumber.tr(), poItemHistoryList[index].pONUMBER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.revision.tr(), poItemHistoryList[index].rEVISIONNUM?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.creationDate.tr(), poItemHistoryList[index].cREATIONDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.supplier.tr(), poItemHistoryList[index].sUPPLIER ?? ""),
ItemDetailViewCol(LocaleKeys.buyer.tr(), poItemHistoryList[index].bUYER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.uom.tr(), poItemHistoryList[index].uOM ?? ""),
ItemDetailViewCol(LocaleKeys.quantityOrdered.tr(), poItemHistoryList[index].qUANTITYORDERED?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantityReceived.tr(), poItemHistoryList[index].qUANTITYRECEIVED?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.bonusQuantity.tr(), poItemHistoryList[index].bONUSQUANTITY?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.purchasePrice.tr(), poItemHistoryList[index].pURCHASEPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.discountPer.tr(), poItemHistoryList[index].dISCOUNTPERCENTAGE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.balanceQuantity.tr(), poItemHistoryList[index].bALANCEQUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.netPrice.tr(), poItemHistoryList[index].nETPRICE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.closureStatus.tr(), poItemHistoryList[index].cLOSEDCODE ?? ""),
Container(),
isItLast: true,
)
],
).objectContainerView(),
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), poItemHistoryList[index].oUNAME ?? ""),
ItemDetailViewCol(LocaleKeys.poNumber.tr(), poItemHistoryList[index].pONUMBER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.revision.tr(), poItemHistoryList[index].rEVISIONNUM?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.creationDate.tr(), poItemHistoryList[index].cREATIONDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.supplier.tr(), poItemHistoryList[index].sUPPLIER ?? ""),
ItemDetailViewCol(LocaleKeys.buyer.tr(), poItemHistoryList[index].bUYER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.uom.tr(), poItemHistoryList[index].uOM ?? ""),
ItemDetailViewCol(LocaleKeys.quantityOrdered.tr(), poItemHistoryList[index].qUANTITYORDERED?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantityReceived.tr(), poItemHistoryList[index].qUANTITYRECEIVED?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.bonusQuantity.tr(), poItemHistoryList[index].bONUSQUANTITY?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.purchasePrice.tr(), poItemHistoryList[index].pURCHASEPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.discountPer.tr(), poItemHistoryList[index].dISCOUNTPERCENTAGE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.balanceQuantity.tr(), poItemHistoryList[index].bALANCEQUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.netPrice.tr(), poItemHistoryList[index].nETPRICE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.closureStatus.tr(), poItemHistoryList[index].cLOSEDCODE ?? ""),
Container(),
isItLast: true,
)
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: poItemHistoryList.length);
}
@ -724,40 +507,40 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationNumber.tr(), quotationAnalysisList[index].qUOTNUM ?? ""),
ItemDetailViewCol(LocaleKeys.vendorName.tr(), quotationAnalysisList[index].vENDORNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.itemCode.tr(), quotationAnalysisList[index].iTEMCODE ?? ""),
ItemDetailViewCol(LocaleKeys.description.tr(), quotationAnalysisList[index].iTEMDESC ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationQty.tr(), quotationAnalysisList[index].qUOTQTY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.quotationUOM.tr(), quotationAnalysisList[index].qUOTUOM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationNetPrice.tr(), quotationAnalysisList[index].qUOTUNITPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.quotationLineTotal.tr(), quotationAnalysisList[index].qUOTLINETOTAL?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationBonusQuantity.tr(), quotationAnalysisList[index].qUOTBONUSQTY ?? ""),
ItemDetailViewCol(LocaleKeys.quotationDeliveryDate.tr(), quotationAnalysisList[index].qUOTDELIVERYDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationMFGPartNumber.tr(), quotationAnalysisList[index].qUOTMFGPARTNUM ?? ""),
ItemDetailViewCol(LocaleKeys.rfqNumber.tr(), quotationAnalysisList[index].rFQNUM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.rfqQty.tr(), quotationAnalysisList[index].rFQQTY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.rfqUOM.tr(), quotationAnalysisList[index].rFQUOM ?? ""),
isItLast: true,
)
],
).objectContainerView(title: "${quotationAnalysisList[index].iTEMCODE}-${quotationAnalysisList[index].iTEMDESC}"),
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationNumber.tr(), quotationAnalysisList[index].qUOTNUM ?? ""),
ItemDetailViewCol(LocaleKeys.vendorName.tr(), quotationAnalysisList[index].vENDORNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.itemCode.tr(), quotationAnalysisList[index].iTEMCODE ?? ""),
ItemDetailViewCol(LocaleKeys.description.tr(), quotationAnalysisList[index].iTEMDESC ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationQty.tr(), quotationAnalysisList[index].qUOTQTY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.quotationUOM.tr(), quotationAnalysisList[index].qUOTUOM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationNetPrice.tr(), quotationAnalysisList[index].qUOTUNITPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.quotationLineTotal.tr(), quotationAnalysisList[index].qUOTLINETOTAL?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationBonusQuantity.tr(), quotationAnalysisList[index].qUOTBONUSQTY ?? ""),
ItemDetailViewCol(LocaleKeys.quotationDeliveryDate.tr(), quotationAnalysisList[index].qUOTDELIVERYDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationMFGPartNumber.tr(), quotationAnalysisList[index].qUOTMFGPARTNUM ?? ""),
ItemDetailViewCol(LocaleKeys.rfqNumber.tr(), quotationAnalysisList[index].rFQNUM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.rfqQty.tr(), quotationAnalysisList[index].rFQQTY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.rfqUOM.tr(), quotationAnalysisList[index].rFQUOM ?? ""),
isItLast: true,
)
],
).objectContainerView(title: "${quotationAnalysisList[index].iTEMCODE}-${quotationAnalysisList[index].iTEMDESC}"),
separatorBuilder: (cxt, index) => 12.height,
itemCount: quotationAnalysisList.length);
}
@ -792,4 +575,4 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
});
}).expanded;
}
}
}

@ -159,7 +159,7 @@ class _BottomSheet extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 12.0),
decoration: BoxDecoration(color: Theme.of(context).backgroundColor, borderRadius: const BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0))),
decoration: BoxDecoration(color: Theme.of(context).colorScheme.background, borderRadius: const BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0))),
child: SafeArea(
top: false,
child: Column(

@ -24,7 +24,6 @@ import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart';
import 'package:mohem_flutter_app/widgets/qr_scanner_dialog.dart';
import 'package:nfc_manager/nfc_manager.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:platform_device_id/platform_device_id.dart';
import 'package:wifi_iot/wifi_iot.dart';
class MarkAttendanceWidget extends StatefulWidget {

@ -32,57 +32,47 @@ dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.4
path_provider: ^2.0.8
injector: ^2.0.0
injector: ^4.0.0
provider: ^6.0.1
easy_localization: ^3.0.0
http: ^0.13.4
permission_handler: ^10.2.0
http: ^1.4.0
permission_handler: ^12.0.0+1
flutter_svg: any
sizer: ^2.0.15
local_auth: ^1.1.9
sizer: ^3.0.5
local_auth: ^2.3.0
fluttertoast: ^8.0.8
syncfusion_flutter_calendar: ^19.4.48
syncfusion_flutter_calendar: ^29.2.4
# flutter_calendar_carousel: ^2.1.0
pie_chart: ^5.1.0
shared_preferences: ^2.0.12
firebase_messaging: ^13.0.4
shimmer: ^2.0.0
logger: ^1.1.0
firebase_messaging: ^15.2.5
shimmer: ^3.0.0
logger: ^2.5.0
flutter_countdown_timer: ^4.1.0
nfc_manager: ^3.2.0
# uuid: ^3.0.6
# device_info_plus: ^4.0.0
# android_id: ^0.1.3+1
platform_device_id: ^1.0.1
image_picker: ^0.8.5+3
file_picker: 5.2.5
geolocator: ^9.0.2
month_year_picker: ^0.2.0+1
month_picker_dialog_2: ^0.5.5
# open_file: ^3.2.1
platform_device_id_v2: ^1.0.4
image_picker: ^1.1.2
file_picker: ^10.1.9
geolocator: ^14.0.0
month_year_picker: ^0.4.0+1
month_picker_dialog: any
# open_file: ^3.2.1
open_filex: ^4.4.0
wifi_iot: ^0.3.19+1
wifi_iot: ^0.3.18
flutter_html: ^3.0.0-alpha.6
# flutter_barcode_scanner: ^2.0.0
qr_code_scanner: ^1.0.1
# qr_flutter: ^4.0.0
url_launcher: ^6.0.15
share: 2.0.4
flutter_rating_bar: ^4.0.1
auto_size_text: ^3.0.0
pull_to_refresh: ^2.0.0
fl_chart: ^0.62.0
# lottie json animations
lottie: any
# Marathon Card Swipe
appinio_swiper: ^1.1.1
appinio_swiper: ^2.1.1
expandable: ^5.0.1
safe_device: ^1.1.9
# networkImage
cached_network_image: ^3.2.2
@ -91,47 +81,46 @@ dependencies:
signalr_netcore: ^1.3.3
logging: ^1.0.1
swipe_to: ^1.0.2
flutter_webrtc: ^0.9.17
camera: ^0.10.3
flutter_local_notifications: ^10.0.0
flutter_webrtc: ^0.14.0
camera: ^0.11.1
flutter_local_notifications: ^19.2.1
#firebase_analytics: any
#Chat Voice Message Recoding & Play
audio_waveforms: ^0.1.5+1
rxdart: ^0.27.7
audio_waveforms: ^1.3.0
rxdart: ^0.28.0
#Encryption
flutter_des: ^2.1.0
flutter_des: ^3.0.0
video_player: 2.7.0
just_audio: ^0.9.30
# safe_device: ^1.1.2
video_player: ^2.9.5
just_audio: ^0.10.3
safe_device: ^1.2.1
flutter_layout_grid: ^2.0.1
#Huawei Dependencies
# huawei_hmsavailability: ^6.6.0+300
# huawei_location: 6.0.0+302
# huawei_location: 6.0.0+302
huawei_location: ^6.11.0+301
huawei_push: ^6.7.0+300
firebase_crashlytics: ^2.9.0
# huawei_push: ^6.12.0+303
firebase_crashlytics: ^4.3.5
#Items for sale Image Carousel Slider
carousel_slider: ^4.2.1
carousel_slider: ^5.0.0
#Huawei Specified
# store_checker: ^1.1.0
google_api_availability: ^3.0.1
in_app_update: 4.1.0
google_api_availability: ^5.0.1
google_maps_flutter_web: ^0.5.4
in_app_update: ^4.2.3
#todo its for temporary purpose, later will remove this.
dotted_border: ^2.0.0+3
dotted_border: ^3.0.1
device_info_plus: ^11.4.0
# saf: ^1.0.3+4
dependency_overrides:
firebase_core_platform_interface: 4.5.1
#dependency_overrides:
dev_dependencies:
@ -143,7 +132,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.4
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

Loading…
Cancel
Save