Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added date fields to view #711

Merged
merged 7 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@
- ...
-->

## Versione X.X.X (dd/mm/yyyy)

### Migliorie

- Tutti i campi compilabili nel CT Incarico vengono ora visualizzati nella vista corrispondente.

### Novità

- ...

### Fix

- ...

## Versione 11.15.0 (05/07/2024)

### Novità
Expand Down
4 changes: 3 additions & 1 deletion locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,7 @@ msgstr ""
msgid "data_conclusione"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Ha fatto parte dell'organizzazione comunale come {incarico} fino al
msgid "data_conclusione_incarico"
Expand All @@ -1478,14 +1479,15 @@ msgstr ""
msgid "data_inizio"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data di inizio dell'incarico
msgid "data_inizio_incarico"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data insediamento
# defaultMessage: Data di insediamento
msgid "data_insediamento"
msgstr ""

Expand Down
4 changes: 3 additions & 1 deletion locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ msgstr ""
msgid "data_conclusione"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Ha fatto parte dell'organizzazione comunale come {incarico} fino al
msgid "data_conclusione_incarico"
Expand All @@ -1463,14 +1464,15 @@ msgstr "He was part of the municipal organization until"
msgid "data_inizio"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data di inizio dell'incarico
msgid "data_inizio_incarico"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data insediamento
# defaultMessage: Data di insediamento
msgid "data_insediamento"
msgstr "Settlement date"

Expand Down
4 changes: 3 additions & 1 deletion locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,7 @@ msgstr ""
msgid "data_conclusione"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Ha fatto parte dell'organizzazione comunale come {incarico} fino al
msgid "data_conclusione_incarico"
Expand All @@ -1472,14 +1473,15 @@ msgstr "Formó parte de la organización municipal hasta"
msgid "data_inizio"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data di inizio dell'incarico
msgid "data_inizio_incarico"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data insediamento
# defaultMessage: Data di insediamento
msgid "data_insediamento"
msgstr "Fecha de liquidación"

Expand Down
4 changes: 3 additions & 1 deletion locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@ msgstr ""
msgid "data_conclusione"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Ha fatto parte dell'organizzazione comunale come {incarico} fino al
msgid "data_conclusione_incarico"
Expand All @@ -1480,14 +1481,15 @@ msgstr "Date de conclusion de la mission"
msgid "data_inizio"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data di inizio dell'incarico
msgid "data_inizio_incarico"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data insediamento
# defaultMessage: Data di insediamento
msgid "data_insediamento"
msgstr "Date de règlement"

Expand Down
4 changes: 3 additions & 1 deletion locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ msgstr "dal {dateStart} fino a conclusione"
msgid "data_conclusione"
msgstr "Data conclusione incarico"

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Ha fatto parte dell'organizzazione comunale come {incarico} fino al
msgid "data_conclusione_incarico"
Expand All @@ -1463,14 +1464,15 @@ msgstr "Ha fatto parte dell'organizzazione comunale come {incarico} fino al"
msgid "data_inizio"
msgstr "Data inizio incarico"

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data di inizio dell'incarico
msgid "data_inizio_incarico"
msgstr "Data di inizio dell'incarico"

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data insediamento
# defaultMessage: Data di insediamento
msgid "data_insediamento"
msgstr "Data di insediamento"

Expand Down
6 changes: 4 additions & 2 deletions locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-06-11T14:57:29.832Z\n"
"POT-Creation-Date: 2024-06-25T15:14:34.369Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -1455,6 +1455,7 @@ msgstr ""
msgid "data_conclusione"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Ha fatto parte dell'organizzazione comunale come {incarico} fino al
msgid "data_conclusione_incarico"
Expand All @@ -1465,14 +1466,15 @@ msgstr ""
msgid "data_inizio"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data di inizio dell'incarico
msgid "data_inizio_incarico"
msgstr ""

#: components/ItaliaTheme/View/IncaricoView/IncaricoView
#: components/ItaliaTheme/View/PersonaView/PersonaRuolo
# defaultMessage: Data insediamento
# defaultMessage: Data di insediamento
msgid "data_insediamento"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions src/components/ItaliaTheme/View/Commons/Actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Button,
} from 'design-react-kit';
import { toPublicURL } from '@plone/volto/helpers';
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
import Icon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon';

