Compare commits

...

6 Commits

@ -34,7 +34,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.huawei.agconnect'
android {
compileSdkVersion 33
compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
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'

@ -97,6 +97,7 @@
"reject": "يرفض",
"approve": "يوافق",
"cancel": "إلغاء",
"generate": "يولد",
"requestedItems": "العناصر المطلوبة",
"request": "طلب",
"myRequest": "طلبي",

@ -93,6 +93,7 @@
"whatsapp": "Whatsapp",
"reject": "Reject",
"approve": "Approve",
"generate": "Generate",
"cancel": "Cancel",
"requestedItems": "Requested Items",
"request": "Request",
@ -547,7 +548,7 @@
"manageGroup": "Manage Group",
"admin": "Admin",
"addUsers": "Add users to the group",
"editGroups":"Edit Group",
"editGroups": "Edit Group",
"groupNameshouldbe": "Group name should be minimum 10 character long",
"enterGroupName": "Please enter valid group Name",
"groupName": "Group Name",

@ -380,7 +380,7 @@ class WorkListApiClient {
}, url, postParams);
}
Future<ITGRequest?> rejectITGRequest(String requestType, taskId, itemId, String employeeNumber, String comments) async {
Future<ITGRequest?> rejectITGRequest(String requestType, taskId, itemId, String employeeNumber, String comments) async {
String url = "${ApiConsts.cocRest}ITGRejectRequest";
Map<String, dynamic> postParams = {
"RequestType": requestType,
@ -396,7 +396,7 @@ class WorkListApiClient {
}, url, postParams);
}
Future<ITGRequest?> approveITGRequest(String requestType, taskId, itemId, String employeeNumber, String comments) async {
Future<ITGRequest?> approveITGRequest(String requestType, taskId, itemId, String employeeNumber, String comments) async {
String url = "${ApiConsts.cocRest}ITGApproveRequest";
Map<String, dynamic> postParams = {
"RequestType": requestType,
@ -412,7 +412,7 @@ class WorkListApiClient {
}, url, postParams);
}
Future<ITGRequest?> delegateITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments) async {
Future<ITGRequest?> delegateITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}ITGDelegateRequest";
Map<String, dynamic> postParams = {
"RequestType": requestType,
@ -431,7 +431,7 @@ class WorkListApiClient {
// ANSWER = 'Services/COCWS.svc/REST/ITGAnswer';
Future<ITGRequest?> answerITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments) async {
Future<ITGRequest?> answerITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}ITGAnswer";
Map<String, dynamic> postParams = {
"RequestType": requestType,
@ -447,6 +447,26 @@ class WorkListApiClient {
}, url, postParams);
}
Future<ITGRequest?> requestActionITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments, String email) async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_GenerateQR_RequestAction";
Map<String, dynamic> postParams = {
"RequestType": requestType,
"TaskID": taskId,
"ItemIDStr": itemId,
"EmployeeNumber": employeeNumber,
"Comments": comments,
"EmailAddress": email,
"RequestID": itemId,
"RequestActionId": 3,
"IsQRCodeGenerate": true,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
ItgFormsModel responseData = ItgFormsModel.fromJson(json);
return responseData.itgRequest;
}, url, postParams);
}
Future<ITGRequest?> grantITGRequest(String requestType, int taskId, int itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}ITGGrantAccess";
Map<String, dynamic> postParams = {
@ -465,7 +485,7 @@ class WorkListApiClient {
}, url, postParams);
}
Future<ITGRequest?> informationITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments) async {
Future<ITGRequest?> informationITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}ITGRequestInformation";
Map<String, dynamic> postParams = {
"RequestType": requestType,
@ -581,8 +601,6 @@ class WorkListApiClient {
}, url, postParams);
}
Future<List<GetFavoriteReplacements>?> getFavoriteReplacementWithoutImage() async {
String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacementsWithoutImage";
Map<String, dynamic> postParams = {};

@ -551,6 +551,7 @@ class CodegenLoader extends AssetLoader {
"uploadedDocuments": "المستندات التي تم تحميلها",
"youCannotJoinTheMarathon": "لا يمكنك الانضمام إلى الماراثون لأنك تجاوزت الحد الزمني",
"pleaseClickButtonToJoinMarathon": "الرجاء الضغط على الزر أدناه للانضمام إلى الماراثون",
"generate": "يولد",
};
static const Map<String, dynamic> en_US = {
"mohemm": "Mohemm",
@ -1107,7 +1108,8 @@ class CodegenLoader extends AssetLoader {
"userName": "User Name",
"userId": "UserID",
"pleaseClickButtonToJoinMarathon": "Press the button below to join the Marathon.",
"youCannotJoinTheMarathon": "You cannot join the Marathon because you have exceeded the time limit."
"youCannotJoinTheMarathon": "You cannot join the Marathon because you have exceeded the time limit.",
"generate": "Generate"
};
static const Map<String, Map<String, dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
}

@ -550,4 +550,5 @@ abstract class LocaleKeys {
static const pleaseClickButtonToJoinMarathon ='pleaseClickButtonToJoinMarathon';
static const youCannotJoinTheMarathon ='youCannotJoinTheMarathon';
static const open ='open';
static const generate = 'generate';
}

@ -1,8 +1,3 @@
import 'dart:convert';
import 'dart:io' as Io;
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_countdown_timer/index.dart';
import 'package:lottie/lottie.dart';
@ -17,7 +12,6 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/itg/advertisement.dart' as ads;
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:path_provider/path_provider.dart';
import 'package:video_player/video_player.dart';
class ITGAdsScreen extends StatefulWidget {
@ -51,6 +45,10 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
void checkFileType() {
String? rFile = advertisementData!.viewAttachFileColl!.first.base64String;
try {
rFile = advertisementData!.viewAttachFileColl!.where((element) => element.languageId == AppState().getLanguageID(context)).toList().first.base64String;
} catch (ex) {}
String? rFileExt = advertisementData!.viewAttachFileColl!.first.fileName;
ext = "." + rFileExt!.split(".").last.toLowerCase();
if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif") {
@ -65,8 +63,8 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
_futureController = createVideoPlayer(rFile!);
}
// advertisementData?.actionButtonsColl!.forEach((element) {
advertisementData?.actionButtonsColl!.removeWhere((element1) => element1.actionButtonId == advertisementData?.skipButtonId);
// advertisementData?.actionButtonsColl!.forEach((element) {
advertisementData?.actionButtonsColl!.removeWhere((element1) => element1.actionButtonId == advertisementData?.skipButtonId);
//});
// setState(() {});
@ -264,26 +262,29 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
},
),
if (isImage)
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.network(imageUrl),
50.height,
Container(padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_up, color: MyColors.gradiantEndColor)).onPress(
() {
try {
Navigator.pop(context);
DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Like").then((value) {
logger.d(value);
});
} catch (ex) {
logger.wtf(ex);
Utils.handleException(ex, context, null);
}
},
),
],
SingleChildScrollView(
padding: const EdgeInsets.only(top: 60, left: 12, right: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.network(imageUrl),
50.height,
Container(padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_up, color: MyColors.gradiantEndColor)).onPress(
() {
try {
Navigator.pop(context);
DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Like").then((value) {
logger.d(value);
});
} catch (ex) {
logger.wtf(ex);
Utils.handleException(ex, context, null);
}
},
),
],
),
),
],
),

