|
|
|
@ -40,6 +40,7 @@ import 'package:mohem_flutter_app/widgets/dialogs/accept_reject_input_dialog.dar
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
|
|
|
|
|
class WorkListDetailScreen extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
WorkListDetailScreen({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -98,6 +99,12 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
|
|
|
|
|
getUserInformation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getNotificationButtons();
|
|
|
|
|
notificationGetRespondAttributes();
|
|
|
|
|
getAttachments();
|
|
|
|
|
getActionHistory();
|
|
|
|
|
|
|
|
|
|
if (workListData!.iTEMTYPE == "HRSSA") {
|
|
|
|
|
if (workListData!.rEQUESTTYPE == "EIT") {
|
|
|
|
|
getEitNotificationBody();
|
|
|
|
@ -130,8 +137,6 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
getPRNotification();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
notificationGetRespondAttributes();
|
|
|
|
|
|
|
|
|
|
// List dataToFetch = await Future.wait([
|
|
|
|
|
//
|
|
|
|
|
// WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
|
|
|
|
@ -142,10 +147,6 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
// actionHistoryList = dataToFetch[1];
|
|
|
|
|
// getAttachmentList = dataToFetch[2];
|
|
|
|
|
|
|
|
|
|
getNotificationButtons();
|
|
|
|
|
getActionHistory();
|
|
|
|
|
getAttachments();
|
|
|
|
|
|
|
|
|
|
// if (notificationButtonsList.isNotEmpty) {
|
|
|
|
|
// isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
|
|
|
|
|
// isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
|
|
|
|
@ -487,7 +488,6 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
builder: (cxt) => AcceptRejectInputDialog(
|
|
|
|
|
message: LocaleKeys.requestedItems.tr(),
|
|
|
|
|
notificationGetRespond: notificationNoteInput,
|
|
|
|
|
textEditingController: textEditingController,
|
|
|
|
|
onTap: (note) {
|
|
|
|
|
Map<String, dynamic> payload = {
|
|
|
|
|
"P_ACTION_MODE": actionMode,
|
|
|
|
@ -503,7 +503,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
if (actionMode == "APPROVED" || actionMode == "APPROVE") {
|
|
|
|
|
if (actionMode == "APPROVED" || actionMode == "APPROVE" || actionMode == "CLOSE") {
|
|
|
|
|
performNotificationAction(payload);
|
|
|
|
|
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
|
|
|
|
|
performNotificationAction(payload);
|
|
|
|
@ -540,34 +540,34 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
|
|
|
|
|
void getEitNotificationBody() async {
|
|
|
|
|
try {
|
|
|
|
|
if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
apiCallCount++;
|
|
|
|
|
// if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
// apiCallCount++;
|
|
|
|
|
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
if (apiCallCount == 0) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// if (apiCallCount == 0) {
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getUserInformation() async {
|
|
|
|
|
try {
|
|
|
|
|
if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
apiCallCount++;
|
|
|
|
|
// if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
// apiCallCount++;
|
|
|
|
|
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
if (apiCallCount == 0) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// if (apiCallCount == 0) {
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -608,17 +608,17 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
|
|
|
|
|
void getAbsenceNotificationBody() async {
|
|
|
|
|
try {
|
|
|
|
|
if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
apiCallCount++;
|
|
|
|
|
// if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
// apiCallCount++;
|
|
|
|
|
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
if (apiCallCount == 0) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// if (apiCallCount == 0) {
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -731,20 +731,20 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
|
|
|
|
|
void notificationGetRespondAttributes() async {
|
|
|
|
|
try {
|
|
|
|
|
if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
apiCallCount++;
|
|
|
|
|
// if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
// apiCallCount++;
|
|
|
|
|
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
|
|
|
|
|
if (getNotificationRespondAttributes.isNotEmpty) {
|
|
|
|
|
notificationNoteInput = getNotificationRespondAttributes.first;
|
|
|
|
|
}
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
if (apiCallCount == 0) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// if (apiCallCount == 0) {
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -773,17 +773,17 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
|
|
|
|
|
|
|
|
|
|
void getActionHistory() async {
|
|
|
|
|
try {
|
|
|
|
|
if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
apiCallCount++;
|
|
|
|
|
// if (apiCallCount == 0) Utils.showLoading(context);
|
|
|
|
|
// apiCallCount++;
|
|
|
|
|
actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!);
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
if (apiCallCount == 0) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// if (apiCallCount == 0) {
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
apiCallCount--;
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
// apiCallCount--;
|
|
|
|
|
// Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|