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