Skip to content

Commit

Permalink
UIORGS-383: add donor info for organization summary (#574)
Browse files Browse the repository at this point in the history
* UIORGS-383: add donor info for organization summary

* tests: fix failing tests

* tests: remove failing snapshots

* tests: generate snapshot tests

* tests: update snapshot tests

* improve: bump package.json, fix organizations summary layout, remove checkbox handler
  • Loading branch information
alisher-epam committed Oct 18, 2023
1 parent 0c5efe6 commit cdcf2cf
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 81 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/organizations",
"version": "5.0.0",
"version": "5.1.0",
"description": "Organizations",
"main": "index.js",
"repository": "folio-org/ui-organizations",
Expand Down
1 change: 1 addition & 0 deletions src/Organizations/OrganizationCreate/OrganizationCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const INITIAL_VALUES = {
interfaces: [],
contacts: [],
isVendor: false,
isDonor: false,
edi: {
vendorEdiType: '31B/US-SAN',
libEdiType: '31B/US-SAN',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const OrganizationSummary = ({
description,
erpCode,
isVendor,
isDonor,
language,
metadata,
name,
Expand Down Expand Up @@ -101,6 +102,15 @@ const OrganizationSummary = ({
/>
</Col>

<Col xs={4}>
<Checkbox
checked={isDonor}
disabled
label={<FormattedMessage id="ui-organizations.summary.isDonor" />}
vertical
/>
</Col>

<Col xs={4}>
<KeyValue
data-testid="type"
Expand Down Expand Up @@ -150,6 +160,7 @@ OrganizationSummary.propTypes = {
description: PropTypes.string,
erpCode: PropTypes.string,
isVendor: PropTypes.bool,
isDonor: PropTypes.bool,
language: PropTypes.string,
metadata: PropTypes.object,
name: PropTypes.string,
Expand All @@ -160,6 +171,7 @@ OrganizationSummary.propTypes = {
OrganizationSummary.defaultProps = {
aliases: [],
isVendor: false,
isDonor: false,
};

export default OrganizationSummary;
14 changes: 8 additions & 6 deletions src/Organizations/OrganizationForm/OrganizationForm.test.js
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,6 @@ function OrganizationSummaryForm({ initialValues }) {
name="language"
/>
</Col>
<Col
xs={6}
md={3}
>
<Field
component={Checkbox}
label={<FormattedMessage id="ui-organizations.summary.isVendor" />}
name="isVendor"
type="checkbox"
onChange={onChangeIsVendor}
vertical
validateFields={[]}
/>
</Col>
<Col
xs={6}
md={3}
Expand All @@ -197,6 +183,33 @@ function OrganizationSummaryForm({ initialValues }) {
validateFields={[]}
/>
</Col>
<Col
xs={6}
md={3}
>
<Field
component={Checkbox}
label={<FormattedMessage id="ui-organizations.summary.isDonor" />}
name="isDonor"
type="checkbox"
vertical
validateFields={[]}
/>
</Col>
<Col
xs={6}
md={3}
>
<Field
component={Checkbox}
label={<FormattedMessage id="ui-organizations.summary.isVendor" />}
name="isVendor"
type="checkbox"
vertical
onChange={onChangeIsVendor}
validateFields={[]}
/>
</Col>
<Col xs={6}>
<FieldArray
addLabel={<FormattedMessage id="ui-organizations.summary.add" />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7765,60 +7765,6 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
</div>
</div>
</div>
<div
class="col-xs-6 col-md-3"
>
<div
class="checkbox inline vertical"
data-test-checkbox="true"
>
<label
class="label label checkboxInteractionStylesControl"
for="checkbox-5"
>
<span
class="labelText"
>
ui-organizations.summary.isVendor
</span>
<span
class="inner checkboxInteractionStyles"
>
<input
aria-invalid="false"
checked=""
class="input"
id="checkbox-5"
name="isVendor"
type="checkbox"
value=""
/>
<span
class="checkboxIcon"
>
<svg
height="10"
viewBox="0 0 14 14"
width="10"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10.395 4.617L5.63 9.383 3.605 7.358"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="1.5"
/>
</svg>
</span>
</span>
</label>
<div
role="alert"
/>
</div>
</div>
<div
class="col-xs-6 col-md-3"
>
Expand Down Expand Up @@ -7945,14 +7891,14 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
>
<label
class="label"
for="textarea-input-6"
for="textarea-input-5"
>
ui-organizations.summary.description
</label>
<textarea
aria-invalid="false"
class="formControl"
id="textarea-input-6"
id="textarea-input-5"
name="description"
type="text"
>
Expand All @@ -7963,6 +7909,113 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
/>
</div>
</div>
<div
class="col-xs-6 col-md-3"
>
<div
class="checkbox inline vertical"
data-test-checkbox="true"
>
<label
class="label label checkboxInteractionStylesControl"
for="checkbox-6"
>
<span
class="labelText"
>
ui-organizations.summary.isDonor
</span>
<span
class="inner checkboxInteractionStyles"
>
<input
aria-invalid="false"
class="input"
id="checkbox-6"
name="isDonor"
type="checkbox"
value=""
/>
<span
class="checkboxIcon"
>
<svg
height="10"
viewBox="0 0 14 14"
width="10"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10.395 4.617L5.63 9.383 3.605 7.358"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="1.5"
/>
</svg>
</span>
</span>
</label>
<div
role="alert"
/>
</div>
</div>
<div
class="col-xs-6 col-md-3"
>
<div
class="checkbox inline vertical"
data-test-checkbox="true"
>
<label
class="label label checkboxInteractionStylesControl"
for="checkbox-7"
>
<span
class="labelText"
>
ui-organizations.summary.isVendor
</span>
<span
class="inner checkboxInteractionStyles"
>
<input
aria-invalid="false"
checked=""
class="input"
id="checkbox-7"
name="isVendor"
type="checkbox"
value=""
/>
<span
class="checkboxIcon"
>
<svg
height="10"
viewBox="0 0 14 14"
width="10"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10.395 4.617L5.63 9.383 3.605 7.358"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="1.5"
/>
</svg>
</span>
</span>
</label>
<div
role="alert"
/>
</div>
</div>
<div
class="col-xs-6"
>
Expand Down Expand Up @@ -8001,7 +8054,7 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
>
<label
class="label"
for="text-input-7"
for="text-input-8"
>
ui-organizations.summary.alias
<span
Expand All @@ -8021,7 +8074,7 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
autocomplete="off"
autocorrect="off"
error=""
id="text-input-7"
id="text-input-8"
name="aliases[0].value"
required=""
spellcheck="false"
Expand All @@ -8043,7 +8096,7 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
>
<label
class="label"
for="text-input-8"
for="text-input-9"
>
ui-organizations.summary.description
</label>
Expand All @@ -8056,7 +8109,7 @@ exports[`OrganizationSummaryForm should render correct structure 1`] = `
autocomplete="off"
autocorrect="off"
error=""
id="text-input-8"
id="text-input-9"
name="aliases[0].description"
spellcheck="false"
type="text"
Expand Down
1 change: 1 addition & 0 deletions translations/ui-organizations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit cdcf2cf

Please sign in to comment.