@kenyaemr/esm-appointments-app 7.0.2-pre.65

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.
Files changed (181) hide show
  1. package/.turbo/turbo-build.log +42 -0
  2. package/dist/130.js +2 -0
  3. package/dist/130.js.LICENSE.txt +3 -0
  4. package/dist/130.js.map +1 -0
  5. package/dist/152.js +1 -0
  6. package/dist/152.js.map +1 -0
  7. package/dist/224.js +1 -0
  8. package/dist/224.js.map +1 -0
  9. package/dist/255.js +2 -0
  10. package/dist/255.js.LICENSE.txt +9 -0
  11. package/dist/255.js.map +1 -0
  12. package/dist/271.js +1 -0
  13. package/dist/303.js +1 -0
  14. package/dist/303.js.map +1 -0
  15. package/dist/309.js +1 -0
  16. package/dist/309.js.map +1 -0
  17. package/dist/319.js +1 -0
  18. package/dist/4.js +1 -0
  19. package/dist/4.js.map +1 -0
  20. package/dist/445.js +2 -0
  21. package/dist/445.js.LICENSE.txt +54 -0
  22. package/dist/445.js.map +1 -0
  23. package/dist/460.js +1 -0
  24. package/dist/501.js +1 -0
  25. package/dist/501.js.map +1 -0
  26. package/dist/574.js +1 -0
  27. package/dist/591.js +2 -0
  28. package/dist/591.js.LICENSE.txt +32 -0
  29. package/dist/591.js.map +1 -0
  30. package/dist/644.js +1 -0
  31. package/dist/729.js +1 -0
  32. package/dist/729.js.map +1 -0
  33. package/dist/757.js +1 -0
  34. package/dist/784.js +2 -0
  35. package/dist/784.js.LICENSE.txt +9 -0
  36. package/dist/784.js.map +1 -0
  37. package/dist/788.js +1 -0
  38. package/dist/807.js +1 -0
  39. package/dist/833.js +1 -0
  40. package/dist/857.js +2 -0
  41. package/dist/857.js.LICENSE.txt +5 -0
  42. package/dist/857.js.map +1 -0
  43. package/dist/904.js +1 -0
  44. package/dist/904.js.map +1 -0
  45. package/dist/kenyaemr-esm-appointments-app.js +1 -0
  46. package/dist/kenyaemr-esm-appointments-app.js.buildmanifest.json +699 -0
  47. package/dist/kenyaemr-esm-appointments-app.js.map +1 -0
  48. package/dist/main.js +2 -0
  49. package/dist/main.js.LICENSE.txt +64 -0
  50. package/dist/main.js.map +1 -0
  51. package/dist/routes.json +1 -0
  52. package/jest.config.js +3 -0
  53. package/package.json +57 -0
  54. package/src/admin/appointment-services/appointment-services-hook.ts +31 -0
  55. package/src/admin/appointment-services/appointment-services-validation.ts +17 -0
  56. package/src/admin/appointment-services/appointment-services.component.tsx +182 -0
  57. package/src/admin/appointment-services/appointment-services.scss +25 -0
  58. package/src/appointments/appointment-tabs.component.tsx +48 -0
  59. package/src/appointments/appointment-tabs.scss +53 -0
  60. package/src/appointments/appointment-tabs.test.tsx +55 -0
  61. package/src/appointments/common-components/appointments-actions.component.tsx +86 -0
  62. package/src/appointments/common-components/appointments-actions.scss +4 -0
  63. package/src/appointments/common-components/appointments-actions.test.tsx +201 -0
  64. package/src/appointments/common-components/appointments-table.component.tsx +277 -0
  65. package/src/appointments/common-components/appointments-table.scss +133 -0
  66. package/src/appointments/common-components/appointments-table.test.tsx +134 -0
  67. package/src/appointments/common-components/checkin-button.component.tsx +43 -0
  68. package/src/appointments/common-components/end-appointment-modal.component.tsx +104 -0
  69. package/src/appointments/common-components/end-appointment-modal.test.tsx +80 -0
  70. package/src/appointments/common-components/location-select-option.component.tsx +48 -0
  71. package/src/appointments/details/appointment-details.component.tsx +91 -0
  72. package/src/appointments/details/appointment-details.scss +81 -0
  73. package/src/appointments/details/appointment-details.test.tsx +103 -0
  74. package/src/appointments/scheduled/appointments-list.component.tsx +33 -0
  75. package/src/appointments/scheduled/early-appointments.component.tsx +32 -0
  76. package/src/appointments/scheduled/scheduled-appointments.component.tsx +215 -0
  77. package/src/appointments/scheduled/scheduled-appointments.scss +4 -0
  78. package/src/appointments/unscheduled/unscheduled-appointments.component.tsx +146 -0
  79. package/src/appointments/unscheduled/unscheduled-appointments.test.tsx +131 -0
  80. package/src/appointments/utils.tsx +80 -0
  81. package/src/appointments.component.tsx +44 -0
  82. package/src/appointments.test.tsx +15 -0
  83. package/src/calendar/appointments-calendar-view-view.scss +24 -0
  84. package/src/calendar/appointments-calendar-view.component.tsx +36 -0
  85. package/src/calendar/appointments-calendar-view.test.tsx +22 -0
  86. package/src/calendar/header/calendar-header.component.tsx +34 -0
  87. package/src/calendar/header/calendar-header.scss +32 -0
  88. package/src/calendar/monthly/days-of-week.component.tsx +16 -0
  89. package/src/calendar/monthly/days-of-week.scss +33 -0
  90. package/src/calendar/monthly/monthly-calendar-view.component.tsx +34 -0
  91. package/src/calendar/monthly/monthly-header.module.scss +14 -0
  92. package/src/calendar/monthly/monthly-header.module.tsx +40 -0
  93. package/src/calendar/monthly/monthly-view-workload.scss +188 -0
  94. package/src/calendar/monthly/monthly-workload-view-expanded.component.tsx +42 -0
  95. package/src/calendar/monthly/monthly-workload-view.component.tsx +109 -0
  96. package/src/config-schema.ts +151 -0
  97. package/src/constants.ts +55 -0
  98. package/src/createDashboardLink.component.tsx +39 -0
  99. package/src/dashboard.meta.ts +21 -0
  100. package/src/declarations.d.ts +4 -0
  101. package/src/empty-state/empty-data-illustration.component.tsx +39 -0
  102. package/src/empty-state/empty-state.component.tsx +32 -0
  103. package/src/empty-state/empty-state.scss +69 -0
  104. package/src/form/appointments-form.component.tsx +891 -0
  105. package/src/form/appointments-form.resource.ts +165 -0
  106. package/src/form/appointments-form.scss +113 -0
  107. package/src/form/appointments-form.test.tsx +212 -0
  108. package/src/header/appointments-header.component.tsx +79 -0
  109. package/src/header/appointments-header.scss +95 -0
  110. package/src/header/appointments-illustration.component.tsx +22 -0
  111. package/src/helpers/excel.ts +61 -0
  112. package/src/helpers/functions.ts +82 -0
  113. package/src/helpers/index.ts +2 -0
  114. package/src/helpers/time.tsx +15 -0
  115. package/src/home/home-appointments.component.tsx +22 -0
  116. package/src/home/home-appointments.scss +10 -0
  117. package/src/hooks/patientAppointmentContext.ts +15 -0
  118. package/src/hooks/selectedDateContext.ts +10 -0
  119. package/src/hooks/useAppointmentList.ts +48 -0
  120. package/src/hooks/useAppointmentService.ts +11 -0
  121. package/src/hooks/useAppointmentsCalendar.ts +68 -0
  122. package/src/hooks/useClinicalMetrics.ts +79 -0
  123. package/src/hooks/useDefaultLocation.ts +14 -0
  124. package/src/hooks/useOverlay.tsx +45 -0
  125. package/src/hooks/usePatientAppointmentHistory.ts +49 -0
  126. package/src/hooks/useProviders.ts +18 -0
  127. package/src/hooks/useTodaysVisits.ts +19 -0
  128. package/src/hooks/useUnscheduledAppointments.ts +45 -0
  129. package/src/index.ts +111 -0
  130. package/src/metrics/appointments-metrics.component.tsx +71 -0
  131. package/src/metrics/appointments-metrics.scss +15 -0
  132. package/src/metrics/appointments-metrics.test.tsx +49 -0
  133. package/src/metrics/metrics-card.component.tsx +76 -0
  134. package/src/metrics/metrics-card.scss +77 -0
  135. package/src/metrics/metrics-header.component.tsx +62 -0
  136. package/src/metrics/metrics-header.scss +33 -0
  137. package/src/past-visit/encounter-list.component.tsx +54 -0
  138. package/src/past-visit/past-visit.component.tsx +106 -0
  139. package/src/past-visit/past-visit.resource.ts +25 -0
  140. package/src/past-visit/past-visit.scss +106 -0
  141. package/src/patient-appointments/patient-appointments-action-menu.component.tsx +65 -0
  142. package/src/patient-appointments/patient-appointments-action-menu.scss +7 -0
  143. package/src/patient-appointments/patient-appointments-base.component.tsx +165 -0
  144. package/src/patient-appointments/patient-appointments-base.scss +85 -0
  145. package/src/patient-appointments/patient-appointments-base.test.tsx +91 -0
  146. package/src/patient-appointments/patient-appointments-cancel-modal.component.tsx +66 -0
  147. package/src/patient-appointments/patient-appointments-detailed-summary.component.tsx +15 -0
  148. package/src/patient-appointments/patient-appointments-header.scss +27 -0
  149. package/src/patient-appointments/patient-appointments-header.tsx +42 -0
  150. package/src/patient-appointments/patient-appointments-overview.component.tsx +35 -0
  151. package/src/patient-appointments/patient-appointments-overview.scss +7 -0
  152. package/src/patient-appointments/patient-appointments-table.scss +0 -0
  153. package/src/patient-appointments/patient-appointments-table.tsx +128 -0
  154. package/src/patient-appointments/patient-appointments.resource.ts +72 -0
  155. package/src/patient-appointments/patient-upcoming-appointments-card.component.tsx +122 -0
  156. package/src/patient-appointments/patient-upcoming-appointments-card.scss +46 -0
  157. package/src/patient-search/patient-search.component.tsx +34 -0
  158. package/src/patient-search/patient-search.scss +23 -0
  159. package/src/root.component.tsx +26 -0
  160. package/src/root.scss +50 -0
  161. package/src/routes.json +153 -0
  162. package/src/scheduled-appointments-config-schema.ts +169 -0
  163. package/src/types/index.ts +189 -0
  164. package/src/workload/monthly-view-workload/monthly-view.component.tsx +69 -0
  165. package/src/workload/monthly-view-workload/monthly-workload.scss +223 -0
  166. package/src/workload/monthly-view-workload/monthlyWorkCard.tsx +45 -0
  167. package/src/workload/workload-card.component.tsx +31 -0
  168. package/src/workload/workload.component.tsx +47 -0
  169. package/src/workload/workload.resource.ts +78 -0
  170. package/src/workload/workload.scss +92 -0
  171. package/translations/am.json +148 -0
  172. package/translations/ar.json +148 -0
  173. package/translations/en.json +159 -0
  174. package/translations/es.json +148 -0
  175. package/translations/fr.json +148 -0
  176. package/translations/he.json +148 -0
  177. package/translations/km.json +148 -0
  178. package/translations/zh.json +148 -0
  179. package/translations/zh_CN.json +148 -0
  180. package/tsconfig.json +5 -0
  181. package/webpack.config.js +1 -0
