From 8d53a7557d8d41a10c1398afbb18c0b3d8287cf3 Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Fri, 13 Oct 2023 12:34:20 +0500 Subject: [PATCH 1/6] UIORGS-383: add donor info for organization summary --- CHANGELOG.md | 2 + .../OrganizationCreate/OrganizationCreate.js | 1 + .../OrganizationDetails.js | 1 + .../OrganizationSummary.js | 70 +++++++++---------- .../OrganizationForm/OrganizationForm.test.js | 14 ++-- .../OrganizationSummaryForm.js | 46 +++++++----- translations/ui-organizations/en.json | 1 + 7 files changed, 77 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f30bba80..07078bfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 5.1.0 (IN PROGRESS) +* Designate Organization as donor. Refs UIORGS-383. + ## [5.0.0](https://github.com/folio-org/ui-organizations/tree/v5.0.0) (2023-10-12) [Full Changelog](https://github.com/folio-org/ui-organizations/compare/v4.0.0...v5.0.0) diff --git a/src/Organizations/OrganizationCreate/OrganizationCreate.js b/src/Organizations/OrganizationCreate/OrganizationCreate.js index 26bbf3f2..24f5d6de 100644 --- a/src/Organizations/OrganizationCreate/OrganizationCreate.js +++ b/src/Organizations/OrganizationCreate/OrganizationCreate.js @@ -19,6 +19,7 @@ const INITIAL_VALUES = { interfaces: [], contacts: [], isVendor: false, + isDonor: false, edi: { vendorEdiType: '31B/US-SAN', libEdiType: '31B/US-SAN', diff --git a/src/Organizations/OrganizationDetails/OrganizationDetails.js b/src/Organizations/OrganizationDetails/OrganizationDetails.js index 2d381b61..6c6a71d1 100644 --- a/src/Organizations/OrganizationDetails/OrganizationDetails.js +++ b/src/Organizations/OrganizationDetails/OrganizationDetails.js @@ -269,6 +269,7 @@ const OrganizationDetails = ({ description={organization.description} erpCode={organization.erpCode} isVendor={organization.isVendor} + isDonor={organization.isDonor} language={organization.language} metadata={organization.metadata} name={organization.name} diff --git a/src/Organizations/OrganizationDetails/OrganizationSummary/OrganizationSummary.js b/src/Organizations/OrganizationDetails/OrganizationSummary/OrganizationSummary.js index d8a04dc6..22c29624 100644 --- a/src/Organizations/OrganizationDetails/OrganizationSummary/OrganizationSummary.js +++ b/src/Organizations/OrganizationDetails/OrganizationSummary/OrganizationSummary.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; @@ -6,7 +6,6 @@ import { Checkbox, Col, KeyValue, - MultiColumnList, NoValue, Row, } from '@folio/stripes/components'; @@ -18,12 +17,6 @@ import { import { ORGANIZATION_SECTIONS } from '../../constants'; -const aliasesColumnMapping = { - value: , - description: , -}; -const aliasesVisibleColumns = ['value', 'description']; - const OrganizationSummary = ({ acqUnitIds, aliases, @@ -31,6 +24,7 @@ const OrganizationSummary = ({ description, erpCode, isVendor, + isDonor, language, metadata, name, @@ -38,6 +32,7 @@ const OrganizationSummary = ({ organizationTypes, }) => { const defaultLanguageValue = LANG_LABEL_BY_CODE[language] || language; + const alternativeNames = useMemo(() => aliases.map(({ value }) => value).join(', '), [aliases]); return ( <> @@ -53,7 +48,7 @@ const OrganizationSummary = ({ - + } @@ -61,14 +56,14 @@ const OrganizationSummary = ({ /> - + } value={code} /> - + } @@ -76,7 +71,7 @@ const OrganizationSummary = ({ /> - + } > @@ -84,7 +79,7 @@ const OrganizationSummary = ({ - + } @@ -92,16 +87,7 @@ const OrganizationSummary = ({ /> - - } - vertical - /> - - - + } @@ -109,31 +95,42 @@ const OrganizationSummary = ({ /> - + - + } value={description || } /> - - - + + } + vertical + /> + + + + } + vertical + /> + + + } - > - - + value={alternativeNames || } + /> @@ -150,6 +147,7 @@ OrganizationSummary.propTypes = { description: PropTypes.string, erpCode: PropTypes.string, isVendor: PropTypes.bool, + isDonor: PropTypes.bool, language: PropTypes.string, metadata: PropTypes.object, name: PropTypes.string, diff --git a/src/Organizations/OrganizationForm/OrganizationForm.test.js b/src/Organizations/OrganizationForm/OrganizationForm.test.js index 5ff71694..71c527bd 100644 --- a/src/Organizations/OrganizationForm/OrganizationForm.test.js +++ b/src/Organizations/OrganizationForm/OrganizationForm.test.js @@ -1,7 +1,3 @@ -import React from 'react'; -import { render, screen, act } from '@folio/jest-config-stripes/testing-library/react'; -import { queryHelpers } from '@folio/jest-config-stripes/testing-library/dom'; -import user from '@folio/jest-config-stripes/testing-library/user-event'; import { MemoryRouter } from 'react-router-dom'; import { useHistory } from 'react-router'; @@ -10,12 +6,18 @@ import { expandAllSections, collapseAllSections, } from '@folio/stripes/components'; -import { organizationTypes } from 'fixtures'; +import { + render, + screen, + act, +} from '@folio/jest-config-stripes/testing-library/react'; +import { queryHelpers } from '@folio/jest-config-stripes/testing-library/dom'; +import user from '@folio/jest-config-stripes/testing-library/user-event'; +import { organizationTypes } from 'fixtures'; import { ORGANIZATIONS_ROUTE } from '../../common/constants'; import OrganizationForm from './OrganizationForm'; - jest.mock('react-router', () => ({ ...jest.requireActual('react-router'), useHistory: jest.fn(), diff --git a/src/Organizations/OrganizationForm/OrganizationSummaryForm/OrganizationSummaryForm.js b/src/Organizations/OrganizationForm/OrganizationSummaryForm/OrganizationSummaryForm.js index d9459640..816028b9 100644 --- a/src/Organizations/OrganizationForm/OrganizationSummaryForm/OrganizationSummaryForm.js +++ b/src/Organizations/OrganizationForm/OrganizationSummaryForm/OrganizationSummaryForm.js @@ -77,8 +77,8 @@ function OrganizationSummaryForm({ initialValues }) { onResetVendorFields(); }, [onResetVendorFields]); - const onChangeIsVendor = useCallback(({ target: { checked } }) => { - change('isVendor', checked); + const handleCheckbox = useCallback(({ target: { checked, name } }) => { + change(name, checked); if (initialValues.id && !checked) setVendorUncheckConfirm(true); }, [initialValues.id, change]); @@ -159,20 +159,6 @@ function OrganizationSummaryForm({ initialValues }) { name="language" /> - - } - name="isVendor" - type="checkbox" - onChange={onChangeIsVendor} - vertical - validateFields={[]} - /> - + + } + name="isDonor" + type="checkbox" + onChange={handleCheckbox} + vertical + validateFields={[]} + /> + + + } + name="isVendor" + type="checkbox" + onChange={handleCheckbox} + vertical + validateFields={[]} + /> + } diff --git a/translations/ui-organizations/en.json b/translations/ui-organizations/en.json index 7b83dd21..c591d8b2 100644 --- a/translations/ui-organizations/en.json +++ b/translations/ui-organizations/en.json @@ -110,6 +110,7 @@ "summary.organizationStatus": "Organization status", "summary.type": "Type", "summary.isVendor": "Vendor", + "summary.isDonor": "Donor", "summary.accountingCode": "Accounting code", "summary.defaultLanguage": "Default language", "summary.alternativeNames": "Alternative names", From baa0b40856307f0b46d394a7b70c47066873caa0 Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Fri, 13 Oct 2023 12:52:02 +0500 Subject: [PATCH 2/6] tests: fix failing tests --- ...OrganizationContactPeopleForm.test.js.snap | 262 ++++--- .../OrganizationInterfacesForm.test.js.snap | 212 +++--- .../OrganizationSummaryForm.test.js.snap | 173 +++-- .../__snapshots__/ViewContact.test.js.snap | 702 +++++++++--------- 4 files changed, 691 insertions(+), 658 deletions(-) diff --git a/src/Organizations/OrganizationForm/OrganizationContactPeopleForm/__snapshots__/OrganizationContactPeopleForm.test.js.snap b/src/Organizations/OrganizationForm/OrganizationContactPeopleForm/__snapshots__/OrganizationContactPeopleForm.test.js.snap index df1d973e..73757dde 100644 --- a/src/Organizations/OrganizationForm/OrganizationContactPeopleForm/__snapshots__/OrganizationContactPeopleForm.test.js.snap +++ b/src/Organizations/OrganizationForm/OrganizationContactPeopleForm/__snapshots__/OrganizationContactPeopleForm.test.js.snap @@ -10,169 +10,165 @@ exports[`OrganizationContactPeopleForm should render correct structure 1`] = ` class="col-xs-12" >
+
-
-
- ui-organizations.contactPeople.name -
-
- ui-organizations.contactPeople.categories -
-
- ui-organizations.contactPeople.emails -
-
- ui-organizations.contactPeople.note -
-
+ ui-organizations.contactPeople.name
+
+ ui-organizations.contactPeople.categories +
+
+ ui-organizations.contactPeople.emails +
+
+ ui-organizations.contactPeople.note +
+
+
+
-
- -
- Brownstein, Carrie -
-
+
diff --git a/src/Organizations/OrganizationForm/OrganizationInterfacesForm/__snapshots__/OrganizationInterfacesForm.test.js.snap b/src/Organizations/OrganizationForm/OrganizationInterfacesForm/__snapshots__/OrganizationInterfacesForm.test.js.snap index 87554144..80fd9bb2 100644 --- a/src/Organizations/OrganizationForm/OrganizationInterfacesForm/__snapshots__/OrganizationInterfacesForm.test.js.snap +++ b/src/Organizations/OrganizationForm/OrganizationInterfacesForm/__snapshots__/OrganizationInterfacesForm.test.js.snap @@ -10,74 +10,90 @@ exports[`OrganizationInterfacesForm should render correct structure 1`] = ` class="col-xs-12" >
+
-
-
- ui-organizations.interface.name -
-
- ui-organizations.interface.url -
-
+ ui-organizations.interface.name
+
+ ui-organizations.interface.url +
+
+
+
+ +
+ GOBI +
+
+ -
- GOBI -
+ www.gobi3.com
- -
+
+ -
+ +
+
+
diff --git a/src/Organizations/OrganizationForm/OrganizationSummaryForm/__snapshots__/OrganizationSummaryForm.test.js.snap b/src/Organizations/OrganizationForm/OrganizationSummaryForm/__snapshots__/OrganizationSummaryForm.test.js.snap index 200624cf..048253ee 100644 --- a/src/Organizations/OrganizationForm/OrganizationSummaryForm/__snapshots__/OrganizationSummaryForm.test.js.snap +++ b/src/Organizations/OrganizationForm/OrganizationSummaryForm/__snapshots__/OrganizationSummaryForm.test.js.snap @@ -7765,60 +7765,6 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
-
-
- -
-
-
@@ -7945,14 +7891,14 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = ` >