@openmrs/esm-patient-immunizations-app 4.0.1-pre.375 → 4.0.1-pre.383

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.
@@ -1,7 +1,7 @@
1
- @openmrs/esm-patient-immunizations-app:build: cache hit, replaying output b432061da21d9548
2
- @openmrs/esm-patient-immunizations-app:build: assets by chunk 921 KiB (id hint: vendors)
1
+ @openmrs/esm-patient-immunizations-app:build: cache hit, replaying output 1440c8e2dc5bc5b9
2
+ @openmrs/esm-patient-immunizations-app:build: assets by chunk 922 KiB (id hint: vendors)
3
3
  @openmrs/esm-patient-immunizations-app:build:  assets by status 853 KiB [big]
4
- @openmrs/esm-patient-immunizations-app:build:  asset 965.js 446 KiB [emitted] [minimized] [big] (id hint: vendors) 1 related asset
4
+ @openmrs/esm-patient-immunizations-app:build:  asset 718.js 446 KiB [emitted] [minimized] [big] (id hint: vendors) 1 related asset
5
5
  @openmrs/esm-patient-immunizations-app:build:  asset 858.js 407 KiB [emitted] [minimized] [big] (id hint: vendors) 1 related asset
6
6
  @openmrs/esm-patient-immunizations-app:build:  asset 206.js 45.4 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
7
7
  @openmrs/esm-patient-immunizations-app:build:  asset 709.js 19 KiB [emitted] [minimized] (id hint: vendors)
@@ -27,6 +27,6 @@
27
27
  @openmrs/esm-patient-immunizations-app:build: This can impact web performance.
28
28
  @openmrs/esm-patient-immunizations-app:build: Assets:
29
29
  @openmrs/esm-patient-immunizations-app:build:  858.js (407 KiB)
30
- @openmrs/esm-patient-immunizations-app:build:  965.js (446 KiB)
30
+ @openmrs/esm-patient-immunizations-app:build:  718.js (446 KiB)
31
31
  @openmrs/esm-patient-immunizations-app:build: 
