diff --git a/src/Organizations/OrganizationVersion/OrganizationVersionView/OrganizationVersionView.js b/src/Organizations/OrganizationVersion/OrganizationVersionView/OrganizationVersionView.js index ee667272..d96763da 100644 --- a/src/Organizations/OrganizationVersion/OrganizationVersionView/OrganizationVersionView.js +++ b/src/Organizations/OrganizationVersion/OrganizationVersionView/OrganizationVersionView.js @@ -54,8 +54,6 @@ export const OrganizationVersionView = ({ version }) => { }, ]; - console.log('version', version); - return ( - - + + ))} diff --git a/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactAddressesVersionView.js b/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactAddressesVersionView.js index 72abba41..db641a15 100644 --- a/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactAddressesVersionView.js +++ b/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactAddressesVersionView.js @@ -1,5 +1,4 @@ import PropTypes from 'prop-types'; -import { useContext } from 'react'; import { FormattedMessage } from 'react-intl'; import { @@ -7,29 +6,24 @@ import { Col, Row, } from '@folio/stripes/components'; -import { - VersionKeyValue, - VersionViewContext, -} from '@folio/stripes-acq-components'; +import { VersionKeyValue } from '@folio/stripes-acq-components'; -export const ContactAddressesVersionView = ({ addresses }) => { - const versionContext = useContext(VersionViewContext); +import { ContactCardHeaderVersionView } from './ContactCardHeaderVersionView'; +export const ContactAddressesVersionView = ({ addresses }) => { return ( {addresses?.map((address) => { - const isPrimaryValue = ( -

- -

- ); - const headerStart = versionContext?.paths?.includes(`${address?._initialFieldPath}.isPrimary`) - ? {isPrimaryValue} - : isPrimaryValue; - return ( - + + )} + > { + const versionContext = useContext(VersionViewContext); + + const isUpdated = versionContext?.paths?.includes(name); + + const headerStart = ( +

+ +

+ ); + + return headerStart; +}; + +ContactCardHeaderVersionView.propTypes = { + isPrimary: PropTypes.bool.isRequired, + name: PropTypes.string.isRequired, +}; diff --git a/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactCardHeaderVersionView/index.js b/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactCardHeaderVersionView/index.js new file mode 100644 index 00000000..f958e7ee --- /dev/null +++ b/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactCardHeaderVersionView/index.js @@ -0,0 +1 @@ +export { ContactCardHeaderVersionView } from './ContactCardHeaderVersionView'; diff --git a/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactPersonEmailsVersionView.js b/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactPersonEmailsVersionView.js index 65b6d1b3..46cf494e 100644 --- a/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactPersonEmailsVersionView.js +++ b/src/Organizations/OrganizationVersion/components/OrganizationContactInfoVersionView/components/ContactPersonEmailsVersionView.js @@ -1,5 +1,4 @@ import PropTypes from 'prop-types'; -import { useContext } from 'react'; import { FormattedMessage } from 'react-intl'; import { @@ -10,31 +9,27 @@ import { import { LANG_LABEL_BY_CODE, VersionKeyValue, - VersionViewContext, } from '@folio/stripes-acq-components'; import { ContactPersonSection } from '../../../../../ContactPeople/ContactPerson'; +import { ContactCardHeaderVersionView } from './ContactCardHeaderVersionView'; export const ContactPersonEmailsVersionView = ({ emails }) => { - const versionContext = useContext(VersionViewContext); - if (!emails?.length) return null; const renderBody = () => ( {emails?.map((email) => { - const isPrimaryValue = ( -

- -

- ); - const headerStart = versionContext?.paths?.includes(`${email?._initialFieldPath}.isPrimary`) - ? {isPrimaryValue} - : isPrimaryValue; - return ( - + + )} + > { - const versionContext = useContext(VersionViewContext); - if (!phones?.length) return null; const renderBody = () => ( @@ -25,17 +22,15 @@ export const ContactPersonPhonesVersionView = ({ phones }) => { {phones?.map((phone) => { - const isPrimaryValue = ( -

- -

- ); - const headerStart = versionContext?.paths?.includes(`${phone?._initialFieldPath}.isPrimary`) - ? {isPrimaryValue} - : isPrimaryValue; - return ( - + + )} + > { - const versionContext = useContext(VersionViewContext); - if (!urls?.length) return null; const renderBody = () => ( {urls?.map((url) => { - const isPrimaryValue = ( -

- -

- ); - const headerStart = versionContext?.paths?.includes(`${url?._initialFieldPath}.isPrimary`) - ? {isPrimaryValue} - : isPrimaryValue; - return ( - + + )} + > { 'addresses[\\d].stateRegion': 'ui-organizations.contactPeople.stateRegion', 'addresses[\\d].zipCode': 'ui-organizations.contactPeople.zipCode', 'addresses[\\d].country': 'ui-organizations.contactPeople.country', - 'addresses[\\d].isPrimary': 'ui-organizations.primaryItem', - 'addresses[\\d].categories': 'ui-organizations.contactPeople.categories', - 'addresses[\\d].categories[\\d]': 'ui-organizations.contactPeople.categories', - 'addresses[\\d].language': 'ui-organizations.contactPeople.language', + 'addresses[\\d].isPrimary': 'ui-organizations.versionHistory.field.address.isPrimary', + 'addresses[\\d].categories': 'ui-organizations.versionHistory.field.address.categories', + 'addresses[\\d].categories[\\d]': 'ui-organizations.versionHistory.field.address.categories', + 'addresses[\\d].language': 'ui-organizations.versionHistory.field.address.language', 'phoneNumbers': 'ui-organizations.contactPeople.phoneNumbers', 'phoneNumbers[\\d]': 'ui-organizations.contactPeople.phoneNumbers', 'phoneNumbers[\\d].phoneNumber': 'ui-organizations.contactPeople.phoneNumber', - 'phoneNumbers[\\d].categories': 'ui-organizations.contactPeople.categories', - 'phoneNumbers[\\d].categories[\\d]': 'ui-organizations.contactPeople.categories', - 'phoneNumbers[\\d].type': 'ui-organizations.contactPeople.type', - 'phoneNumbers[\\d].isPrimary': 'ui-organizations.primaryItem', + 'phoneNumbers[\\d].categories': 'ui-organizations.versionHistory.field.phoneNumbers.categories', + 'phoneNumbers[\\d].categories[\\d]': 'ui-organizations.versionHistory.field.phoneNumbers.categories', + 'phoneNumbers[\\d].type': 'ui-organizations.versionHistory.field.phoneNumbers.type', + 'phoneNumbers[\\d].isPrimary': 'ui-organizations.versionHistory.field.phoneNumbers.isPrimary', 'phoneNumbers[\\d].language': 'ui-organizations.contactPeople.language', 'emails': 'ui-organizations.contactPeople.emails', 'emails[\\d]': 'ui-organizations.contactPeople.emails', 'emails[\\d].value': 'ui-organizations.contactPeople.emailAddress', - 'emails[\\d].description': 'ui-organizations.contactPeople.description', - 'emails[\\d].isPrimary': 'ui-organizations.primaryItem', - 'emails[\\d].categories': 'ui-organizations.contactPeople.categories', - 'emails[\\d].categories[\\d]': 'ui-organizations.contactPeople.categories', - 'emails[\\d].language': 'ui-organizations.contactPeople.language', + 'emails[\\d].description': 'ui-organizations.versionHistory.field.emails.description', + 'emails[\\d].isPrimary': 'ui-organizations.versionHistory.field.emails.isPrimary', + 'emails[\\d].categories': 'ui-organizations.versionHistory.field.emails.categories', + 'emails[\\d].categories[\\d]': 'ui-organizations.versionHistory.field.emails.categories', + 'emails[\\d].language': 'ui-organizations.versionHistory.field.emails.language', 'urls': 'ui-organizations.contactPeople.urls', 'urls[\\d]': 'ui-organizations.contactPeople.urls', 'urls[\\d].value': 'ui-organizations.contactPeople.url', - 'urls[\\d].description': 'ui-organizations.contactPeople.description', - 'urls[\\d].language': 'ui-organizations.contactPeople.language', - 'urls[\\d].isPrimary': 'ui-organizations.primaryItem', - 'urls[\\d].categories': 'ui-organizations.contactPeople.categories', - 'urls[\\d].categories[\\d]': 'ui-organizations.contactPeople.categories', + 'urls[\\d].description': 'ui-organizations.versionHistory.field.urls.description', + 'urls[\\d].language': 'ui-organizations.versionHistory.field.urls.language', + 'urls[\\d].isPrimary': 'ui-organizations.versionHistory.field.urls.isPrimary', + 'urls[\\d].categories': 'ui-organizations.versionHistory.field.urls.categories', + 'urls[\\d].categories[\\d]': 'ui-organizations.versionHistory.field.urls.categories', 'contacts': 'ui-organizations.contactPeople', 'contacts[\\d]': 'ui-organizations.contactPeople', 'privilegedContacts': 'ui-organizations.privilegedDonorInformation', 'agreements': 'ui-organizations.linkedAgreements.section', 'agreements[\\d]': 'ui-organizations.linkedAgreements.section', - 'agreements[\\d].name': 'ui-organizations.agreement.name', + 'agreements[\\d].name': 'ui-organizations.versionHistory.field.agreements.name', 'agreements[\\d].discount': 'ui-organizations.agreement.discount', 'agreements[\\d].referenceUrl': 'ui-organizations.agreement.referenceUrl', - 'agreements[\\d].notes': 'ui-organizations.agreement.notes', + 'agreements[\\d].notes': 'ui-organizations.versionHistory.field.agreements.notes', 'erpCode': 'ui-organizations.summary.accountingCode', 'paymentMethod': 'ui-organizations.accounts.paymentMethod', 'accessProvider': 'ui-organizations.versionHistory.field.accessProvider', @@ -100,7 +100,7 @@ export const getOrganizationFieldsLabelMap = () => { 'edi.sendAcctNum': 'integration.edi.sendAccountNumber', 'edi.supportOrder': 'ui-organizations.integration.edi.orders', 'edi.supportInvoice': 'ui-organizations.integration.edi.invoices', - 'edi.notes': 'ui-organizations.integration.edi.notes', + 'edi.notes': 'ui-organizations.versionHistory.field.edi.notes', 'edi.ediFtp': 'ui-organizations.integration.ftp', 'edi.ediFtp.ftpFormat': 'ui-organizations.integration.ftp.ftpFormat', 'edi.ediFtp.serverAddress': 'ui-organizations.integration.ftp.serverAddress', diff --git a/translations/ui-organizations/en.json b/translations/ui-organizations/en.json index 2181146c..083d0197 100644 --- a/translations/ui-organizations/en.json +++ b/translations/ui-organizations/en.json @@ -449,6 +449,7 @@ "versionHistory.field.accessProvider": "Access provider", "versionHistory.field.governmental": "Governmental", "versionHistory.field.licensor": "Licensor", + "versionHistory.field.edi.notes": "Notes (EDI)", "versionHistory.field.edi.prorateTax": "Prorate tax", "versionHistory.field.edi.prorateFees": "Prorate fees", "versionHistory.field.edi.ediJob.sendToEmails": "Send to emails", @@ -456,6 +457,26 @@ "versionHistory.field.edi.ediJob.notifyInvoiceOnly": "Notify invoice only", "versionHistory.field.edi.ediJob.notifyErrorOnly": "Notify error only", "versionHistory.field.edi.ediJob.schedulingNotes": "Scheduling notes", + "versionHistory.field.address.isPrimary": "Primary (Address)", + "versionHistory.field.address.categories": "Categories (Address)", + "versionHistory.field.address.language": "Language (Address)", + "versionHistory.field.phoneNumbers.isPrimary": "Primary (Phone number)", + "versionHistory.field.phoneNumbers.categories": "Categories (Phone number)", + "versionHistory.field.phoneNumbers.language": "Language (Phone number)", + "versionHistory.field.phoneNumbers.type": "Type (Phone number)", + "versionHistory.field.emails.description": "Description (Email)", + "versionHistory.field.emails.isPrimary": "Primary (Email)", + "versionHistory.field.emails.categories": "Categories (Email)", + "versionHistory.field.emails.language": "Language (Email)", + "versionHistory.field.urls.description": "Description (URL)", + "versionHistory.field.urls.language": "Language (URL)", + "versionHistory.field.urls.isPrimary": "Primary (URL)", + "versionHistory.field.urls.categories": "Categories (URL)", + "versionHistory.field.agreements.name": "Name (Agreement)", + "versionHistory.field.agreements.notes": "Notes (Agreement)", + "versionHistory.field.accounts.name": "Name (Account)", + "versionHistory.field.accounts.description": "Description (Account)", + "versionHistory.field.accounts.notes": "Notes (Account)", "settings.categories": "Categories", "settings.categories.cannotDeleteTermHeader": "Cannot delete category",