@ampath/esm-reports-app 1.0.0-next.104 → 1.0.0-next.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/272.css +1 -0
  2. package/dist/272.css.map +1 -0
  3. package/dist/272.js +1 -0
  4. package/dist/272.js.map +1 -0
  5. package/dist/410.js +1 -1
  6. package/dist/600.js +1 -1
  7. package/dist/600.js.map +1 -1
  8. package/dist/ampath-esm-reports-app.js +1 -1
  9. package/dist/routes.json +1 -1
  10. package/package.json +1 -1
  11. package/src/common/report-header/index.ts +1 -0
  12. package/src/common/report-header/use-facility-name.ts +117 -0
  13. package/src/common/report-register/register-layout.component.tsx +34 -2
  14. package/src/common/report-register/register-layout.scss +59 -0
  15. package/src/reports/acf-summary/acf-summary-linelist.component.tsx +7 -2
  16. package/src/reports/acf-summary/acf-summary.component.tsx +5 -1
  17. package/src/reports/moh-710/registers/moh-510/moh-510.component.tsx +1 -1
  18. package/src/reports/moh-710/registers/moh-511/moh-511-register.component.tsx +2 -2
  19. package/src/reports/moh-711/registers/moh-333-register.component.tsx +1 -1
  20. package/src/reports/moh-711/registers/moh-405-register.component.tsx +1 -1
  21. package/src/reports/moh-711/registers/moh-406-register.component.tsx +1 -1
  22. package/src/reports/moh-711/registers/moh-407-register.component.tsx +1 -1
  23. package/src/reports/moh-711/registers/moh-512.component.tsx +1 -1
  24. package/src/reports/moh-711/registers/tb-register.component.tsx +1 -1
  25. package/src/reports/moh-729b/moh-729b-linelist.component.tsx +7 -2
  26. package/src/reports/moh-729b/moh-729b.component.tsx +5 -1
  27. package/src/reports/moh-731/linelist/moh-731-linelist.component.tsx +7 -2
  28. package/src/reports/moh-731/moh-731.component.tsx +6 -3
  29. package/src/resources/moh-710.resource.ts +9 -3
  30. package/dist/329.css +0 -1
  31. package/dist/329.css.map +0 -1
  32. package/dist/329.js +0 -1
  33. package/dist/329.js.map +0 -1
