@kenyaemr/esm-ward-app 8.5.1-pre.20 → 8.5.1-pre.25

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.
@@ -29,6 +29,7 @@ import { bedLayoutToBed, getOpenmrsId } from '../ward-view/ward-view.resource';
29
29
  import { EmptyState } from './table-state-components';
30
30
  import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
31
31
  import { type WardConfigObject } from '../config-schema';
32
+ import { HyperLinkPatientCell } from './patient-cells';
32
33
  const AdmittedPatients = () => {
33
34
  const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
34
35
  const { bedLayouts, wardAdmittedPatientsWithBed, isLoading } = wardPatientGroupDetails ?? {};
@@ -71,16 +72,11 @@ const AdmittedPatients = () => {
71
72
  })
72
73
  ?.flat() ?? []
73
74
  ).filter((pat) => {
74
- const noteEncounter = pat?.visit?.encounters?.find(
75
- (encounter) => encounter.encounterType?.uuid === config.doctorsnoteEncounterTypeUuid,
75
+ const ipdDischargeEncounter = pat?.visit?.encounters?.find(
76
+ (encounter) => encounter.encounterType?.uuid === config.ipdDischargeEncounterTypeUuid,
76
77
  );
77
- if (!noteEncounter) return true;
78
- const obs = noteEncounter.obs.find((ob) => ob.concept.uuid === config.referralsConceptUuid);
79
- if (!obs) return true;
80
- const isDischargedIn = [config.referringToAnotherFacilityConceptUuid, config.dischargeHomeConceptUuid].includes(
81
- (obs.value as OpenmrsResource).uuid,
82
- );
83
- return isDischargedIn === false;
78
+ if (!ipdDischargeEncounter) return true;
79
+ return false;
84
80
  });
85
81
  }, [bedLayouts, wardAdmittedPatientsWithBed, config]);
86
82
 
@@ -104,7 +100,9 @@ const AdmittedPatients = () => {
104
100
  id: patient.patient?.uuid ?? index,
105
101
  admissionDate,
106
102
  idNumber: getOpenmrsId(patient.patient?.identifiers ?? []) ?? '--',
107
- name: patient.patient?.person?.display ?? '--',
103
+ name: (
104
+ <HyperLinkPatientCell patientName={patient.patient?.person?.display} patientUuid={patient.patient?.uuid} />
105
+ ),
108
106
  gender: patient.patient?.person?.gender ?? '--',
109
107
  age: patient.patient?.person?.age ?? '--',
110
108
  bedNumber: patient.bed?.bedNumber ?? '--',
@@ -133,18 +131,6 @@ const AdmittedPatients = () => {
133
131
  })
134
132
  }
135
133
  />
136
- <OverflowMenuItem
137
- itemText={t('dischargeIn', 'Discharge In')}
138
- onClick={() => {
139
- launchWorkspace('patient-discharge-workspace', {
140
- wardPatient: patient,
141
- patientUuid: patient.patient.uuid,
142
- formUuid: config.doctorsNoteFormUuid,
143
- workspaceTitle: t('doctorsNote', 'Doctors Note'),
144
- dischargePatientOnSuccesfullSubmission: false,
145
- });
146
- }}
147
- />
148
134
  <OverflowMenuItem
149
135
  itemText={t('discharge', 'Discharge')}
150
136
  onClick={() => {
@@ -152,6 +138,7 @@ const AdmittedPatients = () => {
152
138
  wardPatient: patient,
153
139
  patientUuid: patient.patient.uuid,
154
140
  formUuid: config.inpatientDischargeFormUuid,
141
+ dischargePatientOnSuccesfullSubmission: false,
155
142
  });
156
143
  }}
157
144
  />
@@ -21,6 +21,7 @@ import { getOpenmrsId } from '../ward-view/ward-view.resource';
21
21
  import AdmitPatientButton from '../ward-workspace/admit-patient-button.component';
22
22
  import { EmptyState, ErrorState } from './table-state-components';
23
23
  import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
