Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBPIH-5816 approval and reject actions on list page approvals lists pages #4319

Conversation

drodzewicz
Copy link
Collaborator

No description provided.

@drodzewicz drodzewicz force-pushed the OBPIH-5816-approval-and-reject-actions-on-list-page-approvals-lists-pages branch 2 times, most recently from 39505b8 to 45df840 Compare October 6, 2023 11:14
@drodzewicz drodzewicz force-pushed the OBPIH-5816-approval-and-reject-actions-on-list-page-approvals-lists-pages branch from 45df840 to 3549248 Compare October 6, 2023 11:16
};
actions.push(approveAction);
}
if (statusCode === RequisitionStatus.PENDING_APPROVAL) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move the content of that if into the if above, since those are the same "ifs"

};

const rollbackRequest = () => {
Alert.error('Not implemented');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it be handled in another ticket or are you waiting for it to be merged?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am waiting for the changes to be merged.
I can either wait for it or add it in the following PR.

@@ -90,6 +91,7 @@ export default function (state = initialState, action) {
isSuperuser: _.get(action, 'payload.data.data.isSuperuser'),
isUserAdmin: _.get(action, 'payload.data.data.isUserAdmin'),
isUserApprover: _.get(action, 'payload.data.data.isUserApprover', false),
isUserRequestApprover: _.get(action, 'payload.data.data.isUserRequestApprover', false),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whenever I see this ugly _.get I wish we refactored it in the future 🙏
to something like:

const { isUserRequestApprover, ... } = payload.data.data
...
isUserApprover: isUserApprover ?? false

try {
await stockMovementApi.updateStatus(id, RequisitionStatus.REJECTED);
const successMessage = `You have successfully Rejected the request ${identifier}`;
Alert.success(successMessage);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and a question why don't you use our new notifications?

notification(NotificationType.SUCCESS)({
  message: <message>
})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simply used the same Alert as we have in this file

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because notification was implemented later this is why in this file Alert was used. I think we should use notification, since it lets us do more and this should become a convention. (I know in this case it would evaluate to the same, but just not to mix Alert vs notification.

@drodzewicz drodzewicz force-pushed the OBPIH-5816-approval-and-reject-actions-on-list-page-approvals-lists-pages branch from 8a972f6 to 14052ed Compare October 6, 2023 12:13
Copy link
Collaborator

@kchelstowski kchelstowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@jmiranda jmiranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@awalkowiak awalkowiak merged commit 7d5e879 into develop Oct 9, 2023
3 checks passed
@awalkowiak awalkowiak deleted the OBPIH-5816-approval-and-reject-actions-on-list-page-approvals-lists-pages branch October 9, 2023 07:18
awalkowiak pushed a commit that referenced this pull request Oct 26, 2023
…ages (#4319)

* OBPIH-5816 Return isUserRequestApprover from config endpoint

* OBPIH-5816 Add approval actions in the request list

* OBPIH-5816 Call status update for approved and rejected actions

* OBPIH-5816 Fix tests

* OBPIH-5816 use notification util function to render notifications

* OBPIH-5816 Fix API context test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants