From d5413393a6b582f20712e216539655c6b589a9da Mon Sep 17 00:00:00 2001 From: Rajeshwar Singh <132039556+Raj4478@users.noreply.github.com> Date: Fri, 19 Sep 2025 18:06:18 +0000 Subject: [PATCH 1/2] feat(Translation fix): Fixed Translation on the Data Entry Search Page --- src/dataEntryApp/components/SubjectVoided.jsx | 12 +- .../views/GlobalSearch/BasicForm.jsx | 22 +- .../views/GlobalSearch/SearchFilterForm.jsx | 143 +-- .../views/GlobalSearch/SubjectTypeOptions.jsx | 18 +- .../views/registration/FormWizardButton.jsx | 6 +- .../components/AddRelative.jsx | 96 +- .../subjectDashBoard/components/Button.jsx | 8 +- .../components/ProfileDetails.jsx | 66 +- .../components/ProgramEnrol.jsx | 34 +- translations/hi_IN.json | 906 +++++++++++------- 10 files changed, 748 insertions(+), 563 deletions(-) diff --git a/src/dataEntryApp/components/SubjectVoided.jsx b/src/dataEntryApp/components/SubjectVoided.jsx index da692d69b..453c8622b 100644 --- a/src/dataEntryApp/components/SubjectVoided.jsx +++ b/src/dataEntryApp/components/SubjectVoided.jsx @@ -1,34 +1,36 @@ import { styled } from "@mui/material/styles"; import { Paper, Grid, Button, Typography } from "@mui/material"; +import { useTranslation } from "react-i18next"; const StyledPaper = styled(Paper)({ padding: 20, marginBottom: 10, - elevation: 2 + elevation: 2, }); const StyledGrid = styled(Grid)({ - alignItems: "flex-start" + alignItems: "flex-start", }); const StyledTypography = styled(Typography)(({ theme }) => ({ color: theme.palette.error.main, - marginBottom: 8 + marginBottom: 8, })); const SubjectVoided = ({ onUnVoid, showUnVoid }) => { + const { t } = useTranslation(); return ( - {"THE SUBJECT HAS BEEN VOIDED"} + {t("THE SUBJECT HAS BEEN VOIDED")} {showUnVoid && ( )} diff --git a/src/dataEntryApp/views/GlobalSearch/BasicForm.jsx b/src/dataEntryApp/views/GlobalSearch/BasicForm.jsx index 66183581a..63860af85 100644 --- a/src/dataEntryApp/views/GlobalSearch/BasicForm.jsx +++ b/src/dataEntryApp/views/GlobalSearch/BasicForm.jsx @@ -6,7 +6,7 @@ import { Grid, FormGroup, FormControlLabel, - Checkbox + Checkbox, } from "@mui/material"; import { useTranslation } from "react-i18next"; import { find } from "lodash"; @@ -14,12 +14,12 @@ import AddressLevelsByType from "../../../common/components/AddressLevelsByType" const StyledContainer = styled(Grid)({ marginTop: "1%", - marginBottom: "1%" + marginBottom: "1%", }); const StyledLabel = styled(Typography)({ marginBottom: 10, - color: "rgba(0, 0, 0, 0.54)" + color: "rgba(0, 0, 0, 0.54)", }); function BasicForm({ @@ -30,7 +30,7 @@ function BasicForm({ selectedGender, enterValue, addressLevelIds, - setAddressLevelIds + setAddressLevelIds, }) { const { t } = useTranslation(); @@ -52,7 +52,7 @@ function BasicForm({ ); } - const isFilterConfigured = !!find(searchFilterForms, sff => sff.type); + const isFilterConfigured = !!find(searchFilterForms, (sff) => sff.type); return isFilterConfigured ? ( @@ -76,7 +76,7 @@ function BasicForm({ ) : ( "" - ) + ), )} {searchFilterForms.map((searchFilterForm, index) => @@ -98,13 +98,13 @@ function BasicForm({ ) : ( "" - ) + ), )} {searchFilterForms.map((searchFilterForm, index) => searchFilterForm.type === "SearchAll" ? renderSearchAll(index, searchFilterForm.titleKey) - : "" + : "", )} @@ -125,7 +125,7 @@ function BasicForm({ : false } onChange={onGenderChange} - name={gender.uuid} + name={t(gender.uuid)} color="primary" /> } @@ -137,7 +137,7 @@ function BasicForm({ ) : ( "" - ) + ), )} @@ -153,7 +153,7 @@ function BasicForm({ ) : ( "" - ) + ), )} diff --git a/src/dataEntryApp/views/GlobalSearch/SearchFilterForm.jsx b/src/dataEntryApp/views/GlobalSearch/SearchFilterForm.jsx index fd7e80d99..c293c7d20 100644 --- a/src/dataEntryApp/views/GlobalSearch/SearchFilterForm.jsx +++ b/src/dataEntryApp/views/GlobalSearch/SearchFilterForm.jsx @@ -10,11 +10,11 @@ import { FormControl, Button, Grid, - Stack + Stack, } from "@mui/material"; import { getGenders, - getOrganisationConfig + getOrganisationConfig, } from "../../reducers/metadataReducer"; import BasicForm from "../GlobalSearch/BasicForm"; import NonCodedConceptForm from "../GlobalSearch/NonCodedConceptForm"; @@ -33,13 +33,13 @@ const StyledPaper = styled(Paper)(({ theme }) => ({ padding: theme.spacing(3, 2), margin: theme.spacing(1, 3), flexGrow: 1, - backgroundColor: "white" + backgroundColor: "white", })); const StyledTypography = styled(Typography)({ fontSize: 20 }); const StyledButtons = styled("div")(({ theme }) => ({ - "& > *": { margin: theme.spacing(1) } + "& > *": { margin: theme.spacing(1) }, })); const initialStates = { @@ -48,8 +48,8 @@ const initialStates = { RegistrationDate: { minValue: null, maxValue: null }, EnrolmentDate: { minValue: null, maxValue: null }, ProgramEncounterDate: { minValue: null, maxValue: null }, - EncounterDate: { minValue: null, maxValue: null } - } + EncounterDate: { minValue: null, maxValue: null }, + }, }; export const SearchForm = ({ @@ -59,7 +59,7 @@ export const SearchForm = ({ searchRequest, searchTo, cancelTo, - onSearch + onSearch, }) => { const { t } = useTranslation(); const searchProps = _.isFunction(onSearch) @@ -77,51 +77,52 @@ export const SearchForm = ({ encounterDate, programEncounterDate, programEnrolmentDate, - searchAll + searchAll, } = searchRequest; const [selectedSubjectTypeUUID, setSelectedSubjectTypeUUID] = useState( - subjectType || _.get(operationalModules.subjectTypes[0], "uuid") + subjectType || _.get(operationalModules.subjectTypes[0], "uuid"), ); - const initialSubjectTypeSearchFilter = organisationConfigs?.organisationConfig?.searchFilters?.filter( - sf => sf.subjectTypeUUID === selectedSubjectTypeUUID - ); + const initialSubjectTypeSearchFilter = + organisationConfigs?.organisationConfig?.searchFilters?.filter( + (sf) => sf.subjectTypeUUID === selectedSubjectTypeUUID, + ); const [selectedSearchFilter, setSelectedSearchFilter] = useState( - initialSubjectTypeSearchFilter || [] + initialSubjectTypeSearchFilter || [], ); const [enterValue, setEnterValue] = useState({ name: name || "", age: (age && age.minValue) || "", - searchAll: searchAll || "" + searchAll: searchAll || "", }); - const searchFilterValue = e => + const searchFilterValue = (e) => setEnterValue({ ...enterValue, [e.target.name]: e.target.value }); let g = {}; - _.forEach(gender, x => _.assign(g, { [x]: true })); + _.forEach(gender, (x) => _.assign(g, { [x]: true })); const [selectedGender, setSelectedGender] = useState(g); - const onGenderChange = e => + const onGenderChange = (e) => setSelectedGender({ ...selectedGender, - [e.target.name]: e.target.checked + [e.target.name]: e.target.checked, }); const selectedGenderSort = Object.keys(selectedGender) - .filter(k => selectedGender[k]) + .filter((k) => selectedGender[k]) .map(String); const [addressLevelIds, setAddressLevelIds] = useState(addressIds || []); - const setPrev = d => ({ + const setPrev = (d) => ({ minValue: d?.minValue || null, - maxValue: d?.maxValue || null + maxValue: d?.maxValue || null, }); const [selectedDate, setSelectedDate] = useState({ RegistrationDate: setPrev(registrationDate), EnrolmentDate: setPrev(programEnrolmentDate), ProgramEncounterDate: setPrev(programEncounterDate), - EncounterDate: setPrev(encounterDate) + EncounterDate: setPrev(encounterDate), }); const searchFilterDates = (min, max, type) => setSelectedDate({ @@ -134,14 +135,14 @@ export const SearchForm = ({ maxValue: max && isValid(new Date(max)) ? format(new Date(max), "yyyy-MM-dd") - : null - } + : null, + }, }); - const getInitialConceptList = filters => + const getInitialConceptList = (filters) => filters - .filter(f => f.type === "Concept" && f.conceptDataType !== null) - .map(c => { + .filter((f) => f.type === "Concept" && f.conceptDataType !== null) + .map((c) => { const def = { Date: { ...c, minValue: null, maxValue: null }, DateTime: { ...c, minValue: null, maxValue: null }, @@ -149,7 +150,7 @@ export const SearchForm = ({ Numeric: { ...c, minValue: null, maxValue: null }, Coded: { ...c, values: [] }, Text: { ...c, value: "" }, - Id: { ...c, value: "" } + Id: { ...c, value: "" }, }; return def[c.conceptDataType]; }); @@ -159,21 +160,21 @@ export const SearchForm = ({ // Update selected concepts when search filter changes useEffect(() => { const initialConceptList = getInitialConceptList(selectedSearchFilter); - const allConceptRelated = _.map(initialConceptList, itm => - _.merge(itm, _.find(concept, { uuid: itm.conceptUUID })) + const allConceptRelated = _.map(initialConceptList, (itm) => + _.merge(itm, _.find(concept, { uuid: itm.conceptUUID })), ); setSelectedConcept(allConceptRelated); }, [selectedSearchFilter, concept]); const [checked, setChecked] = useState({ includeVoided: searchRequest.includeVoided || false, - includeDisplayCount: searchRequest.includeDisplayCount || false + includeDisplayCount: searchRequest.includeDisplayCount || false, }); - const onChecked = (key, val) => setChecked(c => ({ ...c, [key]: val })); + const onChecked = (key, val) => setChecked((c) => ({ ...c, [key]: val })); const { includeVoided, includeDisplayCount } = checked; - const getSelectedConceptApi = list => - list.filter(c => { + const getSelectedConceptApi = (list) => + list.filter((c) => { switch (c.conceptDataType) { case null: return false; @@ -193,8 +194,8 @@ export const SearchForm = ({ } }); - const getConceptRequests = list => - getSelectedConceptApi(list).map(r => { + const getConceptRequests = (list) => + getSelectedConceptApi(list).map((r) => { if (["Date", "DateTime", "Time"].includes(r.conceptDataType)) { return { uuid: r.conceptUUID, @@ -208,7 +209,7 @@ export const SearchForm = ({ : null, searchScope: r.scope, dataType: r.conceptDataType, - widget: r.widget + widget: r.widget, }; } if (r.conceptDataType === "Coded") { @@ -217,7 +218,7 @@ export const SearchForm = ({ searchScope: r.scope, dataType: r.conceptDataType, widget: r.widget, - values: r.values + values: r.values, }; } if (["Text", "Id"].includes(r.conceptDataType)) { @@ -226,7 +227,7 @@ export const SearchForm = ({ searchScope: r.scope, dataType: r.conceptDataType, widget: r.widget, - value: r.value + value: r.value, }; } if (r.conceptDataType === "Numeric") { @@ -236,7 +237,7 @@ export const SearchForm = ({ maxValue: r.maxValue, searchScope: r.scope, dataType: r.conceptDataType, - widget: r.widget + widget: r.widget, }; } return null; @@ -252,10 +253,10 @@ export const SearchForm = ({ setChecked({ includeVoided: false, includeDisplayCount: false }); }; - const onSubjectTypeChange = uuid => { + const onSubjectTypeChange = (uuid) => { setSelectedSubjectTypeUUID(uuid); const sf = organisationConfigs?.organisationConfig?.searchFilters?.filter( - s => s.subjectTypeUUID === uuid + (s) => s.subjectTypeUUID === uuid, ); setSelectedSearchFilter(sf || []); resetFilters(); @@ -273,21 +274,21 @@ export const SearchForm = ({ gender: selectedGenderSort, registrationDate: { minValue: selectedDate.RegistrationDate.minValue, - maxValue: selectedDate.RegistrationDate.maxValue + maxValue: selectedDate.RegistrationDate.maxValue, }, encounterDate: { minValue: selectedDate.EncounterDate.minValue, - maxValue: selectedDate.EncounterDate.maxValue + maxValue: selectedDate.EncounterDate.maxValue, }, programEncounterDate: { minValue: selectedDate.ProgramEncounterDate.minValue, - maxValue: selectedDate.ProgramEncounterDate.maxValue + maxValue: selectedDate.ProgramEncounterDate.maxValue, }, programEnrolmentDate: { minValue: selectedDate.EnrolmentDate.minValue, - maxValue: selectedDate.EnrolmentDate.maxValue + maxValue: selectedDate.EnrolmentDate.maxValue, }, - searchAll: enterValue.searchAll + searchAll: enterValue.searchAll, }; if (_.isFunction(onSearch)) onSearch(req); @@ -350,16 +351,16 @@ export const SearchForm = ({ onChecked("includeVoided", e.target.checked)} + onChange={(e) => onChecked("includeVoided", e.target.checked)} /> + onChange={(e) => onChecked("includeDisplayCount", e.target.checked) } /> @@ -388,31 +389,31 @@ export const SearchForm = ({ ); }; -const searchFilterConcept = function( +const searchFilterConcept = function ( event, searchFilterForm, fieldName, - setSelectedConcept + setSelectedConcept, ) { - setSelectedConcept(previousSelectedConcepts => - previousSelectedConcepts.map(concept => { + setSelectedConcept((previousSelectedConcepts) => + previousSelectedConcepts.map((concept) => { if (concept.conceptDataType === null) { } else { if (["Date", "DateTime", "Time"].includes(concept.conceptDataType)) { if (concept.conceptUUID === searchFilterForm.conceptUUID) { return { ...concept, - [fieldName]: event + [fieldName]: event, }; } else { return { - ...concept + ...concept, }; } } else if (concept.conceptDataType === "Coded") { if (concept.conceptUUID === searchFilterForm.conceptUUID) { const selectedCodedValue = {}; - concept.values.forEach(element => { + concept.values.forEach((element) => { selectedCodedValue[element] = true; }); selectedCodedValue[event.target.name] = event.target.checked; @@ -420,12 +421,12 @@ const searchFilterConcept = function( return { ...concept, values: Object.keys(selectedCodedValue).filter( - selectedId => selectedCodedValue[selectedId] - ) + (selectedId) => selectedCodedValue[selectedId], + ), }; } else { return { - ...concept + ...concept, }; } } else if (["Text", "Id"].includes(concept.conceptDataType)) { @@ -433,11 +434,11 @@ const searchFilterConcept = function( const selectedText = event.target.value; return { ...concept, - value: selectedText + value: selectedText, }; } else { return { - ...concept + ...concept, }; } } else if (concept.conceptDataType === "Numeric") { @@ -445,17 +446,17 @@ const searchFilterConcept = function( const selectedNumeric = event.target.value; return { ...concept, - [fieldName]: selectedNumeric + [fieldName]: selectedNumeric, }; } else { return { - ...concept + ...concept, }; } } } return null; - }) + }), ); }; @@ -463,7 +464,7 @@ export const SearchFilterForm = ({ operationalModules, genders, organisationConfigs, - searchRequest + searchRequest, }) => { const location = useLocation(); @@ -492,14 +493,14 @@ export const SearchFilterForm = ({ function SearchFilterFormContainer() { const dispatch = useDispatch(); const operationalModules = useSelector( - state => state.dataEntry.metadata.operationalModules + (state) => state.dataEntry.metadata.operationalModules, ); - const genders = useSelector(state => state.dataEntry.metadata.genders); + const genders = useSelector((state) => state.dataEntry.metadata.genders); const organisationConfigs = useSelector( - state => state.dataEntry.metadata.organisationConfigs + (state) => state.dataEntry.metadata.organisationConfigs, ); const searchRequest = useSelector( - state => state.dataEntry.searchFilterReducer.request + (state) => state.dataEntry.searchFilterReducer.request, ); useEffect(() => { diff --git a/src/dataEntryApp/views/GlobalSearch/SubjectTypeOptions.jsx b/src/dataEntryApp/views/GlobalSearch/SubjectTypeOptions.jsx index 97b5e738b..df7fd5d96 100644 --- a/src/dataEntryApp/views/GlobalSearch/SubjectTypeOptions.jsx +++ b/src/dataEntryApp/views/GlobalSearch/SubjectTypeOptions.jsx @@ -5,31 +5,31 @@ import SubjectTypeIcon from "../../components/SubjectTypeIcon"; import { sortBy } from "lodash"; const StyledGridContainer = styled(Grid)({ - alignItems: "center" + alignItems: "center", }); const StyledGridItem = styled(Grid)({ - alignItems: "center" + alignItems: "center", }); const StyledButton = styled(Button, { - shouldForwardProp: prop => prop !== "isSelected" + shouldForwardProp: (prop) => prop !== "isSelected", })(({ theme, isSelected }) => ({ margin: theme.spacing(1), color: theme.palette.getContrastText( - isSelected ? "rgba(0,108,235,0.85)" : "rgb(252,252,252)" + isSelected ? "rgba(0,108,235,0.85)" : "rgb(252,252,252)", ), background: isSelected ? "rgba(0,108,235,0.85)" : "rgb(252,252,252)", "&:hover": { - backgroundColor: "rgb(0,108,235)" - } + backgroundColor: "rgb(0,108,235)", + }, })); const SubjectTypeOptions = ({ t, operationalModules, onSubjectTypeChange, - selectedSubjectTypeUUID + selectedSubjectTypeUUID, }) => { return ( @@ -47,11 +47,11 @@ const SubjectTypeOptions = ({ - {subjectType.name} + {t(subjectType.name)} - ) + ), ) : ""} diff --git a/src/dataEntryApp/views/registration/FormWizardButton.jsx b/src/dataEntryApp/views/registration/FormWizardButton.jsx index 12355be5a..51ccf84f9 100644 --- a/src/dataEntryApp/views/registration/FormWizardButton.jsx +++ b/src/dataEntryApp/views/registration/FormWizardButton.jsx @@ -1,4 +1,5 @@ import { Button } from "@mui/material"; +import { useTranslation } from "react-i18next"; const FormWizardButton = ({ text, @@ -7,8 +8,9 @@ const FormWizardButton = ({ params, onClick, disabled, - id + id, }) => { + const { t } = useTranslation(); return ( ); }; diff --git a/src/dataEntryApp/views/subjectDashBoard/components/AddRelative.jsx b/src/dataEntryApp/views/subjectDashBoard/components/AddRelative.jsx index 7574222f3..5f66cac70 100644 --- a/src/dataEntryApp/views/subjectDashBoard/components/AddRelative.jsx +++ b/src/dataEntryApp/views/subjectDashBoard/components/AddRelative.jsx @@ -13,12 +13,12 @@ import { TableCell, TableHead, TableRow, - Typography + Typography, } from "@mui/material"; import Breadcrumbs from "dataEntryApp/components/Breadcrumbs"; import { getRelationshipTypes, - saveRelationShip + saveRelationShip, } from "../../../reducers/relationshipReducer"; import { getSubjectProfile } from "../../../reducers/subjectDashboardReducer"; import { useNavigate, useParams, useLocation } from "react-router-dom"; @@ -31,44 +31,44 @@ import { find, get, head, includes, isEmpty } from "lodash"; import CustomizedBackdrop from "../../../components/CustomizedBackdrop"; import { getGenders, - getOrganisationConfig + getOrganisationConfig, } from "../../../reducers/metadataReducer"; import { findApplicableRelations, getRelationshipType, - validateRelative + validateRelative, } from "../../../utils/RelationshipUtil"; const StyledPaper = styled(Paper)(({ theme }) => ({ margin: theme.spacing(1, 3), flexGrow: 1, boxShadow: - "0px 0px 3px 0px rgba(0,0,0,0.4), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 2px 1px -1px rgba(0,0,0,0.12)" + "0px 0px 3px 0px rgba(0,0,0,0.4), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 2px 1px -1px rgba(0,0,0,0.12)", })); const StyledInnerDiv = styled("div")(({ theme }) => ({ padding: theme.spacing(2, 2), margin: theme.spacing(1, 1), - height: 500 + height: 500, })); const StyledMainHeading = styled(Typography)({ fontSize: "20px", fontWeight: "500", marginLeft: 10, - marginBottom: 10 + marginBottom: 10, }); const StyledSubHeading = styled(Typography)(({ theme }) => ({ fontWeight: "bold", fontSize: "12px", padding: theme.spacing(0.6, 0.6), - margin: theme.spacing(1, 1) + margin: theme.spacing(1, 1), })); const StyledScheduledDateDiv = styled("div")({ marginBottom: 20, - marginTop: 10 + marginTop: 10, }); const StyledCancelButton = styled(Button)({ @@ -79,7 +79,7 @@ const StyledCancelButton = styled(Button)({ padding: "4px 25px", fontSize: 12, borderRadius: 50, - borderColor: "orange" + borderColor: "orange", }); const StyledAddButton = styled(Button)({ @@ -90,7 +90,7 @@ const StyledAddButton = styled(Button)({ padding: "4px 25px", fontSize: 12, borderRadius: 50, - marginLeft: 20 + marginLeft: 20, }); const StyledButtonBox = styled(Box)({ @@ -101,17 +101,17 @@ const StyledButtonBox = styled(Box)({ display: "flex", flexDirection: "row", flexWrap: "wrap", - justifyContent: "flex-start" + justifyContent: "flex-start", }); const StyledTable = styled(Table)({ - marginTop: "10px" + marginTop: "10px", }); const StyledTableView = styled("div")({ flexGrow: 1, alignItems: "center", - justifyContent: "center" + justifyContent: "center", }); const StyledTableCell = styled(TableCell)({ @@ -119,7 +119,7 @@ const StyledTableCell = styled(TableCell)({ fontSize: "12px", borderBottom: "none", padding: "0px 0px 0px 11px", - fontWeight: "500" + fontWeight: "500", }); const StyledTableCellDetails = styled(TableCell)({ @@ -127,17 +127,17 @@ const StyledTableCellDetails = styled(TableCell)({ padding: "0px 21px 0px 11px", fontWeight: "500", color: "#1010101", - fontSize: "14px" + fontSize: "14px", }); const StyledLabelTypography = styled(Typography)({ width: "50%", - color: "rgba(0, 0, 0, 0.54)" + color: "rgba(0, 0, 0, 0.54)", }); const StyledErrorTypography = styled(Typography)(({ theme }) => ({ color: theme.palette.error.main, - marginTop: theme.spacing(1.25) + marginTop: theme.spacing(1.25), })); const AddRelative = () => { @@ -153,33 +153,33 @@ const AddRelative = () => { // Redux selectors const subjectTypes = useSelector( - state => state.dataEntry.metadata.operationalModules.subjectTypes + (state) => state.dataEntry.metadata.operationalModules.subjectTypes, ); const relationshipTypes = useSelector( - state => state.dataEntry.relations.relationshipTypes + (state) => state.dataEntry.relations.relationshipTypes, ); const RelationsData = useSelector( - state => state.dataEntry.relations.relationData + (state) => state.dataEntry.relations.relationData, ); - const subjects = useSelector(state => state.dataEntry.search.subjects); + const subjects = useSelector((state) => state.dataEntry.search.subjects); const subjectProfile = useSelector( - state => state.dataEntry.subjectProfile.subjectProfile + (state) => state.dataEntry.subjectProfile.subjectProfile, ); const searchRequest = useSelector( - state => state.dataEntry.searchFilterReducer.request + (state) => state.dataEntry.searchFilterReducer.request, ); const operationalModules = useSelector( - state => state.dataEntry.metadata.operationalModules + (state) => state.dataEntry.metadata.operationalModules, ); - const genders = useSelector(state => state.dataEntry.metadata.genders); + const genders = useSelector((state) => state.dataEntry.metadata.genders); const organisationConfigs = useSelector( - state => state.dataEntry.metadata.organisationConfigs + (state) => state.dataEntry.metadata.organisationConfigs, ); // Create match object for compatibility const match = { queryParams: { uuid }, - path: location.pathname + path: location.pathname, }; useEffect(() => { @@ -192,48 +192,48 @@ const AddRelative = () => { }, [dispatch, uuid]); const selectedRelative = head( - JSON.parse(sessionStorage.getItem("selectedRelativeslist")) + JSON.parse(sessionStorage.getItem("selectedRelativeslist")), ); const [error, setError] = useState(); const [state, setState] = useState({ age: "", - name: "" + name: "", }); const [relationData, setRelationData] = useState({ uuid: General.randomUUID(), relationshipTypeUUID: "", individualAUUID: "", individualBUUID: "", - enterDateTime: new Date() + enterDateTime: new Date(), }); const existingRelatives = get(subjectProfile, "relationships", []); const applicableRelations = findApplicableRelations( relationshipTypes, - selectedRelative + selectedRelative, ); - const handleChange = event => { + const handleChange = (event) => { const selectedRelationUUID = event.target.value; const relationshipType = getRelationshipType( subjectProfile, selectedRelationUUID, - relationshipTypes + relationshipTypes, ); const name = event.target.name; setState({ ...state, - [name]: selectedRelationUUID + [name]: selectedRelationUUID, }); const selectedRelation = find( applicableRelations, - ar => ar.uuid === selectedRelationUUID + (ar) => ar.uuid === selectedRelationUUID, ); const validationError = validateRelative( selectedRelative, subjectProfile, selectedRelation, - existingRelatives + existingRelatives, ); if (validationError) { setError(validationError); @@ -244,13 +244,13 @@ const AddRelative = () => { } const isReverseRelation = includes( get(relationshipType, "individualAIsToBRelation.uuid", []), - selectedRelationUUID + selectedRelationUUID, ); setRelationData({ ...relationData, relationshipTypeUUID: relationshipType.uuid, individualAUUID: isReverseRelation ? selectedRelative.uuid : uuid, - individualBUUID: isReverseRelation ? uuid : selectedRelative.uuid + individualBUUID: isReverseRelation ? uuid : selectedRelative.uuid, }); }; @@ -278,7 +278,7 @@ const AddRelative = () => { direction="row" sx={{ justifyContent: "space-between", - alignItems: "baseline" + alignItems: "baseline", }} > @@ -304,7 +304,7 @@ const AddRelative = () => {
- Give relationship + {t("Give relationship")} @@ -313,7 +313,7 @@ const AddRelative = () => { container spacing={1} sx={{ - alignItems: "center" + alignItems: "center", }} > @@ -352,7 +352,7 @@ const AddRelative = () => { {selectedRelative.dateOfBirth ? new Date().getFullYear() - new Date( - selectedRelative.dateOfBirth + selectedRelative.dateOfBirth, ).getFullYear() + " " + t("years") @@ -369,7 +369,7 @@ const AddRelative = () => {
- Relationship + {t("Relationship")}
@@ -379,11 +379,11 @@ const AddRelative = () => { onChange={handleChange} inputProps={{ name: "age", - id: "age-native-simple" + id: "age-native-simple", }} > {applicableRelations.map((relation, index) => (