/**
* Actions view component class.
Expand Down Expand Up @@ -98,7 +98,7 @@ const Actions = (props) => {
<LinkList>
{socials.map((item, i) => {
const commonButtonProps = {
icon: false,
icon: undefined,
title: item.title,
alt: item.title,
'aria-label': item.title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useIntl, defineMessages } from 'react-intl';
import PropTypes from 'prop-types';
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
import Icon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon';

/**
* Dates view component class.
Expand Down
2 changes: 1 addition & 1 deletion src/components/ItaliaTheme/View/Commons/Attachment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { defineMessages, useIntl } from 'react-intl';
import { Card, CardBody, CardTitle } from 'design-react-kit';
import { flattenToAppURL } from '@plone/volto/helpers';
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
import Icon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon';

const messages = defineMessages({
attachment: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ItaliaTheme/View/Commons/HelpBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { useIntl, defineMessages } from 'react-intl';
import PropTypes from 'prop-types';
import { Callout, CalloutTitle } from 'design-react-kit';
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
import Icon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon';
import { RichText } from 'design-comuni-plone-theme/components/ItaliaTheme/View';

const HelpBox = ({ text }) => {
Expand Down
7 changes: 5 additions & 2 deletions src/components/ItaliaTheme/View/Commons/RenderBlocks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ const RenderBlocks = ({

if (Block != null) {
return (
<Wrapper block={blockContent[blocksFieldname]?.[block]} id={block}>
<Wrapper
block={blockContent[blocksFieldname]?.[block]}
id={block}
key={block}
>
<Block
key={block}
id={block}
properties={content ?? data}
data={{
Expand Down
2 changes: 1 addition & 1 deletion src/components/ItaliaTheme/View/Commons/Sharing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from 'design-react-kit';

import { toPublicURL } from '@plone/volto/helpers';
import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';
import Icon from 'design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon';

/**
* Sharing view component class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@testing-library/react';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import Dates from '../Dates';

Expand Down
58 changes: 50 additions & 8 deletions src/components/ItaliaTheme/View/IncaricoView/IncaricoView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
import { defineMessages, useIntl } from 'react-intl';
import {
PageHeader,
Expand All @@ -24,12 +23,26 @@ import {
import { contentFolderHasItems } from 'design-comuni-plone-theme/helpers';
import { UniversalLink } from '@plone/volto/components';
import { flattenToAppURL } from '@plone/volto/helpers';
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';

const messages = defineMessages({
tipologia_incarico: {
id: 'tipologia_incarico',
defaultMessage: 'Tipo di incarico',
},
data_inizio_incarico: {
id: 'data_inizio_incarico',
defaultMessage: "Data di inizio dell'incarico",
},
data_conclusione_incarico: {
id: 'data_conclusione_incarico',
defaultMessage:
"Ha fatto parte dell'organizzazione comunale come {incarico} fino al",
},
data_insediamento: {
id: 'data_insediamento',
defaultMessage: 'Data di insediamento',
},
importi_viaggio: {
id: 'importi_viaggio',
defaultMessage: 'Importi di viaggio e/o servizio',
Expand All @@ -54,10 +67,6 @@ const messages = defineMessages({
id: 'data_conclusione',
defaultMessage: 'Data conclusione incarico',
},
data_insediamento: {
id: 'data_insediamento',
defaultMessage: 'Data insediamento',
},
atto_nomina: {
id: 'atto_nomina',
defaultMessage: 'Atto di nomina',
Expand All @@ -69,9 +78,10 @@ const messages = defineMessages({
* @param {Object} content Content object.
* @returns {string} Markup of the component.
*/
const IncaricoView = (props) => {
const { content } = props;
const IncaricoView = ({ content, moment: momentlib }) => {
const moment = momentlib.default;
const intl = useIntl();

return (
<div className="container px-4 my-4 incarico-view">
<SkipToMainContent />
Expand All @@ -93,6 +103,38 @@ const IncaricoView = (props) => {
<div className="font-serif">{content.tipologia_incarico.title}</div>
</RichTextSection>
)}
{content.data_inizio_incarico && (
<RichTextSection
tag_id="data_inizio_incarico"
title={intl.formatMessage(messages.data_inizio_incarico)}
>
<div className="font-serif">
{moment(content.data_inizio_incarico).format('D-MM-YYYY')}
</div>
</RichTextSection>
)}
{content.data_conclusione_incarico && (
<RichTextSection
tag_id="data_conclusione_incarico"
title={intl.formatMessage(messages.data_conclusione_incarico, {
incarico: content.title,
})}
>
<div className="font-serif">
{moment(content.data_conclusione_incarico).format('D-MM-YYYY')}
</div>
</RichTextSection>
)}
{content.data_insediamento && (
<RichTextSection
tag_id="data_insediamento"
title={intl.formatMessage(messages.data_insediamento)}
>
<div className="font-serif">
{moment(content.data_insediamento).format('D-MM-YYYY')}
</div>
</RichTextSection>
)}
{richTextHasContent(content.compensi) && (
<RichTextSection
data={content.compensi}
Expand Down Expand Up @@ -196,4 +238,4 @@ IncaricoView.propTypes = {
}).isRequired,
};

export default injectIntl(IncaricoView);
export default injectLazyLibs(['moment'])(IncaricoView);
10 changes: 4 additions & 6 deletions src/components/ItaliaTheme/View/PersonaView/PersonaRuolo.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { UniversalLink } from '@plone/volto/components';
import {
Expand Down Expand Up @@ -85,15 +86,12 @@ const PersonaRuolo = ({ content }) => {
return (
<>
{content?.incarichi_persona?.length > 0 && (
<>
<React.Fragment key={content?.incarichi_persona[0]?.id}>
<RichTextSection
tag_id="incarico"
title={intl.formatMessage(messages.ruolo)}
>
<div
className="font-serif mb-3"
key={content?.incarichi_persona[0]?.id}
>
<div className="font-serif mb-3">
<p>{content?.incarichi_persona[0]?.title}</p>
{content?.incarichi_persona[0]?.atto_di_nomina && (
<UniversalLink
Expand Down Expand Up @@ -239,7 +237,7 @@ const PersonaRuolo = ({ content }) => {
)}
</RichTextSection>
)}
</>
</React.Fragment>
)}

{content.incarichi_persona?.length > 1 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const mockStore = configureStore(middlewares);
// Warning: An update to Icon inside a test was not wrapped in act(...).
// When testing, code that causes React state updates should be wrapped into act(...):
jest.mock('design-comuni-plone-theme/components/ItaliaTheme/Icons/Icon');
// loadables.push('rrule');
jest.mock('@plone/volto/helpers/Loadable/Loadable');
beforeAll(
async () =>
Expand Down
Loading