actions & attachment api response overlapping other request responses. fixed.

master-Api2.0
Sikander Saleem 12 months ago
parent 11881b0ba1
commit b06fb6345a

@ -13,7 +13,7 @@ import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_messaging_web/firebase_messaging_web.dart';
import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:geolocator_web/geolocator_web.dart';
import 'package:google_maps_flutter_web/google_maps_flutter_web.dart';
// import 'package:google_maps_flutter_web/google_maps_flutter_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:just_audio_web/just_audio_web.dart';
// import 'package:record_web/record_web.dart';
@ -32,7 +32,7 @@ void registerPlugins(Registrar registrar) {
FirebaseMessagingWeb.registerWith(registrar);
FluttertoastWebPlugin.registerWith(registrar);
GeolocatorPlugin.registerWith(registrar);
GoogleMapsPlugin.registerWith(registrar);
// GoogleMapsPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
JustAudioPlugin.registerWith(registrar);
//RecordPluginWeb.registerWith(registrar);

@ -23,6 +23,7 @@ import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_mod
import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/member_information_list_model.dart';
import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart';
import 'package:mohem_flutter_app/models/termination/termination_notification_body.dart';
import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart';
@ -45,7 +46,6 @@ import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dialogs/accept_reject_input_dialog.dart';
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
import 'package:mohem_flutter_app/models/termination/termination_notification_body.dart';
class WorkListDetailScreen extends StatefulWidget {
WorkListDetailScreen({Key? key}) : super(key: key);
@ -70,19 +70,16 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
List<GetStampMsNotificationBodyList> getStampMsNotifications = [];
List<GetStampNsNotificationBodyList> getStampNsNotifications = [];
List<GetMoNotificationBodyList> getMoNotificationBodyList = [];
List<NotificationGetRespondAttributesList> getNotificationRespondAttributes =
[];
List<NotificationGetRespondAttributesList> getNotificationRespondAttributes = [];
NotificationGetRespondAttributesList? notificationNoteInput;
List<GetRFCEmployeeList> getRFCEmployeeList = [];
//HR Details Screen Requests
List<GetEitCollectionNotificationBodyList>?
getEitCollectionNotificationBodyList = [];
List<GetEitCollectionNotificationBodyList>? getEitCollectionNotificationBodyList = [];
List<GetPhonesNotificationBodyList>? getPhonesNotificationBodyList = [];
List<GetBasicDetNtfBodyList>? getBasicDetNtfBodyList = [];
List<GetAbsenceCollectionNotificationBodyList>?
getAbsenceCollectionNotificationBodyList = [];
List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList = [];
GetContactNotificationBodyList? getContactNotificationBodyList;
List<GetAddressNotificationBodyList>? getAddressNotificationBodyList = [];
List<TerminationNotificationBody>? getTerminationNotificationBodyList = [];
@ -133,8 +130,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
getContactNotificationBodyList = null;
getAddressNotificationBodyList!.clear();
getPaymentNotificationBodyList = null;
if (workListData!.iTEMTYPE == "HRSSA" ||
workListData!.iTEMTYPE == "STAMP") {
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
getUserInformation();
}
@ -191,8 +187,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getDataFromState() {
if (workListData == null) {
workListData = AppState().workList![AppState()
.workListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel;
workListData = AppState().workList![AppState().workListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel;
getData();
}
}
@ -225,8 +220,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
Column(
children: [
Container(
padding: const EdgeInsets.only(
left: 21, right: 21, top: 16, bottom: 16),
padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25),
@ -245,19 +239,13 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
child: Row(
children: [
myTab(LocaleKeys.info.tr(), 0),
(workListData!.iTEMTYPE == "HRSSA" ||
workListData!.iTEMTYPE == "STAMP")
? myTab(LocaleKeys.details.tr(), 1)
: myTab(LocaleKeys.request.tr(), 1),
(workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") ? myTab(LocaleKeys.details.tr(), 1) : myTab(LocaleKeys.request.tr(), 1),
myTab(LocaleKeys.actions.tr(), 2),
myTab(LocaleKeys.attachments.tr(), 3),
],
),
),
if ((workListData?.sUBJECT ?? "").isNotEmpty)
workListData!.sUBJECT!
.toText14()
.paddingOnly(top: 20, right: 21, left: 21),
if ((workListData?.sUBJECT ?? "").isNotEmpty) workListData!.sUBJECT!.toText14().paddingOnly(top: 20, right: 21, left: 21),
PageView(
controller: controller,
onPageChanged: (int pageIndex) {
@ -269,38 +257,26 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
InfoFragment(
poHeaderList: getPoNotificationBody?.pOHeader ?? [],
workListData: workListData,
itemCreationHeader:
getItemCreationNtfBody?.itemCreationHeader ?? [],
itemCreationHeader: getItemCreationNtfBody?.itemCreationHeader ?? [],
getStampMsNotifications: getStampMsNotifications,
getStampNsNotifications: getStampNsNotifications,
getEitCollectionNotificationBodyList:
getEitCollectionNotificationBodyList,
getPhonesNotificationBodyList:
getPhonesNotificationBodyList,
getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList,
getPhonesNotificationBodyList: getPhonesNotificationBodyList,
getBasicDetNtfBodyList: getBasicDetNtfBodyList,
getAddressNotificationBodyList:
getAddressNotificationBodyList,
getAbsenceCollectionNotificationBodyList:
getAbsenceCollectionNotificationBodyList,
getContactNotificationBodyList:
getContactNotificationBodyList,
getAddressNotificationBodyList: getAddressNotificationBodyList,
getAbsenceCollectionNotificationBodyList: getAbsenceCollectionNotificationBodyList,
getContactNotificationBodyList: getContactNotificationBodyList,
getPrNotificationBodyList: getPrNotificationBody,
getTerminationNotificationBodyList:
getTerminationNotificationBodyList,
getPaymentNotificationBodyList:
getPaymentNotificationBodyList,
getTerminationNotificationBodyList: getTerminationNotificationBodyList,
getPaymentNotificationBodyList: getPaymentNotificationBodyList,
),
(workListData!.iTEMTYPE == "HRSSA" ||
workListData!.iTEMTYPE == "STAMP" || workListData!.iTEMTYPE == "PAY_REQ")
? DetailFragment(
workListData, memberInformationListModel)
(workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP" || workListData!.iTEMTYPE == "PAY_REQ")
? DetailFragment(workListData, memberInformationListModel)
: RequestFragment(
moNotificationBodyList: getMoNotificationBodyList,
poLinesList: getPoNotificationBody?.pOLines ?? [],
itemCreationLines:
getItemCreationNtfBody?.itemCreationLines ?? [],
itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [],
prLinesList: getPrNotificationBody?.pRLines ?? [],
),
isActionHistoryLoaded
? actionHistoryList.isEmpty
@ -320,13 +296,11 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
).expanded,
if (isApproveAvailable || isRejectAvailable || isCloseAvailable)
Container(
padding: const EdgeInsets.only(
top: 14, bottom: 14, left: 21, right: 21),
padding: const EdgeInsets.only(top: 14, bottom: 14, left: 21, right: 21),
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(
color: MyColors.lightGreyEFColor, width: 1.0),
top: BorderSide(color: MyColors.lightGreyEFColor, width: 1.0),
),
),
child: Row(
@ -335,29 +309,20 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
DefaultButton(
LocaleKeys.reject.tr(),
() => performAction(rejectAction),
colors: const [
Color(0xffE47A7E),
Color(0xffDE6D71)
],
colors: const [Color(0xffE47A7E), Color(0xffDE6D71)],
).expanded,
if (isApproveAvailable && isRejectAvailable) 8.width,
if (isApproveAvailable)
DefaultButton(
LocaleKeys.approve.tr(),
() => performAction(approveAction),
colors: const [
Color(0xff28C884),
Color(0xff1BB271)
],
colors: const [Color(0xff28C884), Color(0xff1BB271)],
).expanded,
if (isCloseAvailable)
DefaultButton(
LocaleKeys.ok.tr(),
() => performAction("CLOSE"),
colors: const [
Color(0xff32D892),
Color(0xff1AB170)
],
colors: const [Color(0xff32D892), Color(0xff1AB170)],
).expanded,
8.width,
Container(
@ -367,11 +332,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
shape: BoxShape.circle,
color: MyColors.lightGreyE6Color,
),
child: Icon(
showFabOptions
? Icons.more_vert_rounded
: Icons.more_horiz_rounded,
color: MyColors.darkIconColor),
child: Icon(showFabOptions ? Icons.more_vert_rounded : Icons.more_horiz_rounded, color: MyColors.darkIconColor),
).onPress(() {
setState(() {
showFabOptions = true;
@ -388,8 +349,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
opacity: showFabOptions ? 1 : 0,
duration: const Duration(milliseconds: 250),
child: Container(
padding: const EdgeInsets.only(
left: 21, right: 21, bottom: 75 - 12),
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 75 - 12),
width: double.infinity,
height: double.infinity,
color: Colors.white.withOpacity(.67),
@ -398,19 +358,15 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg")
.onPress(() {
if (AppState().workList!.length - 1 >
AppState().workListIndex!) {
myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().workList!.length - 1 > AppState().workListIndex!) {
animationIndex = animationIndex + 1;
AppState().setWorkListIndex =
AppState().workListIndex! + 1;
AppState().setWorkListIndex = AppState().workListIndex! + 1;
workListData = null;
showFabOptions = false;
tabIndex = 0;
getDataFromState();
} else if (AppState().workList!.length - 1 ==
AppState().workListIndex!) {
} else if (AppState().workList!.length - 1 == AppState().workListIndex!) {
Navigator.pop(context);
}
}),
@ -428,8 +384,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
],
),
),
floatingActionButton:
(!isApproveAvailable && !isRejectAvailable && !isCloseAvailable)
floatingActionButton: (!isApproveAvailable && !isRejectAvailable && !isCloseAvailable)
? Container(
height: 43,
width: 43,
@ -437,11 +392,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
shape: BoxShape.circle,
color: MyColors.lightGreyE6Color,
),
child: Icon(
showFabOptions
? Icons.more_vert_rounded
: Icons.more_horiz_rounded,
color: MyColors.darkIconColor),
child: Icon(showFabOptions ? Icons.more_vert_rounded : Icons.more_horiz_rounded, color: MyColors.darkIconColor),
).onPress(() {
setState(() {
showFabOptions = true;
@ -451,8 +402,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
);
}
List<Widget> viewApiButtonsList(
List<GetNotificationButtonsList> notificationButtonsList) {
List<Widget> viewApiButtonsList(List<GetNotificationButtonsList> notificationButtonsList) {
List<Widget> fabs = [];
for (int i = 0; i < notificationButtonsList.length; i++) {
if (notificationButtonsList[i].bUTTONACTION! == "REJECTED" ||
@ -466,9 +416,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
notificationButtonsList[i].bUTTONLABEL!,
getActionImage(notificationButtonsList[i].bUTTONACTION!),
isIconAsset: true,
)
.paddingOnly(bottom: 12)
.onPress(() => handleFabAction(notificationButtonsList[i])));
).paddingOnly(bottom: 12).onPress(() => handleFabAction(notificationButtonsList[i])));
}
return fabs;
}
@ -547,8 +495,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
));
break;
case "ANSWER_INFO":
performAction(notificationButton.bUTTONACTION!,
title: notificationButton.bUTTONLABEL);
performAction(notificationButton.bUTTONACTION!, title: notificationButton.bUTTONLABEL);
break;
case "RFC":
getRFCEmployeeListFunc();
@ -568,14 +515,9 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
callBackFunc: reloadWorkList,
child: UpdateContinueSheet(
workListData: workListData,
getEitCollectionNotificationBodyList:
getEitCollectionNotificationBodyList,
dynamicParams: DynamicListViewParams(
workListData!.sUBJECT!, workListData!.fUNCTIONNAME!,
isUpdate: true,
collectionNotificationList:
getEitCollectionNotificationBodyList![0]
.collectionNotification)),
getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList,
dynamicParams: DynamicListViewParams(workListData!.sUBJECT!, workListData!.fUNCTIONNAME!,
isUpdate: true, collectionNotificationList: getEitCollectionNotificationBodyList![0].collectionNotification)),
);
break;
case "CONTINUE_ACTION":
@ -585,14 +527,9 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
callBackFunc: reloadWorkList,
child: UpdateContinueSheet(
workListData: workListData,
getEitCollectionNotificationBodyList:
getEitCollectionNotificationBodyList,
dynamicParams: DynamicListViewParams(
workListData!.sUBJECT!, workListData!.fUNCTIONNAME!,
isUpdate: true,
collectionNotificationList:
getEitCollectionNotificationBodyList![0]
.collectionNotification)),
getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList,
dynamicParams: DynamicListViewParams(workListData!.sUBJECT!, workListData!.fUNCTIONNAME!,
isUpdate: true, collectionNotificationList: getEitCollectionNotificationBodyList![0].collectionNotification)),
);
break;
case "APPROVE_AND_FORWARD":
@ -604,8 +541,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
notificationID: workListData!.nOTIFICATIONID,
actionHistoryList: actionHistoryList,
callBackFunc: reloadWorkList,
getNotificationRespondAttributes:
getNotificationRespondAttributes,
getNotificationRespondAttributes: getNotificationRespondAttributes,
));
break;
case "FORWARD":
@ -617,8 +553,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
notificationID: workListData!.nOTIFICATIONID,
actionHistoryList: actionHistoryList,
callBackFunc: reloadWorkList,
getNotificationRespondAttributes:
getNotificationRespondAttributes,
getNotificationRespondAttributes: getNotificationRespondAttributes,
));
break;
case "DEL":
@ -639,8 +574,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getRFCEmployeeListFunc() async {
try {
Utils.showLoading(context);
getRFCEmployeeList = await WorkListApiClient()
.getRFCEmployeeeList(workListData!.nOTIFICATIONID!);
getRFCEmployeeList = await WorkListApiClient().getRFCEmployeeeList(workListData!.nOTIFICATIONID!);
Utils.hideLoading(context);
actionHistoryList.last.sEQUENCE = getRFCEmployeeList[0].sEQ;
showMyBottomSheet(context,
@ -660,8 +594,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
}
Future<void> performNetworkCall(BuildContext context,
{String? email, String? userId}) async {
Future<void> performNetworkCall(BuildContext context, {String? email, String? userId}) async {
showDialog(
context: context,
builder: (BuildContext cxt) => ConfirmDialog(
@ -671,12 +604,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
Navigator.pop(cxt);
Utils.showLoading(context);
try {
await WorkListApiClient().submitComment(
comment: "",
email: email,
userId: userId,
notificationId: workListData!.nOTIFICATIONID,
apiMode: "REJECT");
await WorkListApiClient().submitComment(comment: "", email: email, userId: userId, notificationId: workListData!.nOTIFICATIONID, apiMode: "REJECT");
Utils.hideLoading(context);
Navigator.pop(context, "delegate_reload");
} catch (ex) {
@ -694,9 +622,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
title.toText12(
color: isSelected ? Colors.white : Colors.white.withOpacity(.74),
isCenter: true),
title.toText12(color: isSelected ? Colors.white : Colors.white.withOpacity(.74), isCenter: true),
4.height,
Container(
height: 8,
@ -764,10 +690,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
for (var element in getNotificationRespondAttributes!) {
responseAttribute.add({
"ATTRIBUTE_NAME": element!.attributeName,
if (element!.attributeType == "number")
"ATTRIBUTE_NUMBER_VALUE": note
else if (element!.attributeType == "VARCHAR2")
"ATTRIBUTE_TEXT_VALUE": note
if (element!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (element!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note
});
}
@ -780,11 +703,15 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
"RespondAttributeList": responseAttribute,
};
if (actionMode == "APPROVED" || actionMode == "APPROVE" || actionMode == "CLOSE" || actionMode == "ANSWER_INFO" || actionMode == "RFC" || actionMode == "TRY_APPROVE_AGAIN" || actionMode == "SEND_BACK_TO_PREPARER") {
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")) {
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
performNotificationAction(payload);
} else {
Utils.showToast(LocaleKeys.pleaseEnterComments.tr());
@ -797,8 +724,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void performNotificationAction(Map<String, dynamic> payload) async {
try {
Utils.showLoading(context);
GenericResponseModel model =
await WorkListApiClient().postNotificationActions(payload);
GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload);
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
animationIndex = animationIndex + 1;
@ -839,8 +765,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getEitCollectionNotificationBodyList!.clear();
getEitCollectionNotificationBodyList = await WorkListApiClient()
.GetEitNotificationBody(workListData!.nOTIFICATIONID);
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -858,8 +783,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
memberInformationListModel = null;
memberInformationListModel = await WorkListApiClient()
.getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -877,8 +801,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPhonesNotificationBodyList!.clear();
getPhonesNotificationBodyList = await WorkListApiClient()
.getPhonesNotificationBodyList(workListData!.nOTIFICATIONID);
getPhonesNotificationBodyList = await WorkListApiClient().getPhonesNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -896,8 +819,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getBasicDetNtfBodyList!.clear();
getBasicDetNtfBodyList = await WorkListApiClient()
.getBasicDetNtfBodyList(workListData!.nOTIFICATIONID);
getBasicDetNtfBodyList = await WorkListApiClient().getBasicDetNtfBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -915,8 +837,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getAbsenceCollectionNotificationBodyList!.clear();
getAbsenceCollectionNotificationBodyList = await WorkListApiClient()
.getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -933,8 +854,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getContactNotificationBodyList = await WorkListApiClient()
.getContactNotificationBodyList(workListData!.nOTIFICATIONID);
getContactNotificationBodyList = await WorkListApiClient().getContactNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -951,8 +871,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getAddressNotificationBodyList = await WorkListApiClient()
.getAddressNotificationBodyList(workListData!.nOTIFICATIONID);
getAddressNotificationBodyList = await WorkListApiClient().getAddressNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -968,8 +887,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void getTerminationNotificationBody() async {
try {
if (apiCallCount == 0) apiCallCount++;
getTerminationNotificationBodyList = await WorkListApiClient()
.getTerminationNotificationBodyList(workListData!.nOTIFICATIONID);
getTerminationNotificationBodyList = await WorkListApiClient().getTerminationNotificationBodyList(workListData!.nOTIFICATIONID);
Utils.hideLoading(context);
apiCallCount--;
if (apiCallCount == 0) {
@ -987,11 +905,9 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
if (workListData!.rEQUESTTYPE == "STAMP_MS") {
getStampMsNotifications = await WorkListApiClient()
.getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999);
getStampMsNotifications = await WorkListApiClient().getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999);
} else {
getStampNsNotifications = await WorkListApiClient()
.getStampNsNotificationBody(workListData!.nOTIFICATIONID!, -999);
getStampNsNotifications = await WorkListApiClient().getStampNsNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
apiCallCount--;
if (apiCallCount == 0) {
@ -1009,8 +925,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getMoNotificationBodyList = await WorkListApiClient()
.getMoNotificationBody(workListData!.nOTIFICATIONID!, -999);
getMoNotificationBodyList = await WorkListApiClient().getMoNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -1027,8 +942,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getItemCreationNtfBody = await WorkListApiClient()
.getItemCreationNtfBody(workListData!.nOTIFICATIONID!, -999);
getItemCreationNtfBody = await WorkListApiClient().getItemCreationNtfBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -1045,8 +959,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPoNotificationBody = await WorkListApiClient()
.getPoNotificationBody(workListData!.nOTIFICATIONID!, -999);
getPoNotificationBody = await WorkListApiClient().getPoNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -1063,8 +976,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPrNotificationBody = await WorkListApiClient()
.getPRNotificationBody(workListData!.nOTIFICATIONID!, -999);
getPrNotificationBody = await WorkListApiClient().getPRNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -1081,8 +993,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPaymentNotificationBodyList = await WorkListApiClient()
.getPaymentNotificationBody(workListData!.nOTIFICATIONID!, -999);
getPaymentNotificationBodyList = await WorkListApiClient().getPaymentNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
@ -1100,8 +1011,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getNotificationRespondAttributes.clear();
getNotificationRespondAttributes = await WorkListApiClient()
.notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first;
}
@ -1122,25 +1032,18 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
notificationButtonsList.clear();
notificationButtonsList = await WorkListApiClient()
.getNotificationButtons(workListData!.nOTIFICATIONID!);
notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!);
if (notificationButtonsList.isNotEmpty) {
isCloseAvailable = notificationButtonsList.any(
(GetNotificationButtonsList element) =>
element.bUTTONACTION == "CLOSE");
isApproveAvailable =
notificationButtonsList.any((GetNotificationButtonsList element) {
if (element.bUTTONACTION == "APPROVED" ||
element.bUTTONACTION == "APPROVE") {
isCloseAvailable = notificationButtonsList.any((GetNotificationButtonsList element) => element.bUTTONACTION == "CLOSE");
isApproveAvailable = notificationButtonsList.any((GetNotificationButtonsList element) {
if (element.bUTTONACTION == "APPROVED" || element.bUTTONACTION == "APPROVE") {
approveAction = element.bUTTONACTION!;
return true;
}
return false;
});
isRejectAvailable =
notificationButtonsList.any((GetNotificationButtonsList element) {
if (element.bUTTONACTION == "REJECTED" ||
element.bUTTONACTION == "REJECT") {
isRejectAvailable = notificationButtonsList.any((GetNotificationButtonsList element) {
if (element.bUTTONACTION == "REJECTED" || element.bUTTONACTION == "REJECT") {
rejectAction = element.bUTTONACTION!;
return true;
}
@ -1163,8 +1066,10 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
isActionHistoryLoaded = false;
actionHistoryList.clear();
actionHistoryList = await WorkListApiClient()
.getActionHistory(workListData!.nOTIFICATIONID!);
List<GetActionHistoryList> _actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!);
if (!isActionHistoryLoaded) {
actionHistoryList = _actionHistoryList;
}
setState(() {
isActionHistoryLoaded = true;
});
@ -1177,8 +1082,10 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
isAttachmentLoaded = false;
getAttachmentList.clear();
getAttachmentList = await WorkListApiClient()
.getAttachments(workListData!.nOTIFICATIONID!);
List<GetAttachementList> _getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!);
if (!isAttachmentLoaded) {
getAttachmentList = _getAttachmentList;
}
setState(() {
isAttachmentLoaded = true;
});

Loading…
Cancel
Save