@openmrs/esm-appointments-app 5.2.2-pre.2397 → 5.2.2-pre.2402
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 +6 -6
- package/dist/755.js +1 -0
- package/dist/755.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-appointments-app.js +1 -1
- package/dist/openmrs-esm-appointments-app.js.buildmanifest.json +23 -23
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/appointments/unscheduled/unscheduled-appointments.component.tsx +1 -2
- package/src/appointments-calendar/daily/daily-view-workload.test.tsx +1 -0
- package/src/appointments-calendar/weekly/weekly-view-workload.test.tsx +1 -0
- package/src/helpers/functions.ts +7 -2
- package/src/hooks/useAppointmentList.tsx +7 -3
- package/src/hooks/useUnscheduledAppointments.tsx +26 -3
- package/src/types/index.ts +6 -1
- package/dist/690.js +0 -1
- package/dist/690.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var _openmrs_esm_appointments_app;(()=>{"use strict";var e,r,t,n,o,a,i,l,s,u,p,f,d,c,h,m={5605:(e,r,t)=>{var n={"./start":()=>Promise.all([t.e(255),t.e(549),t.e(268),t.e(325),t.e(
|
|
1
|
+
var _openmrs_esm_appointments_app;(()=>{"use strict";var e,r,t,n,o,a,i,l,s,u,p,f,d,c,h,m={5605:(e,r,t)=>{var n={"./start":()=>Promise.all([t.e(255),t.e(549),t.e(268),t.e(325),t.e(755)]).then((()=>()=>t(3755)))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},v={};function g(e){var r=v[e];if(void 0!==r)return r.exports;var t=v[e]={id:e,loaded:!1,exports:{}};return m[e].call(t.exports,t,t.exports,g),t.loaded=!0,t.exports}g.m=m,g.c=v,g.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return g.d(r,{a:r}),r},g.d=(e,r)=>{for(var t in r)g.o(r,t)&&!g.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},g.f={},g.e=e=>Promise.all(Object.keys(g.f).reduce(((r,t)=>(g.f[t](e,r),r)),[])),g.u=e=>e+".js",g.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),g.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="@openmrs/esm-appointments-app:",g.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,l;if(void 0!==o)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var p=s[u];if(p.getAttribute("src")==t||p.getAttribute("data-webpack")==r+o){i=p;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,g.nc&&i.setAttribute("nonce",g.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var f=(r,n)=>{i.onerror=i.onload=null,clearTimeout(d);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((e=>e(n))),r)return r(n)},d=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),l&&document.head.appendChild(i)}},g.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},g.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{g.S={};var e={},r={};g.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];g.o(g.S,t)||(g.S[t]={});var a=g.S[t],i="@openmrs/esm-appointments-app",l=(e,r,t,n)=>{var o=a[e]=a[e]||{},l=o[r];(!l||!l.loaded&&(!n!=!l.eager?n:i>l.from))&&(o[r]={get:t,from:i,eager:!!n})},s=[];return"default"===t&&(l("@openmrs/esm-framework","5.3.1-pre.1182",(()=>Promise.all([g.e(130),g.e(268)]).then((()=>()=>g(130))))),l("react-i18next","11.18.6",(()=>Promise.all([g.e(268),g.e(610)]).then((()=>()=>g(610))))),l("react-router-dom","6.4.3",(()=>Promise.all([g.e(591),g.e(268)]).then((()=>()=>g(6591))))),l("react","18.2.0",(()=>g.e(784).then((()=>()=>g(2784))))),l("swr/_internal","2.0.1",(()=>Promise.all([g.e(729),g.e(268)]).then((()=>()=>g(4729))))),l("swr/immutable","2.0.1",(()=>Promise.all([g.e(255),g.e(268),g.e(325),g.e(152)]).then((()=>()=>g(2303)))))),e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;g.g.importScripts&&(e=g.g.location+"");var r=g.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&!e;)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),g.p=e})(),t=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],l=(typeof i)[0];if(a!=l)return"o"==a&&"n"==l||"s"==l||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,a=1;a<e.length;a++)n--,t+="u"==(typeof(l=e[a]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(a=1;a<e.length;a++){var l=e[a];i.push(0===l?"not("+s()+")":1===l?"("+s()+" || "+s()+")":2===l?i.pop()+" "+i.pop():o(l))}return s();function s(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var n=e[0],o=n<0;o&&(n=-n-1);for(var i=0,l=1,s=!0;;l++,i++){var u,p,f=l<e.length?(typeof e[l])[0]:"";if(i>=r.length||"o"==(p=(typeof(u=r[i]))[0]))return!s||("u"==f?l>n&&!o:""==f!=o);if("u"==p){if(!s||"u"!=f)return!1}else if(s)if(f==p)if(l<=n){if(u!=e[l])return!1}else{if(o?u>e[l]:u<e[l])return!1;u!=e[l]&&(s=!1)}else if("s"!=f&&"n"!=f){if(o||l<=n)return!1;s=!1,l--}else{if(l<=n||p<f!=o)return!1;s=!1}else"s"!=f&&"n"!=f&&(s=!1,l--)}}var d=[],c=d.pop.bind(d);for(i=1;i<e.length;i++){var h=e[i];d.push(1==h?c()|c():2==h?c()&c():h?a(h,r):!c())}return!!c()},i=(e,r)=>{var t=e[r];return Object.keys(t).reduce(((e,r)=>!e||!t[e].loaded&&n(e,r)?r:e),0)},l=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+o(n)+")",s=(e,r,t,n)=>{var o=i(e,t);return a(n,o)||u(l(e,t,o,n)),p(e[t][o])},u=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},p=e=>(e.loaded=1,e.get()),f=(e=>function(r,t,n,o){var a=g.I(r);return a&&a.then?a.then(e.bind(e,r,g.S[r],t,n,o)):e(0,g.S[r],t,n,o)})(((e,r,t,n,o)=>r&&g.o(r,t)?s(r,0,t,n):o())),d={},c={268:()=>f("default","react",[1,18],(()=>g.e(784).then((()=>()=>g(2784))))),3325:()=>f("default","swr/_internal",[1,2],(()=>g.e(729).then((()=>()=>g(4729))))),2870:()=>f("default","@openmrs/esm-framework",[1,5],(()=>g.e(130).then((()=>()=>g(130))))),4924:()=>f("default","react-i18next",[1,11],(()=>g.e(469).then((()=>()=>g(610))))),8744:()=>f("default","react-router-dom",[1,6],(()=>g.e(591).then((()=>()=>g(6591))))),9198:()=>f("default","swr/immutable",[1,2],(()=>g.e(303).then((()=>()=>g(2303)))))},h={268:[268],325:[3325],755:[2870,4924,8744,9198]},g.f.consumes=(e,r)=>{g.o(h,e)&&h[e].forEach((e=>{if(g.o(d,e))return r.push(d[e]);var t=r=>{d[e]=0,g.m[e]=t=>{delete g.c[e],t.exports=r()}},n=r=>{delete d[e],g.m[e]=t=>{throw delete g.c[e],r}};try{var o=c[e]();o.then?r.push(d[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}))},(()=>{var e={529:0};g.f.j=(r,t)=>{var n=g.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(268|325)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=g.p+g.u(r),i=new Error;g.l(a,(t=>{if(g.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,l]=t,s=0;if(a.some((r=>0!==e[r]))){for(n in i)g.o(i,n)&&(g.m[n]=i[n]);l&&l(g)}for(r&&r(t);s<a.length;s++)o=a[s],g.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=globalThis.webpackChunk_openmrs_esm_appointments_app=globalThis.webpackChunk_openmrs_esm_appointments_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),g.nc=void 0;var b=g(5605);_openmrs_esm_appointments_app=b})();
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"initial": true,
|
|
81
81
|
"entry": true,
|
|
82
82
|
"recorded": false,
|
|
83
|
-
"size":
|
|
83
|
+
"size": 4554486,
|
|
84
84
|
"sizes": {
|
|
85
85
|
"consume-shared": 252,
|
|
86
|
-
"javascript":
|
|
86
|
+
"javascript": 4533564,
|
|
87
87
|
"share-init": 252,
|
|
88
88
|
"runtime": 20418
|
|
89
89
|
},
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"auxiliaryFiles": [
|
|
101
101
|
"main.js.map"
|
|
102
102
|
],
|
|
103
|
-
"hash": "
|
|
103
|
+
"hash": "19e9fdbd1fa9d5af",
|
|
104
104
|
"childrenByOrder": {}
|
|
105
105
|
},
|
|
106
106
|
{
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"auxiliaryFiles": [
|
|
289
289
|
"openmrs-esm-appointments-app.js.map"
|
|
290
290
|
],
|
|
291
|
-
"hash": "
|
|
291
|
+
"hash": "65cec1492ef63e70",
|
|
292
292
|
"childrenByOrder": {}
|
|
293
293
|
},
|
|
294
294
|
{
|
|
@@ -395,23 +395,26 @@
|
|
|
395
395
|
"initial": false,
|
|
396
396
|
"entry": false,
|
|
397
397
|
"recorded": false,
|
|
398
|
-
"
|
|
398
|
+
"reason": "reused as split chunk (cache group: defaultVendors)",
|
|
399
|
+
"size": 26095,
|
|
399
400
|
"sizes": {
|
|
400
|
-
"javascript":
|
|
401
|
-
"consume-shared": 168
|
|
401
|
+
"javascript": 26095
|
|
402
402
|
},
|
|
403
403
|
"names": [],
|
|
404
|
-
"idHints": [
|
|
404
|
+
"idHints": [
|
|
405
|
+
"vendors"
|
|
406
|
+
],
|
|
405
407
|
"runtime": [
|
|
406
|
-
"@openmrs/esm-appointments-app"
|
|
408
|
+
"@openmrs/esm-appointments-app",
|
|
409
|
+
"main"
|
|
407
410
|
],
|
|
408
411
|
"files": [
|
|
409
|
-
"
|
|
412
|
+
"729.js"
|
|
410
413
|
],
|
|
411
414
|
"auxiliaryFiles": [
|
|
412
|
-
"
|
|
415
|
+
"729.js.map"
|
|
413
416
|
],
|
|
414
|
-
"hash": "
|
|
417
|
+
"hash": "72c13b51b2b3243a",
|
|
415
418
|
"childrenByOrder": {}
|
|
416
419
|
},
|
|
417
420
|
{
|
|
@@ -419,26 +422,23 @@
|
|
|
419
422
|
"initial": false,
|
|
420
423
|
"entry": false,
|
|
421
424
|
"recorded": false,
|
|
422
|
-
"
|
|
423
|
-
"size": 26095,
|
|
425
|
+
"size": 496039,
|
|
424
426
|
"sizes": {
|
|
425
|
-
"javascript":
|
|
427
|
+
"javascript": 495871,
|
|
428
|
+
"consume-shared": 168
|
|
426
429
|
},
|
|
427
430
|
"names": [],
|
|
428
|
-
"idHints": [
|
|
429
|
-
"vendors"
|
|
430
|
-
],
|
|
431
|
+
"idHints": [],
|
|
431
432
|
"runtime": [
|
|
432
|
-
"@openmrs/esm-appointments-app"
|
|
433
|
-
"main"
|
|
433
|
+
"@openmrs/esm-appointments-app"
|
|
434
434
|
],
|
|
435
435
|
"files": [
|
|
436
|
-
"
|
|
436
|
+
"755.js"
|
|
437
437
|
],
|
|
438
438
|
"auxiliaryFiles": [
|
|
439
|
-
"
|
|
439
|
+
"755.js.map"
|
|
440
440
|
],
|
|
441
|
-
"hash": "
|
|
441
|
+
"hash": "0f35a34da06ecae3",
|
|
442
442
|
"childrenByOrder": {}
|
|
443
443
|
},
|
|
444
444
|
{
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2402"}
|
package/package.json
CHANGED
|
@@ -53,7 +53,6 @@ const UnscheduledAppointments: React.FC = () => {
|
|
|
53
53
|
];
|
|
54
54
|
|
|
55
55
|
const { results, currentPage, goTo } = usePagination(searchResults, pageSize);
|
|
56
|
-
|
|
57
56
|
const rowData = results?.map((visit) => ({
|
|
58
57
|
id: `${visit.uuid}`,
|
|
59
58
|
name: (
|
|
@@ -64,9 +63,9 @@ const UnscheduledAppointments: React.FC = () => {
|
|
|
64
63
|
{visit.name}
|
|
65
64
|
</ConfigurableLink>
|
|
66
65
|
),
|
|
67
|
-
identifier: visit.identifier,
|
|
68
66
|
gender: visit.gender === 'F' ? 'Female' : 'Male',
|
|
69
67
|
phoneNumber: visit.phoneNumber === '' ? '--' : visit.phoneNumber,
|
|
68
|
+
identifier: visit?.identifier,
|
|
70
69
|
}));
|
|
71
70
|
|
|
72
71
|
if (isLoading) {
|
package/src/helpers/functions.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppointmentSummary, Appointment } from '../types';
|
|
2
2
|
import { formatDate, parseDate, formatDatetime } from '@openmrs/esm-framework';
|
|
3
3
|
import dayjs, { Dayjs } from 'dayjs';
|
|
4
|
+
import { configSchema } from '../config-schema';
|
|
4
5
|
|
|
5
6
|
export const getHighestAppointmentServiceLoad = (appointmentSummary: Array<any> = []) => {
|
|
6
7
|
const groupedAppointments = appointmentSummary?.map(({ countMap, serviceName }) => ({
|
|
@@ -63,7 +64,9 @@ export const mapAppointmentProperties = (appointment: Appointment, t?: Function)
|
|
|
63
64
|
comments: appointment.comments ? appointment.comments : '--',
|
|
64
65
|
appointmentNumber: appointment.appointmentNumber,
|
|
65
66
|
color: appointment?.service?.color ?? '',
|
|
66
|
-
identifier: appointment
|
|
67
|
+
identifier: appointment?.patient?.identifiers?.find(
|
|
68
|
+
(identifier) => identifier.identifierName === configSchema.patientIdentifierType._default,
|
|
69
|
+
).identifier,
|
|
67
70
|
duration: appointment.service?.durationMins
|
|
68
71
|
? appointment?.service?.durationMins + t('minutes', 'min')
|
|
69
72
|
: getAppointmentDuration(appointment.startDateTime, appointment.endDateTime),
|
|
@@ -90,7 +93,9 @@ export const getAppointment = (appointment: Appointment) => {
|
|
|
90
93
|
comments: appointment.comments ? appointment.comments : '--',
|
|
91
94
|
appointmentNumber: appointment.appointmentNumber,
|
|
92
95
|
providers: appointment.providers,
|
|
93
|
-
identifier: appointment
|
|
96
|
+
identifier: appointment?.patient?.identifiers?.find(
|
|
97
|
+
(identifier) => identifier.identifierName === configSchema.patientIdentifierType._default,
|
|
98
|
+
).identifier,
|
|
94
99
|
};
|
|
95
100
|
return formattedAppointment;
|
|
96
101
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
2
|
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
3
|
-
import { AppointmentService, Provider } from '../types';
|
|
3
|
+
import { AppointmentService, Identifier, Provider } from '../types';
|
|
4
4
|
import { useAppointmentDate } from '../helpers';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
|
+
import { configSchema } from '../config-schema';
|
|
6
7
|
|
|
7
8
|
interface AppointmentPatientList {
|
|
8
9
|
uuid: string;
|
|
@@ -14,11 +15,12 @@ interface AppointmentPatientList {
|
|
|
14
15
|
name: string;
|
|
15
16
|
uuid: string;
|
|
16
17
|
age: number;
|
|
17
|
-
|
|
18
|
+
identifiers?: Array<Identifier>;
|
|
18
19
|
};
|
|
19
20
|
providers: Array<Provider>;
|
|
20
21
|
service: AppointmentService;
|
|
21
22
|
startDateTime: string;
|
|
23
|
+
identifier: string;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export const useAppointmentList = (appointmentStatus: string, date?: string) => {
|
|
@@ -68,7 +70,9 @@ function toAppointmentObject(appointment: AppointmentPatientList) {
|
|
|
68
70
|
return {
|
|
69
71
|
name: appointment.patient.name,
|
|
70
72
|
patientUuid: appointment.patient.uuid,
|
|
71
|
-
identifier: appointment
|
|
73
|
+
identifier: appointment?.patient?.identifiers?.find(
|
|
74
|
+
(identifier) => identifier.identifierName === configSchema.patientIdentifierType._default,
|
|
75
|
+
).identifier,
|
|
72
76
|
dateTime: appointment.startDateTime,
|
|
73
77
|
serviceType: appointment.service?.name,
|
|
74
78
|
provider: appointment?.providers[0]?.['name'] ?? '',
|
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
2
|
import useSWR from 'swr';
|
|
3
|
-
import { useAppointmentDate } from '../helpers';
|
|
3
|
+
import { mapAppointmentProperties, useAppointmentDate } from '../helpers';
|
|
4
|
+
import { Identifier } from '../types';
|
|
5
|
+
import { configSchema } from '../config-schema';
|
|
4
6
|
|
|
5
7
|
export interface Response {
|
|
6
8
|
age: number;
|
|
7
9
|
dob: number;
|
|
8
10
|
gender: string;
|
|
9
|
-
|
|
11
|
+
identifiers: Array<Identifier>;
|
|
10
12
|
name: string;
|
|
11
13
|
uuid: string;
|
|
12
14
|
phoneNumber: string;
|
|
15
|
+
visit: {
|
|
16
|
+
stopDateTime: Date;
|
|
17
|
+
startDateTime: Date;
|
|
18
|
+
visitType: string;
|
|
19
|
+
};
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
export function useUnscheduledAppointments() {
|
|
16
23
|
const { currentAppointmentDate } = useAppointmentDate();
|
|
17
24
|
const url = `/ws/rest/v1/appointment/unScheduledAppointment?forDate=${currentAppointmentDate}`;
|
|
18
25
|
const { data, error, isLoading } = useSWR<{ data: Array<Response> }>(url, openmrsFetch, { errorRetryCount: 2 });
|
|
19
|
-
|
|
26
|
+
const appointments = data?.data?.map((appointment) => toAppointmentObject(appointment));
|
|
27
|
+
|
|
28
|
+
return { isLoading, data: appointments ?? [], error };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function toAppointmentObject(appointment: Response) {
|
|
32
|
+
return {
|
|
33
|
+
name: appointment.name,
|
|
34
|
+
identifier: appointment?.identifiers?.find(
|
|
35
|
+
(identifier) => identifier.identifierName === configSchema.patientIdentifierType._default,
|
|
36
|
+
).identifier,
|
|
37
|
+
dateTime: appointment?.visit.startDateTime,
|
|
38
|
+
gender: appointment.gender,
|
|
39
|
+
phoneNumber: appointment.phoneNumber,
|
|
40
|
+
age: appointment.age,
|
|
41
|
+
uuid: appointment.uuid,
|
|
42
|
+
};
|
|
20
43
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface Appointment {
|
|
|
15
15
|
endDateTime: Date | number | any;
|
|
16
16
|
location: OpenmrsResource;
|
|
17
17
|
patient: {
|
|
18
|
-
|
|
18
|
+
identifiers: Array<Identifier>;
|
|
19
19
|
name: string;
|
|
20
20
|
uuid: string;
|
|
21
21
|
age?: string;
|
|
@@ -194,3 +194,8 @@ export enum AppointmentTypes {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
export type CalendarType = 'daily' | 'weekly' | 'monthly';
|
|
197
|
+
|
|
198
|
+
export interface Identifier {
|
|
199
|
+
identifier: string;
|
|
200
|
+
identifierName?: string;
|
|
201
|
+
}
|