generate QR Api added.

payment_worklist_CR_6939
Sikander Saleem 1 year ago
parent e8fbffdc9c
commit 030887452d

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

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

@ -380,7 +380,7 @@ class WorkListApiClient {
}, url, postParams); }, 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"; String url = "${ApiConsts.cocRest}ITGRejectRequest";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"RequestType": requestType, "RequestType": requestType,
@ -396,7 +396,7 @@ class WorkListApiClient {
}, url, postParams); }, 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"; String url = "${ApiConsts.cocRest}ITGApproveRequest";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"RequestType": requestType, "RequestType": requestType,
@ -412,7 +412,7 @@ class WorkListApiClient {
}, url, postParams); }, 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"; String url = "${ApiConsts.cocRest}ITGDelegateRequest";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"RequestType": requestType, "RequestType": requestType,
@ -431,7 +431,7 @@ class WorkListApiClient {
// ANSWER = 'Services/COCWS.svc/REST/ITGAnswer'; // 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"; String url = "${ApiConsts.cocRest}ITGAnswer";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"RequestType": requestType, "RequestType": requestType,
@ -447,6 +447,25 @@ class WorkListApiClient {
}, url, postParams); }, 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 { Future<ITGRequest?> grantITGRequest(String requestType, int taskId, int itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}ITGGrantAccess"; String url = "${ApiConsts.cocRest}ITGGrantAccess";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
@ -465,7 +484,7 @@ class WorkListApiClient {
}, url, postParams); }, 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"; String url = "${ApiConsts.cocRest}ITGRequestInformation";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"RequestType": requestType, "RequestType": requestType,
@ -581,8 +600,6 @@ class WorkListApiClient {
}, url, postParams); }, url, postParams);
} }
Future<List<GetFavoriteReplacements>?> getFavoriteReplacementWithoutImage() async { Future<List<GetFavoriteReplacements>?> getFavoriteReplacementWithoutImage() async {
String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacementsWithoutImage"; String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacementsWithoutImage";
Map<String, dynamic> postParams = {}; Map<String, dynamic> postParams = {};

@ -551,6 +551,7 @@ class CodegenLoader extends AssetLoader {
"uploadedDocuments": "المستندات التي تم تحميلها", "uploadedDocuments": "المستندات التي تم تحميلها",
"youCannotJoinTheMarathon": "لا يمكنك الانضمام إلى الماراثون لأنك تجاوزت الحد الزمني", "youCannotJoinTheMarathon": "لا يمكنك الانضمام إلى الماراثون لأنك تجاوزت الحد الزمني",
"pleaseClickButtonToJoinMarathon": "الرجاء الضغط على الزر أدناه للانضمام إلى الماراثون", "pleaseClickButtonToJoinMarathon": "الرجاء الضغط على الزر أدناه للانضمام إلى الماراثون",
"generate": "يولد",
}; };
static const Map<String, dynamic> en_US = { static const Map<String, dynamic> en_US = {
"mohemm": "Mohemm", "mohemm": "Mohemm",
@ -1107,7 +1108,8 @@ class CodegenLoader extends AssetLoader {
"userName": "User Name", "userName": "User Name",
"userId": "UserID", "userId": "UserID",
"pleaseClickButtonToJoinMarathon": "Press the button below to join the Marathon.", "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}; 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 pleaseClickButtonToJoinMarathon ='pleaseClickButtonToJoinMarathon';
static const youCannotJoinTheMarathon ='youCannotJoinTheMarathon'; static const youCannotJoinTheMarathon ='youCannotJoinTheMarathon';
static const open ='open'; 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/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
// import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; // import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
import 'package:mohem_flutter_app/api/login_api_client.dart'; import 'package:mohem_flutter_app/api/login_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart';
@ -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/models/privilege_list_model.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/input_widget.dart'; import 'package:mohem_flutter_app/widgets/input_widget.dart';
// import 'package:safe_device/safe_device.dart'; // import 'package:safe_device/safe_device.dart';
import 'package:wifi_iot/wifi_iot.dart'; import 'package:wifi_iot/wifi_iot.dart';
@ -116,8 +114,11 @@ class _LoginScreenState extends State<LoginScreen> {
print("GOOGLE PLAY STOREEEE!!!!"); print("GOOGLE PLAY STOREEEE!!!!");
await Firebase.initializeApp(); await Firebase.initializeApp();
_firebaseMessaging = FirebaseMessaging.instance; _firebaseMessaging = FirebaseMessaging.instance;
firebaseToken = await _firebaseMessaging.getToken(); try {
print(firebaseToken); firebaseToken = await _firebaseMessaging.getToken();
} catch (ex) {
firebaseToken = "";
}
AppNotifications().init(firebaseToken, context); AppNotifications().init(firebaseToken, context);
checkLoginInfo(); checkLoginInfo();
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);

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

Loading…
Cancel
Save