From 8b56e347368caf962ff371df9ed99fc62e74463e Mon Sep 17 00:00:00 2001 From: Miu Razvan Date: Thu, 16 Jul 2020 08:43:42 +0300 Subject: [PATCH] Added FacilityBlock and RegulatoryInformationBlock --- src/components/manage/Blocks/DefaultEdit.jsx | 44 +++++ src/components/manage/Blocks/DefaultView.jsx | 90 ++++++++++ .../manage/Blocks/FacilityBlock/Edit.jsx | 44 +++++ .../manage/Blocks/FacilityBlock/View.jsx | 111 ++++++++++++ .../manage/Blocks/FacilityBlock/style.css | 116 +++++++++++++ .../RegulatoryInformationBlock/Edit.jsx | 44 +++++ .../RegulatoryInformationBlock/View.jsx | 162 ++++++++++++++++++ .../RegulatoryInformationBlock/style.css | 112 ++++++++++++ src/components/manage/DataBase/DB.jsx | 43 +++++ src/config.js | 3 +- src/helpers/index.js | 69 ++++++++ src/localconfig.js | 27 +++ 12 files changed, 863 insertions(+), 2 deletions(-) create mode 100644 src/components/manage/Blocks/DefaultEdit.jsx create mode 100644 src/components/manage/Blocks/DefaultView.jsx create mode 100644 src/components/manage/Blocks/FacilityBlock/Edit.jsx create mode 100644 src/components/manage/Blocks/FacilityBlock/View.jsx create mode 100644 src/components/manage/Blocks/FacilityBlock/style.css create mode 100644 src/components/manage/Blocks/RegulatoryInformationBlock/Edit.jsx create mode 100644 src/components/manage/Blocks/RegulatoryInformationBlock/View.jsx create mode 100644 src/components/manage/Blocks/RegulatoryInformationBlock/style.css create mode 100644 src/components/manage/DataBase/DB.jsx diff --git a/src/components/manage/Blocks/DefaultEdit.jsx b/src/components/manage/Blocks/DefaultEdit.jsx new file mode 100644 index 00000000..5ef1330c --- /dev/null +++ b/src/components/manage/Blocks/DefaultEdit.jsx @@ -0,0 +1,44 @@ +import React, { useState, useEffect } from 'react'; +import RenderFields from 'volto-addons/Widgets/RenderFields'; +import { connect } from 'react-redux'; +import { compose } from 'redux'; + +import { settings } from '~/config'; + +import DB from '~/components/manage/DataBase/DB'; + +const DefaultEdit = props => { + useEffect(() => { + if ( + props.data?.sql_select?.value.table && + props.data?.sql_select?.value.columnKey && + props.data?.sql_select?.value.columnValue + ) + DB.table( + props.data?.provider_url?.value || settings.providerUrl, + props.data?.sql_select?.value.table, + ) + .get() + .where( + props.data?.sql_select?.value.where, + props.data?.sql_select?.value.columnKey, + ) + .where( + props.data?.data_query?.value?.i, + props.data?.data_query?.value?.v, + ) + .log(); + /* eslint-disable-next-line */ + }, [props.data?.data_query?.value, props.data?.sql_select?.value]) + return ( +
+ +
+ ); +}; +export default compose( + connect((state, props) => ({ + connected_data_parameters: state.connected_data_parameters, + pathname: state.router.location.pathname, + })), +)(DefaultEdit); diff --git a/src/components/manage/Blocks/DefaultView.jsx b/src/components/manage/Blocks/DefaultView.jsx new file mode 100644 index 00000000..eff1da8b --- /dev/null +++ b/src/components/manage/Blocks/DefaultView.jsx @@ -0,0 +1,90 @@ +import { useState, useEffect } from 'react'; +import _uniqueId from 'lodash/uniqueId'; + +import { connect } from 'react-redux'; +import { compose } from 'redux'; + +import { + setConnectedDataParameters, + deleteConnectedDataParameters, +} from 'volto-datablocks/actions'; + +import { getSchemaWithDataQuery, objectHasData, getBasePath } from '~/helpers'; + +const DefaultView = props => { + const [state, setState] = useState({ + id: _uniqueId('block_'), + schemaWithDataQuery: null, + dataQueryKeys: [], + ids: [], + }); + const id = props.id || state.id; + const path = getBasePath(props.pathname); + useEffect(() => { + // Set schema adding data_query if needed + const schemaWithDataQuery = getSchemaWithDataQuery({ ...props, path }); + setState({ ...state, schemaWithDataQuery }); + /* eslint-disable-next-line */ + }, [props.connected_data_parameters?.byContextPath, props.connected_data_parameters?.byProviderPath]); + + useEffect(() => { + // Set data_query keys and ids + if (state.schemaWithDataQuery) { + const dataQueryKeys = []; + const ids = []; + Object.keys(state.schemaWithDataQuery).forEach(element => { + if (state.schemaWithDataQuery[element].type === 'data-query') { + dataQueryKeys.push(element); + ids.push(`${id}_${element}`); + } + }); + setState({ ...state, dataQueryKeys, ids }); + } + /* eslint-disable-next-line */ + }, [state.schemaWithDataQuery]); + // Update connected_data_parameters if data_query available in data.columns + __CLIENT__ && + state.dataQueryKeys.forEach((key, index) => { + if ( + !objectHasData( + props.connected_data_parameters?.byProviderPath?.[path], + ) && + !objectHasData( + props.connected_data_parameters?.byContextPath?.[path], + ) && + !props.connected_data_parameters?.byPath?.[path]?.override?.[ + state.ids[index] + ] && + props.data?.columns?.[key]?.value?.i && + props.data?.columns?.[key]?.value?.v + ) { + props.dispatch( + setConnectedDataParameters( + path, + props.data.columns[key].value, + state.ids[index], + ), + ); + } + }); + useEffect(() => { + props.onChange && props.onChange(state); + return () => { + // Delete connected data parrameters on Unmount + __CLIENT__ && + state.dataQueryKeys && + state.dataQueryKeys.forEach((key, index) => { + props.dispatch(deleteConnectedDataParameters(path, state.ids[index])); + }); + }; + /* eslint-disable-next-line */ + }, [state]); + return props.view; +}; + +export default compose( + connect((state, props) => ({ + connected_data_parameters: state.connected_data_parameters, + pathname: state.router.location.pathname, + })), +)(DefaultView); diff --git a/src/components/manage/Blocks/FacilityBlock/Edit.jsx b/src/components/manage/Blocks/FacilityBlock/Edit.jsx new file mode 100644 index 00000000..10d66bae --- /dev/null +++ b/src/components/manage/Blocks/FacilityBlock/Edit.jsx @@ -0,0 +1,44 @@ +import React, { useState, useEffect } from 'react'; +import _uniqueId from 'lodash/uniqueId'; +import DefaultEdit from '../DefaultEdit'; +import View from './View'; +import { connect } from 'react-redux'; +import { compose } from 'redux'; +import { settings } from '~/config'; + +const schema = { + provider_url: { + title: 'Provider url', + type: 'text', + default: '', + }, + sql_select: { + type: 'sql', + }, + data_query: { + iTitle: 'Where column', + vTitle: 'Is equal to', + type: 'data-query', + }, +}; + +const Edit = props => { + const [state] = useState({ + id: _uniqueId('block_'), + }); + useEffect(() => { + schema.provider_url.default = settings.providerUrl; + }, []); + return ( +
+ + +
+ ); +}; +export default compose( + connect((state, props) => ({ + connected_data_parameters: state.connected_data_parameters, + pathname: state.router.location.pathname, + })), +)(Edit); diff --git a/src/components/manage/Blocks/FacilityBlock/View.jsx b/src/components/manage/Blocks/FacilityBlock/View.jsx new file mode 100644 index 00000000..db91aa6b --- /dev/null +++ b/src/components/manage/Blocks/FacilityBlock/View.jsx @@ -0,0 +1,111 @@ +import React, { useState } from 'react'; +import DB from '~/components/manage/DataBase/DB'; + +import DefaultView from '../DefaultView'; + +import moment from 'moment'; +import './style.css'; + +// STATIC DATA +// ================== +const facility = { + siteName: ' "ASM BRESCIA" - BOSCO SELLA', + countryCode: 'IT', + 'Site Inspire ID': '2', + mainActivity: + '1(c) Thermal power stations and other combustion installations', + Regulation: 'regulatoryType', + shape_wm_as_text: 'POINT (1122835 5710975)', + NUTS: 'Nord-Ovest, Lombardia, Brescia', + riverBasin: 'RBD PADANO', + 'Facility Main Activity': + 'Thermal power stations and other combustion installations', + nationalId: '250452007.SITE', + OrganizationName: 'ISPRA', + ContactMail: 'protocollo.ispra@ispra.legalmail.it', + 'Auth Address': 'ISPRA Via Vitaliano Brancati 48 Roma 00144', + ContactPerson: 'ISPRA', + authLastUpdated: '2018-05-15T06:37:00', + eprtrReportingDate: '2020-05-15T06:37:00', + eprtrReportingYear: 2020, + 'Facility inspire ID': '2007000854', +}; +const metadata = [ + { label: 'Name', id: 'siteName' }, + { label: 'Contact Person', id: 'ContactPerson' }, + { label: 'Phone', id: 'ContactPhone', default: '++421-2-59415291' }, + { label: 'Address', id: 'Auth Address' }, + { label: 'E-mail', id: 'ContactMail' }, +]; +// ================== + +const View = props => { + const [state, setState] = useState({ + onChange: newState => { + setState({ ...state, ...newState }); + }, + }); + const view = ( +
+
+
+

[facilityName1]

+

Industrial activity

+

{facility.mainActivity}

+
+
+
+

Last report was submitted on:

+

+ {moment(facility.eprtrReportingDate).format('DD MMM YYYY')} +

+
+
+

Reporting year

+

{facility.eprtrReportingYear}

+
+
+

Publish date

+

+ {moment(facility.eprtrReportingDate).format('DD MMM YYYY')} +

+
+
+
+
+

Competent Authority

+

+ Last updated: {moment(facility.authLastUpdated).format('DD MMM YYYY')} +

+
+
+ {metadata.map(meta => + facility[meta.id] ? ( +
+

{meta.label}

+

{facility[meta.id]}

+
+ ) : meta.default ? ( +
+

{meta.label}

+

{meta.default}

+
+ ) : ( + '' + ), + )} +
+
+ ); + return view; + // return ( + // + // ); +}; + +export default View; diff --git a/src/components/manage/Blocks/FacilityBlock/style.css b/src/components/manage/Blocks/FacilityBlock/style.css new file mode 100644 index 00000000..a2eb5d27 --- /dev/null +++ b/src/components/manage/Blocks/FacilityBlock/style.css @@ -0,0 +1,116 @@ +/* DISPLAY */ +.flex { + display: flex; +} +.grid { + display: grid; + grid-gap: 20px; +} +.display-block { + display: block; +} +/* GRID LAYOUT */ +div.grid-cl-3 { + grid-template-columns: repeat(3, 1fr); +} +div.grid-cl-2 { + grid-template-columns: repeat(2, 1fr); +} +/* FLEX FLOW */ +div.flex-row { + flex-flow: row; +} +div.flex-column { + flex-flow: column; +} +/* ALIGN ITEMS */ +div.align-center { + align-items: center; +} +/* JUSTIFY CONTENT */ +div.space-between { + justify-content: space-between; +} + +div.banner { + background: #4296B2; + color: #fff; + padding: 0 1rem; + border-radius: 10px; +} + +div.banner p { + color: #fff; +} + +.light-blue { + color: #4296B2; +} + +div.flex-item { + margin: 1rem; +} +/* PARAGRAPH */ +p.bold { + font-weight: bold; +} +p.lighter { + font-weight: 300; +} +p.info { + color: #989898; + font-weight: 300; + font-size: 14px; +} +p.dark { + color: #333333; +} +/* MARGINS */ +.mt-0 { + margin-top: 0; +} +.mt-1 { + margin-top: 1rem; +} +.mt-2 { + margin-top: 2rem; +} +.mb-0 { + margin-bottom: 0; +} +.mb-1 { + margin-bottom: 1rem; +} +.mb-2 { + margin-bottom: 2rem; +} + +.bat-container { + border: 1px solid #606060; + padding: 16px; + border-radius: 10px; + box-sizing: border-box; +} + +.bat-container div.hr { + height: 1px; + background-color: #606060; +} + +.bat-container a, +.bat-container a:hover { + text-decoration: underline; +} + +@media(max-width: 768px) { + div.responsive.flex { + flex-flow: column; + } + div.responsive.flex > * { + width: 100%; + margin-bottom: 26px; + } + div.responsive.grid.grid-cl-3 { + grid-template-columns: repeat(2, 1fr); + } +} \ No newline at end of file diff --git a/src/components/manage/Blocks/RegulatoryInformationBlock/Edit.jsx b/src/components/manage/Blocks/RegulatoryInformationBlock/Edit.jsx new file mode 100644 index 00000000..10d66bae --- /dev/null +++ b/src/components/manage/Blocks/RegulatoryInformationBlock/Edit.jsx @@ -0,0 +1,44 @@ +import React, { useState, useEffect } from 'react'; +import _uniqueId from 'lodash/uniqueId'; +import DefaultEdit from '../DefaultEdit'; +import View from './View'; +import { connect } from 'react-redux'; +import { compose } from 'redux'; +import { settings } from '~/config'; + +const schema = { + provider_url: { + title: 'Provider url', + type: 'text', + default: '', + }, + sql_select: { + type: 'sql', + }, + data_query: { + iTitle: 'Where column', + vTitle: 'Is equal to', + type: 'data-query', + }, +}; + +const Edit = props => { + const [state] = useState({ + id: _uniqueId('block_'), + }); + useEffect(() => { + schema.provider_url.default = settings.providerUrl; + }, []); + return ( +
+ + +
+ ); +}; +export default compose( + connect((state, props) => ({ + connected_data_parameters: state.connected_data_parameters, + pathname: state.router.location.pathname, + })), +)(Edit); diff --git a/src/components/manage/Blocks/RegulatoryInformationBlock/View.jsx b/src/components/manage/Blocks/RegulatoryInformationBlock/View.jsx new file mode 100644 index 00000000..5eded2e2 --- /dev/null +++ b/src/components/manage/Blocks/RegulatoryInformationBlock/View.jsx @@ -0,0 +1,162 @@ +import React, { useState, useEffect } from 'react'; +import { Table } from 'semantic-ui-react'; + +import DB from '~/components/manage/DataBase/DB'; +import DefaultView from '../DefaultView'; + +import './style.css'; + +// STATIC DATA +// ================== +const information = { + regulatedActivities: 'IEDAnnex|Activity|mainActivity', + statusType: 'statusType', + status: 'Valid', + statusModified: '24.10.2018', + seveso: 'eSPIRSId', + batFileName: 'Production of Chlor-alkali', + batPath: '', + permitUpdated: 'dateOfLastUpdate', + permitAuthority: 'organisationName', + permitUrl: 'permitURL', + visits: '4', + derogations: [ + { + 'Granted derogations': 'Derogation 1', + 'Date granted': '12.1.2017', + 'End date': '12.1.2017', + }, + { + 'Granted derogations': 'Derogation 2', + 'Date granted': '12.1.2017', + 'End date': 'N/A', + }, + { + 'Granted derogations': 'Derogation 3', + 'Date granted': '12.1.2017', + 'End date': '12.1.2017', + }, + { + 'Granted derogations': 'Derogation 4', + 'Date granted': '12.1.2017', + 'End date': 'N/A', + }, + ], +}; +const operatingPermitMetadata = [ + { label: 'Permit updated', id: 'permitUpdated' }, + { label: 'Permitting authority', id: 'permitAuthority' }, + { label: 'Permit available', id: 'permitUrl' }, + { label: 'Seveso', id: 'seveso' }, + { label: 'Site visits in 2018', id: 'visits' }, +]; +const aboutEntityMetadata = [ + { label: 'Regulated activities', id: 'regulatedActivities' }, + { label: 'Status', id: 'statusType' }, + { label: 'Seveso', id: 'seveso' }, +]; + +const batMetadata = [ + { label: 'Status', id: 'status' }, + { label: 'Status Modified', id: 'statusModified' }, +]; +// ================== + +const GridMetadata = props => { + const { metadata, metadataKeys, gridColumns } = props; + return ( +
+ {metadataKeys.map((meta, index) => + metadata[meta.id] ? ( +
+

{meta.label}

+

[{metadata[meta.id]}]

+
+ ) : ( + '' + ), + )} +
+ ); +}; + +const View = props => { + const [state, setState] = useState({ + onChange: newState => { + setState({ ...state, ...newState }); + }, + }); + const view = ( +
+
+

About the entity

+ +
+
+

BAT Conlcussions

+
+ + {information.batFileName} + + +
+ +
+
+
+

Operating permit

+ +
+
+

BAT Derogations

+ + {/* ==== TABLE HEADER ==== */} + + + {Object.keys(information.derogations[0]).map(header => ( + + {header} + + ))} + + + {/* ==== TABLE BODY ==== */} + + {information.derogations.map((row, index) => ( + + {Object.keys(row).map(cell => ( + {row[cell]} + ))} + + ))} + +
+
+
+ ); + return view; + // return ( + // + // ); +}; + +export default View; diff --git a/src/components/manage/Blocks/RegulatoryInformationBlock/style.css b/src/components/manage/Blocks/RegulatoryInformationBlock/style.css new file mode 100644 index 00000000..fc01c618 --- /dev/null +++ b/src/components/manage/Blocks/RegulatoryInformationBlock/style.css @@ -0,0 +1,112 @@ +/* DISPLAY */ +.flex { + display: flex; +} +.grid { + display: grid; + grid-gap: 20px; +} +.display-block { + display: block; +} +/* GRID LAYOUT */ +div.grid-cl-3 { + grid-template-columns: repeat(3, 1fr); +} +div.grid-cl-2 { + grid-template-columns: repeat(2, 1fr); +} +/* FLEX FLOW */ +div.flex-row { + flex-flow: row; +} +div.flex-column { + flex-flow: column; +} +/* ALIGN ITEMS */ +div.align-center { + align-items: center; +} +/* JUSTIFY CONTENT */ +div.space-between { + justify-content: space-between; +} + +div.banner { + background: #4296B2; + color: #fff; + padding: 0 1rem; + border-radius: 10px; +} + +.light-blue { + color: #4296B2; +} + +div.flex-item { + margin: 1rem; +} +/* PARAGRAPH */ +p.bold { + font-weight: bold; +} +p.lighter { + font-weight: 300; +} +p.info { + color: #989898; + font-weight: 300; + font-size: 14px; +} +p.dark { + color: #333333; +} +/* MARGINS */ +.mt-0 { + margin-top: 0; +} +.mt-1 { + margin-top: 1rem; +} +.mt-2 { + margin-top: 2rem; +} +.mb-0 { + margin-bottom: 0; +} +.mb-1 { + margin-bottom: 1rem; +} +.mb-2 { + margin-bottom: 2rem; +} + +.bat-container { + border: 1px solid #606060; + padding: 16px; + border-radius: 10px; + box-sizing: border-box; +} + +.bat-container div.hr { + height: 1px; + background-color: #606060; +} + +.bat-container a, +.bat-container a:hover { + text-decoration: underline; +} + +@media(max-width: 768px) { + div.responsive.flex { + flex-flow: column; + } + div.responsive.flex > * { + width: 100%; + margin-bottom: 26px; + } + div.responsive.grid.grid-cl-3 { + grid-template-columns: repeat(2, 1fr); + } +} \ No newline at end of file diff --git a/src/components/manage/DataBase/DB.jsx b/src/components/manage/DataBase/DB.jsx new file mode 100644 index 00000000..97bc0f13 --- /dev/null +++ b/src/components/manage/DataBase/DB.jsx @@ -0,0 +1,43 @@ +import axios from 'axios'; + +class DB { + static table(path, tableName) { + return new Table(path, tableName); + } +} + +class Table { + constructor(path, tableName) { + this.path = path; + this.tableName = tableName; + this.method = ''; + this.query = ''; + this.whereStatements = []; + } + get() { + this.query += `SELECT * FROM ${this.tableName} `; + this.method = 'get'; + return this; + } + where(column, value) { + if (Array.isArray(value)) { + value.forEach(v => { + this.whereStatements.push(`WHERE ${column}='${v}'`); + }); + } else if (value) { + value.split(',').forEach(v => { + this.whereStatements.push(`WHERE ${column}='${v}'`); + }); + } + return this; + } + log() { + console.log(this.query + this.whereStatements.join(' AND ')); + return this.query + this.whereStatements.join(' AND '); + } + makeRequest() { + return axios[this.method](`${this.path}?query=${this.query}`); + } +} + +export default DB; diff --git a/src/config.js b/src/config.js index ade7bd97..d6760281 100644 --- a/src/config.js +++ b/src/config.js @@ -36,6 +36,7 @@ export const settings = { 'navigation', '&expand.navigation.depth=5', ], + providerUrl: 'https://discodata.eea.europa.eu/sql', }; export const views = { @@ -61,5 +62,3 @@ export const portlets = { export const editForms = { ...config.editForms, }; - -// console.log('config', config); diff --git a/src/helpers/index.js b/src/helpers/index.js index 36f73104..26a50dbe 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -6,6 +6,7 @@ */ import { settings } from '~/config'; import { getBaseUrl } from '@plone/volto/helpers'; +import { setConnectedDataParameters } from 'volto-datablocks/actions'; export function getBasePath(url) { return getBaseUrl(url) @@ -13,6 +14,10 @@ export function getBasePath(url) { .replace(settings.internalApiPath, ''); } +export const objectHasData = obj => { + return typeof obj === 'object' && obj !== null && Object.keys(obj).length > 0; +}; + export function deepSearch({ inputArray = [], pattern, depth }) { const objFitCriteria = { first: index => index === 0, @@ -39,3 +44,67 @@ export function deepSearch({ inputArray = [], pattern, depth }) { return null; } + +export const getSchemaWithDataQuery = props => { + if (!props.schema) return {}; + let schemaWithDataQuery = {}; + Object.keys(props.schema).forEach(element => { + if (props.schema[element].type === 'data-provider') { + if ( + !objectHasData( + props?.connected_data_parameters?.byProviderPath?.[props.path], + ) && + !objectHasData( + props?.connected_data_parameters?.byContextPath?.[props.path], + ) + ) { + const dataQuery = {}; + dataQuery[element + '_data_query'] = { + defaultformat: 'compactnumber', + type: 'data-query', + }; + schemaWithDataQuery[element] = props.schema[element]; + schemaWithDataQuery = { ...schemaWithDataQuery, ...dataQuery }; + } + } + schemaWithDataQuery[element] = props.schema[element]; + }); + return schemaWithDataQuery; +}; + +export const updateConnectedDataParameters = props => { + props.schema && + Object.keys(props.schema).forEach(element => { + if (props.schema[element].type === 'data-query') { + if ( + props?.newData?.columns?.[element] && + (props?.newData?.columns?.[element]?.value?.i !== + props?.data?.columns?.[element]?.value?.i || + props?.newData?.columns?.[element]?.value?.v !== + props?.data?.columns?.[element]?.value?.v) + ) { + const path = getBasePath(props.pathname); + const byPath = props?.connected_data_parameters?.byPath; + const connected_data_parameters = + (byPath?.[path]?.override?.length > 0 && + byPath?.[path]?.override?.[`${props.id}_${element}`]) || + null; + if ( + connected_data_parameters === null || + (connected_data_parameters?.i !== + props?.newData?.columns?.[element]?.value?.i || + connected_data_parameters?.v?.join(',') !== + props?.newData?.columns?.[element]?.value?.v) + ) { + props.dispatch( + setConnectedDataParameters( + path.replace('/edit', ''), + props?.newData?.columns?.[element]?.value, + `${props.id}_${element}`, + ), + ); + } + } + } + }); +}; diff --git a/src/localconfig.js b/src/localconfig.js index 5bf37e98..069d1abc 100644 --- a/src/localconfig.js +++ b/src/localconfig.js @@ -1,3 +1,4 @@ +import chartIcon from '@plone/volto/icons/world.svg'; import TabsView from '~/components/theme/View/TabsView'; import RedirectView from '~/components/theme/View/RedirectView'; import TabsChildView from '~/components/theme/View/TabsChildView'; @@ -15,7 +16,14 @@ import ArticlesListEdit from '~/components/manage/Blocks/ArticlesList/Edit'; import ChildrenLinksView from '~/components/manage/Blocks/ChildrenLinks/View'; import ChildrenLinksEdit from '~/components/manage/Blocks/ChildrenLinks/Edit'; +import FacilityBlockEdit from '~/components/manage/Blocks/FacilityBlock/Edit'; +import FacilityBlockView from '~/components/manage/Blocks/FacilityBlock/View'; + +import RegulatoryInformationBlockEdit from '~/components/manage/Blocks/RegulatoryInformationBlock/Edit'; +import RegulatoryInformationBlockView from '~/components/manage/Blocks/RegulatoryInformationBlock/View'; + const applyConfig = config => { + console.log('config', config); config.views = { ...config.views, layoutViews: { @@ -62,6 +70,25 @@ const applyConfig = config => { edit: ChildrenLinksEdit, icon: config.blocks.blocksConfig.text.icon, }; + + config.blocks.blocksConfig.facility_block = { + id: 'facility_block', + title: 'Facility block', + view: FacilityBlockView, + edit: FacilityBlockEdit, + icon: chartIcon, + group: 'data_blocks', + }; + + config.blocks.blocksConfig.regulatory_information_block = { + id: 'regulatory_information_block', + title: 'Regulatory information block', + view: RegulatoryInformationBlockView, + edit: RegulatoryInformationBlockEdit, + icon: chartIcon, + group: 'data_blocks', + }; + return config; };