24
+ import { HyperLinkPatientCell } from './patient-cells';
24
25
 
25
26
  const AwaitingAdmissionPatients = () => {
26
27
  const { t } = useTranslation();
@@ -75,7 +76,9 @@ const AwaitingAdmissionPatients = () => {
75
76
  id: request?.patient?.uuid ?? index,
76
77
  admissionDate,
77
78
  idNumber: getOpenmrsId(request.patient?.identifiers ?? []) ?? '--',
78
- name: request?.patient?.person?.display ?? '--',
79
+ name: (
80
+ <HyperLinkPatientCell patientName={request.patient?.person?.display} patientUuid={request.patient?.uuid} />
81
+ ),
79
82
  gender: request?.patient?.person?.gender ?? '--',
80
83
  age: request?.patient?.person?.age ?? '--',
81
84
  bedNumber: '--',
@@ -15,12 +15,14 @@ import React, { useMemo, useState } from 'react';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { EmptyState } from './table-state-components';
17
17
  import {
18
+ type Encounter,
18
19
  formatDatetime,
19
20
  launchWorkspace,
20
21
  type OpenmrsResource,
21
22
  parseDate,
22
23
  useAppContext,
23
24
  useConfig,
25
+ useEmrConfiguration,
24
26
  usePagination,
25
27
  } from '@openmrs/esm-framework';
26
28
  import { type WardPatient, type WardViewContext } from '../types';
@@ -28,11 +30,17 @@ import { bedLayoutToBed, getOpenmrsId } from '../ward-view/ward-view.resource';
28
30
  import dayjs from 'dayjs';
29
31
  import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
30
32
  import { type WardConfigObject } from '../config-schema';
33
+ import { HyperLinkPatientCell } from './patient-cells';
34
+ import { usePatientDischarge } from '../ward-workspace/kenya-emr-patient-discharge/patient-discharge.resource';
31
35
 
32
36
  const DischargeInPatients = () => {
33
37
  const { t } = useTranslation();
34
38
  const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
35
39
  const { bedLayouts, wardAdmittedPatientsWithBed, isLoading } = wardPatientGroupDetails ?? {};
40
+ //TODO remove (added for demo purposes)
41
+ const { emrConfiguration, isLoadingEmrConfiguration, errorFetchingEmrConfiguration } = useEmrConfiguration();
42
+ const { handleDischarge } = usePatientDischarge();
43
+
36
44
  const config = useConfig<WardConfigObject>();
37
45
  const headers = [
38
46
  { key: 'admissionDate', header: t('admissionDate', 'Admission Date') },
@@ -71,16 +79,11 @@ const DischargeInPatients = () => {
71
79
  })
72
80
  ?.flat() ?? []
73
81
  ).filter((pat) => {
74
- const noteEncounter = pat?.visit?.encounters?.find(
75
- (encounter) => encounter.encounterType?.uuid === config.doctorsnoteEncounterTypeUuid,
76
- );
77
- if (!noteEncounter) return false;
78
- const obs = noteEncounter.obs.find((ob) => ob.concept.uuid === config.referralsConceptUuid);
79
- if (!obs) return false;
80
- const isDischargedIn = [config.referringToAnotherFacilityConceptUuid, config.dischargeHomeConceptUuid].includes(
81
- (obs.value as OpenmrsResource).uuid,
82
+ const ipdDischargeEncounter = pat?.visit?.encounters?.find(
83
+ (encounter) => encounter.encounterType?.uuid === config.ipdDischargeEncounterTypeUuid,
82
84
  );
83
- return isDischargedIn === true;
85
+ if (!ipdDischargeEncounter) return false;
86
+ return true;
84
87
  });
85
88
  }, [bedLayouts, wardAdmittedPatientsWithBed, config]);
86
89
 
@@ -90,7 +93,7 @@ const DischargeInPatients = () => {
90
93
 
91
94
  const tableRows = useMemo(() => {
92
95
  return results.map((patient, index) => {
93
- const { encounterAssigningToCurrentInpatientLocation } = patient.inpatientAdmission ?? {};
96
+ const { encounterAssigningToCurrentInpatientLocation, visit } = patient.inpatientAdmission ?? {};
94
97
 
95
98
  const admissionDate = encounterAssigningToCurrentInpatientLocation?.encounterDatetime
96
99
  ? formatDatetime(parseDate(encounterAssigningToCurrentInpatientLocation!.encounterDatetime!))
@@ -98,11 +101,16 @@ const DischargeInPatients = () => {
98
101
  const daysAdmitted = encounterAssigningToCurrentInpatientLocation?.encounterDatetime
99
102
  ? dayjs(encounterAssigningToCurrentInpatientLocation?.encounterDatetime).diff(dayjs(), 'days')
100
103
  : '--';
104
+
105
+ // TODO Debug why visit for some patient ainit available
106
+
101
107
  return {
102
108
  id: patient.patient?.uuid ?? index,
103
109
  admissionDate,
104
110
  idNumber: getOpenmrsId(patient.patient?.identifiers ?? []) ?? '--',
105
- name: patient.patient?.person?.display ?? '--',
111
+ name: (
112
+ <HyperLinkPatientCell patientName={patient.patient?.person?.display} patientUuid={patient.patient?.uuid} />
113
+ ),
106
114
  gender: patient.patient?.person?.gender ?? '--',
107
115
  age: patient.patient?.person?.age ?? '--',
108
116
  bedNumber: patient.bed?.bedNumber ?? '--',
@@ -113,13 +121,15 @@ const DischargeInPatients = () => {
113
121
  <OverflowMenuItem itemText={t('waivePatient', 'Waive Patient')} onClick={() => {}} />
114
122
  <OverflowMenuItem itemText={t('patientAbscondend', 'Patient Absconded')} onClick={() => {}} />
115
123
  <OverflowMenuItem
116
- itemText={t('discharge', 'Discharge')}
117
- onClick={() => {
118
- launchWorkspace('patient-discharge-workspace', {
119
- wardPatient: patient,
120
- patientUuid: patient.patient.uuid,
121
- formUuid: config.inpatientDischargeFormUuid,
122
- });
124
+ itemText={t('discharged', 'Discharged')}
125
+ onClick={async () => {
126
+ // TODO Clean up
127
+ await handleDischarge({} as Encounter, patient, emrConfiguration as Record<string, any>, patient.visit);
128
+ // launchWorkspace('patient-discharge-workspace', {
129
+ // wardPatient: patient,
130
+ // patientUuid: patient.patient.uuid,
131
+ // formUuid: config.inpatientDischargeFormUuid,
132
+ // });
123
133
  }}
124
134
  />
125
135
  </OverflowMenu>
@@ -17,7 +17,13 @@ import { useTranslation } from 'react-i18next';
17
17
  import { EmptyState, ErrorState } from './table-state-components';
18
18
  import { useIpdDischargeEncounter } from '../hooks/useIpdDischargeEncounter';
19
19
  import { formatDatetime, parseDate } from '@openmrs/esm-framework';
20
- import { PatientAdmissionDateCell, PatientAgeCell, PatientDayInWardCell, PatientGenderCell } from './patient-cells';
20
+ import {
21
+ HyperLinkPatientCell,
22
+ PatientAdmissionDateCell,
23
+ PatientAgeCell,
24
+ PatientDayInWardCell,
25
+ PatientGenderCell,
26
+ } from './patient-cells';
21
27
 
22
28
  const DischargePatients = () => {
23
29
  const { t } = useTranslation();
@@ -51,7 +57,7 @@ const DischargePatients = () => {
51
57
  dischargeDate: encounter.encounterDateTime ? formatDatetime(parseDate(encounter.encounterDateTime)) : '--',
52
58
  admissionDate: <PatientAdmissionDateCell patientUuid={encounter.patient.uuid} encounterUuid={encounter.uuid} />,
53
59
  idNumber: encounter.patient.openmrsId,
54
- name: encounter.patient.name,
60
+ name: <HyperLinkPatientCell patientName={encounter.patient.name} patientUuid={encounter.patient.uuid} />, //encounter.patient.name,
55
61
  gender: <PatientGenderCell patientUuid={encounter.patient.uuid} />,
56
62
  age: <PatientAgeCell patientUuid={encounter.patient.uuid} />,
57
63
  bedNumber: '--',
@@ -69,7 +75,7 @@ const DischargePatients = () => {
69
75
  if (isLoading) return <DataTableSkeleton />;
70
76
  if (error) return <ErrorState error={error} />;
71
77
 
72
- if (!encounters?.length) return <EmptyState message={t('noDischargepatients', 'No Discharge patients')} />;
78
+ if (!encounters?.length) return <EmptyState message={t('noDischargedPatients', 'No Discharged patients')} />;
73
79
 
74
80
  return (
75
81
  <DataTable rows={tableRows} headers={headers} isSortable useZebraStyles>
@@ -1,5 +1,5 @@
1
1
  import { InlineLoading } from '@carbon/react';
2
- import { formatDatetime, parseDate, useConfig, usePatient } from '@openmrs/esm-framework';
2
+ import { ConfigurableLink, formatDatetime, parseDate, useConfig, usePatient } from '@openmrs/esm-framework';
3
3
  import dayjs from 'dayjs';
4
4
  import React, { type FC, useMemo } from 'react';
5
5
  import { useEncounterDetails } from '../hooks/useIpdDischargeEncounter';
@@ -19,6 +19,14 @@ export const PatientAgeCell: FC<CellProps> = ({ patientUuid }) => {
19
19
  if (error) return <p>--</p>;
20
20
  return <div>{age}</div>;
21
21
  };
22
+ export const HyperLinkPatientCell: FC<CellProps & { patientName: string }> = ({ patientUuid, patientName }) => {
23
+ const patientChartUrl = '${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary';
24
+ return (
25
+ <ConfigurableLink to={patientChartUrl} templateParams={{ patientUuid }} style={{ textDecoration: 'none' }}>
26
+ {patientName}
27
+ </ConfigurableLink>
28
+ );
29
+ };
22
30
 
23
31
  export const PatientGenderCell: FC<CellProps> = ({ patientUuid }) => {
24
32
  const { isLoading, patient, error } = usePatient(patientUuid);
@@ -15,7 +15,7 @@ const WardPatientsTable = () => {
15
15
  <Tab>{t('awaitingAdmision', 'Awaiting Admission')}</Tab>
16
16
  <Tab>{t('admitted', 'Admitted')}</Tab>
17
17
  <Tab>{t('dischargeIn', 'Discharge In')}</Tab>
18
- <Tab>{t('discharge', 'Discharge')}</Tab>
18
+ <Tab>{t('discharged', 'Discharged')}</Tab>
19
19
  </TabList>
20
20
  <TabPanels>
21
21
  <TabPanel>
@@ -33,7 +33,7 @@ const DefaultWardView = () => {
33
33
  },
34
34
  { label: t('admitted', 'Admitted'), value: `${summary.admittedPatients}` },
35
35
  { label: t('dischargeIn', 'Discharge In'), value: `${summary.dischargeInPatients}` },
36
- { label: t('discharge', 'Discharge'), value: `${summary.dischargedPatients}` },
36
+ { label: t('discharged', 'Discharged'), value: `${summary.dischargedPatients}` },
37
37
  ];
38
38
  }, [t, summary]);
39
39
 
@@ -12,7 +12,7 @@ import {
12
12
  TableRow,
13
13
  Tile,
14
14
  } from '@carbon/react';
15
- import { ConfigurableLink, ErrorState } from '@openmrs/esm-framework';
15
+ import { ConfigurableLink, ErrorState, useConfig } from '@openmrs/esm-framework';
16
16
  import { CardHeader } from '@openmrs/esm-patient-common-lib';
17
17
  import { useTranslation } from 'react-i18next';
18
18
  import React, { useMemo } from 'react';
@@ -22,6 +22,8 @@ import styles from './linelist-wards.scss';
22
22
  import { type AdmissionLocationFetchResponse } from '../../types';
23
23
  import { EmptyState } from '../../ward-patients/table-state-components';
24
24
  import WardPendingOutCell from './WardPendingOutCell';
25
+ import { type WardConfigObject } from '../../config-schema';
26
+
25
27
  const LineListTable = () => {
26
28
  const {
27
29
  admissionLocations,
@@ -37,6 +39,17 @@ const LineListTable = () => {
37
39
  } = useAdmisiionLocations();
38
40
  const { t } = useTranslation();
39
41
  const headerTitle = t('wards', 'Wards');
42
+ const { mortuaryAdmissionLoctionTagUuid } = useConfig<WardConfigObject>();
43
+
44
+ const filteredAdmissionLocations = useMemo(() => {
45
+ if (!mortuaryAdmissionLoctionTagUuid) return admissionLocations;
46
+
47
+ return admissionLocations.filter((location) => {
48
+ const hasMortuaryTag = location.ward.tags?.some((tag) => tag.uuid === mortuaryAdmissionLoctionTagUuid);
49
+ return !hasMortuaryTag;
50
+ });
51
+ }, [admissionLocations, mortuaryAdmissionLoctionTagUuid]);
52
+
40
53
  const headers = [
41
54
  { key: 'ward', header: t('wardName', 'Ward Name') },
42
55
  { key: 'numberOfBeds', header: t('numberofbeds', 'Number of Beds') },
@@ -46,12 +59,14 @@ const LineListTable = () => {
46
59
  { key: 'pendingOut', header: t('pendingOut', 'Pending Out') },
47
60
  { key: 'action', header: t('action', 'Action') },
48
61
  ];
62
+
49
63
  const calculateOccupancy = (location: AdmissionLocationFetchResponse) => {
50
64
  if (!location.totalBeds || !location.occupiedBeds) return 0;
51
65
  return (((location.totalBeds - location.occupiedBeds) / location.totalBeds) * 100).toFixed(2);
52
66
  };
67
+
53
68
  const tableRows = useMemo(() => {
54
- return admissionLocations.map((location) => {
69
+ return filteredAdmissionLocations.map((location) => {
55
70
  const url = '${openmrsSpaBase}/home/ward/${locationUuid}';
56
71
 
57
72
  return {
@@ -68,19 +83,22 @@ const LineListTable = () => {
68
83
  pendingOut: <WardPendingOutCell locationUuid={location.ward.uuid} />,
69
84
  };
70
85
  });
71
- }, [admissionLocations]);
86
+ }, [filteredAdmissionLocations]);
87
+
72
88
  if (isLoading)
73
89
  return (
74
90
  <Layer className={styles.tableContainer}>
75
91
  <DataTableSkeleton />
76
92
  </Layer>
77
93
  );
94
+
78
95
  if (error)
79
96
  return (
80
97
  <Layer className={styles.tableContainer}>
81
98
  <ErrorState headerTitle={headerTitle} error={error} />
82
99
  </Layer>
83
100
  );
101
+
84
102
  return (
85
103
  <Tile className={styles.tableContainer}>
86
104
  <CardHeader title={headerTitle}>
package/dist/3399.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_kenyaemr_esm_ward_app=globalThis.webpackChunk_kenyaemr_esm_ward_app||[]).push([[3399],{93399:(e,n,t)=>{t.r(n),t.d(n,{PatientDischargeWorkspace:()=>p,default:()=>f});var r=t(90380),o=t.n(r),i=t(93150),a=t(22775),u=t(38254);function l(e,n,t,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void t(e)}u.done?n(l):Promise.resolve(l).then(r,o)}function s(e,n){return(0,u.openmrsFetch)("".concat(u.restBaseUrl,"/beds/").concat(e,"?patientUuid=").concat(n),{method:"DELETE"})}var c=function(e){return(0,u.openmrsFetch)("".concat(u.restBaseUrl,"/encounter"),{method:"POST",body:e,headers:{"Content-Type":"application/json"}})},d=function(){var e,n=(0,i.useTranslation)().t,t=(null!==(e=(0,u.useAppContext)("ward-view-context"))&&void 0!==e?e:{}).wardPatientGroupDetails,r=(0,u.useSession)();return{handleDischarge:function(e,o,i,a){return(d=function(){var e,l,d,p,f,v;return function(e,n){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(l){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}(this,(function(h){switch(h.label){case 0:return h.trys.push([0,4,5,6]),b=o.patient.uuid,w=i.exitFromInpatientEncounterType,y=null==r?void 0:r.sessionLocation,k=null==r?void 0:r.currentProvider,E=a.uuid,C=i.clinicianEncounterRole,l={patient:b,encounterType:w,location:null==y?void 0:y.uuid,encounterProviders:[{provider:null==k?void 0:k.uuid,encounterRole:null==C?void 0:C.uuid}],obs:[],visit:E},[4,c(l)];case 1:if(!(null==(d=h.sent())?void 0:d.ok))throw new Error("Failed to create discharge encounter");return(null==o||null===(e=o.bed)||void 0===e?void 0:e.id)?[4,s(o.bed.id,null==o||null===(p=o.patient)||void 0===p?void 0:p.uuid)]:[3,3];case 2:if(!(null==(f=h.sent())?void 0:f.ok))throw new Error("Failed to remove patient from bed");h.label=3;case 3:return(0,u.showSnackbar)({title:n("patientWasDischarged","Patient was discharged"),kind:"success"}),[3,6];case 4:return v=h.sent(),(0,u.showSnackbar)({title:n("errorDischargingPatient","Error discharging patient"),subtitle:(g=v,m=Error,(null!=m&&"undefined"!=typeof Symbol&&m[Symbol.hasInstance]?m[Symbol.hasInstance](g):g instanceof m)?v.message:"Unknown error occurred"),kind:"error"}),[3,6];case 5:return null==t||t.mutate(),[7];case 6:return[2]}var g,m,b,w,y,k,E,C}))},function(){var e=this,n=arguments;return new Promise((function(t,r){var o=d.apply(e,n);function i(e){l(o,t,r,i,a,"next",e)}function a(e){l(o,t,r,i,a,"throw",e)}i(void 0)}))})();var d}}};function p(e){var n=(0,i.useTranslation)().t,t=e.patientUuid,l=e.closeWorkspace,s=e.closeWorkspaceWithSavedChanges,c=e.wardPatient,p=e.promptBeforeClosing,f=e.formUuid,v=e.dischargePatientOnSuccesfullSubmission,h=void 0===v||v,g=(null!=c?c:{}).visit,m=(0,u.usePatient)(t),b=m.patient,w=m.isLoading,y=m.error,k=(0,u.useEmrConfiguration)(),E=k.emrConfiguration,C=k.isLoadingEmrConfiguration,P=k.errorFetchingEmrConfiguration,S=d().handleDischarge,T=(0,r.useMemo)((function(){var e,n,r;return{view:"form",formUuid:f,visitUuid:null!==(n=null==g?void 0:g.uuid)&&void 0!==n?n:null,visitTypeUuid:null!==(r=null==g||null===(e=g.visitType)||void 0===e?void 0:e.uuid)&&void 0!==r?r:null,patientUuid:null!=t?t:null,patient:b,encounterUuid:"",closeWorkspaceWithSavedChanges:s,closeWorkspace:l,promptBeforeClosing:p,handlePostResponse:function(e){h&&S(e,c,E,g)}}}),[t,g,b,l,p,E,s,S,h,f,c]),U=y||P;return w||C?o().createElement(a.OuH,{description:n("loading","Loading"),iconDescription:n("loading","Loading data...")}):U?o().createElement(a.jeF,{"aria-label":n("error","Error"),kind:"error",onClose:function(){},onCloseButtonClick:function(){},statusIconDescription:"notification",subtitle:n("errorLoadingPatientWorkspace","Error loading patient workspace {{errorMessage}}",{errorMessage:null==U?void 0:U.message}),title:n("error","Error")}):o().createElement("div",null,b&&o().createElement(u.ExtensionSlot,{name:"form-widget-slot",state:T}))}const f=p}}]);
package/dist/3399.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"3399.js","mappings":"6XAaO,SAASA,EAAqBC,EAAeC,GAClD,OAAOC,EAAAA,EAAAA,cAAa,GAAuBF,OAApBG,EAAAA,YAAY,UAA6BF,OAArBD,EAAM,iBAA2B,OAAZC,GAAe,CAC7EG,OAAQ,UAEZ,CAEA,IAwBMC,EAA2B,SAACC,GAChC,OAAOJ,EAAAA,EAAAA,cAAa,GAAe,OAAZC,EAAAA,YAAY,cAAa,CAC9CC,OAAQ,OACRG,KAAMD,EACNE,QAAS,CAAE,eAAgB,qBAE/B,EAaaC,EAAsB,WACjC,IAEEC,EAFI,GAAQC,EAAAA,EAAAA,kBAANC,EACF,GAC+D,QAAnEF,GAAAA,EAAAA,EAAAA,eAAmE,4BAAnEA,IAAAA,EAAAA,EAA2F,CAAC,GADtFG,wBAEFC,GAAUC,EAAAA,EAAAA,cAuDhB,MAAO,CAAEC,gBA5Ce,SACtBC,EACAC,EACAC,EACAC,G,wBAkBMF,EAfEZ,EASAe,EAOsEH,EAApEI,EAUDC,E,mrCAjBmB,O,uBAzE9BtB,EAiEMiB,EAAYM,QA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3BC,sBAAsB,eACtBjC,SAAUhC,EAAE,+BAAgC,mDAAoD,CAC9FkE,aAActB,aAAAA,EAAAA,EAAOX,UAEvBH,MAAO9B,EAAE,QAAS,WAMtB,kBAACmE,MAAAA,KAEEvD,GAAW,kBAACwD,EAAAA,cAAaA,CAACC,KAAK,mBAAmBrB,MAAOA,IAGhE,CAEA,S","sources":["webpack://@kenyaemr/esm-ward-app/./src/ward-workspace/kenya-emr-patient-discharge/patient-discharge.resource.tsx","webpack://@kenyaemr/esm-ward-app/./src/ward-workspace/kenya-emr-patient-discharge/patient-discharge.workspace.tsx"],"names":["removePatientFromBed","bedId","patientUuid","openmrsFetch","restBaseUrl","method","createDischargeEncounter","encounterPayload","body","headers","usePatientDischarge","useAppContext","useTranslation","t","wardPatientGroupDetails","session","useSession","handleDischarge","encounter","wardPatient","emrConfiguration","visit","dischargeResponse","bedRemovalResponse","err","patient","uuid","encounterType","exitFromInpatientEncounterType","location","sessionLocation","currentProvider","visitUuid","clinicianEncounterRole","encounterProviders","provider","encounterRole","obs","ok","Error","bed","id","showSnackbar","title","kind","subtitle","message","mutate","PatientDischargeWorkspace","props","closeWorkspace","closeWorkspaceWithSavedChanges","promptBeforeClosing","formUuid","dischargePatientOnSuccesfullSubmission","usePatient","isLoading","error","useEmrConfiguration","isLoadingEmrConfiguration","errorFetchingEmrConfiguration","state","useMemo","currentVisit","view","visitTypeUuid","visitType","encounterUuid","handlePostResponse","patientError","isLoadingPatient","InlineLoading","description","iconDescription","InlineNotification","aria-label","onClose","onCloseButtonClick","statusIconDescription","errorMessage","div","ExtensionSlot","name"],"sourceRoot":""}