32
- @openmrs/esm-patient-immunizations-app:build: webpack 5.74.0 compiled with 1 warning in 97130 ms
32
+ @openmrs/esm-patient-immunizations-app:build: webpack 5.74.0 compiled with 1 warning in 86399 ms
package/dist/355.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_openmrs_esm_patient_immunizations_app=self.webpackChunk_openmrs_esm_patient_immunizations_app||[]).push([[355],{2996:(e,t,n)=>{n.d(t,{Z:()=>u});var i=n(9601),r=n.n(i),a=n(2609),o=n.n(a)()(r());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-immunizations__immunizations-form__immunizationSequenceSelect___MlJNX{margin:1rem 2rem 1rem}.-esm-patient-immunizations__immunizations-form__form___K6IzX{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}.-esm-patient-immunizations__immunizations-form__button___L8zJi{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-immunizations__immunizations-form__tablet___zycFW{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-immunizations__immunizations-form__desktop___c6k1T{padding:0rem}",""]),o.locals={immunizationSequenceSelect:"-esm-patient-immunizations__immunizations-form__immunizationSequenceSelect___MlJNX",form:"-esm-patient-immunizations__immunizations-form__form___K6IzX",button:"-esm-patient-immunizations__immunizations-form__button___L8zJi",tablet:"-esm-patient-immunizations__immunizations-form__tablet___zycFW",desktop:"-esm-patient-immunizations__immunizations-form__desktop___c6k1T"};const u=o},1756:(e,t,n)=>{n.d(t,{V:()=>d,j:()=>v});var i=n(906),r=n(2449),a=n(772),o=n(468),u=n(4402),c=n(3012),l=n(3939),s=function(e){var t,n,r=null==e?void 0:e.resource,a=null==r?void 0:r.id,o=null==r||null===(t=r.manufacturer)||void 0===t?void 0:t.display,u=null==r?void 0:r.lotNumber,c=(null==r||null===(n=r.protocolApplied)||void 0===n?void 0:n.length)>0&&(null==r?void 0:r.protocolApplied[0]);return{immunizationObsUuid:a,manufacturer:o,lotNumber:u,sequenceLabel:null==c?void 0:c.series,sequenceNumber:null==c?void 0:c.doseNumberPositiveInt,occurrenceDateTime:(0,i.formatDate)(new Date(null==r?void 0:r.occurrenceDateTime)),expirationDate:(0,i.formatDate)(new Date(null==r?void 0:r.expirationDate))}},m=function(e){var t;return(0,r.Z)(null==e||null===(t=e.vaccineCode)||void 0===t?void 0:t.coding,(function(e){return(0,u.Z)(e.system)}))},d=function(e){var t=(0,o.Z)(e.entry,(function(e){var t;return null===(t=m(e.resource))||void 0===t?void 0:t.code}));return(0,c.Z)(t,(function(e){var t,n=(0,c.Z)(e,s),i=m(null===(t=e[0])||void 0===t?void 0:t.resource);return{vaccineName:null==i?void 0:i.display,vaccineUuid:null==i?void 0:i.code,existingDoses:(0,l.Z)(n,[function(e){return(0,a.Z)(e,"occurrenceDateTime")}],["desc"])}}))};function f(e,t){return{type:e,reference:"".concat(e,"/").concat(t)}}var v=function(e,t,n,r){return{resourceType:"Immunization",status:"completed",id:e.immunizationObsUuid,vaccineCode:{coding:[{code:e.vaccineUuid,display:e.vaccineName}]},patient:f("Patient",e.patientUuid),encounter:f("Encounter",t),occurrenceDateTime:(0,i.parseDate)(e.vaccinationDate),expirationDate:(0,i.parseDate)(e.expirationDate),location:f("Location",n),performer:[{actor:f("Practitioner",r)}],manufacturer:{display:e.manufacturer},lotNumber:e.lotNumber,protocolApplied:[{doseNumberPositiveInt:e.currentDose.sequenceNumber,series:e.currentDose.sequenceLabel}]}}},2458:(e,t,n)=>{n.d(t,{s:()=>i});var i=new(n(2444).BehaviorSubject)(null)},5355:(e,t,n)=>{n.r(t),n.d(t,{default:()=>j});var i=n(268),r=n.n(i),a=n(4924),o=n(9694),u=n(906),c=n(8108),l=n(1756),s=n(2458),m=n(6062),d=n.n(m),f=n(4036),v=n.n(f),p=n(6793),b=n.n(p),y=n(7892),_=n.n(y),g=n(1173),h=n.n(g),S=n(2464),z=n.n(S),D=n(2996),N={};N.styleTagTransform=z(),N.setAttributes=_(),N.insert=b().bind(null,"head"),N.domAPI=v(),N.insertStyleElement=h(),d()(D.Z,N);const O=D.Z&&D.Z.locals?D.Z.locals:void 0;function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){x(e,t,n[t])}))}return e}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,u=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){u=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(u)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const j=function(e){var t,n,m=e.patientUuid,d=e.closeWorkspace,f=q((0,i.useState)({vaccineName:"",vaccineUuid:"",immunizationObsUuid:"",vaccinationDate:null,sequences:[],currentDose:{},expirationDate:null,lotNumber:"",manufacturer:"",formChanged:!1}),2),v=f[0],p=f[1],b=function(e,t){return p((function(n){return i=w({},n),r=null!=(r=x({},e,t))?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(r)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(r,e))})),i;var i,r}))},y=(0,a.useTranslation)().t,_=(0,u.useSession)(),g=(0,u.useVisit)(m).currentVisit,h="tablet"===(0,u.useLayoutType)(),S=!!v.immunizationObsUuid,z=!S&&!!v.vaccinationDate,D=S&&v.formChanged;(0,i.useEffect)((function(){var e=s.s.subscribe((function(e){return e&&p(e)}));return function(){return e.unsubscribe()}}),[]);var N,E=r().useCallback((function(e){var t,n;e.preventDefault();var i=null==g?void 0:g.uuid,r=null==_||null===(t=_.sessionLocation)||void 0===t?void 0:t.uuid,a=null==_||null===(n=_.currentProvider)||void 0===n?void 0:n.uuid,o=w({patientUuid:m},v),s=new AbortController;return(0,c.eu)((0,l.j)(o,i,r,a),m,v.immunizationObsUuid,s).then((function(e){201===e.status&&d(),(0,u.showToast)({kind:"success",description:y("vaccinationSaved","Vaccination saved successfully")})}),(function(e){(0,u.showNotification)({title:y("errorSaving","Error saving vaccination"),kind:"error",critical:!0,description:null==e?void 0:e.message})})),function(){return s.abort()}}),[null==_||null===(t=_.sessionLocation)||void 0===t?void 0:t.uuid,d,v,m,null==_||null===(n=_.currentProvider)||void 0===n?void 0:n.uuid,null==g?void 0:g.uuid,y]);return r().createElement(o.l09,{className:O.form,onSubmit:E,"data-testid":"immunization-form"},r().createElement("div",null,r().createElement("h4",{className:O.immunizationSequenceSelect},"".concat(y("vaccine","Vaccine")," : ").concat(null==v?void 0:v.vaccineName)," "),(N=v.sequences)&&(null==N?void 0:N.length)>0&&r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.PhF,{id:"sequence",name:"sequence",value:v.currentDose.sequenceNumber,onChange:function(e){var t=v.sequences.find((function(t){return n=e.target.value,!isNaN(n)&&t.sequenceNumber===parseInt(e.target.value);var n}))||{};b("currentDose",t)},className:"immunizationSequenceSelect",labelText:y("sequence","Sequence")},r().createElement(o.QlF,{text:y("pleaseSelect","Please select"),value:"DEFAULT"},y("pleaseSelect","Please select")),v.sequences.map((function(e){return r().createElement(o.QlF,{key:e.sequenceNumber,text:e.sequenceLabel,value:e.sequenceNumber},y(e.sequenceLabel,e.sequenceLabel))})))),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.Mtg,{id:"vaccinationDate",className:"vaccinationDate",maxDate:(new Date).toISOString(),dateFormat:"d/m/Y",datePickerType:"single",value:v.vaccinationDate,onChange:function(e){var t=q(e,1)[0];return b("vaccinationDate",t.toISOString())}},r().createElement(o.aj6,{id:"date-picker-calendar-id",placeholder:"dd/mm/yyyy",labelText:y("vaccinationDate","Vaccination Date"),type:"text"}))),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.Mtg,{id:"vaccinationExpiration",className:"vaccinationExpiration",minDate:(new Date).toISOString(),dateFormat:"d/m/Y",datePickerType:"single",value:v.expirationDate,onChange:function(e){var t=q(e,1)[0];return b("expirationDate",t.toISOString())}},r().createElement(o.aj6,{id:"date-picker-calendar-id",placeholder:"dd/mm/yyyy",labelText:y("expirationDate","Expiration Date"),type:"text"}))),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.oil,{type:"text",id:"lotNumber",labelText:y("lotNumber","Lot Number"),value:v.lotNumber,onChange:function(e){return b("lotNumber",e.target.value)}})),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.oil,{type:"text",id:"manufacturer",labelText:y("manufacturer","Manufacturer"),value:v.manufacturer,onChange:function(e){return b("manufacturer",e.target.value)}}))),r().createElement(o.uVA,{className:h?O.tablet:O.desktop},r().createElement(o.zxk,{className:O.button,kind:"secondary",onClick:function(){return d()}},y("cancel","Cancel")),r().createElement(o.zxk,{className:O.button,kind:"primary",disabled:S?!D:!z},y("save","Save"))))}},8108:(e,t,n)=>{n.d(t,{dv:()=>l,eu:()=>s,iX:()=>c}),n(5047);var i=n(9857),r=n(906),a=n(9867),o=n(1756);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function c(){var e,t,n,o=(0,r.useConfig)().immunizationsConfig,c=null==o?void 0:o.vaccinesConceptSet,l=(t=c.split(":"),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,u=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){u=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(u)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],m=l[1],d="/ws/rest/v1/concept?source=".concat(s,"&code=").concat(m,"&v=full"),f="/ws/rest/v1/concept/".concat(c,"?v=full"),v=(0,i.ZP)((e=c,(0,a.Z)(e,":")?d:f),r.openmrsFetch),p=v.data,b=v.error;return{data:p?p.data.results[0]:null,isError:b,isLoading:!p&&!b}}function l(e){var t="".concat(r.fhirBaseUrl,"/Immunization?patient=").concat(e),n=(0,i.ZP)(t,r.openmrsFetch),a=n.data,u=n.error,c=n.isValidating,l=a?(0,o.V)(a.data):null;return{data:a?l:null,isError:u,isLoading:!a&&!u,isValidating:c}}function s(e,t,n,i){var a="".concat(r.fhirBaseUrl,"/Immunization");return n&&(a="".concat(a,"/").concat(n)),(0,r.openmrsFetch)(a,{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:i.signal})}}}]);
1
+ "use strict";(self.webpackChunk_openmrs_esm_patient_immunizations_app=self.webpackChunk_openmrs_esm_patient_immunizations_app||[]).push([[355],{2996:(e,t,n)=>{n.d(t,{Z:()=>u});var i=n(9601),r=n.n(i),a=n(2609),o=n.n(a)()(r());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-immunizations__immunizations-form__immunizationSequenceSelect___MlJNX{margin:1rem 2rem 1rem}.-esm-patient-immunizations__immunizations-form__form___K6IzX{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}.-esm-patient-immunizations__immunizations-form__button___L8zJi{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-immunizations__immunizations-form__tablet___zycFW{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-immunizations__immunizations-form__desktop___c6k1T{padding:0rem}",""]),o.locals={immunizationSequenceSelect:"-esm-patient-immunizations__immunizations-form__immunizationSequenceSelect___MlJNX",form:"-esm-patient-immunizations__immunizations-form__form___K6IzX",button:"-esm-patient-immunizations__immunizations-form__button___L8zJi",tablet:"-esm-patient-immunizations__immunizations-form__tablet___zycFW",desktop:"-esm-patient-immunizations__immunizations-form__desktop___c6k1T"};const u=o},1756:(e,t,n)=>{n.d(t,{V:()=>d,j:()=>v});var i=n(906),r=n(2449),a=n(772),o=n(468),u=n(4402),c=n(3012),l=n(3939),s=function(e){var t,n,r=null==e?void 0:e.resource,a=null==r?void 0:r.id,o=null==r||null===(t=r.manufacturer)||void 0===t?void 0:t.display,u=null==r?void 0:r.lotNumber,c=(null==r||null===(n=r.protocolApplied)||void 0===n?void 0:n.length)>0&&(null==r?void 0:r.protocolApplied[0]);return{immunizationObsUuid:a,manufacturer:o,lotNumber:u,sequenceLabel:null==c?void 0:c.series,sequenceNumber:null==c?void 0:c.doseNumberPositiveInt,occurrenceDateTime:(0,i.formatDate)(new Date(null==r?void 0:r.occurrenceDateTime)),expirationDate:(0,i.formatDate)(new Date(null==r?void 0:r.expirationDate))}},m=function(e){var t;return(0,r.Z)(null==e||null===(t=e.vaccineCode)||void 0===t?void 0:t.coding,(function(e){return(0,u.Z)(e.system)}))},d=function(e){var t=(0,o.Z)(e.entry,(function(e){var t;return null===(t=m(e.resource))||void 0===t?void 0:t.code}));return(0,c.Z)(t,(function(e){var t,n=(0,c.Z)(e,s),i=m(null===(t=e[0])||void 0===t?void 0:t.resource);return{vaccineName:null==i?void 0:i.display,vaccineUuid:null==i?void 0:i.code,existingDoses:(0,l.Z)(n,[function(e){return(0,a.Z)(e,"occurrenceDateTime")}],["desc"])}}))};function f(e,t){return{type:e,reference:"".concat(e,"/").concat(t)}}var v=function(e,t,n,r){return{resourceType:"Immunization",status:"completed",id:e.immunizationObsUuid,vaccineCode:{coding:[{code:e.vaccineUuid,display:e.vaccineName}]},patient:f("Patient",e.patientUuid),encounter:f("Encounter",t),occurrenceDateTime:(0,i.parseDate)(e.vaccinationDate),expirationDate:(0,i.parseDate)(e.expirationDate),location:f("Location",n),performer:[{actor:f("Practitioner",r)}],manufacturer:{display:e.manufacturer},lotNumber:e.lotNumber,protocolApplied:[{doseNumberPositiveInt:e.currentDose.sequenceNumber,series:e.currentDose.sequenceLabel}]}}},2458:(e,t,n)=>{n.d(t,{s:()=>i});var i=new(n(2444).BehaviorSubject)(null)},5355:(e,t,n)=>{n.r(t),n.d(t,{default:()=>j});var i=n(268),r=n.n(i),a=n(4924),o=n(4732),u=n(906),c=n(8108),l=n(1756),s=n(2458),m=n(6062),d=n.n(m),f=n(4036),v=n.n(f),p=n(6793),b=n.n(p),y=n(7892),_=n.n(y),g=n(1173),h=n.n(g),S=n(2464),z=n.n(S),D=n(2996),N={};N.styleTagTransform=z(),N.setAttributes=_(),N.insert=b().bind(null,"head"),N.domAPI=v(),N.insertStyleElement=h(),d()(D.Z,N);const O=D.Z&&D.Z.locals?D.Z.locals:void 0;function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){x(e,t,n[t])}))}return e}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,u=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){u=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(u)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const j=function(e){var t,n,m=e.patientUuid,d=e.closeWorkspace,f=q((0,i.useState)({vaccineName:"",vaccineUuid:"",immunizationObsUuid:"",vaccinationDate:null,sequences:[],currentDose:{},expirationDate:null,lotNumber:"",manufacturer:"",formChanged:!1}),2),v=f[0],p=f[1],b=function(e,t){return p((function(n){return i=w({},n),r=null!=(r=x({},e,t))?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n.push.apply(n,i)}return n}(Object(r)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(r,e))})),i;var i,r}))},y=(0,a.useTranslation)().t,_=(0,u.useSession)(),g=(0,u.useVisit)(m).currentVisit,h="tablet"===(0,u.useLayoutType)(),S=!!v.immunizationObsUuid,z=!S&&!!v.vaccinationDate,D=S&&v.formChanged;(0,i.useEffect)((function(){var e=s.s.subscribe((function(e){return e&&p(e)}));return function(){return e.unsubscribe()}}),[]);var N,E=r().useCallback((function(e){var t,n;e.preventDefault();var i=null==g?void 0:g.uuid,r=null==_||null===(t=_.sessionLocation)||void 0===t?void 0:t.uuid,a=null==_||null===(n=_.currentProvider)||void 0===n?void 0:n.uuid,o=w({patientUuid:m},v),s=new AbortController;return(0,c.eu)((0,l.j)(o,i,r,a),m,v.immunizationObsUuid,s).then((function(e){201===e.status&&d(),(0,u.showToast)({kind:"success",description:y("vaccinationSaved","Vaccination saved successfully")})}),(function(e){(0,u.showNotification)({title:y("errorSaving","Error saving vaccination"),kind:"error",critical:!0,description:null==e?void 0:e.message})})),function(){return s.abort()}}),[null==_||null===(t=_.sessionLocation)||void 0===t?void 0:t.uuid,d,v,m,null==_||null===(n=_.currentProvider)||void 0===n?void 0:n.uuid,null==g?void 0:g.uuid,y]);return r().createElement(o.l09,{className:O.form,onSubmit:E,"data-testid":"immunization-form"},r().createElement("div",null,r().createElement("h4",{className:O.immunizationSequenceSelect},"".concat(y("vaccine","Vaccine")," : ").concat(null==v?void 0:v.vaccineName)," "),(N=v.sequences)&&(null==N?void 0:N.length)>0&&r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.PhF,{id:"sequence",name:"sequence",value:v.currentDose.sequenceNumber,onChange:function(e){var t=v.sequences.find((function(t){return n=e.target.value,!isNaN(n)&&t.sequenceNumber===parseInt(e.target.value);var n}))||{};b("currentDose",t)},className:"immunizationSequenceSelect",labelText:y("sequence","Sequence")},r().createElement(o.QlF,{text:y("pleaseSelect","Please select"),value:"DEFAULT"},y("pleaseSelect","Please select")),v.sequences.map((function(e){return r().createElement(o.QlF,{key:e.sequenceNumber,text:e.sequenceLabel,value:e.sequenceNumber},y(e.sequenceLabel,e.sequenceLabel))})))),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.Mtg,{id:"vaccinationDate",className:"vaccinationDate",maxDate:(new Date).toISOString(),dateFormat:"d/m/Y",datePickerType:"single",value:v.vaccinationDate,onChange:function(e){var t=q(e,1)[0];return b("vaccinationDate",t.toISOString())}},r().createElement(o.aj6,{id:"date-picker-calendar-id",placeholder:"dd/mm/yyyy",labelText:y("vaccinationDate","Vaccination Date"),type:"text"}))),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.Mtg,{id:"vaccinationExpiration",className:"vaccinationExpiration",minDate:(new Date).toISOString(),dateFormat:"d/m/Y",datePickerType:"single",value:v.expirationDate,onChange:function(e){var t=q(e,1)[0];return b("expirationDate",t.toISOString())}},r().createElement(o.aj6,{id:"date-picker-calendar-id",placeholder:"dd/mm/yyyy",labelText:y("expirationDate","Expiration Date"),type:"text"}))),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.oil,{type:"text",id:"lotNumber",labelText:y("lotNumber","Lot Number"),value:v.lotNumber,onChange:function(e){return b("lotNumber",e.target.value)}})),r().createElement("div",{className:O.immunizationSequenceSelect},r().createElement(o.oil,{type:"text",id:"manufacturer",labelText:y("manufacturer","Manufacturer"),value:v.manufacturer,onChange:function(e){return b("manufacturer",e.target.value)}}))),r().createElement(o.uVA,{className:h?O.tablet:O.desktop},r().createElement(o.zxk,{className:O.button,kind:"secondary",onClick:function(){return d()}},y("cancel","Cancel")),r().createElement(o.zxk,{className:O.button,kind:"primary",disabled:S?!D:!z},y("save","Save"))))}},8108:(e,t,n)=>{n.d(t,{dv:()=>l,eu:()=>s,iX:()=>c}),n(5047);var i=n(9857),r=n(906),a=n(9867),o=n(1756);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function c(){var e,t,n,o=(0,r.useConfig)().immunizationsConfig,c=null==o?void 0:o.vaccinesConceptSet,l=(t=c.split(":"),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,u=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){u=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(u)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],m=l[1],d="/ws/rest/v1/concept?source=".concat(s,"&code=").concat(m,"&v=full"),f="/ws/rest/v1/concept/".concat(c,"?v=full"),v=(0,i.ZP)((e=c,(0,a.Z)(e,":")?d:f),r.openmrsFetch),p=v.data,b=v.error;return{data:p?p.data.results[0]:null,isError:b,isLoading:!p&&!b}}function l(e){var t="".concat(r.fhirBaseUrl,"/Immunization?patient=").concat(e),n=(0,i.ZP)(t,r.openmrsFetch),a=n.data,u=n.error,c=n.isValidating,l=a?(0,o.V)(a.data):null;return{data:a?l:null,isError:u,isLoading:!a&&!u,isValidating:c}}function s(e,t,n,i){var a="".concat(r.fhirBaseUrl,"/Immunization");return n&&(a="".concat(a,"/").concat(n)),(0,r.openmrsFetch)(a,{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:i.signal})}}}]);
package/dist/555.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_openmrs_esm_patient_immunizations_app=self.webpackChunk_openmrs_esm_patient_immunizations_app||[]).push([[555],{237:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(9601),r=t.n(i),a=t(2609),o=t.n(a)()(r());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-immunizations__immunizations-detailed-summary__widgetCard___THJK4{border:1px solid #e0e0e0}",""]),o.locals={widgetCard:"-esm-patient-immunizations__immunizations-detailed-summary__widgetCard___THJK4"};const c=o},1756:(e,n,t)=>{t.d(n,{V:()=>m,j:()=>p});var i=t(906),r=t(2449),a=t(772),o=t(468),c=t(4402),u=t(3012),s=t(3939),l=function(e){var n,t,r=null==e?void 0:e.resource,a=null==r?void 0:r.id,o=null==r||null===(n=r.manufacturer)||void 0===n?void 0:n.display,c=null==r?void 0:r.lotNumber,u=(null==r||null===(t=r.protocolApplied)||void 0===t?void 0:t.length)>0&&(null==r?void 0:r.protocolApplied[0]);return{immunizationObsUuid:a,manufacturer:o,lotNumber:c,sequenceLabel:null==u?void 0:u.series,sequenceNumber:null==u?void 0:u.doseNumberPositiveInt,occurrenceDateTime:(0,i.formatDate)(new Date(null==r?void 0:r.occurrenceDateTime)),expirationDate:(0,i.formatDate)(new Date(null==r?void 0:r.expirationDate))}},d=function(e){var n;return(0,r.Z)(null==e||null===(n=e.vaccineCode)||void 0===n?void 0:n.coding,(function(e){return(0,c.Z)(e.system)}))},m=function(e){var n=(0,o.Z)(e.entry,(function(e){var n;return null===(n=d(e.resource))||void 0===n?void 0:n.code}));return(0,u.Z)(n,(function(e){var n,t=(0,u.Z)(e,l),i=d(null===(n=e[0])||void 0===n?void 0:n.resource);return{vaccineName:null==i?void 0:i.display,vaccineUuid:null==i?void 0:i.code,existingDoses:(0,s.Z)(t,[function(e){return(0,a.Z)(e,"occurrenceDateTime")}],["desc"])}}))};function v(e,n){return{type:e,reference:"".concat(e,"/").concat(n)}}var p=function(e,n,t,r){return{resourceType:"Immunization",status:"completed",id:e.immunizationObsUuid,vaccineCode:{coding:[{code:e.vaccineUuid,display:e.vaccineName}]},patient:v("Patient",e.patientUuid),encounter:v("Encounter",n),occurrenceDateTime:(0,i.parseDate)(e.vaccinationDate),expirationDate:(0,i.parseDate)(e.expirationDate),location:v("Location",t),performer:[{actor:v("Practitioner",r)}],manufacturer:{display:e.manufacturer},lotNumber:e.lotNumber,protocolApplied:[{doseNumberPositiveInt:e.currentDose.sequenceNumber,series:e.currentDose.sequenceLabel}]}}},2458:(e,n,t)=>{t.d(n,{s:()=>i});var i=new(t(2444).BehaviorSubject)(null)},555:(e,n,t)=>{t.r(n),t.d(n,{default:()=>H});var i=t(268),r=t.n(i),a=t(772);const o=function(e){return e&&e.length?e[0]:void 0};var c=t(739),u=t(7210),s=t(4248),l=t(7885),d=t(3282),m=t(4975),v=t(5441),p=t(130),f=Object.prototype.hasOwnProperty;const g=function(e){if(null==e)return!0;if((0,d.Z)(e)&&((0,l.Z)(e)||"string"==typeof e||"function"==typeof e.splice||(0,m.Z)(e)||(0,p.Z)(e)||(0,s.Z)(e)))return!e.length;var n=(0,u.Z)(e);if("[object Map]"==n||"[object Set]"==n)return!e.size;if((0,v.Z)(e))return!(0,c.Z)(e).length;for(var t in e)if(f.call(e,t))return!1;return!0};var b=t(3939),y=t(4924),D=t(9694),h=t(6759),Z=t(6217),w=t(906),T=t(8108),_=t(3012),z=t(2449),x=function(e,n){return new Date(n.occurrenceDateTime).getTime()-new Date(e.occurrenceDateTime).getTime()},C=t(2458),S=t(6062),N=t.n(S),U=t(4036),q=t.n(U),P=t(6793),k=t.n(P),A=t(7892),E=t.n(A),O=t(1173),j=t.n(O),I=t(2464),L=t.n(I),V=t(237),F={};F.styleTagTransform=L(),F.setAttributes=E(),F.insert=k().bind(null,"head"),F.domAPI=q(),F.insertStyleElement=j(),N()(V.Z,F);const M=V.Z&&V.Z.locals?V.Z.locals:void 0;function B(){return B=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},B.apply(this,arguments)}const H=function(e){var n,t,c,u,s,l=e.patientUuid,d=(e.basePath,(0,y.useTranslation)()),m=d.t,v=d.i18n,p=(0,w.useConfig)().immunizationsConfig,f=null==p?void 0:p.sequenceDefinitions,S=m("immunizations","immunizations"),N=m("immunizations","Immunizations"),U=v.language.replace("_","-"),q=(window.spaBase,m("goToSummary","Go to Summary"),(0,T.iX)().data),P=(0,T.dv)(l),k=P.data,A=P.isError,E=P.isLoading,O=P.isValidating,j=(n=f,c=null==(t=q)?void 0:t.setMembers,u=(0,_.Z)(c,(function(e){var t={vaccineName:e.display,vaccineUuid:e.uuid,existingDoses:[]},i=(0,z.Z)(n,(function(n){return n.vaccineConceptUuid===e.uuid}));return t.sequences=null==i?void 0:i.sequences,t})),s=k||[],(0,_.Z)(u,(function(e){var n=(0,z.Z)(s,(function(n){return n.vaccineUuid===e.vaccineUuid}));return n&&(e.existingDoses=n.existingDoses),e}))),I=(0,b.Z)(j,[function(e){return(0,a.Z)(e,"existingDoses.length",0)}],["desc"]),L=r().useCallback((function(){return(0,Z.launchPatientWorkspace)("immunization-form-workspace")}),[]),V=((0,i.useMemo)((function(){return[{key:"vaccine",header:m("vaccine","Vaccine")},{key:"recentVaccination",header:m("recentVaccination","Recent Vaccination")},{key:"add",header:""}]}),[m]),(0,i.useMemo)((function(){return null==I?void 0:I.map((function(e){var n,t,i,a=g(e.sequences)&&!g(e.existingDoses)?"".concat(m("singleDoseOn","Single Dose on")," ").concat(new Date(null===(n=o(e.existingDoses.sort(x)))||void 0===n?void 0:n.occurrenceDateTime).toLocaleDateString(U,{dateStyle:"medium"})):g(e.existingDoses)?"":"".concat(null===(t=o(null==e?void 0:e.sequences))||void 0===t?void 0:t.sequenceLabel," on ").concat(new Date(null===(i=o(e.existingDoses.sort(x)))||void 0===i?void 0:i.occurrenceDateTime).toLocaleDateString(U,{dateStyle:"medium"})," ");return{id:e.vaccineUuid,vaccine:e.vaccineName,recentVaccination:a,add:r().createElement(D.zxk,{kind:"ghost",renderIcon:function(e){return r().createElement(h.mm,B({size:16},e))},iconDescription:"Add",onClick:function(){C.s.next({vaccineName:e.vaccineName,vaccineUuid:e.vaccineUuid,sequences:null==e?void 0:e.sequences,existingDoses:null==e?void 0:e.existingDoses,immunizationObsUuid:null==e?void 0:e.immunizationObsUuid,manufacturer:e.manufacturer,lotNumber:e.lotNumber,expirationDate:e.expirationDate,currentDose:{sequenceLabel:e.sequenceLabel,sequenceNumber:e.sequenceNumber},vaccinationDate:e.occurrenceDateTime,formChanged:e.formChanged}),L()}})}}))}),[I,m,U,L])),F=(0,w.usePagination)(V,10),H=F.results;return F.currentPage,F.goTo,E||!I?r().createElement(D.gqd,{role:"progressbar"}):A?r().createElement(Z.ErrorState,{error:A,headerTitle:N}):((null==I?void 0:I.length)&&(M.widgetCard,Z.CardHeader,O&&D.lSo,D.zxk,m("add","Add"),D.wQF,Z.PatientChartPagination,null==V||V.length,null==H||H.length),r().createElement(Z.EmptyState,{displayText:S,headerTitle:N,launchForm:L}))}},8108:(e,n,t)=>{t.d(n,{dv:()=>s,eu:()=>l,iX:()=>u}),t(5047);var i=t(9857),r=t(906),a=t(9867),o=t(1756);function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}function u(){var e,n,t,o=(0,r.useConfig)().immunizationsConfig,u=null==o?void 0:o.vaccinesConceptSet,s=(n=u.split(":"),t=2,function(e){if(Array.isArray(e))return e}(n)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var i,r,a=[],o=!0,c=!1;try{for(t=t.call(e);!(o=(i=t.next()).done)&&(a.push(i.value),!n||a.length!==n);o=!0);}catch(e){c=!0,r=e}finally{try{o||null==t.return||t.return()}finally{if(c)throw r}}return a}}(n,t)||function(e,n){if(e){if("string"==typeof e)return c(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,n):void 0}}(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=s[0],d=s[1],m="/ws/rest/v1/concept?source=".concat(l,"&code=").concat(d,"&v=full"),v="/ws/rest/v1/concept/".concat(u,"?v=full"),p=(0,i.ZP)((e=u,(0,a.Z)(e,":")?m:v),r.openmrsFetch),f=p.data,g=p.error;return{data:f?f.data.results[0]:null,isError:g,isLoading:!f&&!g}}function s(e){var n="".concat(r.fhirBaseUrl,"/Immunization?patient=").concat(e),t=(0,i.ZP)(n,r.openmrsFetch),a=t.data,c=t.error,u=t.isValidating,s=a?(0,o.V)(a.data):null;return{data:a?s:null,isError:c,isLoading:!a&&!c,isValidating:u}}function l(e,n,t,i){var a="".concat(r.fhirBaseUrl,"/Immunization");return t&&(a="".concat(a,"/").concat(t)),(0,r.openmrsFetch)(a,{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:i.signal})}}}]);
1
+ "use strict";(self.webpackChunk_openmrs_esm_patient_immunizations_app=self.webpackChunk_openmrs_esm_patient_immunizations_app||[]).push([[555],{237:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(9601),r=t.n(i),a=t(2609),o=t.n(a)()(r());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-immunizations__immunizations-detailed-summary__widgetCard___THJK4{border:1px solid #e0e0e0}",""]),o.locals={widgetCard:"-esm-patient-immunizations__immunizations-detailed-summary__widgetCard___THJK4"};const c=o},1756:(e,n,t)=>{t.d(n,{V:()=>m,j:()=>p});var i=t(906),r=t(2449),a=t(772),o=t(468),c=t(4402),u=t(3012),s=t(3939),l=function(e){var n,t,r=null==e?void 0:e.resource,a=null==r?void 0:r.id,o=null==r||null===(n=r.manufacturer)||void 0===n?void 0:n.display,c=null==r?void 0:r.lotNumber,u=(null==r||null===(t=r.protocolApplied)||void 0===t?void 0:t.length)>0&&(null==r?void 0:r.protocolApplied[0]);return{immunizationObsUuid:a,manufacturer:o,lotNumber:c,sequenceLabel:null==u?void 0:u.series,sequenceNumber:null==u?void 0:u.doseNumberPositiveInt,occurrenceDateTime:(0,i.formatDate)(new Date(null==r?void 0:r.occurrenceDateTime)),expirationDate:(0,i.formatDate)(new Date(null==r?void 0:r.expirationDate))}},d=function(e){var n;return(0,r.Z)(null==e||null===(n=e.vaccineCode)||void 0===n?void 0:n.coding,(function(e){return(0,c.Z)(e.system)}))},m=function(e){var n=(0,o.Z)(e.entry,(function(e){var n;return null===(n=d(e.resource))||void 0===n?void 0:n.code}));return(0,u.Z)(n,(function(e){var n,t=(0,u.Z)(e,l),i=d(null===(n=e[0])||void 0===n?void 0:n.resource);return{vaccineName:null==i?void 0:i.display,vaccineUuid:null==i?void 0:i.code,existingDoses:(0,s.Z)(t,[function(e){return(0,a.Z)(e,"occurrenceDateTime")}],["desc"])}}))};function v(e,n){return{type:e,reference:"".concat(e,"/").concat(n)}}var p=function(e,n,t,r){return{resourceType:"Immunization",status:"completed",id:e.immunizationObsUuid,vaccineCode:{coding:[{code:e.vaccineUuid,display:e.vaccineName}]},patient:v("Patient",e.patientUuid),encounter:v("Encounter",n),occurrenceDateTime:(0,i.parseDate)(e.vaccinationDate),expirationDate:(0,i.parseDate)(e.expirationDate),location:v("Location",t),performer:[{actor:v("Practitioner",r)}],manufacturer:{display:e.manufacturer},lotNumber:e.lotNumber,protocolApplied:[{doseNumberPositiveInt:e.currentDose.sequenceNumber,series:e.currentDose.sequenceLabel}]}}},2458:(e,n,t)=>{t.d(n,{s:()=>i});var i=new(t(2444).BehaviorSubject)(null)},555:(e,n,t)=>{t.r(n),t.d(n,{default:()=>H});var i=t(268),r=t.n(i),a=t(772);const o=function(e){return e&&e.length?e[0]:void 0};var c=t(739),u=t(7210),s=t(4248),l=t(7885),d=t(3282),m=t(4975),v=t(5441),p=t(130),f=Object.prototype.hasOwnProperty;const g=function(e){if(null==e)return!0;if((0,d.Z)(e)&&((0,l.Z)(e)||"string"==typeof e||"function"==typeof e.splice||(0,m.Z)(e)||(0,p.Z)(e)||(0,s.Z)(e)))return!e.length;var n=(0,u.Z)(e);if("[object Map]"==n||"[object Set]"==n)return!e.size;if((0,v.Z)(e))return!(0,c.Z)(e).length;for(var t in e)if(f.call(e,t))return!1;return!0};var b=t(3939),y=t(4924),D=t(4732),h=t(6759),Z=t(6217),w=t(906),T=t(8108),_=t(3012),z=t(2449),x=function(e,n){return new Date(n.occurrenceDateTime).getTime()-new Date(e.occurrenceDateTime).getTime()},C=t(2458),S=t(6062),N=t.n(S),U=t(4036),q=t.n(U),P=t(6793),k=t.n(P),A=t(7892),E=t.n(A),O=t(1173),j=t.n(O),I=t(2464),L=t.n(I),V=t(237),F={};F.styleTagTransform=L(),F.setAttributes=E(),F.insert=k().bind(null,"head"),F.domAPI=q(),F.insertStyleElement=j(),N()(V.Z,F);const M=V.Z&&V.Z.locals?V.Z.locals:void 0;function B(){return B=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},B.apply(this,arguments)}const H=function(e){var n,t,c,u,s,l=e.patientUuid,d=(e.basePath,(0,y.useTranslation)()),m=d.t,v=d.i18n,p=(0,w.useConfig)().immunizationsConfig,f=null==p?void 0:p.sequenceDefinitions,S=m("immunizations","immunizations"),N=m("immunizations","Immunizations"),U=v.language.replace("_","-"),q=(window.spaBase,m("goToSummary","Go to Summary"),(0,T.iX)().data),P=(0,T.dv)(l),k=P.data,A=P.isError,E=P.isLoading,O=P.isValidating,j=(n=f,c=null==(t=q)?void 0:t.setMembers,u=(0,_.Z)(c,(function(e){var t={vaccineName:e.display,vaccineUuid:e.uuid,existingDoses:[]},i=(0,z.Z)(n,(function(n){return n.vaccineConceptUuid===e.uuid}));return t.sequences=null==i?void 0:i.sequences,t})),s=k||[],(0,_.Z)(u,(function(e){var n=(0,z.Z)(s,(function(n){return n.vaccineUuid===e.vaccineUuid}));return n&&(e.existingDoses=n.existingDoses),e}))),I=(0,b.Z)(j,[function(e){return(0,a.Z)(e,"existingDoses.length",0)}],["desc"]),L=r().useCallback((function(){return(0,Z.launchPatientWorkspace)("immunization-form-workspace")}),[]),V=((0,i.useMemo)((function(){return[{key:"vaccine",header:m("vaccine","Vaccine")},{key:"recentVaccination",header:m("recentVaccination","Recent Vaccination")},{key:"add",header:""}]}),[m]),(0,i.useMemo)((function(){return null==I?void 0:I.map((function(e){var n,t,i,a=g(e.sequences)&&!g(e.existingDoses)?"".concat(m("singleDoseOn","Single Dose on")," ").concat(new Date(null===(n=o(e.existingDoses.sort(x)))||void 0===n?void 0:n.occurrenceDateTime).toLocaleDateString(U,{dateStyle:"medium"})):g(e.existingDoses)?"":"".concat(null===(t=o(null==e?void 0:e.sequences))||void 0===t?void 0:t.sequenceLabel," on ").concat(new Date(null===(i=o(e.existingDoses.sort(x)))||void 0===i?void 0:i.occurrenceDateTime).toLocaleDateString(U,{dateStyle:"medium"})," ");return{id:e.vaccineUuid,vaccine:e.vaccineName,recentVaccination:a,add:r().createElement(D.zxk,{kind:"ghost",renderIcon:function(e){return r().createElement(h.mm,B({size:16},e))},iconDescription:"Add",onClick:function(){C.s.next({vaccineName:e.vaccineName,vaccineUuid:e.vaccineUuid,sequences:null==e?void 0:e.sequences,existingDoses:null==e?void 0:e.existingDoses,immunizationObsUuid:null==e?void 0:e.immunizationObsUuid,manufacturer:e.manufacturer,lotNumber:e.lotNumber,expirationDate:e.expirationDate,currentDose:{sequenceLabel:e.sequenceLabel,sequenceNumber:e.sequenceNumber},vaccinationDate:e.occurrenceDateTime,formChanged:e.formChanged}),L()}})}}))}),[I,m,U,L])),F=(0,w.usePagination)(V,10),H=F.results;return F.currentPage,F.goTo,E||!I?r().createElement(D.gqd,{role:"progressbar"}):A?r().createElement(Z.ErrorState,{error:A,headerTitle:N}):((null==I?void 0:I.length)&&(M.widgetCard,Z.CardHeader,O&&D.lSo,D.zxk,m("add","Add"),D.wQF,Z.PatientChartPagination,null==V||V.length,null==H||H.length),r().createElement(Z.EmptyState,{displayText:S,headerTitle:N,launchForm:L}))}},8108:(e,n,t)=>{t.d(n,{dv:()=>s,eu:()=>l,iX:()=>u}),t(5047);var i=t(9857),r=t(906),a=t(9867),o=t(1756);function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}function u(){var e,n,t,o=(0,r.useConfig)().immunizationsConfig,u=null==o?void 0:o.vaccinesConceptSet,s=(n=u.split(":"),t=2,function(e){if(Array.isArray(e))return e}(n)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var i,r,a=[],o=!0,c=!1;try{for(t=t.call(e);!(o=(i=t.next()).done)&&(a.push(i.value),!n||a.length!==n);o=!0);}catch(e){c=!0,r=e}finally{try{o||null==t.return||t.return()}finally{if(c)throw r}}return a}}(n,t)||function(e,n){if(e){if("string"==typeof e)return c(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,n):void 0}}(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=s[0],d=s[1],m="/ws/rest/v1/concept?source=".concat(l,"&code=").concat(d,"&v=full"),v="/ws/rest/v1/concept/".concat(u,"?v=full"),p=(0,i.ZP)((e=u,(0,a.Z)(e,":")?m:v),r.openmrsFetch),f=p.data,g=p.error;return{data:f?f.data.results[0]:null,isError:g,isLoading:!f&&!g}}function s(e){var n="".concat(r.fhirBaseUrl,"/Immunization?patient=").concat(e),t=(0,i.ZP)(n,r.openmrsFetch),a=t.data,c=t.error,u=t.isValidating,s=a?(0,o.V)(a.data):null;return{data:a?s:null,isError:c,isLoading:!a&&!c,isValidating:u}}function l(e,n,t,i){var a="".concat(r.fhirBaseUrl,"/Immunization");return t&&(a="".concat(a,"/").concat(t)),(0,r.openmrsFetch)(a,{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:i.signal})}}}]);
package/dist/684.js CHANGED
@@ -1 +1 @@
1
- (self.webpackChunk_openmrs_esm_patient_immunizations_app=self.webpackChunk_openmrs_esm_patient_immunizations_app||[]).push([[684,660],{2684:(e,n,i)=>{"use strict";i.r(n),i.d(n,{backendDependencies:()=>u,importTranslation:()=>c,setupOpenMRS:()=>m,version:()=>r});var t=i(906),s=i(6217),a={immunizationsConfig:{vaccinesConceptSet:{_type:t.Type.String,_default:"CIEL:984",_description:"A uuid or concept mapping which will have all the possible vaccines as set-members."},sequenceDefinitions:{_type:t.Type.Array,_description:"Doses/Schedules definitions for each vaccine configured if applicable. If not provided the vaccine would be treated as a vaccine without schedules",_elements:{vaccineConceptUuid:{_type:t.Type.UUID,_description:"The UUID of the individual vaccine concept"},sequences:{_type:t.Type.Array,_elements:{sequenceLabel:{_type:t.Type.String,_description:"Name of the dose/booster/schedule.. This will be used as a translation key as well."},sequenceNumber:{_type:t.Type.Number,_description:"The dose number in the vaccines. Convention for doses is [1...9] and for boosters is [11...19]"}}}},_default:[{vaccineConceptUuid:"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",sequences:[{sequenceLabel:"Dose-1",sequenceNumber:1},{sequenceLabel:"Dose-2",sequenceNumber:2},{sequenceLabel:"Dose-3",sequenceNumber:3},{sequenceLabel:"Dose-4",sequenceNumber:4},{sequenceLabel:"Booster-1",sequenceNumber:11},{sequenceLabel:"Booster-2",sequenceNumber:12}]}]}}},o={slot:"patient-chart-immunizations-dashboard-slot",columns:1,title:"Immunizations"},r="4.0.1-pre.375",c=i(3979),u={"webservices.rest":"^2.2.0",fhir2:"^1.2.0"};function m(){var e="@openmrs/esm-patient-immunizations-app",n={featureName:"patient-immunizations",moduleName:e};return(0,t.defineConfigSchema)(e,a),{extensions:[{name:"immunization-overview-widget",slot:"patient-chart-summary-dashboard-slot",order:10,load:(0,t.getAsyncLifecycle)((function(){return Promise.all([i.e(965),i.e(245),i.e(268),i.e(924),i.e(885)]).then(i.bind(i,1885))}),n),meta:{columnSpan:4}},{name:"immunization-details-widget",slot:o.slot,load:(0,t.getAsyncLifecycle)((function(){return Promise.all([i.e(965),i.e(245),i.e(268),i.e(924),i.e(444),i.e(555)]).then(i.bind(i,555))}),n),meta:{columnSpan:1}},{name:"immunization-summary-dashboard",slot:"patient-chart-dashboard-slot",order:8,load:(0,t.getSyncLifecycle)((0,s.createDashboardLink)(o),n),meta:o},{name:"immunization-form-workspace",load:(0,t.getAsyncLifecycle)((function(){return Promise.all([i.e(965),i.e(245),i.e(268),i.e(924),i.e(444),i.e(355)]).then(i.bind(i,5355))}),n),meta:{title:"Immunization Form"}}]}}},3979:(e,n,i)=>{var t={"./en.json":[3574,574],"./fr.json":[2757,757]};function s(e){if(!i.o(t,e))return Promise.resolve().then((()=>{var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=t[e],s=n[0];return i.e(n[1]).then((()=>i(s)))}s.keys=()=>Object.keys(t),s.id=3979,e.exports=s}}]);
1
+ (self.webpackChunk_openmrs_esm_patient_immunizations_app=self.webpackChunk_openmrs_esm_patient_immunizations_app||[]).push([[684,660],{2684:(e,n,i)=>{"use strict";i.r(n),i.d(n,{backendDependencies:()=>u,importTranslation:()=>c,setupOpenMRS:()=>m,version:()=>r});var t=i(906),s=i(6217),a={immunizationsConfig:{vaccinesConceptSet:{_type:t.Type.String,_default:"CIEL:984",_description:"A uuid or concept mapping which will have all the possible vaccines as set-members."},sequenceDefinitions:{_type:t.Type.Array,_description:"Doses/Schedules definitions for each vaccine configured if applicable. If not provided the vaccine would be treated as a vaccine without schedules",_elements:{vaccineConceptUuid:{_type:t.Type.UUID,_description:"The UUID of the individual vaccine concept"},sequences:{_type:t.Type.Array,_elements:{sequenceLabel:{_type:t.Type.String,_description:"Name of the dose/booster/schedule.. This will be used as a translation key as well."},sequenceNumber:{_type:t.Type.Number,_description:"The dose number in the vaccines. Convention for doses is [1...9] and for boosters is [11...19]"}}}},_default:[{vaccineConceptUuid:"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",sequences:[{sequenceLabel:"Dose-1",sequenceNumber:1},{sequenceLabel:"Dose-2",sequenceNumber:2},{sequenceLabel:"Dose-3",sequenceNumber:3},{sequenceLabel:"Dose-4",sequenceNumber:4},{sequenceLabel:"Booster-1",sequenceNumber:11},{sequenceLabel:"Booster-2",sequenceNumber:12}]}]}}},o={slot:"patient-chart-immunizations-dashboard-slot",columns:1,title:"Immunizations"},r="4.0.1-pre.383",c=i(3979),u={"webservices.rest":"^2.2.0",fhir2:"^1.2.0"};function m(){var e="@openmrs/esm-patient-immunizations-app",n={featureName:"patient-immunizations",moduleName:e};return(0,t.defineConfigSchema)(e,a),{extensions:[{name:"immunization-overview-widget",slot:"patient-chart-summary-dashboard-slot",order:10,load:(0,t.getAsyncLifecycle)((function(){return Promise.all([i.e(718),i.e(245),i.e(268),i.e(924),i.e(885)]).then(i.bind(i,1885))}),n),meta:{columnSpan:4}},{name:"immunization-details-widget",slot:o.slot,load:(0,t.getAsyncLifecycle)((function(){return Promise.all([i.e(718),i.e(245),i.e(268),i.e(924),i.e(444),i.e(555)]).then(i.bind(i,555))}),n),meta:{columnSpan:1}},{name:"immunization-summary-dashboard",slot:"patient-chart-dashboard-slot",order:8,load:(0,t.getSyncLifecycle)((0,s.createDashboardLink)(o),n),meta:o},{name:"immunization-form-workspace",load:(0,t.getAsyncLifecycle)((function(){return Promise.all([i.e(718),i.e(245),i.e(268),i.e(924),i.e(444),i.e(355)]).then(i.bind(i,5355))}),n),meta:{title:"Immunization Form"}}]}}},3979:(e,n,i)=>{var t={"./en.json":[3574,574],"./fr.json":[2757,757]};function s(e){if(!i.o(t,e))return Promise.resolve().then((()=>{var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=t[e],s=n[0];return i.e(n[1]).then((()=>i(s)))}s.keys=()=>Object.keys(t),s.id=3979,e.exports=s}}]);