@kenyaemr/esm-lab-manifest-app 5.4.2-pre.2349 → 5.4.2-pre.2354
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/129.js +1 -1
- package/dist/162.js +1 -1
- package/dist/238.js +1 -1
- package/dist/264.js +1 -1
- package/dist/376.js +1 -1
- package/dist/391.js +1 -1
- package/dist/449.js +1 -1
- package/dist/726.js +1 -1
- package/dist/741.js +1 -1
- package/dist/746.js +1 -1
- package/dist/831.js +1 -1
- package/dist/832.js +1 -1
- package/dist/kenyaemr-esm-lab-manifest-app.js +1 -1
- package/dist/kenyaemr-esm-lab-manifest-app.js.buildmanifest.json +39 -39
- package/dist/kenyaemr-esm-lab-manifest-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -2
package/dist/726.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app=globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app||[]).push([[726],{21513:(e,t,n)=>{n.d(t,{oA:()=>i,TE:()=>s,Zl:()=>l});var r=n(38254),a=n(85216),o=n(63349);const l=function(e){var t,n,l="".concat(r.restBaseUrl,"/labmanifest?v=full&status=").concat(e),i=(0,a.Ay)(l,r.openmrsFetch),s=i.isLoading,u=i.error,c=i.data;return{isLoading:s,manifests:(null!==(n=null==c||null===(t=c.data)||void 0===t?void 0:t.results)&&void 0!==n?n:[]).map(o.iM),error:u}},i=function(e){var t="".concat(r.restBaseUrl,"/labmanifest/").concat(e),n=(0,a.Ay)(t,r.openmrsFetch),l=n.isLoading,i=n.error,s=n.data,u=n.mutate;return{isLoading:l,error:i,manifest:(null==s?void 0:s.data)?(0,o.iM)(s.data):void 0,mutate:u}},s=function(){var e,t="".concat(r.restBaseUrl,"/kemrorder/manifestmetrics"),n=(0,a.Ay)(t,r.openmrsFetch),o=n.isLoading,l=n.data,i=n.error,s=(n.isValidating,(null==l?void 0:l.data)?{Draft:(e=l.data).manifestsDraft,"On Hold":e.manifestsOnHold,"Ready to send":e.manifestsReadyToSend,Sending:e.manifestsSending,Submitted:e.manifestsSubmitted,"Complete errors":e.errorsOnComplete,"Complete results":e.manifestsComplete,"Incomplete errors":e.errorsOnIncomplete,"Incomplete results":e.manifestsIncomplete,summaryGraph:e.summaryGraph,userHasSettingsEditRole:e.userHasSettingsEditRole}:null);return{isLoading:o,error:i,metrics:s,statusAggregates:function(e){var t=0;return e.forEach((function(e){var n;t+=null!==(n=null==s?void 0:s[e])&&void 0!==n?n:0})),t}}}},25625:(e,t,n)=>{n.d(t,{A:()=>A});var r=n(75198),a=n(2326),o=n(18282),l=n(85848),i=n(38254),s=n(10570),u=n(90380),c=n.n(u),m=n(93150),d=n(21513),f=n(85216);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const b=function(e){var t,n,r,a,o=(r=(0,u.useState)(""),a=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}}(r,a)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}(r,a)||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=o[0],s=o[1],c=(0,i.useDebounce)(l,500),m="".concat(i.restBaseUrl,"/labmanifestorder?v=full&manifestuuid=").concat(e,"&q=").concat(c),d=(0,f.Ay)(m,i.openmrsFetch),b=d.data,v=d.isLoading,h=d.error;return d.mutate,{labmanifestOrders:null!==(n=null==b||null===(t=b.data)||void 0===t?void 0:t.results)&&void 0!==n?n:[],searchValue:l,setSearchvalue:s,isLoading:v,error:h}};var v=n(63349),h=n(46696),y=n(89190);const g=function(e){var t=e.patient,n=null!=t?t:{},r=n.display,a=n.uuid;return c().createElement(i.ConfigurableLink,{to:"${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary",templateParams:{patientUuid:a},style:{textDecoration:"none"}},r)};function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n,r,a,o,l){try{var i=e[o](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,a)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function l(e){w(o,r,a,l,i,"next",e)}function i(e){w(o,r,a,l,i,"throw",e)}l(void 0)}))}}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){k(e,t,n[t])}))}return e}function C(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=i(0),l.throw=i(1),l.return=i(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}const A=function(e){var t,n,f,p=e.manifestUuid,w=(0,d.oA)(p),k=w.error,A=w.isLoading,D=w.manifest,T=b(p),P=T.labmanifestOrders,j=T.setSearchvalue,N=T.searchValue,R=T.isLoading,B=T.error,I=(0,m.useTranslation)().t,M=(n=(0,u.useState)(10),f=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}}(n,f)||function(e,t){if(e){if("string"==typeof e)return S(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)?S(e,t):void 0}}(n,f)||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=M[0],U=M[1],x=I("labManifestSamples","Lab Manifest Samples"),F=(0,i.usePagination)(P,L),H=F.results,_=F.totalPages,z=F.currentPage,q=F.goTo,K=(0,s.WK)(L,_,z,H.length).pageSizes,V=[{header:I("patient","Patient"),key:"patientName"},{header:I("cccKDODNumber","CCC/KDOD Number"),key:"cccKDODNumber"},{header:I("batchNumber","Batch Number"),key:"batchNumber"},{header:I("sampleType","Sample type"),key:"sampleType"},{header:I("status","Status"),key:"status"},{header:I("dateRequested","Date Requested"),key:"dateRequested",isSortable:!0},{header:I("resultDate","Result Date"),key:"resultDate",isSortable:!0},{header:I("result","Result"),key:"result"},{header:I("actions","Actions"),key:"actions"}],$=null!==(t=null==H?void 0:H.map((function(e){var t,n,l,s,u,m,d;return{id:"".concat(e.uuid),sampleType:null!==(u=e.sampleType)&&void 0!==u?u:"--",status:e.status,batchNumber:null!==(m=e.batchNumber)&&void 0!==m?m:"--",patientName:c().createElement(g,{patient:null==e||null===(t=e.order)||void 0===t?void 0:t.patient}),cccKDODNumber:(null==e||null===(n=e.order)||void 0===n?void 0:n.patient)?c().createElement(y.A,{patientUuid:null==e||null===(s=e.order)||void 0===s||null===(l=s.patient)||void 0===l?void 0:l.uuid}):"--",dateRequested:e.dateSent?(0,i.formatDate)((0,i.parseDate)(e.dateSent)):"--",resultDate:e.resultDate?(0,i.formatDate)((0,i.parseDate)(e.resultDate)):"--",result:null!==(d=e.result)&&void 0!==d?d:"--",actions:c().createElement(r.ButtonSet,{className:h.A.btnSet},v.nY.includes(null==D?void 0:D.manifestStatus)&&c().createElement(r.Button,{renderIcon:a.zH,className:h.A.btn,hasIconOnly:!0,kind:"ghost",iconDescription:I("removeFromManifest","Remove from Manifest"),onClick:function(){return t=e.uuid,void(n=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return n()},samples:P.filter((function(e){return e.uuid===t})),onDelete:function(){return E((function(){var e,r,a,o,l,s;return C(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,(0,v.zg)(t)];case 1:return u.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),n(),(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:I("sampleRemoveSuccess","Sample removed from manifest successfully!")}),[3,3];case 2:return e=u.sent(),o=P.find((function(e){return e.uuid===t})),(0,i.showSnackbar)({title:I("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(l=o.id)&&void 0!==l?l:null==o?void 0:o.uuid}),kind:"error",subtitle:"".concat(null!==(s=null==e||null===(a=e.responseBody)||void 0===a||null===(r=a.error)||void 0===r?void 0:r.message)&&void 0!==s?s:null==e?void 0:e.message," ")}),[3,3];case 3:return[2]}}))}))()}}));var t,n}}),c().createElement(r.Button,{className:h.A.btn,renderIcon:o.xj,hasIconOnly:!0,kind:"ghost",iconDescription:I("printSpecimenLabel","Print Specimen Label"),onClick:function(){return function(e){return E((function(){return C(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,v.sN)(e.uuid)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,i.showSnackbar)({title:"Failure",subtitle:"Error specimen label",kind:"error"}),[3,3];case 3:return[2]}}))}))()}(e)}}))}})))&&void 0!==t?t:[];return A||R?c().createElement(r.DataTableSkeleton,{rowCount:5}):k||B?c().createElement(i.ErrorState,{headerTitle:x,error:k}):0===P.length?c().createElement(s.pp,{headerTitle:I("manifestSamples","Manifest Samples"),displayText:I("labManifestSamples","Lab manifest samples")}):c().createElement("div",{className:h.A.widgetContainer},c().createElement(r.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=$?$:[],headers:V,render:function(e){var t=e.rows,n=e.headers,a=e.getHeaderProps,o=e.getRowProps,u=e.getSelectionProps,m=e.getTableProps,d=e.getTableContainerProps,f=e.selectedRows;return c().createElement(c().Fragment,null,c().createElement(s.aR,{title:x},c().createElement(r.Button,{onClick:function(){var e=f.map((function(e){var t=e.id;return P.find((function(e){return e.uuid===t}))}));!function(e){if(e.length>0)var t=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return t()},samples:e,onDelete:function(){return E((function(){var n;return C(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,Promise.allSettled(e.map((function(e){var t=e.uuid;return(0,v.zg)(t)})))];case 1:return n=r.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),t(),n.forEach((function(t,n){var r,a,o,l,s,u,c=e[n];"rejected"===t.status?(0,i.showSnackbar)({title:I("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(s=c.id)&&void 0!==s?s:c.uuid}),kind:"error",subtitle:"".concat(null!==(u=null===(o=t.reason)||void 0===o||null===(a=o.responseBody)||void 0===a||null===(r=a.error)||void 0===r?void 0:r.message)&&void 0!==u?u:null===(l=t.reason)||void 0===l?void 0:l.message," ")}):(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:"Sample removed from manifest successfully!"})})),[3,3];case 2:return r.sent(),(0,i.showSnackbar)({title:"Failure",kind:"error",subtitle:"Error removing sample from the manifest"}),[3,3];case 3:return[2]}}))}))()}})}(e)},renderIcon:l.Qp,kind:"ghost"},I("deleteSelectedSamples","Remove Selected Samples"))),c().createElement(r.Search,{labelText:"",value:N,onChange:function(e){var t=e.target.value;return j(t)}}),c().createElement(r.TableContainer,d(),c().createElement(r.Table,m(),c().createElement(r.TableHead,null,c().createElement(r.TableRow,null,c().createElement(r.TableSelectAll,u()),n.map((function(e,t){return c().createElement(r.TableHeader,O({key:t},a({header:e,isSortable:!0})),e.header)})))),c().createElement(r.TableBody,null,t.map((function(e,t){return c().createElement(r.TableRow,(n=O({key:t},o({row:e})),a=null!=(a={onClick:function(e){}})?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(a)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))})),n),c().createElement(r.TableSelectRow,u({row:e})),e.cells.map((function(e){return c().createElement(r.TableCell,{key:e.id},e.value)})));var n,a}))))))}}),c().createElement(r.Pagination,{page:z,pageSize:L,pageSizes:K,totalItems:P.length,onChange:function(e){var t=e.page,n=e.pageSize;q(t),U(n)}}))}},47726:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var r=n(75198),a=n(90380),o=n.n(a),l=n(93150),i=n(25625),s=n(86532);const u=function(e){var t=e.manifest,n=e.onClose,a=e.onConfirm,u=(0,l.useTranslation)().t;return o().createElement(o().Fragment,null,o().createElement(r.ModalHeader,{className:s.A.sectionHeader,closeModal:n},u("confirmChangeOfManifestStatus","Confirm change of manifest status")),o().createElement(r.ModalBody,null,o().createElement("span",{className:s.A.modalQuiz},u("manifestStatusChangeConfirmationQuestion",'Are you sure you want to change this manifest status from "Draft" to "Ready to Send"?Please review the manifest and confirm all added patients have the correct details and a physical sample before submitting for e-logging to reference Labs. ')),o().createElement("div",{className:s.A.previewContainer},o().createElement(i.A,{manifestUuid:t.uuid}))),o().createElement(r.ModalFooter,null,o().createElement(r.ButtonSet,{className:s.A.buttonSet},o().createElement(r.Button,{kind:"secondary",onClick:n,className:s.A.button},u("cancel","Cancel")),o().createElement(r.Button,{kind:"primary",onClick:a,className:s.A.button},u("confirm","Confirm")))))}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app=globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app||[]).push([[726],{21513:(e,t,n)=>{n.d(t,{oA:()=>i,TE:()=>s,Zl:()=>l});var r=n(83437),a=n(85216),o=n(63349);const l=function(e){var t,n,l="".concat(r.restBaseUrl,"/labmanifest?v=full&status=").concat(e),i=(0,a.Ay)(l,r.openmrsFetch),s=i.isLoading,u=i.error,c=i.data;return{isLoading:s,manifests:(null!==(n=null==c||null===(t=c.data)||void 0===t?void 0:t.results)&&void 0!==n?n:[]).map(o.iM),error:u}},i=function(e){var t="".concat(r.restBaseUrl,"/labmanifest/").concat(e),n=(0,a.Ay)(t,r.openmrsFetch),l=n.isLoading,i=n.error,s=n.data,u=n.mutate;return{isLoading:l,error:i,manifest:(null==s?void 0:s.data)?(0,o.iM)(s.data):void 0,mutate:u}},s=function(){var e,t="".concat(r.restBaseUrl,"/kemrorder/manifestmetrics"),n=(0,a.Ay)(t,r.openmrsFetch),o=n.isLoading,l=n.data,i=n.error,s=(n.isValidating,(null==l?void 0:l.data)?{Draft:(e=l.data).manifestsDraft,"On Hold":e.manifestsOnHold,"Ready to send":e.manifestsReadyToSend,Sending:e.manifestsSending,Submitted:e.manifestsSubmitted,"Complete errors":e.errorsOnComplete,"Complete results":e.manifestsComplete,"Incomplete errors":e.errorsOnIncomplete,"Incomplete results":e.manifestsIncomplete,summaryGraph:e.summaryGraph,userHasSettingsEditRole:e.userHasSettingsEditRole}:null);return{isLoading:o,error:i,metrics:s,statusAggregates:function(e){var t=0;return e.forEach((function(e){var n;t+=null!==(n=null==s?void 0:s[e])&&void 0!==n?n:0})),t}}}},25625:(e,t,n)=>{n.d(t,{A:()=>A});var r=n(75198),a=n(2326),o=n(18282),l=n(85848),i=n(83437),s=n(10570),u=n(90380),c=n.n(u),m=n(93150),d=n(21513),f=n(85216);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const b=function(e){var t,n,r,a,o=(r=(0,u.useState)(""),a=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}}(r,a)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}(r,a)||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=o[0],s=o[1],c=(0,i.useDebounce)(l,500),m="".concat(i.restBaseUrl,"/labmanifestorder?v=full&manifestuuid=").concat(e,"&q=").concat(c),d=(0,f.Ay)(m,i.openmrsFetch),b=d.data,v=d.isLoading,h=d.error;return d.mutate,{labmanifestOrders:null!==(n=null==b||null===(t=b.data)||void 0===t?void 0:t.results)&&void 0!==n?n:[],searchValue:l,setSearchvalue:s,isLoading:v,error:h}};var v=n(63349),h=n(46696),y=n(89190);const g=function(e){var t=e.patient,n=null!=t?t:{},r=n.display,a=n.uuid;return c().createElement(i.ConfigurableLink,{to:"${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary",templateParams:{patientUuid:a},style:{textDecoration:"none"}},r)};function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n,r,a,o,l){try{var i=e[o](l),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,a)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function l(e){w(o,r,a,l,i,"next",e)}function i(e){w(o,r,a,l,i,"throw",e)}l(void 0)}))}}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){k(e,t,n[t])}))}return e}function C(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=i(0),l.throw=i(1),l.return=i(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}const A=function(e){var t,n,f,p=e.manifestUuid,w=(0,d.oA)(p),k=w.error,A=w.isLoading,D=w.manifest,T=b(p),P=T.labmanifestOrders,j=T.setSearchvalue,N=T.searchValue,R=T.isLoading,B=T.error,I=(0,m.useTranslation)().t,M=(n=(0,u.useState)(10),f=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}}(n,f)||function(e,t){if(e){if("string"==typeof e)return S(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)?S(e,t):void 0}}(n,f)||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=M[0],U=M[1],x=I("labManifestSamples","Lab Manifest Samples"),F=(0,i.usePagination)(P,L),H=F.results,_=F.totalPages,z=F.currentPage,q=F.goTo,K=(0,s.WK)(L,_,z,H.length).pageSizes,V=[{header:I("patient","Patient"),key:"patientName"},{header:I("cccKDODNumber","CCC/KDOD Number"),key:"cccKDODNumber"},{header:I("batchNumber","Batch Number"),key:"batchNumber"},{header:I("sampleType","Sample type"),key:"sampleType"},{header:I("status","Status"),key:"status"},{header:I("dateRequested","Date Requested"),key:"dateRequested",isSortable:!0},{header:I("resultDate","Result Date"),key:"resultDate",isSortable:!0},{header:I("result","Result"),key:"result"},{header:I("actions","Actions"),key:"actions"}],$=null!==(t=null==H?void 0:H.map((function(e){var t,n,l,s,u,m,d;return{id:"".concat(e.uuid),sampleType:null!==(u=e.sampleType)&&void 0!==u?u:"--",status:e.status,batchNumber:null!==(m=e.batchNumber)&&void 0!==m?m:"--",patientName:c().createElement(g,{patient:null==e||null===(t=e.order)||void 0===t?void 0:t.patient}),cccKDODNumber:(null==e||null===(n=e.order)||void 0===n?void 0:n.patient)?c().createElement(y.A,{patientUuid:null==e||null===(s=e.order)||void 0===s||null===(l=s.patient)||void 0===l?void 0:l.uuid}):"--",dateRequested:e.dateSent?(0,i.formatDate)((0,i.parseDate)(e.dateSent)):"--",resultDate:e.resultDate?(0,i.formatDate)((0,i.parseDate)(e.resultDate)):"--",result:null!==(d=e.result)&&void 0!==d?d:"--",actions:c().createElement(r.ButtonSet,{className:h.A.btnSet},v.nY.includes(null==D?void 0:D.manifestStatus)&&c().createElement(r.Button,{renderIcon:a.zH,className:h.A.btn,hasIconOnly:!0,kind:"ghost",iconDescription:I("removeFromManifest","Remove from Manifest"),onClick:function(){return t=e.uuid,void(n=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return n()},samples:P.filter((function(e){return e.uuid===t})),onDelete:function(){return E((function(){var e,r,a,o,l,s;return C(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,(0,v.zg)(t)];case 1:return u.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),n(),(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:I("sampleRemoveSuccess","Sample removed from manifest successfully!")}),[3,3];case 2:return e=u.sent(),o=P.find((function(e){return e.uuid===t})),(0,i.showSnackbar)({title:I("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(l=o.id)&&void 0!==l?l:null==o?void 0:o.uuid}),kind:"error",subtitle:"".concat(null!==(s=null==e||null===(a=e.responseBody)||void 0===a||null===(r=a.error)||void 0===r?void 0:r.message)&&void 0!==s?s:null==e?void 0:e.message," ")}),[3,3];case 3:return[2]}}))}))()}}));var t,n}}),c().createElement(r.Button,{className:h.A.btn,renderIcon:o.xj,hasIconOnly:!0,kind:"ghost",iconDescription:I("printSpecimenLabel","Print Specimen Label"),onClick:function(){return function(e){return E((function(){return C(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,v.sN)(e.uuid)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,i.showSnackbar)({title:"Failure",subtitle:"Error specimen label",kind:"error"}),[3,3];case 3:return[2]}}))}))()}(e)}}))}})))&&void 0!==t?t:[];return A||R?c().createElement(r.DataTableSkeleton,{rowCount:5}):k||B?c().createElement(i.ErrorState,{headerTitle:x,error:k}):0===P.length?c().createElement(s.pp,{headerTitle:I("manifestSamples","Manifest Samples"),displayText:I("labManifestSamples","Lab manifest samples")}):c().createElement("div",{className:h.A.widgetContainer},c().createElement(r.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=$?$:[],headers:V,render:function(e){var t=e.rows,n=e.headers,a=e.getHeaderProps,o=e.getRowProps,u=e.getSelectionProps,m=e.getTableProps,d=e.getTableContainerProps,f=e.selectedRows;return c().createElement(c().Fragment,null,c().createElement(s.aR,{title:x},c().createElement(r.Button,{onClick:function(){var e=f.map((function(e){var t=e.id;return P.find((function(e){return e.uuid===t}))}));!function(e){if(e.length>0)var t=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return t()},samples:e,onDelete:function(){return E((function(){var n;return C(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,Promise.allSettled(e.map((function(e){var t=e.uuid;return(0,v.zg)(t)})))];case 1:return n=r.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),t(),n.forEach((function(t,n){var r,a,o,l,s,u,c=e[n];"rejected"===t.status?(0,i.showSnackbar)({title:I("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(s=c.id)&&void 0!==s?s:c.uuid}),kind:"error",subtitle:"".concat(null!==(u=null===(o=t.reason)||void 0===o||null===(a=o.responseBody)||void 0===a||null===(r=a.error)||void 0===r?void 0:r.message)&&void 0!==u?u:null===(l=t.reason)||void 0===l?void 0:l.message," ")}):(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:"Sample removed from manifest successfully!"})})),[3,3];case 2:return r.sent(),(0,i.showSnackbar)({title:"Failure",kind:"error",subtitle:"Error removing sample from the manifest"}),[3,3];case 3:return[2]}}))}))()}})}(e)},renderIcon:l.Qp,kind:"ghost"},I("deleteSelectedSamples","Remove Selected Samples"))),c().createElement(r.Search,{labelText:"",value:N,onChange:function(e){var t=e.target.value;return j(t)}}),c().createElement(r.TableContainer,d(),c().createElement(r.Table,m(),c().createElement(r.TableHead,null,c().createElement(r.TableRow,null,c().createElement(r.TableSelectAll,u()),n.map((function(e,t){return c().createElement(r.TableHeader,O({key:t},a({header:e,isSortable:!0})),e.header)})))),c().createElement(r.TableBody,null,t.map((function(e,t){return c().createElement(r.TableRow,(n=O({key:t},o({row:e})),a=null!=(a={onClick:function(e){}})?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(a)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))})),n),c().createElement(r.TableSelectRow,u({row:e})),e.cells.map((function(e){return c().createElement(r.TableCell,{key:e.id},e.value)})));var n,a}))))))}}),c().createElement(r.Pagination,{page:z,pageSize:L,pageSizes:K,totalItems:P.length,onChange:function(e){var t=e.page,n=e.pageSize;q(t),U(n)}}))}},47726:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var r=n(75198),a=n(90380),o=n.n(a),l=n(93150),i=n(25625),s=n(86532);const u=function(e){var t=e.manifest,n=e.onClose,a=e.onConfirm,u=(0,l.useTranslation)().t;return o().createElement(o().Fragment,null,o().createElement(r.ModalHeader,{className:s.A.sectionHeader,closeModal:n},u("confirmChangeOfManifestStatus","Confirm change of manifest status")),o().createElement(r.ModalBody,null,o().createElement("span",{className:s.A.modalQuiz},u("manifestStatusChangeConfirmationQuestion",'Are you sure you want to change this manifest status from "Draft" to "Ready to Send"?Please review the manifest and confirm all added patients have the correct details and a physical sample before submitting for e-logging to reference Labs. ')),o().createElement("div",{className:s.A.previewContainer},o().createElement(i.A,{manifestUuid:t.uuid}))),o().createElement(r.ModalFooter,null,o().createElement(r.ButtonSet,{className:s.A.buttonSet},o().createElement(r.Button,{kind:"secondary",onClick:n,className:s.A.button},u("cancel","Cancel")),o().createElement(r.Button,{kind:"primary",onClick:a,className:s.A.button},u("confirm","Confirm")))))}}}]);
|
package/dist/741.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app=globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app||[]).push([[441,741],{14441:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});const t=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}},32741:(e,n,a)=>{"use strict";a.r(n),a.d(n,{importTranslation:()=>u,labManifestForm:()=>h,labManifestOrderToManifestForm:()=>T,labManifestOverview:()=>b,manifestOverviewDashboardLink:()=>L,manifestStatusChangeConfirmModal:()=>_,manifestsDashboardLink:()=>w,requeueLabManifestConfirmModal:()=>g,root:()=>d,sampleDeleteConfirmDialog:()=>v,startupApp:()=>y});var t=a(
|
|
1
|
+
(globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app=globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app||[]).push([[441,741],{14441:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});const t=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}},32741:(e,n,a)=>{"use strict";a.r(n),a.d(n,{importTranslation:()=>u,labManifestForm:()=>h,labManifestOrderToManifestForm:()=>T,labManifestOverview:()=>b,manifestOverviewDashboardLink:()=>L,manifestStatusChangeConfirmModal:()=>_,manifestsDashboardLink:()=>w,requeueLabManifestConfirmModal:()=>g,root:()=>d,sampleDeleteConfirmDialog:()=>v,startupApp:()=>y});var t=a(83437),i={labmanifestTypes:{_type:t.Type.Array,_description:"List of Lab manifest types",_default:[{id:1,type:"EID"},{id:2,type:"VL"},{id:3,type:"Influenza"}]},sampleTypes:{_type:t.Type.Array,_description:"List of sample types and list of manifest type id it applies",_default:[{sampleType:"Frozen plasma",labManifestType:["2"]},{sampleType:"Whole Blood",labManifestType:["2"]},{sampleType:"DBS",labManifestType:["1"]},{sampleType:"Nasal Swab",labManifestType:["3"]},{sampleType:"NP",labManifestType:["3"]},{sampleType:"OP",labManifestType:["3"]}]},patientIdentifierTypes:{_type:t.Type.Object,_description:"Patient identifier type uuids",_default:{cccNumberIdentifierType:"05ee9cf4-7242-4a17-b4d4-00f707265c8a",kdodIdentifierType:"b51ffe55-3e76-44f8-89a2-14f5eaf11079"}}},s=a(90380),r=a.n(s),l=a(14441),o=a(8877);function f(e){var n=e.config,a=n.name,i=n.title,f=(0,o.useLocation)(),c=window.getOpenmrsSpaBase()+"home",p=(0,s.useMemo)((function(){return decodeURIComponent((0,l.A)(f.pathname.split("/")))}),[f.pathname]);return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/.test(p)?p=f.pathname.split("/").at(-2):"overview"===p&&f.pathname.includes("lab-manifest")&&(p=f.pathname.replace(c+"/","")),r().createElement(t.ConfigurableLink,{to:c+"/"+a,className:"cds--side-nav__link ".concat(a===p&&"active-left-nav-link")},i)}var c=function(e){return function(){return r().createElement(o.BrowserRouter,null,r().createElement(f,{config:e}))}},p="@kenyaemr/esm-lab-manifest-app",m={featureName:"esm-lab-manifest-app",moduleName:p},u=a(84767);function y(){var e="".concat(window.spaBase,"/home/lab-manifest");(0,t.defineConfigSchema)(p,i),(0,t.registerBreadcrumbs)([{title:"lab-manifest",path:e,parent:"".concat(window.spaBase,"/home")}])}var d=(0,t.getAsyncLifecycle)((function(){return Promise.all([a.e(285),a.e(216),a.e(763),a.e(814),a.e(113),a.e(162),a.e(212),a.e(221),a.e(795),a.e(772),a.e(831),a.e(119),a.e(129),a.e(569),a.e(449),a.e(746)]).then(a.bind(a,74746))}),m),b=(0,t.getAsyncLifecycle)((function(){return Promise.all([a.e(285),a.e(216),a.e(113),a.e(212),a.e(772),a.e(119),a.e(449),a.e(625)]).then(a.bind(a,58449))}),m),h=(0,t.getAsyncLifecycle)((function(){return Promise.all([a.e(285),a.e(113),a.e(160),a.e(119),a.e(264),a.e(238)]).then(a.bind(a,74238))}),m),T=(0,t.getAsyncLifecycle)((function(){return Promise.all([a.e(285),a.e(216),a.e(113),a.e(160),a.e(119),a.e(264),a.e(129),a.e(376)]).then(a.bind(a,14376))}),m),v=(0,t.getAsyncLifecycle)((function(){return Promise.all([a.e(285),a.e(216),a.e(119),a.e(129),a.e(832)]).then(a.bind(a,86496))}),m),_=(0,t.getAsyncLifecycle)((function(){return Promise.all([a.e(285),a.e(216),a.e(763),a.e(814),a.e(113),a.e(162),a.e(221),a.e(831),a.e(119),a.e(264),a.e(129),a.e(569),a.e(726)]).then(a.bind(a,47726))}),m),g=(0,t.getAsyncLifecycle)((function(){return Promise.all([a.e(285),a.e(113),a.e(119),a.e(264),a.e(391)]).then(a.bind(a,24391))}),m),L=(0,t.getSyncLifecycle)(c({name:"lab-manifest/overview",title:"Overview"}),m),w=(0,t.getSyncLifecycle)(c({name:"lab-manifest",title:"Manifests"}),m)},84767:(e,n,a)=>{var t={"./am.json":[81197,197],"./en.json":[34300,300],"./sw.json":[89913,294]};function i(e){if(!a.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],i=n[0];return a.e(n[1]).then((()=>a(i)))}i.keys=()=>Object.keys(t),i.id=84767,e.exports=i}}]);
|
package/dist/746.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app=globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app||[]).push([[746],{25625:(e,t,n)=>{n.d(t,{A:()=>C});var a=n(75198),r=n(2326),l=n(18282),o=n(85848),i=n(38254),s=n(10570),u=n(90380),c=n.n(u),d=n(93150),m=n(21513),f=n(85216);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}const b=function(e){var t,n,a,r,l=(a=(0,u.useState)(""),r=2,function(e){if(Array.isArray(e))return e}(a)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(a,r)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}(a,r)||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.")}()),o=l[0],s=l[1],c=(0,i.useDebounce)(o,500),d="".concat(i.restBaseUrl,"/labmanifestorder?v=full&manifestuuid=").concat(e,"&q=").concat(c),m=(0,f.Ay)(d,i.openmrsFetch),b=m.data,v=m.isLoading,h=m.error;return m.mutate,{labmanifestOrders:null!==(n=null==b||null===(t=b.data)||void 0===t?void 0:t.results)&&void 0!==n?n:[],searchValue:o,setSearchvalue:s,isLoading:v,error:h}};var v=n(63349),h=n(46696),y=n(89190);const g=function(e){var t=e.patient,n=null!=t?t:{},a=n.display,r=n.uuid;return c().createElement(i.ConfigurableLink,{to:"${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary",templateParams:{patientUuid:r},style:{textDecoration:"none"}},a)};function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function E(e,t,n,a,r,l,o){try{var i=e[l](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(a,r)}function S(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var l=e.apply(t,n);function o(e){E(l,a,r,o,i,"next",e)}function i(e){E(l,a,r,o,i,"throw",e)}o(void 0)}))}}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),a.forEach((function(t){k(e,t,n[t])}))}return e}function T(e,t){var n,a,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(n=1,a&&(r=2&i[0]?a.return:i[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,i[1])).done)return r;switch(a=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,a=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((r=(r=l.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){l.label=i[1];break}if(6===i[0]&&l.label<r[1]){l.label=r[1],r=i;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(i);break}r[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],a=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}const C=function(e){var t,n,f,p=e.manifestUuid,E=(0,m.oA)(p),k=E.error,C=E.isLoading,D=E.manifest,O=b(p),_=O.labmanifestOrders,P=O.setSearchvalue,M=O.searchValue,$=O.isLoading,x=O.error,R=(0,d.useTranslation)().t,I=(n=(0,u.useState)(10),f=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(n,f)||function(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}(n,f)||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.")}()),j=I[0],N=I[1],L=R("labManifestSamples","Lab Manifest Samples"),B=(0,i.usePagination)(_,j),U=B.results,q=B.totalPages,z=B.currentPage,F=B.goTo,H=(0,s.WK)(j,q,z,U.length).pageSizes,K=[{header:R("patient","Patient"),key:"patientName"},{header:R("cccKDODNumber","CCC/KDOD Number"),key:"cccKDODNumber"},{header:R("batchNumber","Batch Number"),key:"batchNumber"},{header:R("sampleType","Sample type"),key:"sampleType"},{header:R("status","Status"),key:"status"},{header:R("dateRequested","Date Requested"),key:"dateRequested",isSortable:!0},{header:R("resultDate","Result Date"),key:"resultDate",isSortable:!0},{header:R("result","Result"),key:"result"},{header:R("actions","Actions"),key:"actions"}],G=null!==(t=null==U?void 0:U.map((function(e){var t,n,o,s,u,d,m;return{id:"".concat(e.uuid),sampleType:null!==(u=e.sampleType)&&void 0!==u?u:"--",status:e.status,batchNumber:null!==(d=e.batchNumber)&&void 0!==d?d:"--",patientName:c().createElement(g,{patient:null==e||null===(t=e.order)||void 0===t?void 0:t.patient}),cccKDODNumber:(null==e||null===(n=e.order)||void 0===n?void 0:n.patient)?c().createElement(y.A,{patientUuid:null==e||null===(s=e.order)||void 0===s||null===(o=s.patient)||void 0===o?void 0:o.uuid}):"--",dateRequested:e.dateSent?(0,i.formatDate)((0,i.parseDate)(e.dateSent)):"--",resultDate:e.resultDate?(0,i.formatDate)((0,i.parseDate)(e.resultDate)):"--",result:null!==(m=e.result)&&void 0!==m?m:"--",actions:c().createElement(a.ButtonSet,{className:h.A.btnSet},v.nY.includes(null==D?void 0:D.manifestStatus)&&c().createElement(a.Button,{renderIcon:r.zH,className:h.A.btn,hasIconOnly:!0,kind:"ghost",iconDescription:R("removeFromManifest","Remove from Manifest"),onClick:function(){return t=e.uuid,void(n=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return n()},samples:_.filter((function(e){return e.uuid===t})),onDelete:function(){return S((function(){var e,a,r,l,o,s;return T(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,(0,v.zg)(t)];case 1:return u.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),n(),(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:R("sampleRemoveSuccess","Sample removed from manifest successfully!")}),[3,3];case 2:return e=u.sent(),l=_.find((function(e){return e.uuid===t})),(0,i.showSnackbar)({title:R("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(o=l.id)&&void 0!==o?o:null==l?void 0:l.uuid}),kind:"error",subtitle:"".concat(null!==(s=null==e||null===(r=e.responseBody)||void 0===r||null===(a=r.error)||void 0===a?void 0:a.message)&&void 0!==s?s:null==e?void 0:e.message," ")}),[3,3];case 3:return[2]}}))}))()}}));var t,n}}),c().createElement(a.Button,{className:h.A.btn,renderIcon:l.xj,hasIconOnly:!0,kind:"ghost",iconDescription:R("printSpecimenLabel","Print Specimen Label"),onClick:function(){return function(e){return S((function(){return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,v.sN)(e.uuid)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,i.showSnackbar)({title:"Failure",subtitle:"Error specimen label",kind:"error"}),[3,3];case 3:return[2]}}))}))()}(e)}}))}})))&&void 0!==t?t:[];return C||$?c().createElement(a.DataTableSkeleton,{rowCount:5}):k||x?c().createElement(i.ErrorState,{headerTitle:L,error:k}):0===_.length?c().createElement(s.pp,{headerTitle:R("manifestSamples","Manifest Samples"),displayText:R("labManifestSamples","Lab manifest samples")}):c().createElement("div",{className:h.A.widgetContainer},c().createElement(a.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=G?G:[],headers:K,render:function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,l=e.getRowProps,u=e.getSelectionProps,d=e.getTableProps,m=e.getTableContainerProps,f=e.selectedRows;return c().createElement(c().Fragment,null,c().createElement(s.aR,{title:L},c().createElement(a.Button,{onClick:function(){var e=f.map((function(e){var t=e.id;return _.find((function(e){return e.uuid===t}))}));!function(e){if(e.length>0)var t=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return t()},samples:e,onDelete:function(){return S((function(){var n;return T(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,Promise.allSettled(e.map((function(e){var t=e.uuid;return(0,v.zg)(t)})))];case 1:return n=a.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),t(),n.forEach((function(t,n){var a,r,l,o,s,u,c=e[n];"rejected"===t.status?(0,i.showSnackbar)({title:R("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(s=c.id)&&void 0!==s?s:c.uuid}),kind:"error",subtitle:"".concat(null!==(u=null===(l=t.reason)||void 0===l||null===(r=l.responseBody)||void 0===r||null===(a=r.error)||void 0===a?void 0:a.message)&&void 0!==u?u:null===(o=t.reason)||void 0===o?void 0:o.message," ")}):(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:"Sample removed from manifest successfully!"})})),[3,3];case 2:return a.sent(),(0,i.showSnackbar)({title:"Failure",kind:"error",subtitle:"Error removing sample from the manifest"}),[3,3];case 3:return[2]}}))}))()}})}(e)},renderIcon:o.Qp,kind:"ghost"},R("deleteSelectedSamples","Remove Selected Samples"))),c().createElement(a.Search,{labelText:"",value:M,onChange:function(e){var t=e.target.value;return P(t)}}),c().createElement(a.TableContainer,m(),c().createElement(a.Table,d(),c().createElement(a.TableHead,null,c().createElement(a.TableRow,null,c().createElement(a.TableSelectAll,u()),n.map((function(e,t){return c().createElement(a.TableHeader,A({key:t},r({header:e,isSortable:!0})),e.header)})))),c().createElement(a.TableBody,null,t.map((function(e,t){return c().createElement(a.TableRow,(n=A({key:t},l({row:e})),r=null!=(r={onClick:function(e){}})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n),c().createElement(a.TableSelectRow,u({row:e})),e.cells.map((function(e){return c().createElement(a.TableCell,{key:e.id},e.value)})));var n,r}))))))}}),c().createElement(a.Pagination,{page:z,pageSize:j,pageSizes:H,totalItems:_.length,onChange:function(e){var t=e.page,n=e.pageSize;F(t),N(n)}}))}},74746:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ne});var a=n(90380),r=n.n(a),l=n(8877),o=n(75198),i=n(85848),s=n(38254),u=n(93150),c=n(32588),d=n(10570),m=n(63349),f=n(94897);const p=function(e){var t=e.title,n=e.onFilterChange,a=e.filter,l=(0,u.useTranslation)().t;return r().createElement(d.aR,{title:t},r().createElement("div",{className:f.A.statusFilterContainer},r().createElement(o.Dropdown,{className:f.A.statusFilter,id:"manifestStatus",onChange:function(e){var t=e.selectedItem;n(m.Ou.find((function(e){return e.value===t})).params)},initialSelectedItem:m.Ou.find((function(e){return e.params===a})).value,label:l("selectManifestStatus","Select manifest status"),items:m.Ou.map((function(e){return e.value})),itemToString:function(e){var t,n;return null!==(n=null===(t=m.Ou.find((function(t){return t.value===e})))||void 0===t?void 0:t.label)&&void 0!==n?n:""},titleText:""})))};var b=n(21513),v=n(46696);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function y(e,t,n,a,r,l,o){try{var i=e[l](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(a,r)}function g(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function w(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 a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(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)?h(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 E=function(){var e,t,n=(0,u.useTranslation)().t,l=w((0,a.useState)(10),2),i=l[0],c=l[1],f=w((0,a.useState)("Draft"),2),h=f[0],E=f[1],S=n("lab Manifest","Lab Manifest"),k=(0,s.useLayoutType)(),A=(0,b.Zl)(h),T=A.manifests,C=A.error,D=A.isLoading,O=(0,s.usePagination)(T,i),_=O.results,P=O.totalPages,M=O.currentPage,$=O.goTo,x=(0,d.WK)(i,P,M,_.length).pageSizes,R=(0,s.useConfig)().labmanifestTypes,I="tablet"===k?"lg":"md",j=(0,a.useMemo)((function(){return[{header:n("startDate","Start date"),key:"startDate",isSortable:!0},{header:n("endDate","End date"),key:"endDate",isSortable:!0},{header:n("type","Type"),key:"type",isSortable:!0},{header:n("courrier","Courrier"),key:"courrier"},{header:n("manifestId","Manifest Id"),key:"manifestId"},{header:n("labPersonContact","Lab person contact"),key:"labPersonContact"},{header:n("status","Status"),key:"status"},{header:n("dispatch","Dispatch"),key:"dispatch",isSortable:!0},{header:n("samples","Samples"),key:"samples"},{header:n("actions","Actions"),key:"actions"}]}),[n]),N=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(t=function(){return function(e,t){var n,a,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(n=1,a&&(r=2&i[0]?a.return:i[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,i[1])).done)return r;switch(a=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,a=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((r=(r=l.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){l.label=i[1];break}if(6===i[0]&&l.label<r[1]){l.label=r[1],r=i;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(i);break}r[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],a=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,m.L7)(e.uuid,n)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,s.showSnackbar)({title:"Failure",subtitle:"Error printing manifest",kind:"error"}),[3,3];case 3:return[2]}}))},function(){var e=this,n=arguments;return new Promise((function(a,r){var l=t.apply(e,n);function o(e){y(l,a,r,o,i,"next",e)}function i(e){y(l,a,r,o,i,"throw",e)}o(void 0)}))})()},L=(0,a.useCallback)((function(e){var t=(0,s.showModal)("lab-manifest-requeue-confirn-modal",{labManifest:e,onClose:function(){return t()},filter:h})}),[h]),B=(0,a.useMemo)((function(){var e;return(null!==(e=null==_?void 0:_.map((function(e){var t,a,l,i,u;return{id:"".concat(e.uuid),startDate:(0,s.parseDate)(e.startDate),endDate:e.endDate?(0,s.parseDate)(e.endDate):"--",courrier:e.courierName?e.courierName:"--",labPersonContact:null!==(a=e.labPersonContact)&&void 0!==a?a:"--",type:null!==(l=null===(t=R.find((function(t){return"".concat(t.id)===(null==e?void 0:e.manifestType)})))||void 0===t?void 0:t.type)&&void 0!==l?l:"--",status:null!==(i=e.manifestStatus)&&void 0!==i?i:"--",dispatch:e.dispatchDate?(0,s.parseDate)(e.dispatchDate):"--",manifestId:null!==(u=e.manifestId)&&void 0!==u?u:"--",samples:"".concat(e.samples.length),actions:r().createElement(o.OverflowMenu,{flipped:!0,size:I,"aria-label":"overflow-menu"},r().createElement(o.OverflowMenuItem,{itemText:n("viewManifest","View Manifest"),onClick:function(){return t=e.uuid,void(0,s.navigate)({to:window.getOpenmrsSpaBase()+"home/lab-manifest/".concat(t)});var t}}),m.uV.includes(e.manifestStatus)&&r().createElement(o.OverflowMenuItem,{itemText:n("editmanifest","Edit Manifest"),onClick:function(){return function(e){(0,s.launchWorkspace)("lab-manifest-form",{workspaceTitle:"Lab Manifest Form",manifest:e})}(e)}}),m.BR.includes(e.manifestStatus)&&r().createElement(r().Fragment,null,r().createElement(o.OverflowMenuItem,{itemText:n("printManifest","Print Manifest"),onClick:function(){return N(e)}}),r().createElement(o.OverflowMenuItem,{itemText:n("printManifestLog","Print Manifest Log"),onClick:function(){return N(e,!0)}})),m.fI.includes(e.manifestStatus)&&r().createElement(o.OverflowMenuItem,{itemText:n("requeueManifest","Requeue Manifest"),onClick:function(){return L(e)}}))}})))&&void 0!==e?e:[]).sort((function(e,t){return t.startDate.getTime()-e.startDate.getTime()}))}),[_,L,R,I,n]);return D?r().createElement(o.DataTableSkeleton,{rowCount:5}):C?r().createElement(s.ErrorState,{headerTitle:S,error:C}):0===T.length?r().createElement(o.Layer,{className:v.A.tile},r().createElement(p,{filter:h,onFilterChange:E,title:S}),r().createElement(o.Tile,null,r().createElement(d.K0,null),r().createElement("p",{className:v.A.content},n("notLabManifetToDisplay","There are no {{status}} lab manifets data to display.",{status:null!==(t=null===(e=m.Ou.find((function(e){return e.params===h})))||void 0===e?void 0:e.label)&&void 0!==t?t:""})))):r().createElement("div",{className:v.A.widgetContainer},r().createElement(p,{filter:h,onFilterChange:E,title:S}),r().createElement(o.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=B?B:[],sortRow:function(e,t,n){var a=n.sortDirection,r=n.sortStates,l=n.locale,o=(n.key,n.compare),i=g(e,Date)?e.getTime():e,s=g(t,Date)?t.getTime():t;return a===r.DESC?o(s,i,l):o(i,s,l)},headers:j,render:function(e){var t=e.rows,n=e.headers,a=e.getHeaderProps,l=e.getTableProps,i=e.getTableContainerProps;return r().createElement(o.TableContainer,i(),r().createElement(o.Table,l(),r().createElement(o.TableHead,null,r().createElement(o.TableRow,null,n.map((function(e){return r().createElement(o.TableHeader,a({header:e,isSortable:!0}),e.header)})))),r().createElement(o.TableBody,null,t.map((function(e){return r().createElement(o.TableRow,{key:e.id},e.cells.map((function(e){var t=g(e.value,Date)?(0,s.formatDate)(e.value):e.value;return r().createElement(o.TableCell,{key:e.id},t)})))})))))}}),r().createElement(o.Pagination,{page:M,pageSize:i,pageSizes:x,totalItems:T.length,onChange:function(e){var t=e.page,n=e.pageSize;$(t),c(n)}}))};var S=n(1089);const k=function(){var e=(0,u.useTranslation)().t;return r().createElement("div",{className:"omrs-main-content"},r().createElement(c.a,{title:e("labManifestDashboard","Lab Manifest Dashboard")}),r().createElement(o.Layer,{className:S.A.btnLayer},r().createElement(o.Button,{kind:"ghost",renderIcon:i.OM,iconDescription:e("addNewManifest","Add new Manifest"),onClick:function(){(0,s.launchWorkspace)("lab-manifest-form",{workspaceTitle:"Lab Manifest Form"})}},e("addNewManifest","Add new Manifest"))),r().createElement(E,null))};var A=n(68622),T=n(95795),C=n(18282);function D(e,t,n,a,r,l,o){try{var i=e[l](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(a,r)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var l=e.apply(t,n);function o(e){D(l,a,r,o,i,"next",e)}function i(e){D(l,a,r,o,i,"throw",e)}o(void 0)}))}}function _(e,t){var n,a,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(n=1,a&&(r=2&i[0]?a.return:i[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,i[1])).done)return r;switch(a=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,a=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((r=(r=l.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){l.label=i[1];break}if(6===i[0]&&l.label<r[1]){l.label=r[1],r=i;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(i);break}r[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],a=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}const P=function(e){var t=e.manifestUuid,n=(0,b.oA)(t),a=n.isLoading,l=n.manifest,c=n.mutate,d=(0,u.useTranslation)().t,p=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return O((function(){return _(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,m.L7)(l.uuid,e)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,s.showSnackbar)({title:"Failure",subtitle:"Error printing manifest",kind:"error"}),[3,3];case 3:return[2]}}))}))()};return a?r().createElement(o.Layer,{className:f.A.detailHeaderContainer},r().createElement(o.Tile,{className:f.A.detailHeaderContentLoading},r().createElement(o.Row,{className:f.A.detailHeaderContentRow},Array.from({length:8}).map((function(e,t){return r().createElement(o.SkeletonText,{key:t})}))),r().createElement("hr",null),r().createElement(o.Row,{className:f.A.detailHeaderContentRow},r().createElement(o.SkeletonText,null),r().createElement(o.SkeletonText,null)))):r().createElement(o.Layer,{className:f.A.detailHeaderContainer},r().createElement(o.Tile,{className:f.A.detailHeaderContent},r().createElement(o.Row,{className:f.A.detailHeaderContentRow},r().createElement("span",null,"Start date:"),r().createElement("strong",null,l.startDate?(0,s.formatDate)((0,s.parseDate)(l.startDate)):"--"),r().createElement("span",null,"End date:"),r().createElement("strong",null,l.endDate?(0,s.formatDate)((0,s.parseDate)(l.endDate)):"--"),r().createElement("span",null,"Status:"),r().createElement("strong",null,l.manifestStatus),r().createElement("span",null,"Dispatch date:"),r().createElement("strong",null,l.dispatchDate?(0,s.formatDate)((0,s.parseDate)(l.dispatchDate)):"--")),r().createElement("hr",null),r().createElement(o.Row,{className:f.A.detailHeaderContentRow},r().createElement("span",null,"Total Samples in the Manifest"),r().createElement("span",{className:f.A.samplesCountValue},l.samples.length))),r().createElement(o.Row,{className:f.A.btnSet},r().createElement(o.Button,{kind:"tertiary",renderIcon:i.nk,onClick:function(){(0,s.navigate)({to:window.getOpenmrsSpaBase()+"home/lab-manifest"})}},d("back","Back")),r().createElement(o.Row,{className:f.A.btnSetRight},m.uV.includes(l.manifestStatus)&&r().createElement(o.Button,{kind:"primary",renderIcon:A.ff,onClick:function(){(0,s.launchWorkspace)("lab-manifest-form",{workspaceTitle:"Lab Manifest Form",manifest:l})},size:"md"},d("editManifest","Edit Manifest")),m.fI.includes(l.manifestStatus)&&r().createElement(o.Button,{kind:"tertiary",renderIcon:T.cF,onClick:function(){var e=(0,s.showModal)("lab-manifest-requeue-confirn-modal",{labManifest:l,onClose:function(){e(),c()},filter:l.manifestStatus})},size:"md"},d("requeueManifest","Requeue Manifest")),m.BR.includes(l.manifestStatus)&&r().createElement(r().Fragment,null,r().createElement(o.Button,{kind:"tertiary",renderIcon:C.xj,onClick:function(){return O((function(){return _(this,(function(e){switch(e.label){case 0:return[4,p(!1)];case 1:return[2,e.sent()]}}))}))()},size:"md"},d("printManifest","Print Manifest")),r().createElement(o.Button,{kind:"tertiary",renderIcon:C.xj,onClick:function(){return O((function(){return _(this,(function(e){switch(e.label){case 0:return[4,p(!0)];case 1:return[2,e.sent()]}}))}))()},size:"md"},d("printManifestLog","Print Manifest log"))))))};var M=n(85216);var $=n(89190);function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),a.forEach((function(t){R(e,t,n[t])}))}return e}const j=function(e){var t,n,l,c,m,f,p=e.manifestUuid,b=function(e){var t="".concat(s.restBaseUrl,"/kemrorder/validorders?manifestUuid=").concat(e),n=(0,M.Ay)(t,s.openmrsFetch),a=n.isLoading,r=n.error,l=n.data;return{isLoading:a,request:null==l?void 0:l.data,error:r}}(p),h=b.error,y=b.isLoading,g=b.request,w=(0,u.useTranslation)().t,E=(m=(0,a.useState)(10),f=2,function(e){if(Array.isArray(e))return e}(m)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(m,f)||function(e,t){if(e){if("string"==typeof e)return x(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)?x(e,t):void 0}}(m,f)||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=E[0],k=E[1],A=w("activeRequests","Active Requests"),T=(0,s.usePagination)(null!==(t=null==g?void 0:g.Orders)&&void 0!==t?t:[],S),C=T.results,D=T.totalPages,O=T.currentPage,_=T.goTo,P=(0,d.WK)(S,D,O,C.length).pageSizes,R=[{header:w("patientName","Patient name"),key:"patientName"},{header:w("cccKDODNumber","CCC/KDOD Number"),key:"cccKdod"},{header:w("dateRequested","Date Requested"),key:"dateRequested",isSortable:!0},{header:w("actions","Actions"),key:"actions"}],j=function(e){if(e.length>0)var t=g.Orders.filter((function(t){return e.some((function(e){return e.order.uuid===t.orderUuid}))})),n=(0,s.showModal)("lab-manifest-order-modal-form",{onClose:function(){return n()},props:{title:e.length>1?"Add Multiple Orders To Manifest":void 0,selectedOrders:e,orders:t}})},N=null!==(n=null==C?void 0:C.map((function(e){var t,n;return{id:"".concat(e.orderUuid),patientName:e.patientName?r().createElement(s.ConfigurableLink,{to:"${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary",templateParams:{patientUuid:e.patientUuid},style:{textDecoration:"none"}},e.patientName):"--",cccKdod:(null===(n=e.cccKdod)||void 0===n||null===(t=n.trim())||void 0===t?void 0:t.replaceAll(" ",""))?e.cccKdod:(null==e?void 0:e.patientUuid)?r().createElement($.A,{patientUuid:null==e?void 0:e.patientUuid}):"--",dateRequested:e.dateRequested,actions:r().createElement(o.Button,{kind:"ghost",iconDescription:w("addToManifest","Add To manifest"),renderIcon:i.OM,hasIconOnly:!0,onClick:function(){return j([{labManifest:{uuid:p},order:{uuid:e.orderUuid},payload:e.payload}])}},"Add To manifest")}})))&&void 0!==n?n:[];return y?r().createElement(o.DataTableSkeleton,{rowCount:5}):h?r().createElement(s.ErrorState,{headerTitle:A,error:h}):0===(null!==(l=null==g?void 0:g.Orders)&&void 0!==l?l:[]).length?r().createElement(d.pp,{headerTitle:w("activeRequests","Active Requests"),displayText:w("notLabManifetToDisplay","There is no lab manifets data to display.")}):r().createElement("div",{className:v.A.widgetContainer},r().createElement(o.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=N?N:[],headers:R,render:function(e){var t=e.rows,n=e.headers,a=e.getHeaderProps,l=e.getRowProps,s=e.getSelectionProps,u=e.getTableProps,c=e.getTableContainerProps,m=e.selectedRows;return r().createElement(r().Fragment,null,r().createElement(d.aR,{title:A},r().createElement(o.Button,{onClick:function(){var e=m.map((function(e){var t,n,a=e.id;return{labManifest:{uuid:p},order:{uuid:a},payload:null!==(n=null===(t=g.Orders.find((function(e){return e.orderUuid===a})))||void 0===t?void 0:t.payload)&&void 0!==n?n:""}}));j(e)},renderIcon:i.Qp,kind:"ghost"},w("addSelectedSamples","Add Selected Samples"))),r().createElement(o.TableContainer,c(),r().createElement(o.Table,u(),r().createElement(o.TableHead,null,r().createElement(o.TableRow,null,r().createElement(o.TableSelectAll,s()),n.map((function(e,t){return r().createElement(o.TableHeader,I({key:t},a({header:e,isSortable:!0})),e.header)})))),r().createElement(o.TableBody,null,t.map((function(e,t){return r().createElement(o.TableRow,(n=I({key:t},l({row:e})),a=null!=(a={onClick:function(e){}})?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(a)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))})),n),r().createElement(o.TableSelectRow,s({row:e})),e.cells.map((function(e){return r().createElement(o.TableCell,{key:e.id},e.value)})));var n,a}))))))}}),r().createElement(o.Pagination,{page:O,pageSize:S,pageSizes:P,totalItems:(null!==(c=null==g?void 0:g.Orders)&&void 0!==c?c:[]).length,onChange:function(e){var t=e.page,n=e.pageSize;_(t),k(n)}}))};var N=n(25625),L=n(72591),B=n.n(L),U=n(1740),q=n.n(U),z=n(88128),F=n.n(z),H=n(30855),K=n.n(H),G=n(93051),V=n.n(G),W=n(73656),Z=n.n(W),Y=n(92091),Q={};Q.styleTagTransform=Z(),Q.setAttributes=K(),Q.insert=F().bind(null,"head"),Q.domAPI=q(),Q.insertStyleElement=V(),B()(Y.A,Q);const J=Y.A&&Y.A.locals?Y.A.locals:void 0;var X=function(e){var t=e.manifestUuid,n=(0,u.useTranslation)().t,a=(0,b.oA)(t),l=a.manifest,i=a.isLoading,s=a.error;return i?r().createElement(o.StructuredListSkeleton,null):s?r().createElement(d.W5,{error:s,headerTitle:n("labManifestSamples","Lab Manifest Sample")}):m.Iu.includes(l.manifestStatus)?r().createElement("main",{className:J.tabs},r().createElement(o.Tabs,null,r().createElement(o.TabList,{className:J.tablist,"aria-label":"List tabs",contained:!0},r().createElement(o.Tab,{className:J.tab},n("manifestSamples","ManifestSamples")),r().createElement(o.Tab,{className:J.tab},n("activeRequests","Active Requests"))),r().createElement(o.TabPanels,null,r().createElement(o.TabPanel,null,r().createElement(N.A,{manifestUuid:t})),r().createElement(o.TabPanel,null,r().createElement(j,{manifestUuid:t}))))):r().createElement(N.A,{manifestUuid:t})};const ee=function(){var e=(0,l.useParams)().manifestUuid,t=(0,u.useTranslation)().t;return r().createElement("div",null,r().createElement(c.a,{title:t("labManifest","Lab Manifest")}),r().createElement(P,{manifestUuid:e}),r().createElement(X,{manifestUuid:e}))};var te=n(58449);const ne=function(){var e=window.getOpenmrsSpaBase()+"home/lab-manifest";return r().createElement(l.BrowserRouter,{basename:e},r().createElement(l.Routes,null,r().createElement(l.Route,{path:"/",element:r().createElement(k,null)}),r().createElement(l.Route,{path:"/overview",element:r().createElement(te.default,null)}),r().createElement(l.Route,{path:"/:manifestUuid",element:r().createElement(ee,null)})))}},92091:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(30977),r=n.n(a),l=n(95924),o=n.n(l)()(r());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-lab-manifest__lab-manifest-tabs__tabs___GwYzm{grid-column:span 2}.-esm-lab-manifest__lab-manifest-tabs__tablist___UVTq8{padding:0 1rem}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9{min-width:8.875rem}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9:active{outline:2px solid var(--brand-03) !important}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9:focus{outline:2px solid var(--brand-03) !important}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9[aria-selected=true]{box-shadow:inset 0 2px 0 0 var(--brand-03) !important}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/tabs/lab-manifest-tabs.scss"],names:[],mappings:"AAsDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,oGAAA,CACA,2GAAA,CCxDF,oDACE,kBAAA,CAGF,uDACE,cAAA,CAGF,mDACE,kBAAA,CAEA,0DACE,4CAAA,CAGF,yDACE,4CAAA,CAGF,uEACE,qDAAA",sourcesContent:["@use '@carbon/layout';\n\n$ui-01: #f4f4f4;\n$ui-02: #ffffff;\n$ui-03: #e0e0e0;\n$ui-04: #8d8d8d;\n$ui-05: #161616;\n$text-02: #525252;\n$text-03: #a8a8a8;\n$ui-background: #ffffff;\n$color-gray-30: #c6c6c6;\n$color-gray-70: #525252;\n$color-gray-100: #161616;\n$color-blue-60-2: #0f62fe;\n$color-blue-10: #edf5ff;\n$color-yellow-50: #feecae;\n$carbon--red-50: #fa4d56;\n$inverse-link: #78a9ff;\n$support-02: #24a148;\n$inverse-support-03: #f1c21b;\n$warning-background: #fff8e1;\n$openmrs-background-grey: #f4f4f4;\n$danger: #da1e28;\n$interactive-01: #0f62fe;\n$field-01: #f4f4f4;\n$grey-2: #e0e0e0;\n$labeldropdown: #c6c6c6;\n\n$brand-primary-10: #d9fbfb;\n$brand-primary-20: #9ef0f0;\n$brand-primary-30: #3ddbd9;\n$brand-primary-40: #08bdba;\n$brand-primary-50: #009d9a;\n\n/* 60,70 and 80 are already declared as brand-01, 02 and 03 respectively */\n\n$brand-primary-90: #022b30;\n$brand-primary-100: #081a1c;\n\n@mixin brand-01($property) {\n #{$property}: #005d5d;\n #{$property}: var(--brand-01);\n}\n\n@mixin brand-02($property) {\n #{$property}: #004144;\n #{$property}: var(--brand-02);\n}\n\n@mixin brand-03($property) {\n #{$property}: #007d79;\n #{$property}: var(--brand-03);\n}\n\n:root {\n --brand-01: #005d5d;\n --brand-02: #004144;\n --brand-03: #007d79;\n --bottom-nav-height: #{layout.$spacing-10};\n --workspace-header-height: #{layout.$spacing-09};\n --tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));\n --desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height));\n}\n\n$breakpoint-phone-min: 0px;\n$breakpoint-phone-max: 600px;\n$breakpoint-tablet-min: 601px;\n$breakpoint-tablet-max: 1023px;\n$breakpoint-small-desktop-min: 1024px;\n$breakpoint-small-desktop-max: 1439px;\n$breakpoint-large-desktop-min: 1440px;\n$breakpoint-large-desktop-max: 99999999px;\n\n/* These color variables will be removed in a future release */\n$brand-teal-01: #007d79;\n$brand-01: #005d5d;\n$brand-02: #004144;\n","@use '@carbon/colors';\n@use '@carbon/styles/scss/spacing';\n@use '@carbon/styles/scss/type';\n@use '~@openmrs/esm-styleguide/src/vars' as *;\n\n.tabs {\n grid-column: span 2;\n}\n\n.tablist {\n padding: 0 spacing.$spacing-05;\n}\n\n.tab {\n min-width: 8.875rem;\n\n &:active {\n outline: 2px solid var(--brand-03) !important;\n }\n\n &:focus {\n outline: 2px solid var(--brand-03) !important;\n }\n\n &[aria-selected='true'] {\n box-shadow: inset 0 2px 0 0 var(--brand-03) !important;\n }\n}\n"],sourceRoot:""}]),o.locals={tabs:"-esm-lab-manifest__lab-manifest-tabs__tabs___GwYzm",tablist:"-esm-lab-manifest__lab-manifest-tabs__tablist___UVTq8",tab:"-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9"};const i=o}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app=globalThis.webpackChunk_kenyaemr_esm_lab_manifest_app||[]).push([[746],{25625:(e,t,n)=>{n.d(t,{A:()=>C});var a=n(75198),r=n(2326),l=n(18282),o=n(85848),i=n(83437),s=n(10570),u=n(90380),c=n.n(u),d=n(93150),m=n(21513),f=n(85216);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}const b=function(e){var t,n,a,r,l=(a=(0,u.useState)(""),r=2,function(e){if(Array.isArray(e))return e}(a)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(a,r)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}(a,r)||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.")}()),o=l[0],s=l[1],c=(0,i.useDebounce)(o,500),d="".concat(i.restBaseUrl,"/labmanifestorder?v=full&manifestuuid=").concat(e,"&q=").concat(c),m=(0,f.Ay)(d,i.openmrsFetch),b=m.data,v=m.isLoading,h=m.error;return m.mutate,{labmanifestOrders:null!==(n=null==b||null===(t=b.data)||void 0===t?void 0:t.results)&&void 0!==n?n:[],searchValue:o,setSearchvalue:s,isLoading:v,error:h}};var v=n(63349),h=n(46696),y=n(89190);const g=function(e){var t=e.patient,n=null!=t?t:{},a=n.display,r=n.uuid;return c().createElement(i.ConfigurableLink,{to:"${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary",templateParams:{patientUuid:r},style:{textDecoration:"none"}},a)};function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function E(e,t,n,a,r,l,o){try{var i=e[l](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(a,r)}function S(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var l=e.apply(t,n);function o(e){E(l,a,r,o,i,"next",e)}function i(e){E(l,a,r,o,i,"throw",e)}o(void 0)}))}}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),a.forEach((function(t){k(e,t,n[t])}))}return e}function T(e,t){var n,a,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(n=1,a&&(r=2&i[0]?a.return:i[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,i[1])).done)return r;switch(a=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,a=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((r=(r=l.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){l.label=i[1];break}if(6===i[0]&&l.label<r[1]){l.label=r[1],r=i;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(i);break}r[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],a=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}const C=function(e){var t,n,f,p=e.manifestUuid,E=(0,m.oA)(p),k=E.error,C=E.isLoading,D=E.manifest,O=b(p),_=O.labmanifestOrders,P=O.setSearchvalue,M=O.searchValue,$=O.isLoading,x=O.error,R=(0,d.useTranslation)().t,I=(n=(0,u.useState)(10),f=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(n,f)||function(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}(n,f)||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.")}()),j=I[0],N=I[1],L=R("labManifestSamples","Lab Manifest Samples"),B=(0,i.usePagination)(_,j),U=B.results,q=B.totalPages,z=B.currentPage,F=B.goTo,H=(0,s.WK)(j,q,z,U.length).pageSizes,K=[{header:R("patient","Patient"),key:"patientName"},{header:R("cccKDODNumber","CCC/KDOD Number"),key:"cccKDODNumber"},{header:R("batchNumber","Batch Number"),key:"batchNumber"},{header:R("sampleType","Sample type"),key:"sampleType"},{header:R("status","Status"),key:"status"},{header:R("dateRequested","Date Requested"),key:"dateRequested",isSortable:!0},{header:R("resultDate","Result Date"),key:"resultDate",isSortable:!0},{header:R("result","Result"),key:"result"},{header:R("actions","Actions"),key:"actions"}],G=null!==(t=null==U?void 0:U.map((function(e){var t,n,o,s,u,d,m;return{id:"".concat(e.uuid),sampleType:null!==(u=e.sampleType)&&void 0!==u?u:"--",status:e.status,batchNumber:null!==(d=e.batchNumber)&&void 0!==d?d:"--",patientName:c().createElement(g,{patient:null==e||null===(t=e.order)||void 0===t?void 0:t.patient}),cccKDODNumber:(null==e||null===(n=e.order)||void 0===n?void 0:n.patient)?c().createElement(y.A,{patientUuid:null==e||null===(s=e.order)||void 0===s||null===(o=s.patient)||void 0===o?void 0:o.uuid}):"--",dateRequested:e.dateSent?(0,i.formatDate)((0,i.parseDate)(e.dateSent)):"--",resultDate:e.resultDate?(0,i.formatDate)((0,i.parseDate)(e.resultDate)):"--",result:null!==(m=e.result)&&void 0!==m?m:"--",actions:c().createElement(a.ButtonSet,{className:h.A.btnSet},v.nY.includes(null==D?void 0:D.manifestStatus)&&c().createElement(a.Button,{renderIcon:r.zH,className:h.A.btn,hasIconOnly:!0,kind:"ghost",iconDescription:R("removeFromManifest","Remove from Manifest"),onClick:function(){return t=e.uuid,void(n=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return n()},samples:_.filter((function(e){return e.uuid===t})),onDelete:function(){return S((function(){var e,a,r,l,o,s;return T(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,(0,v.zg)(t)];case 1:return u.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),n(),(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:R("sampleRemoveSuccess","Sample removed from manifest successfully!")}),[3,3];case 2:return e=u.sent(),l=_.find((function(e){return e.uuid===t})),(0,i.showSnackbar)({title:R("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(o=l.id)&&void 0!==o?o:null==l?void 0:l.uuid}),kind:"error",subtitle:"".concat(null!==(s=null==e||null===(r=e.responseBody)||void 0===r||null===(a=r.error)||void 0===a?void 0:a.message)&&void 0!==s?s:null==e?void 0:e.message," ")}),[3,3];case 3:return[2]}}))}))()}}));var t,n}}),c().createElement(a.Button,{className:h.A.btn,renderIcon:l.xj,hasIconOnly:!0,kind:"ghost",iconDescription:R("printSpecimenLabel","Print Specimen Label"),onClick:function(){return function(e){return S((function(){return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,v.sN)(e.uuid)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,i.showSnackbar)({title:"Failure",subtitle:"Error specimen label",kind:"error"}),[3,3];case 3:return[2]}}))}))()}(e)}}))}})))&&void 0!==t?t:[];return C||$?c().createElement(a.DataTableSkeleton,{rowCount:5}):k||x?c().createElement(i.ErrorState,{headerTitle:L,error:k}):0===_.length?c().createElement(s.pp,{headerTitle:R("manifestSamples","Manifest Samples"),displayText:R("labManifestSamples","Lab manifest samples")}):c().createElement("div",{className:h.A.widgetContainer},c().createElement(a.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=G?G:[],headers:K,render:function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,l=e.getRowProps,u=e.getSelectionProps,d=e.getTableProps,m=e.getTableContainerProps,f=e.selectedRows;return c().createElement(c().Fragment,null,c().createElement(s.aR,{title:L},c().createElement(a.Button,{onClick:function(){var e=f.map((function(e){var t=e.id;return _.find((function(e){return e.uuid===t}))}));!function(e){if(e.length>0)var t=(0,i.showModal)("sample-delete-confirm-dialog",{onClose:function(){return t()},samples:e,onDelete:function(){return S((function(){var n;return T(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,Promise.allSettled(e.map((function(e){var t=e.uuid;return(0,v.zg)(t)})))];case 1:return n=a.sent(),(0,v.BV)(null==D?void 0:D.uuid,null==D?void 0:D.manifestStatus),t(),n.forEach((function(t,n){var a,r,l,o,s,u,c=e[n];"rejected"===t.status?(0,i.showSnackbar)({title:R("errorRemovingSample","Error removing sample {{sample}} from the manifest",{sample:null!==(s=c.id)&&void 0!==s?s:c.uuid}),kind:"error",subtitle:"".concat(null!==(u=null===(l=t.reason)||void 0===l||null===(r=l.responseBody)||void 0===r||null===(a=r.error)||void 0===a?void 0:a.message)&&void 0!==u?u:null===(o=t.reason)||void 0===o?void 0:o.message," ")}):(0,i.showSnackbar)({title:"Success",kind:"success",subtitle:"Sample removed from manifest successfully!"})})),[3,3];case 2:return a.sent(),(0,i.showSnackbar)({title:"Failure",kind:"error",subtitle:"Error removing sample from the manifest"}),[3,3];case 3:return[2]}}))}))()}})}(e)},renderIcon:o.Qp,kind:"ghost"},R("deleteSelectedSamples","Remove Selected Samples"))),c().createElement(a.Search,{labelText:"",value:M,onChange:function(e){var t=e.target.value;return P(t)}}),c().createElement(a.TableContainer,m(),c().createElement(a.Table,d(),c().createElement(a.TableHead,null,c().createElement(a.TableRow,null,c().createElement(a.TableSelectAll,u()),n.map((function(e,t){return c().createElement(a.TableHeader,A({key:t},r({header:e,isSortable:!0})),e.header)})))),c().createElement(a.TableBody,null,t.map((function(e,t){return c().createElement(a.TableRow,(n=A({key:t},l({row:e})),r=null!=(r={onClick:function(e){}})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n),c().createElement(a.TableSelectRow,u({row:e})),e.cells.map((function(e){return c().createElement(a.TableCell,{key:e.id},e.value)})));var n,r}))))))}}),c().createElement(a.Pagination,{page:z,pageSize:j,pageSizes:H,totalItems:_.length,onChange:function(e){var t=e.page,n=e.pageSize;F(t),N(n)}}))}},74746:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ne});var a=n(90380),r=n.n(a),l=n(8877),o=n(75198),i=n(85848),s=n(83437),u=n(93150),c=n(32588),d=n(10570),m=n(63349),f=n(94897);const p=function(e){var t=e.title,n=e.onFilterChange,a=e.filter,l=(0,u.useTranslation)().t;return r().createElement(d.aR,{title:t},r().createElement("div",{className:f.A.statusFilterContainer},r().createElement(o.Dropdown,{className:f.A.statusFilter,id:"manifestStatus",onChange:function(e){var t=e.selectedItem;n(m.Ou.find((function(e){return e.value===t})).params)},initialSelectedItem:m.Ou.find((function(e){return e.params===a})).value,label:l("selectManifestStatus","Select manifest status"),items:m.Ou.map((function(e){return e.value})),itemToString:function(e){var t,n;return null!==(n=null===(t=m.Ou.find((function(t){return t.value===e})))||void 0===t?void 0:t.label)&&void 0!==n?n:""},titleText:""})))};var b=n(21513),v=n(46696);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function y(e,t,n,a,r,l,o){try{var i=e[l](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(a,r)}function g(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function w(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 a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(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)?h(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 E=function(){var e,t,n=(0,u.useTranslation)().t,l=w((0,a.useState)(10),2),i=l[0],c=l[1],f=w((0,a.useState)("Draft"),2),h=f[0],E=f[1],S=n("lab Manifest","Lab Manifest"),k=(0,s.useLayoutType)(),A=(0,b.Zl)(h),T=A.manifests,C=A.error,D=A.isLoading,O=(0,s.usePagination)(T,i),_=O.results,P=O.totalPages,M=O.currentPage,$=O.goTo,x=(0,d.WK)(i,P,M,_.length).pageSizes,R=(0,s.useConfig)().labmanifestTypes,I="tablet"===k?"lg":"md",j=(0,a.useMemo)((function(){return[{header:n("startDate","Start date"),key:"startDate",isSortable:!0},{header:n("endDate","End date"),key:"endDate",isSortable:!0},{header:n("type","Type"),key:"type",isSortable:!0},{header:n("courrier","Courrier"),key:"courrier"},{header:n("manifestId","Manifest Id"),key:"manifestId"},{header:n("labPersonContact","Lab person contact"),key:"labPersonContact"},{header:n("status","Status"),key:"status"},{header:n("dispatch","Dispatch"),key:"dispatch",isSortable:!0},{header:n("samples","Samples"),key:"samples"},{header:n("actions","Actions"),key:"actions"}]}),[n]),N=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(t=function(){return function(e,t){var n,a,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(n=1,a&&(r=2&i[0]?a.return:i[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,i[1])).done)return r;switch(a=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,a=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((r=(r=l.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){l.label=i[1];break}if(6===i[0]&&l.label<r[1]){l.label=r[1],r=i;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(i);break}r[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],a=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,m.L7)(e.uuid,n)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,s.showSnackbar)({title:"Failure",subtitle:"Error printing manifest",kind:"error"}),[3,3];case 3:return[2]}}))},function(){var e=this,n=arguments;return new Promise((function(a,r){var l=t.apply(e,n);function o(e){y(l,a,r,o,i,"next",e)}function i(e){y(l,a,r,o,i,"throw",e)}o(void 0)}))})()},L=(0,a.useCallback)((function(e){var t=(0,s.showModal)("lab-manifest-requeue-confirn-modal",{labManifest:e,onClose:function(){return t()},filter:h})}),[h]),B=(0,a.useMemo)((function(){var e;return(null!==(e=null==_?void 0:_.map((function(e){var t,a,l,i,u;return{id:"".concat(e.uuid),startDate:(0,s.parseDate)(e.startDate),endDate:e.endDate?(0,s.parseDate)(e.endDate):"--",courrier:e.courierName?e.courierName:"--",labPersonContact:null!==(a=e.labPersonContact)&&void 0!==a?a:"--",type:null!==(l=null===(t=R.find((function(t){return"".concat(t.id)===(null==e?void 0:e.manifestType)})))||void 0===t?void 0:t.type)&&void 0!==l?l:"--",status:null!==(i=e.manifestStatus)&&void 0!==i?i:"--",dispatch:e.dispatchDate?(0,s.parseDate)(e.dispatchDate):"--",manifestId:null!==(u=e.manifestId)&&void 0!==u?u:"--",samples:"".concat(e.samples.length),actions:r().createElement(o.OverflowMenu,{flipped:!0,size:I,"aria-label":"overflow-menu"},r().createElement(o.OverflowMenuItem,{itemText:n("viewManifest","View Manifest"),onClick:function(){return t=e.uuid,void(0,s.navigate)({to:window.getOpenmrsSpaBase()+"home/lab-manifest/".concat(t)});var t}}),m.uV.includes(e.manifestStatus)&&r().createElement(o.OverflowMenuItem,{itemText:n("editmanifest","Edit Manifest"),onClick:function(){return function(e){(0,s.launchWorkspace)("lab-manifest-form",{workspaceTitle:"Lab Manifest Form",manifest:e})}(e)}}),m.BR.includes(e.manifestStatus)&&r().createElement(r().Fragment,null,r().createElement(o.OverflowMenuItem,{itemText:n("printManifest","Print Manifest"),onClick:function(){return N(e)}}),r().createElement(o.OverflowMenuItem,{itemText:n("printManifestLog","Print Manifest Log"),onClick:function(){return N(e,!0)}})),m.fI.includes(e.manifestStatus)&&r().createElement(o.OverflowMenuItem,{itemText:n("requeueManifest","Requeue Manifest"),onClick:function(){return L(e)}}))}})))&&void 0!==e?e:[]).sort((function(e,t){return t.startDate.getTime()-e.startDate.getTime()}))}),[_,L,R,I,n]);return D?r().createElement(o.DataTableSkeleton,{rowCount:5}):C?r().createElement(s.ErrorState,{headerTitle:S,error:C}):0===T.length?r().createElement(o.Layer,{className:v.A.tile},r().createElement(p,{filter:h,onFilterChange:E,title:S}),r().createElement(o.Tile,null,r().createElement(d.K0,null),r().createElement("p",{className:v.A.content},n("notLabManifetToDisplay","There are no {{status}} lab manifets data to display.",{status:null!==(t=null===(e=m.Ou.find((function(e){return e.params===h})))||void 0===e?void 0:e.label)&&void 0!==t?t:""})))):r().createElement("div",{className:v.A.widgetContainer},r().createElement(p,{filter:h,onFilterChange:E,title:S}),r().createElement(o.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=B?B:[],sortRow:function(e,t,n){var a=n.sortDirection,r=n.sortStates,l=n.locale,o=(n.key,n.compare),i=g(e,Date)?e.getTime():e,s=g(t,Date)?t.getTime():t;return a===r.DESC?o(s,i,l):o(i,s,l)},headers:j,render:function(e){var t=e.rows,n=e.headers,a=e.getHeaderProps,l=e.getTableProps,i=e.getTableContainerProps;return r().createElement(o.TableContainer,i(),r().createElement(o.Table,l(),r().createElement(o.TableHead,null,r().createElement(o.TableRow,null,n.map((function(e){return r().createElement(o.TableHeader,a({header:e,isSortable:!0}),e.header)})))),r().createElement(o.TableBody,null,t.map((function(e){return r().createElement(o.TableRow,{key:e.id},e.cells.map((function(e){var t=g(e.value,Date)?(0,s.formatDate)(e.value):e.value;return r().createElement(o.TableCell,{key:e.id},t)})))})))))}}),r().createElement(o.Pagination,{page:M,pageSize:i,pageSizes:x,totalItems:T.length,onChange:function(e){var t=e.page,n=e.pageSize;$(t),c(n)}}))};var S=n(1089);const k=function(){var e=(0,u.useTranslation)().t;return r().createElement("div",{className:"omrs-main-content"},r().createElement(c.a,{title:e("labManifestDashboard","Lab Manifest Dashboard")}),r().createElement(o.Layer,{className:S.A.btnLayer},r().createElement(o.Button,{kind:"ghost",renderIcon:i.OM,iconDescription:e("addNewManifest","Add new Manifest"),onClick:function(){(0,s.launchWorkspace)("lab-manifest-form",{workspaceTitle:"Lab Manifest Form"})}},e("addNewManifest","Add new Manifest"))),r().createElement(E,null))};var A=n(68622),T=n(95795),C=n(18282);function D(e,t,n,a,r,l,o){try{var i=e[l](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(a,r)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var l=e.apply(t,n);function o(e){D(l,a,r,o,i,"next",e)}function i(e){D(l,a,r,o,i,"throw",e)}o(void 0)}))}}function _(e,t){var n,a,r,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(n=1,a&&(r=2&i[0]?a.return:i[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,i[1])).done)return r;switch(a=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,a=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!((r=(r=l.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){l.label=i[1];break}if(6===i[0]&&l.label<r[1]){l.label=r[1],r=i;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(i);break}r[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],a=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}const P=function(e){var t=e.manifestUuid,n=(0,b.oA)(t),a=n.isLoading,l=n.manifest,c=n.mutate,d=(0,u.useTranslation)().t,p=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return O((function(){return _(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,m.L7)(l.uuid,e)];case 1:return t.sent(),[3,3];case 2:return t.sent(),(0,s.showSnackbar)({title:"Failure",subtitle:"Error printing manifest",kind:"error"}),[3,3];case 3:return[2]}}))}))()};return a?r().createElement(o.Layer,{className:f.A.detailHeaderContainer},r().createElement(o.Tile,{className:f.A.detailHeaderContentLoading},r().createElement(o.Row,{className:f.A.detailHeaderContentRow},Array.from({length:8}).map((function(e,t){return r().createElement(o.SkeletonText,{key:t})}))),r().createElement("hr",null),r().createElement(o.Row,{className:f.A.detailHeaderContentRow},r().createElement(o.SkeletonText,null),r().createElement(o.SkeletonText,null)))):r().createElement(o.Layer,{className:f.A.detailHeaderContainer},r().createElement(o.Tile,{className:f.A.detailHeaderContent},r().createElement(o.Row,{className:f.A.detailHeaderContentRow},r().createElement("span",null,"Start date:"),r().createElement("strong",null,l.startDate?(0,s.formatDate)((0,s.parseDate)(l.startDate)):"--"),r().createElement("span",null,"End date:"),r().createElement("strong",null,l.endDate?(0,s.formatDate)((0,s.parseDate)(l.endDate)):"--"),r().createElement("span",null,"Status:"),r().createElement("strong",null,l.manifestStatus),r().createElement("span",null,"Dispatch date:"),r().createElement("strong",null,l.dispatchDate?(0,s.formatDate)((0,s.parseDate)(l.dispatchDate)):"--")),r().createElement("hr",null),r().createElement(o.Row,{className:f.A.detailHeaderContentRow},r().createElement("span",null,"Total Samples in the Manifest"),r().createElement("span",{className:f.A.samplesCountValue},l.samples.length))),r().createElement(o.Row,{className:f.A.btnSet},r().createElement(o.Button,{kind:"tertiary",renderIcon:i.nk,onClick:function(){(0,s.navigate)({to:window.getOpenmrsSpaBase()+"home/lab-manifest"})}},d("back","Back")),r().createElement(o.Row,{className:f.A.btnSetRight},m.uV.includes(l.manifestStatus)&&r().createElement(o.Button,{kind:"primary",renderIcon:A.ff,onClick:function(){(0,s.launchWorkspace)("lab-manifest-form",{workspaceTitle:"Lab Manifest Form",manifest:l})},size:"md"},d("editManifest","Edit Manifest")),m.fI.includes(l.manifestStatus)&&r().createElement(o.Button,{kind:"tertiary",renderIcon:T.cF,onClick:function(){var e=(0,s.showModal)("lab-manifest-requeue-confirn-modal",{labManifest:l,onClose:function(){e(),c()},filter:l.manifestStatus})},size:"md"},d("requeueManifest","Requeue Manifest")),m.BR.includes(l.manifestStatus)&&r().createElement(r().Fragment,null,r().createElement(o.Button,{kind:"tertiary",renderIcon:C.xj,onClick:function(){return O((function(){return _(this,(function(e){switch(e.label){case 0:return[4,p(!1)];case 1:return[2,e.sent()]}}))}))()},size:"md"},d("printManifest","Print Manifest")),r().createElement(o.Button,{kind:"tertiary",renderIcon:C.xj,onClick:function(){return O((function(){return _(this,(function(e){switch(e.label){case 0:return[4,p(!0)];case 1:return[2,e.sent()]}}))}))()},size:"md"},d("printManifestLog","Print Manifest log"))))))};var M=n(85216);var $=n(89190);function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),a.forEach((function(t){R(e,t,n[t])}))}return e}const j=function(e){var t,n,l,c,m,f,p=e.manifestUuid,b=function(e){var t="".concat(s.restBaseUrl,"/kemrorder/validorders?manifestUuid=").concat(e),n=(0,M.Ay)(t,s.openmrsFetch),a=n.isLoading,r=n.error,l=n.data;return{isLoading:a,request:null==l?void 0:l.data,error:r}}(p),h=b.error,y=b.isLoading,g=b.request,w=(0,u.useTranslation)().t,E=(m=(0,a.useState)(10),f=2,function(e){if(Array.isArray(e))return e}(m)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,l=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw r}}return l}}(m,f)||function(e,t){if(e){if("string"==typeof e)return x(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)?x(e,t):void 0}}(m,f)||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=E[0],k=E[1],A=w("activeRequests","Active Requests"),T=(0,s.usePagination)(null!==(t=null==g?void 0:g.Orders)&&void 0!==t?t:[],S),C=T.results,D=T.totalPages,O=T.currentPage,_=T.goTo,P=(0,d.WK)(S,D,O,C.length).pageSizes,R=[{header:w("patientName","Patient name"),key:"patientName"},{header:w("cccKDODNumber","CCC/KDOD Number"),key:"cccKdod"},{header:w("dateRequested","Date Requested"),key:"dateRequested",isSortable:!0},{header:w("actions","Actions"),key:"actions"}],j=function(e){if(e.length>0)var t=g.Orders.filter((function(t){return e.some((function(e){return e.order.uuid===t.orderUuid}))})),n=(0,s.showModal)("lab-manifest-order-modal-form",{onClose:function(){return n()},props:{title:e.length>1?"Add Multiple Orders To Manifest":void 0,selectedOrders:e,orders:t}})},N=null!==(n=null==C?void 0:C.map((function(e){var t,n;return{id:"".concat(e.orderUuid),patientName:e.patientName?r().createElement(s.ConfigurableLink,{to:"${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary",templateParams:{patientUuid:e.patientUuid},style:{textDecoration:"none"}},e.patientName):"--",cccKdod:(null===(n=e.cccKdod)||void 0===n||null===(t=n.trim())||void 0===t?void 0:t.replaceAll(" ",""))?e.cccKdod:(null==e?void 0:e.patientUuid)?r().createElement($.A,{patientUuid:null==e?void 0:e.patientUuid}):"--",dateRequested:e.dateRequested,actions:r().createElement(o.Button,{kind:"ghost",iconDescription:w("addToManifest","Add To manifest"),renderIcon:i.OM,hasIconOnly:!0,onClick:function(){return j([{labManifest:{uuid:p},order:{uuid:e.orderUuid},payload:e.payload}])}},"Add To manifest")}})))&&void 0!==n?n:[];return y?r().createElement(o.DataTableSkeleton,{rowCount:5}):h?r().createElement(s.ErrorState,{headerTitle:A,error:h}):0===(null!==(l=null==g?void 0:g.Orders)&&void 0!==l?l:[]).length?r().createElement(d.pp,{headerTitle:w("activeRequests","Active Requests"),displayText:w("notLabManifetToDisplay","There is no lab manifets data to display.")}):r().createElement("div",{className:v.A.widgetContainer},r().createElement(o.DataTable,{useZebraStyles:!0,size:"sm",rows:null!=N?N:[],headers:R,render:function(e){var t=e.rows,n=e.headers,a=e.getHeaderProps,l=e.getRowProps,s=e.getSelectionProps,u=e.getTableProps,c=e.getTableContainerProps,m=e.selectedRows;return r().createElement(r().Fragment,null,r().createElement(d.aR,{title:A},r().createElement(o.Button,{onClick:function(){var e=m.map((function(e){var t,n,a=e.id;return{labManifest:{uuid:p},order:{uuid:a},payload:null!==(n=null===(t=g.Orders.find((function(e){return e.orderUuid===a})))||void 0===t?void 0:t.payload)&&void 0!==n?n:""}}));j(e)},renderIcon:i.Qp,kind:"ghost"},w("addSelectedSamples","Add Selected Samples"))),r().createElement(o.TableContainer,c(),r().createElement(o.Table,u(),r().createElement(o.TableHead,null,r().createElement(o.TableRow,null,r().createElement(o.TableSelectAll,s()),n.map((function(e,t){return r().createElement(o.TableHeader,I({key:t},a({header:e,isSortable:!0})),e.header)})))),r().createElement(o.TableBody,null,t.map((function(e,t){return r().createElement(o.TableRow,(n=I({key:t},l({row:e})),a=null!=(a={onClick:function(e){}})?a:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(a)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))})),n),r().createElement(o.TableSelectRow,s({row:e})),e.cells.map((function(e){return r().createElement(o.TableCell,{key:e.id},e.value)})));var n,a}))))))}}),r().createElement(o.Pagination,{page:O,pageSize:S,pageSizes:P,totalItems:(null!==(c=null==g?void 0:g.Orders)&&void 0!==c?c:[]).length,onChange:function(e){var t=e.page,n=e.pageSize;_(t),k(n)}}))};var N=n(25625),L=n(72591),B=n.n(L),U=n(1740),q=n.n(U),z=n(88128),F=n.n(z),H=n(30855),K=n.n(H),G=n(93051),V=n.n(G),W=n(73656),Z=n.n(W),Y=n(92091),Q={};Q.styleTagTransform=Z(),Q.setAttributes=K(),Q.insert=F().bind(null,"head"),Q.domAPI=q(),Q.insertStyleElement=V(),B()(Y.A,Q);const J=Y.A&&Y.A.locals?Y.A.locals:void 0;var X=function(e){var t=e.manifestUuid,n=(0,u.useTranslation)().t,a=(0,b.oA)(t),l=a.manifest,i=a.isLoading,s=a.error;return i?r().createElement(o.StructuredListSkeleton,null):s?r().createElement(d.W5,{error:s,headerTitle:n("labManifestSamples","Lab Manifest Sample")}):m.Iu.includes(l.manifestStatus)?r().createElement("main",{className:J.tabs},r().createElement(o.Tabs,null,r().createElement(o.TabList,{className:J.tablist,"aria-label":"List tabs",contained:!0},r().createElement(o.Tab,{className:J.tab},n("manifestSamples","ManifestSamples")),r().createElement(o.Tab,{className:J.tab},n("activeRequests","Active Requests"))),r().createElement(o.TabPanels,null,r().createElement(o.TabPanel,null,r().createElement(N.A,{manifestUuid:t})),r().createElement(o.TabPanel,null,r().createElement(j,{manifestUuid:t}))))):r().createElement(N.A,{manifestUuid:t})};const ee=function(){var e=(0,l.useParams)().manifestUuid,t=(0,u.useTranslation)().t;return r().createElement("div",null,r().createElement(c.a,{title:t("labManifest","Lab Manifest")}),r().createElement(P,{manifestUuid:e}),r().createElement(X,{manifestUuid:e}))};var te=n(58449);const ne=function(){var e=window.getOpenmrsSpaBase()+"home/lab-manifest";return r().createElement(l.BrowserRouter,{basename:e},r().createElement(l.Routes,null,r().createElement(l.Route,{path:"/",element:r().createElement(k,null)}),r().createElement(l.Route,{path:"/overview",element:r().createElement(te.default,null)}),r().createElement(l.Route,{path:"/:manifestUuid",element:r().createElement(ee,null)})))}},92091:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(30977),r=n.n(a),l=n(95924),o=n.n(l)()(r());o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-lab-manifest__lab-manifest-tabs__tabs___GwYzm{grid-column:span 2}.-esm-lab-manifest__lab-manifest-tabs__tablist___UVTq8{padding:0 1rem}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9{min-width:8.875rem}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9:active{outline:2px solid var(--brand-03) !important}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9:focus{outline:2px solid var(--brand-03) !important}.-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9[aria-selected=true]{box-shadow:inset 0 2px 0 0 var(--brand-03) !important}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/tabs/lab-manifest-tabs.scss"],names:[],mappings:"AAsDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,oGAAA,CACA,2GAAA,CCxDF,oDACE,kBAAA,CAGF,uDACE,cAAA,CAGF,mDACE,kBAAA,CAEA,0DACE,4CAAA,CAGF,yDACE,4CAAA,CAGF,uEACE,qDAAA",sourcesContent:["@use '@carbon/layout';\n\n$ui-01: #f4f4f4;\n$ui-02: #ffffff;\n$ui-03: #e0e0e0;\n$ui-04: #8d8d8d;\n$ui-05: #161616;\n$text-02: #525252;\n$text-03: #a8a8a8;\n$ui-background: #ffffff;\n$color-gray-30: #c6c6c6;\n$color-gray-70: #525252;\n$color-gray-100: #161616;\n$color-blue-60-2: #0f62fe;\n$color-blue-10: #edf5ff;\n$color-yellow-50: #feecae;\n$carbon--red-50: #fa4d56;\n$inverse-link: #78a9ff;\n$support-02: #24a148;\n$inverse-support-03: #f1c21b;\n$warning-background: #fff8e1;\n$openmrs-background-grey: #f4f4f4;\n$danger: #da1e28;\n$interactive-01: #0f62fe;\n$field-01: #f4f4f4;\n$grey-2: #e0e0e0;\n$labeldropdown: #c6c6c6;\n\n$brand-primary-10: #d9fbfb;\n$brand-primary-20: #9ef0f0;\n$brand-primary-30: #3ddbd9;\n$brand-primary-40: #08bdba;\n$brand-primary-50: #009d9a;\n\n/* 60,70 and 80 are already declared as brand-01, 02 and 03 respectively */\n\n$brand-primary-90: #022b30;\n$brand-primary-100: #081a1c;\n\n@mixin brand-01($property) {\n #{$property}: #005d5d;\n #{$property}: var(--brand-01);\n}\n\n@mixin brand-02($property) {\n #{$property}: #004144;\n #{$property}: var(--brand-02);\n}\n\n@mixin brand-03($property) {\n #{$property}: #007d79;\n #{$property}: var(--brand-03);\n}\n\n:root {\n --brand-01: #005d5d;\n --brand-02: #004144;\n --brand-03: #007d79;\n --bottom-nav-height: #{layout.$spacing-10};\n --workspace-header-height: #{layout.$spacing-09};\n --tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));\n --desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height));\n}\n\n$breakpoint-phone-min: 0px;\n$breakpoint-phone-max: 600px;\n$breakpoint-tablet-min: 601px;\n$breakpoint-tablet-max: 1023px;\n$breakpoint-small-desktop-min: 1024px;\n$breakpoint-small-desktop-max: 1439px;\n$breakpoint-large-desktop-min: 1440px;\n$breakpoint-large-desktop-max: 99999999px;\n\n/* These color variables will be removed in a future release */\n$brand-teal-01: #007d79;\n$brand-01: #005d5d;\n$brand-02: #004144;\n","@use '@carbon/colors';\n@use '@carbon/styles/scss/spacing';\n@use '@carbon/styles/scss/type';\n@use '~@openmrs/esm-styleguide/src/vars' as *;\n\n.tabs {\n grid-column: span 2;\n}\n\n.tablist {\n padding: 0 spacing.$spacing-05;\n}\n\n.tab {\n min-width: 8.875rem;\n\n &:active {\n outline: 2px solid var(--brand-03) !important;\n }\n\n &:focus {\n outline: 2px solid var(--brand-03) !important;\n }\n\n &[aria-selected='true'] {\n box-shadow: inset 0 2px 0 0 var(--brand-03) !important;\n }\n}\n"],sourceRoot:""}]),o.locals={tabs:"-esm-lab-manifest__lab-manifest-tabs__tabs___GwYzm",tablist:"-esm-lab-manifest__lab-manifest-tabs__tablist___UVTq8",tab:"-esm-lab-manifest__lab-manifest-tabs__tab___L4lu9"};const i=o}}]);
|