From 46dfbb7381667837f0e5e3883e6cba2be4a88814 Mon Sep 17 00:00:00 2001 From: AlenaYanish Date: Mon, 21 Feb 2022 10:58:57 +0200 Subject: [PATCH 1/2] [DO-2930]No preloader in PEP detailed view page and sanctions when pressing the print button --- src/utils/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 4a9e2714..0e07bd7b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -86,14 +86,17 @@ export const printPDF = (id, dataset, setLoading) => { } Api.get('temporary-token/create/', { useProjectToken: true }) .then((resp) => { - if (setLoading) { - setLoading(false); - } const cookies = new Cookies(['lang']); const lang = cookies.get('lang'); const params = new URLSearchParams(); params.set('token', resp.data.token); params.set('lang', lang); - window.open(`${baseApiUrl}/api/${dataset}${id}/pdf/?${params.toString()}`, '_blank'); + fetch(`${baseApiUrl}/api/${dataset}${id}/pdf/?${params.toString()}`) + .then((resp) => { + if (setLoading) { + setLoading(false); + } + window.open(resp.url, '_blank'); + }); }); }; From 924fd7e2a2e816e05b1fce678100201ab5dddfc5 Mon Sep 17 00:00:00 2001 From: AlenaYanish Date: Mon, 21 Feb 2022 19:25:54 +0200 Subject: [PATCH 2/2] [DO-2912]Incorrect working of the right side menu [Button ] in PEP/Person detailed view page && [DO-2895] --- src/components/blocks/SanctionBlock.jsx | 12 ++++++----- .../pages/datasets/pep/PepDetail.jsx | 20 +++++++++++++++++++ .../pages/datasets/person/PersonDetail.jsx | 8 ++++---- src/components/pages/payment/LogTable.jsx | 2 +- src/utils/index.js | 11 ++++------ 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/components/blocks/SanctionBlock.jsx b/src/components/blocks/SanctionBlock.jsx index 49cda078..86966d33 100644 --- a/src/components/blocks/SanctionBlock.jsx +++ b/src/components/blocks/SanctionBlock.jsx @@ -56,7 +56,7 @@ const SanctionBlock = (props) => { {t(EXPIRED)} - +
{ expired: sanctions.inactiveSanction.length, }} /> - +
@@ -79,9 +79,11 @@ const SanctionBlock = (props) => { {(isEqualArray(values, [ALL]) || isEqualArray(values, [ACTIVE])) && !!sanctions.activeSanction.length && ( <> - - {t('activeSanctions')} - + + + + + {sanctions.activeSanction.map((sanction) => ( sanction.name_of_sanction.map((type, i) => ( diff --git a/src/components/pages/datasets/pep/PepDetail.jsx b/src/components/pages/datasets/pep/PepDetail.jsx index b5697404..dcff54f0 100644 --- a/src/components/pages/datasets/pep/PepDetail.jsx +++ b/src/components/pages/datasets/pep/PepDetail.jsx @@ -80,6 +80,7 @@ const PepDetail = ({ match, history }) => { component: SanctionBlock, blockProps: { data: data.SANCTION && data.SANCTION.length ? data.SANCTION : [{ noSanction: t('noSanction') }] }, type: ASYNCBLOCK, + status: STATUS_BLOCK.isInformation, }, { id: pepBlocks.CRIMINAL, @@ -88,6 +89,7 @@ const PepDetail = ({ match, history }) => { component: PepCriminal, blockProps: { data: pep.criminal_proceedings ? pep.criminal_proceedings : [{ noCriminal: t('noCriminal') }] }, type: INFOBLOCK, + status: STATUS_BLOCK.isInformation, }, { id: pepBlocks.RELATED_PERSONS, @@ -96,6 +98,7 @@ const PepDetail = ({ match, history }) => { component: PepRelatedPerson, blockProps: { pepId: pep.id, matchProps: match, data: prepareRelatedPersonData(pep) }, type: INFOBLOCK, + status: null, }, { id: pepBlocks.RELATED_COMPANIES, @@ -104,6 +107,7 @@ const PepDetail = ({ match, history }) => { component: PepRelatedCompanies, blockProps: { data: pep.related_companies }, type: INFOBLOCK, + status: null, }, { id: asyncBlocks.CAREER, @@ -113,6 +117,7 @@ const PepDetail = ({ match, history }) => { component: PepCareer, blockProps: { data: sortedCareerData(data.CAREER) }, type: ASYNCBLOCK, + status: STATUS_BLOCK.noInformation, }, { id: asyncBlocks.INCOME, @@ -127,6 +132,7 @@ const PepDetail = ({ match, history }) => { pepId: pep.id, ownerField: 'recipient', }, + status: STATUS_BLOCK.noInformation, }, { id: asyncBlocks.LIABILITY, @@ -137,6 +143,7 @@ const PepDetail = ({ match, history }) => { blockData: data.LIABILITY, type: ASYNCBLOCK, blockProps: { data: data.LIABILITY, pepId: pep.id }, + status: STATUS_BLOCK.noInformation, }, { id: asyncBlocks.EXPENDITURE, @@ -151,6 +158,7 @@ const PepDetail = ({ match, history }) => { pepId: pep.id, ownerField: 'participant', }, + status: STATUS_BLOCK.noInformation, }, { id: asyncBlocks.MONETARY_ASSETS, @@ -163,6 +171,7 @@ const PepDetail = ({ match, history }) => { data: data.MONETARY_ASSETS.filter((money) => money.amount !== null), pepId: pep.id, }, + status: STATUS_BLOCK.noInformation, }, { id: asyncBlocks.GIFT, @@ -177,6 +186,7 @@ const PepDetail = ({ match, history }) => { ownerField: 'recipient', data: data.GIFT, }, + status: STATUS_BLOCK.noInformation, }, { id: pepBlocks.INTANGIBLE_ASSETS, @@ -185,6 +195,7 @@ const PepDetail = ({ match, history }) => { component: IntangibleAssets, blockProps: { data: pep.cryptocurrencies_from_last_declaration }, type: INFOBLOCK, + status: STATUS_BLOCK.noInformation, }, { id: asyncBlocks.REAL_ESTATE, @@ -194,6 +205,7 @@ const PepDetail = ({ match, history }) => { component: PepProperty, type: ASYNCBLOCK, blockProps: { data: data.REAL_ESTATE }, + status: STATUS_BLOCK.noInformation, }, { id: asyncBlocks.CAR, @@ -203,6 +215,7 @@ const PepDetail = ({ match, history }) => { component: PepVehicle, blockProps: { data: data.CAR }, type: ASYNCBLOCK, + status: STATUS_BLOCK.noInformation, }, { id: pepBlocks.OTHER_NAMES, @@ -211,6 +224,7 @@ const PepDetail = ({ match, history }) => { component: PepOtherNames, blockProps: { data: pep.fullname_transcriptions_eng }, type: INFOBLOCK, + status: STATUS_BLOCK.noInformation, }, { id: pepBlocks.ADDITIONAL_INFO, @@ -219,6 +233,7 @@ const PepDetail = ({ match, history }) => { component: PepHtml, blockProps: { data: pep.info || '' }, type: INFOBLOCK, + status: STATUS_BLOCK.noInformation, }, ]; const getShortInfo = () => { @@ -309,6 +324,11 @@ const PepDetail = ({ match, history }) => { cur.status = STATUS_BLOCK.isInformation; return 1; } + if (!(cur.blockProps.data.length)) { + cur.status = STATUS_BLOCK.noInformation; + } else { + cur.status = STATUS_BLOCK.isInformation; + } return 0; }).map((block, i) => { const Component = block.component; diff --git a/src/components/pages/datasets/person/PersonDetail.jsx b/src/components/pages/datasets/person/PersonDetail.jsx index 6e0e2112..46a04161 100644 --- a/src/components/pages/datasets/person/PersonDetail.jsx +++ b/src/components/pages/datasets/person/PersonDetail.jsx @@ -286,21 +286,21 @@ const PersonDetail = ({ match, history }) => { id: personBlocks.CAREER, title: 'career', titleIcon: Career, - component: CareerBlock, blockProps: { data: person.position_data, person, }, + component: CareerBlock, status: null, }, { id: personBlocks.OTHER_NAMES, title: 'otherNames', titleIcon: Name, - component: OtherNames, blockProps: { data: person.full_name_options, }, + component: OtherNames, status: null, }, { @@ -398,11 +398,11 @@ const PersonDetail = ({ match, history }) => { const getAdditionalInfo = () => config.sort((prev, cur) => { if (prev.blockProps.data && prev.blockProps.data.length && !(cur.blockProps.data.length)) { prev.status = STATUS_BLOCK.isInformation; - cur.status = STATUS_BLOCK.noInformation; + cur.status = STATUS_BLOCK.inDevelopment; return -1; } if (cur.blockProps.data.length && !(prev.blockProps.data.length)) { - prev.status = STATUS_BLOCK.noInformation; + prev.status = STATUS_BLOCK.inDevelopment; cur.status = STATUS_BLOCK.isInformation; return 1; } diff --git a/src/components/pages/payment/LogTable.jsx b/src/components/pages/payment/LogTable.jsx index d3292992..ac3683c1 100644 --- a/src/components/pages/payment/LogTable.jsx +++ b/src/components/pages/payment/LogTable.jsx @@ -78,7 +78,7 @@ const LogTable = () => { return ( -
+
{t('activeSanctions')}
{ } Api.get('temporary-token/create/', { useProjectToken: true }) .then((resp) => { + if (setLoading) { + setLoading(false); + } const cookies = new Cookies(['lang']); const lang = cookies.get('lang'); const params = new URLSearchParams(); params.set('token', resp.data.token); params.set('lang', lang); - fetch(`${baseApiUrl}/api/${dataset}${id}/pdf/?${params.toString()}`) - .then((resp) => { - if (setLoading) { - setLoading(false); - } - window.open(resp.url, '_blank'); - }); + window.open(`${baseApiUrl}/api/${dataset}${id}/pdf/?${params.toString()}`, '_blank'); }); };