carelynx-infection-form
v1.0.3
Published
Form to capture the Infection details of a Resident/Client.
Downloads
1
Readme
carelynx-infection-form
Form to capture the Infection details of a Resident/Client.
Install
npm install --save carelynx-infection-form
Usage
import React, { Component } from 'react';
import InfectionForm from 'carelynx-infection-form';
const App = () => {
return <InfectionForm />;
};
Props
Special props:
| prop | type | description | required|
| ------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |--- |
| infection
| object
| Infection data object. |true
|
| questions
| object
| An object containing the questions which will be displayed as labels for the form elements. |true
|
| infectionTypes
| array
| Array of objects with properties label
and value
. This will be used to populate the dropdown used for the Infection Types form element. |true
|true
|
| onInfectionTypeChange
| func
| Callback when there is a new value is selected for Infection Type. |true
|
| onFormInputChanges
| func
| Callback for rest of the form element changes. |true
|
| handleCancelForm
| func
| Callback when the Cancel button in the form is clicked. |true
|
| handleFormSubmit
| func
| Callback when the Save buttin in the form is clicked. |true
|
| isSubmitting
| boolean
| Value used to show/hide spinner. This value should be set to true
when your app hit's the endpoint to POST/PUT
the data. |true
|
| customStyling
| object
| To change the default appearance of the react-select component. This is used for the Infection Type
form field. |optional
|
| formErrors
| object
| An object which is used to hide/show the form errors. The properties are boolean
and they need to be set to true/false
as per the validation rules set in your app. |optional
|
| attachmentComponent
| HTML element
| Your attachment component. This prop will be deprecated in the future updates as the Infection Form will have it's own Attachment Component. |optional
|
Prop examples
infection
{
attachments: [],
infection_date: null,
infection_type: {
label: '',
value: ''
},
infection_treatment: {
antibiotics: false,
antifungal: false,
antiviral: false,
hospitalisation: false,
untreated: false,
unsure: false
},
other_report_details: '',
pathology_taken: null,
reportable: null,
reportable_to: '',
services_interrupted: null
}
questions
{
question_1: `What type of infection has the client been diagnosed with?`,
question_2: 'Please specify initial date of infection',
question_3: 'Has pathology been conducted to confirm the infection?',
question_4: `Is the Client being treated for the infection?`,
question_5: 'Is the infection reportable?',
question_6: 'Have services been interrupted as a result of the incident?',
question_7: 'Is there anything else about this infection you would like to report?',
question_8: 'Please add relevant attachments e.g. pathology'
}
infectionTypes
[
{
label: 'Cellulitis',
value: 'Cellulitis'
},
{
label: 'Chest',
value: 'Chest'
},
{
label: 'Conjunctivitis',
value: 'Conjunctivitis'
},
{
label: 'COVID-19',
value: 'COVID-19'
},
{
label: 'Ear',
value: 'Ear'
},
{
label: 'Eye',
value: 'Eye'
},
{
label: 'Fungal',
value: 'Fungal'
},
{
label: 'Gastroenteritis',
value: 'Gastro'
},
{
label: 'Influenza A or B',
value: 'Influenza A or B'
},
{
label: 'MRSA',
value: 'MRSA'
},
{
label: 'Parasite',
value: 'Parasite'
},
{
label: 'Pink Eye',
value: 'Pink Eye'
},
{
label: 'Rash',
value: 'Rash'
},
{
label: 'Scabies',
value: 'Scabies'
},
{
label: 'Skin - Bacterial',
value: 'Skin - Bacterial'
},
{
label: 'Throat',
value: 'Throat URTI'
},
{
label: 'Thrush - Oral',
value: 'Thrush - Oral'
},
{
label: 'Thrush - Vaginal',
value: 'Thrush - Vaginal'
},
{
label: 'URTI',
value: 'URTI'
},
{
label: 'UTI',
value: 'Urinary Tract'
},
{
label: 'UTI IDC',
value: 'UTI with IDC'
},
{
label: 'VRE',
value: 'VRE'
},
{
label: 'Wound',
value: 'Wound'
},
{
label: 'Other',
value: 'Other'
}
]
formErrors
{
infection_date: false,
infection_type: false,
infection_treatment: false,
pathology_taken: false,
reportable: false,
reportable_to: false,
services_interrupted: false
}
customStyling
{
selectInput: {
colors: {
primary: `${primary color}`,
primary75: '#4ec758',
primary50: '#88da8f',
primary25: '#afe6b3',
danger: `${error color}`,
dangerLight: '#efa2a9',
text: `${text color}`
}
}
}
License
MIT © Carelynx Developers