@tellescope/react-components 1.237.4 → 1.237.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Forms/hooks.d.ts +2 -0
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +12 -12
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +73 -73
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +11 -11
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +47 -47
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/cjs/Forms/localization.d.ts +2 -1
- package/lib/cjs/Forms/localization.d.ts.map +1 -1
- package/lib/cjs/Forms/localization.js +198 -61
- package/lib/cjs/Forms/localization.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +2 -0
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +12 -12
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +73 -73
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +11 -11
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +47 -47
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/Forms/localization.d.ts +2 -1
- package/lib/esm/Forms/localization.d.ts.map +1 -1
- package/lib/esm/Forms/localization.js +196 -60
- package/lib/esm/Forms/localization.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/inputs.tsx +116 -116
- package/src/Forms/inputs.v2.tsx +78 -79
- package/src/Forms/localization.ts +232 -30
package/src/Forms/inputs.v2.tsx
CHANGED
|
@@ -193,7 +193,7 @@ const getListStyle = (isDraggingOver: boolean) => ({
|
|
|
193
193
|
// padding: `${grid}px`,
|
|
194
194
|
// width: '250px'
|
|
195
195
|
});
|
|
196
|
-
export const RankingInput = ({ field, value, onChange }: FormInputProps<'ranking'>) => {
|
|
196
|
+
export const RankingInput = ({ field, value, onChange, form }: FormInputProps<'ranking'>) => {
|
|
197
197
|
return (
|
|
198
198
|
<Grid container direction='column'>
|
|
199
199
|
{/* <Typography>Most</Typography> */}
|
|
@@ -242,7 +242,7 @@ export const RankingInput = ({ field, value, onChange }: FormInputProps<'ranking
|
|
|
242
242
|
</DragDropContext>
|
|
243
243
|
|
|
244
244
|
<Typography color="primary" style={{ marginTop: 3 }}>
|
|
245
|
-
Drag and drop to re-order the above options
|
|
245
|
+
{form_display_text_for_language(form, "Drag and drop to re-order the above options")}
|
|
246
246
|
</Typography>
|
|
247
247
|
|
|
248
248
|
{/* <Typography>Least</Typography> */}
|
|
@@ -280,7 +280,7 @@ export const DateInput = ({
|
|
|
280
280
|
)
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
export const TableInput = ({ field, value=[], onChange, ...props }: FormInputProps<'Input Table'>) => {
|
|
283
|
+
export const TableInput = ({ field, value=[], onChange, form, ...props }: FormInputProps<'Input Table'>) => {
|
|
284
284
|
const choices = field.options?.tableChoices
|
|
285
285
|
|
|
286
286
|
const handleNewRow = useCallback(() => {
|
|
@@ -324,7 +324,7 @@ export const TableInput = ({ field, value=[], onChange, ...props }: FormInputPro
|
|
|
324
324
|
}, [field.isOptional, value, handleNewRow])
|
|
325
325
|
|
|
326
326
|
if (!choices?.length) {
|
|
327
|
-
return <Typography color="error">No input choices available</Typography>
|
|
327
|
+
return <Typography color="error">{form_display_text_for_language(form, "No input choices available")}</Typography>
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
const length = choices.length || 1
|
|
@@ -393,7 +393,7 @@ export const TableInput = ({ field, value=[], onChange, ...props }: FormInputPro
|
|
|
393
393
|
))}
|
|
394
394
|
|
|
395
395
|
<Grid item sx={{ ml: 'auto', width: iconWidth }}>
|
|
396
|
-
<LabeledIconButton Icon={CancelIcon} label="Remove" onClick={() => handleRemove(i)}
|
|
396
|
+
<LabeledIconButton Icon={CancelIcon} label={form_display_text_for_language(form, "Remove")} onClick={() => handleRemove(i)}
|
|
397
397
|
disabled={!field.isOptional && value.length === 1}
|
|
398
398
|
/>
|
|
399
399
|
</Grid>
|
|
@@ -404,7 +404,7 @@ export const TableInput = ({ field, value=[], onChange, ...props }: FormInputPro
|
|
|
404
404
|
))}
|
|
405
405
|
|
|
406
406
|
<Button variant="outlined" size="small" onClick={handleNewRow} sx={{ width: 200 }}>
|
|
407
|
-
Add new entry
|
|
407
|
+
{form_display_text_for_language(form, "Add new entry")}
|
|
408
408
|
</Button>
|
|
409
409
|
</Grid>
|
|
410
410
|
)
|
|
@@ -419,7 +419,7 @@ const CustomDateStringInput = forwardRef((props: TextFieldProps, ref) => (
|
|
|
419
419
|
fullWidth inputRef={ref} {...props}
|
|
420
420
|
/>
|
|
421
421
|
))
|
|
422
|
-
export const DateStringInput = ({ field, value, onChange, ...props }: FormInputProps<'string'>) => {
|
|
422
|
+
export const DateStringInput = ({ field, value, onChange, form, ...props }: FormInputProps<'string'>) => {
|
|
423
423
|
const inputRef = useRef(null);
|
|
424
424
|
|
|
425
425
|
// if (value && isDateString(value)) {
|
|
@@ -453,7 +453,7 @@ export const DateStringInput = ({ field, value, onChange, ...props }: FormInputP
|
|
|
453
453
|
/>
|
|
454
454
|
)
|
|
455
455
|
: (
|
|
456
|
-
<AutoFocusTextField {...props} required={!field.isOptional} fullWidth placeholder="MM-DD-YYYY" value={value}
|
|
456
|
+
<AutoFocusTextField {...props} required={!field.isOptional} fullWidth placeholder={form_display_text_for_language(form, "MM-DD-YYYY")} value={value}
|
|
457
457
|
label={(!field.title && field.placeholder) ? field.placeholder : props.label}
|
|
458
458
|
onChange={e => {
|
|
459
459
|
const v = e.target.value || ''
|
|
@@ -741,10 +741,10 @@ export const AddressInput = ({ field, form, value, onChange, ...props }: FormInp
|
|
|
741
741
|
|
|
742
742
|
{field.fullZIP &&
|
|
743
743
|
<Grid item xs={3}>
|
|
744
|
-
<TextField {...props} size="small" label="ZIP+4" required={!field.isOptional && field.fullZIP}
|
|
744
|
+
<TextField {...props} size="small" label={form_display_text_for_language(form, "ZIP+4")} required={!field.isOptional && field.fullZIP}
|
|
745
745
|
InputProps={defaultInputProps}
|
|
746
|
-
value={value?.zipPlusFour ?? ''}
|
|
747
|
-
placeholder="ZIP + 4"
|
|
746
|
+
value={value?.zipPlusFour ?? ''}
|
|
747
|
+
placeholder={form_display_text_for_language(form, "ZIP + 4")}
|
|
748
748
|
onChange={e =>
|
|
749
749
|
onChange({
|
|
750
750
|
...value as any,
|
|
@@ -800,7 +800,7 @@ export const ESignatureTerms = () => {
|
|
|
800
800
|
)
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
-
export const SignatureInput = ({ value, field, autoFocus=true, enduser, onChange }: FormInputProps<'signature'>) => {
|
|
803
|
+
export const SignatureInput = ({ value, field, autoFocus=true, enduser, onChange, form }: FormInputProps<'signature'>) => {
|
|
804
804
|
const prefill = (
|
|
805
805
|
field.options?.prefillSignature && enduser?.fname && enduser.lname
|
|
806
806
|
? `${enduser.fname} ${enduser.lname}`
|
|
@@ -834,8 +834,8 @@ export const SignatureInput = ({ value, field, autoFocus=true, enduser, onChange
|
|
|
834
834
|
}
|
|
835
835
|
{!field.options?.pdfAttachment && field.options?.signatureUrl &&
|
|
836
836
|
<Grid container direction="column" sx={{ mb: 2 }}>
|
|
837
|
-
<iframe src={field.options.signatureUrl}
|
|
838
|
-
style={{
|
|
837
|
+
<iframe src={field.options.signatureUrl}
|
|
838
|
+
style={{
|
|
839
839
|
border: 'none',
|
|
840
840
|
height: 400,
|
|
841
841
|
width: '100%',
|
|
@@ -843,12 +843,12 @@ export const SignatureInput = ({ value, field, autoFocus=true, enduser, onChange
|
|
|
843
843
|
}}
|
|
844
844
|
/>
|
|
845
845
|
<a href={field.options.signatureUrl} target="_blank" rel="noopener noreferrer">
|
|
846
|
-
View document in new tab
|
|
846
|
+
{form_display_text_for_language(form, "View document in new tab")}
|
|
847
847
|
</a>
|
|
848
848
|
</Grid>
|
|
849
849
|
}
|
|
850
850
|
|
|
851
|
-
<Grid item xs={12}>
|
|
851
|
+
<Grid item xs={12}>
|
|
852
852
|
<Checkbox
|
|
853
853
|
style={{ margin: 0, marginTop: 5, padding: 0, paddingRight: 3 }}
|
|
854
854
|
color="primary"
|
|
@@ -856,9 +856,8 @@ export const SignatureInput = ({ value, field, autoFocus=true, enduser, onChange
|
|
|
856
856
|
onClick={() => handleConsentChange()}
|
|
857
857
|
inputProps={{ 'aria-label': 'consent to e-signature checkbox' }}
|
|
858
858
|
/>
|
|
859
|
-
<Typography component="span" style={{ position: 'relative', top: 5, left: 2 }}>
|
|
860
|
-
I consent to
|
|
861
|
-
use <a href={`/e-signature-terms?name=${field.options?.esignatureTermsCompanyName || ''}`} target="_blank" rel="noopener noreferrer"> electronic signatures </a>
|
|
859
|
+
<Typography component="span" style={{ position: 'relative', top: 5, left: 2 }}>
|
|
860
|
+
{form_display_text_for_language(form, "I consent to use")} <a href={`/e-signature-terms?name=${field.options?.esignatureTermsCompanyName || ''}`} target="_blank" rel="noopener noreferrer"> {form_display_text_for_language(form, "electronic signatures")} </a>
|
|
862
861
|
</Typography>
|
|
863
862
|
</Grid>
|
|
864
863
|
|
|
@@ -866,14 +865,14 @@ export const SignatureInput = ({ value, field, autoFocus=true, enduser, onChange
|
|
|
866
865
|
<TextField disabled={!value?.signed} autoFocus={autoFocus}
|
|
867
866
|
style={{ width: '100%'}}
|
|
868
867
|
size="small"
|
|
869
|
-
aria-label="Full Name"
|
|
870
|
-
value={value?.fullName}
|
|
871
|
-
placeholder={prefill || "Full Name"} variant="outlined"
|
|
868
|
+
aria-label={form_display_text_for_language(form, "Full Name")}
|
|
869
|
+
value={value?.fullName}
|
|
870
|
+
placeholder={prefill || form_display_text_for_language(form, "Full Name")} variant="outlined"
|
|
872
871
|
onChange={e => handleNameChange(e.target.value)}
|
|
873
872
|
InputProps={defaultInputProps}
|
|
874
873
|
/>
|
|
875
|
-
<Typography color="primary" style={{ fontSize: 15, marginTop: 2 }}>
|
|
876
|
-
Enter your legal full name to complete the signature
|
|
874
|
+
<Typography color="primary" style={{ fontSize: 15, marginTop: 2 }}>
|
|
875
|
+
{form_display_text_for_language(form, "Enter your legal full name to complete the signature")}
|
|
877
876
|
</Typography>
|
|
878
877
|
</Grid>
|
|
879
878
|
</Grid>
|
|
@@ -910,7 +909,7 @@ export async function convertHEIC (file: FileBlob | string){
|
|
|
910
909
|
};
|
|
911
910
|
|
|
912
911
|
const value_is_image = (f?: { type?: string })=> f?.type?.includes('image')
|
|
913
|
-
export const FileInput = ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles }: FormInputProps<'file'> & { existingFileName?: string }) => {
|
|
912
|
+
export const FileInput = ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles, form }: FormInputProps<'file'> & { existingFileName?: string }) => {
|
|
914
913
|
const [error, setError] = useState('')
|
|
915
914
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
916
915
|
onDrop: useCallback(
|
|
@@ -988,11 +987,11 @@ export const FileInput = ({ value, onChange, field, existingFileName, uploadingF
|
|
|
988
987
|
? (
|
|
989
988
|
<Grid container direction="column" alignItems="center">
|
|
990
989
|
<Grid item>
|
|
991
|
-
<AddPhotoAlternateIcon color="primary" />
|
|
990
|
+
<AddPhotoAlternateIcon color="primary" />
|
|
992
991
|
</Grid>
|
|
993
992
|
<Grid item>
|
|
994
993
|
<Typography sx={{ fontSize: 14, textAlign: 'center' }}>
|
|
995
|
-
Select file or take picture
|
|
994
|
+
{form_display_text_for_language(form, "Select file or take picture")}
|
|
996
995
|
</Typography>
|
|
997
996
|
</Grid>
|
|
998
997
|
</Grid>
|
|
@@ -1000,7 +999,7 @@ export const FileInput = ({ value, onChange, field, existingFileName, uploadingF
|
|
|
1000
999
|
: <Grid container direction="column" alignItems="center" rowGap={2}>
|
|
1001
1000
|
<UploadFile color="primary" sx={{ fontSize: 25 }} />
|
|
1002
1001
|
<Typography>
|
|
1003
|
-
{isDragActive ? "Drop to select file" : "Click or drag and drop"}
|
|
1002
|
+
{isDragActive ? form_display_text_for_language(form, "Drop to select file") : form_display_text_for_language(form, "Click or drag and drop")}
|
|
1004
1003
|
</Typography>
|
|
1005
1004
|
</Grid>
|
|
1006
1005
|
}
|
|
@@ -1031,7 +1030,7 @@ export const safe_create_url = (file: any) => {
|
|
|
1031
1030
|
}
|
|
1032
1031
|
}
|
|
1033
1032
|
|
|
1034
|
-
export const FilesInput = ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles }: FormInputProps<'files'> & { existingFileName?: string }) => {
|
|
1033
|
+
export const FilesInput = ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles, form }: FormInputProps<'files'> & { existingFileName?: string }) => {
|
|
1035
1034
|
const [error, setError] = useState('')
|
|
1036
1035
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
1037
1036
|
onDrop: useCallback(
|
|
@@ -1090,7 +1089,7 @@ export const FilesInput = ({ value, onChange, field, existingFileName, uploading
|
|
|
1090
1089
|
</Grid>
|
|
1091
1090
|
<Grid item>
|
|
1092
1091
|
<Typography sx={{ fontSize: 14, textAlign: 'center' }}>
|
|
1093
|
-
Select files or take pictures
|
|
1092
|
+
{form_display_text_for_language(form, "Select files or take pictures")}
|
|
1094
1093
|
</Typography>
|
|
1095
1094
|
</Grid>
|
|
1096
1095
|
</Grid>
|
|
@@ -1098,7 +1097,7 @@ export const FilesInput = ({ value, onChange, field, existingFileName, uploading
|
|
|
1098
1097
|
: <Grid container direction="column" alignItems="center" rowGap={2}>
|
|
1099
1098
|
<UploadFile color="primary" sx={{ fontSize: 25 }} />
|
|
1100
1099
|
<Typography>
|
|
1101
|
-
{isDragActive ? "Drop to select files" : "Click or drag and drop"}
|
|
1100
|
+
{isDragActive ? form_display_text_for_language(form, "Drop to select files") : form_display_text_for_language(form, "Click or drag and drop")}
|
|
1102
1101
|
</Typography>
|
|
1103
1102
|
</Grid>
|
|
1104
1103
|
}
|
|
@@ -1136,7 +1135,7 @@ export const FilesInput = ({ value, onChange, field, existingFileName, uploading
|
|
|
1136
1135
|
</Grid>
|
|
1137
1136
|
|
|
1138
1137
|
<Grid item>
|
|
1139
|
-
<LabeledIconButton label="Remove"
|
|
1138
|
+
<LabeledIconButton label={form_display_text_for_language(form, "Remove")}
|
|
1140
1139
|
Icon={Delete}
|
|
1141
1140
|
onClick={() => onChange(value.filter((f, _i) => i !== _i), field.id)}
|
|
1142
1141
|
/>
|
|
@@ -1145,7 +1144,7 @@ export const FilesInput = ({ value, onChange, field, existingFileName, uploading
|
|
|
1145
1144
|
</Grid>
|
|
1146
1145
|
))}
|
|
1147
1146
|
</Grid>
|
|
1148
|
-
|
|
1147
|
+
|
|
1149
1148
|
{error &&
|
|
1150
1149
|
<Grid item alignSelf="center" sx={{ mt: 0.5 }}>
|
|
1151
1150
|
<Typography color="error">{error}</Typography>
|
|
@@ -1545,7 +1544,7 @@ type CanvasMedicationResult = {
|
|
|
1545
1544
|
entry?: { resource: { code: { coding: { system: string, code: string, display: string } []}} }[]
|
|
1546
1545
|
}
|
|
1547
1546
|
|
|
1548
|
-
export const CanvasMedicationsInput = ({ field, value=[], onChange }: FormInputProps<'Medications'>) => {
|
|
1547
|
+
export const CanvasMedicationsInput = ({ field, value=[], onChange, form }: FormInputProps<'Medications'>) => {
|
|
1549
1548
|
const session = useResolvedSession()
|
|
1550
1549
|
const [query, setQuery] = useState('')
|
|
1551
1550
|
const [results, setResults] = useState<MedicationResponse[]>([])
|
|
@@ -1593,7 +1592,7 @@ export const CanvasMedicationsInput = ({ field, value=[], onChange }: FormInputP
|
|
|
1593
1592
|
<Grid container direction="column" spacing={1}>
|
|
1594
1593
|
<Grid item>
|
|
1595
1594
|
<Autocomplete multiple value={value} options={results} style={{ marginTop: 5 }}
|
|
1596
|
-
noOptionsText={query.length ? 'No results found' : 'Type to start search'}
|
|
1595
|
+
noOptionsText={query.length ? form_display_text_for_language(form, 'No results found') : form_display_text_for_language(form, 'Type to start search')}
|
|
1597
1596
|
onChange={(e, v) => {
|
|
1598
1597
|
if (!v) { return }
|
|
1599
1598
|
onChange(v, field.id)
|
|
@@ -1603,7 +1602,7 @@ export const CanvasMedicationsInput = ({ field, value=[], onChange }: FormInputP
|
|
|
1603
1602
|
inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
|
|
1604
1603
|
renderInput={(params) => (
|
|
1605
1604
|
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
|
|
1606
|
-
required={!field.isOptional} size="small" label="" placeholder="Search medications..."
|
|
1605
|
+
required={!field.isOptional} size="small" label="" placeholder={form_display_text_for_language(form, "Search medications...")}
|
|
1607
1606
|
/>
|
|
1608
1607
|
)}
|
|
1609
1608
|
renderTags={(value, getTagProps) =>
|
|
@@ -1629,7 +1628,7 @@ export const CanvasMedicationsInput = ({ field, value=[], onChange }: FormInputP
|
|
|
1629
1628
|
|
|
1630
1629
|
<Grid item>
|
|
1631
1630
|
<TextField InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small"
|
|
1632
|
-
label="Medication instructions: how much you take, how often, and when"
|
|
1631
|
+
label={form_display_text_for_language(form, "Medication instructions: how much you take, how often, and when")}
|
|
1633
1632
|
value={medication.dosage?.description || ''}
|
|
1634
1633
|
onChange={e => (
|
|
1635
1634
|
onChange((value || []).map((v, _i) =>
|
|
@@ -1652,7 +1651,7 @@ export const CanvasMedicationsInput = ({ field, value=[], onChange }: FormInputP
|
|
|
1652
1651
|
)
|
|
1653
1652
|
}
|
|
1654
1653
|
|
|
1655
|
-
export const MedicationsInput = ({ field, value, onChange, ...props }: FormInputProps<'Medications'>) => {
|
|
1654
|
+
export const MedicationsInput = ({ field, value, onChange, form, ...props }: FormInputProps<'Medications'>) => {
|
|
1656
1655
|
const { displayTerms, doneLoading, getCodesForDrug, getDrugsForDisplayTerm } = useMedications({
|
|
1657
1656
|
dontFetch: field.options?.dataSource === CANVAS_TITLE
|
|
1658
1657
|
})
|
|
@@ -1743,10 +1742,10 @@ export const MedicationsInput = ({ field, value, onChange, ...props }: FormInput
|
|
|
1743
1742
|
field.id,
|
|
1744
1743
|
)
|
|
1745
1744
|
}}
|
|
1746
|
-
renderInput={params =>
|
|
1747
|
-
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }} required={!field.isOptional} label="Search" size="small" fullWidth />
|
|
1745
|
+
renderInput={params =>
|
|
1746
|
+
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }} required={!field.isOptional} label={form_display_text_for_language(form, "Search")} size="small" fullWidth />
|
|
1748
1747
|
}
|
|
1749
|
-
/>
|
|
1748
|
+
/>
|
|
1750
1749
|
</Grid>
|
|
1751
1750
|
|
|
1752
1751
|
{v.displayTerm && v.drugName !== "Unknown" && !v.otherDrug &&
|
|
@@ -1769,15 +1768,15 @@ export const MedicationsInput = ({ field, value, onChange, ...props }: FormInput
|
|
|
1769
1768
|
if (!drug) return
|
|
1770
1769
|
|
|
1771
1770
|
const info = (
|
|
1772
|
-
drug.name === 'Unknown'
|
|
1771
|
+
drug.name === 'Unknown'
|
|
1773
1772
|
? await getCodesForDrug(v.displayTerm) // might get us a value, better than searching Unknown or keeping a prior value
|
|
1774
1773
|
: await getCodesForDrug(drug.name)
|
|
1775
1774
|
)
|
|
1776
1775
|
onChange(
|
|
1777
1776
|
(value ?? []).map((_v, _i) => (
|
|
1778
1777
|
i === _i
|
|
1779
|
-
? {
|
|
1780
|
-
..._v,
|
|
1778
|
+
? {
|
|
1779
|
+
..._v,
|
|
1781
1780
|
drugName: drug.name,
|
|
1782
1781
|
drugSynonym: drug.synonym || '',
|
|
1783
1782
|
...info,
|
|
@@ -1787,16 +1786,16 @@ export const MedicationsInput = ({ field, value, onChange, ...props }: FormInput
|
|
|
1787
1786
|
field.id,
|
|
1788
1787
|
)
|
|
1789
1788
|
}}
|
|
1790
|
-
renderInput={params =>
|
|
1791
|
-
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }} required={!field.isOptional} label="Drug Select" size="small" fullWidth />
|
|
1789
|
+
renderInput={params =>
|
|
1790
|
+
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }} required={!field.isOptional} label={form_display_text_for_language(form, "Drug Select")} size="small" fullWidth />
|
|
1792
1791
|
}
|
|
1793
|
-
/>
|
|
1792
|
+
/>
|
|
1794
1793
|
</Grid>
|
|
1795
1794
|
}
|
|
1796
1795
|
|
|
1797
|
-
{v.displayTerm && (v.drugName === "Unknown" || !v.drugName) &&
|
|
1796
|
+
{v.displayTerm && (v.drugName === "Unknown" || !v.drugName) &&
|
|
1798
1797
|
<Grid item sx={{ mt: 1 }}>
|
|
1799
|
-
<TextField label='Other Drug' fullWidth size="small" required
|
|
1798
|
+
<TextField label={form_display_text_for_language(form, 'Other Drug')} fullWidth size="small" required
|
|
1800
1799
|
InputProps={defaultInputProps}
|
|
1801
1800
|
value={value?.find((v, _i) => _i === i)?.otherDrug ?? ''}
|
|
1802
1801
|
onChange={e => (
|
|
@@ -1889,7 +1888,7 @@ export const MedicationsInput = ({ field, value, onChange, ...props }: FormInput
|
|
|
1889
1888
|
|
|
1890
1889
|
{v.displayTerm &&
|
|
1891
1890
|
<Grid item sx={{ mt: 1.25 }}>
|
|
1892
|
-
<TextField label="Reason for taking medication" size="small" fullWidth
|
|
1891
|
+
<TextField label={form_display_text_for_language(form, "Reason for taking medication")} size="small" fullWidth
|
|
1893
1892
|
InputProps={defaultInputProps}
|
|
1894
1893
|
value={v.reasonForTaking ?? ''}
|
|
1895
1894
|
onChange={e =>
|
|
@@ -1913,7 +1912,7 @@ export const MedicationsInput = ({ field, value, onChange, ...props }: FormInput
|
|
|
1913
1912
|
<Typography color="primary" sx={{ textDecoration: 'underline', cursor: 'pointer' }}
|
|
1914
1913
|
onClick={() => onChange((value ?? []).filter((_, _i) => i !== _i), field.id)}
|
|
1915
1914
|
>
|
|
1916
|
-
Remove medication
|
|
1915
|
+
{form_display_text_for_language(form, "Remove medication")}
|
|
1917
1916
|
</Typography>
|
|
1918
1917
|
</Grid>
|
|
1919
1918
|
|
|
@@ -1941,17 +1940,17 @@ export const MedicationsInput = ({ field, value, onChange, ...props }: FormInput
|
|
|
1941
1940
|
))}
|
|
1942
1941
|
|
|
1943
1942
|
<Grid item>
|
|
1944
|
-
<Button color="primary" variant="outlined"
|
|
1943
|
+
<Button color="primary" variant="outlined"
|
|
1945
1944
|
onClick={() => onChange([...(value ?? []), { displayTerm: '', drugName: '' }], field.id)}
|
|
1946
1945
|
>
|
|
1947
|
-
Add Medication
|
|
1946
|
+
{form_display_text_for_language(form, "Add Medication")}
|
|
1948
1947
|
</Button>
|
|
1949
1948
|
</Grid>
|
|
1950
1949
|
</Grid>
|
|
1951
1950
|
)
|
|
1952
1951
|
}
|
|
1953
1952
|
|
|
1954
|
-
export const BelugaPatientPreferenceInput = ({ field, value: _value, onChange }: FormInputProps<'Beluga Patient Preference'>) => {
|
|
1953
|
+
export const BelugaPatientPreferenceInput = ({ field, value: _value, onChange, form }: FormInputProps<'Beluga Patient Preference'>) => {
|
|
1955
1954
|
const value = Array.isArray(_value) ? _value : []
|
|
1956
1955
|
|
|
1957
1956
|
return (
|
|
@@ -2091,7 +2090,7 @@ export const BelugaPatientPreferenceInput = ({ field, value: _value, onChange }:
|
|
|
2091
2090
|
<Typography color="primary" sx={{ textDecoration: 'underline', cursor: 'pointer' }}
|
|
2092
2091
|
onClick={() => onChange(value.filter((_, _i) => i !== _i), field.id)}
|
|
2093
2092
|
>
|
|
2094
|
-
Remove medication
|
|
2093
|
+
{form_display_text_for_language(form, "Remove medication")}
|
|
2095
2094
|
</Typography>
|
|
2096
2095
|
</Grid>
|
|
2097
2096
|
</Grid>
|
|
@@ -2110,7 +2109,7 @@ export const BelugaPatientPreferenceInput = ({ field, value: _value, onChange }:
|
|
|
2110
2109
|
{ name: '', strength: '', quantity: '', refills: '', daysSupply: '', sig: '', dispenseUnit: '', medId: '' }
|
|
2111
2110
|
], field.id)}
|
|
2112
2111
|
>
|
|
2113
|
-
Add Medication
|
|
2112
|
+
{form_display_text_for_language(form, "Add Medication")}
|
|
2114
2113
|
</Button>
|
|
2115
2114
|
</Grid>
|
|
2116
2115
|
</Grid>
|
|
@@ -2137,7 +2136,7 @@ export const contact_is_valid = (e: Partial<Enduser>) => {
|
|
|
2137
2136
|
}
|
|
2138
2137
|
}
|
|
2139
2138
|
|
|
2140
|
-
export const RelatedContactsInput = ({ field, value: _value, onChange, error: parentError, ...props }: FormInputProps<'Related Contacts'>) => {
|
|
2139
|
+
export const RelatedContactsInput = ({ field, value: _value, onChange, error: parentError, form, ...props }: FormInputProps<'Related Contacts'>) => {
|
|
2141
2140
|
// safeguard against any rogue values like empty string
|
|
2142
2141
|
const value = Array.isArray(_value) ? _value : []
|
|
2143
2142
|
|
|
@@ -2163,7 +2162,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2163
2162
|
<Grid container alignItems="center" wrap="nowrap" spacing={1}>
|
|
2164
2163
|
{!field.options?.hiddenDefaultFields?.includes('First Name') &&
|
|
2165
2164
|
<Grid item xs={4}>
|
|
2166
|
-
<TextField label="First Name" size="small" fullWidth
|
|
2165
|
+
<TextField label={form_display_text_for_language(form, "First Name")} size="small" fullWidth
|
|
2167
2166
|
InputProps={defaultInputProps}
|
|
2168
2167
|
value={fname} onChange={e => onChange(value.map((v, i) => i === editing ? { ...v, fname: e.target.value } : v), field.id)}
|
|
2169
2168
|
/>
|
|
@@ -2172,7 +2171,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2172
2171
|
|
|
2173
2172
|
{!field.options?.hiddenDefaultFields?.includes('Last Name') &&
|
|
2174
2173
|
<Grid item xs={4}>
|
|
2175
|
-
<TextField label="Last Name" size="small" fullWidth
|
|
2174
|
+
<TextField label={form_display_text_for_language(form, "Last Name")} size="small" fullWidth
|
|
2176
2175
|
InputProps={defaultInputProps}
|
|
2177
2176
|
value={lname} onChange={e => onChange(value.map((v, i) => i === editing ? { ...v, lname: e.target.value } : v), field.id)}
|
|
2178
2177
|
/>
|
|
@@ -2180,7 +2179,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2180
2179
|
}
|
|
2181
2180
|
|
|
2182
2181
|
<Grid item xs={4}>
|
|
2183
|
-
<StringSelector options={field.options?.relatedContactTypes?.length ? field.options.relatedContactTypes : RELATIONSHIP_TYPES} label="Relationship" size="small"
|
|
2182
|
+
<StringSelector options={field.options?.relatedContactTypes?.length ? field.options.relatedContactTypes : RELATIONSHIP_TYPES} label={form_display_text_for_language(form, "Relationship")} size="small"
|
|
2184
2183
|
disabled={field?.options?.relatedContactTypes?.length === 1}
|
|
2185
2184
|
value={relationships?.[0]?.type ?? ''}
|
|
2186
2185
|
onChange={type => onChange(value.map((v, i) => i === editing ? { ...v, relationships: [{ type: type as EnduserRelationship['type'], id: '' /* to be filled on server-side */ }] } : v), field.id)}
|
|
@@ -2193,7 +2192,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2193
2192
|
<Grid container alignItems="center" wrap="nowrap" spacing={1}>
|
|
2194
2193
|
{!field.options?.hiddenDefaultFields?.includes('Date of Birth') &&
|
|
2195
2194
|
<Grid item xs={4}>
|
|
2196
|
-
<DateStringInput value={dateOfBirth} field={{ ...field, isOptional: true }} size="small" label="Date of Birth (MM-DD-YYYY)"
|
|
2195
|
+
<DateStringInput value={dateOfBirth} field={{ ...field, isOptional: true }} size="small" label={form_display_text_for_language(form, "Date of Birth (MM-DD-YYYY)")}
|
|
2197
2196
|
onChange={dateOfBirth => onChange(value.map((v, i) => i === editing ? { ...v, dateOfBirth } : v), field.id)}
|
|
2198
2197
|
/>
|
|
2199
2198
|
</Grid>
|
|
@@ -2201,7 +2200,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2201
2200
|
|
|
2202
2201
|
{!field.options?.hiddenDefaultFields?.includes('Email') &&
|
|
2203
2202
|
<Grid item xs={4}>
|
|
2204
|
-
<TextField label="Email" size="small" fullWidth type="email"
|
|
2203
|
+
<TextField label={form_display_text_for_language(form, "Email")} size="small" fullWidth type="email"
|
|
2205
2204
|
InputProps={defaultInputProps}
|
|
2206
2205
|
value={email} onChange={e => onChange(value.map((v, i) => i === editing ? { ...v, email: e.target.value } : v), field.id)}
|
|
2207
2206
|
/>
|
|
@@ -2210,7 +2209,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2210
2209
|
|
|
2211
2210
|
{!field.options?.hiddenDefaultFields?.includes('Phone Number') &&
|
|
2212
2211
|
<Grid item xs={4}>
|
|
2213
|
-
<TextField label="Phone Number" size="small" fullWidth
|
|
2212
|
+
<TextField label={form_display_text_for_language(form, "Phone Number")} size="small" fullWidth
|
|
2214
2213
|
InputProps={defaultInputProps}
|
|
2215
2214
|
value={phone} onChange={e => onChange(value.map((v, i) => i === editing ? { ...v, phone: e.target.value.trim() } : v), field.id)}
|
|
2216
2215
|
/>
|
|
@@ -2267,7 +2266,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2267
2266
|
|
|
2268
2267
|
<Grid item sx={{ my: 0.75 }}>
|
|
2269
2268
|
<Button variant="outlined" onClick={() => setEditing(-1)} size="small" disabled={!!errorMessage || !!parentError}>
|
|
2270
|
-
Save Contact
|
|
2269
|
+
{form_display_text_for_language(form, "Save Contact")}
|
|
2271
2270
|
</Button>
|
|
2272
2271
|
</Grid>
|
|
2273
2272
|
|
|
@@ -2294,13 +2293,13 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2294
2293
|
<Edit />
|
|
2295
2294
|
</IconButton>
|
|
2296
2295
|
<Typography noWrap>
|
|
2297
|
-
{user_display_name(contact) ||
|
|
2296
|
+
{user_display_name(contact) || `${form_display_text_for_language(form, "Unnamed Contact")} ${i + 1}`}
|
|
2298
2297
|
</Typography>
|
|
2299
2298
|
</Grid>
|
|
2300
2299
|
</Grid>
|
|
2301
2300
|
|
|
2302
2301
|
<Grid item>
|
|
2303
|
-
<LabeledIconButton Icon={Delete} label="Remove" onClick={() => onChange(value.filter((v, _i) => i !== _i), field.id)} />
|
|
2302
|
+
<LabeledIconButton Icon={Delete} label={form_display_text_for_language(form, "Remove")} onClick={() => onChange(value.filter((v, _i) => i !== _i), field.id)} />
|
|
2304
2303
|
</Grid>
|
|
2305
2304
|
</Grid>
|
|
2306
2305
|
</Grid>
|
|
@@ -2309,7 +2308,7 @@ export const RelatedContactsInput = ({ field, value: _value, onChange, error: pa
|
|
|
2309
2308
|
|
|
2310
2309
|
<Grid item>
|
|
2311
2310
|
<Button variant="contained" onClick={handleAddContact}>
|
|
2312
|
-
Add Contact
|
|
2311
|
+
{form_display_text_for_language(form, "Add Contact")}
|
|
2313
2312
|
</Button>
|
|
2314
2313
|
</Grid>
|
|
2315
2314
|
</Grid>
|
|
@@ -2321,16 +2320,16 @@ export const AppointmentBookingInput = (props: FormInputProps<'Appointment Booki
|
|
|
2321
2320
|
return <SharedAppointmentBookingInput {...props} />
|
|
2322
2321
|
}
|
|
2323
2322
|
|
|
2324
|
-
export const HeightInput = ({ field, value={} as any, onChange, ...props }: FormInputProps<'Height'>) => (
|
|
2323
|
+
export const HeightInput = ({ field, value={} as any, onChange, form, ...props }: FormInputProps<'Height'>) => (
|
|
2325
2324
|
<Grid container alignItems='center' wrap="nowrap" spacing={1} style={{ marginTop: 5 }}>
|
|
2326
2325
|
<Grid item sx={{ width: '100%' }}>
|
|
2327
|
-
<TextField fullWidth size="small" label="Feet" type="number"
|
|
2328
|
-
value={value?.feet || ''}
|
|
2326
|
+
<TextField fullWidth size="small" label={form_display_text_for_language(form, "Feet")} type="number"
|
|
2327
|
+
value={value?.feet || ''}
|
|
2329
2328
|
onChange={e => onChange({ ...value, feet: parseInt(e.target.value) }, field.id)}
|
|
2330
2329
|
/>
|
|
2331
2330
|
</Grid>
|
|
2332
2331
|
<Grid item sx={{ width: '100%' }}>
|
|
2333
|
-
<TextField fullWidth size="small" label="Inches" type="number"
|
|
2332
|
+
<TextField fullWidth size="small" label={form_display_text_for_language(form, "Inches")} type="number"
|
|
2334
2333
|
value={value?.inches ?? ''}
|
|
2335
2334
|
onChange={e => onChange({ ...value, inches: parseInt(e.target.value) }, field.id)}
|
|
2336
2335
|
/>
|
|
@@ -2426,7 +2425,7 @@ export const EmotiiInput = ({ goToNextField, goToPreviousField, field, value, on
|
|
|
2426
2425
|
<CheckCircleOutline color="success" />
|
|
2427
2426
|
|
|
2428
2427
|
<Typography sx={{ ml: 1, fontSize: 20 }}>
|
|
2429
|
-
Please click Next or Submit to continue.
|
|
2428
|
+
{form_display_text_for_language(form, "Please click Next or Submit to continue.")}
|
|
2430
2429
|
</Typography>
|
|
2431
2430
|
</Grid>
|
|
2432
2431
|
)
|
|
@@ -2506,7 +2505,7 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2506
2505
|
<Grid container direction="column" spacing={1}>
|
|
2507
2506
|
<Grid item>
|
|
2508
2507
|
<Autocomplete multiple value={value || []} options={results} style={{ marginTop: 5 }}
|
|
2509
|
-
noOptionsText={query.length ? 'No results found' : 'Type to start search'}
|
|
2508
|
+
noOptionsText={query.length ? form_display_text_for_language(form, 'No results found') : form_display_text_for_language(form, 'Type to start search')}
|
|
2510
2509
|
onChange={(e, v) => {
|
|
2511
2510
|
if (!v) { return }
|
|
2512
2511
|
onChange(v, field.id)
|
|
@@ -2516,7 +2515,7 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2516
2515
|
inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
|
|
2517
2516
|
renderInput={(params) => (
|
|
2518
2517
|
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
|
|
2519
|
-
required={!field.isOptional} size="small" label="" placeholder="Search allergies..."
|
|
2518
|
+
required={!field.isOptional} size="small" label="" placeholder={form_display_text_for_language(form, "Search allergies...")}
|
|
2520
2519
|
/>
|
|
2521
2520
|
)}
|
|
2522
2521
|
renderTags={(value, getTagProps) =>
|
|
@@ -2541,7 +2540,7 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2541
2540
|
</Grid>
|
|
2542
2541
|
|
|
2543
2542
|
<Grid item sx={{ width: 140 }}>
|
|
2544
|
-
<StringSelector options={['mild', 'moderate', 'severe']} size="small" label="Severity"
|
|
2543
|
+
<StringSelector options={['mild', 'moderate', 'severe']} size="small" label={form_display_text_for_language(form, "Severity")}
|
|
2545
2544
|
value={allergy.severity || ''}
|
|
2546
2545
|
onChange={severity => onChange((value || []).map((v, _i) => i === _i ? { ...v, severity } : v), field.id)}
|
|
2547
2546
|
getDisplayValue={first_letter_capitalized}
|
|
@@ -2549,8 +2548,8 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2549
2548
|
</Grid>
|
|
2550
2549
|
|
|
2551
2550
|
<Grid item sx={{ width: "50%" }}>
|
|
2552
|
-
<TextField InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small" label="Note"
|
|
2553
|
-
value={allergy.note || ''}
|
|
2551
|
+
<TextField InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small" label={form_display_text_for_language(form, "Note")}
|
|
2552
|
+
value={allergy.note || ''}
|
|
2554
2553
|
onChange={e => onChange((value || []).map((v, _i) => i === _i ? { ...v, note: e.target.value } : v), field.id)}
|
|
2555
2554
|
/>
|
|
2556
2555
|
</Grid>
|
|
@@ -2592,7 +2591,7 @@ export const ConditionsInput = ({ goToNextField, goToPreviousField, field, value
|
|
|
2592
2591
|
|
|
2593
2592
|
return (
|
|
2594
2593
|
<Autocomplete multiple value={value || []} options={results} style={{ marginTop: 5 }}
|
|
2595
|
-
noOptionsText={query.length ? 'No results found' : 'Type to start search'}
|
|
2594
|
+
noOptionsText={query.length ? form_display_text_for_language(form, 'No results found') : form_display_text_for_language(form, 'Type to start search')}
|
|
2596
2595
|
onChange={(e, v) => {
|
|
2597
2596
|
if (!v) { return }
|
|
2598
2597
|
onChange(v, field.id)
|
|
@@ -2602,7 +2601,7 @@ export const ConditionsInput = ({ goToNextField, goToPreviousField, field, value
|
|
|
2602
2601
|
inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
|
|
2603
2602
|
renderInput={(params) => (
|
|
2604
2603
|
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
|
|
2605
|
-
required={!field.isOptional} size="small" label="" placeholder="Search conditions..."
|
|
2604
|
+
required={!field.isOptional} size="small" label="" placeholder={form_display_text_for_language(form, "Search conditions...")}
|
|
2606
2605
|
/>
|
|
2607
2606
|
)}
|
|
2608
2607
|
renderTags={(value, getTagProps) =>
|