Skip to content

Commit 5177a7e

Browse files
authored
Merge pull request #563 from sledilnik/fix/load-gyn-den
fix: ZZZS differentiates how load for gynecologists and dentists is calculated
2 parents 20b8dbf + c159f75 commit 5177a7e

File tree

5 files changed

+45
-13
lines changed

5 files changed

+45
-13
lines changed

src/components/DoctorCard/Info/index.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
import { useNavigate, useParams } from 'react-router-dom';
21
import { CardContent, Stack, Typography } from '@mui/material';
2+
import { useNavigate, useParams } from 'react-router-dom';
3+
4+
import { t } from 'i18next';
35

46
import { useLeafletContext } from 'context/leafletContext';
57

68
import PropTypes from 'prop-types';
79
import DoctorActions from './DoctorActions';
810

9-
import * as Shared from '../Shared';
1011
import { DoctorPropType } from '../../../types';
12+
import * as Shared from '../Shared';
1113

1214
const Info = function Info({ doctor, handleZoom = () => {}, isMarker = false }) {
1315
const { lng } = useParams();
@@ -43,6 +45,18 @@ const Info = function Info({ doctor, handleZoom = () => {}, isMarker = false })
4345
};
4446

4547
const phoneNum = doctor.phone?.split(',')?.[0];
48+
const formatedLoad =
49+
doctor.type.startsWith('gyn') || doctor.type.startsWith('den')
50+
? Intl.NumberFormat(lng, {
51+
style: 'percent',
52+
maximumFractionDigits: 2,
53+
}).format(doctor.load / 100)
54+
: Intl.NumberFormat(lng).format(doctor.load);
55+
56+
const headQuotientTooltipTItle =
57+
doctor.type.startsWith('gyn') || doctor.type.startsWith('den')
58+
? t('achievingAverageOE')
59+
: t('headQuotient');
4660

