Skip to content

Commit

Permalink
Separate the concepts from custom uuids
Browse files Browse the repository at this point in the history
  • Loading branch information
ODORA0 committed Feb 9, 2024
1 parent 5bbeb71 commit 877c20e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
defaultValues: {},
resolver: zodResolver(visitAttributesFormSchema),
});
const patientCatergory = useConfig();
const { patientCatergory, catergoryConcepts } = useConfig();
const [paymentDetails, paymentMethods, insuranceSchema, policyNumber, patientCategory] = watch([
'paymentDetails',
'paymentMethods',
Expand All @@ -57,7 +57,7 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
patientCatergory.paymentDetails,
patientCatergory.paymentMethods,
patientCatergory.policyNumber,
patientCatergory.insuranceSchema,
patientCatergory.insuranceScheme,
patientCatergory.patientCategory,
patientCatergory.formPayloadPending,
true,
Expand Down Expand Up @@ -93,13 +93,13 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
orientation="vertical"
legendText={t('paymentDetails', 'Payment Details')}
name="payment-details-group">
<RadioButton labelText="Paying" value={patientCatergory.payingDetails} id="radio-1" />
<RadioButton labelText="Non paying" value={patientCatergory.nonPayingDetails} id="radio-2" />
<RadioButton labelText="Paying" value={catergoryConcepts.payingDetails} id="radio-1" />
<RadioButton labelText="Non paying" value={catergoryConcepts.nonPayingDetails} id="radio-2" />
</RadioButtonGroup>
)}
/>

{paymentDetails === patientCatergory.payingDetails && (
{paymentDetails === catergoryConcepts.payingDetails && (
<Controller
control={control}
name="paymentMethods"
Expand All @@ -117,7 +117,7 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
/>
)}

{paymentMethods === patientCatergory.insuranceDetails && paymentDetails === patientCatergory.payingDetails && (
{paymentMethods === catergoryConcepts.insuranceDetails && paymentDetails === catergoryConcepts.payingDetails && (
<>
<Controller
control={control}
Expand Down Expand Up @@ -149,7 +149,7 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
</>
)}

{paymentDetails === patientCatergory.nonPayingDetails && (
{paymentDetails === catergoryConcepts.nonPayingDetails && (
<Controller
control={control}
name="patientCategory"
Expand All @@ -159,8 +159,8 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
onChange={({ selectedItem }) => field.onChange(selectedItem?.uuid)}
id="patientCategory"
items={[
{ text: 'Child under 5', uuid: patientCatergory.childUnder5 },
{ text: 'Student', uuid: patientCatergory.student },
{ text: 'Child under 5', uuid: catergoryConcepts.childUnder5 },
{ text: 'Student', uuid: catergoryConcepts.student },
]}
itemToString={(item) => (item ? item.text : '')}
titleText={t('patientCategory', 'Patient category')}
Expand Down
12 changes: 10 additions & 2 deletions src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ export interface BillingConfig {}
export const configSchema = {
patientCatergory: {
_type: Type.Object,
_description: 'Encounter type UUIDs for TB.',
_description: 'Patient Category Custom UUIDs',
_default: {
paymentDetails: 'caf2124f-00a9-4620-a250-efd8535afd6d',
paymentMethods: 'c39b684c-250f-4781-a157-d6ad7353bc90',
policyNumber: '0f4f3306-f01b-43c6-af5b-fdb60015cb02',
insuranceSchema: '2d0fa959-6780-41f1-85b1-402045935068',
insuranceScheme: '2d0fa959-6780-41f1-85b1-402045935068',
patientCategory: '3b9dfac8-9e4d-11ee-8c90-0242ac120002',
formPayloadPending: '919b51c9-8e2e-468f-8354-181bf3e55786',
},
},

catergoryConcepts: {
_type: Type.Object,
_description: 'Patient Category Concept UUIDs',
_default: {
payingDetails: '1c30ee58-82d4-4ea4-a8c1-4bf2f9dfc8cf',
nonPayingDetails: 'a28d7929-050a-4249-a61a-551e9b8cc102',
insuranceDetails: 'beac329b-f1dc-4a33-9e7c-d95821a137a6',
Expand All @@ -31,4 +38,5 @@ export const configSchema = {
export interface ConfigObject {
patientCatergory: Object;
defaultCurrency: string;
catergoryConcepts: Object;
}

0 comments on commit 877c20e

Please sign in to comment.