Skip to content

Commit

Permalink
Merge pull request #573 from code4romania/fix/511-financial-data
Browse files Browse the repository at this point in the history
fix 511: financial data error translations
  • Loading branch information
luciatugui authored Jul 12, 2024
2 parents a2d45b6 + 3b7f9c9 commit c96126d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 29 deletions.
8 changes: 6 additions & 2 deletions frontend/src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,11 @@
"label": "Other expenses",
"info": "Enter here the total of any other expenses you have not entered in other segments of this budget (for example the purchase of a trailer for a caravan etc.)."
}
}
},
"retry_anaf_warning": "Your data is not up to date.",
"retry_anaf_button": "Try again",
"retry_anaf_error": "Service unavailable.",
"no_financial_info": "No data available for your request."
},
"open_data": {
"load_error": "Data could not be uploaded",
Expand Down Expand Up @@ -1576,4 +1580,4 @@
"date_added": "Date of feedback"
}
}
}
}
8 changes: 6 additions & 2 deletions frontend/src/assets/locales/ro/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,11 @@
"label": "Alte cheltuieli",
"info": "Introduci aici totalul oricăror altor cheltuieli pe care nu le-ai trecut in alte segmente ale acestui buget (de exemplu achiziția unei rulote pentru o caravana etc.)."
}
}
},
"retry_anaf_warning": "Datele nu au fost actualizate.",
"retry_anaf_button": "Încearcă din nou",
"retry_anaf_error": "Serviciu momentan indisponibil.",
"no_financial_info": "Nu există date pentru solicitarea dumneavoastră."
},
"open_data": {
"load_error": "Datele nu s-au putut încărca",
Expand Down Expand Up @@ -1580,4 +1584,4 @@
"date_added": "Data acordării feedback-ului"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,21 @@ const OrganizationFinancial = () => {

const onUpdateAnaf = () => {
if (organization && organizationGeneral?.cui) {
retryAnaf({ organizationId: organization?.id, cui: organizationGeneral?.cui }, {
onSuccess: (data) => {
if (data[0].synched_anaf === false) {
retryAnaf(
{ organizationId: organization?.id, cui: organizationGeneral?.cui },
{
onSuccess: (data) => {
if (data[0].synched_anaf === false) {
useErrorToast(t('no_financial_info'));
}
},
onError: () => {
useErrorToast(t('retry_anaf_error'));
}
},
},
onError: () => {
useErrorToast(t('retry_anaf_error'));
}
});
);
}
}

};

const onView = (row: IOrganizationFinancial) => {
setSelectedReport(row);
Expand Down Expand Up @@ -135,21 +137,26 @@ const OrganizationFinancial = () => {
{t('data_update', { ns: 'financial' })}
</p>
</div>
{organization?.status === OrganizationStatus.PENDING && organizationFinancial[0].synched_anaf === false && role == UserRole.SUPER_ADMIN && (
<div className='flex my-2 gap-4 items-center flex-column'>
<p className='flex'>
<span className='text-yellow-900 sm:text-sm lg:text-base text-xs font-normal'>{t('retry_anaf_warning')}&nbsp;</span>
</p>
<button
aria-label={t('retry_anaf_button')}
className="edit-button flex gap-4 justify-center disabled:bg-gray-50"
onClick={onUpdateAnaf}
disabled={false}
>
{t('retry_anaf_button')}
</button>
{isLoadinAnaf && <LoadingContent />}
</div>)}
{organization?.status === OrganizationStatus.PENDING &&
organizationFinancial[0].synched_anaf === false &&
role == UserRole.SUPER_ADMIN && (
<div className="flex my-2 gap-4 items-center flex-column">
<p className="flex">
<span className="text-yellow-900 sm:text-sm lg:text-base text-xs font-normal">
{t('retry_anaf_warning')}&nbsp;
</span>
</p>
<button
aria-label={t('retry_anaf_button')}
className="edit-button flex gap-4 justify-center disabled:bg-gray-50"
onClick={onUpdateAnaf}
disabled={false}
>
{t('retry_anaf_button')}
</button>
{isLoadinAnaf && <LoadingContent />}
</div>
)}
<DataTableComponent
columns={[...OrganizationFinancialTableHeaders, buildActionColumn()]}
data={organizationFinancial}
Expand Down

0 comments on commit c96126d

Please sign in to comment.