4761
return (
4862
<>
@@ -73,11 +87,12 @@ const Info = function Info({ doctor, handleZoom = () => {}, isMarker = false })
7387
<Stack direction={isMarker ? 'column' : 'row'} justifyContent="space-between">
7488
<Stack direction="row" alignItems="center" spacing={1}>
7589
<Shared.HeadQuotient
76-
load={doctor.load}
90+
load={formatedLoad}
7791
note={doctor.note}
7892
date={doctor.updatedAt && doctor.formatUpdatedAt(lng)}
7993
accepts={doctor.accepts}
8094
hasOverride={doctor.acceptsOverride || doctor.note ? true : undefined}
95+
tooltipTitle={headQuotientTooltipTItle}
8196
/>
8297
<Shared.Availability
8398
isFloating={doctor.isFloating}

src/components/DoctorCard/Shared/Tooltips.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import PropTypes from 'prop-types';
22

33
import { t } from 'i18next';
44

5-
import { styled } from '@mui/material/styles';
65
import { Divider, Stack, Typography } from '@mui/material';
6+
import { styled } from '@mui/material/styles';
77
import { useParams } from 'react-router-dom';
88
import { toPercent } from '../utils';
99

10-
export const HeadQuotient = function HeadQuotient({ load, note, date, hasOverride }) {
10+
export const HeadQuotient = function HeadQuotient({ load, note, date, hasOverride, tooltipTitle }) {
1111
return (
1212
<Stack sx={{ textAlign: 'center' }}>
13-
<Typography variant="caption">{t('headQuotient')}</Typography>
14-
<Typography variant="body2">{parseFloat(load)}</Typography>
13+
<Typography variant="caption">{tooltipTitle}</Typography>
14+
<Typography variant="body2">{load}</Typography>
1515
{hasOverride && (
1616
<>
1717
<TooltipDivider />
@@ -38,6 +38,7 @@ HeadQuotient.propTypes = {
3838
note: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(undefined)]).isRequired,
3939
date: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(undefined)]).isRequired,
4040
hasOverride: PropTypes.bool,
41+
tooltipTitle: PropTypes.string.isRequired,
4142
};
4243

4344
export const Availability = function Availability({ date, hasOverride, availability }) {

src/components/DoctorCard/Shared/index.js

+20-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import * as Icons from 'components/Shared/Icons';
1010
import Accepts from './Accepts';
1111

1212
import {
13-
TypeTranslate,
13+
AgeGroupIconTranslate,
1414
AgeGroupTranslate,
1515
TypeIconTranslate,
16-
AgeGroupIconTranslate,
16+
TypeTranslate,
1717
} from '../dicts';
1818
import * as Styled from '../styles';
1919

@@ -22,11 +22,11 @@ import * as Tooltips from './Tooltips';
2222
export * as Tooltip from './Tooltips';
2323

2424
// it would be better to import just like Tooltip but don't want to make to many changes all over the code
25-
export { Link, LinkNoRel, ConditionalLink } from './Links';
25+
export { ConditionalLink, Link, LinkNoRel } from './Links';
2626

27+
export { default as Accepts } from './Accepts';
2728
export { default as DoctorLinks } from './DoctorLinks';
2829
export { default as PhoneButton } from './PhoneButton';
29-
export { default as Accepts } from './Accepts';
3030

3131
export const DoubleChip = function DoubleChip({ type, ageGroup, isExtra, isFloating, viewType }) {
3232
const drType = t(TypeTranslate[type]);
@@ -113,11 +113,24 @@ DoubleChip.propTypes = {
113113
viewType: PropTypes.oneOf(['marker', 'list', 'page']),
114114
};
115115

116-
export const HeadQuotient = function HeadQuotient({ load, note, date, accepts, hasOverride }) {
116+
export const HeadQuotient = function HeadQuotient({
117+
load,
118+
note,
119+
date,
120+
accepts,
121+
hasOverride,
122+
tooltipTitle,
123+
}) {
117124
return (
118125
<Tooltip
119126
title={
120-
<Tooltips.HeadQuotient load={load} note={note} date={date} hasOverride={hasOverride} />
127+
<Tooltips.HeadQuotient
128+
load={load}
129+
note={note}
130+
date={date}
131+
hasOverride={hasOverride}
132+
tooltipTitle={tooltipTitle}
133+
/>
121134
}
122135
leaveTouchDelay={3000}
123136
enterTouchDelay={50}
@@ -139,6 +152,7 @@ HeadQuotient.propTypes = {
139152
load: PropTypes.string.isRequired,
140153
accepts: PropTypes.oneOf(['y', 'n']).isRequired,
141154
hasOverride: PropTypes.bool,
155+
tooltipTitle: PropTypes.string.isRequired,
142156
};
143157

144158
export const Availability = function Availability({ date, availability, hasOverride, isFloating }) {

src/locales/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"noResults": "No doctor found based on your search criteria. Check if you have the right doctor type selected or zoom out the map.",
3636
"changedOn": "Changed on: ",
3737
"headQuotient": "Capitation",
38+
"achievingAverageOE": "Achieving average OE",
3839
"doctorAvailabilityLabel": "Availability",
3940
"doctorAvailability": "Availability can be lower than 100% for doctors that work part time on preventive programs or in other units (e.g. dentist working with adults and youth).",
4041
"yourLocation": "Your location",

src/locales/sl.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"noResults": "Noben zdravnik ne ustreza iskalnim pogojem. Preverite, če imate označeno pravilno vrsto zdravnika ali razširite pogled na zemljevidu.",
3838
"changedOn": "Popravek od: ",
3939
"headQuotient": "Glavarinski količnik",
40+
"achievingAverageOE": "Doseganje povprečja OE",
4041
"doctorAvailabilityLabel": "Obseg zaposlitve",
4142
"doctorAvailability": "Obseg zaposlitve: delež je lahko nižji od 100 %, ker zdravnik določen del časa dela na preventivnih programih ali na drugih dejavnostih (recimo zobozdravnik za odrasle in mladino).",
4243
"yourLocation": "Tvoja lokacija",

0 commit comments

Comments
 (0)