From 0f0bef54cf9f92c457a9ec7241b0ffaccd549c5f Mon Sep 17 00:00:00 2001 From: Azizjon Nurov Date: Mon, 6 Jan 2025 19:14:11 +0500 Subject: [PATCH 1/2] Add GroupByOrgActionMenuItem Component --- .../GroupByOrgActionMenuItem.js | 27 +++++++++++++ .../GroupByOrgActionMenuItem.test.js | 38 +++++++++++++++++++ .../GroupByOrgActionMenuItem/index.js | 1 + lib/claiming/components/menu-items/index.js | 1 + translations/stripes-acq-components/en.json | 1 + 5 files changed, 68 insertions(+) create mode 100644 lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.js create mode 100644 lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.test.js create mode 100644 lib/claiming/components/menu-items/GroupByOrgActionMenuItem/index.js diff --git a/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.js b/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.js new file mode 100644 index 00000000..3c7420dc --- /dev/null +++ b/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.js @@ -0,0 +1,27 @@ +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; + +import { + Button, + Icon, +} from '@folio/stripes/components'; + +export const GroupByOrgActionMenuItem = ({ + onClick, +}) => { + return ( + + ); +}; + +GroupByOrgActionMenuItem.propTypes = { + onClick: PropTypes.func.isRequired, +}; diff --git a/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.test.js b/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.test.js new file mode 100644 index 00000000..2693c99f --- /dev/null +++ b/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/GroupByOrgActionMenuItem.test.js @@ -0,0 +1,38 @@ +import { + render, + screen, +} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; + +import { GroupByOrgActionMenuItem } from './GroupByOrgActionMenuItem'; + +const defaultProps = { + onClick: jest.fn(), +}; + +const renderComponent = (props = {}) => render( + , +); + +describe('GroupByOrgActionMenuItem', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + it('should render the button', () => { + renderComponent(); + + expect(screen.getByTestId('group-by-org-button')).toBeInTheDocument(); + }); + + it('should call onClick when button is clicked', async () => { + renderComponent(); + + await userEvent.click(screen.getByTestId('group-by-org-button')); + + expect(defaultProps.onClick).toHaveBeenCalled(); + }); +}); diff --git a/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/index.js b/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/index.js new file mode 100644 index 00000000..66eddf4e --- /dev/null +++ b/lib/claiming/components/menu-items/GroupByOrgActionMenuItem/index.js @@ -0,0 +1 @@ +export { GroupByOrgActionMenuItem } from './GroupByOrgActionMenuItem'; diff --git a/lib/claiming/components/menu-items/index.js b/lib/claiming/components/menu-items/index.js index 57057248..7420aec5 100644 --- a/lib/claiming/components/menu-items/index.js +++ b/lib/claiming/components/menu-items/index.js @@ -1,3 +1,4 @@ export { DelayClaimActionMenuItem } from './DelayClaimActionMenuItem'; export { MarkUnreceivableActionMenuItem } from './MarkUnreceivableActionMenuItem'; export { SendClaimActionMenuItem } from './SendClaimActionMenuItem'; +export { GroupByOrgActionMenuItem } from './GroupByOrgActionMenuItem'; diff --git a/translations/stripes-acq-components/en.json b/translations/stripes-acq-components/en.json index b069c9f8..1854c666 100644 --- a/translations/stripes-acq-components/en.json +++ b/translations/stripes-acq-components/en.json @@ -144,6 +144,7 @@ "receiving.itemStatus.Order closed": "Order closed", "receiving.itemStatus.Undefined": "Undefined", + "claiming.action.groupByOrganization": "Group by organization", "claiming.action.sendClaim": "Send claim", "claiming.action.delayClaim": "Delay claim", "claiming.action.unreceivable": "Unreceivable", From dfeedda489eaf1b5d8e98c9237c55450dcee0247 Mon Sep 17 00:00:00 2001 From: Azizjon Nurov Date: Mon, 6 Jan 2025 19:26:06 +0500 Subject: [PATCH 2/2] Add change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb206c56..f63caff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Move reusable claiming code from `ui-receiving` to the shared library. Refs UISACQCOMP-236. * Support `CLAIMS` export type in the `useIntegrationConfigs` hook. Refs UISACQCOMP-238. * Exclude unsupported currencies on `getInvoiceExportData`. Refs UISACQCOMP-237. +* Add `GroupByOrgActionMenuItem` action button. Refs UICLAIM-2. ## [6.0.3](https://github.com/folio-org/stripes-acq-components/tree/v6.0.3) (2024-12-27) [Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v6.0.2...v6.0.3)