From 166685378a716d5e684ae029b005e664490aa568 Mon Sep 17 00:00:00 2001 From: MonireRasouli Date: Mon, 23 Sep 2024 14:13:07 +0100 Subject: [PATCH 1/6] ERM-3331, Add documents to agreement lines --- .../Documents/Documents.js | 61 +++++++++++++++++++ .../AgreementLineSections/Documents/index.js | 1 + .../FormDocuments/FormDocuments.js | 47 ++++++++++++++ .../FormDocuments/index.js | 1 + src/components/AgreementLineSections/index.js | 2 + .../views/AgreementLine/AgreementLine.js | 36 ++++++----- .../AgreementLineForm/AgreementLineForm.js | 3 +- translations/ui-agreements/en.json | 3 + 8 files changed, 139 insertions(+), 15 deletions(-) create mode 100644 src/components/AgreementLineSections/Documents/Documents.js create mode 100644 src/components/AgreementLineSections/Documents/index.js create mode 100644 src/components/AgreementLineSections/FormDocuments/FormDocuments.js create mode 100644 src/components/AgreementLineSections/FormDocuments/index.js diff --git a/src/components/AgreementLineSections/Documents/Documents.js b/src/components/AgreementLineSections/Documents/Documents.js new file mode 100644 index 000000000..ef270efc3 --- /dev/null +++ b/src/components/AgreementLineSections/Documents/Documents.js @@ -0,0 +1,61 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; + +import { Accordion, Badge } from '@folio/stripes/components'; +import { DocumentCard, useFileHandlers } from '@folio/stripes-erm-components'; +import { useStripes } from '@folio/stripes/core'; + +const Documents = ({ line: { docs = {} } = {}, id }) => { + const stripes = useStripes(); + const { handleDownloadFile } = useFileHandlers('erm/files'); + console.log('docs %O:', docs); + const renderDocs = (docs) => { + return docs.map((doc) => ( + + )); + }; + + const renderBadge = () => { + const count = docs.length; + return {count}; + }; + + return ( + } + > + {docs.length ? ( + renderDocs(docs) + ) : ( + + )} + + ); +}; + +Documents.propTypes = { + line: PropTypes.shape({ + docs: PropTypes.arrayOf( + PropTypes.shape({ + dateCreated: PropTypes.string, + lastUpdated: PropTypes.string, + location: PropTypes.string, + name: PropTypes.string.isRequired, + note: PropTypes.string, + url: PropTypes.string, + }) + ), + }), + id: PropTypes.string, +}; + +export default Documents; diff --git a/src/components/AgreementLineSections/Documents/index.js b/src/components/AgreementLineSections/Documents/index.js new file mode 100644 index 000000000..fd99c39eb --- /dev/null +++ b/src/components/AgreementLineSections/Documents/index.js @@ -0,0 +1 @@ +export { default } from './Documents'; diff --git a/src/components/AgreementLineSections/FormDocuments/FormDocuments.js b/src/components/AgreementLineSections/FormDocuments/FormDocuments.js new file mode 100644 index 000000000..bfbe932d5 --- /dev/null +++ b/src/components/AgreementLineSections/FormDocuments/FormDocuments.js @@ -0,0 +1,47 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; +import { FieldArray } from 'react-final-form-arrays'; + +import { Accordion } from '@folio/stripes/components'; +import { DocumentsFieldArray, useFileHandlers } from '@folio/stripes-erm-components'; +import { useStripes } from '@folio/stripes/core'; + +const FormDocuments = ({ line, id, onToggle, open }) => { + const stripes = useStripes(); + const { handleDownloadFile, handleUploadFile } = useFileHandlers('erm/files'); + console.log('line %O:', line); + return ( + } + onToggle={onToggle} + open={open} + > + } + component={DocumentsFieldArray} + deleteBtnTooltipMsgId="ui-agreements.doc.removeDocsInformation" + documentCategories={line} + hasDownloadPerm={stripes.hasPerm('ui-agreements.agreements.file.download')} + isEmptyMessage={ + + } + name="docs" + onDownloadFile={handleDownloadFile} + onUploadFile={handleUploadFile} + /> + + ); +}; + +FormDocuments.propTypes = { + line: PropTypes.shape({ + documentCategories: PropTypes.arrayOf(PropTypes.object), + }).isRequired, + id: PropTypes.string, + onToggle: PropTypes.func, + open: PropTypes.bool, +}; + +export default FormDocuments; diff --git a/src/components/AgreementLineSections/FormDocuments/index.js b/src/components/AgreementLineSections/FormDocuments/index.js new file mode 100644 index 000000000..b9f0ddbe3 --- /dev/null +++ b/src/components/AgreementLineSections/FormDocuments/index.js @@ -0,0 +1 @@ +export { default } from './FormDocuments'; diff --git a/src/components/AgreementLineSections/index.js b/src/components/AgreementLineSections/index.js index a0bc4cc20..ba1df9bb0 100644 --- a/src/components/AgreementLineSections/index.js +++ b/src/components/AgreementLineSections/index.js @@ -1,7 +1,9 @@ export { default as Coverage } from './Coverage'; export { default as Info } from './Info'; export { default as POLines } from './POLines'; +export { default as Documents } from './Documents'; export { default as FormCoverage } from './FormCoverage'; export { default as FormEresource } from './FormEresource'; export { default as FormInfo } from './FormInfo'; export { default as FormPOLines } from './FormPOLines'; +export { default as FormDocuments } from './FormDocuments'; diff --git a/src/components/views/AgreementLine/AgreementLine.js b/src/components/views/AgreementLine/AgreementLine.js index 2bf0ef9e2..d6c9915b5 100644 --- a/src/components/views/AgreementLine/AgreementLine.js +++ b/src/components/views/AgreementLine/AgreementLine.js @@ -23,7 +23,7 @@ import { import { NotesSmartAccordion } from '@folio/stripes/smart-components'; -import { Info, POLines, Coverage } from '../../AgreementLineSections'; +import { Info, POLines, Coverage, Documents } from '../../AgreementLineSections'; import { isExternal, urls } from '../../utilities'; import DiscoverySettings from '../../DiscoverySettings'; @@ -146,9 +146,7 @@ const AgreementLine = ({ lastMenu={ - + } @@ -168,9 +166,13 @@ const AgreementLine = ({ + - - {title => ( + + {(title) => ( )} - { - (handlers.isSuppressFromDiscoveryEnabled('pci') || - handlers.isSuppressFromDiscoveryEnabled('title') || - handlers.isSuppressFromDiscoveryEnabled('agreementLine')) - && - } + )} @@ -204,9 +205,16 @@ const AgreementLine = ({ buttonStyle="danger" confirmLabel={} data-test-delete-confirmation-modal - heading={} + heading={ + + } id="delete-agreement-line-confirmation" - message={} + message={ + + } onCancel={() => setShowDeleteConfirmationModal(false)} onConfirm={() => { handlers.onDelete(); diff --git a/src/components/views/AgreementLineForm/AgreementLineForm.js b/src/components/views/AgreementLineForm/AgreementLineForm.js index d56cc6111..ce0e6700c 100644 --- a/src/components/views/AgreementLineForm/AgreementLineForm.js +++ b/src/components/views/AgreementLineForm/AgreementLineForm.js @@ -26,7 +26,7 @@ import { import { AppIcon } from '@folio/stripes/core'; import stripesFinalForm from '@folio/stripes/final-form'; import css from './AgreementLineForm.css'; -import { FormInfo, FormPOLines, FormCoverage, FormEresource } from '../../AgreementLineSections'; +import { FormInfo, FormPOLines, FormCoverage, FormEresource, FormDocuments } from '../../AgreementLineSections'; import { isDetached, isExternal } from '../../utilities'; import { useEresourcesEnabled } from '../../../hooks'; @@ -239,6 +239,7 @@ const AgreementLineForm = ({ + {agreementLineSource === 'basket' && } diff --git a/translations/ui-agreements/en.json b/translations/ui-agreements/en.json index 7c42dfca1..24b813412 100644 --- a/translations/ui-agreements/en.json +++ b/translations/ui-agreements/en.json @@ -236,6 +236,7 @@ "coverage.volumeShort": "Vol: {value}", "coverage.issueShort": "Iss: {value}", "coverage.editionShort": "Ed: {value}", + "documents.addDocs": "Add document", "duplicateAgreementModal.agreementInfo": "Agreement information", "duplicateAgreementModal.agreementLines": "Agreement lines", "duplicateAgreementModal.cloneEndpointError": "Unable to duplicate the agreement. The clone endpoint could not be accessed.", @@ -265,6 +266,7 @@ "emptyAccordion.lineCustomCoverage": "No custom coverage for this agreement line", "emptyAccordion.lineCoverageEresource": "No coverage for this e-resource", "emptyAccordion.linePOLines": "No PO lines for this agreement line", + "emptyAccordion.documents": "No documents for this agreement line ", "emptyAccordion.noAgreementsPackage": "No agreements for this package", "emptyAccordion.noAgreementsEresource": "No agreements for this e-resource", "emptyAccordion.organizations": "No organizations for this agreement", @@ -504,6 +506,7 @@ "line.parentAgreement": "Parent agreement", "line.lineForAgreement": "Agreement line in {agreementName}", "line.poLines": "PO lines", + "line.documents": "Documents", "organizations.edit": "Edit organizations", "organizations.add": "Add organization to agreement", "organizations.agreementHasNone": "No organizations for this agreement", From bc96caef5f7ec8bda1944a7b2f048f7a13956408 Mon Sep 17 00:00:00 2001 From: MonireRasouli Date: Fri, 27 Sep 2024 11:54:52 +0100 Subject: [PATCH 2/6] ERM-3331, Add documents to agreement lines --- .../Documents/Documents.js | 10 +- .../Documents/Documents.test.js | 302 ++++++++++++++++++ .../FormDocuments/FormDocuments.js | 10 +- .../FormDocuments/FormDocuments.test.js | 44 +++ .../views/AgreementLine/AgreementLine.test.js | 6 + .../AgreementLineForm/AgreementLineForm.js | 4 +- .../AgreementLineForm.test.js | 6 + .../AgreementLineCreateRoute.js | 15 +- .../AgreementLineEditRoute.js | 17 +- 9 files changed, 395 insertions(+), 19 deletions(-) create mode 100644 src/components/AgreementLineSections/Documents/Documents.test.js create mode 100644 src/components/AgreementLineSections/FormDocuments/FormDocuments.test.js diff --git a/src/components/AgreementLineSections/Documents/Documents.js b/src/components/AgreementLineSections/Documents/Documents.js index ef270efc3..d55f7fa82 100644 --- a/src/components/AgreementLineSections/Documents/Documents.js +++ b/src/components/AgreementLineSections/Documents/Documents.js @@ -6,12 +6,12 @@ import { Accordion, Badge } from '@folio/stripes/components'; import { DocumentCard, useFileHandlers } from '@folio/stripes-erm-components'; import { useStripes } from '@folio/stripes/core'; -const Documents = ({ line: { docs = {} } = {}, id }) => { +const Documents = ({ line: { docs = [] } = {}, id }) => { const stripes = useStripes(); const { handleDownloadFile } = useFileHandlers('erm/files'); - console.log('docs %O:', docs); - const renderDocs = (docs) => { - return docs.map((doc) => ( + + const renderDocs = (documents) => { + return documents.map((doc) => ( {}, +}; + +let renderComponent; + +describe('Documents', () => { + beforeEach(() => { + renderComponent = renderWithIntl( + , + translationsProperties + ); + }); + + test('renders the Documents Accordion', async () => { + await Accordion('Documents').exists(); + }); + + test('renders the DocumentCard component', () => { + const { getAllByText } = renderComponent; + expect(getAllByText('DocumentCard')); + }); +}); diff --git a/src/components/AgreementLineSections/FormDocuments/FormDocuments.js b/src/components/AgreementLineSections/FormDocuments/FormDocuments.js index bfbe932d5..cb543a4c1 100644 --- a/src/components/AgreementLineSections/FormDocuments/FormDocuments.js +++ b/src/components/AgreementLineSections/FormDocuments/FormDocuments.js @@ -7,10 +7,10 @@ import { Accordion } from '@folio/stripes/components'; import { DocumentsFieldArray, useFileHandlers } from '@folio/stripes-erm-components'; import { useStripes } from '@folio/stripes/core'; -const FormDocuments = ({ line, id, onToggle, open }) => { +const FormDocuments = ({ documentCategories, id, onToggle, open }) => { const stripes = useStripes(); const { handleDownloadFile, handleUploadFile } = useFileHandlers('erm/files'); - console.log('line %O:', line); + return ( { addDocBtnLabel={} component={DocumentsFieldArray} deleteBtnTooltipMsgId="ui-agreements.doc.removeDocsInformation" - documentCategories={line} + documentCategories={documentCategories} hasDownloadPerm={stripes.hasPerm('ui-agreements.agreements.file.download')} isEmptyMessage={ @@ -36,9 +36,7 @@ const FormDocuments = ({ line, id, onToggle, open }) => { }; FormDocuments.propTypes = { - line: PropTypes.shape({ - documentCategories: PropTypes.arrayOf(PropTypes.object), - }).isRequired, + documentCategories: PropTypes.arrayOf(PropTypes.object), id: PropTypes.string, onToggle: PropTypes.func, open: PropTypes.bool, diff --git a/src/components/AgreementLineSections/FormDocuments/FormDocuments.test.js b/src/components/AgreementLineSections/FormDocuments/FormDocuments.test.js new file mode 100644 index 000000000..30e73dffe --- /dev/null +++ b/src/components/AgreementLineSections/FormDocuments/FormDocuments.test.js @@ -0,0 +1,44 @@ +import { TestForm, renderWithIntl, Accordion } from '@folio/stripes-erm-testing'; +import FormDocuments from './FormDocuments'; +import translationsProperties from '../../../../test/helpers'; + +const onSubmit = jest.fn(); + +const intitialValues = { + docs: [ + { + id: 'bce1b2d6-b21b-450e-aaf8-c8af4ae63136', + dateCreated: '2024-09-24T19:47:53Z', + lastUpdated: '2024-09-24T19:51:56Z', + atType: 'license', + url: 'http://www.test.com', + name: 'test1', + }, + ], +}; + +const handlers = { + onUploadFile: () => {}, + onDownloadFile: () => {}, +}; + +describe('FormDocuments', () => { + let renderComponent; + beforeEach(() => { + renderComponent = renderWithIntl( + + + , + translationsProperties + ); + }); + + test('renders the Documents accordion', async () => { + await Accordion('Documents').exists(); + }); + + test('renders the DocumentsFieldArray component', () => { + const { getByText } = renderComponent; + expect(getByText('DocumentsFieldArray')).toBeInTheDocument(); + }); +}); diff --git a/src/components/views/AgreementLine/AgreementLine.test.js b/src/components/views/AgreementLine/AgreementLine.test.js index bad1a8a87..716e51a16 100644 --- a/src/components/views/AgreementLine/AgreementLine.test.js +++ b/src/components/views/AgreementLine/AgreementLine.test.js @@ -9,6 +9,7 @@ import AgreementLine from './AgreementLine'; jest.mock('../../AgreementLineSections/Info', () => () =>
Info
); jest.mock('../../AgreementLineSections/POLines', () => () =>
POLines
); +jest.mock('../../AgreementLineSections/Documents', () => () =>
Documents
); jest.mock('../../AgreementLineSections/Coverage', () => () =>
Coverage
); jest.mock('../../DiscoverySettings', () => () =>
DiscoverySettings
); @@ -67,6 +68,11 @@ describe('AgreementLine', () => { expect(getByText('POLines')).toBeInTheDocument(); }); + it('renders the Documents component', () => { + const { getByText } = renderComponent; + expect(getByText('Documents')).toBeInTheDocument(); + }); + it('renders the Coverage component', () => { const { getByText } = renderComponent; expect(getByText('Coverage')).toBeInTheDocument(); diff --git a/src/components/views/AgreementLineForm/AgreementLineForm.js b/src/components/views/AgreementLineForm/AgreementLineForm.js index ce0e6700c..3e45f73d8 100644 --- a/src/components/views/AgreementLineForm/AgreementLineForm.js +++ b/src/components/views/AgreementLineForm/AgreementLineForm.js @@ -40,6 +40,7 @@ const propTypes = { }), }), settings: PropTypes.object, + documentCategories: PropTypes.arrayOf(PropTypes.object), }), form: PropTypes.shape({ mutators: PropTypes.shape({ @@ -62,7 +63,7 @@ const propTypes = { }; const AgreementLineForm = ({ - data: { basket = [], line = {} }, + data: { basket = [], line = {}, documentCategories = [] }, form, handlers, handleSubmit, @@ -108,6 +109,7 @@ const AgreementLineForm = ({ resource, setFieldData: form.mutators.setFieldData, values, + documentCategories, }; }; diff --git a/src/components/views/AgreementLineForm/AgreementLineForm.test.js b/src/components/views/AgreementLineForm/AgreementLineForm.test.js index 4fedba1bc..737e8254c 100644 --- a/src/components/views/AgreementLineForm/AgreementLineForm.test.js +++ b/src/components/views/AgreementLineForm/AgreementLineForm.test.js @@ -13,6 +13,7 @@ jest.mock('../../IfEResourcesEnabled', () => ({ children }) => { jest.mock('../../AgreementLineSections/FormInfo', () => () =>
FormInfo
); jest.mock('../../AgreementLineSections/FormPOLines', () => () =>
FormPOLines
); +jest.mock('../../AgreementLineSections/FormDocuments', () => () =>
FormDocuments
); jest.mock('../../AgreementLineSections/FormCoverage', () => () =>
FormCoverage
); jest.mock('../../AgreementLineSections/FormEresource', () => () =>
FormEresource
); @@ -47,6 +48,11 @@ describe('AgreementLineForm', () => { expect(getByText('FormPOLines')).toBeInTheDocument(); }); + it('renders the FormDocuments component', () => { + const { getByText } = renderComponent; + expect(getByText('FormDocuments')).toBeInTheDocument(); + }); + it('renders the FormCoverage component', () => { const { getByText } = renderComponent; expect(getByText('FormCoverage')).toBeInTheDocument(); diff --git a/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js b/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js index 635c9c85e..0717555b6 100644 --- a/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js +++ b/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js @@ -7,13 +7,19 @@ import { useMutation, useQueryClient } from 'react-query'; import { isEmpty } from 'lodash'; import { CalloutContext, useOkapiKy, useStripes } from '@folio/stripes/core'; -import { isPackage } from '@folio/stripes-erm-components'; +import { isPackage, getRefdataValuesByDesc } from '@folio/stripes-erm-components'; import View from '../../components/views/AgreementLineForm'; import { urls } from '../../components/utilities'; import { AGREEMENT_LINES_ENDPOINT } from '../../constants'; -import { useBasket, useSuppressFromDiscovery } from '../../hooks'; +import { + useBasket, + useSuppressFromDiscovery, + useAgreementsRefdata, +} from '../../hooks'; + +const [DOC_ATTACHMENT_TYPE] = ['DocumentAttachment.AtType']; const AgreementLineCreateRoute = ({ handlers, @@ -27,7 +33,9 @@ const AgreementLineCreateRoute = ({ const queryClient = useQueryClient(); const { basket = [] } = useBasket(); - + const refdata = useAgreementsRefdata({ + desc: [DOC_ATTACHMENT_TYPE], + }); /* * This state tracks a checkbox on the form marked "Create another", * which allows the user to redirect back to this form on submit @@ -99,6 +107,7 @@ const AgreementLineCreateRoute = ({ key="agreement-line-create-form" createAnother={createAnother} data={{ + documentCategories: getRefdataValuesByDesc(refdata, DOC_ATTACHMENT_TYPE), basket, }} handlers={{ diff --git a/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js b/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js index 33b0f5040..267e8f391 100644 --- a/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js +++ b/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js @@ -8,13 +8,21 @@ import { isEmpty } from 'lodash'; import { CalloutContext, useOkapiKy, useStripes } from '@folio/stripes/core'; import { LoadingView } from '@folio/stripes/components'; - -import { useSuppressFromDiscovery, useChunkedOrderLines, useBasket } from '../../hooks'; +import { getRefdataValuesByDesc } from '@folio/stripes-erm-components'; + +import { + useSuppressFromDiscovery, + useChunkedOrderLines, + useBasket, + useAgreementsRefdata, +} from '../../hooks'; import { urls } from '../../components/utilities'; import { AGREEMENT_LINE_ENDPOINT } from '../../constants'; import View from '../../components/views/AgreementLineForm'; +const [DOC_ATTACHMENT_TYPE] = ['DocumentAttachment.AtType']; + const AgreementLineEditRoute = ({ handlers, history, @@ -27,7 +35,9 @@ const AgreementLineEditRoute = ({ const queryClient = useQueryClient(); const { basket = [] } = useBasket(); - + const refdata = useAgreementsRefdata({ + desc: [DOC_ATTACHMENT_TYPE], + }); /* * This state tracks a checkbox on the form marked "Create another", * which allows the user to redirect back to this form on submit @@ -133,6 +143,7 @@ const AgreementLineEditRoute = ({ data={{ basket, line: getCompositeLine(), + documentCategories: getRefdataValuesByDesc(refdata, DOC_ATTACHMENT_TYPE), }} handlers={{ ...handlers, From e24410dc0236cc50dd1019ea1459f5c3b3834e40 Mon Sep 17 00:00:00 2001 From: MonireRasouli Date: Tue, 1 Oct 2024 14:07:01 +0100 Subject: [PATCH 3/6] tweak --- .../AgreementLineCreateRoute/AgreementLineCreateRoute.js | 9 ++------- .../AgreementLineEditRoute/AgreementLineEditRoute.js | 1 + translations/ui-agreements/en.json | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js b/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js index 0717555b6..17ac35db8 100644 --- a/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js +++ b/src/routes/AgreementLineCreateRoute/AgreementLineCreateRoute.js @@ -13,11 +13,7 @@ import View from '../../components/views/AgreementLineForm'; import { urls } from '../../components/utilities'; import { AGREEMENT_LINES_ENDPOINT } from '../../constants'; -import { - useBasket, - useSuppressFromDiscovery, - useAgreementsRefdata, -} from '../../hooks'; +import { useBasket, useSuppressFromDiscovery, useAgreementsRefdata } from '../../hooks'; const [DOC_ATTACHMENT_TYPE] = ['DocumentAttachment.AtType']; @@ -101,14 +97,13 @@ const AgreementLineCreateRoute = ({ postAgreementLine(items); }; - return ( Date: Tue, 8 Oct 2024 10:59:21 +0100 Subject: [PATCH 4/6] ERM-3331 --- src/components/views/AgreementLineForm/AgreementLineForm.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/views/AgreementLineForm/AgreementLineForm.js b/src/components/views/AgreementLineForm/AgreementLineForm.js index 3e45f73d8..e586e870e 100644 --- a/src/components/views/AgreementLineForm/AgreementLineForm.js +++ b/src/components/views/AgreementLineForm/AgreementLineForm.js @@ -60,6 +60,7 @@ const propTypes = { values: PropTypes.object, createAnother: PropTypes.bool, toggleCreateAnother: PropTypes.func.isRequired, + initialValues: PropTypes.object, }; const AgreementLineForm = ({ @@ -74,6 +75,7 @@ const AgreementLineForm = ({ values, createAnother = false, toggleCreateAnother, + initialValues = {}, }) => { const hasLoaded = form.getRegisteredFields().length > 0; const resource = isExternal(line) ? line : (line.resource?._object ?? {}); @@ -110,6 +112,7 @@ const AgreementLineForm = ({ setFieldData: form.mutators.setFieldData, values, documentCategories, + initialValues }; }; From 9a19b93d1f595401d2fb49a383e312e9da8bc5eb Mon Sep 17 00:00:00 2001 From: Jack Golding Date: Tue, 8 Oct 2024 14:55:48 +0100 Subject: [PATCH 5/6] fix: Document category field Fixed an issue in while editing an existing agreement line document, in which the category field would not be populated --- src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js b/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js index 9174f1581..3083cc97c 100644 --- a/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js +++ b/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js @@ -96,6 +96,7 @@ const AgreementLineEditRoute = ({ ...agreementLine, linkedResource: agreementLine.type !== 'detached' ? agreementLine : undefined, coverage: agreementLine.customCoverage ? agreementLine.coverage : undefined, + docs: agreementLine.docs.map(o => ({ ...o, atType: o.atType?.value })) ?? [] }; }; From 60a05f4401807978289a6e6816ee838b1d126107 Mon Sep 17 00:00:00 2001 From: MonireRasouli Date: Tue, 8 Oct 2024 15:42:05 +0100 Subject: [PATCH 6/6] tweak --- src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js b/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js index 3083cc97c..aaf916966 100644 --- a/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js +++ b/src/routes/AgreementLineEditRoute/AgreementLineEditRoute.js @@ -96,7 +96,7 @@ const AgreementLineEditRoute = ({ ...agreementLine, linkedResource: agreementLine.type !== 'detached' ? agreementLine : undefined, coverage: agreementLine.customCoverage ? agreementLine.coverage : undefined, - docs: agreementLine.docs.map(o => ({ ...o, atType: o.atType?.value })) ?? [] + docs: agreementLine.docs?.map(o => ({ ...o, atType: o.atType?.value })) ?? [] }; };