diff --git a/CHANGELOG.md b/CHANGELOG.md index d04a2457d..0e0fe2053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * Preview contains blank page when trying to print an order. Refs UIOR-1173. * Do not disable account numbers having only one account available. Refs UIOR-1174. * Populate values from a template after the fields are registered. Refs UIOR-1169. +* Add donor info to POL. Refs UIOR-1147. ## [5.0.0](https://github.com/folio-org/ui-orders/tree/v5.0.0) (2023-10-12) [Full Changelog](https://github.com/folio-org/ui-orders/compare/v4.0.3...v5.0.0) diff --git a/src/components/POLine/POLineForm.js b/src/components/POLine/POLineForm.js index 437d13b9e..015e83bfd 100644 --- a/src/components/POLine/POLineForm.js +++ b/src/components/POLine/POLineForm.js @@ -30,6 +30,7 @@ import { import { ViewMetaData } from '@folio/stripes/smart-components'; import stripesForm from '@folio/stripes/final-form'; import { + Donors, FundDistributionFieldsFinal, handleKeyCommand, } from '@folio/stripes-acq-components'; @@ -108,6 +109,7 @@ function POLineForm({ const locations = parentResources?.locations?.records; const lineId = get(initialValues, 'id'); const saveBtnLabelId = isCreateAnotherChecked ? 'save' : 'saveAndClose'; + const donorOrganizationIds = get(initialValues, 'donorOrganizationIds', []); const templateValue = useMemo(() => getOrderTemplateValue(parentResources, order?.template, { locations, @@ -139,6 +141,7 @@ function POLineForm({ Populate field values for new PO Line from a template if it exist. First, the values of the fields are set, which, when changed, change other fields. */ + useEffect(() => { if (!lineId && templateValue.id) { const populateFieldsFromTemplate = (fields) => { @@ -447,6 +450,15 @@ function POLineForm({ integrationConfigs={integrationConfigs} /> + } + > + + {isOngoing(order.orderType) && ( } diff --git a/src/components/POLine/POLineForm.test.js b/src/components/POLine/POLineForm.test.js index 944f564e5..8b9b3432a 100644 --- a/src/components/POLine/POLineForm.test.js +++ b/src/components/POLine/POLineForm.test.js @@ -138,6 +138,7 @@ describe('POLineForm', () => { expect(screen.getByText('ui-orders.line.accordion.vendor')).toBeInTheDocument(); expect(screen.getByText('ui-orders.line.accordion.cost')).toBeInTheDocument(); expect(screen.getByText('ui-orders.line.accordion.fund')).toBeInTheDocument(); + expect(screen.getByText('ui-orders.line.accordion.donorInformation')).toBeInTheDocument(); expect(screen.getByText(/LocationForm/i)).toBeInTheDocument(); }); }); diff --git a/src/components/POLine/const.js b/src/components/POLine/const.js index e62ab7d47..deb49fdf1 100644 --- a/src/components/POLine/const.js +++ b/src/components/POLine/const.js @@ -24,6 +24,7 @@ export const ACCORDION_ID = { vendor: 'vendor', linkedInstances: 'linkedInstances', ongoingOrder: 'ongoingOrder', + donorsInformation: 'donorsInformation', }; // Mapping between attribute (field) in form and id of accordion @@ -59,8 +60,12 @@ export const POL_TEMPLATE_FIELDS_MAP = { 'tags.tagList': 'polTags.tagList', }; +const INITIALLY_CLOSED_ACCORDION_IDS = { + [ACCORDION_ID.donorsInformation]: true, +}; + export const INITIAL_SECTIONS = Object.values(ACCORDION_ID).reduce( - (accum, id) => ({ ...accum, [id]: true }), {}, + (accum, id) => ({ ...accum, [id]: !INITIALLY_CLOSED_ACCORDION_IDS[id] }), {}, ); export const ACCOUNT_STATUS = { diff --git a/translations/ui-orders/en.json b/translations/ui-orders/en.json index e64be3721..8c00f0315 100644 --- a/translations/ui-orders/en.json +++ b/translations/ui-orders/en.json @@ -337,6 +337,7 @@ "line.accordion.linkedInstance": "Linked instance", "line.accordion.packageTitles": "Package titles", "line.accordion.vendor": "Vendor", + "line.accordion.donorInformation": "Donor information", "line.closedOrderMessage": "Purchase order is closed - {reason}", "line.paneTitle.details": "PO Line details - {poLineNumber}", "line.paneTitle.edit": "Edit - {lineNumber}", @@ -470,6 +471,7 @@ "paneBlock.openBtn": "Open", "paneBlock.unopenBtn": "Unopen", "paneBlock.POLines": "PO lines", + "paneBlock.donorInformation": "Donor information", "paneBlock.POSummary": "PO summary", "paneBlock.purchaseOrder": "Purchase order", "paneBlock.receiveBtn": "Receive",