generate QR Api added.

payment_worklist_CR_6939
Sikander Saleem 1 year ago
parent e8fbffdc9c
commit 030887452d

@ -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,25 @@ class WorkListApiClient {
}, url, postParams);
}
Future<ITGRequest?> requestActionITGRequest(String requestType, taskId, itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_GenerateQR_RequestAction";
Map<String, dynamic> postParams = {
"RequestType": requestType,
"TaskID": taskId,
"ItemIDStr":itemId,
"EmployeeNumber": employeeNumber,
"Comments": comments,
"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 +484,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 +600,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';
}

@ -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,29 @@ 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);
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);

Loading…
Cancel
Save