@@ -0,0 +1,153 @@
1
+ {
2
+ "$schema": "https://json.openmrs.org/routes.schema.json",
3
+ "backendDependencies": {
4
+ "webservices.rest": "^2.2.0"
5
+ },
6
+ "modals": [
7
+ {
8
+ "name": "end-appointment-modal",
9
+ "component": "endAppointmentModal"
10
+ }
11
+ ],
12
+ "extensions": [
13
+ {
14
+ "name": "home-appointments",
15
+ "slot": "homepage-widgets-slot",
16
+ "component": "homeAppointments",
17
+ "order": 1
18
+ },
19
+ {
20
+ "name": "clinical-appointments-dashboard-link",
21
+ "slot": "homepage-dashboard-slot",
22
+ "component": "appointmentsDashboardLink",
23
+ "meta": {
24
+ "name": "appointments",
25
+ "slot": "clinical-appointments-dashboard-slot",
26
+ "title": "Appointments"
27
+ }
28
+ },
29
+ {
30
+ "component": "root",
31
+ "name": "clinical-appointments-dashboard",
32
+ "slot": "clinical-appointments-dashboard-slot"
33
+ },
34
+ {
35
+ "name": "appointments-calendar-dashboard-link",
36
+ "slot": "calendar-dashboard-slot",
37
+ "component": "appointmentsCalendarDashboardLink"
38
+ },
39
+ {
40
+ "name": "check-in-appointment-modal",
41
+ "slot": "todays-appointment-slot",
42
+ "component": "checkInModal"
43
+ },
44
+ {
45
+ "name": "todays-appointments-dashboard",
46
+ "slot": "todays-appointment-slot",
47
+ "component": "homeAppointments"
48
+ },
49
+ {
50
+ "name": "expected-appointments-panel",
51
+ "slot": "scheduled-appointments-panels-slot",
52
+ "component": "appointmentsList"
53
+ },
54
+ {
55
+ "name": "checked-in-appointments-panel",
56
+ "slot": "scheduled-appointments-panels-slot",
57
+ "component": "appointmentsList"
58
+ },
59
+ {
60
+ "name": "completed-appointments-panel",
61
+ "slot": "scheduled-appointments-panels-slot",
62
+ "component": "appointmentsList"
63
+ },
64
+ {
65
+ "name": "missed-appointments-panel",
66
+ "slot": "scheduled-appointments-panels-slot",
67
+ "component": "appointmentsList"
68
+ },
69
+ {
70
+ "name": "cancelled-appointments-panel",
71
+ "slot": "scheduled-appointments-panels-slot",
72
+ "component": "appointmentsList"
73
+ },
74
+ {
75
+ "name": "early-appointments-panel",
76
+ "component": "earlyAppointments"
77
+ },
78
+ {
79
+ "name": "appointments-form-workspace",
80
+ "component": "appointmentsFormWorkspace",
81
+ "meta": {
82
+ "title": {
83
+ "key": "createNewAppointment",
84
+ "default": "Create new appointment"
85
+ }
86
+ }
87
+ },
88
+ {
89
+ "name": "patient-appointments-summary-dashboard",
90
+ "component": "patientAppointmentsSummaryDashboardLink",
91
+ "slot": "patient-chart-dashboard-slot",
92
+ "order": 11,
93
+ "meta": {
94
+ "columns": 1,
95
+ "columnSpan": 1,
96
+ "slot": "patient-chart-appointments-dashboard-slot",
97
+ "title": "Appointments",
98
+ "path": "Appointments"
99
+ }
100
+ },
101
+ {
102
+ "name": "patientAppointments-details-widget",
103
+ "component": "patientAppointmentsDetailedSummary",
104
+ "slot": "patient-chart-appointments-dashboard-slot",
105
+ "meta": {
106
+ "columnSpan": 1
107
+ }
108
+ },
109
+ {
110
+ "name": "patient-upcoming-appointment-widget",
111
+ "component": "patientUpcomingAppointmentsWidget",
112
+ "slot": "upcoming-appointment-slot"
113
+ },
114
+ {
115
+ "name": "patient-appointment-cancel-confirmation-dialog",
116
+ "component": "patientAppointmentsCancelConfirmationDialog"
117
+ },
118
+ {
119
+ "name": "edit-appointments-form",
120
+ "component": "appointementForm",
121
+ "meta": {
122
+ "title":{
123
+ "key":"editAppointment",
124
+ "default":"Edit Appointment"
125
+ }
126
+ }
127
+ },
128
+ {
129
+ "name": "search-patient",
130
+ "component": "searchPatient"
131
+ },
132
+ {
133
+ "name": "create-appointment",
134
+ "component": "appointementForm",
135
+ "meta": {
136
+ "title": {
137
+ "key":"appointmentForm",
138
+ "default":"Appointment Form"
139
+ }
140
+ }
141
+ },
142
+ {
143
+ "name": "add-appointment",
144
+ "component": "appointementForm",
145
+ "meta": {
146
+ "title": {
147
+ "key": "createNewAppointment",
148
+ "default": "Create new appointment"
149
+ }
150
+ }
151
+ }
152
+ ]
153
+ }
@@ -0,0 +1,169 @@
1
+ import { Type } from '@openmrs/esm-framework';
2
+
3
+ export const expectedAppointmentsPanelConfigSchema = {
4
+ title: {
5
+ _type: Type.String,
6
+ _description: 'The title to display, may be a translation key or plain text',
7
+ _default: 'expected',
8
+ },
9
+ status: {
10
+ _type: Type.String,
11
+ _description:
12
+ 'The status to filter on, must be one of the valid appointment statues: Requested, Scheduled, CheckedIn, Completed, Cancelled, Missed',
13
+ _default: 'Scheduled',
14
+ },
15
+ showForPastDate: {
16
+ _type: Type.Boolean,
17
+ _description: 'Whether to display this panel when viewing scheduled appointments for a past date',
18
+ _default: false,
19
+ },
20
+ showForToday: {
21
+ _type: Type.Boolean,
22
+ _description: 'Whether to display this panel when viewing scheduled appointments for today',
23
+ _default: true,
24
+ },
25
+ showForFutureDate: {
26
+ _type: Type.Boolean,
27
+ _description: 'Whether to display this panel when viewing scheduled appointments for a future date',
28
+ _default: true,
29
+ },
30
+ };
31
+
32
+ export const checkedInAppointmentsPanelConfigSchema = {
33
+ title: {
34
+ _type: Type.String,
35
+ _description: 'The title to display, may be a translation key or plain text',
36
+ _default: 'checkedIn',
37
+ },
38
+ status: {
39
+ _type: Type.String,
40
+ _description:
41
+ 'The status to filter on, must be one of the valid appointment statues: Requested, Scheduled, CheckedIn, Completed, Cancelled, Missed',
42
+ _default: 'CheckedIn',
43
+ },
44
+ showForPastDate: {
45
+ _type: Type.Boolean,
46
+ _description: 'Whether to display this panel when viewing scheduled appointments for a past date',
47
+ _default: false,
48
+ },
49
+ showForToday: {
50
+ _type: Type.Boolean,
51
+ _description: 'Whether to display this panel when viewing scheduled appointments for today',
52
+ _default: true,
53
+ },
54
+ showForFutureDate: {
55
+ _type: Type.Boolean,
56
+ _description: 'Whether to display this panel when viewing scheduled appointments for a future date',
57
+ _default: false,
58
+ },
59
+ };
60
+
61
+ export const completedAppointmentsPanelConfigSchema = {
62
+ title: {
63
+ _type: Type.String,
64
+ _description: 'The title to display, may be a translation key or plain text',
65
+ _default: 'completed',
66
+ },
67
+ status: {
68
+ _type: Type.String,
69
+ _description:
70
+ 'The status to filter on, must be one of the valid appointment statues: Requested, Scheduled, CheckedIn, Completed, Cancelled, Missed',
71
+ _default: 'Completed',
72
+ },
73
+ showForPastDate: {
74
+ _type: Type.Boolean,
75
+ _description: 'Whether to display this panel when viewing scheduled appointments for a past date',
76
+ _default: true,
77
+ },
78
+ showForToday: {
79
+ _type: Type.Boolean,
80
+ _description: 'Whether to display this panel when viewing scheduled appointments for today',
81
+ _default: true,
82
+ },
83
+ showForFutureDate: {
84
+ _type: Type.Boolean,
85
+ _description: 'Whether to display this panel when viewing scheduled appointments for a future date',
86
+ _default: false,
87
+ },
88
+ };
89
+
90
+ export const missedAppointmentsPanelConfigSchema = {
91
+ title: {
92
+ _type: Type.String,
93
+ _description: 'The title to display, may be a translation key or plain text',
94
+ _default: 'missed',
95
+ },
96
+ status: {
97
+ _type: Type.String,
98
+ _description:
99
+ 'The status to filter on, must be one of the valid appointment statues: Requested, Scheduled, CheckedIn, Completed, Cancelled, Missed',
100
+ _default: 'Missed',
101
+ },
102
+ showForPastDate: {
103
+ _type: Type.Boolean,
104
+ _description: 'Whether to display this panel when viewing scheduled appointments for a past date',
105
+ _default: true,
106
+ },
107
+ showForToday: {
108
+ _type: Type.Boolean,
109
+ _description: 'Whether to display this panel when viewing scheduled appointments for today',
110
+ _default: false,
111
+ },
112
+ showForFutureDate: {
113
+ _type: Type.Boolean,
114
+ _description: 'Whether to display this panel when viewing scheduled appointments for a future date',
115
+ _default: false,
116
+ },
117
+ };
118
+
119
+ export const cancelledAppointmentsPanelConfigSchema = {
120
+ title: {
121
+ _type: Type.String,
122
+ _description: 'The title to display, may be a translation key or plain text',
123
+ _default: 'cancelled',
124
+ },
125
+ status: {
126
+ _type: Type.String,
127
+ _description:
128
+ 'The status to filter on, must be one of the valid appointment statues: Requested, Scheduled, CheckedIn, Completed, Cancelled, Missed',
129
+ _default: 'Cancelled',
130
+ },
131
+ showForPastDate: {
132
+ _type: Type.Boolean,
133
+ _description: 'Whether to display this panel when viewing scheduled appointments for a past date',
134
+ _default: true,
135
+ },
136
+ showForToday: {
137
+ _type: Type.Boolean,
138
+ _description: 'Whether to display this panel when viewing scheduled appointments for today',
139
+ _default: true,
140
+ },
141
+ showForFutureDate: {
142
+ _type: Type.Boolean,
143
+ _description: 'Whether to display this panel when viewing scheduled appointments for a future date',
144
+ _default: true,
145
+ },
146
+ };
147
+
148
+ export const earlyAppointmentsPanelConfigSchema = {
149
+ title: {
150
+ _type: Type.String,
151
+ _description: 'The title to display, may be a translation key or plain text',
152
+ _default: 'cameEarly',
153
+ },
154
+ showForPastDate: {
155
+ _type: Type.Boolean,
156
+ _description: 'Whether to display this panel when viewing scheduled appointments for a past date',
157
+ _default: true,
158
+ },
159
+ showForToday: {
160
+ _type: Type.Boolean,
161
+ _description: 'Whether to display this panel when viewing scheduled appointments for today',
162
+ _default: true,
163
+ },
164
+ showForFutureDate: {
165
+ _type: Type.Boolean,
166
+ _description: 'Whether to display this panel when viewing scheduled appointments for a future date',
167
+ _default: false,
168
+ },
169
+ };
@@ -0,0 +1,189 @@
1
+ import { type OpenmrsResource } from '@openmrs/esm-framework';
2
+ import { type amPm } from '../helpers';
3
+
4
+ export enum SearchTypes {
5
+ BASIC = 'basic',
6
+ ADVANCED = 'advanced',
7
+ SEARCH_RESULTS = 'search_results',
8
+ SCHEDULED_VISITS = 'scheduled-visits',
9
+ }
10
+
11
+ export interface AppointmentLocation {
12
+ uuid: string;
13
+ name: string;
14
+ }
15
+
16
+ // note that the API supports two other statuses that we are not currently supporting: "Requested" and "WaitList"
17
+ export enum AppointmentStatus {
18
+ SCHEDULED = 'Scheduled',
19
+ CANCELLED = 'Cancelled',
20
+ MISSED = 'Missed',
21
+ CHECKEDIN = 'CheckedIn',
22
+ COMPLETED = 'Completed',
23
+ }
24
+
25
+ export enum AppointmentKind {
26
+ SCHEDULED = 'Scheduled',
27
+ WALKIN = 'WalkIn',
28
+ VIRTUAL = 'Virtual',
29
+ }
30
+
31
+ // TODO: remove interface elements that aren't actually present on the Appointment object returned from the Appointment API
32
+ export interface Appointment {
33
+ appointmentKind: AppointmentKind;
34
+ appointmentNumber: string;
35
+ comments: string;
36
+ endDateTime: Date | number | any;
37
+ location: AppointmentLocation;
38
+ patient: {
39
+ identifier: string;
40
+ identifiers: Array<Identifier>;
41
+ name: string;
42
+ uuid: string;
43
+ age?: string;
44
+ gender?: string;
45
+ };
46
+ provider: OpenmrsResource;
47
+ providers: Array<OpenmrsResource>;
48
+ recurring: boolean;
49
+ service: AppointmentService;
50
+ startDateTime: string | any;
51
+ dateAppointmentScheduled: string | any;
52
+ status: AppointmentStatus;
53
+ uuid: string;
54
+ additionalInfo?: string | null;
55
+ serviceTypes?: Array<ServiceTypes> | null;
56
+ voided: boolean;
57
+ extensions: {};
58
+ teleconsultationLink: string | null;
59
+ }
60
+
61
+ export interface AppointmentsFetchResponse {
62
+ data: Array<Appointment>;
63
+ }
64
+ export interface AppointmentService {
65
+ appointmentServiceId: number;
66
+ creatorName: string;
67
+ description: string;
68
+ durationMins?: number;
69
+ endTime: string;
70
+ initialAppointmentStatus: string;
71
+ location?: OpenmrsResource;
72
+ maxAppointmentsLimit: number | null;
73
+ name: string;
74
+ specialityUuid?: OpenmrsResource | {};
75
+ startTime: string;
76
+ uuid: string;
77
+ serviceTypes?: Array<ServiceTypes>;
78
+ color?: string;
79
+ startTimeTimeFormat?: amPm;
80
+ endTimeTimeFormat?: amPm;
81
+ }
82
+
83
+ export interface ServiceTypes {
84
+ duration: number;
85
+ name: string;
86
+ uuid: string;
87
+ }
88
+
89
+ export interface DashboardConfig {
90
+ name: string;
91
+ slot: string;
92
+ title: string;
93
+ }
94
+
95
+ export interface Observation {
96
+ uuid: string;
97
+ concept: {
98
+ uuid: string;
99
+ display: string;
100
+ conceptClass: {
101
+ uuid: string;
102
+ display: string;
103
+ };
104
+ };
105
+ display: string;
106
+ groupMembers: null | Array<{
107
+ uuid: string;
108
+ concept: {
109
+ uuid: string;
110
+ display: string;
111
+ };
112
+ value: {
113
+ uuid: string;
114
+ display: string;
115
+ };
116
+ }>;
117
+ value: any;
118
+ obsDatetime: string;
119
+ }
120
+
121
+ export interface AppointmentPayload {
122
+ patientUuid: string;
123
+ serviceUuid: string;
124
+ dateAppointmentScheduled: string;
125
+ startDateTime: string;
126
+ endDateTime: string;
127
+ appointmentKind: string;
128
+ providers?: Array<OpenmrsResource>;
129
+ locationUuid: string;
130
+ comments: string;
131
+ status?: string;
132
+ appointmentNumber?: string;
133
+ uuid?: string;
134
+ providerUuid?: string | OpenmrsResource;
135
+ }
136
+ export interface AppointmentCountMap {
137
+ allAppointmentsCount: number;
138
+ missedAppointmentsCount;
139
+ appointmentDate: number;
140
+ appointmentServiceUuid: string;
141
+ }
142
+
143
+ export interface AppointmentSummary {
144
+ appointmentService: OpenmrsResource;
145
+ appointmentCountMap: Record<string, AppointmentCountMap>;
146
+ }
147
+ export interface Provider {
148
+ uuid: string;
149
+ display: string;
150
+ comments: string;
151
+ response?: string;
152
+ person: OpenmrsResource;
153
+ name?: string;
154
+ }
155
+
156
+ export enum DurationPeriod {
157
+ monthly,
158
+ weekly,
159
+ daily,
160
+ }
161
+ export interface Identifier {
162
+ identifier: string;
163
+ identifierName?: string;
164
+ }
165
+
166
+ export interface DailyAppointmentsCountByService {
167
+ appointmentDate: string;
168
+ services: Array<{
169
+ serviceName: string;
170
+ serviceUuid: string;
171
+ count: number;
172
+ }>;
173
+ }
174
+
175
+ export interface RecurringPattern {
176
+ type: 'DAY' | 'WEEK';
177
+ period: number;
178
+ endDate: string;
179
+ daysOfWeek?: Array<string>; //'MONDAY' | 'TUESDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY'>;
180
+ }
181
+
182
+ export interface RecurringAppointmentsPayload {
183
+ appointmentRequest: AppointmentPayload;
184
+ recurringPattern: RecurringPattern;
185
+ }
186
+
187
+ export interface PatientDetails {
188
+ dateOfBirth: string;
189
+ }
@@ -0,0 +1,69 @@
1
+ import dayjs from 'dayjs';
2
+ import React, { useContext } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import DaysOfWeekCard from '../../calendar/monthly/days-of-week.component';
5
+ import { monthDays } from '../../helpers';
6
+ import SelectedDateContext from '../../hooks/selectedDateContext';
7
+ import styles from './monthly-workload.scss';
8
+ import MonthlyWorkloadCard from './monthlyWorkCard';
9
+
10
+ interface MonthlyCalendarViewProps {
11
+ calendarWorkload: Array<{ count: number; date: string }>;
12
+ dateToDisplay?: string;
13
+ onDateClick?: (pickedDate: Date) => void;
14
+ }
15
+
16
+ const monthFormat = 'MMMM, YYYY';
17
+ const MonthlyCalendarView: React.FC<MonthlyCalendarViewProps> = ({
18
+ calendarWorkload,
19
+ dateToDisplay = '',
20
+ onDateClick,
21
+ }) => {
22
+ const { selectedDate } = useContext(SelectedDateContext);
23
+ const daysInWeek = ['SUN', 'MON', 'TUE', 'WED', 'THUR', 'FRI', 'SAT'];
24
+ const monthViewDate = dateToDisplay === '' ? selectedDate : dateToDisplay;
25
+ const handleClick = (date: Date) => {
26
+ if (onDateClick) {
27
+ onDateClick(date);
28
+ }
29
+ };
30
+ const { t } = useTranslation();
31
+ const daysInWeeks = daysInWeek.map((day) => t(day));
32
+ return (
33
+ <div className={styles.calendarViewContainer}>
34
+ <>
35
+ <div className={styles.container}></div>
36
+ <span className={styles.headerContainer}>{dayjs(monthViewDate).format(monthFormat)}</span>
37
+ <div className={styles.workLoadCard}>
38
+ {daysInWeeks?.map((day, i) => <DaysOfWeekCard key={`${day}-${i}`} dayOfWeek={day} />)}
39
+ </div>
40
+ <div className={styles.wrapper}>
41
+ <div className={styles.monthlyCalendar}>
42
+ {monthDays(dayjs(monthViewDate)).map((dateTime, i) => (
43
+ <div
44
+ onClick={() => handleClick(dayjs(dateTime).toDate())}
45
+ key={i}
46
+ className={`${styles.monthlyWorkloadCard} ${
47
+ dayjs(dateTime).format('YYYY-MM-DD') === dayjs(monthViewDate).format('YYYY-MM-DD')
48
+ ? styles.selectedDate
49
+ : ''
50
+ }`}>
51
+ <MonthlyWorkloadCard
52
+ key={i}
53
+ date={dateTime}
54
+ isActive={dayjs(dateToDisplay).format('DD-MM-YYYY') === dayjs(dateTime).format('DD-MM-YYYY')}
55
+ count={
56
+ calendarWorkload.find((calendar) => calendar.date === dayjs(dateTime).format('YYYY-MM-DD'))
57
+ ?.count ?? 0
58
+ }
59
+ />
60
+ </div>
61
+ ))}
62
+ </div>
63
+ </div>
64
+ </>
65
+ </div>
66
+ );
67
+ };
68
+
69
+ export default MonthlyCalendarView;