@kenyaemr/esm-patient-clinical-view-app 5.4.2-pre.2230 → 5.4.2-pre.2238
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 +7 -7
- package/dist/317.js +1 -1
- package/dist/317.js.map +1 -1
- package/dist/{746.js → 577.js} +2 -2
- package/dist/{746.js.map → 577.js.map} +1 -1
- package/dist/kenyaemr-esm-patient-clinical-view-app.js +1 -1
- package/dist/kenyaemr-esm-patient-clinical-view-app.js.buildmanifest.json +32 -32
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/contact-list/contact-list.resource.tsx +59 -34
- package/src/contact-list/forms/contact-list-update.workspace.tsx +58 -102
- package/src/hooks/useRelationshipTypes.ts +6 -3
- package/src/relationships/forms/baseline-info-form-section.component.tsx +61 -48
- package/src/relationships/relationship.resources.ts +14 -17
- /package/dist/{746.js.LICENSE.txt → 577.js.LICENSE.txt} +0 -0
|
@@ -4,32 +4,17 @@ import { z } from 'zod';
|
|
|
4
4
|
import { Patient } from '../types';
|
|
5
5
|
import { ConfigObject } from '../config-schema';
|
|
6
6
|
import omit from 'lodash/omit';
|
|
7
|
+
import pick from 'lodash/pick';
|
|
7
8
|
|
|
8
9
|
export const BOOLEAN_YES = '1065';
|
|
9
10
|
export const BOOLEAN_NO = '1066';
|
|
10
11
|
export const HIV_EXPOSED_INFANT = 'HIV exposed infant';
|
|
11
12
|
export const INFANT_AGE_THRESHOLD_IN_MONTHS = 24;
|
|
12
13
|
|
|
13
|
-
export const relationshipUpdateFormSchema = z
|
|
14
|
-
.object({
|
|
15
|
-
startDate: z.date({ coerce: true }).max(new Date(), 'Can not be a furture date'),
|
|
16
|
-
endDate: z.date({ coerce: true }).optional(),
|
|
17
|
-
relationshipType: z.string().uuid(),
|
|
18
|
-
})
|
|
19
|
-
.refine(
|
|
20
|
-
(data) => {
|
|
21
|
-
if (data.endDate && data.startDate && data.endDate < data.startDate) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
},
|
|
26
|
-
{ message: 'End date must be after start date', path: ['endDate'] },
|
|
27
|
-
);
|
|
28
|
-
|
|
29
14
|
export const updateRelationship = (relationshipUuid: string, payload: z.infer<typeof relationshipUpdateFormSchema>) => {
|
|
30
15
|
const url = `${restBaseUrl}/relationship/${relationshipUuid}`;
|
|
31
16
|
return openmrsFetch(url, {
|
|
32
|
-
body: JSON.stringify(payload),
|
|
17
|
+
body: JSON.stringify(pick(payload, ['relationshipType', 'startDate', 'endDate'])),
|
|
33
18
|
method: 'POST',
|
|
34
19
|
headers: {
|
|
35
20
|
'Content-Type': 'application/json',
|
|
@@ -100,6 +85,18 @@ export const relationshipFormSchema = z.object({
|
|
|
100
85
|
.optional(),
|
|
101
86
|
});
|
|
102
87
|
|
|
88
|
+
export const relationshipUpdateFormSchema = relationshipFormSchema
|
|
89
|
+
.omit({ personBInfo: true, mode: true, personA: true, personB: true })
|
|
90
|
+
.refine(
|
|
91
|
+
(data) => {
|
|
92
|
+
if (data.endDate && data.startDate && data.endDate < data.startDate) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
},
|
|
97
|
+
{ message: 'End date must be after start date', path: ['endDate'] },
|
|
98
|
+
);
|
|
99
|
+
|
|
103
100
|
export function generateOpenmrsIdentifier(source: string) {
|
|
104
101
|
const abortController = new AbortController();
|
|
105
102
|
return openmrsFetch(`${restBaseUrl}/idgen/identifiersource/${source}/identifier`, {
|
|
File without changes
|