@digihmis/esm-administration-app 1.0.0 → 1.0.1
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/package.json +1 -1
- package/release-version.js +4 -4
- package/src/billing-management/billing-charge-items/billing-charge-items-modal/billing-charge-items.resource.ts +2 -1
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/billing-charge-items.resource.ts +30 -7
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/billing-charge-service.workspace.tsx +79 -107
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/components/price.component.scss +16 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/components/price.component.tsx +30 -20
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/schemas/form-schemas.ts +19 -14
- package/src/billing-management/billing-charge-items/billing-charge-items.component.tsx +26 -35
- package/src/billing-management/billing-charge-items/billing-charge-items.resource.ts +1 -1
- package/src/billing-management/billing-charge-items/type/index.ts +10 -10
- package/src/billing-management/billing-charge-items/utils/index.ts +32 -74
- package/src/billing-management/billing-payment-modes/billing-payment-modes.component.tsx +24 -166
- package/src/billing-management/billing-payment-modes/billing-payment-modes.resource.ts +24 -14
- package/src/billing-management/billing-payment-points/billing-payment-point-modal/billing-delete-payment-point.modal.tsx +1 -1
- package/src/billing-management/billing-payment-points/billing-payment-point.resource.ts +1 -1
- package/src/billing-management/billing-payment-points/billing-payment-point.scss +47 -0
- package/src/billing-management/billing-payment-points/billing-payment-points-workspace/billing-payment-point.resource.ts +18 -23
- package/src/billing-management/billing-payment-points/billing-payment-points-workspace/billing-payment-points.workspace.tsx +1 -1
- package/src/config-schema.ts +17 -0
- package/src/dashboard.meta.ts +8 -0
- package/src/document-branding/document-branding-workspace/document-branding.workspace.scss +34 -0
- package/src/document-branding/document-branding-workspace/document-branding.workspace.tsx +160 -0
- package/src/document-branding/document-branding.component.tsx +185 -0
- package/src/document-branding/document-branding.resource.ts +54 -0
- package/src/document-branding/document-branding.scss +69 -0
- package/src/index.ts +15 -9
- package/src/routes.json +34 -13
- package/dist/101.js +0 -1
- package/dist/101.js.map +0 -1
- package/dist/117.js +0 -1
- package/dist/117.js.map +0 -1
- package/dist/132.js +0 -1
- package/dist/132.js.map +0 -1
- package/dist/15.js +0 -1
- package/dist/15.js.map +0 -1
- package/dist/152.js +0 -1
- package/dist/152.js.map +0 -1
- package/dist/153.js +0 -1
- package/dist/153.js.map +0 -1
- package/dist/190.js +0 -1
- package/dist/190.js.map +0 -1
- package/dist/209.js +0 -1
- package/dist/209.js.map +0 -1
- package/dist/266.js +0 -1
- package/dist/266.js.map +0 -1
- package/dist/317.js +0 -1
- package/dist/317.js.map +0 -1
- package/dist/349.js +0 -1
- package/dist/349.js.map +0 -1
- package/dist/371.js +0 -1
- package/dist/371.js.map +0 -1
- package/dist/378.js +0 -1
- package/dist/378.js.map +0 -1
- package/dist/394.js +0 -1
- package/dist/394.js.map +0 -1
- package/dist/442.js +0 -1
- package/dist/442.js.map +0 -1
- package/dist/45.js +0 -1
- package/dist/45.js.map +0 -1
- package/dist/454.js +0 -1
- package/dist/454.js.map +0 -1
- package/dist/466.js +0 -1
- package/dist/466.js.map +0 -1
- package/dist/482.js +0 -1
- package/dist/482.js.map +0 -1
- package/dist/501.js +0 -1
- package/dist/501.js.map +0 -1
- package/dist/508.js +0 -1
- package/dist/508.js.map +0 -1
- package/dist/578.js +0 -1
- package/dist/578.js.map +0 -1
- package/dist/598.js +0 -1
- package/dist/598.js.map +0 -1
- package/dist/606.js +0 -1
- package/dist/606.js.map +0 -1
- package/dist/61.js +0 -1
- package/dist/61.js.map +0 -1
- package/dist/640.js +0 -1
- package/dist/640.js.map +0 -1
- package/dist/685.js +0 -1
- package/dist/685.js.map +0 -1
- package/dist/689.js +0 -1
- package/dist/689.js.map +0 -1
- package/dist/709.js +0 -1
- package/dist/709.js.map +0 -1
- package/dist/712.js +0 -1
- package/dist/712.js.map +0 -1
- package/dist/720.js +0 -1
- package/dist/720.js.map +0 -1
- package/dist/737.js +0 -12
- package/dist/737.js.map +0 -1
- package/dist/742.js +0 -1
- package/dist/742.js.map +0 -1
- package/dist/747.js +0 -1
- package/dist/747.js.map +0 -1
- package/dist/771.js +0 -1
- package/dist/771.js.map +0 -1
- package/dist/806.js +0 -1
- package/dist/806.js.map +0 -1
- package/dist/912.js +0 -1
- package/dist/912.js.map +0 -1
- package/dist/913.js +0 -1
- package/dist/913.js.map +0 -1
- package/dist/916.js +0 -15
- package/dist/916.js.map +0 -1
- package/dist/940.js +0 -1
- package/dist/940.js.map +0 -1
- package/dist/digihmis-esm-administration-app.js +0 -6
- package/dist/digihmis-esm-administration-app.js.buildmanifest.json +0 -1100
- package/dist/digihmis-esm-administration-app.js.map +0 -1
- package/dist/main.js +0 -17
- package/dist/main.js.map +0 -1
- package/dist/routes.json +0 -1
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/billing-charge-item.workspace.tsx +0 -212
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/components/stock-search.component.tsx +0 -107
|
@@ -3,22 +3,22 @@ import { OpenmrsResource } from '@openmrs/esm-framework';
|
|
|
3
3
|
export interface ChargeItems {
|
|
4
4
|
uuid: string;
|
|
5
5
|
name: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
price: number | string;
|
|
7
|
+
description?: string;
|
|
8
|
+
retired?: boolean;
|
|
9
|
+
concept: {
|
|
10
10
|
uuid: string;
|
|
11
11
|
display: string;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
uuid: string;
|
|
15
|
-
name: string;
|
|
16
|
-
price: number;
|
|
17
|
-
}>;
|
|
18
|
-
concept: {
|
|
13
|
+
serviceType?: {
|
|
19
14
|
uuid: string;
|
|
20
15
|
display: string;
|
|
21
16
|
};
|
|
17
|
+
prices?: Array<{
|
|
18
|
+
uuid?: string;
|
|
19
|
+
paymentMode: string;
|
|
20
|
+
price: number | string;
|
|
21
|
+
}>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface ChargeItemsResponse {
|
|
@@ -1,96 +1,54 @@
|
|
|
1
|
-
import { BillableFormSchema
|
|
1
|
+
import { BillableFormSchema } from '../billing-charge-items-workspace/schemas/form-schemas';
|
|
2
2
|
|
|
3
3
|
export type BillableServicePayload = {
|
|
4
4
|
name: string;
|
|
5
|
-
|
|
6
|
-
serviceType
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
price: string | number;
|
|
10
|
-
name: string;
|
|
11
|
-
}>;
|
|
12
|
-
serviceStatus: string;
|
|
13
|
-
concept: string | number;
|
|
14
|
-
stockItem: string;
|
|
5
|
+
concept?: string;
|
|
6
|
+
serviceType?: string;
|
|
7
|
+
price: string | number;
|
|
8
|
+
description?: string;
|
|
15
9
|
uuid?: string;
|
|
16
10
|
};
|
|
17
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Map the form to the billable-item create/update payload. Pricing is per payment mode, but the
|
|
14
|
+
* module still stores a fallback default price, so the first configured mode's price is used for it;
|
|
15
|
+
* the per-mode prices are then synced separately as overrides.
|
|
16
|
+
*/
|
|
18
17
|
export const formatBillableServicePayloadForSubmission = (
|
|
19
18
|
formData: BillableFormSchema,
|
|
20
19
|
uuid?: string,
|
|
21
20
|
): BillableServicePayload => {
|
|
22
|
-
const
|
|
21
|
+
const prices = formData.servicePrices ?? [];
|
|
22
|
+
const fallbackPrice = prices.length ? Number(prices[0].price ?? 0) : 0;
|
|
23
|
+
const payload: BillableServicePayload = {
|
|
23
24
|
name: formData.name,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
name: servicePrice.paymentMode.name,
|
|
30
|
-
})),
|
|
31
|
-
serviceStatus: formData.serviceStatus,
|
|
32
|
-
concept: formData.concept.concept.uuid,
|
|
33
|
-
stockItem: formData.stockItem || null,
|
|
25
|
+
concept: formData.concept?.concept?.uuid,
|
|
26
|
+
// Empty string clears the service type on update; a uuid sets it.
|
|
27
|
+
serviceType: formData.serviceType?.uuid ?? '',
|
|
28
|
+
price: fallbackPrice,
|
|
29
|
+
description: formData.description,
|
|
34
30
|
};
|
|
35
|
-
|
|
36
|
-
return uuid ? Object.assign(formPayload, { uuid: uuid }) : formPayload;
|
|
31
|
+
return uuid ? { ...payload, uuid } : payload;
|
|
37
32
|
};
|
|
38
33
|
|
|
34
|
+
/** Map an existing billable item (from the list) back onto the form for editing. */
|
|
39
35
|
export function mapInputToPayloadSchema(service): BillableFormSchema {
|
|
40
|
-
const servicePrices
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
uuid: price.paymentMode?.uuid,
|
|
44
|
-
name: price.paymentMode?.name,
|
|
45
|
-
},
|
|
36
|
+
const servicePrices = (service?.prices ?? []).map((override: { paymentMode?: string; price?: number | string }) => ({
|
|
37
|
+
paymentMode: { uuid: override?.paymentMode ?? '', name: override?.paymentMode ?? '' },
|
|
38
|
+
price: Number(override?.price ?? 0),
|
|
46
39
|
}));
|
|
47
|
-
|
|
48
|
-
const payload: BillableFormSchema = {
|
|
49
|
-
name: service.name,
|
|
50
|
-
shortName: service.shortName,
|
|
51
|
-
serviceType: {
|
|
52
|
-
uuid: service?.serviceType?.uuid,
|
|
53
|
-
display: service?.serviceType?.display,
|
|
54
|
-
},
|
|
55
|
-
servicePrices: servicePrices,
|
|
56
|
-
serviceStatus: service.serviceStatus,
|
|
57
|
-
concept: {
|
|
58
|
-
concept: {
|
|
59
|
-
uuid: service?.concept?.uuid,
|
|
60
|
-
display: service.concept?.display,
|
|
61
|
-
},
|
|
62
|
-
conceptName: {
|
|
63
|
-
uuid: service?.concept?.uuid,
|
|
64
|
-
display: service?.concept?.display,
|
|
65
|
-
},
|
|
66
|
-
display: service?.concept?.display,
|
|
67
|
-
},
|
|
68
|
-
stockItem: service?.stockItem?.uuid ?? null,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return payload;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const formatStockItemToPayload = (stockItem: any): BillableFormSchema => {
|
|
75
40
|
return {
|
|
76
|
-
name:
|
|
77
|
-
|
|
78
|
-
serviceType: {
|
|
79
|
-
uuid: stockItem.serviceType?.uuid || '',
|
|
80
|
-
display: stockItem.serviceType?.display || '',
|
|
81
|
-
},
|
|
82
|
-
servicePrices: [],
|
|
41
|
+
name: service?.name ?? '',
|
|
42
|
+
description: service?.description ?? '',
|
|
83
43
|
concept: {
|
|
84
44
|
concept: {
|
|
85
|
-
uuid:
|
|
86
|
-
display:
|
|
87
|
-
},
|
|
88
|
-
conceptName: {
|
|
89
|
-
uuid: stockItem.conceptUuid,
|
|
90
|
-
display: stockItem.conceptName,
|
|
45
|
+
uuid: service?.concept?.uuid ?? '',
|
|
46
|
+
display: service?.concept?.display ?? '',
|
|
91
47
|
},
|
|
92
|
-
display: stockItem.conceptName,
|
|
93
48
|
},
|
|
94
|
-
|
|
49
|
+
serviceType: service?.serviceType
|
|
50
|
+
? { uuid: service.serviceType.uuid, display: service.serviceType.display }
|
|
51
|
+
: null,
|
|
52
|
+
servicePrices,
|
|
95
53
|
};
|
|
96
|
-
}
|
|
54
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { useMemo
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Button,
|
|
4
3
|
DataTable,
|
|
5
4
|
DataTableSkeleton,
|
|
6
5
|
Table,
|
|
@@ -10,88 +9,35 @@ import {
|
|
|
10
9
|
TableHead,
|
|
11
10
|
TableHeader,
|
|
12
11
|
TableRow,
|
|
13
|
-
TableExpandHeader,
|
|
14
|
-
TableExpandRow,
|
|
15
|
-
TableExpandedRow,
|
|
16
12
|
Layer,
|
|
17
|
-
Pagination,
|
|
18
13
|
Tile,
|
|
19
|
-
IconButton,
|
|
20
14
|
} from '@carbon/react';
|
|
21
|
-
import {
|
|
22
|
-
import { launchWorkspace, useLayoutType, ErrorState, showModal } from '@openmrs/esm-framework';
|
|
15
|
+
import { useLayoutType, ErrorState } from '@openmrs/esm-framework';
|
|
23
16
|
import { useTranslation } from 'react-i18next';
|
|
24
|
-
import startCase from 'lodash-es/startCase';
|
|
25
17
|
import styles from './billing-payment-modes.scss';
|
|
26
18
|
import { CardHeader } from '@openmrs/esm-patient-common-lib';
|
|
27
|
-
import { PaymentMethod } from './type';
|
|
28
19
|
import { usePaymentModes } from './billing-payment-modes.resource';
|
|
29
20
|
|
|
21
|
+
/**
|
|
22
|
+
* DigiHMIS payment modes are a fixed set (the billing module's PaymentMode enum), so this tab lists
|
|
23
|
+
* them read-only -- there is nothing to add, edit or delete.
|
|
24
|
+
*/
|
|
30
25
|
const PaymentModeTable = () => {
|
|
31
26
|
const { t } = useTranslation();
|
|
32
|
-
const
|
|
33
|
-
const isTablet = layout === 'tablet';
|
|
27
|
+
const isTablet = useLayoutType() === 'tablet';
|
|
34
28
|
const responsiveSize = isTablet ? 'lg' : 'sm';
|
|
35
29
|
|
|
36
30
|
const { paymentModes, isLoading, error } = usePaymentModes(false);
|
|
37
31
|
|
|
38
|
-
// Pagination state
|
|
39
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
40
|
-
const [currentPageSize, setCurrentPageSize] = useState(10);
|
|
41
|
-
const pageSizes = [10, 20, 30, 40, 50];
|
|
42
|
-
|
|
43
32
|
const headers = [
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
header: t('dateCreated', 'Date Created'),
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
key: 'name',
|
|
50
|
-
header: t('name', 'Name'),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
key: 'description',
|
|
54
|
-
header: t('description', 'Description'),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
key: 'retired',
|
|
58
|
-
header: t('retired', 'Retired'),
|
|
59
|
-
},
|
|
33
|
+
{ key: 'name', header: t('name', 'Name') },
|
|
34
|
+
{ key: 'description', header: t('code', 'Code') },
|
|
60
35
|
];
|
|
61
36
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return paymentModes.map((mode) => ({
|
|
69
|
-
id: mode.uuid,
|
|
70
|
-
dateCreated: new Date(mode.auditInfo.dateCreated).toLocaleDateString(),
|
|
71
|
-
name: mode.name,
|
|
72
|
-
description: mode.description || '-',
|
|
73
|
-
retired: mode.retired ? t('yes', 'Yes') : t('no', 'No'),
|
|
74
|
-
paymentMode: mode, // Store full object for expandable row
|
|
75
|
-
}));
|
|
76
|
-
}, [paymentModes, t]);
|
|
77
|
-
|
|
78
|
-
// Paginated rows
|
|
79
|
-
const paginatedRows = useMemo(() => {
|
|
80
|
-
const startIndex = (currentPage - 1) * currentPageSize;
|
|
81
|
-
const endIndex = startIndex + currentPageSize;
|
|
82
|
-
return tableRows.slice(startIndex, endIndex);
|
|
83
|
-
}, [tableRows, currentPage, currentPageSize]);
|
|
84
|
-
|
|
85
|
-
const handleAddPaymentMode = () => {
|
|
86
|
-
launchWorkspace('payment-mode-workspace');
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const showDeletePaymentModeModal = (paymentMode: PaymentMethod) => {
|
|
90
|
-
const dispose = showModal('delete-payment-mode-modal', {
|
|
91
|
-
closeModal: () => dispose(),
|
|
92
|
-
paymentMode,
|
|
93
|
-
});
|
|
94
|
-
};
|
|
37
|
+
const rows = useMemo(
|
|
38
|
+
() => (paymentModes ?? []).map((mode) => ({ id: mode.uuid, name: mode.name, description: mode.description || '-' })),
|
|
39
|
+
[paymentModes],
|
|
40
|
+
);
|
|
95
41
|
|
|
96
42
|
if (isLoading) {
|
|
97
43
|
return (
|
|
@@ -109,102 +55,41 @@ const PaymentModeTable = () => {
|
|
|
109
55
|
return (
|
|
110
56
|
<div className={styles.section}>
|
|
111
57
|
<CardHeader title={t('paymentModes', 'Payment Modes')}>
|
|
112
|
-
<
|
|
113
|
-
{t('addPaymentMode', 'Add Payment Mode')}
|
|
114
|
-
</Button>
|
|
58
|
+
<span>{t('builtInPaymentModes', 'Built-in payment modes')}</span>
|
|
115
59
|
</CardHeader>
|
|
116
60
|
<Layer>
|
|
117
|
-
<DataTable rows={
|
|
118
|
-
{({ rows, headers, getHeaderProps, getRowProps, getTableProps
|
|
61
|
+
<DataTable rows={rows} headers={headers} isSortable size={responsiveSize} useZebraStyles>
|
|
62
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps }) => (
|
|
119
63
|
<TableContainer>
|
|
120
64
|
<Table {...getTableProps()} aria-label={t('paymentModesTable', 'Payment modes table')}>
|
|
121
65
|
<TableHead>
|
|
122
66
|
<TableRow>
|
|
123
|
-
<TableExpandHeader />
|
|
124
67
|
{headers.map((header) => (
|
|
125
68
|
<TableHeader key={header.key} {...getHeaderProps({ header })}>
|
|
126
69
|
{header.header}
|
|
127
70
|
</TableHeader>
|
|
128
71
|
))}
|
|
129
|
-
<TableHeader>{t('actions', 'Actions')}</TableHeader>
|
|
130
72
|
</TableRow>
|
|
131
73
|
</TableHead>
|
|
132
74
|
<TableBody>
|
|
133
|
-
{rows.map((row
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
))}
|
|
141
|
-
<TableCell>
|
|
142
|
-
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
|
143
|
-
<IconButton
|
|
144
|
-
kind="ghost"
|
|
145
|
-
size={responsiveSize}
|
|
146
|
-
label={t('edit', 'Edit')}
|
|
147
|
-
onClick={() =>
|
|
148
|
-
launchWorkspace('payment-mode-workspace', {
|
|
149
|
-
workspaceTitle: t('editPaymentMode', 'Edit Payment Mode'),
|
|
150
|
-
initialPaymentMode: paymentMode,
|
|
151
|
-
})
|
|
152
|
-
}>
|
|
153
|
-
<Edit />
|
|
154
|
-
</IconButton>
|
|
155
|
-
<IconButton
|
|
156
|
-
kind="danger--ghost"
|
|
157
|
-
size={responsiveSize}
|
|
158
|
-
label={t('delete', 'Delete')}
|
|
159
|
-
onClick={() => showDeletePaymentModeModal(paymentMode)}>
|
|
160
|
-
<TrashCan />
|
|
161
|
-
</IconButton>
|
|
162
|
-
</div>
|
|
163
|
-
</TableCell>
|
|
164
|
-
</TableExpandRow>
|
|
165
|
-
<TableExpandedRow
|
|
166
|
-
colSpan={headers.length + 2}
|
|
167
|
-
className="demo-expanded-td"
|
|
168
|
-
{...getExpandedRowProps({ row })}>
|
|
169
|
-
{paymentMode && <PaymentModeAttributes paymentMode={paymentMode} />}
|
|
170
|
-
</TableExpandedRow>
|
|
171
|
-
</React.Fragment>
|
|
172
|
-
);
|
|
173
|
-
})}
|
|
75
|
+
{rows.map((row) => (
|
|
76
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
77
|
+
{row.cells.map((cell) => (
|
|
78
|
+
<TableCell key={cell.id}>{cell.value}</TableCell>
|
|
79
|
+
))}
|
|
80
|
+
</TableRow>
|
|
81
|
+
))}
|
|
174
82
|
</TableBody>
|
|
175
83
|
</Table>
|
|
176
|
-
{
|
|
84
|
+
{rows.length === 0 ? (
|
|
177
85
|
<div className={styles.tileContainer}>
|
|
178
86
|
<Tile className={styles.tile}>
|
|
179
87
|
<div className={styles.tileContent}>
|
|
180
88
|
<p className={styles.content}>{t('noPaymentModesFound', 'No payment modes found')}</p>
|
|
181
|
-
<p className={styles.emptyStateHelperText}>
|
|
182
|
-
{t('checkFilters', 'Please check the filters above and try again')}
|
|
183
|
-
</p>
|
|
184
89
|
</div>
|
|
185
90
|
</Tile>
|
|
186
91
|
</div>
|
|
187
92
|
) : null}
|
|
188
|
-
{tableRows.length > 0 && (
|
|
189
|
-
<Pagination
|
|
190
|
-
forwardText={t('nextPage', 'Next page')}
|
|
191
|
-
backwardText={t('previousPage', 'Previous page')}
|
|
192
|
-
page={currentPage}
|
|
193
|
-
pageSize={currentPageSize}
|
|
194
|
-
pageSizes={pageSizes}
|
|
195
|
-
totalItems={tableRows.length}
|
|
196
|
-
className={styles.pagination}
|
|
197
|
-
onChange={({ pageSize, page }) => {
|
|
198
|
-
if (pageSize !== currentPageSize) {
|
|
199
|
-
setCurrentPageSize(pageSize);
|
|
200
|
-
setCurrentPage(1);
|
|
201
|
-
}
|
|
202
|
-
if (page !== currentPage) {
|
|
203
|
-
setCurrentPage(page);
|
|
204
|
-
}
|
|
205
|
-
}}
|
|
206
|
-
/>
|
|
207
|
-
)}
|
|
208
93
|
</TableContainer>
|
|
209
94
|
)}
|
|
210
95
|
</DataTable>
|
|
@@ -213,31 +98,4 @@ const PaymentModeTable = () => {
|
|
|
213
98
|
);
|
|
214
99
|
};
|
|
215
100
|
|
|
216
|
-
const PaymentModeAttributes: React.FC<{ paymentMode: PaymentMethod }> = ({ paymentMode }) => {
|
|
217
|
-
const { t } = useTranslation();
|
|
218
|
-
const { attributeTypes } = paymentMode;
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<div className={styles.attributeContainer}>
|
|
222
|
-
{attributeTypes.map((attributeType, index) =>
|
|
223
|
-
Object.entries(attributeType).map(([key, value]) => {
|
|
224
|
-
if (key === 'uuid') {
|
|
225
|
-
return null;
|
|
226
|
-
}
|
|
227
|
-
return <AttributeCard key={`${index}-${key}`} label={key} value={JSON.stringify(value)} />;
|
|
228
|
-
}),
|
|
229
|
-
)}
|
|
230
|
-
</div>
|
|
231
|
-
);
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
const AttributeCard: React.FC<{ label: string; value: string }> = ({ label, value }) => {
|
|
235
|
-
return (
|
|
236
|
-
<div className={styles.attributeCard}>
|
|
237
|
-
<div className={styles.attributeLabel}>{startCase(label).replace(/\s+/g, ' ')}</div>
|
|
238
|
-
<div className={styles.attributeValue}>{value.replace(/['"]/g, '')}</div>
|
|
239
|
-
</div>
|
|
240
|
-
);
|
|
241
|
-
};
|
|
242
|
-
|
|
243
101
|
export default PaymentModeTable;
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import { openmrsFetch, restBaseUrl
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
2
|
import useSWR from 'swr';
|
|
3
|
-
import { PaymentMethod } from './type';
|
|
4
|
-
import { ConfigObject } from '../../config-schema';
|
|
5
3
|
|
|
4
|
+
export interface PaymentModeOption {
|
|
5
|
+
uuid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The payment modes are a fixed enum in the DigiHMIS billing module, served read-only at
|
|
12
|
+
* /digihmisbilling/paymentmode. The `uuid` carries the enum name (what a visit attribute / payment
|
|
13
|
+
* stores) and `name` its label.
|
|
14
|
+
*/
|
|
6
15
|
export const usePaymentModes = (excludeWaiver: boolean = true) => {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const url = `${restBaseUrl}/digihmisbilling/paymentmode`;
|
|
17
|
+
const { data, isLoading, error, mutate } = useSWR<{
|
|
18
|
+
data: { results: Array<{ value: string; uuid: string; display: string }> };
|
|
19
|
+
}>(url, openmrsFetch);
|
|
20
|
+
|
|
21
|
+
const modes: Array<PaymentModeOption> = (data?.data?.results ?? []).map((mode) => ({
|
|
22
|
+
uuid: mode.uuid ?? mode.value,
|
|
23
|
+
name: mode.display,
|
|
24
|
+
description: mode.value,
|
|
25
|
+
}));
|
|
26
|
+
|
|
17
27
|
return {
|
|
18
|
-
paymentModes: excludeWaiver ?
|
|
28
|
+
paymentModes: excludeWaiver ? modes.filter((mode) => mode.uuid !== 'WAIVER') : modes,
|
|
19
29
|
isLoading,
|
|
20
30
|
mutate,
|
|
21
31
|
error,
|
|
@@ -28,7 +28,7 @@ const DeletePaymentPointModal: React.FC<DeletePaymentPointModalProps> = ({ close
|
|
|
28
28
|
timeoutInMs: 5000,
|
|
29
29
|
autoClose: true,
|
|
30
30
|
});
|
|
31
|
-
handleMutation(`${restBaseUrl}/
|
|
31
|
+
handleMutation(`${restBaseUrl}/digihmisbilling/paymentpoint`);
|
|
32
32
|
closeModal();
|
|
33
33
|
} catch (error) {
|
|
34
34
|
showSnackbar({
|
|
@@ -3,7 +3,7 @@ import { PaymentPoint } from './type';
|
|
|
3
3
|
import useSWR from 'swr';
|
|
4
4
|
|
|
5
5
|
export const usePaymentPoints = () => {
|
|
6
|
-
const url = `${restBaseUrl}/
|
|
6
|
+
const url = `${restBaseUrl}/digihmisbilling/paymentpoint`;
|
|
7
7
|
|
|
8
8
|
const { data, isLoading, error, mutate } = useSWR<FetchResponse<{ results: Array<PaymentPoint> }>>(url, openmrsFetch);
|
|
9
9
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
@use '@carbon/type';
|
|
3
|
+
@use '@carbon/colors';
|
|
4
|
+
|
|
5
|
+
.section {
|
|
6
|
+
margin-bottom: layout.$spacing-07;
|
|
7
|
+
|
|
8
|
+
&:last-child {
|
|
9
|
+
margin-bottom: 0;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.tileContainer {
|
|
14
|
+
border-top: 1px solid colors.$gray-20;
|
|
15
|
+
padding: 3rem 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tile {
|
|
19
|
+
margin: auto;
|
|
20
|
+
width: fit-content;
|
|
21
|
+
background: colors.$gray-20;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tileContent {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.content {
|
|
31
|
+
@include type.type-style('heading-compact-02');
|
|
32
|
+
color: colors.$gray-70;
|
|
33
|
+
margin-bottom: layout.$spacing-03;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.emptyStateHelperText {
|
|
37
|
+
@include type.type-style('body-compact-01');
|
|
38
|
+
color: colors.$gray-70;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.pagination {
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
|
|
44
|
+
&:global(.cds--pagination) {
|
|
45
|
+
border-top: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -2,38 +2,33 @@ import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
|
2
2
|
import { type PaymentPoint } from '../type';
|
|
3
3
|
import { mutate } from 'swr';
|
|
4
4
|
|
|
5
|
+
// The DigiHMIS billing module takes payment-point fields as request params (name, description).
|
|
6
|
+
const toUrl = (payload: Partial<PaymentPoint>, uuid?: string) => {
|
|
7
|
+
const params = new URLSearchParams();
|
|
8
|
+
if (payload.name != null) {
|
|
9
|
+
params.set('name', payload.name);
|
|
10
|
+
}
|
|
11
|
+
if (payload.description != null) {
|
|
12
|
+
params.set('description', payload.description);
|
|
13
|
+
}
|
|
14
|
+
const base = `${restBaseUrl}/digihmisbilling/paymentpoint`;
|
|
15
|
+
return uuid ? `${base}/${uuid}?${params.toString()}` : `${base}?${params.toString()}`;
|
|
16
|
+
};
|
|
17
|
+
|
|
5
18
|
export const createPaymentPoint = (payload: Partial<PaymentPoint>) => {
|
|
6
|
-
|
|
7
|
-
return openmrsFetch(url, {
|
|
8
|
-
method: 'POST',
|
|
9
|
-
body: payload,
|
|
10
|
-
headers: {
|
|
11
|
-
'Content-Type': 'application/json',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
19
|
+
return openmrsFetch(toUrl(payload), { method: 'POST' });
|
|
14
20
|
};
|
|
15
21
|
|
|
16
22
|
export const updatePaymentPoint = (uuid: string, payload: Partial<PaymentPoint>) => {
|
|
17
|
-
|
|
18
|
-
return openmrsFetch(url, {
|
|
19
|
-
method: 'POST',
|
|
20
|
-
body: payload,
|
|
21
|
-
headers: {
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
23
|
+
return openmrsFetch(toUrl(payload, uuid), { method: 'POST' });
|
|
25
24
|
};
|
|
26
25
|
|
|
27
26
|
export const deletePaymentPoint = (uuid: string) => {
|
|
28
|
-
|
|
29
|
-
return openmrsFetch(url, {
|
|
27
|
+
return openmrsFetch(`${restBaseUrl}/digihmisbilling/paymentpoint/${uuid}?reason=Retired via billing administration`, {
|
|
30
28
|
method: 'DELETE',
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json',
|
|
33
|
-
},
|
|
34
29
|
});
|
|
35
30
|
};
|
|
36
31
|
|
|
37
|
-
export const handleMutation = (
|
|
38
|
-
return mutate(
|
|
32
|
+
export const handleMutation = (url: string) => {
|
|
33
|
+
return mutate((key) => typeof key === 'string' && key.startsWith(url), undefined, { revalidate: true });
|
|
39
34
|
};
|
|
@@ -91,7 +91,7 @@ const PaymentPointWorkspace: React.FC<PaymentPointWorkspaceProps> = ({
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
closeWorkspaceWithSavedChanges();
|
|
94
|
-
handleMutation(`${restBaseUrl}/
|
|
94
|
+
handleMutation(`${restBaseUrl}/digihmisbilling/paymentpoint`);
|
|
95
95
|
}
|
|
96
96
|
} catch (error) {
|
|
97
97
|
const errorObject = error?.responseBody?.error;
|
package/src/config-schema.ts
CHANGED
|
@@ -38,6 +38,20 @@ export const configSchema: ConfigSchema = {
|
|
|
38
38
|
_description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
|
+
documentBrandingIcon: {
|
|
42
|
+
src: {
|
|
43
|
+
_type: Type.String,
|
|
44
|
+
_default: '/openmrs/spa/form_builder.svg',
|
|
45
|
+
_description:
|
|
46
|
+
'The path or URL to the logo image. If set to an empty string, the default OpenMRS SVG sprite will be used.',
|
|
47
|
+
_validators: [validators.isUrl],
|
|
48
|
+
},
|
|
49
|
+
alt: {
|
|
50
|
+
_type: Type.String,
|
|
51
|
+
_default: 'Logo',
|
|
52
|
+
_description: 'The alternative text for the logo image, displayed when the image cannot be loaded or on hover.',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
41
55
|
inpatientIcon: {
|
|
42
56
|
src: {
|
|
43
57
|
_type: Type.String,
|
|
@@ -126,6 +140,9 @@ export type ConfigObject = {
|
|
|
126
140
|
billingIcon: {
|
|
127
141
|
src: string;
|
|
128
142
|
};
|
|
143
|
+
documentBrandingIcon: {
|
|
144
|
+
src: string;
|
|
145
|
+
};
|
|
129
146
|
inpatientIcon: {
|
|
130
147
|
src: string;
|
|
131
148
|
};
|
package/src/dashboard.meta.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
DataCenter,
|
|
3
3
|
DocumentSketch,
|
|
4
4
|
HospitalBed,
|
|
5
|
+
Image,
|
|
5
6
|
MessageQueue,
|
|
6
7
|
PiggyBank,
|
|
7
8
|
WebServicesTaskDefinitionVersion,
|
|
@@ -45,3 +46,10 @@ export const billingManagementDashboardMeta = {
|
|
|
45
46
|
title: 'Billing Management',
|
|
46
47
|
icon: PiggyBank,
|
|
47
48
|
};
|
|
49
|
+
|
|
50
|
+
export const documentBrandingDashboardMeta = {
|
|
51
|
+
name: 'document-branding',
|
|
52
|
+
slot: 'administration-dashboard-slot',
|
|
53
|
+
title: 'Document Branding',
|
|
54
|
+
icon: Image,
|
|
55
|
+
};
|