@palladium-ethiopia/esm-clinical-workflow-app 5.4.2-pre.34 → 5.4.2-pre.37
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/.turbo/turbo-build.log +4 -4
- package/dist/164.js +1 -1
- package/dist/164.js.map +1 -1
- package/dist/{160.js → 693.js} +1 -1
- package/dist/693.js.map +1 -0
- package/dist/ethiopia-esm-clinical-workflow-app.js +1 -1
- package/dist/ethiopia-esm-clinical-workflow-app.js.buildmanifest.json +28 -28
- package/dist/main.js +4 -4
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/config-schema.ts +2 -0
- package/src/index.ts +1 -1
- package/src/mru/billing-information/billing-information.resource.ts +60 -59
- package/src/mru/billing-information/billing-information.scss +21 -3
- package/src/mru/billing-information/billing-information.workspace.tsx +106 -252
- package/src/mru/billing-information/components/BillingTypeAttributes.tsx +106 -0
- package/src/mru/billing-information/components/CreditSubTypeFields.tsx +145 -0
- package/src/mru/billing-information/components/CreditSubTypeSelection.tsx +66 -0
- package/src/mru/billing-information/components/FreeSubTypeFields.tsx +7 -0
- package/src/mru/billing-information/components/FreeSubTypeSelection.tsx +61 -0
- package/src/mru/billing-information/components/index.ts +5 -0
- package/src/mru/billing-information/hooks/index.ts +4 -0
- package/src/mru/billing-information/hooks/useBillingForm.ts +22 -0
- package/src/mru/billing-information/hooks/useBillingType.ts +18 -0
- package/src/mru/billing-information/hooks/useCreditCompanies.ts +17 -0
- package/src/mru/billing-information/hooks/usePaymentModes.ts +17 -0
- package/dist/160.js.map +0 -1
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"pages":[],"extensions":[{"name":"clinical-workflow-triage-dashboard-link","component":"triageDashboardLink","slot":"homepage-dashboard-slot","order":0,"meta":{"name":"clinical-workflow-triage","slot":"clinical-workflow-triage-dashboard-slot","title":"clinical-workflow-triage"}},{"name":"clinical-workflow-triage-dashboard","component":"triageDashboard","slot":"clinical-workflow-triage-dashboard-slot"},{"name":"ewf-mru-dashboard-link","component":"mruLeftPanelLink","slot":"homepage-dashboard-slot","order":1,"meta":{"name":"mru","title":"MRU","path":"mru","slot":"mru-dashboard-slot"}},{"name":"ewf-mru-dashboard","component":"mruDashboard","slot":"mru-dashboard-slot","online":true,"offline":false},{"name":"patient-scoreboard-link","component":"patientScoreboardLink","slot":"homepage-dashboard-slot","order":1,"meta":{"name":"patient-scoreboard","title":"Patient Scoreboard","path":"patient-scoreboard","slot":"patient-scoreboard-slot"}},{"name":"patient-scoreboard","component":"patientScoreboard","slot":"patient-scoreboard-slot","online":true,"offline":false},{"name":"past-visits-detail-overview-shadow","slot":"patient-chart-encounters-dashboard-slot","component":"pastVisitsDetailOverviewShadow","order":0,"meta":{"title":"Visits","view":"visits"},"online":true,"offline":true},{"name":"queue-table-transfer-column","component":"queueTableTransferColumn","slot":"queue-table-transfer-status-slot"},{"name":"transfer-notes-overview-widget","component":"transferNotesOverview","slot":"patient-chart-summary-dashboard-slot","meta":{"fullWidth":false},"order":6}],"workspaces":[{"name":"triage-workspace","component":"triageWorkspace","title":"Triage Form","canMaximize":true,"type":"clinical-form"},{"name":"patient-registration-workspace","component":"patientRegistrationWorkspace","title":"Patient Registration","canMaximize":true,"type":"registration-form"},{"name":"billing-information-workspace","component":"billingInformationWorkspace","title":"Billing Information Workspace","type":"clinical-form"}],"workspaces2":[{"name":"clinical-workflow-patient-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"clinical-workflow-window"},{"name":"patient-transfer-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"patient-transfer"},{"name":"visit-notes-form-shadow-workspace","component":"visitNotesFormWorkspace","window":"visit-note-shadow"}],"workspaceWindows2":[{"name":"clinical-workflow-window","group":"clinical-workflow-group","width":"wider","canMaximize":true},{"name":"visit-note-shadow","group":"patient-chart","icon":"visitNoteActionButton","order":3},{"name":"patient-transfer","group":"patient-chart","icon":"patientTransferActionButton","order":4,"width":"wider","canMaximize":true}],"workspaceGroups2":[{"name":"clinical-workflow-group","overlay":true,"persistence":"closable"}],"modals":[{"name":"confirm-transfer-dialog","component":"confirmTransferDialog"},{"name":"patient-transfer-details-modal","component":"patientTransferDetailsModal"}],"version":"5.4.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"pages":[],"extensions":[{"name":"clinical-workflow-triage-dashboard-link","component":"triageDashboardLink","slot":"homepage-dashboard-slot","order":0,"meta":{"name":"clinical-workflow-triage","slot":"clinical-workflow-triage-dashboard-slot","title":"clinical-workflow-triage"}},{"name":"clinical-workflow-triage-dashboard","component":"triageDashboard","slot":"clinical-workflow-triage-dashboard-slot"},{"name":"ewf-mru-dashboard-link","component":"mruLeftPanelLink","slot":"homepage-dashboard-slot","order":1,"meta":{"name":"mru","title":"MRU","path":"mru","slot":"mru-dashboard-slot"}},{"name":"ewf-mru-dashboard","component":"mruDashboard","slot":"mru-dashboard-slot","online":true,"offline":false},{"name":"patient-scoreboard-link","component":"patientScoreboardLink","slot":"homepage-dashboard-slot","order":1,"meta":{"name":"patient-scoreboard","title":"Patient Scoreboard","path":"patient-scoreboard","slot":"patient-scoreboard-slot"}},{"name":"patient-scoreboard","component":"patientScoreboard","slot":"patient-scoreboard-slot","online":true,"offline":false},{"name":"past-visits-detail-overview-shadow","slot":"patient-chart-encounters-dashboard-slot","component":"pastVisitsDetailOverviewShadow","order":0,"meta":{"title":"Visits","view":"visits"},"online":true,"offline":true},{"name":"queue-table-transfer-column","component":"queueTableTransferColumn","slot":"queue-table-transfer-status-slot"},{"name":"transfer-notes-overview-widget","component":"transferNotesOverview","slot":"patient-chart-summary-dashboard-slot","meta":{"fullWidth":false},"order":6}],"workspaces":[{"name":"triage-workspace","component":"triageWorkspace","title":"Triage Form","canMaximize":true,"type":"clinical-form"},{"name":"patient-registration-workspace","component":"patientRegistrationWorkspace","title":"Patient Registration","canMaximize":true,"type":"registration-form"},{"name":"billing-information-workspace","component":"billingInformationWorkspace","title":"Billing Information Workspace","type":"clinical-form"}],"workspaces2":[{"name":"clinical-workflow-patient-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"clinical-workflow-window"},{"name":"patient-transfer-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"patient-transfer"},{"name":"visit-notes-form-shadow-workspace","component":"visitNotesFormWorkspace","window":"visit-note-shadow"}],"workspaceWindows2":[{"name":"clinical-workflow-window","group":"clinical-workflow-group","width":"wider","canMaximize":true},{"name":"visit-note-shadow","group":"patient-chart","icon":"visitNoteActionButton","order":3},{"name":"patient-transfer","group":"patient-chart","icon":"patientTransferActionButton","order":4,"width":"wider","canMaximize":true}],"workspaceGroups2":[{"name":"clinical-workflow-group","overlay":true,"persistence":"closable"}],"modals":[{"name":"confirm-transfer-dialog","component":"confirmTransferDialog"},{"name":"patient-transfer-details-modal","component":"patientTransferDetailsModal"}],"version":"5.4.2-pre.37"}
|
package/package.json
CHANGED
package/src/config-schema.ts
CHANGED
|
@@ -25,6 +25,7 @@ export const configSchema = {
|
|
|
25
25
|
creditType: '5cd1eb62-e006-4146-bd22-80bc4d5bd2f7',
|
|
26
26
|
creditTypeDetails: 'd824aa96-d2c7-4a52-aa8d-03f60a516083',
|
|
27
27
|
freeType: '7523ecfe-b8f1-4e7f-80a7-1a495b15ace4',
|
|
28
|
+
paymentAttributesSummary: '3cc0102e-6c1f-41db-af72-4be6aa9eb27a',
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
visitTypeUuid: {
|
|
@@ -125,6 +126,7 @@ export type ClinicalWorkflowConfig = {
|
|
|
125
126
|
creditType: string;
|
|
126
127
|
creditTypeDetails: string;
|
|
127
128
|
freeType: string;
|
|
129
|
+
paymentAttributesSummary: string;
|
|
128
130
|
};
|
|
129
131
|
visitTypeUuid: string;
|
|
130
132
|
identifierSourceUuid: string;
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ import visitNotesActionButtonExtension from './patient-notes/visit-note-action-b
|
|
|
10
10
|
import patientTransferActionButtonExtension from './patient-transfer/patient-transfer-action-button.extension';
|
|
11
11
|
import pastVisitsOverviewComponent from './patient-chart/visit/visits-widget/visit-detail-overview.component';
|
|
12
12
|
|
|
13
|
-
const moduleName = '@ethiopia/esm-clinical-workflow-app';
|
|
13
|
+
const moduleName = '@palladium-ethiopia/esm-clinical-workflow-app';
|
|
14
14
|
|
|
15
15
|
const options = {
|
|
16
16
|
featureName: 'clinical-workflow',
|
|
@@ -3,59 +3,45 @@ import { z } from 'zod';
|
|
|
3
3
|
// Create the billing form schema factory with conditional validation based on skip logic
|
|
4
4
|
import type { TFunction } from 'i18next';
|
|
5
5
|
|
|
6
|
-
export const createBillingFormSchema = (
|
|
6
|
+
export const createBillingFormSchema = (
|
|
7
|
+
t: TFunction,
|
|
8
|
+
billingTypes?: Array<{ uuid: string; name?: string; attributeTypes?: Array<{ uuid: string; required?: boolean }> }>,
|
|
9
|
+
) => {
|
|
7
10
|
return z
|
|
8
11
|
.object({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
id: z.string().optional(),
|
|
14
|
-
expiryDate: z.string().optional(),
|
|
15
|
-
zone: z.string().optional(),
|
|
16
|
-
freeType: z.string().optional(),
|
|
12
|
+
billingTypeUuid: z.string().optional(),
|
|
13
|
+
creditSubType: z.string().optional(),
|
|
14
|
+
freeSubType: z.string().optional(),
|
|
15
|
+
attributes: z.record(z.string(), z.any()).optional(),
|
|
17
16
|
})
|
|
18
17
|
.superRefine((data, ctx) => {
|
|
19
18
|
// Billing type is required on submit
|
|
20
|
-
if (!data.
|
|
19
|
+
if (!data.billingTypeUuid) {
|
|
21
20
|
ctx.addIssue({
|
|
22
21
|
code: z.ZodIssueCode.custom,
|
|
23
22
|
message: t('billingTypeRequired', 'Billing type is required'),
|
|
24
|
-
path: ['
|
|
23
|
+
path: ['billingTypeUuid'],
|
|
25
24
|
});
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
//
|
|
30
|
-
if (data.
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
path: ['id'],
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Free billing type validation
|
|
53
|
-
if (data.billingType === 'free') {
|
|
54
|
-
if (!data.freeType || data.freeType.trim() === '') {
|
|
55
|
-
ctx.addIssue({
|
|
56
|
-
code: z.ZodIssueCode.custom,
|
|
57
|
-
message: t('freeTypeRequired', 'Free type is required'),
|
|
58
|
-
path: ['freeType'],
|
|
28
|
+
// Validate required attributes for the selected billing type
|
|
29
|
+
if (billingTypes && data.billingTypeUuid) {
|
|
30
|
+
const selectedBillingType = billingTypes.find((bt) => bt.uuid === data.billingTypeUuid);
|
|
31
|
+
if (selectedBillingType?.attributeTypes) {
|
|
32
|
+
selectedBillingType.attributeTypes.forEach((attrType) => {
|
|
33
|
+
if (attrType.required) {
|
|
34
|
+
const attrValue = data.attributes?.[attrType.uuid];
|
|
35
|
+
if (!attrValue || (typeof attrValue === 'string' && attrValue.trim() === '')) {
|
|
36
|
+
ctx.addIssue({
|
|
37
|
+
code: z.ZodIssueCode.custom,
|
|
38
|
+
message: t('attributeRequired', '{{attributeName}} is required', {
|
|
39
|
+
attributeName: attrType.uuid,
|
|
40
|
+
}),
|
|
41
|
+
path: ['attributes', attrType.uuid],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
59
45
|
});
|
|
60
46
|
}
|
|
61
47
|
}
|
|
@@ -98,33 +84,48 @@ export const createBillingInformationVisitAttribute = (
|
|
|
98
84
|
billingFormData: BillingFormData,
|
|
99
85
|
visitAttributeTypeUuidsMap: {
|
|
100
86
|
paymentMethod: string;
|
|
101
|
-
|
|
102
|
-
creditTypeDetails: string;
|
|
103
|
-
freeType: string;
|
|
87
|
+
paymentAttributesSummary?: string;
|
|
104
88
|
},
|
|
105
89
|
) => {
|
|
106
|
-
const {
|
|
90
|
+
const { billingTypeUuid, attributes } = billingFormData;
|
|
107
91
|
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
92
|
+
const visitAttributePayload: Array<{ attributeType: { uuid: string } | string; value: string }> = [];
|
|
93
|
+
|
|
94
|
+
// Add billing method
|
|
95
|
+
if (billingTypeUuid && visitAttributeTypeUuidsMap.paymentMethod) {
|
|
96
|
+
visitAttributePayload.push({
|
|
97
|
+
attributeType: visitAttributeTypeUuidsMap.paymentMethod,
|
|
98
|
+
value: billingTypeUuid,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Save sub attributes (from attributes object) as a stringified object under the paymentAttributesSummary key
|
|
103
|
+
// Format: {attributeUuid: value}
|
|
104
|
+
// Only includes sub attributes, not the main paymentMethod attribute
|
|
105
|
+
if (visitAttributeTypeUuidsMap.paymentAttributesSummary && attributes) {
|
|
106
|
+
const paymentAttributesObject: Record<string, any> = {};
|
|
107
|
+
|
|
108
|
+
// Add sub attributes from the attributes object using their UUIDs as keys
|
|
109
|
+
Object.entries(attributes).forEach(([attrTypeUuid, value]) => {
|
|
110
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
111
|
+
paymentAttributesObject[attrTypeUuid] = value;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
120
114
|
|
|
121
|
-
|
|
115
|
+
// Only add the summary if there are sub attributes to save
|
|
116
|
+
if (Object.keys(paymentAttributesObject).length > 0) {
|
|
117
|
+
visitAttributePayload.push({
|
|
118
|
+
attributeType: visitAttributeTypeUuidsMap.paymentAttributesSummary,
|
|
119
|
+
value: JSON.stringify(paymentAttributesObject),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
122
123
|
|
|
123
124
|
return visitAttributePayload;
|
|
124
125
|
};
|
|
125
126
|
|
|
126
127
|
export const updateVisitWithBillingInformation = (
|
|
127
|
-
visitAttributePayload: Array<{ attributeType: string; value: string }>,
|
|
128
|
+
visitAttributePayload: Array<{ attributeType: { uuid: string } | string; value: string }>,
|
|
128
129
|
visitUuid: string,
|
|
129
130
|
) => {
|
|
130
131
|
return openmrsFetch(`${restBaseUrl}/visit/${visitUuid}`, {
|
|
@@ -24,18 +24,35 @@
|
|
|
24
24
|
|
|
25
25
|
.billingInformationContainer {
|
|
26
26
|
margin: spacing.$spacing-05;
|
|
27
|
+
overflow-y: visible;
|
|
27
28
|
height: 100%;
|
|
28
|
-
|
|
29
|
+
border: solid red 1px;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
.paymentTypeSwitcher {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
justify-content: space-evenly;
|
|
36
|
+
// flex-wrap: wrap;
|
|
37
|
+
border: none;
|
|
38
|
+
outline: none;
|
|
39
|
+
padding: 2px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// .paymentTypeSwitch {
|
|
43
|
+
// margin-bottom: spacing.$spacing-03;
|
|
44
|
+
// border: solid #a6c8ff;
|
|
45
|
+
// }
|
|
46
|
+
|
|
31
47
|
.creditDetailsContainer {
|
|
32
48
|
display: flex;
|
|
33
49
|
flex-direction: column;
|
|
34
50
|
gap: spacing.$spacing-05;
|
|
35
51
|
margin-top: spacing.$spacing-03;
|
|
36
|
-
|
|
52
|
+
height: auto;
|
|
37
53
|
border: 1px solid colors.$gray-20;
|
|
38
54
|
padding: spacing.$spacing-03;
|
|
55
|
+
overflow: visible;
|
|
39
56
|
}
|
|
40
57
|
|
|
41
58
|
.freeDetailsContainer {
|
|
@@ -43,9 +60,10 @@
|
|
|
43
60
|
flex-direction: column;
|
|
44
61
|
gap: spacing.$spacing-05;
|
|
45
62
|
margin-top: spacing.$spacing-03;
|
|
46
|
-
|
|
63
|
+
height: auto;
|
|
47
64
|
border: 1px solid colors.$gray-20;
|
|
48
65
|
padding: spacing.$spacing-03;
|
|
66
|
+
overflow: visible;
|
|
49
67
|
}
|
|
50
68
|
|
|
51
69
|
.creditTypeDetailsContainer {
|