@ -8,7 +8,6 @@ import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:mohem_flutter_app/api/login_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
@ -31,7 +30,6 @@ import 'package:mohem_flutter_app/models/member_login_list_model.dart';
import 'package:mohem_flutter_app/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/input_widget.dart';
// import 'package:safe_device/safe_device.dart';
import 'package:wifi_iot/wifi_iot.dart';
@ -116,8 +114,11 @@ class _LoginScreenState extends State<LoginScreen> {
print("GOOGLE PLAY STOREEEE!!!!");
await Firebase.initializeApp();
_firebaseMessaging = FirebaseMessaging.instance;
firebaseToken = await _firebaseMessaging.getToken();
print(firebaseToken);
try {
firebaseToken = await _firebaseMessaging.getToken();
} catch (ex) {
firebaseToken = "";
}
AppNotifications().init(firebaseToken, context);
checkLoginInfo();
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);

@ -45,6 +45,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
bool isCloseAvailable = false;
bool isApproveAvailable = false;
bool isRejectAvailable = false;
bool isGenerateAvailable = false;
List<AllowedActions> allowedActionList = [];
List<ITGFormsAttachmentsModel> itgFormAttachmentsList = [];
@ -76,6 +77,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
isCloseAvailable = allowedActionList.any((element) => element.action == "CLOSE");
isApproveAvailable = itgRequest!.allowedActions!.any((element) => element.action == "Approve");
isRejectAvailable = itgRequest!.allowedActions!.any((element) => element.action == "Reject");
isGenerateAvailable = itgRequest!.allowedActions!.any((element) => element.action == "Generate");
}
Utils.hideLoading(context);
setState(() {
@ -209,6 +211,16 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
Color(0xff1BB271),
],
).expanded,
if ((isApproveAvailable || isRejectAvailable) && isGenerateAvailable) 8.width,
if (isGenerateAvailable)
DefaultButton(
LocaleKeys.generate.tr(),
() => performAction("Generate"),
colors: const [
Color(0xff28C884),
Color(0xff1BB271),
],
).expanded,
if (isCloseAvailable)
DefaultButton(
LocaleKeys.ok.tr(),
@ -279,7 +291,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
],
),
),
floatingActionButton: (!isApproveAvailable && !isRejectAvailable && !isCloseAvailable)
floatingActionButton: (!isApproveAvailable && !isRejectAvailable && !isCloseAvailable && !isGenerateAvailable)
? Container(
height: 43,
width: 43,
@ -300,7 +312,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
List<Widget> viewApiButtonsList(List<AllowedActions> allowedActionList) {
List<Widget> fabs = [];
for (int i = 0; i < allowedActionList.length; i++) {
if (allowedActionList[i].action! == "Reject" || allowedActionList[i].action! == "Approve" || allowedActionList[i].action! == "CLOSE") {
if (allowedActionList[i].action! == "Reject" || allowedActionList[i].action! == "Approve" || allowedActionList[i].action! == "CLOSE" || allowedActionList[i].action! == "Generate") {
continue;
}
fabs.add(myFab(getFabActionTitle(allowedActionList[i].action!), getFabActionImages(allowedActionList[i].action!)).paddingOnly(bottom: 12).onPress(() => handleFabAction(allowedActionList[i])));
@ -487,6 +499,8 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
performApproveAction(requestDetails!.requestType!, requestDetails!.iD, requestDetails!.itemID, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note);
} else if (actionMode == "Answer") {
performAnswerAction(requestDetails!.requestType!, requestDetails!.iD, requestDetails!.itemID, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note);
} else if (actionMode == "Generate") {
performGenerateQrAction(requestDetails!.requestType!, requestDetails!.iD, requestDetails!.itemID, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note);
} else {
performRejectAction(requestDetails!.requestType!, requestDetails!.iD, requestDetails!.itemID, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note);
}
@ -495,6 +509,30 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
);
}
void performGenerateQrAction(String requestType, taskId, itemId, String employeeNumber, String comments) async {
try {
Utils.showLoading(context);
ITGRequest? itgRequest =
await WorkListApiClient().requestActionITGRequest(requestType, taskId, itemId, employeeNumber, "", comments, AppState().memberInformationList?.eMPLOYEEEMAILADDRESS ?? "");
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
// Navigator.pop(context, "delegate_reload");
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().requestAllList!.length <= AppState().itgWorkListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
requestDetails = null;
getDataFromState();
}
}
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void performAnswerAction(String requestType, taskId, itemId, String employeeNumber, String comments) async {
try {
Utils.showLoading(context);

@ -499,6 +499,12 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
case "APPROVE":
performAction(notificationButton.bUTTONACTION!);
break;
case "TRY_APPROVE_AGAIN":
performAction(notificationButton.bUTTONACTION!);
break;
case "SEND_BACK_TO_PREPARER":
performAction(notificationButton.bUTTONACTION!);
break;
case "UPDATE_ACTION":
showMyBottomSheet(
context,
@ -691,7 +697,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"RespondAttributeList":responseAttribute,
};
if (actionMode == "APPROVED" || actionMode == "APPROVE" || actionMode == "CLOSE" || actionMode == "ANSWER_INFO" || actionMode == "RFC") {
if (actionMode == "APPROVED" || actionMode == "APPROVE" || actionMode == "CLOSE" || actionMode == "ANSWER_INFO" || actionMode == "RFC" || actionMode == "TRY_APPROVE_AGAIN" || actionMode == "SEND_BACK_TO_PREPARER") {
performNotificationAction(payload);
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
performNotificationAction(payload);

@ -35,7 +35,7 @@ class Location {
});
}
static void getCurrentLocation(Function(Position position, bool isMocked) callback, BuildContext context) {
static void getCurrentLocation(Function(Position position, bool isMocked) callback, Function errorCallBack, BuildContext context) {
void done(Position position) {
//AppStorage.sp.saveLocation(position);
bool isMocked = position.isMocked;
@ -46,6 +46,8 @@ class Location {
if (granted) {
Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: const Duration(seconds: 5)).then((value) {
done(value);
}).catchError((err) {
errorCallBack();
});
} else {
// AppPermissions

@ -171,14 +171,21 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isEnabled) {
location.Location.havePermission((bool permission) {
if (permission) {
Utils.showLoading(context);
location.Location.getCurrentLocation(
(Position position, bool isMocked) {
if (isMocked) {
Utils.hideLoading(context);
markFakeAttendance("NFC", position.latitude.toString() ?? "", position.longitude.toString() ?? "");
} else {
Utils.hideLoading(context);
performNfcAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? "");
}
},
() {
Utils.hideLoading(context);
Utils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working.");
},
context,
);
} else {
@ -218,14 +225,21 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isEnabled) {
location.Location.havePermission((bool permission) {
if (permission) {
Utils.showLoading(context);
location.Location.getCurrentLocation(
(Position position, bool isMocked) {
if (isMocked) {
Utils.hideLoading(context);
markFakeAttendance("WIFI", position.latitude.toString() ?? "", position.longitude.toString() ?? "");
} else {
Utils.hideLoading(context);
performWifiAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? "");
}
},
() {
Utils.hideLoading(context);
Utils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working.");
},
context,
);
} else {
@ -265,14 +279,21 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
if (isEnabled) {
location.Location.havePermission((bool permission) {
if (permission) {
Utils.showLoading(context);
location.Location.getCurrentLocation(
(Position position, bool isMocked) {
if (isMocked) {
Utils.hideLoading(context);
markFakeAttendance("QR", position.latitude.toString() ?? "", position.longitude.toString() ?? "");
} else {
Utils.hideLoading(context);
performQrCodeAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? "");
}
},
() {
Utils.hideLoading(context);
Utils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working.");
},
context,
);
} else {

Loading…
Cancel
Save