Skip to content

Commit

Permalink
Merge pull request #81 from autentia/fix/add-nrv-english-description
Browse files Browse the repository at this point in the history
Fix/add nrv english description
  • Loading branch information
Francisco Javier Martínez authored Jan 13, 2023
2 parents f02c6f4 + d2e122d commit eb18e09
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
31 changes: 18 additions & 13 deletions src/modules/binnacle/components/WorkingTime/WorkingTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,27 @@ export const WorkingTime = observer(() => {
const notRequestedVacations = Number(workingTime?.year.current.notRequestedVacations)
const plus = ' + '
const ncvPlusTarget = notRequestedVacations + (target ?? 0)
const tooltipNotConsumed =
'Objetivo: ' +
(ncvPlusTarget ?? 0) +
'h = ' +
(target ?? 0) +
'h objetivo anual + ' +
notRequestedVacations +
'h vacaciones no solicitadas en el año en curso'
const formatHours = (value: number) => {
if (!settings.useDecimalTimeFormat) {
return value.toString() + 'h '
}
return value.toString()
}

const tooltipParser = t('tooltip_nrv_info.information_message', {
target_hours_nrv: formatHours(ncvPlusTarget ?? 0),
target_annual_hours: formatHours(target ?? 0),
notRequestedVacations_info: formatHours(notRequestedVacations)
})

const shownotRequestedVacations = (notRequestedVacations: number) => {
if (selectedWorkingTimeMode === 'by-year' && notRequestedVacations > 0) {
return (
<>
<Text>
{' '}
{t('time_tracking.target_hours_and_nrv')}{' '}
<Tooltip label={tooltipNotConsumed} placement="bottom">
{t('tooltip_nrv_info.target_and_vns_title')}{' '}
<Tooltip label={tooltipParser} placement="bottom">
<InfoOutlineIcon></InfoOutlineIcon>
</Tooltip>
</Text>
Expand All @@ -66,16 +71,16 @@ export const WorkingTime = observer(() => {
textAlign="left"
fontSize="sm"
>
{(target ?? 0) + notRequestedVacations + 'h'}
{formatHours(notRequestedVacations + (target ?? 0))}
{' (' + getDurationByHours(target ?? 0, settings.useDecimalTimeFormat)}
{plus + notRequestedVacations + 'h v.n.s' + ')'}
{plus + formatHours(notRequestedVacations) + ' v.n.s' + ')'}
</Text>
</>
)
} else {
return (
<>
<Text> {t('time_tracking.recommended_hours')}</Text>
<Text> {t('time_tracking.target_hours')}</Text>
<Text
data-testid="time_tracking_hours"
textTransform="initial"
Expand Down
4 changes: 4 additions & 0 deletions src/shared/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@
"recommended_hours": "Recommended",
"target_hours": "Target"
},
"tooltip_nrv_info": {
"target_and_vns_title": " Target + n.r.v",
"information_message": "{{target_hours_nrv}} = ({{target_annual_hours}} annual target + {{notRequestedVacations_info}} not requested vacations in current year)"
},
"remove_modal": {
"title": "Remove confirmation",
"description": "Are you sure?"
Expand Down
7 changes: 5 additions & 2 deletions src/shared/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@
"imputed_hours": "Imputadas",
"worked_hours": "Trabajadas",
"recommended_hours": "Recomendadas",
"target_hours": "Objetivo",
"target_hours_and_nrv": " Objetivo + v.n.s"
"target_hours": "Objetivo"
},
"tooltip_nrv_info": {
"target_and_vns_title": " Objetivo + v.n.s",
"information_message": "{{target_hours_nrv}} = ({{target_annual_hours}} objetivo anual + {{notRequestedVacations_info}} vacaciones no solicitadas en el año en curso)"
},
"remove_modal": {
"title": "Eliminar activity",
Expand Down

0 comments on commit eb18e09

Please sign in to comment.