@@ -1 +1 @@
1
- var _ampath_esm_reports_app;!function(){var e="undefined"!=typeof globalThis?globalThis:self;if(void 0===e._FEDERATION_RUNTIME_CORE||void 0===e._OPENMRS_FEDERATION_SDK||void 0===e._OPENMRS_FEDERATION_ERROR_CODES)throw new Error("@ampath/esm-reports-app cannot start: the OpenMRS app shell serving this page does not provide the Module Federation runtime. This app was built with newer OpenMRS tooling than the app shell, so either upgrade @openmrs/esm-app-shell, or rebuild this app with tooling matching the app shell.");var r=e._FEDERATION_RUNTIME_CORE_FROM;r&&r.version&&"2.8"!==String(r.version).split(".").slice(0,2).join(".")&&console.warn("@ampath/esm-reports-app was built against Module Federation 2.8.x but the app shell provides "+r.version+". Shared dependencies may not de-duplicate correctly.")}(),(()=>{"use strict";var e,r,t,n,a,o,i={2464(e,r,t){var n={};function a(e){e.S&&!e.federation.hasAttachShareScopeMap&&e.federation.instance&&e.federation.instance.shareScopeMap&&(e.S=e.federation.instance.shareScopeMap,e.federation.hasAttachShareScopeMap=!0)}t.r(n),t.d(n,{Module:()=>p.Module,ModuleFederation:()=>p.ModuleFederation,createInstance:()=>h,getInstance:()=>M,getRemoteEntry:()=>p.getRemoteEntry,getRemoteInfo:()=>p.getRemoteInfo,init:()=>m,loadRemote:()=>g,loadScript:()=>p.loadScript,loadScriptNode:()=>p.loadScriptNode,loadShare:()=>y,loadShareSync:()=>S,preloadRemote:()=>b,registerGlobalPlugins:()=>p.registerGlobalPlugins,registerPlugins:()=>E,registerRemotes:()=>v,registerShared:()=>R});const o=["script"];function i(e){const{webpackRequire:r,moduleToHandlerMapping:t}=e,{consumesLoadingData:n,initializeSharingData:a}=r,{sharedFallback:o,bundlerRuntime:i,libraryType:s}=r.federation;if(n&&!n._updated){const{moduleIdToConsumeDataMapping:a={},initialConsumes:c=[],chunkMapping:l={}}=n;if(Object.entries(a).forEach(([e,n])=>{t[e]||(t[e]={getter:o?i?.getSharedFallbackGetter({shareKey:n.shareKey,factory:n.fallback,webpackRequire:r,libraryType:s}):n.fallback,treeShakingGetter:o?n.fallback:void 0,shareInfo:{shareConfig:{requiredVersion:n.requiredVersion,strictVersion:n.strictVersion,singleton:n.singleton,eager:n.eager,layer:n.layer},scope:Array.isArray(n.shareScope)?n.shareScope:[n.shareScope||"default"],treeShaking:o?{get:n.fallback,mode:n.treeShakingMode}:void 0},shareKey:n.shareKey})}),"initialConsumes"in e){const{initialConsumes:r=[]}=e;c.forEach(e=>{r.includes(e)||r.push(e)})}if("chunkMapping"in e){const{chunkMapping:r={}}=e;Object.entries(l).forEach(([e,t])=>{r[e]||(r[e]=[]),t.forEach(t=>{r[e].includes(t)||r[e].push(t)})})}n._updated=1}if(a&&!a._updated){const{federation:e}=r;if(!e.instance||!a.scopeToSharingDataMapping)return;const t={};for(let[e,r]of Object.entries(a.scopeToSharingDataMapping))for(let n of r)if("object"==typeof n&&null!==n){const{name:r,version:a,factory:o,eager:i,singleton:s,requiredVersion:c,strictVersion:l}=n,p={requiredVersion:`^${a}`},u=function(e){return void 0!==e};u(s)&&(p.singleton=s),u(c)&&(p.requiredVersion=c),u(i)&&(p.eager=i),u(l)&&(p.strictVersion=l);const d={version:a,scope:[e],shareConfig:p,get:o};t[r]?t[r].push(d):t[r]=[d]}e.instance.registerShared(t),a._updated=1}}const s=self._OPENMRS_FEDERATION_SDK;function c(e,r){const t=e.federation.usedExports;if(t)return t[r]}const l="RUNTIME-012",p=self._FEDERATION_RUNTIME_CORE;function u(e,r){return p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(t=>!("@ampath/esm-reports-app:1.0.0-next.104"!==t.options.id&&(t.options.name!==e||t.options.version||r)&&(t.options.name!==e||!r||t.options.version!==r)))}const d=self._OPENMRS_FEDERATION_ERROR_CODES;function h(e){const r=new((0,p.getGlobalFederationConstructor)()||p.ModuleFederation)({id:`${e.name}@${e.version||Date.now()}`,...e});return(0,p.setGlobalFederationInstance)(r),r}let f=null;function m(e){const r=u(e.name,e.version),t={...e,id:e.id||""};return r?(r.initOptions(t),f||(f=r),r):(f=h(t),f)}function g(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadRemote.apply(f,e)}function y(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShare.apply(f,e)}function S(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShareSync.apply(f,e)}function b(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.preloadRemote.apply(f,e)}function v(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerRemotes.apply(f,e)}function E(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerPlugins.apply(f,e)}function M(e){return e?p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(e)||null:f}function R(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerShared.apply(f,e)}(0,p.setGlobalFederationConstructor)(p.ModuleFederation);const k={global:{...p.helpers.global,getGlobalFederationInstance:u},share:p.helpers.share,utils:p.helpers.utils},_={remotes:function(e){!function(e){const{webpackRequire:r,idToExternalAndNameMapping:t={},idToRemoteMap:n={},chunkMapping:a={}}=e,{remotesLoadingData:o}=r,i=r.federation?.bundlerRuntimeOptions?.remotes?.remoteInfos;if(!o||o._updated||!i)return;const{chunkMapping:s,moduleIdToRemoteDataMapping:c}=o;if(s&&c){for(let[e,r]of Object.entries(c))if(t[e]||(t[e]=[r.shareScope,r.name,r.externalModuleId]),!n[e]&&i[r.remoteName]){const t=i[r.remoteName];n[e]||=[],t.forEach(r=>{n[e].includes(r)||n[e].push(r)})}a&&Object.entries(s).forEach(([e,r])=>{a[e]||(a[e]=[]),r.forEach(r=>{a[e].includes(r)||a[e].push(r)})}),o._updated=1}}(e);const{chunkId:r,promises:t,webpackRequire:n,chunkMapping:i,idToExternalAndNameMapping:c,idToRemoteMap:l}=e;a(n),n.o(i,r)&&i[r].forEach(e=>{let r=n.R;r||(r=[]);const a=c[e],i=l[e]||[];if(r.indexOf(a)>=0)return;if(r.push(a),a.p)return t.push(a.p);const p=r=>{r||(r=new Error("Container missing")),"string"==typeof r.message&&(r.message+=`\nwhile loading "${a[1]}" from ${a[2]}`),n.m[e]=()=>{throw r},a.p=0},u=(e,r,n,o,i,s)=>{try{const c=e(r,n);if(!c||!c.then)return i(c,o,s);{const e=c.then(e=>i(e,o),p);if(!s)return e;t.push(a.p=e)}}catch(e){p(e)}};var d=(e,t,n)=>u(t.get,a[1],r,0,h,n),h=r=>{a.p=1,n.m[e]=e=>{e.exports=r()}};1===i.length&&o.includes(i[0].externalType)&&i[0].name?u(()=>{try{const e=(0,s.decodeName)(i[0].name,s.ENCODE_NAME_PREFIX)+a[1].slice(1),r=n.federation.instance,t=()=>n.federation.instance.loadRemote(e,{loadFactory:!1,from:"build"});if("version-first"===r.options.shareStrategy){const e=Array.isArray(a[0])?a[0]:[a[0]];return Promise.all(e.map(e=>r.sharedHandler.initializeSharing(e))).then(()=>t())}return t()}catch(e){p(e)}},a[2],0,0,h,1):u(n,a[2],0,0,(e,r,t)=>e?u(n.I,a[0],0,e,d,t):p(),1)})},consumes:function(e){i(e);const{chunkId:r,promises:t,installedModules:n,webpackRequire:o,chunkMapping:s,moduleToHandlerMapping:p}=e;a(o),o.o(s,r)&&s[r].forEach(e=>{if(o.o(n,e))return t.push(n[e]);const r=r=>{n[e]=0,o.m[e]=t=>{delete o.c[e];const n=r(),{shareInfo:a}=p[e];if(a?.shareConfig?.layer&&n&&"object"==typeof n)try{n.hasOwnProperty("layer")&&void 0!==n.layer||(n.layer=a.shareConfig.layer)}catch(e){}t.exports=n}},a=r=>{delete n[e],o.m[e]=t=>{throw delete o.c[e],r}};try{const i=o.federation.instance;if(!i)throw new Error("Federation instance not found!");const{shareKey:s,getter:u,shareInfo:d,treeShakingGetter:h}=p[e],f=c(o,s),m={...d};Array.isArray(m.scope)&&Array.isArray(m.scope[0])&&(m.scope=m.scope[0]),f&&(m.treeShaking={usedExports:f,useIn:[i.options.name]});const g=i.loadShare(s,{customShareInfo:m}).then(e=>{if(!1===e){if("function"!=typeof u)throw new Error(((e,r,t)=>{const n=[`${[r[e]]} #${e}`];return t&&n.push(`args: ${JSON.stringify(t)}`),n.push((e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`)(e)),n.join("\n")})(l,{[l]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'},{shareKey:s}));return h?.()||u()}return e});g.then?t.push(n[e]=g.then(r).catch(a)):r(g)}catch(e){a(e)}})},I:function({shareScopeName:e,webpackRequire:r,initPromises:t,initTokens:n,initScope:i}){const s=Array.isArray(e)?e:[e];var c=[];return s.forEach(s=>{c.push(function(s){i||(i=[]);const c=r.federation.instance;var l=n[s];if(l||(l=n[s]={from:c.name}),i.indexOf(l)>=0)return;i.push(l);const p=t[s];if(p)return p;var u=t=>{var n=e=>{return r="Initialization of sharing external failed: "+e,"undefined"!=typeof console&&console.warn&&console.warn(r);var r};try{var a=r(t);if(!a)return;var o=t=>t&&t.init&&t.init(r.S[s],i,{shareScopeMap:r.S||{},shareScopeKeys:e});if(a.then)return d.push(a.then(o,n));var c=o(a);if(c&&"boolean"!=typeof c&&c.then)return d.push(c.catch(n))}catch(e){n(e)}};const d=c.initializeSharing(s,{strategy:c.options.shareStrategy,initScope:i,from:"build"});a(r);const h=r.federation.bundlerRuntimeOptions.remotes;return h&&Object.keys(h.idToRemoteMap).forEach(e=>{const r=h.idToRemoteMap[e],t=h.idToExternalAndNameMapping[e][2];if(r.length>1)u(t);else if(1===r.length){const e=r[0];o.includes(e.externalType)||u(t)}}),d.length?t[s]=Promise.all(d).then(()=>t[s]=!0):t[s]=!0}(s))}),Promise.all(c).then(()=>!0)},S:{},installInitialConsumes:function(e){i(e);const{moduleToHandlerMapping:r,webpackRequire:t,installedModules:n,initialConsumes:a,asyncLoad:o}=e,s=[];a.forEach(e=>{s.push([e,()=>function(e){const{moduleId:r,moduleToHandlerMapping:t,webpackRequire:n,asyncLoad:a}=e,o=n.federation.instance;if(!o)throw new Error("Federation instance not found!");const{shareKey:i,shareInfo:s}=t[r];try{const e=c(n,i),r={...s};return e&&(r.treeShaking={usedExports:e,useIn:[o.options.name]}),a?o.loadShare(i,{customShareInfo:r}):o.loadShareSync(i,{customShareInfo:r})}catch(e){throw console.error('loadShareSync failed! The function should not be called unless you set "eager:true". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.'),console.error("The original error message is as follows: "),e}}({moduleId:e,moduleToHandlerMapping:r,webpackRequire:t,asyncLoad:o})])});const l=(e,a)=>{t.m[e]=o=>{n[e]=0,delete t.c[e];const i=a();if("function"!=typeof i)throw new Error(`Shared module is not available for eager consumption: ${e}`);const s=i(),{shareInfo:c}=r[e];if(c?.shareConfig?.layer&&s&&"object"==typeof s)try{s.hasOwnProperty("layer")&&void 0!==s.layer||(s.layer=c.shareConfig.layer)}catch(e){}o.exports=s}};if(o)return Promise.all(s.map(async([e,r])=>{const t=await r();l(e,()=>t)}));s.forEach(([e,r])=>{l(e,r)})},initContainerEntry:function(e){const{webpackRequire:r,shareScope:t,initScope:n,shareScopeKey:a,remoteEntryInitOptions:o}=e;if(!r.S)return;if(!r.federation||!r.federation.instance||!r.federation.initOptions)return;const i=r.federation.instance;i.initOptions({name:r.federation.initOptions.name,remotes:[],...o});const s=o?.shareScopeKeys,c=o?.shareScopeMap;if(a&&"string"!=typeof a)a.forEach(e=>{if(!s||!c)return void i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}});c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})});else{const e=a||"default";Array.isArray(s)?s.forEach(e=>{c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})}):i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}})}return r.federation.attachShareScopeMap&&r.federation.attachShareScopeMap(r),Array.isArray(a)?Boolean(r.federation.initOptions.shared)?r.I(a,n):Promise.all(a.map(e=>r.I(e,n))).then(()=>!0):r.I(a||"default",n)},init:function({webpackRequire:e}){const{initOptions:r,runtime:n,sharedFallback:a,bundlerRuntime:o,libraryType:i}=e.federation;if(!r)throw new Error("initOptions is required!");{const n=function(){return{name:"tree-shake-plugin",beforeInit(r){const{userOptions:n,origin:s,options:c}=r,l=n.version||c.version;if(!a)return r;const u=n.shared||{},d=[];Object.keys(u).forEach(r=>{(Array.isArray(u[r])?u[r]:[u[r]]).forEach(t=>{d.push([r,t]),"get"in t&&(t.treeShaking||={},t.treeShaking.get=t.get,t.get=o.getSharedFallbackGetter({shareKey:r,factory:t.get,webpackRequire:e,libraryType:i,version:t.version}))})});const h=k.global.getGlobalSnapshotInfoByModuleInfo({name:s.name,version:l});return h&&"shared"in h?(Object.keys(c.shared||{}).forEach(e=>{c.shared[e].forEach(r=>{d.push([e,r])})}),d.forEach(([e,r])=>{((e,r)=>{const n=h.shared.find(r=>r.sharedName===e);if(!n)return;const{treeShaking:a}=r;if(!a)return;const{secondarySharedTreeShakingName:o,secondarySharedTreeShakingEntry:c,treeShakingStatus:l}=n;a.status!==l&&(a.status=l,c&&i&&o&&(a.get=async()=>{const e=await(0,p.getRemoteEntry)({origin:s,remoteInfo:{name:o,entry:c,type:i,entryGlobalName:o,shareScope:"default"}});return await e.init(s,t.federation.bundlerRuntime),e.get()}))})(e,r)}),r):r}}};r.plugins||=[],r.plugins.push(n())}return n.init(r)},getSharedFallbackGetter:({shareKey:e,factory:r,version:t,webpackRequire:n,libraryType:a="global"})=>{const{runtime:o,instance:i,bundlerRuntime:s,sharedFallback:c}=n.federation;if(!c)return r;const l=c[e];if(!l)return r;const p=t?l.find(e=>e[1]===t):l[0];if(!p)throw new Error(`No fallback item found for shareKey: ${e} and version: ${t}`);return()=>o.getRemoteEntry({origin:n.federation.instance,remoteInfo:{name:p[2],entry:`${n.p}${p[0]}`,type:a,entryGlobalName:p[2],shareScope:"default"}}).then(r=>{if(!r)throw new Error(`Failed to load fallback entry for shareKey: ${e} and version: ${t}`);return r.init(n.federation.instance,s).then(()=>r.get())})}},w={runtime:n,instance:void 0,initOptions:void 0,bundlerRuntime:_,attachShareScopeMap:a,bundlerRuntimeOptions:{}};if(!t.federation.runtime||!t.federation.bundlerRuntime){var I=t.federation;for(var T in t.federation={},w)t.federation[T]=w[T];for(var T in I)t.federation[T]=I[T]}t.federation.instance||(t.federation.instance=t.federation.bundlerRuntime.init({webpackRequire:t}),t.federation.attachShareScopeMap&&t.federation.attachShareScopeMap(t),t.federation.installInitialConsumes&&t.federation.installInitialConsumes())},9421(e,r,t){var n={"./start":()=>Promise.all([t.e(31),t.e(435),t.e(410)]).then(()=>()=>t(5410))},a=(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),o=(e,r,n)=>t.federation.bundlerRuntime.initContainerEntry({webpackRequire:t,shareScope:e,initScope:r,remoteEntryInitOptions:n,shareScopeKey:"default"});t.d(r,{get:()=>a,init:()=>o})}},s={};function c(e){var r=s[e];if(void 0!==r)return r.exports;var t=s[e]={exports:{}},n={id:e,module:t,factory:i[e],require:c};return c.i.forEach(function(e){e(n)}),t=n.module,n.factory.call(t.exports,t,t.exports,n.require),t.exports}c.m=i,c.c=s,c.i=[],c.x=e=>{},c.federation||(c.federation={initOptions:{name:"@ampath/esm-reports-app",remotes:[],shareStrategy:"version-first"},chunkMatcher:function(e){return!/^(31|435|680|987)$/.test(e)},rootOutputDir:"",bundlerRuntimeOptions:{remotes:{remoteInfos:{},webpackRequire:c,idToRemoteMap:{},chunkMapping:{},idToExternalAndNameMapping:{}}}},c.consumesLoadingData={},c.remotesLoadingData={}),c.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return c.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var a=Object.create(null);c.r(a);var o={};e=e||[null,r({}),r([]),r(r)];for(var i=2&n&&t;("object"==typeof i||"function"==typeof i)&&!~e.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(e=>o[e]=()=>t[e]);return o.default=()=>t,c.d(a,o),a},c.d=(e,r)=>{for(var t in r)c.o(r,t)&&!c.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((r,t)=>(c.f[t](e,r),r),[])),c.u=e=>e+".js",c.miniCssF=e=>e+".css",c.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@ampath/esm-reports-app:",c.l=(e,r,a,o)=>{if(t[e])t[e].push(r);else{var i,s;if(void 0!==a)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+a){i=u;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",c.nc&&i.setAttribute("nonce",c.nc),i.setAttribute("data-webpack",n+a),i.src=e),t[e]=[r];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(h);var a=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(n)),r)return r(n)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),s&&document.head.appendChild(i)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{c.S={};var e={},r={};c.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];c.o(c.S,t)||(c.S[t]={});var o=c.S[t],i="@ampath/esm-reports-app",s=(e,r,t,n)=>{var a=o[e]=o[e]||{},s=a[r];(!s||!s.loaded&&(!n!=!s.eager?n:i>s.from))&&(a[r]={get:t,from:i,eager:!!n})},l=[];return"default"===t&&(s("@openmrs/esm-framework","11.0.1-pre.5776",()=>Promise.all([c.e(961),c.e(600),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295))),s("dayjs","1.11.20",()=>c.e(353).then(()=>()=>c(4353))),s("react-i18next","16.6.6",()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311))),s("react-router-dom","6.30.3",()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282))),s("react","18.3.1",()=>c.e(540).then(()=>()=>c(6540)))),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{c.federation.initOptions.shared={"@openmrs/esm-framework":[{version:"11.0.1-pre.5776",get:()=>Promise.all([c.e(961),c.e(600),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"*",strictVersion:!1,singleton:!0,layer:null}}],dayjs:[{version:"1.11.20",get:()=>c.e(353).then(()=>()=>c(4353)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"1.x",strictVersion:!1,singleton:!0,layer:null}}],"react-i18next":[{version:"16.6.6",get:()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"16.x",strictVersion:!1,singleton:!0,layer:null}}],"react-router-dom":[{version:"6.30.3",get:()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"6.x",strictVersion:!1,singleton:!0,layer:null}}],react:[{version:"18.3.1",get:()=>c.e(540).then(()=>()=>c(6540)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"18.x",strictVersion:!1,singleton:!0,layer:null}}]},c.S={};var e={},r={};c.I=(t,n)=>c.federation.bundlerRuntime.I({shareScopeName:t,webpackRequire:c,initPromises:e,initTokens:r,initScope:n})})(),(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c.p=e})(),(()=>{var e={};c.consumesLoadingData.moduleIdToConsumeDataMapping={6031:{fallback:()=>c.e(540).then(()=>()=>c(6540)),shareScope:["default"],singleton:!0,requiredVersion:"18.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react"},6435:{fallback:()=>Promise.all([c.e(961),c.e(282)]).then(()=>()=>c(282)),shareScope:["default"],singleton:!0,requiredVersion:"6.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-router-dom"},7693:{fallback:()=>Promise.all([c.e(961),c.e(600),c.e(478),c.e(295),c.e(680),c.e(987)]).then(()=>()=>c(9295)),shareScope:["default"],singleton:!0,requiredVersion:"*",strictVersion:!1,eager:!1,layer:void 0,shareKey:"@openmrs/esm-framework"},7680:{fallback:()=>c.e(353).then(()=>()=>c(4353)),shareScope:["default"],singleton:!0,requiredVersion:"1.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"dayjs"},3987:{fallback:()=>c.e(311).then(()=>()=>c(3311)),shareScope:["default"],singleton:!0,requiredVersion:"16.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-i18next"}};var r={};c.consumesLoadingData.chunkMapping={31:[6031],410:[7693],435:[6435],680:[7680],987:[3987]},c.f.consumes=(t,n)=>{c.federation.bundlerRuntime.consumes({chunkMapping:c.consumesLoadingData.chunkMapping,installedModules:e,chunkId:t,moduleToHandlerMapping:r,promises:n,webpackRequire:c})}})(),(()=>{if("undefined"!=typeof document){var e={462:0};c.f.miniCss=(r,t)=>{e[r]?t.push(e[r]):0!==e[r]&&{295:1,329:1}[r]&&t.push(e[r]=(e=>new Promise((r,t)=>{var n=c.miniCssF(e),a=c.p+n;if(((e,r)=>{for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++){var a=(i=t[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(a===e||a===r))return i}var o=document.getElementsByTagName("style");for(n=0;n<o.length;n++){var i;if((a=(i=o[n]).getAttribute("data-href"))===e||a===r)return i}})(n,a))return r();((e,r,t,n,a)=>{var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",c.nc&&(o.nonce=c.nc),o.onerror=o.onload=t=>{if(o.onerror=o.onload=null,"load"===t.type)n();else{var i=t&&t.type,s=t&&t.target&&t.target.href||r,c=new Error("Loading CSS chunk "+e+" failed.\n("+i+": "+s+")");c.name="ChunkLoadError",c.code="CSS_CHUNK_LOAD_FAILED",c.type=i,c.request=s,o.parentNode&&o.parentNode.removeChild(o),a(c)}},o.href=r,document.head.appendChild(o)})(e,a,0,r,t)}))(r).then(()=>{e[r]=0},t=>{throw delete e[r],t}))}}})(),a=c.x,o=!1,c.x=()=>{if(o||(o=!0,c(2464)),"function"==typeof a)return a();console.warn("[Module Federation] prevStartup is not a function, skipping startup execution")},(()=>{var e={462:0};c.f.j=(r,t)=>{var n=c.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(31|435|680|987)$/.test(r))e[r]=0;else{var a=new Promise((t,a)=>n=e[r]=[t,a]);t.push(n[2]=a);var o=c.p+c.u(r),i=new Error;c.l(o,t=>{if(c.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[o,i,s]=t,l=0;if(o.some(r=>0!==e[r])){for(n in i)c.o(i,n)&&(c.m[n]=i[n]);s&&s(c)}for(r&&r(t);l<o.length;l++)a=o[l],c.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunk_ampath_esm_reports_app=self.webpackChunk_ampath_esm_reports_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),c.x();var l=c(9421);_ampath_esm_reports_app=l})();
1
+ var _ampath_esm_reports_app;!function(){var e="undefined"!=typeof globalThis?globalThis:self;if(void 0===e._FEDERATION_RUNTIME_CORE||void 0===e._OPENMRS_FEDERATION_SDK||void 0===e._OPENMRS_FEDERATION_ERROR_CODES)throw new Error("@ampath/esm-reports-app cannot start: the OpenMRS app shell serving this page does not provide the Module Federation runtime. This app was built with newer OpenMRS tooling than the app shell, so either upgrade @openmrs/esm-app-shell, or rebuild this app with tooling matching the app shell.");var r=e._FEDERATION_RUNTIME_CORE_FROM;r&&r.version&&"2.8"!==String(r.version).split(".").slice(0,2).join(".")&&console.warn("@ampath/esm-reports-app was built against Module Federation 2.8.x but the app shell provides "+r.version+". Shared dependencies may not de-duplicate correctly.")}(),(()=>{"use strict";var e,r,t,n,a,o,i={2464(e,r,t){var n={};function a(e){e.S&&!e.federation.hasAttachShareScopeMap&&e.federation.instance&&e.federation.instance.shareScopeMap&&(e.S=e.federation.instance.shareScopeMap,e.federation.hasAttachShareScopeMap=!0)}t.r(n),t.d(n,{Module:()=>p.Module,ModuleFederation:()=>p.ModuleFederation,createInstance:()=>h,getInstance:()=>M,getRemoteEntry:()=>p.getRemoteEntry,getRemoteInfo:()=>p.getRemoteInfo,init:()=>m,loadRemote:()=>g,loadScript:()=>p.loadScript,loadScriptNode:()=>p.loadScriptNode,loadShare:()=>y,loadShareSync:()=>S,preloadRemote:()=>b,registerGlobalPlugins:()=>p.registerGlobalPlugins,registerPlugins:()=>E,registerRemotes:()=>v,registerShared:()=>R});const o=["script"];function i(e){const{webpackRequire:r,moduleToHandlerMapping:t}=e,{consumesLoadingData:n,initializeSharingData:a}=r,{sharedFallback:o,bundlerRuntime:i,libraryType:s}=r.federation;if(n&&!n._updated){const{moduleIdToConsumeDataMapping:a={},initialConsumes:c=[],chunkMapping:l={}}=n;if(Object.entries(a).forEach(([e,n])=>{t[e]||(t[e]={getter:o?i?.getSharedFallbackGetter({shareKey:n.shareKey,factory:n.fallback,webpackRequire:r,libraryType:s}):n.fallback,treeShakingGetter:o?n.fallback:void 0,shareInfo:{shareConfig:{requiredVersion:n.requiredVersion,strictVersion:n.strictVersion,singleton:n.singleton,eager:n.eager,layer:n.layer},scope:Array.isArray(n.shareScope)?n.shareScope:[n.shareScope||"default"],treeShaking:o?{get:n.fallback,mode:n.treeShakingMode}:void 0},shareKey:n.shareKey})}),"initialConsumes"in e){const{initialConsumes:r=[]}=e;c.forEach(e=>{r.includes(e)||r.push(e)})}if("chunkMapping"in e){const{chunkMapping:r={}}=e;Object.entries(l).forEach(([e,t])=>{r[e]||(r[e]=[]),t.forEach(t=>{r[e].includes(t)||r[e].push(t)})})}n._updated=1}if(a&&!a._updated){const{federation:e}=r;if(!e.instance||!a.scopeToSharingDataMapping)return;const t={};for(let[e,r]of Object.entries(a.scopeToSharingDataMapping))for(let n of r)if("object"==typeof n&&null!==n){const{name:r,version:a,factory:o,eager:i,singleton:s,requiredVersion:c,strictVersion:l}=n,p={requiredVersion:`^${a}`},u=function(e){return void 0!==e};u(s)&&(p.singleton=s),u(c)&&(p.requiredVersion=c),u(i)&&(p.eager=i),u(l)&&(p.strictVersion=l);const d={version:a,scope:[e],shareConfig:p,get:o};t[r]?t[r].push(d):t[r]=[d]}e.instance.registerShared(t),a._updated=1}}const s=self._OPENMRS_FEDERATION_SDK;function c(e,r){const t=e.federation.usedExports;if(t)return t[r]}const l="RUNTIME-012",p=self._FEDERATION_RUNTIME_CORE;function u(e,r){return p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(t=>!("@ampath/esm-reports-app:1.0.0-next.106"!==t.options.id&&(t.options.name!==e||t.options.version||r)&&(t.options.name!==e||!r||t.options.version!==r)))}const d=self._OPENMRS_FEDERATION_ERROR_CODES;function h(e){const r=new((0,p.getGlobalFederationConstructor)()||p.ModuleFederation)({id:`${e.name}@${e.version||Date.now()}`,...e});return(0,p.setGlobalFederationInstance)(r),r}let f=null;function m(e){const r=u(e.name,e.version),t={...e,id:e.id||""};return r?(r.initOptions(t),f||(f=r),r):(f=h(t),f)}function g(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadRemote.apply(f,e)}function y(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShare.apply(f,e)}function S(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.loadShareSync.apply(f,e)}function b(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.preloadRemote.apply(f,e)}function v(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerRemotes.apply(f,e)}function E(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerPlugins.apply(f,e)}function M(e){return e?p.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(e)||null:f}function R(...e){return(0,p.assert)(f,d.RUNTIME_009,d.runtimeDescMap),f.registerShared.apply(f,e)}(0,p.setGlobalFederationConstructor)(p.ModuleFederation);const k={global:{...p.helpers.global,getGlobalFederationInstance:u},share:p.helpers.share,utils:p.helpers.utils},_={remotes:function(e){!function(e){const{webpackRequire:r,idToExternalAndNameMapping:t={},idToRemoteMap:n={},chunkMapping:a={}}=e,{remotesLoadingData:o}=r,i=r.federation?.bundlerRuntimeOptions?.remotes?.remoteInfos;if(!o||o._updated||!i)return;const{chunkMapping:s,moduleIdToRemoteDataMapping:c}=o;if(s&&c){for(let[e,r]of Object.entries(c))if(t[e]||(t[e]=[r.shareScope,r.name,r.externalModuleId]),!n[e]&&i[r.remoteName]){const t=i[r.remoteName];n[e]||=[],t.forEach(r=>{n[e].includes(r)||n[e].push(r)})}a&&Object.entries(s).forEach(([e,r])=>{a[e]||(a[e]=[]),r.forEach(r=>{a[e].includes(r)||a[e].push(r)})}),o._updated=1}}(e);const{chunkId:r,promises:t,webpackRequire:n,chunkMapping:i,idToExternalAndNameMapping:c,idToRemoteMap:l}=e;a(n),n.o(i,r)&&i[r].forEach(e=>{let r=n.R;r||(r=[]);const a=c[e],i=l[e]||[];if(r.indexOf(a)>=0)return;if(r.push(a),a.p)return t.push(a.p);const p=r=>{r||(r=new Error("Container missing")),"string"==typeof r.message&&(r.message+=`\nwhile loading "${a[1]}" from ${a[2]}`),n.m[e]=()=>{throw r},a.p=0},u=(e,r,n,o,i,s)=>{try{const c=e(r,n);if(!c||!c.then)return i(c,o,s);{const e=c.then(e=>i(e,o),p);if(!s)return e;t.push(a.p=e)}}catch(e){p(e)}};var d=(e,t,n)=>u(t.get,a[1],r,0,h,n),h=r=>{a.p=1,n.m[e]=e=>{e.exports=r()}};1===i.length&&o.includes(i[0].externalType)&&i[0].name?u(()=>{try{const e=(0,s.decodeName)(i[0].name,s.ENCODE_NAME_PREFIX)+a[1].slice(1),r=n.federation.instance,t=()=>n.federation.instance.loadRemote(e,{loadFactory:!1,from:"build"});if("version-first"===r.options.shareStrategy){const e=Array.isArray(a[0])?a[0]:[a[0]];return Promise.all(e.map(e=>r.sharedHandler.initializeSharing(e))).then(()=>t())}return t()}catch(e){p(e)}},a[2],0,0,h,1):u(n,a[2],0,0,(e,r,t)=>e?u(n.I,a[0],0,e,d,t):p(),1)})},consumes:function(e){i(e);const{chunkId:r,promises:t,installedModules:n,webpackRequire:o,chunkMapping:s,moduleToHandlerMapping:p}=e;a(o),o.o(s,r)&&s[r].forEach(e=>{if(o.o(n,e))return t.push(n[e]);const r=r=>{n[e]=0,o.m[e]=t=>{delete o.c[e];const n=r(),{shareInfo:a}=p[e];if(a?.shareConfig?.layer&&n&&"object"==typeof n)try{n.hasOwnProperty("layer")&&void 0!==n.layer||(n.layer=a.shareConfig.layer)}catch(e){}t.exports=n}},a=r=>{delete n[e],o.m[e]=t=>{throw delete o.c[e],r}};try{const i=o.federation.instance;if(!i)throw new Error("Federation instance not found!");const{shareKey:s,getter:u,shareInfo:d,treeShakingGetter:h}=p[e],f=c(o,s),m={...d};Array.isArray(m.scope)&&Array.isArray(m.scope[0])&&(m.scope=m.scope[0]),f&&(m.treeShaking={usedExports:f,useIn:[i.options.name]});const g=i.loadShare(s,{customShareInfo:m}).then(e=>{if(!1===e){if("function"!=typeof u)throw new Error(((e,r,t)=>{const n=[`${[r[e]]} #${e}`];return t&&n.push(`args: ${JSON.stringify(t)}`),n.push((e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`)(e)),n.join("\n")})(l,{[l]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'},{shareKey:s}));return h?.()||u()}return e});g.then?t.push(n[e]=g.then(r).catch(a)):r(g)}catch(e){a(e)}})},I:function({shareScopeName:e,webpackRequire:r,initPromises:t,initTokens:n,initScope:i}){const s=Array.isArray(e)?e:[e];var c=[];return s.forEach(s=>{c.push(function(s){i||(i=[]);const c=r.federation.instance;var l=n[s];if(l||(l=n[s]={from:c.name}),i.indexOf(l)>=0)return;i.push(l);const p=t[s];if(p)return p;var u=t=>{var n=e=>{return r="Initialization of sharing external failed: "+e,"undefined"!=typeof console&&console.warn&&console.warn(r);var r};try{var a=r(t);if(!a)return;var o=t=>t&&t.init&&t.init(r.S[s],i,{shareScopeMap:r.S||{},shareScopeKeys:e});if(a.then)return d.push(a.then(o,n));var c=o(a);if(c&&"boolean"!=typeof c&&c.then)return d.push(c.catch(n))}catch(e){n(e)}};const d=c.initializeSharing(s,{strategy:c.options.shareStrategy,initScope:i,from:"build"});a(r);const h=r.federation.bundlerRuntimeOptions.remotes;return h&&Object.keys(h.idToRemoteMap).forEach(e=>{const r=h.idToRemoteMap[e],t=h.idToExternalAndNameMapping[e][2];if(r.length>1)u(t);else if(1===r.length){const e=r[0];o.includes(e.externalType)||u(t)}}),d.length?t[s]=Promise.all(d).then(()=>t[s]=!0):t[s]=!0}(s))}),Promise.all(c).then(()=>!0)},S:{},installInitialConsumes:function(e){i(e);const{moduleToHandlerMapping:r,webpackRequire:t,installedModules:n,initialConsumes:a,asyncLoad:o}=e,s=[];a.forEach(e=>{s.push([e,()=>function(e){const{moduleId:r,moduleToHandlerMapping:t,webpackRequire:n,asyncLoad:a}=e,o=n.federation.instance;if(!o)throw new Error("Federation instance not found!");const{shareKey:i,shareInfo:s}=t[r];try{const e=c(n,i),r={...s};return e&&(r.treeShaking={usedExports:e,useIn:[o.options.name]}),a?o.loadShare(i,{customShareInfo:r}):o.loadShareSync(i,{customShareInfo:r})}catch(e){throw console.error('loadShareSync failed! The function should not be called unless you set "eager:true". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.'),console.error("The original error message is as follows: "),e}}({moduleId:e,moduleToHandlerMapping:r,webpackRequire:t,asyncLoad:o})])});const l=(e,a)=>{t.m[e]=o=>{n[e]=0,delete t.c[e];const i=a();if("function"!=typeof i)throw new Error(`Shared module is not available for eager consumption: ${e}`);const s=i(),{shareInfo:c}=r[e];if(c?.shareConfig?.layer&&s&&"object"==typeof s)try{s.hasOwnProperty("layer")&&void 0!==s.layer||(s.layer=c.shareConfig.layer)}catch(e){}o.exports=s}};if(o)return Promise.all(s.map(async([e,r])=>{const t=await r();l(e,()=>t)}));s.forEach(([e,r])=>{l(e,r)})},initContainerEntry:function(e){const{webpackRequire:r,shareScope:t,initScope:n,shareScopeKey:a,remoteEntryInitOptions:o}=e;if(!r.S)return;if(!r.federation||!r.federation.instance||!r.federation.initOptions)return;const i=r.federation.instance;i.initOptions({name:r.federation.initOptions.name,remotes:[],...o});const s=o?.shareScopeKeys,c=o?.shareScopeMap;if(a&&"string"!=typeof a)a.forEach(e=>{if(!s||!c)return void i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}});c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})});else{const e=a||"default";Array.isArray(s)?s.forEach(e=>{c[e]||(c[e]={});const r=c[e];i.initShareScopeMap(e,r,{hostShareScopeMap:o?.shareScopeMap||{}})}):i.initShareScopeMap(e,t,{hostShareScopeMap:o?.shareScopeMap||{}})}return r.federation.attachShareScopeMap&&r.federation.attachShareScopeMap(r),Array.isArray(a)?Boolean(r.federation.initOptions.shared)?r.I(a,n):Promise.all(a.map(e=>r.I(e,n))).then(()=>!0):r.I(a||"default",n)},init:function({webpackRequire:e}){const{initOptions:r,runtime:n,sharedFallback:a,bundlerRuntime:o,libraryType:i}=e.federation;if(!r)throw new Error("initOptions is required!");{const n=function(){return{name:"tree-shake-plugin",beforeInit(r){const{userOptions:n,origin:s,options:c}=r,l=n.version||c.version;if(!a)return r;const u=n.shared||{},d=[];Object.keys(u).forEach(r=>{(Array.isArray(u[r])?u[r]:[u[r]]).forEach(t=>{d.push([r,t]),"get"in t&&(t.treeShaking||={},t.treeShaking.get=t.get,t.get=o.getSharedFallbackGetter({shareKey:r,factory:t.get,webpackRequire:e,libraryType:i,version:t.version}))})});const h=k.global.getGlobalSnapshotInfoByModuleInfo({name:s.name,version:l});return h&&"shared"in h?(Object.keys(c.shared||{}).forEach(e=>{c.shared[e].forEach(r=>{d.push([e,r])})}),d.forEach(([e,r])=>{((e,r)=>{const n=h.shared.find(r=>r.sharedName===e);if(!n)return;const{treeShaking:a}=r;if(!a)return;const{secondarySharedTreeShakingName:o,secondarySharedTreeShakingEntry:c,treeShakingStatus:l}=n;a.status!==l&&(a.status=l,c&&i&&o&&(a.get=async()=>{const e=await(0,p.getRemoteEntry)({origin:s,remoteInfo:{name:o,entry:c,type:i,entryGlobalName:o,shareScope:"default"}});return await e.init(s,t.federation.bundlerRuntime),e.get()}))})(e,r)}),r):r}}};r.plugins||=[],r.plugins.push(n())}return n.init(r)},getSharedFallbackGetter:({shareKey:e,factory:r,version:t,webpackRequire:n,libraryType:a="global"})=>{const{runtime:o,instance:i,bundlerRuntime:s,sharedFallback:c}=n.federation;if(!c)return r;const l=c[e];if(!l)return r;const p=t?l.find(e=>e[1]===t):l[0];if(!p)throw new Error(`No fallback item found for shareKey: ${e} and version: ${t}`);return()=>o.getRemoteEntry({origin:n.federation.instance,remoteInfo:{name:p[2],entry:`${n.p}${p[0]}`,type:a,entryGlobalName:p[2],shareScope:"default"}}).then(r=>{if(!r)throw new Error(`Failed to load fallback entry for shareKey: ${e} and version: ${t}`);return r.init(n.federation.instance,s).then(()=>r.get())})}},w={runtime:n,instance:void 0,initOptions:void 0,bundlerRuntime:_,attachShareScopeMap:a,bundlerRuntimeOptions:{}};if(!t.federation.runtime||!t.federation.bundlerRuntime){var I=t.federation;for(var T in t.federation={},w)t.federation[T]=w[T];for(var T in I)t.federation[T]=I[T]}t.federation.instance||(t.federation.instance=t.federation.bundlerRuntime.init({webpackRequire:t}),t.federation.attachShareScopeMap&&t.federation.attachShareScopeMap(t),t.federation.installInitialConsumes&&t.federation.installInitialConsumes())},9421(e,r,t){var n={"./start":()=>Promise.all([t.e(31),t.e(435),t.e(410)]).then(()=>()=>t(5410))},a=(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),o=(e,r,n)=>t.federation.bundlerRuntime.initContainerEntry({webpackRequire:t,shareScope:e,initScope:r,remoteEntryInitOptions:n,shareScopeKey:"default"});t.d(r,{get:()=>a,init:()=>o})}},s={};function c(e){var r=s[e];if(void 0!==r)return r.exports;var t=s[e]={exports:{}},n={id:e,module:t,factory:i[e],require:c};return c.i.forEach(function(e){e(n)}),t=n.module,n.factory.call(t.exports,t,t.exports,n.require),t.exports}c.m=i,c.c=s,c.i=[],c.x=e=>{},c.federation||(c.federation={initOptions:{name:"@ampath/esm-reports-app",remotes:[],shareStrategy:"version-first"},chunkMatcher:function(e){return!/^(31|435|680|987)$/.test(e)},rootOutputDir:"",bundlerRuntimeOptions:{remotes:{remoteInfos:{},webpackRequire:c,idToRemoteMap:{},chunkMapping:{},idToExternalAndNameMapping:{}}}},c.consumesLoadingData={},c.remotesLoadingData={}),c.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return c.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var a=Object.create(null);c.r(a);var o={};e=e||[null,r({}),r([]),r(r)];for(var i=2&n&&t;("object"==typeof i||"function"==typeof i)&&!~e.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(e=>o[e]=()=>t[e]);return o.default=()=>t,c.d(a,o),a},c.d=(e,r)=>{for(var t in r)c.o(r,t)&&!c.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((r,t)=>(c.f[t](e,r),r),[])),c.u=e=>e+".js",c.miniCssF=e=>e+".css",c.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@ampath/esm-reports-app:",c.l=(e,r,a,o)=>{if(t[e])t[e].push(r);else{var i,s;if(void 0!==a)for(var l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var u=l[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+a){i=u;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",c.nc&&i.setAttribute("nonce",c.nc),i.setAttribute("data-webpack",n+a),i.src=e),t[e]=[r];var d=(r,n)=>{i.onerror=i.onload=null,clearTimeout(h);var a=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(n)),r)return r(n)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),s&&document.head.appendChild(i)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{c.S={};var e={},r={};c.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];c.o(c.S,t)||(c.S[t]={});var o=c.S[t],i="@ampath/esm-reports-app",s=(e,r,t,n)=>{var a=o[e]=o[e]||{},s=a[r];(!s||!s.loaded&&(!n!=!s.eager?n:i>s.from))&&(a[r]={get:t,from:i,eager:!!n})},l=[];return"default"===t&&(s("@openmrs/esm-framework","11.0.1-pre.5776",()=>Promise.all([c.e(961),c.e(600),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295))),s("dayjs","1.11.20",()=>c.e(353).then(()=>()=>c(4353))),s("react-i18next","16.6.6",()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311))),s("react-router-dom","6.30.3",()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282))),s("react","18.3.1",()=>c.e(540).then(()=>()=>c(6540)))),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{c.federation.initOptions.shared={"@openmrs/esm-framework":[{version:"11.0.1-pre.5776",get:()=>Promise.all([c.e(961),c.e(600),c.e(478),c.e(295),c.e(31),c.e(680),c.e(435),c.e(987)]).then(()=>()=>c(9295)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"*",strictVersion:!1,singleton:!0,layer:null}}],dayjs:[{version:"1.11.20",get:()=>c.e(353).then(()=>()=>c(4353)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"1.x",strictVersion:!1,singleton:!0,layer:null}}],"react-i18next":[{version:"16.6.6",get:()=>Promise.all([c.e(478),c.e(311),c.e(31)]).then(()=>()=>c(3311)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"16.x",strictVersion:!1,singleton:!0,layer:null}}],"react-router-dom":[{version:"6.30.3",get:()=>Promise.all([c.e(961),c.e(282),c.e(31)]).then(()=>()=>c(282)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"6.x",strictVersion:!1,singleton:!0,layer:null}}],react:[{version:"18.3.1",get:()=>c.e(540).then(()=>()=>c(6540)),scope:["default"],shareConfig:{eager:!1,requiredVersion:"18.x",strictVersion:!1,singleton:!0,layer:null}}]},c.S={};var e={},r={};c.I=(t,n)=>c.federation.bundlerRuntime.I({shareScopeName:t,webpackRequire:c,initPromises:e,initTokens:r,initScope:n})})(),(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c.p=e})(),(()=>{var e={};c.consumesLoadingData.moduleIdToConsumeDataMapping={6031:{fallback:()=>c.e(540).then(()=>()=>c(6540)),shareScope:["default"],singleton:!0,requiredVersion:"18.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react"},6435:{fallback:()=>Promise.all([c.e(961),c.e(282)]).then(()=>()=>c(282)),shareScope:["default"],singleton:!0,requiredVersion:"6.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-router-dom"},7693:{fallback:()=>Promise.all([c.e(961),c.e(600),c.e(478),c.e(295),c.e(680),c.e(987)]).then(()=>()=>c(9295)),shareScope:["default"],singleton:!0,requiredVersion:"*",strictVersion:!1,eager:!1,layer:void 0,shareKey:"@openmrs/esm-framework"},7680:{fallback:()=>c.e(353).then(()=>()=>c(4353)),shareScope:["default"],singleton:!0,requiredVersion:"1.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"dayjs"},3987:{fallback:()=>c.e(311).then(()=>()=>c(3311)),shareScope:["default"],singleton:!0,requiredVersion:"16.x",strictVersion:!1,eager:!1,layer:void 0,shareKey:"react-i18next"}};var r={};c.consumesLoadingData.chunkMapping={31:[6031],410:[7693],435:[6435],680:[7680],987:[3987]},c.f.consumes=(t,n)=>{c.federation.bundlerRuntime.consumes({chunkMapping:c.consumesLoadingData.chunkMapping,installedModules:e,chunkId:t,moduleToHandlerMapping:r,promises:n,webpackRequire:c})}})(),(()=>{if("undefined"!=typeof document){var e={462:0};c.f.miniCss=(r,t)=>{e[r]?t.push(e[r]):0!==e[r]&&{272:1,295:1}[r]&&t.push(e[r]=(e=>new Promise((r,t)=>{var n=c.miniCssF(e),a=c.p+n;if(((e,r)=>{for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++){var a=(i=t[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(a===e||a===r))return i}var o=document.getElementsByTagName("style");for(n=0;n<o.length;n++){var i;if((a=(i=o[n]).getAttribute("data-href"))===e||a===r)return i}})(n,a))return r();((e,r,t,n,a)=>{var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",c.nc&&(o.nonce=c.nc),o.onerror=o.onload=t=>{if(o.onerror=o.onload=null,"load"===t.type)n();else{var i=t&&t.type,s=t&&t.target&&t.target.href||r,c=new Error("Loading CSS chunk "+e+" failed.\n("+i+": "+s+")");c.name="ChunkLoadError",c.code="CSS_CHUNK_LOAD_FAILED",c.type=i,c.request=s,o.parentNode&&o.parentNode.removeChild(o),a(c)}},o.href=r,document.head.appendChild(o)})(e,a,0,r,t)}))(r).then(()=>{e[r]=0},t=>{throw delete e[r],t}))}}})(),a=c.x,o=!1,c.x=()=>{if(o||(o=!0,c(2464)),"function"==typeof a)return a();console.warn("[Module Federation] prevStartup is not a function, skipping startup execution")},(()=>{var e={462:0};c.f.j=(r,t)=>{var n=c.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(31|435|680|987)$/.test(r))e[r]=0;else{var a=new Promise((t,a)=>n=e[r]=[t,a]);t.push(n[2]=a);var o=c.p+c.u(r),i=new Error;c.l(o,t=>{if(c.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,a,[o,i,s]=t,l=0;if(o.some(r=>0!==e[r])){for(n in i)c.o(i,n)&&(c.m[n]=i[n]);s&&s(c)}for(r&&r(t);l<o.length;l++)a=o[l],c.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunk_ampath_esm_reports_app=self.webpackChunk_ampath_esm_reports_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),c.x();var l=c(9421);_ampath_esm_reports_app=l})();
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"ampath-reports-dashboard-link","component":"reportsDashboardLink","slot":"homepage-dashboard-slot","privileges":["O3 View Reports Dashboard"],"meta":{"name":"reports","slot":"ampath-reports-dashboard-slot","title":"Reports"},"online":true,"offline":true},{"component":"root","name":"ampath-reports-dashboard-root","slot":"ampath-reports-dashboard-slot","privileges":["O3 View Reports Dashboard"]}],"pages":[],"version":"1.0.0-next.104"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"ampath-reports-dashboard-link","component":"reportsDashboardLink","slot":"homepage-dashboard-slot","privileges":["O3 View Reports Dashboard"],"meta":{"name":"reports","slot":"ampath-reports-dashboard-slot","title":"Reports"},"online":true,"offline":true},{"component":"root","name":"ampath-reports-dashboard-root","slot":"ampath-reports-dashboard-slot","privileges":["O3 View Reports Dashboard"]}],"pages":[],"version":"1.0.0-next.106"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampath/esm-reports-app",
3
- "version": "1.0.0-next.104",
3
+ "version": "1.0.0-next.106",
4
4
  "license": "MPL-2.0",
5
5
  "description": "An AMPATH application for M&E reports",
6
6
  "browser": "dist/ampath-esm-reports-app.js",
@@ -1 +1,2 @@
1
1
  export * from './use-location-details';
2
+ export * from './use-facility-name';
@@ -0,0 +1,117 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { openmrsFetch } from '@openmrs/esm-framework';
3
+
4
+ /* AMPATH's parent locations mostly carry a code for a name (MTRHPL, BDHPL)
5
+ and the facility's own name in their description, e.g. "Busia District
6
+ Hospital Parent Location" or "Railways Parent Location (Uasin Gishu)" (spelt
7
+ variously: "Parent location", "Parent Locaion") */
8
+ const PARENT_PHRASE = /\s*parent\s+loca\w*/i;
9
+ const PARENT_CODE = /^[a-z]+PL$/i;
10
+
11
+ interface LocationRecord {
12
+ name?: string;
13
+ description?: string;
14
+ retired?: boolean;
15
+ childLocations?: LocationRecord[];
16
+ parentLocation?: LocationRecord;
17
+ }
18
+
19
+ /**
20
+ * A location's facility name: from its parent's description without "Parent
21
+ * Location"; else the parent's name, unless that is only a code (TWPL, with no
22
+ * description), when the location's own name stands for it.
23
+ */
24
+ const facilityNameOf = (location: LocationRecord) => {
25
+ const parent = location.parentLocation;
26
+ if (!parent) {
27
+ return location.name ?? '';
28
+ }
29
+ if (parent.description && PARENT_PHRASE.test(parent.description)) {
30
+ return parent.description.replace(PARENT_PHRASE, '').replace(/\s+/g, ' ').trim();
31
+ }
32
+ return parent.name && !PARENT_CODE.test(parent.name) ? parent.name : (location.name ?? '');
33
+ };
34
+
35
+ /**
36
+ * The clinics a location's facility takes in, as the ETL widens it: the active
37
+ * locations under its parent, or under itself (and itself) when it has none.
38
+ * A parent that is only a grouping code (MTRHPL) is not listed as a clinic.
39
+ */
40
+ const facilityClinicsOf = (location: LocationRecord) => {
41
+ const root = location.parentLocation ?? location;
42
+ const children = (root.childLocations ?? []).filter((child) => !child.retired).map((child) => child.name ?? '');
43
+ const self = location.parentLocation ? [] : [location.name ?? ''];
44
+ return [...self, ...children].filter(Boolean);
45
+ };
46
+
47
+ export interface Facility {
48
+ /** e.g. `MTRH`; the fallback until the locations answer */
49
+ name: string;
50
+ /** Every clinic the figures include, A–Z; empty until the locations answer */
51
+ clinics: string[];
52
+ }
53
+
54
+ /**
55
+ * The facility a report covers, for reports the ETL widens to the whole
56
+ * facility (widenToFacility): a location stands for its parent location and
57
+ * every location under it, or for itself when it has no parent. So MTRH
58
+ * Module 1 is named by its parent (MTRHPL, "MTRH Parent Location") as MTRH,
59
+ * with the MTRH clinics the figures include. Several uuids (comma-separated)
60
+ * are named in order, each facility once.
61
+ *
62
+ * Until the locations answer (or if the lookup fails) the name is `fallback`,
63
+ * e.g. the session location's own name.
64
+ */
65
+ export function useFacility(locationUuids: string | null | undefined, fallback = ''): Facility {
66
+ const uuids = (locationUuids ?? '')
67
+ .split(',')
68
+ .map((uuid) => uuid.trim())
69
+ .filter(Boolean);
70
+ const key = uuids.join(',');
71
+
72
+ const [found, setFound] = useState<Record<string, { name: string; clinics: string[] }>>({});
73
+
74
+ useEffect(() => {
75
+ if (uuids.length === 0) {
76
+ return;
77
+ }
78
+
79
+ const abortController = new AbortController();
80
+ const fields = 'name,description,retired,childLocations:(name,retired)';
81
+
82
+ Promise.all(
83
+ uuids.map((uuid) =>
84
+ openmrsFetch(`/ws/rest/v1/location/${uuid}?v=custom:(${fields},parentLocation:(${fields}))`, {
85
+ signal: abortController.signal,
86
+ })
87
+ .then((response) => response.json())
88
+ .then(
89
+ (location: LocationRecord) =>
90
+ [uuid, { name: facilityNameOf(location), clinics: facilityClinicsOf(location) }] as const,
91
+ )
92
+ .catch(() => [uuid, { name: '', clinics: [] }] as const),
93
+ ),
94
+ ).then((results) => {
95
+ if (!abortController.signal.aborted) {
96
+ setFound(Object.fromEntries(results.filter(([, facility]) => facility.name)));
97
+ }
98
+ });
99
+
100
+ return () => abortController.abort();
101
+ // eslint-disable-next-line react-hooks/exhaustive-deps
102
+ }, [key]);
103
+
104
+ const answered = uuids.length > 0 && uuids.every((uuid) => found[uuid]);
105
+ if (!answered) {
106
+ return { name: fallback, clinics: [] };
107
+ }
108
+ return {
109
+ name: [...new Set(uuids.map((uuid) => found[uuid].name))].join(', '),
110
+ clinics: [...new Set(uuids.flatMap((uuid) => found[uuid].clinics))].sort((a, b) => a.localeCompare(b)),
111
+ };
112
+ }
113
+
114
+ /** Just the facility's name; see `useFacility` */
115
+ export function useFacilityName(locationUuids: string | null | undefined, fallback = ''): string {
116
+ return useFacility(locationUuids, fallback).name;
117
+ }
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
- import { Breadcrumb, BreadcrumbItem, Button, Layer, Pagination } from '@carbon/react';
2
+ import {
3
+ Breadcrumb,
4
+ BreadcrumbItem,
5
+ Button,
6
+ Layer,
7
+ Pagination,
8
+ Toggletip,
9
+ ToggletipButton,
10
+ ToggletipContent,
11
+ } from '@carbon/react';
3
12
  import { Link, useSearchParams } from 'react-router-dom';
4
13
  import { ArrowLeft, Calendar, Document, Download, Location } from '@carbon/react/icons';
5
14
  import { formatDate } from '@openmrs/esm-framework';
@@ -36,6 +45,11 @@ interface RegisterLayoutProps {
36
45
  heading?: string;
37
46
  /** The location the register was generated for, shown beside the period */
38
47
  location?: string;
48
+ /**
49
+ * The clinics `location` takes in, when it is a whole facility (e.g. MTRH's
50
+ * modules, MCH, HTS…): listed under a "N clinics" button beside its name
51
+ */
52
+ locationClinics?: string[];
39
53
  isLoading: boolean;
40
54
  /** `true` once loaded with nothing to show */
41
55
  isEmpty: boolean;
@@ -78,6 +92,7 @@ const RegisterLayout: React.FC<RegisterLayoutProps> = ({
78
92
  title,
79
93
  heading: headingProp,
80
94
  location,
95
+ locationClinics = [],
81
96
  isLoading,
82
97
  isEmpty,
83
98
  page,
@@ -211,10 +226,27 @@ const RegisterLayout: React.FC<RegisterLayoutProps> = ({
211
226
  <span className={styles.location}>
212
227
  <Location size={14} />
213
228
  {location}
229
+ {locationClinics.length > 0 && (
230
+ <Toggletip align="bottom-left" autoAlign className={styles.clinics}>
231
+ <ToggletipButton label={`Clinics in ${location}`} className={styles.clinicsButton}>
232
+ {locationClinics.length === 1 ? '1 clinic' : `${locationClinics.length} clinics`}
233
+ </ToggletipButton>
234
+ <ToggletipContent>
235
+ <p className={styles.clinicsTitle}>Includes every clinic in {location}</p>
236
+ <ul className={styles.clinicsList}>
237
+ {locationClinics.map((clinic) => (
238
+ <li key={clinic}>{clinic}</li>
239
+ ))}
240
+ </ul>
241
+ </ToggletipContent>
242
+ </Toggletip>
243
+ )}
214
244
  </span>
215
245
  )}
216
246
  {typeof total === 'number' && total > 0 && (
217
- <span>{isTotalExact ? `${total.toLocaleString()} patients` : `${total.toLocaleString()}+ patients`}</span>
247
+ <span>
248
+ {isTotalExact ? `${total.toLocaleString()} patients` : `${total.toLocaleString()}+ patients`}
249
+ </span>
218
250
  )}
219
251
  </span>
220
252
  </span>
@@ -129,6 +129,65 @@
129
129
  margin-left: layout.$spacing-03;
130
130
  }
131
131
 
132
+ /* "18 clinics": opens the list of the facility's clinics */
133
+ .clinics {
134
+ margin-left: layout.$spacing-02;
135
+
136
+ /* wide enough for the list's two columns (Carbon caps the toggletip at 18rem) */
137
+ :global(.cds--popover-content),
138
+ :global(.cds--toggletip-content) {
139
+ max-inline-size: min(36rem, calc(100vw - 2rem));
140
+ }
141
+ }
142
+
143
+ .clinicsButton {
144
+ padding: 0 layout.$spacing-02;
145
+ font: inherit;
146
+ color: var(--brand-01);
147
+ text-decoration: underline;
148
+ text-underline-offset: 2px;
149
+ cursor: pointer;
150
+ background: none;
151
+ border: none;
152
+
153
+ &:hover {
154
+ text-decoration-thickness: 2px;
155
+ }
156
+ }
157
+
158
+ .clinicsTitle {
159
+ margin-bottom: layout.$spacing-03;
160
+ font-weight: 600;
161
+ }
162
+
163
+ /* two columns when the list is long, so it stays short */
164
+ .clinicsList {
165
+ columns: 2;
166
+ column-gap: layout.$spacing-06;
167
+ margin: 0;
168
+ padding: 0;
169
+ list-style: none;
170
+
171
+ li {
172
+ padding: layout.$spacing-01 0;
173
+ white-space: nowrap;
174
+ break-inside: avoid;
175
+ }
176
+ }
177
+
178
+ /* on a phone: one column, scrolling if long, names allowed to wrap */
179
+ @media (max-width: $breakpoint-phone-max) {
180
+ .clinicsList {
181
+ columns: 1;
182
+ max-height: 50vh;
183
+ overflow-y: auto;
184
+
185
+ li {
186
+ white-space: normal;
187
+ }
188
+ }
189
+ }
190
+
132
191
  .export {
133
192
  flex-shrink: 0;
134
193
  margin-left: auto;
@@ -3,6 +3,7 @@ import { useSearchParams } from 'react-router-dom';
3
3
 
4
4
  import { type LinelistColumn, LinelistTable, useAllRows } from '../../common/linelist-table';
5
5
  import { RegisterLayout, useLocationName } from '../../common/report-register';
6
+ import { useFacility } from '../../common/report-header';
6
7
  import { getPresumptiveTb } from '../../resources/presumptive-tb.resource';
7
8
  import { ACF_INDICATORS, type AcfCase } from './acf-summary.counts';
8
9
 
@@ -43,7 +44,10 @@ const AcfSummaryLinelist: React.FC = () => {
43
44
  const indicator = ACF_INDICATORS[number];
44
45
  const heading = indicator ? `${number}. ${indicator.label} linelist` : 'ACF linelist';
45
46
 
46
- const locationName = useLocationName(locationUuids);
47
+ /* the cases come from the whole facility (as the sheet's counts do), so it
48
+ is named by its parent location, e.g. MTRH, with the clinics it includes;
49
+ the location's own name until that loads */
50
+ const facility = useFacility(locationUuids, useLocationName(locationUuids));
47
51
  /* the period's cases come back in one response; they are fetched once and
48
52
  handed to the table in the batches it reads */
49
53
  let cases: Promise<AcfCase[]> | undefined;
@@ -67,7 +71,8 @@ const AcfSummaryLinelist: React.FC = () => {
67
71
  parentPath="/acf-summary"
68
72
  title="ACF Facility Summary · TB / Chest Clinic"
69
73
  heading={heading}
70
- location={locationName}
74
+ location={facility.name}
75
+ locationClinics={facility.clinics}
71
76
  isLoading={isLoading}
72
77
  isEmpty={rows.length === 0}
73
78
  >
@@ -7,6 +7,7 @@ import { downloadSheetsPdf } from '../../common/report-page';
7
7
  import { ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
8
8
  import { showReportError } from '../../common/report-error';
9
9
  import { ReportSkeleton } from '../../common/report-skeleton';
10
+ import { useFacilityName } from '../../common/report-header';
10
11
  import { registerFileName } from '../../registers/register-file-name';
11
12
  import { getPresumptiveTb } from '../../resources/presumptive-tb.resource';
12
13
  import { acfCounts, type AcfCase } from './acf-summary.counts';
@@ -29,7 +30,10 @@ const AcfSummaryReport: React.FC = () => {
29
30
  const navigate = useNavigate();
30
31
  const session = useSession();
31
32
  const locationUuids = session?.sessionLocation?.uuid ?? '';
32
- const facility = session?.sessionLocation?.display ?? '';
33
+ /* the cases come from the session location's whole facility (the ETL
34
+ widens to its parent location and every clinic under it), so the sheet
35
+ and the PDF name the facility, e.g. MTRH rather than MTRH Module 1 */
36
+ const facility = useFacilityName(locationUuids, session?.sessionLocation?.display ?? '');
33
37
  /* Only a report for the current location counts */
34
38
  const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('acfSummaryLocation');
35
39
  const isReportGenerated = isGenerated && isForCurrentLocation;
@@ -88,7 +88,7 @@ const Moh510RegisterComponent: React.FC<Moh510RegisterComponentProps> = () => {
88
88
  parentPath={isDrilldown ? '/moh-710' : '/?tab=registers'}
89
89
  title="MOH-510 Register"
90
90
  isLoading={isLoading}
91
- isEmpty={isGenerated && patientlist.length === 0}
91
+ isEmpty={isGenerated && patientlist?.length === 0}
92
92
  page={page}
93
93
  pageSize={pageSize}
94
94
  total={total}
@@ -86,7 +86,7 @@ const Moh511Register: React.FC = () => {
86
86
  parentPath={isDrilldown ? '/moh-710' : '/?tab=registers'}
87
87
  title="MOH-511 Register"
88
88
  isLoading={isLoading}
89
- isEmpty={isGenerated && patientlist.length === 0}
89
+ isEmpty={isGenerated && patientlist?.length === 0}
90
90
  page={page}
91
91
  pageSize={pageSize}
92
92
  total={total}
@@ -279,7 +279,7 @@ const Moh511Register: React.FC = () => {
279
279
  </TableHead>
280
280
  <TableBody>
281
281
  {patientlist?.length > 0 ? (
282
- patientlist.map((patient, index) => (
282
+ patientlist?.map((patient, index) => (
283
283
  <TableRow key={index}>
284
284
  {moh511Columns.map((col) => (
285
285
  <td key={col}>{col === 'serial_no' ? index + 1 : (patient?.[col] ?? '')}</td>
@@ -90,7 +90,7 @@ const Moh333Register: React.FC = () => {
90
90
  parentPath={isDrilldown ? '/moh-711' : '/?tab=registers'}
91
91
  title="MOH 333 Register"
92
92
  isLoading={isLoading}
93
- isEmpty={isGenerated && patientlist.length === 0}
93
+ isEmpty={isGenerated && patientlist?.length === 0}
94
94
  page={page}
95
95
  pageSize={pageSize}
96
96
  total={total}
@@ -90,7 +90,7 @@ const Moh405Register: React.FC = () => {
90
90
  parentPath={isDrilldown ? '/moh-711' : '/?tab=registers'}
91
91
  title="MOH 405 ANC Register"
92
92
  isLoading={isLoading}
93
- isEmpty={(isDrilldown || Boolean(generatedPeriod)) && patientlist.length === 0}
93
+ isEmpty={(isDrilldown || Boolean(generatedPeriod)) && patientlist?.length === 0}
94
94
  page={page}
95
95
  pageSize={pageSize}
96
96
  total={total}
@@ -90,7 +90,7 @@ const Moh406Register: React.FC = () => {
90
90
  parentPath={isDrilldown ? '/moh-711' : '/?tab=registers'}
91
91
  title="MOH 406 Register"
92
92
  isLoading={isLoading}
93
- isEmpty={isGenerated && patientlist.length === 0}
93
+ isEmpty={isGenerated && patientlist?.length === 0}
94
94
  page={page}
95
95
  pageSize={pageSize}
96
96
  total={total}
@@ -92,7 +92,7 @@ const Moh407RegisterComponent: React.FC<Moh407RegisterComponentProps> = () => {
92
92
  parentPath={isDrilldown ? '/moh-711' : '/?tab=registers'}
93
93
  title="MOH 407 Register"
94
94
  isLoading={isLoading}
95
- isEmpty={isGenerated && patientlist.length === 0}
95
+ isEmpty={isGenerated && patientlist?.length === 0}
96
96
  page={page}
97
97
  pageSize={pageSize}
98
98
  total={total}
@@ -140,7 +140,7 @@ const Moh512RegisterComponent: React.FC<Moh512RegisterComponentProps> = () => {
140
140
  parentPath={isDrilldown ? '/moh-711' : '/?tab=registers'}
141
141
  title="MOH 512 Register"
142
142
  isLoading={isLoading}
143
- isEmpty={isGenerated && patientlist.length === 0}
143
+ isEmpty={isGenerated && patientlist?.length === 0}
144
144
  page={page}
145
145
  pageSize={pageSize}
146
146
  total={total}
@@ -46,7 +46,7 @@ const TbRegisterComponent: React.FC<TbRegisterComponentProps> = () => {
46
46
  parentPath="/moh-711"
47
47
  title="TB Register"
48
48
  isLoading={isLoading}
49
- isEmpty={patientlist.length === 0}
49
+ isEmpty={patientlist?.length === 0}
50
50
  page={page}
51
51
  pageSize={pageSize}
52
52
  total={total}
@@ -3,6 +3,7 @@ import { useSearchParams } from 'react-router-dom';
3
3
 
4
4
  import { type LinelistColumn, LinelistTable, useAllRows } from '../../common/linelist-table';
5
5
  import { RegisterLayout, useLocationName } from '../../common/report-register';
6
+ import { useFacility } from '../../common/report-header';
6
7
  import { getMoh729b } from '../../resources/moh-729b.resource';
7
8
  import { decodeCell, describeCell, inCells, PEP_CODES, type Moh729bCell, type Moh729bRow } from './moh-729b.types';
8
9
 
@@ -237,7 +238,10 @@ const Moh729bLinelist: React.FC = () => {
237
238
  ? GROUPS.pep
238
239
  : GROUPS.art;
239
240
 
240
- const locationName = useLocationName(locationUuids);
241
+ /* the clients come from the whole facility (as the form's counts do), so it
242
+ is named by its parent location, e.g. MTRH, with the clinics it includes;
243
+ the location's own name until that loads */
244
+ const facility = useFacility(locationUuids, useLocationName(locationUuids));
241
245
  /* the month's clients come back in one response; they are fetched once and
242
246
  handed to the table in the batches it reads */
243
247
  let clients: Promise<Moh729bRow[]> | undefined;
@@ -261,7 +265,8 @@ const Moh729bLinelist: React.FC = () => {
261
265
  parentPath="/moh-729b"
262
266
  title={`MOH 729B F-MAPS · ${group.title}`}
263
267
  heading={heading}
264
- location={locationName}
268
+ location={facility.name}
269
+ locationClinics={facility.clinics}
265
270
  isLoading={isLoading}
266
271
  isEmpty={rows.length === 0}
267
272
  >
@@ -8,6 +8,7 @@ import { downloadSheetsPdf } from '../../common/report-page';
8
8
  import { showReportError } from '../../common/report-error';
9
9
  import { ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
10
10
  import { ReportSkeleton } from '../../common/report-skeleton';
11
+ import { useFacilityName } from '../../common/report-header';
11
12
  import { registerFileName } from '../../registers/register-file-name';
12
13
  import { getMoh729b } from '../../resources/moh-729b.resource';
13
14
  import Moh729bForm, { type Moh729bCounts } from './moh-729b-form.component';
@@ -48,7 +49,10 @@ const Moh729bReport: React.FC = () => {
48
49
  };
49
50
  const session = useSession();
50
51
  const locationUuids = session?.sessionLocation?.uuid ?? '';
51
- const facility = session?.sessionLocation?.display ?? '';
52
+ /* the figures cover the session location's whole facility (the ETL widens
53
+ to its parent location and every clinic under it), so the form and the
54
+ PDF name the facility, e.g. MTRH rather than MTRH Module 1 */
55
+ const facility = useFacilityName(locationUuids, session?.sessionLocation?.display ?? '');
52
56
  const preparedBy = session?.user?.person?.display ?? session?.user?.display ?? '';
53
57
  /* Only a report for the current location counts */
54
58
  const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('moh729bLocation');
@@ -3,6 +3,7 @@ import { useSearchParams } from 'react-router-dom';
3
3
 
4
4
  import { LinelistTable, useAllRows } from '../../../common/linelist-table';
5
5
  import { RegisterLayout, useLocationName } from '../../../common/report-register';
6
+ import { useFacility } from '../../../common/report-header';
6
7
  import { MOH_731_INDICATORS } from './moh-731-indicators';
7
8
  import { MOH_731_LINELIST_SECTIONS } from './moh-731-linelist-sections';
8
9
 
@@ -29,7 +30,10 @@ const Moh731Linelist: React.FC = () => {
29
30
  const endDate = searchParams.get('endDate');
30
31
  const locationUuids = searchParams.get('locationUuids');
31
32
 
32
- const locationName = useLocationName(locationUuids);
33
+ /* the rows cover the whole facility (as the figures do), so it is named by
34
+ its parent location, e.g. MTRH, with the clinics it includes; the
35
+ location's own name until that loads */
36
+ const facility = useFacility(locationUuids, useLocationName(locationUuids));
33
37
 
34
38
  const isTotal = totalCodes.length > 0;
35
39
  const parts = (isTotal ? totalCodes : [code]).map((partCode) => MOH_731_INDICATORS[partCode]);
@@ -83,7 +87,8 @@ const Moh731Linelist: React.FC = () => {
83
87
  parentPath="/moh-731"
84
88
  title={figure ? `${section.title} · ${block}` : 'MOH 731 Linelist'}
85
89
  heading={heading}
86
- location={locationName}
90
+ location={facility.name}
91
+ locationClinics={facility.clinics}
87
92
  isLoading={isLoading}
88
93
  isEmpty={rows.length === 0}
89
94
  >
@@ -16,6 +16,7 @@ import { ReportSkeleton } from '../../common/report-skeleton';
16
16
  import { downloadSheetPdf, usePageScale } from '../../common/report-page';
17
17
  import Moh731Summary from './summary/moh-731-summary.component';
18
18
  import { useOpenMoh731Linelist } from './linelist/use-open-moh-731-linelist';
19
+ import { useFacilityName } from '../../common/report-header';
19
20
 
20
21
  interface Moh731Props {}
21
22
 
@@ -80,12 +81,14 @@ const Moh731Report: React.FC<Moh731Props> = () => {
80
81
 
81
82
  /* The sign-off records who produced the return and when. Designation and
82
83
  signature stay blank -- those are filled in by hand on the printed sheet. */
83
- /* The masthead names the location the report was generated from, so the
84
- session location leads and the ETL's own facility field is the fallback.
84
+ /* The masthead names the facility the figures cover. The ETL counts the
85
+ session location's whole facility (its parent location and every clinic
86
+ under it), so the parent's name leads, e.g. MTRH rather than MTRH Module 1;
87
+ until it loads, the session location, then the ETL's own facility field.
85
88
  County, sub-county and MFL come from the response where the ETL supplies
86
89
  them (the same keys MOH-740 returns). Month and year come from the period
87
90
  the report was actually generated for, not from today. */
88
- const facility = session?.sessionLocation?.display ?? moh731Data?.facility ?? '';
91
+ const facility = useFacilityName(locationUuids, session?.sessionLocation?.display ?? moh731Data?.facility ?? '');
89
92
  const county = moh731Data?.county ?? '';
90
93
  const subCounty = moh731Data?.sub_county ?? '';
91
94
  const mflCode = moh731Data?.mfl_code ?? '';