From 877c20e84ced1284a1cd5550ba2c2a0bef0f3dbf Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:21:20 +0300 Subject: [PATCH] Separate the concepts from custom uuids --- .../visit-attributes-form.component.tsx | 18 +++++++++--------- src/config-schema.ts | 12 ++++++++++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/billing-form/visit-attributes/visit-attributes-form.component.tsx b/src/billing-form/visit-attributes/visit-attributes-form.component.tsx index 774b62c..9d18c7b 100644 --- a/src/billing-form/visit-attributes/visit-attributes-form.component.tsx +++ b/src/billing-form/visit-attributes/visit-attributes-form.component.tsx @@ -36,7 +36,7 @@ const VisitAttributesForm: React.FC = ({ setAttributes defaultValues: {}, resolver: zodResolver(visitAttributesFormSchema), }); - const patientCatergory = useConfig(); + const { patientCatergory, catergoryConcepts } = useConfig(); const [paymentDetails, paymentMethods, insuranceSchema, policyNumber, patientCategory] = watch([ 'paymentDetails', 'paymentMethods', @@ -57,7 +57,7 @@ const VisitAttributesForm: React.FC = ({ setAttributes patientCatergory.paymentDetails, patientCatergory.paymentMethods, patientCatergory.policyNumber, - patientCatergory.insuranceSchema, + patientCatergory.insuranceScheme, patientCatergory.patientCategory, patientCatergory.formPayloadPending, true, @@ -93,13 +93,13 @@ const VisitAttributesForm: React.FC = ({ setAttributes orientation="vertical" legendText={t('paymentDetails', 'Payment Details')} name="payment-details-group"> - - + + )} /> - {paymentDetails === patientCatergory.payingDetails && ( + {paymentDetails === catergoryConcepts.payingDetails && ( = ({ setAttributes /> )} - {paymentMethods === patientCatergory.insuranceDetails && paymentDetails === patientCatergory.payingDetails && ( + {paymentMethods === catergoryConcepts.insuranceDetails && paymentDetails === catergoryConcepts.payingDetails && ( <> = ({ setAttributes )} - {paymentDetails === patientCatergory.nonPayingDetails && ( + {paymentDetails === catergoryConcepts.nonPayingDetails && ( = ({ 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')} diff --git a/src/config-schema.ts b/src/config-schema.ts index a7f9fd4..2d7cb38 100644 --- a/src/config-schema.ts +++ b/src/config-schema.ts @@ -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', @@ -31,4 +38,5 @@ export const configSchema = { export interface ConfigObject { patientCatergory: Object; defaultCurrency: string; + catergoryConcepts: Object; }