Skip to content

Commit

Permalink
UIF-482 Designate funds as location use restricted
Browse files Browse the repository at this point in the history
  • Loading branch information
usavkov-epam committed Dec 4, 2023
1 parent 86e1aba commit 87faf15
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 5.1.0 (IN PROGRESS)

* Add donor info to Fund. Refs UIF-473.
* Designate funds as location use restricted. Refs UIF-482.

## [5.0.0](https://github.com/folio-org/ui-finance/tree/v5.0.0) (2023-10-12)
[Full Changelog](https://github.com/folio-org/ui-finance/compare/v4.0.4...v5.0.0)
Expand Down
12 changes: 10 additions & 2 deletions src/Funds/FundDetails/FundDetails.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';

import {
Checkbox,
Col,
Row,
KeyValue,
NoValue,
Row,
} from '@folio/stripes/components';
import { AcqUnitsView } from '@folio/stripes-acq-components';

Expand Down Expand Up @@ -78,6 +78,14 @@ const FundDetails = ({
value={fund.externalAccountNo}
/>
</Col>
<Col xs={3}>
<Checkbox
checked={fund.restrictByLocations}
disabled
label={<FormattedMessage id="ui-finance.fund.information.restrictByLocations" />}
vertical
/>
</Col>
</Row>
<Row>
<Col xs={12}>
Expand Down
11 changes: 11 additions & 0 deletions src/Funds/FundForm/FundForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
Accordion,
AccordionSet,
AccordionStatus,
Checkbox,
checkScope,
Col,
collapseAllSections,
Expand Down Expand Up @@ -412,6 +413,16 @@ const FundForm = ({
validateFields={[]}
/>
</Col>
<Col xs={6}>
<Field
component={Checkbox}
label={<FormattedMessage id="ui-finance.fund.information.restrictByLocations" />}
name="fund.restrictByLocations"
type="checkbox"
vertical
validateFields={[]}
/>
</Col>
</Row>
</Accordion>
<Accordion
Expand Down
13 changes: 9 additions & 4 deletions src/Funds/FundForm/FundFormContainer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useCallback, useState, useEffect } from 'react';
import { FORM_ERROR } from 'final-form';
import get from 'lodash/get';
import PropTypes from 'prop-types';
import { get } from 'lodash';
import { useCallback, useState, useEffect } from 'react';
import {
FormattedMessage,
useIntl,
} from 'react-intl';
import { withRouter } from 'react-router-dom';
import { FORM_ERROR } from 'final-form';

import {
stripesConnect,
Expand All @@ -33,6 +33,11 @@ import { FUND_STATUSES } from '../constants';
import FundForm from './FundForm';
import { fetchFundsByName } from './fetchFunds';

const INITIAL_FUND_VALUES = {
fundStatus: FUND_STATUSES.ACTIVE,
restrictByLocations: false,
};

const FundFormContainer = ({
match,
mutator,
Expand Down Expand Up @@ -68,7 +73,7 @@ const FundFormContainer = ({
});
} else {
setFund({
fund: { fundStatus: FUND_STATUSES.ACTIVE },
fund: INITIAL_FUND_VALUES,
groupIds: [],
});
}
Expand Down
1 change: 1 addition & 0 deletions translations/ui-finance/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"fund.information.status": "Status",
"fund.information.title": "Fund information",
"fund.information.donorInformation": "Donor information",
"fund.information.restrictByLocations": "Restrict use by location",
"fund.information.transferFrom": "Transfer from",
"fund.information.transferTo": "Transfer to",
"fund.information.type": "Type",
Expand Down

0 comments on commit 87faf15

Please sign in to comment.